summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src')
-rw-r--r--src/3rdparty/angle/src/common/Color.h53
-rw-r--r--src/3rdparty/angle/src/common/Color.inl37
-rw-r--r--src/3rdparty/angle/src/common/Float16ToFloat32.cpp2205
-rw-r--r--src/3rdparty/angle/src/common/MemoryBuffer.cpp155
-rw-r--r--src/3rdparty/angle/src/common/MemoryBuffer.h77
-rw-r--r--src/3rdparty/angle/src/common/Optional.h68
-rw-r--r--src/3rdparty/angle/src/common/angleutils.cpp74
-rw-r--r--src/3rdparty/angle/src/common/angleutils.h253
-rw-r--r--src/3rdparty/angle/src/common/bitset_utils.h498
-rw-r--r--src/3rdparty/angle/src/common/debug.cpp220
-rw-r--r--src/3rdparty/angle/src/common/debug.h286
-rw-r--r--src/3rdparty/angle/src/common/event_tracer.cpp55
-rw-r--r--src/3rdparty/angle/src/common/event_tracer.h26
-rw-r--r--src/3rdparty/angle/src/common/mathutil.cpp73
-rw-r--r--src/3rdparty/angle/src/common/mathutil.h1145
-rw-r--r--src/3rdparty/angle/src/common/matrix_utils.h386
-rw-r--r--src/3rdparty/angle/src/common/platform.h103
-rw-r--r--src/3rdparty/angle/src/common/string_utils.cpp213
-rw-r--r--src/3rdparty/angle/src/common/string_utils.h85
-rw-r--r--src/3rdparty/angle/src/common/system_utils.h27
-rw-r--r--src/3rdparty/angle/src/common/system_utils_linux.cpp89
-rw-r--r--src/3rdparty/angle/src/common/system_utils_mac.cpp94
-rw-r--r--src/3rdparty/angle/src/common/system_utils_win.cpp79
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/README.angle27
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/base_export.h13
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/containers/mru_cache.h275
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/logging.h26
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/macros.h17
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/OWNERS3
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_conversions.h179
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_conversions_impl.h274
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_math.h329
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_math_impl.h575
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_numerics_unittest.cc771
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/sha1.cc245
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/sha1.h36
-rw-r--r--src/3rdparty/angle/src/common/third_party/base/anglebase/sys_byteorder.h49
-rw-r--r--src/3rdparty/angle/src/common/third_party/smhasher/LICENSE23
-rw-r--r--src/3rdparty/angle/src/common/third_party/smhasher/README.angle14
-rw-r--r--src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp321
-rw-r--r--src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.h59
-rw-r--r--src/3rdparty/angle/src/common/tls.cpp156
-rw-r--r--src/3rdparty/angle/src/common/tls.h46
-rw-r--r--src/3rdparty/angle/src/common/uniform_type_info_autogen.cpp275
-rw-r--r--src/3rdparty/angle/src/common/utilities.cpp1071
-rw-r--r--src/3rdparty/angle/src/common/utilities.h173
-rw-r--r--src/3rdparty/angle/src/common/vector_utils.h523
-rw-r--r--src/3rdparty/angle/src/common/version.h28
-rw-r--r--src/3rdparty/angle/src/compiler/fuzz/translator_fuzzer.cpp179
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp143
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h90
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.cpp16
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.h43
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp1000
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.h83
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.h43
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y462
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Input.cpp129
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Input.h54
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Lexer.cpp16
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Lexer.h27
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp44
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Macro.h50
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp481
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.h83
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp107
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.h60
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/SourceLocation.h39
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Token.cpp80
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Token.h109
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.h58
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l384
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h72
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ASTMetadataHLSL.cpp462
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ASTMetadataHLSL.h63
-rw-r--r--src/3rdparty/angle/src/compiler/translator/AddAndTrueToLoopCondition.cpp59
-rw-r--r--src/3rdparty/angle/src/compiler/translator/AddAndTrueToLoopCondition.h20
-rw-r--r--src/3rdparty/angle/src/compiler/translator/AddDefaultReturnStatements.cpp58
-rw-r--r--src/3rdparty/angle/src/compiler/translator/AddDefaultReturnStatements.h22
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ArrayReturnValueToOutParameter.cpp213
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ArrayReturnValueToOutParameter.h22
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BaseTypes.h1073
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BreakVariableAliasingInInnerLoops.cpp107
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BreakVariableAliasingInInnerLoops.h23
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp355
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h183
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp293
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorGLSL.h40
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp184
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorHLSL.h27
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Cache.cpp99
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Cache.h84
-rw-r--r--src/3rdparty/angle/src/compiler/translator/CallDAG.cpp346
-rw-r--r--src/3rdparty/angle/src/compiler/translator/CallDAG.h79
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ClampPointSize.cpp47
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ClampPointSize.h22
-rw-r--r--src/3rdparty/angle/src/compiler/translator/CodeGen.cpp75
-rw-r--r--src/3rdparty/angle/src/compiler/translator/CollectVariables.cpp869
-rw-r--r--src/3rdparty/angle/src/compiler/translator/CollectVariables.h37
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Common.h138
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Compiler.cpp1169
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Compiler.h308
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ConstantUnion.cpp681
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ConstantUnion.h117
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.cpp221
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h48
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DeferGlobalInitializers.cpp147
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DeferGlobalInitializers.h32
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Diagnostics.cpp105
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Diagnostics.h67
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DirectiveHandler.cpp203
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DirectiveHandler.h57
-rw-r--r--src/3rdparty/angle/src/compiler/translator/EmulateGLFragColorBroadcast.cpp129
-rw-r--r--src/3rdparty/angle/src/compiler/translator/EmulateGLFragColorBroadcast.h31
-rw-r--r--src/3rdparty/angle/src/compiler/translator/EmulatePrecision.cpp751
-rw-r--r--src/3rdparty/angle/src/compiler/translator/EmulatePrecision.h73
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ExpandIntegerPowExpressions.cpp153
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ExpandIntegerPowExpressions.h29
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.cpp96
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.h60
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ExtensionGLSL.cpp105
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ExtensionGLSL.h44
-rw-r--r--src/3rdparty/angle/src/compiler/translator/FindMain.cpp38
-rw-r--r--src/3rdparty/angle/src/compiler/translator/FindMain.h23
-rw-r--r--src/3rdparty/angle/src/compiler/translator/FindSymbolNode.cpp58
-rw-r--r--src/3rdparty/angle/src/compiler/translator/FindSymbolNode.h27
-rw-r--r--src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.cpp75
-rw-r--r--src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.h30
-rw-r--r--src/3rdparty/angle/src/compiler/translator/HashNames.cpp72
-rw-r--r--src/3rdparty/angle/src/compiler/translator/HashNames.h28
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ImageFunctionHLSL.cpp304
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ImageFunctionHLSL.h76
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InfoSink.cpp40
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InfoSink.h120
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Initialize.cpp1135
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Initialize.h38
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeDll.cpp37
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeDll.h15
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeGlobals.h13
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp290
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeVariables.h53
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermNode.cpp3330
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermNode.h917
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermNodePatternMatcher.cpp157
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermNodePatternMatcher.h75
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermNode_util.cpp254
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermNode_util.h60
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp983
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermTraverse.h355
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IsASTDepthBelowLimit.cpp51
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IsASTDepthBelowLimit.h20
-rw-r--r--src/3rdparty/angle/src/compiler/translator/NodeSearch.h56
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Operator.cpp385
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Operator.h255
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputESSL.cpp47
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputESSL.h37
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSL.cpp110
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSL.h36
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp1357
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h122
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp3084
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputHLSL.h248
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputTree.cpp682
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputTree.h22
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputVulkanGLSL.cpp80
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputVulkanGLSL.h34
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ParamType.h102
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ParseContext.cpp6022
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ParseContext.h657
-rw-r--r--src/3rdparty/angle/src/compiler/translator/PoolAlloc.cpp360
-rw-r--r--src/3rdparty/angle/src/compiler/translator/PoolAlloc.h319
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Pragma.h31
-rw-r--r--src/3rdparty/angle/src/compiler/translator/PruneNoOps.cpp156
-rw-r--r--src/3rdparty/angle/src/compiler/translator/PruneNoOps.h24
-rw-r--r--src/3rdparty/angle/src/compiler/translator/QualifierTypes.cpp784
-rw-r--r--src/3rdparty/angle/src/compiler/translator/QualifierTypes.h191
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RecordConstantPrecision.cpp167
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RecordConstantPrecision.h28
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.cpp76
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.h45
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveArrayLengthMethod.cpp83
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveArrayLengthMethod.h29
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveDynamicIndexing.cpp550
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveDynamicIndexing.h27
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveEmptySwitchStatements.cpp56
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveEmptySwitchStatements.h18
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveInvariantDeclaration.cpp43
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveInvariantDeclaration.h18
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.cpp116
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h21
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemovePow.cpp97
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemovePow.h21
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.cpp270
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.h27
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveUnreferencedVariables.cpp358
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveUnreferencedVariables.h24
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteDoWhile.cpp159
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteDoWhile.h23
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp120
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h22
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteTexelFetchOffset.cpp154
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteTexelFetchOffset.h28
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorFloat.cpp94
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorFloat.h19
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorInt.cpp112
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorInt.h20
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RunAtTheEndOfShader.cpp112
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RunAtTheEndOfShader.h23
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp238
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h27
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SearchSymbol.cpp38
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SearchSymbol.h33
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SeparateArrayInitialization.cpp92
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SeparateArrayInitialization.h29
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SeparateDeclarations.cpp79
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SeparateDeclarations.h26
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SeparateExpressionsReturningArrays.cpp126
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SeparateExpressionsReturningArrays.h23
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Severity.h22
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp578
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ShaderVars.cpp586
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SimplifyLoopConditions.cpp300
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SimplifyLoopConditions.h25
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SplitSequenceOperator.cpp171
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SplitSequenceOperator.h28
-rw-r--r--src/3rdparty/angle/src/compiler/translator/StructureHLSL.cpp594
-rw-r--r--src/3rdparty/angle/src/compiler/translator/StructureHLSL.h98
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp622
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SymbolTable.h545
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SymbolUniqueId.cpp28
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SymbolUniqueId.h36
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TextureFunctionHLSL.cpp1322
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TextureFunctionHLSL.h76
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorESSL.cpp184
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorESSL.h35
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.cpp339
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.h38
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp161
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h41
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorVulkan.cpp173
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorVulkan.h34
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Types.cpp1072
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Types.h509
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp59
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h33
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitToIf.cpp186
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitToIf.h25
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UniformHLSL.cpp600
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UniformHLSL.h110
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UseInterfaceBlockFields.cpp105
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UseInterfaceBlockFields.h30
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UtilsHLSL.cpp970
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UtilsHLSL.h129
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateGlobalInitializer.cpp120
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateGlobalInitializer.h23
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateLimitations.cpp444
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h27
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateMaxParameters.cpp29
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateMaxParameters.h21
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateOutputs.cpp174
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateOutputs.h30
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateSwitch.cpp319
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateSwitch.h28
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateVaryingLocations.cpp174
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateVaryingLocations.h25
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp413
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariablePacker.h32
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VectorizeVectorScalarArithmetic.cpp284
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VectorizeVectorScalarArithmetic.h25
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp143
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VersionGLSL.h76
-rw-r--r--src/3rdparty/angle/src/compiler/translator/WrapSwitchStatementsInBlocks.cpp132
-rw-r--r--src/3rdparty/angle/src/compiler/translator/WrapSwitchStatementsInBlocks.h22
-rw-r--r--src/3rdparty/angle/src/compiler/translator/blocklayout.cpp281
-rw-r--r--src/3rdparty/angle/src/compiler/translator/blocklayout.h144
-rw-r--r--src/3rdparty/angle/src/compiler/translator/blocklayoutHLSL.cpp166
-rw-r--r--src/3rdparty/angle/src/compiler/translator/blocklayoutHLSL.h68
-rw-r--r--src/3rdparty/angle/src/compiler/translator/emulated_builtin_function_data_hlsl.json1382
-rw-r--r--src/3rdparty/angle/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp859
-rw-r--r--src/3rdparty/angle/src/compiler/translator/glslang.h24
-rw-r--r--src/3rdparty/angle/src/compiler/translator/glslang.l697
-rw-r--r--src/3rdparty/angle/src/compiler/translator/glslang.y1468
-rw-r--r--src/3rdparty/angle/src/compiler/translator/length_limits.h26
-rw-r--r--src/3rdparty/angle/src/compiler/translator/util.cpp714
-rw-r--r--src/3rdparty/angle/src/compiler/translator/util.h63
-rw-r--r--src/3rdparty/angle/src/gpu_info_util/SystemInfo.cpp171
-rw-r--r--src/3rdparty/angle/src/gpu_info_util/SystemInfo.h73
-rw-r--r--src/3rdparty/angle/src/gpu_info_util/SystemInfo_internal.h38
-rw-r--r--src/3rdparty/angle/src/gpu_info_util/SystemInfo_libpci.cpp132
-rw-r--r--src/3rdparty/angle/src/gpu_info_util/SystemInfo_linux.cpp144
-rw-r--r--src/3rdparty/angle/src/gpu_info_util/SystemInfo_mac.mm170
-rw-r--r--src/3rdparty/angle/src/gpu_info_util/SystemInfo_win.cpp251
-rw-r--r--src/3rdparty/angle/src/gpu_info_util/SystemInfo_x11.cpp53
-rw-r--r--src/3rdparty/angle/src/image_util/copyimage.cpp22
-rw-r--r--src/3rdparty/angle/src/image_util/copyimage.h36
-rw-r--r--src/3rdparty/angle/src/image_util/copyimage.inl34
-rw-r--r--src/3rdparty/angle/src/image_util/generatemip.h34
-rw-r--r--src/3rdparty/angle/src/image_util/generatemip.inl268
-rw-r--r--src/3rdparty/angle/src/image_util/imageformats.cpp1722
-rw-r--r--src/3rdparty/angle/src/image_util/imageformats.h700
-rw-r--r--src/3rdparty/angle/src/image_util/loadimage.cpp1323
-rw-r--r--src/3rdparty/angle/src/image_util/loadimage.h658
-rw-r--r--src/3rdparty/angle/src/image_util/loadimage.inl163
-rw-r--r--src/3rdparty/angle/src/image_util/loadimage_etc.cpp1729
-rw-r--r--src/3rdparty/angle/src/libANGLE/AttributeMap.cpp110
-rw-r--r--src/3rdparty/angle/src/libANGLE/AttributeMap.h49
-rw-r--r--src/3rdparty/angle/src/libANGLE/BinaryStream.h261
-rw-r--r--src/3rdparty/angle/src/libANGLE/Buffer.cpp215
-rw-r--r--src/3rdparty/angle/src/libANGLE/Buffer.h123
-rw-r--r--src/3rdparty/angle/src/libANGLE/Caps.cpp1213
-rw-r--r--src/3rdparty/angle/src/libANGLE/Caps.h758
-rw-r--r--src/3rdparty/angle/src/libANGLE/Compiler.cpp221
-rw-r--r--src/3rdparty/angle/src/libANGLE/Compiler.h51
-rw-r--r--src/3rdparty/angle/src/libANGLE/Config.cpp309
-rw-r--r--src/3rdparty/angle/src/libANGLE/Config.h101
-rw-r--r--src/3rdparty/angle/src/libANGLE/Constants.h62
-rw-r--r--src/3rdparty/angle/src/libANGLE/Context.cpp5558
-rw-r--r--src/3rdparty/angle/src/libANGLE/Context.h1154
-rw-r--r--src/3rdparty/angle/src/libANGLE/ContextState.cpp839
-rw-r--r--src/3rdparty/angle/src/libANGLE/ContextState.h164
-rw-r--r--src/3rdparty/angle/src/libANGLE/Debug.cpp327
-rw-r--r--src/3rdparty/angle/src/libANGLE/Debug.h129
-rw-r--r--src/3rdparty/angle/src/libANGLE/Device.cpp125
-rw-r--r--src/3rdparty/angle/src/libANGLE/Device.h58
-rw-r--r--src/3rdparty/angle/src/libANGLE/Display.cpp1240
-rw-r--r--src/3rdparty/angle/src/libANGLE/Display.h219
-rw-r--r--src/3rdparty/angle/src/libANGLE/Error.cpp110
-rw-r--r--src/3rdparty/angle/src/libANGLE/Error.h267
-rw-r--r--src/3rdparty/angle/src/libANGLE/Error.inl189
-rw-r--r--src/3rdparty/angle/src/libANGLE/ErrorStrings.h173
-rw-r--r--src/3rdparty/angle/src/libANGLE/Fence.cpp135
-rw-r--r--src/3rdparty/angle/src/libANGLE/Fence.h81
-rw-r--r--src/3rdparty/angle/src/libANGLE/Framebuffer.cpp2182
-rw-r--r--src/3rdparty/angle/src/libANGLE/Framebuffer.h389
-rw-r--r--src/3rdparty/angle/src/libANGLE/FramebufferAttachment.cpp385
-rw-r--r--src/3rdparty/angle/src/libANGLE/FramebufferAttachment.h250
-rw-r--r--src/3rdparty/angle/src/libANGLE/HandleAllocator.cpp142
-rw-r--r--src/3rdparty/angle/src/libANGLE/HandleAllocator.h63
-rw-r--r--src/3rdparty/angle/src/libANGLE/HandleRangeAllocator.cpp229
-rw-r--r--src/3rdparty/angle/src/libANGLE/HandleRangeAllocator.h60
-rw-r--r--src/3rdparty/angle/src/libANGLE/Image.cpp245
-rw-r--r--src/3rdparty/angle/src/libANGLE/Image.h115
-rw-r--r--src/3rdparty/angle/src/libANGLE/ImageIndex.cpp249
-rw-r--r--src/3rdparty/angle/src/libANGLE/ImageIndex.h91
-rw-r--r--src/3rdparty/angle/src/libANGLE/IndexRangeCache.cpp121
-rw-r--r--src/3rdparty/angle/src/libANGLE/IndexRangeCache.h63
-rw-r--r--src/3rdparty/angle/src/libANGLE/LoggingAnnotator.cpp44
-rw-r--r--src/3rdparty/angle/src/libANGLE/LoggingAnnotator.h31
-rw-r--r--src/3rdparty/angle/src/libANGLE/MemoryProgramCache.cpp772
-rw-r--r--src/3rdparty/angle/src/libANGLE/MemoryProgramCache.h130
-rw-r--r--src/3rdparty/angle/src/libANGLE/PackedGLEnums.h111
-rw-r--r--src/3rdparty/angle/src/libANGLE/PackedGLEnums_autogen.cpp174
-rw-r--r--src/3rdparty/angle/src/libANGLE/PackedGLEnums_autogen.h84
-rw-r--r--src/3rdparty/angle/src/libANGLE/Path.cpp78
-rw-r--r--src/3rdparty/angle/src/libANGLE/Path.h71
-rw-r--r--src/3rdparty/angle/src/libANGLE/Platform.cpp69
-rw-r--r--src/3rdparty/angle/src/libANGLE/Program.cpp3066
-rw-r--r--src/3rdparty/angle/src/libANGLE/Program.h735
-rw-r--r--src/3rdparty/angle/src/libANGLE/ProgramLinkedResources.cpp1040
-rw-r--r--src/3rdparty/angle/src/libANGLE/ProgramLinkedResources.h274
-rw-r--r--src/3rdparty/angle/src/libANGLE/ProgramPipeline.cpp65
-rw-r--r--src/3rdparty/angle/src/libANGLE/ProgramPipeline.h65
-rw-r--r--src/3rdparty/angle/src/libANGLE/Query.cpp87
-rw-r--r--src/3rdparty/angle/src/libANGLE/Query.h60
-rw-r--r--src/3rdparty/angle/src/libANGLE/RefCountObject.h187
-rw-r--r--src/3rdparty/angle/src/libANGLE/Renderbuffer.cpp235
-rw-r--r--src/3rdparty/angle/src/libANGLE/Renderbuffer.h93
-rw-r--r--src/3rdparty/angle/src/libANGLE/ResourceManager.cpp483
-rw-r--r--src/3rdparty/angle/src/libANGLE/ResourceManager.h289
-rw-r--r--src/3rdparty/angle/src/libANGLE/ResourceMap.h305
-rw-r--r--src/3rdparty/angle/src/libANGLE/Sampler.cpp169
-rw-r--r--src/3rdparty/angle/src/libANGLE/Sampler.h85
-rw-r--r--src/3rdparty/angle/src/libANGLE/Shader.cpp561
-rw-r--r--src/3rdparty/angle/src/libANGLE/Shader.h212
-rw-r--r--src/3rdparty/angle/src/libANGLE/SizedMRUCache.h174
-rw-r--r--src/3rdparty/angle/src/libANGLE/State.cpp2433
-rw-r--r--src/3rdparty/angle/src/libANGLE/State.h602
-rw-r--r--src/3rdparty/angle/src/libANGLE/Stream.cpp271
-rw-r--r--src/3rdparty/angle/src/libANGLE/Stream.h143
-rw-r--r--src/3rdparty/angle/src/libANGLE/Surface.cpp484
-rw-r--r--src/3rdparty/angle/src/libANGLE/Surface.h238
-rw-r--r--src/3rdparty/angle/src/libANGLE/Texture.cpp1484
-rw-r--r--src/3rdparty/angle/src/libANGLE/Texture.h471
-rw-r--r--src/3rdparty/angle/src/libANGLE/Thread.cpp91
-rw-r--r--src/3rdparty/angle/src/libANGLE/Thread.h51
-rw-r--r--src/3rdparty/angle/src/libANGLE/TransformFeedback.cpp221
-rw-r--r--src/3rdparty/angle/src/libANGLE/TransformFeedback.h101
-rw-r--r--src/3rdparty/angle/src/libANGLE/Uniform.cpp226
-rw-r--r--src/3rdparty/angle/src/libANGLE/Uniform.h126
-rw-r--r--src/3rdparty/angle/src/libANGLE/VaryingPacking.cpp408
-rw-r--r--src/3rdparty/angle/src/libANGLE/VaryingPacking.h184
-rw-r--r--src/3rdparty/angle/src/libANGLE/Version.h34
-rw-r--r--src/3rdparty/angle/src/libANGLE/Version.inl59
-rw-r--r--src/3rdparty/angle/src/libANGLE/VertexArray.cpp267
-rw-r--r--src/3rdparty/angle/src/libANGLE/VertexArray.h205
-rw-r--r--src/3rdparty/angle/src/libANGLE/VertexAttribute.cpp162
-rw-r--r--src/3rdparty/angle/src/libANGLE/VertexAttribute.h107
-rw-r--r--src/3rdparty/angle/src/libANGLE/VertexAttribute.inl58
-rw-r--r--src/3rdparty/angle/src/libANGLE/Workarounds.h29
-rw-r--r--src/3rdparty/angle/src/libANGLE/WorkerThread.cpp157
-rw-r--r--src/3rdparty/angle/src/libANGLE/WorkerThread.h284
-rw-r--r--src/3rdparty/angle/src/libANGLE/angletypes.cpp259
-rw-r--r--src/3rdparty/angle/src/libANGLE/angletypes.h487
-rw-r--r--src/3rdparty/angle/src/libANGLE/angletypes.inl35
-rw-r--r--src/3rdparty/angle/src/libANGLE/entry_points_enum_autogen.h336
-rw-r--r--src/3rdparty/angle/src/libANGLE/es3_copy_conversion_formats.json44
-rw-r--r--src/3rdparty/angle/src/libANGLE/es3_copy_conversion_table_autogen.cpp171
-rw-r--r--src/3rdparty/angle/src/libANGLE/es3_format_type_combinations.json171
-rw-r--r--src/3rdparty/angle/src/libANGLE/features.h65
-rw-r--r--src/3rdparty/angle/src/libANGLE/format_map_autogen.cpp1570
-rw-r--r--src/3rdparty/angle/src/libANGLE/format_map_data.json142
-rw-r--r--src/3rdparty/angle/src/libANGLE/formatutils.cpp2133
-rw-r--r--src/3rdparty/angle/src/libANGLE/formatutils.h329
-rw-r--r--src/3rdparty/angle/src/libANGLE/histogram_macros.h112
-rw-r--r--src/3rdparty/angle/src/libANGLE/packed_gl_enums.json35
-rw-r--r--src/3rdparty/angle/src/libANGLE/params.cpp68
-rw-r--r--src/3rdparty/angle/src/libANGLE/params.h228
-rw-r--r--src/3rdparty/angle/src/libANGLE/queryconversions.cpp283
-rw-r--r--src/3rdparty/angle/src/libANGLE/queryconversions.h117
-rw-r--r--src/3rdparty/angle/src/libANGLE/queryutils.cpp1916
-rw-r--r--src/3rdparty/angle/src/libANGLE/queryutils.h162
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/BufferImpl.h69
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/BufferImpl_mock.h48
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/CompilerImpl.h34
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ContextImpl.cpp119
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ContextImpl.h186
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/DeviceImpl.cpp22
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/DeviceImpl.h37
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/DisplayImpl.cpp58
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/DisplayImpl.h96
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/EGLImplFactory.h68
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/FenceNVImpl.h34
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/Format.h105
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/Format_ID_autogen.inl147
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/Format_table_autogen.cpp434
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h54
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/FramebufferImpl.h95
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/FramebufferImpl_mock.h73
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/GLImplFactory.h93
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ImageImpl.h42
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ImageImpl_mock.h34
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/PathImpl.h36
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ProgramImpl.h107
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ProgramImpl_mock.h84
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ProgramPipelineImpl.h32
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/QueryImpl.h44
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/RenderbufferImpl.h50
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/RenderbufferImpl_mock.h40
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/SamplerImpl.h39
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ShaderImpl.h40
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/StreamProducerImpl.h39
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/SurfaceImpl.cpp28
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/SurfaceImpl.h73
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/SyncImpl.h34
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/TextureImpl.cpp63
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/TextureImpl.h159
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/TextureImpl_mock.h131
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/TransformFeedbackImpl.h39
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/TransformFeedbackImpl_mock.h41
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/VertexArrayImpl.h37
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/angle_format_data.json24
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/angle_format_map.json132
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/BufferD3D.cpp190
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/BufferD3D.h89
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/CompilerD3D.cpp30
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/CompilerD3D.h33
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/DeviceD3D.cpp105
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/DeviceD3D.h39
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/DisplayD3D.cpp361
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/DisplayD3D.h83
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/DynamicHLSL.cpp1427
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/DynamicHLSL.h175
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/EGLImageD3D.cpp87
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/EGLImageD3D.h55
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/FramebufferD3D.cpp405
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/FramebufferD3D.h134
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp354
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.h64
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ImageD3D.cpp62
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ImageD3D.h105
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexBuffer.cpp189
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexBuffer.h100
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexDataManager.cpp320
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexDataManager.h105
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/NativeWindowD3D.cpp23
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/NativeWindowD3D.h38
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ProgramD3D.cpp2867
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ProgramD3D.h523
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp36
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderTargetD3D.h47
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp130
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.h62
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.cpp260
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h359
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/SamplerD3D.h25
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderD3D.cpp247
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderD3D.h99
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp71
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h57
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp509
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h136
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/SwapChainD3D.cpp34
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/SwapChainD3D.h83
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp3974
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureD3D.h891
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureStorage.h82
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexBuffer.cpp293
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexBuffer.h175
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexDataManager.cpp646
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexDataManager.h152
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp2153
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.h332
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp1600
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.h189
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp833
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.h100
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Context11.cpp405
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Context11.h155
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp119
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h37
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp240
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.h60
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp507
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h104
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Image11.cpp657
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Image11.h112
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp159
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h50
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp503
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h135
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/NativeWindow11.h38
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp258
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h93
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.cpp24
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h27
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp375
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.h68
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp273
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h123
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp405
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h131
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp4089
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h576
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.cpp533
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.h366
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp119
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h62
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp3075
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.h557
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StreamProducerNV12.cpp102
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StreamProducerNV12.h44
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp1075
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h137
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp3155
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h589
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp124
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h60
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp100
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Trim11.h43
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp413
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h99
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp184
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h62
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/copyvertex.h40
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/copyvertex.inl386
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_data.json118
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp516
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_data.json1279
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.cpp3042
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.h49
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp1023
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.h71
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp2421
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h431
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/BufferToTexture11.hlsl77
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Clear11.hlsl635
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/MultiplyAlpha.hlsl131
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough2D11.hlsl122
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough3D11.hlsl146
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/ResolveDepthStencil.hlsl56
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Swizzle11.hlsl99
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dms11ps.h155
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_data.json523
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_map.json78
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp35
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h105
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp1938
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_utils.h85
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp217
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.h53
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp208
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h90
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp297
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h136
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp126
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h51
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp359
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h93
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp829
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.h153
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp139
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.h63
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Context9.cpp303
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Context9.h151
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp36
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h29
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp91
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Fence9.h38
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp411
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h63
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Image9.cpp920
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Image9.h102
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp168
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h49
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.cpp39
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.h35
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Query9.cpp188
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Query9.h48
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp163
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h98
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp3310
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h543
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h106
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp47
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h35
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp945
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.h209
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp467
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h81
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp647
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h154
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h46
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp169
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h53
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp257
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h65
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp652
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.h94
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp671
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h95
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.ps67
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.vs29
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h200
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/formatutilsD3D.h38
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/driver_utils.cpp120
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/driver_utils.h73
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/load_functions_data.json602
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/load_functions_table.h22
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/load_functions_table_autogen.cpp2459
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/renderer_utils.cpp549
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/renderer_utils.h254
-rw-r--r--src/3rdparty/angle/src/libANGLE/signal_utils.h187
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationEGL.cpp2501
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationEGL.h182
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES.cpp5828
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES.h601
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES2.cpp6351
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES2.h687
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES3.cpp3702
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES3.h614
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES31.cpp1786
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES31.h325
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGL.cpp408
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGL.def77
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGL_mingw32.def77
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGLd.def77
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGLd_mingw32.def77
-rw-r--r--src/3rdparty/angle/src/libEGL/resource.h14
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_egl.cpp1186
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_egl.h74
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp856
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.h113
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_autogen.cpp2612
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_autogen.h297
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_ext.cpp3558
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_ext.h717
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_0_autogen.cpp2084
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_0_autogen.h284
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_1_autogen.cpp1430
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_1_autogen.h228
-rw-r--r--src/3rdparty/angle/src/libGLESv2/global_state.cpp150
-rw-r--r--src/3rdparty/angle/src/libGLESv2/global_state.h29
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp2575
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2.def412
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2_mingw32.def411
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2d.def412
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2d_mingw32.def411
-rw-r--r--src/3rdparty/angle/src/libGLESv2/proc_table.h24
-rw-r--r--src/3rdparty/angle/src/libGLESv2/proc_table_autogen.cpp548
-rw-r--r--src/3rdparty/angle/src/libGLESv2/proc_table_data.json662
-rw-r--r--src/3rdparty/angle/src/libGLESv2/resource.h14
-rw-r--r--src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.cpp115
-rw-r--r--src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h66
-rw-r--r--src/3rdparty/angle/src/third_party/compiler/LICENSE22
-rw-r--r--src/3rdparty/angle/src/third_party/compiler/README.angle12
-rw-r--r--src/3rdparty/angle/src/third_party/libXNVCtrl/LICENSE22
-rw-r--r--src/3rdparty/angle/src/third_party/libXNVCtrl/NVCtrl.c1240
-rw-r--r--src/3rdparty/angle/src/third_party/libXNVCtrl/NVCtrl.h4365
-rw-r--r--src/3rdparty/angle/src/third_party/libXNVCtrl/NVCtrlLib.h707
-rw-r--r--src/3rdparty/angle/src/third_party/libXNVCtrl/README.angle14
-rw-r--r--src/3rdparty/angle/src/third_party/libXNVCtrl/nv_control.h652
-rw-r--r--src/3rdparty/angle/src/third_party/systeminfo/SystemInfo.cpp65
-rw-r--r--src/3rdparty/angle/src/third_party/systeminfo/SystemInfo.h35
-rw-r--r--src/3rdparty/angle/src/third_party/trace_event/trace_event.h798
704 files changed, 0 insertions, 253324 deletions
diff --git a/src/3rdparty/angle/src/common/Color.h b/src/3rdparty/angle/src/common/Color.h
deleted file mode 100644
index 2b4d2f6fba..0000000000
--- a/src/3rdparty/angle/src/common/Color.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// 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_
-
-namespace angle
-{
-
-template <typename T>
-struct Color
-{
- T red;
- T green;
- T blue;
- T alpha;
-
- Color();
- Color(T r, T g, T b, T a);
-};
-
-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;
-
-} // 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;
-
-} // namespace gl
-
-#include "Color.inl"
-
-#endif // COMMON_COLOR_H_
diff --git a/src/3rdparty/angle/src/common/Color.inl b/src/3rdparty/angle/src/common/Color.inl
deleted file mode 100644
index c3073256b5..0000000000
--- a/src/3rdparty/angle/src/common/Color.inl
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// 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.inl : Inline definitions of some functions from Color.h
-
-namespace angle
-{
-
-template <typename T>
-Color<T>::Color() : Color(0, 0, 0, 0)
-{
-}
-
-template <typename T>
-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);
-}
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/common/Float16ToFloat32.cpp b/src/3rdparty/angle/src/common/Float16ToFloat32.cpp
deleted file mode 100644
index acd0d88b60..0000000000
--- a/src/3rdparty/angle/src/common/Float16ToFloat32.cpp
+++ /dev/null
@@ -1,2205 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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);
-}
-}
-
diff --git a/src/3rdparty/angle/src/common/MemoryBuffer.cpp b/src/3rdparty/angle/src/common/MemoryBuffer.cpp
deleted file mode 100644
index 6f5188c69c..0000000000
--- a/src/3rdparty/angle/src/common/MemoryBuffer.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-//
-// 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() : mSize(0), mData(nullptr)
-{
-}
-
-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 = reinterpret_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/src/3rdparty/angle/src/common/MemoryBuffer.h b/src/3rdparty/angle/src/common/MemoryBuffer.h
deleted file mode 100644
index f76b9ee62e..0000000000
--- a/src/3rdparty/angle/src/common/MemoryBuffer.h
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// 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();
- ~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;
- }
-
- void fill(uint8_t datum);
-
- private:
- size_t mSize;
- uint8_t *mData;
-};
-
-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/src/3rdparty/angle/src/common/Optional.h b/src/3rdparty/angle/src/common/Optional.h
deleted file mode 100644
index 822de4de51..0000000000
--- a/src/3rdparty/angle/src/common/Optional.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/common/angleutils.cpp b/src/3rdparty/angle/src/common/angleutils.cpp
deleted file mode 100644
index 739d12a767..0000000000
--- a/src/3rdparty/angle/src/common/angleutils.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-//
-// 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();
-}
-
-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/src/3rdparty/angle/src/common/angleutils.h b/src/3rdparty/angle/src/common/angleutils.h
deleted file mode 100644
index ad32a2f03a..0000000000
--- a/src/3rdparty/angle/src/common/angleutils.h
+++ /dev/null
@@ -1,253 +0,0 @@
-//
-// 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 <string>
-#include <set>
-#include <sstream>
-#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:
- 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)
-{
- static std::set<std::string> strings;
- 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);
-
-std::string FormatString(const char *fmt, va_list vararg);
-std::string FormatString(const char *fmt, ...);
-
-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_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
-
-// Hidden enum for the NULL D3D device type.
-#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x6AC0
-
-// TODO(jmadill): Clean this up at some point.
-#define EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX 0x9999
-
-#define ANGLE_TRY_CHECKED_MATH(result) \
- if (!result.IsValid()) \
- { \
- return gl::InternalError() << "Integer overflow."; \
- }
-
-// 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
-
-#ifndef ANGLE_STRINGIFY
-#define ANGLE_STRINGIFY(x) #x
-#endif
-
-#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)
-
-#endif // COMMON_ANGLEUTILS_H_
diff --git a/src/3rdparty/angle/src/common/bitset_utils.h b/src/3rdparty/angle/src/common/bitset_utils.h
deleted file mode 100644
index 4166a562a7..0000000000
--- a/src/3rdparty/angle/src/common/bitset_utils.h
+++ /dev/null
@@ -1,498 +0,0 @@
-//
-// 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 <size_t N, typename BitsT>
-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, std::size_t bit) : mParent(parent), mBit(bit) {}
-
- BitSetT *mParent;
- std::size_t mBit;
- };
-
- class Iterator final
- {
- public:
- Iterator(const BitSetT &bits);
- Iterator &operator++();
-
- bool operator==(const Iterator &other) const;
- bool operator!=(const Iterator &other) const;
- std::size_t operator*() const;
-
- private:
- std::size_t getNextBit();
-
- BitSetT mBitsCopy;
- std::size_t mCurrentBit;
- };
-
- BitSetT();
- BitSetT(BitsT value);
- ~BitSetT();
-
- BitSetT(const BitSetT &other);
- BitSetT &operator=(const BitSetT &other);
-
- bool operator==(const BitSetT &other) const;
- bool operator!=(const BitSetT &other) const;
-
- constexpr bool operator[](std::size_t pos) const;
- Reference operator[](std::size_t pos) { return Reference(this, pos); }
-
- bool test(std::size_t 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<<(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(std::size_t pos, bool value = true);
-
- BitSetT &reset();
- BitSetT &reset(std::size_t pos);
-
- BitSetT &flip();
- BitSetT &flip(std::size_t 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:
- constexpr static BitsT Bit(std::size_t x) { return (static_cast<BitsT>(1) << x); }
- constexpr static BitsT Mask(std::size_t x) { return ((Bit(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; }
-
- 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>
-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>
-BitSetT<N, BitsT>::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>
-BitSetT<N, BitsT>::BitSetT(BitsT value) : mBits(value & Mask(N))
-{
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT>::~BitSetT()
-{
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT>::BitSetT(const BitSetT &other) : mBits(other.mBits)
-{
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator=(const BitSetT &other)
-{
- mBits = other.mBits;
- return *this;
-}
-
-template <size_t N, typename BitsT>
-bool BitSetT<N, BitsT>::operator==(const BitSetT &other) const
-{
- return mBits == other.mBits;
-}
-
-template <size_t N, typename BitsT>
-bool BitSetT<N, BitsT>::operator!=(const BitSetT &other) const
-{
- return mBits != other.mBits;
-}
-
-template <size_t N, typename BitsT>
-constexpr bool BitSetT<N, BitsT>::operator[](std::size_t pos) const
-{
- return test(pos);
-}
-
-template <size_t N, typename BitsT>
-bool BitSetT<N, BitsT>::test(std::size_t pos) const
-{
- return (mBits & Bit(pos)) != 0;
-}
-
-template <size_t N, typename BitsT>
-bool BitSetT<N, BitsT>::all() const
-{
- ASSERT(mBits == (mBits & Mask(N)));
- return mBits == Mask(N);
-}
-
-template <size_t N, typename BitsT>
-bool BitSetT<N, BitsT>::any() const
-{
- ASSERT(mBits == (mBits & Mask(N)));
- return (mBits != 0);
-}
-
-template <size_t N, typename BitsT>
-bool BitSetT<N, BitsT>::none() const
-{
- ASSERT(mBits == (mBits & Mask(N)));
- return (mBits == 0);
-}
-
-template <size_t N, typename BitsT>
-std::size_t BitSetT<N, BitsT>::count() const
-{
- return gl::BitCount(mBits);
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator&=(const BitSetT &other)
-{
- mBits &= other.mBits;
- return *this;
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator|=(const BitSetT &other)
-{
- mBits |= other.mBits;
- return *this;
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator^=(const BitSetT &other)
-{
- mBits = (mBits ^ other.mBits) & Mask(N);
- return *this;
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> BitSetT<N, BitsT>::operator~() const
-{
- return BitSetT<N, BitsT>(~mBits & Mask(N));
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> BitSetT<N, BitsT>::operator<<(std::size_t pos) const
-{
- return BitSetT<N, BitsT>((mBits << pos) & Mask(N));
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator<<=(std::size_t pos)
-{
- mBits = (mBits << pos & Mask(N));
- return *this;
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> BitSetT<N, BitsT>::operator>>(std::size_t pos) const
-{
- return BitSetT<N, BitsT>(mBits >> pos);
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator>>=(std::size_t pos)
-{
- mBits = ((mBits >> pos) & Mask(N));
- return *this;
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> &BitSetT<N, BitsT>::set()
-{
- mBits = Mask(N);
- return *this;
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> &BitSetT<N, BitsT>::set(std::size_t pos, bool value)
-{
- if (value)
- {
- mBits |= Bit(pos);
- }
- else
- {
- reset(pos);
- }
- return *this;
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> &BitSetT<N, BitsT>::reset()
-{
- mBits = 0;
- return *this;
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> &BitSetT<N, BitsT>::reset(std::size_t pos)
-{
- mBits &= ~Bit(pos);
- return *this;
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> &BitSetT<N, BitsT>::flip()
-{
- mBits ^= Mask(N);
- return *this;
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT> &BitSetT<N, BitsT>::flip(std::size_t pos)
-{
- mBits ^= Bit(pos);
- return *this;
-}
-
-template <size_t N, typename BitsT>
-BitSetT<N, BitsT>::Iterator::Iterator(const BitSetT &bits) : mBitsCopy(bits), mCurrentBit(0)
-{
- if (bits.any())
- {
- mCurrentBit = getNextBit();
- }
-}
-
-template <size_t N, typename BitsT>
-typename BitSetT<N, BitsT>::Iterator &BitSetT<N, BitsT>::Iterator::operator++()
-{
- ASSERT(mBitsCopy.any());
- mBitsCopy.reset(mCurrentBit);
- mCurrentBit = getNextBit();
- return *this;
-}
-
-template <size_t N, typename BitsT>
-bool BitSetT<N, BitsT>::Iterator::operator==(const Iterator &other) const
-{
- return mBitsCopy == other.mBitsCopy;
-}
-
-template <size_t N, typename BitsT>
-bool BitSetT<N, BitsT>::Iterator::operator!=(const Iterator &other) const
-{
- return !(*this == other);
-}
-
-template <size_t N, typename BitsT>
-std::size_t BitSetT<N, BitsT>::Iterator::operator*() const
-{
- return mCurrentBit;
-}
-
-template <size_t N, typename BitsT>
-std::size_t BitSetT<N, BitsT>::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;
-
-} // angle
-
-template <size_t N, typename BitsT>
-inline angle::BitSetT<N, BitsT> operator&(const angle::BitSetT<N, BitsT> &lhs,
- const angle::BitSetT<N, BitsT> &rhs)
-{
- return angle::BitSetT<N, BitsT>(lhs.bits() & rhs.bits());
-}
-
-template <size_t N, typename BitsT>
-inline angle::BitSetT<N, BitsT> operator|(const angle::BitSetT<N, BitsT> &lhs,
- const angle::BitSetT<N, BitsT> &rhs)
-{
- return angle::BitSetT<N, BitsT>(lhs.bits() | rhs.bits());
-}
-
-template <size_t N, typename BitsT>
-inline angle::BitSetT<N, BitsT> operator^(const angle::BitSetT<N, BitsT> &lhs,
- const angle::BitSetT<N, BitsT> &rhs)
-{
- return angle::BitSetT<N, BitsT>(lhs.bits() ^ rhs.bits());
-}
-
-#endif // COMMON_BITSETITERATOR_H_
diff --git a/src/3rdparty/angle/src/common/debug.cpp b/src/3rdparty/angle/src/common/debug.cpp
deleted file mode 100644
index b02e80be5f..0000000000
--- a/src/3rdparty/angle/src/common/debug.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// debug.cpp: Debugging utilities.
-
-#include "common/debug.h"
-
-#include <stdarg.h>
-
-#include <array>
-#include <cstdio>
-#include <fstream>
-#include <ostream>
-#include <vector>
-
-#include "common/angleutils.h"
-#include "common/Optional.h"
-
-namespace gl
-{
-
-namespace
-{
-
-DebugAnnotator *g_debugAnnotator = nullptr;
-
-constexpr std::array<const char *, LOG_NUM_SEVERITIES> g_logSeverityNames = {
- {"EVENT", "WARN", "ERR"}};
-
-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_ERR;
-#else
- return false;
-#endif
-}
-
-} // namespace
-
-namespace priv
-{
-
-bool ShouldCreatePlatformLogMessage(LogSeverity severity)
-{
-#if defined(ANGLE_TRACE_ENABLED)
- return true;
-#else
- return severity != LOG_EVENT;
-#endif
-}
-
-} // 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;
-}
-
-ScopedPerfEventHelper::ScopedPerfEventHelper(const char *format, ...)
-{
-#if !defined(ANGLE_ENABLE_DEBUG_TRACE)
- if (!DebugAnnotationsActive())
- {
- 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);
- va_end(vararg);
-}
-
-ScopedPerfEventHelper::~ScopedPerfEventHelper()
-{
- if (DebugAnnotationsActive())
- {
- g_debugAnnotator->endEvent();
- }
-}
-
-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()
-{
- if (DebugAnnotationsInitialized() && (mSeverity == LOG_ERR || mSeverity == LOG_WARN))
- {
- g_debugAnnotator->logMessage(*this);
- }
- else
- {
- Trace(getSeverity(), getMessage().c_str());
- }
-}
-
-void Trace(LogSeverity severity, const char *message)
-{
- if (!ShouldCreateLogMessage(severity))
- {
- return;
- }
-
- std::string str(message);
-
- if (DebugAnnotationsActive())
- {
- std::wstring formattedWideMessage(str.begin(), str.end());
-
- switch (severity)
- {
- case LOG_EVENT:
- g_debugAnnotator->beginEvent(formattedWideMessage.c_str());
- break;
- default:
- g_debugAnnotator->setMarker(formattedWideMessage.c_str());
- break;
- }
- }
-
- if (severity == LOG_ERR)
- {
- // Note: we use fprintf because <iostream> includes static initializers.
- fprintf(stderr, "%s: %s\n", LogSeverityName(severity), str.c_str());
- }
-
-#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)
- {
- 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)
-std::ostream &operator<<(std::ostream &os, const FmtHR &fmt)
-{
- os << "HRESULT: ";
- return FmtHexInt(os, fmt.mHR);
-}
-
-std::ostream &operator<<(std::ostream &os, const FmtErr &fmt)
-{
- os << "error: ";
- return FmtHexInt(os, fmt.mErr);
-}
-
-#endif // defined(ANGLE_PLATFORM_WINDOWS)
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/common/debug.h b/src/3rdparty/angle/src/common/debug.h
deleted file mode 100644
index 290a4e8bb7..0000000000
--- a/src/3rdparty/angle/src/common/debug.h
+++ /dev/null
@@ -1,286 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// debug.h: Debugging utilities.
-
-#ifndef COMMON_DEBUG_H_
-#define COMMON_DEBUG_H_
-
-#include <assert.h>
-#include <stdio.h>
-
-#include <ios>
-#include <iomanip>
-#include <sstream>
-#include <string>
-
-#include "common/angleutils.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:
- ScopedPerfEventHelper(const char* format, ...);
- ~ScopedPerfEventHelper();
-};
-
-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_WARN = 1;
-constexpr LogSeverity LOG_ERR = 2;
-constexpr LogSeverity LOG_NUM_SEVERITIES = 3;
-
-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 D3D9/D3D11 debug annotation functions.
-// Also handles redirecting logging destination.
-class DebugAnnotator : angle::NonCopyable
-{
- public:
- DebugAnnotator(){};
- virtual ~DebugAnnotator() { };
- virtual void beginEvent(const wchar_t *eventName) = 0;
- virtual void endEvent() = 0;
- virtual void setMarker(const wchar_t *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();
-
-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 &) {}
-};
-
-// 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;
-}
-} // namespace priv
-
-#if defined(ANGLE_PLATFORM_WINDOWS)
-class FmtHR
-{
- public:
- explicit FmtHR(HRESULT hresult) : mHR(hresult) {}
- private:
- HRESULT mHR;
- friend std::ostream &operator<<(std::ostream &os, const FmtHR &fmt);
-};
-
-class FmtErr
-{
- public:
- explicit FmtErr(DWORD err) : mErr(err) {}
-
- private:
- DWORD mErr;
- friend std::ostream &operator<<(std::ostream &os, const FmtErr &fmt);
-};
-#endif // defined(ANGLE_PLATFORM_WINDOWS)
-
-template <typename T>
-std::ostream &FmtHexShort(std::ostream &os, T value)
-{
- return priv::FmtHex<4>(os, value);
-}
-
-template <typename T>
-std::ostream &FmtHexInt(std::ostream &os, T value)
-{
- return priv::FmtHex<8>(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_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_EVENT COMPACT_ANGLE_LOG_EX_EVENT(LogMessage)
-#define COMPACT_ANGLE_LOG_WARN COMPACT_ANGLE_LOG_EX_WARN(LogMessage)
-#define COMPACT_ANGLE_LOG_ERR COMPACT_ANGLE_LOG_EX_ERR(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
-
-#define ANGLE_EMPTY_STATEMENT for (;;) break
-#if !defined(NDEBUG) || defined(ANGLE_ENABLE_RELEASE_ASSERTS)
-#define ANGLE_ENABLE_ASSERTS
-#endif
-
-#define WARN() ANGLE_LOG(WARN)
-#define ERR() ANGLE_LOG(ERR)
-
-// 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(COMPILER_GCC) || defined(__clang__)
-#define ANGLE_CRASH() __builtin_trap()
-#else
-#define ANGLE_CRASH() ((void)(*(volatile char *)0 = 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)
-
-// 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) : ((ERR() << "\t! Assert failed in " << __FUNCTION__ << "(" \
- << __LINE__ << "): " << #expression), \
- ANGLE_ASSERT_IMPL(expression)))
-#else
-// These are just dummy values.
-#define COMPACT_ANGLE_LOG_EX_ASSERT(ClassName, ...) \
- COMPACT_ANGLE_LOG_EX_EVENT(ClassName, ##__VA_ARGS__)
-#define COMPACT_ANGLE_LOG_ASSERT COMPACT_ANGLE_LOG_EVENT
-namespace gl
-{
-constexpr LogSeverity LOG_ASSERT = LOG_EVENT;
-} // namespace gl
-
-#define ASSERT(condition) \
- ANGLE_LAZY_STREAM(ANGLE_LOG_STREAM(ASSERT), false ? !(condition) : false) \
- << "Check failed: " #condition ". "
-#endif // defined(ANGLE_ENABLE_ASSERTS)
-
-#define UNUSED_VARIABLE(variable) ((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() \
- { \
- ERR() << "\t! Unimplemented: " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ \
- << ")"; \
- ASSERT(NOASSERT_UNIMPLEMENTED); \
- } \
- ANGLE_EMPTY_STATEMENT
-
-// A macro for code which is not expected to be reached under valid assumptions
-#define UNREACHABLE() \
- ((ERR() << "\t! Unreachable reached: " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ \
- << ")"), \
- ASSERT(false))
-#else
-#define UNIMPLEMENTED() \
- { \
- ASSERT(NOASSERT_UNIMPLEMENTED); \
- } \
- ANGLE_EMPTY_STATEMENT
-
-// A macro for code which is not expected to be reached under valid assumptions
-#define UNREACHABLE() ASSERT(false)
-#endif // defined(ANGLE_TRACE_ENABLED) || defined(ANGLE_ENABLE_ASSERTS)
-
-#endif // COMMON_DEBUG_H_
diff --git a/src/3rdparty/angle/src/common/event_tracer.cpp b/src/3rdparty/angle/src/common/event_tracer.cpp
deleted file mode 100644
index 6dc8458acc..0000000000
--- a/src/3rdparty/angle/src/common/event_tracer.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "common/event_tracer.h"
-
-#include "common/debug.h"
-
-namespace angle
-{
-
-const unsigned char *GetTraceCategoryEnabledFlag(const char *name)
-{
- auto *platform = ANGLEPlatformCurrent();
- 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(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)
-{
- auto *platform = ANGLEPlatformCurrent();
- 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);
- ASSERT(handle != 0);
- return handle;
- }
-
- return static_cast<angle::TraceEventHandle>(0);
-}
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/common/event_tracer.h b/src/3rdparty/angle/src/common/event_tracer.h
deleted file mode 100644
index 9b30c750c1..0000000000
--- a/src/3rdparty/angle/src/common/event_tracer.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMMON_EVENT_TRACER_H_
-#define COMMON_EVENT_TRACER_H_
-
-#include "common/platform.h"
-#include "platform/Platform.h"
-
-namespace angle
-{
-
-const unsigned char *GetTraceCategoryEnabledFlag(const char* name);
-angle::TraceEventHandle AddTraceEvent(char phase,
- const unsigned char *categoryGroupEnabled,
- const char *name,
- unsigned long long id,
- int numArgs,
- const char **argNames,
- const unsigned char *argTypes,
- const unsigned long long *argValues,
- unsigned char flags);
-}
-
-#endif // COMMON_EVENT_TRACER_H_
diff --git a/src/3rdparty/angle/src/common/mathutil.cpp b/src/3rdparty/angle/src/common/mathutil.cpp
deleted file mode 100644
index 5db997c664..0000000000
--- a/src/3rdparty/angle/src/common/mathutil.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// mathutil.cpp: Math and bit manipulation functions.
-
-#include "common/mathutil.h"
-
-#include <algorithm>
-#include <math.h>
-
-namespace gl
-{
-
-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);
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/common/mathutil.h b/src/3rdparty/angle/src/common/mathutil.h
deleted file mode 100644
index 88aedddfe8..0000000000
--- a/src/3rdparty/angle/src/common/mathutil.h
+++ /dev/null
@@ -1,1145 +0,0 @@
-//
-// 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 <limits>
-#include <algorithm>
-#include <math.h>
-#include <string.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <anglebase/numerics/safe_math.h>
-
-#include "common/debug.h"
-#include "common/platform.h"
-
-namespace angle
-{
-using base::CheckedNumeric;
-using base::IsValueInRangeForNumericType;
-}
-
-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 > 0x47FFEFFF) // Infinity
- {
- return static_cast<unsigned short>(sign | 0x7FFF);
- }
- else if(abs < 0x38800000) // Denormal
- {
- unsigned int mantissa = (abs & 0x007FFFFF) | 0x00800000;
- int e = 113 - (abs >> 23);
-
- if(e < 24)
- {
- abs = mantissa >> e;
- }
- else
- {
- abs = 0;
- }
-
- return 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));
- }
-}
-
-template <typename T>
-inline float normalizedToFloat(T input)
-{
- static_assert(std::numeric_limits<T>::is_integer, "T must be an integer.");
-
- const float inverseMax = 1.0f / std::numeric_limits<T>::max();
- return input * inverseMax;
-}
-
-template <unsigned int inputBitCount, typename T>
-inline float normalizedToFloat(T input)
-{
- 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.");
-
- const float inverseMax = 1.0f / ((1 << inputBitCount) - 1);
- return input * inverseMax;
-}
-
-template <typename T>
-inline T floatToNormalized(float input)
-{
- 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.");
- 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; }
-
- private:
- T mLow;
- T mHigh;
-};
-
-typedef Range<int> RangeI;
-typedef Range<unsigned int> RangeUI;
-
-struct IndexRange
-{
- 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(ANGLE_PLATFORM_WINDOWS)
-#if defined(_M_ARM) || defined(_M_ARM64)
-inline int BitCount(uint32_t bits)
-{
- bits = bits - ((bits >> 1) & 0x55555555);
- bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
- return (((bits + (bits >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
-}
-#else // _M_ARM || _M_ARM64
-inline int BitCount(uint32_t bits)
-{
- return static_cast<int>(__popcnt(bits));
-}
-#if defined(ANGLE_IS_64_BIT_CPU)
-inline int BitCount(uint64_t bits)
-{
- return static_cast<int>(__popcnt64(bits));
-}
-#endif // !_M_ARM
-#endif // defined(ANGLE_IS_64_BIT_CPU)
-#endif // defined(ANGLE_PLATFORM_WINDOWS)
-
-#if defined(ANGLE_PLATFORM_POSIX)
-inline int BitCount(uint32_t bits)
-{
- return __builtin_popcount(bits);
-}
-
-#if defined(ANGLE_IS_64_BIT_CPU)
-inline int BitCount(uint64_t bits)
-{
- return __builtin_popcountll(bits);
-}
-#endif // defined(ANGLE_IS_64_BIT_CPU)
-#endif // defined(ANGLE_PLATFORM_POSIX)
-
-#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)
-
-// 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);
-}
-
-} // 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 unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor)
-{
- unsigned int divided = value / divisor;
- return (divided + ((value % divisor == 0) ? 0 : 1));
-}
-
-#if defined(_MSC_VER)
-
-#define ANGLE_ROTL(x,y) _rotl(x,y)
-#define ANGLE_ROTR16(x,y) _rotr16(x,y)
-
-#else
-
-inline uint32_t RotL(uint32_t x, int8_t r)
-{
- return (x << r) | (x >> (32 - 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_ROTR16(x, y) ::rx::RotR16(x, y)
-
-#endif // namespace rx
-
-}
-
-#endif // COMMON_MATHUTIL_H_
diff --git a/src/3rdparty/angle/src/common/matrix_utils.h b/src/3rdparty/angle/src/common/matrix_utils.h
deleted file mode 100644
index aa3f89536e..0000000000
--- a/src/3rdparty/angle/src/common/matrix_utils.h
+++ /dev/null
@@ -1,386 +0,0 @@
-//
-// 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"
-
-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
- {
- return mElements[rowIndex * columns() + columnIndex];
- }
-
- T &operator()(const unsigned int &rowIndex, const unsigned int &columnIndex)
- {
- return mElements[rowIndex * columns() + columnIndex];
- }
-
- const T &at(const unsigned int &rowIndex, const unsigned int &columnIndex) const
- {
- 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;
- }
-
- 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; }
-
- Matrix<T> compMult(const Matrix<T> &mat1) const
- {
- Matrix result(std::vector<T>(mElements.size()), size());
- for (unsigned int i = 0; i < columns(); i++)
- for (unsigned int j = 0; j < rows(); j++)
- result(i, j) = at(i, j) * mat1(i, j);
-
- 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;
- }
- }
-
- private:
- std::vector<T> mElements;
- unsigned int mRows;
- unsigned int mCols;
-};
-
-} // namespace angle
-
-#endif // COMMON_MATRIX_UTILS_H_
-
diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
deleted file mode 100644
index fb251da579..0000000000
--- a/src/3rdparty/angle/src/common/platform.h
+++ /dev/null
@@ -1,103 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// platform.h: Operating system specific includes and defines.
-
-#ifndef COMMON_PLATFORM_H_
-#define COMMON_PLATFORM_H_
-
-#if defined(_WIN32) || defined(_WIN64)
-# define ANGLE_PLATFORM_WINDOWS 1
-#elif defined(__APPLE__)
-# define ANGLE_PLATFORM_APPLE 1
-# define ANGLE_PLATFORM_POSIX 1
-#elif defined(ANDROID)
-# define ANGLE_PLATFORM_ANDROID 1
-# define ANGLE_PLATFORM_POSIX 1
-#elif defined(__linux__) || defined(EMSCRIPTEN)
-# define ANGLE_PLATFORM_LINUX 1
-# define ANGLE_PLATFORM_POSIX 1
-#elif defined(__FreeBSD__) || \
- defined(__OpenBSD__) || \
- defined(__NetBSD__) || \
- defined(__DragonFly__) || \
- defined(__sun) || \
- defined(__GLIBC__) || \
- defined(__GNU__) || \
- defined(__QNX__) || \
- 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 <windows.h>
-# include <intrin.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
-
-# if defined(ANGLE_ENABLE_D3D11)
-#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__)) && !defined(__MINGW32__)
-#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
-
-#endif // COMMON_PLATFORM_H_
diff --git a/src/3rdparty/angle/src/common/string_utils.cpp b/src/3rdparty/angle/src/common/string_utils.cpp
deleted file mode 100644
index 26f384bb2a..0000000000
--- a/src/3rdparty/angle/src/common/string_utils.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-//
-// 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 <algorithm>
-#include <stdlib.h>
-#include <string.h>
-#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(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);
-}
-
-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();
-}
-
-Optional<std::vector<wchar_t>> WidenString(size_t length, const char *cString)
-{
- std::vector<wchar_t> wcstring(length + 1);
-#if !defined(ANGLE_PLATFORM_WINDOWS)
- size_t written = mbstowcs(wcstring.data(), cString, length + 1);
- if (written == 0)
- {
- return Optional<std::vector<wchar_t>>::Invalid();
- }
-#else
- size_t convertedChars = 0;
- errno_t err = mbstowcs_s(&convertedChars, wcstring.data(), length + 1, cString, _TRUNCATE);
- if (err != 0)
- {
- return Optional<std::vector<wchar_t>>::Invalid();
- }
-#endif
- return Optional<std::vector<wchar_t>>(wcstring);
-}
-
-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/src/3rdparty/angle/src/common/string_utils.h b/src/3rdparty/angle/src/common/string_utils.h
deleted file mode 100644
index 07bf1ff81a..0000000000
--- a/src/3rdparty/angle/src/common/string_utils.h
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// 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);
-
-bool HexStringToUInt(const std::string &input, unsigned int *uintOut);
-
-bool ReadFileToString(const std::string &path, std::string *stringOut);
-
-Optional<std::vector<wchar_t>> WidenString(size_t length, const char *cString);
-
-// 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/src/3rdparty/angle/src/common/system_utils.h b/src/3rdparty/angle/src/common/system_utils.h
deleted file mode 100644
index d61faa53fd..0000000000
--- a/src/3rdparty/angle/src/common/system_utils.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// 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/angleutils.h"
-#include "common/Optional.h"
-
-namespace angle
-{
-
-const char *GetExecutablePath();
-const char *GetExecutableDirectory();
-const char *GetSharedLibraryExtension();
-Optional<std::string> GetCWD();
-bool SetCWD(const char *dirName);
-bool SetEnvironmentVar(const char *variableName, const char *value);
-
-} // namespace angle
-
-#endif // COMMON_SYSTEM_UTILS_H_
diff --git a/src/3rdparty/angle/src/common/system_utils_linux.cpp b/src/3rdparty/angle/src/common/system_utils_linux.cpp
deleted file mode 100644
index 98ab4cce6d..0000000000
--- a/src/3rdparty/angle/src/common/system_utils_linux.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// 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
-{
-
-namespace
-{
-
-std::string GetExecutablePathImpl()
-{
- // 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 GetExecutableDirectoryImpl()
-{
- std::string executablePath = GetExecutablePath();
- size_t lastPathSepLoc = executablePath.find_last_of("/");
- return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
-}
-
-} // anonymous namespace
-
-const char *GetExecutablePath()
-{
- // TODO(jmadill): Make global static string thread-safe.
- const static std::string &exePath = GetExecutablePathImpl();
- return exePath.c_str();
-}
-
-const char *GetExecutableDirectory()
-{
- // TODO(jmadill): Make global static string thread-safe.
- const static std::string &exeDir = GetExecutableDirectoryImpl();
- return exeDir.c_str();
-}
-
-const char *GetSharedLibraryExtension()
-{
- return "so";
-}
-
-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 SetEnvironmentVar(const char *variableName, const char *value)
-{
- return (setenv(variableName, value, 1) == 0);
-}
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/common/system_utils_mac.cpp b/src/3rdparty/angle/src/common/system_utils_mac.cpp
deleted file mode 100644
index 03b9185ab1..0000000000
--- a/src/3rdparty/angle/src/common/system_utils_mac.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// 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 <cstdlib>
-#include <mach-o/dyld.h>
-#include <vector>
-
-#include <array>
-
-namespace angle
-{
-
-namespace
-{
-
-std::string GetExecutablePathImpl()
-{
- 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 GetExecutableDirectoryImpl()
-{
- std::string executablePath = GetExecutablePath();
- size_t lastPathSepLoc = executablePath.find_last_of("/");
- return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
-}
-
-} // anonymous namespace
-
-const char *GetExecutablePath()
-{
- // TODO(jmadill): Make global static string thread-safe.
- const static std::string &exePath = GetExecutablePathImpl();
- return exePath.c_str();
-}
-
-const char *GetExecutableDirectory()
-{
- // TODO(jmadill): Make global static string thread-safe.
- const static std::string &exeDir = GetExecutableDirectoryImpl();
- return exeDir.c_str();
-}
-
-const char *GetSharedLibraryExtension()
-{
- return "dylib";
-}
-
-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 SetEnvironmentVar(const char *variableName, const char *value)
-{
- return (setenv(variableName, value, 1) == 0);
-}
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/common/system_utils_win.cpp b/src/3rdparty/angle/src/common/system_utils_win.cpp
deleted file mode 100644
index 6bb2bfbd3f..0000000000
--- a/src/3rdparty/angle/src/common/system_utils_win.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// 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
-{
-
-std::string GetExecutablePathImpl()
-{
- 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 GetExecutableDirectoryImpl()
-{
- std::string executablePath = GetExecutablePath();
- size_t lastPathSepLoc = executablePath.find_last_of("\\/");
- return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
-}
-
-} // anonymous namespace
-
-const char *GetExecutablePath()
-{
- // TODO(jmadill): Make global static string thread-safe.
- const static std::string &exePath = GetExecutablePathImpl();
- return exePath.c_str();
-}
-
-const char *GetExecutableDirectory()
-{
- // TODO(jmadill): Make global static string thread-safe.
- const static std::string &exeDir = GetExecutableDirectoryImpl();
- return exeDir.c_str();
-}
-
-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 SetEnvironmentVar(const char *variableName, const char *value)
-{
- return (SetEnvironmentVariableA(variableName, value) == TRUE);
-}
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/common/third_party/base/README.angle b/src/3rdparty/angle/src/common/third_party/base/README.angle
deleted file mode 100644
index ca0943bc99..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/README.angle
+++ /dev/null
@@ -1,27 +0,0 @@
-Name: Chromium base:: helper Classes
-Short Name: base::numerics, base::MRUCachem, base::SHA1
-Version:
-URL: https://chromium.googlesource.com/chromium/src/base/+/master
-SOURCE CODE: Copy the Chromium folder manually into this folder and run git cl format.
-Date: 24/05/2017
-Revision: 28b5bbb227d331c01e6ff9b2f8729732135aadc7 (Chromium)
-Security Critical: no
-License: Chromium
-License File: LICENSE in Chromium/src
-
-Description:
-base::numerics is a library for doing some simple safe math and conversions.
-base::MRUCache is a few collections of most-recently-used caching structures.
-base::SHA1 is a secure hashing algorithm.
-
-To update the checkout, simply overwrite the folder with Chromium's latest, apply
-the appropriate namespace, and make sure the paths are correct (anglebase/ instead of
-base/), and update the header guards and macros.
-
-Modifications:
-
-- the file scope is now anglebase/ from base/ to prevent include conflicts.
-- anglebase/logging.h defines (D)CHECK to be ASSERT to be compatible with ANGLE.
-- the headers use namespace angle::base instead of base:: to avoid ODR
- violations when ANGLE code is mixed with Chromium code.
-- header guards and macros are changed from BASE to ANGLEBASE to prevent conflicts.
diff --git a/src/3rdparty/angle/src/common/third_party/base/anglebase/base_export.h b/src/3rdparty/angle/src/common/third_party/base/anglebase/base_export.h
deleted file mode 100644
index 1af5485336..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/base_export.h
+++ /dev/null
@@ -1,13 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/common/third_party/base/anglebase/containers/mru_cache.h b/src/3rdparty/angle/src/common/third_party/base/anglebase/containers/mru_cache.h
deleted file mode 100644
index fe4fec5768..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/containers/mru_cache.h
+++ /dev/null
@@ -1,275 +0,0 @@
-// 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/src/3rdparty/angle/src/common/third_party/base/anglebase/logging.h b/src/3rdparty/angle/src/common/third_party/base/anglebase/logging.h
deleted file mode 100644
index 85ad82b47d..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/logging.h
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/common/third_party/base/anglebase/macros.h b/src/3rdparty/angle/src/common/third_party/base/anglebase/macros.h
deleted file mode 100644
index 06391784e4..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/macros.h
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/OWNERS b/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/OWNERS
deleted file mode 100644
index 41f35fc79b..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-jschuh@chromium.org
-tsepez@chromium.org
-
diff --git a/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_conversions.h b/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_conversions.h
deleted file mode 100644
index 43babc31a8..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_conversions.h
+++ /dev/null
@@ -1,179 +0,0 @@
-// 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/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_conversions_impl.h b/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_conversions_impl.h
deleted file mode 100644
index 10ed6c7a7f..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_conversions_impl.h
+++ /dev/null
@@ -1,274 +0,0 @@
-// 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/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_math.h b/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_math.h
deleted file mode 100644
index 3af4db63f7..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_math.h
+++ /dev/null
@@ -1,329 +0,0 @@
-// 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; }
-
- // 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/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_math_impl.h b/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_math_impl.h
deleted file mode 100644
index 2831cc6ceb..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_math_impl.h
+++ /dev/null
@@ -1,575 +0,0 @@
-// 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/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_numerics_unittest.cc b/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_numerics_unittest.cc
deleted file mode 100644
index 052d850427..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_numerics_unittest.cc
+++ /dev/null
@@ -1,771 +0,0 @@
-// Copyright 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.
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <limits>
-#include <type_traits>
-
-#include "base/compiler_specific.h"
-#include "base/numerics/safe_conversions.h"
-#include "base/numerics/safe_math.h"
-#include "build/build_config.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-#if defined(COMPILER_MSVC) && defined(ARCH_CPU_32_BITS)
-#include <mmintrin.h>
-#endif
-
-using std::numeric_limits;
-using base::CheckedNumeric;
-using base::checked_cast;
-using base::IsValueInRangeForNumericType;
-using base::IsValueNegative;
-using base::SizeT;
-using base::StrictNumeric;
-using base::saturated_cast;
-using base::strict_cast;
-using base::internal::MaxExponent;
-using base::internal::RANGE_VALID;
-using base::internal::RANGE_INVALID;
-using base::internal::RANGE_OVERFLOW;
-using base::internal::RANGE_UNDERFLOW;
-using base::internal::SignedIntegerForSize;
-
-// These tests deliberately cause arithmetic overflows. If the compiler is
-// aggressive enough, it can const fold these overflows. Disable warnings about
-// overflows for const expressions.
-#if defined(OS_WIN)
-#pragma warning(disable : 4756)
-#endif
-
-// This is a helper function for finding the maximum value in Src that can be
-// wholy represented as the destination floating-point type.
-template <typename Dst, typename Src>
-Dst GetMaxConvertibleToFloat()
-{
- typedef numeric_limits<Dst> DstLimits;
- typedef numeric_limits<Src> SrcLimits;
- static_assert(SrcLimits::is_specialized, "Source must be numeric.");
- static_assert(DstLimits::is_specialized, "Destination must be numeric.");
- CHECK(DstLimits::is_iec559);
-
- if (SrcLimits::digits <= DstLimits::digits &&
- MaxExponent<Src>::value <= MaxExponent<Dst>::value)
- return SrcLimits::max();
- Src max = SrcLimits::max() / 2 + (SrcLimits::is_integer ? 1 : 0);
- while (max != static_cast<Src>(static_cast<Dst>(max)))
- {
- max /= 2;
- }
- return static_cast<Dst>(max);
-}
-
-// Helper macros to wrap displaying the conversion types and line numbers.
-#define TEST_EXPECTED_VALIDITY(expected, actual) \
- EXPECT_EQ(expected, CheckedNumeric<Dst>(actual).IsValid()) \
- << "Result test: Value " << +(actual).ValueUnsafe() << " as " << dst << " on line " \
- << line;
-
-#define TEST_EXPECTED_SUCCESS(actual) TEST_EXPECTED_VALIDITY(true, actual)
-#define TEST_EXPECTED_FAILURE(actual) TEST_EXPECTED_VALIDITY(false, actual)
-
-#define TEST_EXPECTED_VALUE(expected, actual) \
- EXPECT_EQ(static_cast<Dst>(expected), CheckedNumeric<Dst>(actual).ValueUnsafe()) \
- << "Result test: Value " << +((actual).ValueUnsafe()) << " as " << dst << " on line " \
- << line;
-
-// Signed integer arithmetic.
-template <typename Dst>
-static void TestSpecializedArithmetic(
- const char *dst,
- int line,
- typename std::enable_if<numeric_limits<Dst>::is_integer && numeric_limits<Dst>::is_signed,
- int>::type = 0)
-{
- typedef numeric_limits<Dst> DstLimits;
- TEST_EXPECTED_FAILURE(-CheckedNumeric<Dst>(DstLimits::min()));
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()).Abs());
- TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(-1).Abs());
-
- TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) + -1);
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) + -1);
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(-DstLimits::max()) + -DstLimits::max());
-
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) - 1);
- TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()) - -1);
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) - -DstLimits::max());
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(-DstLimits::max()) - DstLimits::max());
-
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) * 2);
-
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) / -1);
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(-1) / 2);
-
- // Modulus is legal only for integers.
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>() % 1);
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % 1);
- TEST_EXPECTED_VALUE(-1, CheckedNumeric<Dst>(-1) % 2);
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(-1) % -2);
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(DstLimits::min()) % 2);
- TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(DstLimits::max()) % 2);
- // Test all the different modulus combinations.
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(0, 1 % CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % 1);
- CheckedNumeric<Dst> checked_dst = 1;
- TEST_EXPECTED_VALUE(0, checked_dst %= 1);
-}
-
-// Unsigned integer arithmetic.
-template <typename Dst>
-static void TestSpecializedArithmetic(
- const char *dst,
- int line,
- typename std::enable_if<numeric_limits<Dst>::is_integer && !numeric_limits<Dst>::is_signed,
- int>::type = 0)
-{
- typedef numeric_limits<Dst> DstLimits;
- TEST_EXPECTED_SUCCESS(-CheckedNumeric<Dst>(DstLimits::min()));
- TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()).Abs());
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) + -1);
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) - 1);
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(DstLimits::min()) * 2);
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) / 2);
- TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()).UnsignedAbs());
- TEST_EXPECTED_SUCCESS(CheckedNumeric<typename SignedIntegerForSize<Dst>::type>(
- std::numeric_limits<typename SignedIntegerForSize<Dst>::type>::min())
- .UnsignedAbs());
-
- // Modulus is legal only for integers.
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>() % 1);
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % 1);
- TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) % 2);
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(DstLimits::min()) % 2);
- TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(DstLimits::max()) % 2);
- // Test all the different modulus combinations.
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(0, 1 % CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % 1);
- CheckedNumeric<Dst> checked_dst = 1;
- TEST_EXPECTED_VALUE(0, checked_dst %= 1);
-}
-
-// Floating point arithmetic.
-template <typename Dst>
-void TestSpecializedArithmetic(
- const char *dst,
- int line,
- typename std::enable_if<numeric_limits<Dst>::is_iec559, int>::type = 0)
-{
- typedef numeric_limits<Dst> DstLimits;
- TEST_EXPECTED_SUCCESS(-CheckedNumeric<Dst>(DstLimits::min()));
-
- TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()).Abs());
- TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(-1).Abs());
-
- TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()) + -1);
- TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) + 1);
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(-DstLimits::max()) + -DstLimits::max());
-
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) - -DstLimits::max());
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(-DstLimits::max()) - DstLimits::max());
-
- TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()) * 2);
-
- TEST_EXPECTED_VALUE(-0.5, CheckedNumeric<Dst>(-1.0) / 2);
- EXPECT_EQ(static_cast<Dst>(1.0), CheckedNumeric<Dst>(1.0).ValueFloating());
-}
-
-// Generic arithmetic tests.
-template <typename Dst>
-static void TestArithmetic(const char *dst, int line)
-{
- typedef numeric_limits<Dst> DstLimits;
-
- EXPECT_EQ(true, CheckedNumeric<Dst>().IsValid());
- EXPECT_EQ(
- false,
- CheckedNumeric<Dst>(CheckedNumeric<Dst>(DstLimits::max()) * DstLimits::max()).IsValid());
- EXPECT_EQ(static_cast<Dst>(0), CheckedNumeric<Dst>().ValueOrDie());
- EXPECT_EQ(static_cast<Dst>(0), CheckedNumeric<Dst>().ValueOrDefault(1));
- EXPECT_EQ(static_cast<Dst>(1),
- CheckedNumeric<Dst>(CheckedNumeric<Dst>(DstLimits::max()) * DstLimits::max())
- .ValueOrDefault(1));
-
- // Test the operator combinations.
- TEST_EXPECTED_VALUE(2, CheckedNumeric<Dst>(1) + CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) - CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) * CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) / CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(2, 1 + CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(0, 1 - CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(1, 1 * CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(1, 1 / CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(2, CheckedNumeric<Dst>(1) + 1);
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) - 1);
- TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) * 1);
- TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) / 1);
- CheckedNumeric<Dst> checked_dst = 1;
- TEST_EXPECTED_VALUE(2, checked_dst += 1);
- checked_dst = 1;
- TEST_EXPECTED_VALUE(0, checked_dst -= 1);
- checked_dst = 1;
- TEST_EXPECTED_VALUE(1, checked_dst *= 1);
- checked_dst = 1;
- TEST_EXPECTED_VALUE(1, checked_dst /= 1);
-
- // Generic negation.
- TEST_EXPECTED_VALUE(0, -CheckedNumeric<Dst>());
- TEST_EXPECTED_VALUE(-1, -CheckedNumeric<Dst>(1));
- TEST_EXPECTED_VALUE(1, -CheckedNumeric<Dst>(-1));
- TEST_EXPECTED_VALUE(static_cast<Dst>(DstLimits::max() * -1),
- -CheckedNumeric<Dst>(DstLimits::max()));
-
- // Generic absolute value.
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>().Abs());
- TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1).Abs());
- TEST_EXPECTED_VALUE(DstLimits::max(), CheckedNumeric<Dst>(DstLimits::max()).Abs());
-
- // Generic addition.
- TEST_EXPECTED_VALUE(1, (CheckedNumeric<Dst>() + 1));
- TEST_EXPECTED_VALUE(2, (CheckedNumeric<Dst>(1) + 1));
- TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(-1) + 1));
- TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()) + 1);
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) + DstLimits::max());
-
- // Generic subtraction.
- TEST_EXPECTED_VALUE(-1, (CheckedNumeric<Dst>() - 1));
- TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(1) - 1));
- TEST_EXPECTED_VALUE(-2, (CheckedNumeric<Dst>(-1) - 1));
- TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) - 1);
-
- // Generic multiplication.
- TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>() * 1));
- TEST_EXPECTED_VALUE(1, (CheckedNumeric<Dst>(1) * 1));
- TEST_EXPECTED_VALUE(-2, (CheckedNumeric<Dst>(-1) * 2));
- TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(0) * 0));
- TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(-1) * 0));
- TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(0) * -1));
- TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) * DstLimits::max());
-
- // Generic division.
- TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>() / 1);
- TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) / 1);
- TEST_EXPECTED_VALUE(DstLimits::min() / 2, CheckedNumeric<Dst>(DstLimits::min()) / 2);
- TEST_EXPECTED_VALUE(DstLimits::max() / 2, CheckedNumeric<Dst>(DstLimits::max()) / 2);
-
- TestSpecializedArithmetic<Dst>(dst, line);
-}
-
-// Helper macro to wrap displaying the conversion types and line numbers.
-#define TEST_ARITHMETIC(Dst) TestArithmetic<Dst>(#Dst, __LINE__)
-
-TEST(SafeNumerics, SignedIntegerMath)
-{
- TEST_ARITHMETIC(int8_t);
- TEST_ARITHMETIC(int);
- TEST_ARITHMETIC(intptr_t);
- TEST_ARITHMETIC(intmax_t);
-}
-
-TEST(SafeNumerics, UnsignedIntegerMath)
-{
- TEST_ARITHMETIC(uint8_t);
- TEST_ARITHMETIC(unsigned int);
- TEST_ARITHMETIC(uintptr_t);
- TEST_ARITHMETIC(uintmax_t);
-}
-
-TEST(SafeNumerics, FloatingPointMath)
-{
- TEST_ARITHMETIC(float);
- TEST_ARITHMETIC(double);
-}
-
-// Enumerates the five different conversions types we need to test.
-enum NumericConversionType
-{
- SIGN_PRESERVING_VALUE_PRESERVING,
- SIGN_PRESERVING_NARROW,
- SIGN_TO_UNSIGN_WIDEN_OR_EQUAL,
- SIGN_TO_UNSIGN_NARROW,
- UNSIGN_TO_SIGN_NARROW_OR_EQUAL,
-};
-
-// Template covering the different conversion tests.
-template <typename Dst, typename Src, NumericConversionType conversion>
-struct TestNumericConversion
-{
-};
-
-// EXPECT_EQ wrappers providing specific detail on test failures.
-#define TEST_EXPECTED_RANGE(expected, actual) \
- EXPECT_EQ(expected, base::internal::DstRangeRelationToSrcRange<Dst>(actual)) \
- << "Conversion test: " << src << " value " << actual << " to " << dst << " on line " \
- << line;
-
-template <typename Dst, typename Src>
-struct TestNumericConversion<Dst, Src, SIGN_PRESERVING_VALUE_PRESERVING>
-{
- static void Test(const char *dst, const char *src, int line)
- {
- typedef numeric_limits<Src> SrcLimits;
- typedef numeric_limits<Dst> DstLimits;
- // Integral to floating.
- static_assert(
- (DstLimits::is_iec559 && SrcLimits::is_integer) ||
- // Not floating to integral and...
- (!(DstLimits::is_integer && SrcLimits::is_iec559) &&
- // Same sign, same numeric, source is narrower or same.
- ((SrcLimits::is_signed == DstLimits::is_signed && sizeof(Dst) >= sizeof(Src)) ||
- // Or signed destination and source is smaller
- (DstLimits::is_signed && sizeof(Dst) > sizeof(Src)))),
- "Comparison must be sign preserving and value preserving");
-
- const CheckedNumeric<Dst> checked_dst = SrcLimits::max();
- TEST_EXPECTED_SUCCESS(checked_dst);
- if (MaxExponent<Dst>::value > MaxExponent<Src>::value)
- {
- if (MaxExponent<Dst>::value >= MaxExponent<Src>::value * 2 - 1)
- {
- // At least twice larger type.
- TEST_EXPECTED_SUCCESS(SrcLimits::max() * checked_dst);
- }
- else
- { // Larger, but not at least twice as large.
- TEST_EXPECTED_FAILURE(SrcLimits::max() * checked_dst);
- TEST_EXPECTED_SUCCESS(checked_dst + 1);
- }
- }
- else
- { // Same width type.
- TEST_EXPECTED_FAILURE(checked_dst + 1);
- }
-
- TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::max());
- TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(1));
- if (SrcLimits::is_iec559)
- {
- TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::max() * static_cast<Src>(-1));
- TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::infinity());
- TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::infinity() * -1);
- TEST_EXPECTED_RANGE(RANGE_INVALID, SrcLimits::quiet_NaN());
- }
- else if (numeric_limits<Src>::is_signed)
- {
- TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(-1));
- TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::min());
- }
- }
-};
-
-template <typename Dst, typename Src>
-struct TestNumericConversion<Dst, Src, SIGN_PRESERVING_NARROW>
-{
- static void Test(const char *dst, const char *src, int line)
- {
- typedef numeric_limits<Src> SrcLimits;
- typedef numeric_limits<Dst> DstLimits;
- static_assert(SrcLimits::is_signed == DstLimits::is_signed,
- "Destination and source sign must be the same");
- static_assert(sizeof(Dst) < sizeof(Src) || (DstLimits::is_integer && SrcLimits::is_iec559),
- "Destination must be narrower than source");
-
- const CheckedNumeric<Dst> checked_dst;
- TEST_EXPECTED_FAILURE(checked_dst + SrcLimits::max());
- TEST_EXPECTED_VALUE(1, checked_dst + static_cast<Src>(1));
- TEST_EXPECTED_FAILURE(checked_dst - SrcLimits::max());
-
- TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::max());
- TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(1));
- if (SrcLimits::is_iec559)
- {
- TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::max() * -1);
- TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(-1));
- TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::infinity());
- TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::infinity() * -1);
- TEST_EXPECTED_RANGE(RANGE_INVALID, SrcLimits::quiet_NaN());
- if (DstLimits::is_integer)
- {
- if (SrcLimits::digits < DstLimits::digits)
- {
- TEST_EXPECTED_RANGE(RANGE_OVERFLOW, static_cast<Src>(DstLimits::max()));
- }
- else
- {
- TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(DstLimits::max()));
- }
- TEST_EXPECTED_RANGE(RANGE_VALID,
- static_cast<Src>(GetMaxConvertibleToFloat<Src, Dst>()));
- TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(DstLimits::min()));
- }
- }
- else if (SrcLimits::is_signed)
- {
- TEST_EXPECTED_VALUE(-1, checked_dst - static_cast<Src>(1));
- TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::min());
- TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(-1));
- }
- else
- {
- TEST_EXPECTED_FAILURE(checked_dst - static_cast<Src>(1));
- TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::min());
- }
- }
-};
-
-template <typename Dst, typename Src>
-struct TestNumericConversion<Dst, Src, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL>
-{
- static void Test(const char *dst, const char *src, int line)
- {
- typedef numeric_limits<Src> SrcLimits;
- typedef numeric_limits<Dst> DstLimits;
- static_assert(sizeof(Dst) >= sizeof(Src),
- "Destination must be equal or wider than source.");
- static_assert(SrcLimits::is_signed, "Source must be signed");
- static_assert(!DstLimits::is_signed, "Destination must be unsigned");
-
- const CheckedNumeric<Dst> checked_dst;
- TEST_EXPECTED_VALUE(SrcLimits::max(), checked_dst + SrcLimits::max());
- TEST_EXPECTED_FAILURE(checked_dst + static_cast<Src>(-1));
- TEST_EXPECTED_FAILURE(checked_dst + -SrcLimits::max());
-
- TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::min());
- TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::max());
- TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(1));
- TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, static_cast<Src>(-1));
- }
-};
-
-template <typename Dst, typename Src>
-struct TestNumericConversion<Dst, Src, SIGN_TO_UNSIGN_NARROW>
-{
- static void Test(const char *dst, const char *src, int line)
- {
- typedef numeric_limits<Src> SrcLimits;
- typedef numeric_limits<Dst> DstLimits;
- static_assert(
- (DstLimits::is_integer && SrcLimits::is_iec559) || (sizeof(Dst) < sizeof(Src)),
- "Destination must be narrower than source.");
- static_assert(SrcLimits::is_signed, "Source must be signed.");
- static_assert(!DstLimits::is_signed, "Destination must be unsigned.");
-
- const CheckedNumeric<Dst> checked_dst;
- TEST_EXPECTED_VALUE(1, checked_dst + static_cast<Src>(1));
- TEST_EXPECTED_FAILURE(checked_dst + SrcLimits::max());
- TEST_EXPECTED_FAILURE(checked_dst + static_cast<Src>(-1));
- TEST_EXPECTED_FAILURE(checked_dst + -SrcLimits::max());
-
- TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::max());
- TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(1));
- TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, static_cast<Src>(-1));
- if (SrcLimits::is_iec559)
- {
- TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::max() * -1);
- TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::infinity());
- TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::infinity() * -1);
- TEST_EXPECTED_RANGE(RANGE_INVALID, SrcLimits::quiet_NaN());
- if (DstLimits::is_integer)
- {
- if (SrcLimits::digits < DstLimits::digits)
- {
- TEST_EXPECTED_RANGE(RANGE_OVERFLOW, static_cast<Src>(DstLimits::max()));
- }
- else
- {
- TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(DstLimits::max()));
- }
- TEST_EXPECTED_RANGE(RANGE_VALID,
- static_cast<Src>(GetMaxConvertibleToFloat<Src, Dst>()));
- TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(DstLimits::min()));
- }
- }
- else
- {
- TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::min());
- }
- }
-};
-
-template <typename Dst, typename Src>
-struct TestNumericConversion<Dst, Src, UNSIGN_TO_SIGN_NARROW_OR_EQUAL>
-{
- static void Test(const char *dst, const char *src, int line)
- {
- typedef numeric_limits<Src> SrcLimits;
- typedef numeric_limits<Dst> DstLimits;
- static_assert(sizeof(Dst) <= sizeof(Src),
- "Destination must be narrower or equal to source.");
- static_assert(!SrcLimits::is_signed, "Source must be unsigned.");
- static_assert(DstLimits::is_signed, "Destination must be signed.");
-
- const CheckedNumeric<Dst> checked_dst;
- TEST_EXPECTED_VALUE(1, checked_dst + static_cast<Src>(1));
- TEST_EXPECTED_FAILURE(checked_dst + SrcLimits::max());
- TEST_EXPECTED_VALUE(SrcLimits::min(), checked_dst + SrcLimits::min());
-
- TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::min());
- TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::max());
- TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(1));
- }
-};
-
-// Helper macro to wrap displaying the conversion types and line numbers
-#define TEST_NUMERIC_CONVERSION(d, s, t) TestNumericConversion<d, s, t>::Test(#d, #s, __LINE__)
-
-TEST(SafeNumerics, IntMinOperations)
-{
- TEST_NUMERIC_CONVERSION(int8_t, int8_t, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(uint8_t, uint8_t, SIGN_PRESERVING_VALUE_PRESERVING);
-
- TEST_NUMERIC_CONVERSION(int8_t, int, SIGN_PRESERVING_NARROW);
- TEST_NUMERIC_CONVERSION(uint8_t, unsigned int, SIGN_PRESERVING_NARROW);
- TEST_NUMERIC_CONVERSION(int8_t, float, SIGN_PRESERVING_NARROW);
-
- TEST_NUMERIC_CONVERSION(uint8_t, int8_t, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL);
-
- TEST_NUMERIC_CONVERSION(uint8_t, int, SIGN_TO_UNSIGN_NARROW);
- TEST_NUMERIC_CONVERSION(uint8_t, intmax_t, SIGN_TO_UNSIGN_NARROW);
- TEST_NUMERIC_CONVERSION(uint8_t, float, SIGN_TO_UNSIGN_NARROW);
-
- TEST_NUMERIC_CONVERSION(int8_t, unsigned int, UNSIGN_TO_SIGN_NARROW_OR_EQUAL);
- TEST_NUMERIC_CONVERSION(int8_t, uintmax_t, UNSIGN_TO_SIGN_NARROW_OR_EQUAL);
-}
-
-TEST(SafeNumerics, IntOperations)
-{
- TEST_NUMERIC_CONVERSION(int, int, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(unsigned int, unsigned int, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(int, int8_t, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(unsigned int, uint8_t, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(int, uint8_t, SIGN_PRESERVING_VALUE_PRESERVING);
-
- TEST_NUMERIC_CONVERSION(int, intmax_t, SIGN_PRESERVING_NARROW);
- TEST_NUMERIC_CONVERSION(unsigned int, uintmax_t, SIGN_PRESERVING_NARROW);
- TEST_NUMERIC_CONVERSION(int, float, SIGN_PRESERVING_NARROW);
- TEST_NUMERIC_CONVERSION(int, double, SIGN_PRESERVING_NARROW);
-
- TEST_NUMERIC_CONVERSION(unsigned int, int, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL);
- TEST_NUMERIC_CONVERSION(unsigned int, int8_t, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL);
-
- TEST_NUMERIC_CONVERSION(unsigned int, intmax_t, SIGN_TO_UNSIGN_NARROW);
- TEST_NUMERIC_CONVERSION(unsigned int, float, SIGN_TO_UNSIGN_NARROW);
- TEST_NUMERIC_CONVERSION(unsigned int, double, SIGN_TO_UNSIGN_NARROW);
-
- TEST_NUMERIC_CONVERSION(int, unsigned int, UNSIGN_TO_SIGN_NARROW_OR_EQUAL);
- TEST_NUMERIC_CONVERSION(int, uintmax_t, UNSIGN_TO_SIGN_NARROW_OR_EQUAL);
-}
-
-TEST(SafeNumerics, IntMaxOperations)
-{
- TEST_NUMERIC_CONVERSION(intmax_t, intmax_t, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(uintmax_t, uintmax_t, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(intmax_t, int, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(uintmax_t, unsigned int, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(intmax_t, unsigned int, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(intmax_t, uint8_t, SIGN_PRESERVING_VALUE_PRESERVING);
-
- TEST_NUMERIC_CONVERSION(intmax_t, float, SIGN_PRESERVING_NARROW);
- TEST_NUMERIC_CONVERSION(intmax_t, double, SIGN_PRESERVING_NARROW);
-
- TEST_NUMERIC_CONVERSION(uintmax_t, int, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL);
- TEST_NUMERIC_CONVERSION(uintmax_t, int8_t, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL);
-
- TEST_NUMERIC_CONVERSION(uintmax_t, float, SIGN_TO_UNSIGN_NARROW);
- TEST_NUMERIC_CONVERSION(uintmax_t, double, SIGN_TO_UNSIGN_NARROW);
-
- TEST_NUMERIC_CONVERSION(intmax_t, uintmax_t, UNSIGN_TO_SIGN_NARROW_OR_EQUAL);
-}
-
-TEST(SafeNumerics, FloatOperations)
-{
- TEST_NUMERIC_CONVERSION(float, intmax_t, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(float, uintmax_t, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(float, int, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(float, unsigned int, SIGN_PRESERVING_VALUE_PRESERVING);
-
- TEST_NUMERIC_CONVERSION(float, double, SIGN_PRESERVING_NARROW);
-}
-
-TEST(SafeNumerics, DoubleOperations)
-{
- TEST_NUMERIC_CONVERSION(double, intmax_t, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(double, uintmax_t, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(double, int, SIGN_PRESERVING_VALUE_PRESERVING);
- TEST_NUMERIC_CONVERSION(double, unsigned int, SIGN_PRESERVING_VALUE_PRESERVING);
-}
-
-TEST(SafeNumerics, SizeTOperations)
-{
- TEST_NUMERIC_CONVERSION(size_t, int, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL);
- TEST_NUMERIC_CONVERSION(int, size_t, UNSIGN_TO_SIGN_NARROW_OR_EQUAL);
-}
-
-TEST(SafeNumerics, CastTests)
-{
-// MSVC catches and warns that we're forcing saturation in these tests.
-// Since that's intentional, we need to shut this warning off.
-#if defined(COMPILER_MSVC)
-#pragma warning(disable : 4756)
-#endif
-
- int small_positive = 1;
- int small_negative = -1;
- double double_small = 1.0;
- double double_large = numeric_limits<double>::max();
- double double_infinity = numeric_limits<float>::infinity();
- double double_large_int = numeric_limits<int>::max();
- double double_small_int = numeric_limits<int>::min();
-
- // Just test that the casts compile, since the other tests cover logic.
- EXPECT_EQ(0, checked_cast<int>(static_cast<size_t>(0)));
- EXPECT_EQ(0, strict_cast<int>(static_cast<char>(0)));
- EXPECT_EQ(0, strict_cast<int>(static_cast<unsigned char>(0)));
- EXPECT_EQ(0U, strict_cast<unsigned>(static_cast<unsigned char>(0)));
- EXPECT_EQ(1ULL, static_cast<uint64_t>(StrictNumeric<size_t>(1U)));
- EXPECT_EQ(1ULL, static_cast<uint64_t>(SizeT(1U)));
- EXPECT_EQ(1U, static_cast<size_t>(StrictNumeric<unsigned>(1U)));
-
- EXPECT_TRUE(CheckedNumeric<uint64_t>(StrictNumeric<unsigned>(1U)).IsValid());
- EXPECT_TRUE(CheckedNumeric<int>(StrictNumeric<unsigned>(1U)).IsValid());
- EXPECT_FALSE(CheckedNumeric<unsigned>(StrictNumeric<int>(-1)).IsValid());
-
- EXPECT_TRUE(IsValueNegative(-1));
- EXPECT_TRUE(IsValueNegative(numeric_limits<int>::min()));
- EXPECT_FALSE(IsValueNegative(numeric_limits<unsigned>::min()));
- EXPECT_TRUE(IsValueNegative(-numeric_limits<double>::max()));
- EXPECT_FALSE(IsValueNegative(0));
- EXPECT_FALSE(IsValueNegative(1));
- EXPECT_FALSE(IsValueNegative(0u));
- EXPECT_FALSE(IsValueNegative(1u));
- EXPECT_FALSE(IsValueNegative(numeric_limits<int>::max()));
- EXPECT_FALSE(IsValueNegative(numeric_limits<unsigned>::max()));
- EXPECT_FALSE(IsValueNegative(numeric_limits<double>::max()));
-
- // These casts and coercions will fail to compile:
- // EXPECT_EQ(0, strict_cast<int>(static_cast<size_t>(0)));
- // EXPECT_EQ(0, strict_cast<size_t>(static_cast<int>(0)));
- // EXPECT_EQ(1ULL, StrictNumeric<size_t>(1));
- // EXPECT_EQ(1, StrictNumeric<size_t>(1U));
-
- // Test various saturation corner cases.
- EXPECT_EQ(saturated_cast<int>(small_negative), static_cast<int>(small_negative));
- EXPECT_EQ(saturated_cast<int>(small_positive), static_cast<int>(small_positive));
- EXPECT_EQ(saturated_cast<unsigned>(small_negative), static_cast<unsigned>(0));
- EXPECT_EQ(saturated_cast<int>(double_small), static_cast<int>(double_small));
- EXPECT_EQ(saturated_cast<int>(double_large), numeric_limits<int>::max());
- EXPECT_EQ(saturated_cast<float>(double_large), double_infinity);
- EXPECT_EQ(saturated_cast<float>(-double_large), -double_infinity);
- EXPECT_EQ(numeric_limits<int>::min(), saturated_cast<int>(double_small_int));
- EXPECT_EQ(numeric_limits<int>::max(), saturated_cast<int>(double_large_int));
-
- float not_a_number =
- std::numeric_limits<float>::infinity() - std::numeric_limits<float>::infinity();
- EXPECT_TRUE(std::isnan(not_a_number));
- EXPECT_EQ(0, saturated_cast<int>(not_a_number));
-}
-
-#if GTEST_HAS_DEATH_TEST
-
-TEST(SafeNumerics, SaturatedCastChecks)
-{
- float not_a_number =
- std::numeric_limits<float>::infinity() - std::numeric_limits<float>::infinity();
- EXPECT_TRUE(std::isnan(not_a_number));
- EXPECT_DEATH((saturated_cast<int, base::SaturatedCastNaNBehaviorCheck>(not_a_number)), "");
-}
-
-#endif // GTEST_HAS_DEATH_TEST
-
-TEST(SafeNumerics, IsValueInRangeForNumericType)
-{
- EXPECT_TRUE(IsValueInRangeForNumericType<uint32_t>(0));
- EXPECT_TRUE(IsValueInRangeForNumericType<uint32_t>(1));
- EXPECT_TRUE(IsValueInRangeForNumericType<uint32_t>(2));
- EXPECT_FALSE(IsValueInRangeForNumericType<uint32_t>(-1));
- EXPECT_TRUE(IsValueInRangeForNumericType<uint32_t>(0xffffffffu));
- EXPECT_TRUE(IsValueInRangeForNumericType<uint32_t>(UINT64_C(0xffffffff)));
- EXPECT_FALSE(IsValueInRangeForNumericType<uint32_t>(UINT64_C(0x100000000)));
- EXPECT_FALSE(IsValueInRangeForNumericType<uint32_t>(UINT64_C(0x100000001)));
- EXPECT_FALSE(IsValueInRangeForNumericType<uint32_t>(std::numeric_limits<int32_t>::min()));
- EXPECT_FALSE(IsValueInRangeForNumericType<uint32_t>(std::numeric_limits<int64_t>::min()));
-
- EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(0));
- EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(1));
- EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(2));
- EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(-1));
- EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(0x7fffffff));
- EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(0x7fffffffu));
- EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(0x80000000u));
- EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(0xffffffffu));
- EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(INT64_C(0x80000000)));
- EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(INT64_C(0xffffffff)));
- EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(INT64_C(0x100000000)));
- EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(std::numeric_limits<int32_t>::min()));
- EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(
- static_cast<int64_t>(std::numeric_limits<int32_t>::min())));
- EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(
- static_cast<int64_t>(std::numeric_limits<int32_t>::min()) - 1));
- EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(std::numeric_limits<int64_t>::min()));
-
- EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(0));
- EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(1));
- EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(2));
- EXPECT_FALSE(IsValueInRangeForNumericType<uint64_t>(-1));
- EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(0xffffffffu));
- EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(UINT64_C(0xffffffff)));
- EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(UINT64_C(0x100000000)));
- EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(UINT64_C(0x100000001)));
- EXPECT_FALSE(IsValueInRangeForNumericType<uint64_t>(std::numeric_limits<int32_t>::min()));
- EXPECT_FALSE(IsValueInRangeForNumericType<uint64_t>(INT64_C(-1)));
- EXPECT_FALSE(IsValueInRangeForNumericType<uint64_t>(std::numeric_limits<int64_t>::min()));
-
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(0));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(1));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(2));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(-1));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(0x7fffffff));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(0x7fffffffu));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(0x80000000u));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(0xffffffffu));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(INT64_C(0x80000000)));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(INT64_C(0xffffffff)));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(INT64_C(0x100000000)));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(INT64_C(0x7fffffffffffffff)));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(UINT64_C(0x7fffffffffffffff)));
- EXPECT_FALSE(IsValueInRangeForNumericType<int64_t>(UINT64_C(0x8000000000000000)));
- EXPECT_FALSE(IsValueInRangeForNumericType<int64_t>(UINT64_C(0xffffffffffffffff)));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(std::numeric_limits<int32_t>::min()));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(
- static_cast<int64_t>(std::numeric_limits<int32_t>::min())));
- EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(std::numeric_limits<int64_t>::min()));
-}
-
-TEST(SafeNumerics, CompoundNumericOperations)
-{
- CheckedNumeric<int> a = 1;
- CheckedNumeric<int> b = 2;
- CheckedNumeric<int> c = 3;
- CheckedNumeric<int> d = 4;
- a += b;
- EXPECT_EQ(3, a.ValueOrDie());
- a -= c;
- EXPECT_EQ(0, a.ValueOrDie());
- d /= b;
- EXPECT_EQ(2, d.ValueOrDie());
- d *= d;
- EXPECT_EQ(4, d.ValueOrDie());
-
- CheckedNumeric<int> too_large = std::numeric_limits<int>::max();
- EXPECT_TRUE(too_large.IsValid());
- too_large += d;
- EXPECT_FALSE(too_large.IsValid());
- too_large -= d;
- EXPECT_FALSE(too_large.IsValid());
- too_large /= d;
- EXPECT_FALSE(too_large.IsValid());
-}
diff --git a/src/3rdparty/angle/src/common/third_party/base/anglebase/sha1.cc b/src/3rdparty/angle/src/common/third_party/base/anglebase/sha1.cc
deleted file mode 100644
index cb88ba06e1..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/sha1.cc
+++ /dev/null
@@ -1,245 +0,0 @@
-// 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/src/3rdparty/angle/src/common/third_party/base/anglebase/sha1.h b/src/3rdparty/angle/src/common/third_party/base/anglebase/sha1.h
deleted file mode 100644
index a60908814f..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/sha1.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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/src/3rdparty/angle/src/common/third_party/base/anglebase/sys_byteorder.h b/src/3rdparty/angle/src/common/third_party/base/anglebase/sys_byteorder.h
deleted file mode 100644
index 43d1777f26..0000000000
--- a/src/3rdparty/angle/src/common/third_party/base/anglebase/sys_byteorder.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/common/third_party/smhasher/LICENSE b/src/3rdparty/angle/src/common/third_party/smhasher/LICENSE
deleted file mode 100644
index 3f18a844ad..0000000000
--- a/src/3rdparty/angle/src/common/third_party/smhasher/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-All MurmurHash source files are placed in the public domain.
-
-The license below applies to all other code in SMHasher:
-
-Copyright (c) 2011 Google, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-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 Software.
-
-THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/src/3rdparty/angle/src/common/third_party/smhasher/README.angle b/src/3rdparty/angle/src/common/third_party/smhasher/README.angle
deleted file mode 100644
index b84ea3249b..0000000000
--- a/src/3rdparty/angle/src/common/third_party/smhasher/README.angle
+++ /dev/null
@@ -1,14 +0,0 @@
-Name: SMHasher
-URL: http://code.google.com/p/smhasher/
-Version: 0
-Revision: 147
-License: MIT, Public Domain
-License File: LICENSE
-Security Critical: yes
-
-Description:
-This is a library containing the MurmurHash3 function, and a hashing function
-test suite.
-
-Licenses are MIT (SMHasher) and Public Domain (MurmurHash).
-
diff --git a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp b/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp
deleted file mode 100644
index 93b48713cd..0000000000
--- a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp
+++ /dev/null
@@ -1,321 +0,0 @@
-/*-----------------------------------------------------------------------------
- * 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;
-}
-}
-
-/*---------------------------------------------------------------------------*/
diff --git a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.h b/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.h
deleted file mode 100644
index 57c56c538d..0000000000
--- a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-----------------------------------------------------------------------------
- * 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);
-}
diff --git a/src/3rdparty/angle/src/common/tls.cpp b/src/3rdparty/angle/src/common/tls.cpp
deleted file mode 100644
index 10a10252f4..0000000000
--- a/src/3rdparty/angle/src/common/tls.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-//
-// 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 <vector>
-#include <set>
-#include <map>
-#include <mutex>
-
-#include <wrl/client.h>
-#include <wrl/async.h>
-#include <Windows.System.Threading.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/src/3rdparty/angle/src/common/tls.h b/src/3rdparty/angle/src/common/tls.h
deleted file mode 100644
index ca9e07ab70..0000000000
--- a/src/3rdparty/angle/src/common/tls.h
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// 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 <pthread.h>
-# include <semaphore.h>
-# include <errno.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/src/3rdparty/angle/src/common/uniform_type_info_autogen.cpp b/src/3rdparty/angle/src/common/uniform_type_info_autogen.cpp
deleted file mode 100644
index 9c199128a4..0000000000
--- a/src/3rdparty/angle/src/common/uniform_type_info_autogen.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by gen_uniform_type_table.py.
-//
-// 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.
-//
-// 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, 59> kInfoTable = {
- {{GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, 0, 0, 0, 0, 0 * 0, 0 * 0, false, false, false},
- {GL_BOOL, GL_BOOL, GL_NONE, GL_NONE, GL_NONE, 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, 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, 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, 1, 4, 4, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 4, false, false, false},
- {GL_FLOAT, GL_FLOAT, GL_NONE, GL_NONE, GL_BOOL, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
- {GL_IMAGE_2D_ARRAY, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
- {GL_IMAGE_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
- {GL_IMAGE_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
- {GL_INT, GL_INT, GL_NONE, GL_NONE, GL_BOOL, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4,
- sizeof(GLint) * 1, false, false, false},
- {GL_INT_IMAGE_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
- {GL_INT_IMAGE_2D_ARRAY, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
- {GL_INT_IMAGE_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
- {GL_INT_IMAGE_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
- {GL_INT_SAMPLER_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_INT_SAMPLER_2D_ARRAY, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1, 1, 1,
- sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_INT_SAMPLER_2D_MULTISAMPLE, GL_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE, GL_NONE, 1, 1, 1,
- sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_INT_SAMPLER_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_INT_SAMPLER_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_INT_VEC2, GL_INT, GL_NONE, GL_NONE, GL_BOOL_VEC2, 1, 2, 2, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 2, false, false, false},
- {GL_INT_VEC3, GL_INT, GL_NONE, GL_NONE, GL_BOOL_VEC3, 1, 3, 3, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 3, false, false, false},
- {GL_INT_VEC4, GL_INT, GL_NONE, GL_NONE, GL_BOOL_VEC4, 1, 4, 4, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 4, false, false, false},
- {GL_SAMPLER_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_SAMPLER_2D_ARRAY, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_SAMPLER_2D_ARRAY_SHADOW, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1, 1, 1,
- sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_SAMPLER_2D_MULTISAMPLE, GL_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE, GL_NONE, 1, 1, 1,
- sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_SAMPLER_2D_RECT_ANGLE, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_SAMPLER_2D_SHADOW, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_SAMPLER_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_SAMPLER_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_SAMPLER_CUBE_SHADOW, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
- sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_SAMPLER_EXTERNAL_OES, GL_INT, GL_TEXTURE_EXTERNAL_OES, GL_NONE, GL_NONE, 1, 1, 1,
- sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
- {GL_UNSIGNED_INT, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL, 1, 1, 1, sizeof(GLuint),
- sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, false},
- {GL_UNSIGNED_INT_ATOMIC_COUNTER, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_NONE, 1, 1, 1,
- sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, false},
- {GL_UNSIGNED_INT_IMAGE_2D, GL_UNSIGNED_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1,
- sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, true},
- {GL_UNSIGNED_INT_IMAGE_2D_ARRAY, GL_UNSIGNED_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1, 1,
- 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, true},
- {GL_UNSIGNED_INT_IMAGE_3D, GL_UNSIGNED_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1,
- sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, true},
- {GL_UNSIGNED_INT_IMAGE_CUBE, GL_UNSIGNED_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1,
- sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, true},
- {GL_UNSIGNED_INT_SAMPLER_2D, GL_UNSIGNED_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1,
- sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
- {GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, GL_UNSIGNED_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1,
- 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
- {GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, GL_UNSIGNED_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE,
- GL_NONE, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
- {GL_UNSIGNED_INT_SAMPLER_3D, GL_UNSIGNED_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1,
- sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
- {GL_UNSIGNED_INT_SAMPLER_CUBE, GL_UNSIGNED_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1,
- sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
- {GL_UNSIGNED_INT_VEC2, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL_VEC2, 1, 2, 2,
- sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 2, false, false, false},
- {GL_UNSIGNED_INT_VEC3, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL_VEC3, 1, 3, 3,
- sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 3, false, false, false},
- {GL_UNSIGNED_INT_VEC4, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL_VEC4, 1, 4, 4,
- sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 4, false, false, false}}};
-
-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_3D:
- return 30;
- case GL_INT_SAMPLER_CUBE:
- return 31;
- case GL_INT_VEC2:
- return 32;
- case GL_INT_VEC3:
- return 33;
- case GL_INT_VEC4:
- return 34;
- case GL_SAMPLER_2D:
- return 35;
- case GL_SAMPLER_2D_ARRAY:
- return 36;
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- return 37;
- case GL_SAMPLER_2D_MULTISAMPLE:
- return 38;
- case GL_SAMPLER_2D_RECT_ANGLE:
- return 39;
- case GL_SAMPLER_2D_SHADOW:
- return 40;
- case GL_SAMPLER_3D:
- return 41;
- case GL_SAMPLER_CUBE:
- return 42;
- case GL_SAMPLER_CUBE_SHADOW:
- return 43;
- case GL_SAMPLER_EXTERNAL_OES:
- return 44;
- case GL_UNSIGNED_INT:
- return 45;
- case GL_UNSIGNED_INT_ATOMIC_COUNTER:
- return 46;
- case GL_UNSIGNED_INT_IMAGE_2D:
- return 47;
- case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
- return 48;
- case GL_UNSIGNED_INT_IMAGE_3D:
- return 49;
- case GL_UNSIGNED_INT_IMAGE_CUBE:
- return 50;
- case GL_UNSIGNED_INT_SAMPLER_2D:
- return 51;
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- return 52;
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
- return 53;
- case GL_UNSIGNED_INT_SAMPLER_3D:
- return 54;
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- return 55;
- case GL_UNSIGNED_INT_VEC2:
- return 56;
- case GL_UNSIGNED_INT_VEC3:
- return 57;
- case GL_UNSIGNED_INT_VEC4:
- return 58;
- 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/src/3rdparty/angle/src/common/utilities.cpp b/src/3rdparty/angle/src/common/utilities.cpp
deleted file mode 100644
index 6dae9cc51f..0000000000
--- a/src/3rdparty/angle/src/common/utilities.cpp
+++ /dev/null
@@ -1,1071 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// utilities.cpp: Conversion functions and other utility routines.
-
-#include "common/utilities.h"
-#include "common/mathutil.h"
-#include "common/platform.h"
-
-#include <set>
-
-#if defined(ANGLE_ENABLE_WINDOWS_STORE)
-# include <wrl.h>
-# include <wrl/wrappers/corewrappers.h>
-# include <windows.applicationmodel.core.h>
-# include <windows.graphics.display.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_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_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_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_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_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_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_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_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_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_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_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_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 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);
-}
-
-GLenum 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 GL_TEXTURE_2D;
-
- case GL_SAMPLER_EXTERNAL_OES:
- return GL_TEXTURE_EXTERNAL_OES;
-
- case GL_SAMPLER_CUBE:
- case GL_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_SAMPLER_CUBE_SHADOW:
- return GL_TEXTURE_CUBE_MAP;
-
- case GL_SAMPLER_2D_ARRAY:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- return GL_TEXTURE_2D_ARRAY;
-
- case GL_SAMPLER_3D:
- case GL_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- return GL_TEXTURE_3D;
-
- case GL_SAMPLER_2D_MULTISAMPLE:
- case GL_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
- return GL_TEXTURE_2D_MULTISAMPLE;
-
- case GL_SAMPLER_2D_RECT_ANGLE:
- return GL_TEXTURE_RECTANGLE_ANGLE;
-
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-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;
-}
-
-static_assert(GL_TEXTURE_CUBE_MAP_NEGATIVE_X - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 1, "Unexpected GL cube map enum value.");
-static_assert(GL_TEXTURE_CUBE_MAP_POSITIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 2, "Unexpected GL cube map enum value.");
-static_assert(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 3, "Unexpected GL cube map enum value.");
-static_assert(GL_TEXTURE_CUBE_MAP_POSITIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 4, "Unexpected GL cube map enum value.");
-static_assert(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 5, "Unexpected GL cube map enum value.");
-
-bool IsCubeMapTextureTarget(GLenum target)
-{
- return (target >= FirstCubeMapTextureTarget && target <= LastCubeMapTextureTarget);
-}
-
-size_t CubeMapTextureTargetToLayerIndex(GLenum target)
-{
- ASSERT(IsCubeMapTextureTarget(target));
- return target - static_cast<size_t>(FirstCubeMapTextureTarget);
-}
-
-GLenum LayerIndexToCubeMapTextureTarget(size_t index)
-{
- ASSERT(index <= (LastCubeMapTextureTarget - FirstCubeMapTextureTarget));
- return FirstCubeMapTextureTarget + static_cast<GLenum>(index);
-}
-
-IndexRange ComputeIndexRange(GLenum indexType,
- const GLvoid *indices,
- size_t count,
- bool primitiveRestartEnabled)
-{
- switch (indexType)
- {
- case GL_UNSIGNED_BYTE:
- return ComputeTypedIndexRange(static_cast<const GLubyte *>(indices), count,
- primitiveRestartEnabled,
- GetPrimitiveRestartIndex(indexType));
- case GL_UNSIGNED_SHORT:
- return ComputeTypedIndexRange(static_cast<const GLushort *>(indices), count,
- primitiveRestartEnabled,
- GetPrimitiveRestartIndex(indexType));
- case GL_UNSIGNED_INT:
- return ComputeTypedIndexRange(static_cast<const GLuint *>(indices), count,
- primitiveRestartEnabled,
- GetPrimitiveRestartIndex(indexType));
- default:
- UNREACHABLE();
- return IndexRange();
- }
-}
-
-GLuint GetPrimitiveRestartIndex(GLenum indexType)
-{
- switch (indexType)
- {
- case GL_UNSIGNED_BYTE:
- return 0xFF;
- case GL_UNSIGNED_SHORT:
- return 0xFFFF;
- case GL_UNSIGNED_INT:
- return 0xFFFFFFFF;
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-bool IsTriangleMode(GLenum drawMode)
-{
- switch (drawMode)
- {
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- return true;
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- return false;
- default: UNREACHABLE();
- }
-
- return false;
-}
-
-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_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_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_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);
-}
-
-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;
- }
-}
-
-} // 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;
-}
-
-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
-{
-GLenum EGLCubeMapTargetToGLCubeMapTarget(EGLenum eglTarget)
-{
- ASSERT(egl::IsCubeMapTextureTarget(eglTarget));
- return gl::LayerIndexToCubeMapTextureTarget(egl::CubeMapTextureTargetToLayerIndex(eglTarget));
-}
-
-GLenum EGLImageTargetToGLTextureTarget(EGLenum eglTarget)
-{
- switch (eglTarget)
- {
- case EGL_GL_TEXTURE_2D_KHR:
- return GL_TEXTURE_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 EGLCubeMapTargetToGLCubeMapTarget(eglTarget);
-
- case EGL_GL_TEXTURE_3D_KHR:
- return GL_TEXTURE_3D;
-
- default:
- UNREACHABLE();
- return GL_NONE;
- }
-}
-
-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;
- }
-}
-} // 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/src/3rdparty/angle/src/common/utilities.h b/src/3rdparty/angle/src/common/utilities.h
deleted file mode 100644
index f2f9c63d0e..0000000000
--- a/src/3rdparty/angle/src/common/utilities.h
+++ /dev/null
@@ -1,173 +0,0 @@
-//
-// 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/mathutil.h"
-
-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 IsAtomicCounterType(GLenum type);
-bool IsOpaqueType(GLenum type);
-GLenum SamplerTypeToTextureType(GLenum samplerType);
-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);
-
-static const GLenum FirstCubeMapTextureTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
-static const GLenum LastCubeMapTextureTarget = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
-bool IsCubeMapTextureTarget(GLenum target);
-size_t CubeMapTextureTargetToLayerIndex(GLenum target);
-GLenum LayerIndexToCubeMapTextureTarget(size_t index);
-
-// 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 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(GLenum indexType,
- const GLvoid *indices,
- size_t count,
- bool primitiveRestartEnabled);
-
-// Get the primitive restart index value for the given index type.
-GLuint GetPrimitiveRestartIndex(GLenum indexType);
-
-bool IsTriangleMode(GLenum drawMode);
-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);
-
-struct UniformTypeInfo final : angle::NonCopyable
-{
- constexpr UniformTypeInfo(GLenum type,
- GLenum componentType,
- GLenum samplerTextureType,
- GLenum transposedMatrixType,
- GLenum boolVectorType,
- int rowCount,
- int columnCount,
- int componentCount,
- size_t componentSize,
- size_t internalSize,
- size_t externalSize,
- bool isSampler,
- bool isMatrixType,
- bool isImageType)
- : type(type),
- componentType(componentType),
- samplerTextureType(samplerTextureType),
- transposedMatrixType(transposedMatrixType),
- boolVectorType(boolVectorType),
- rowCount(rowCount),
- columnCount(columnCount),
- componentCount(componentCount),
- componentSize(componentSize),
- internalSize(internalSize),
- externalSize(externalSize),
- isSampler(isSampler),
- isMatrixType(isMatrixType),
- isImageType(isImageType)
- {
- }
-
- GLenum type;
- GLenum componentType;
- GLenum samplerTextureType;
- GLenum transposedMatrixType;
- GLenum boolVectorType;
- int rowCount;
- int columnCount;
- int componentCount;
- size_t componentSize;
- size_t internalSize;
- size_t externalSize;
- bool isSampler;
- bool isMatrixType;
- bool isImageType;
-};
-
-const UniformTypeInfo &GetUniformTypeInfo(GLenum uniformType);
-
-const char *GetGenericErrorMessage(GLenum error);
-
-unsigned int ElementTypeSize(GLenum elementType);
-
-} // 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);
-
-const char *GetGenericErrorMessage(EGLint error);
-} // namespace egl
-
-namespace egl_gl
-{
-GLenum EGLCubeMapTargetToGLCubeMapTarget(EGLenum eglTarget);
-GLenum EGLImageTargetToGLTextureTarget(EGLenum eglTarget);
-GLuint EGLClientBufferToGLObjectHandle(EGLClientBuffer buffer);
-}
-
-namespace gl_egl
-{
-EGLenum GLComponentTypeToEGLColorComponentType(GLenum glComponentType);
-} // 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/src/3rdparty/angle/src/common/vector_utils.h b/src/3rdparty/angle/src/common/vector_utils.h
deleted file mode 100644
index 9f5bee1a4a..0000000000
--- a/src/3rdparty/angle/src/common/vector_utils.h
+++ /dev/null
@@ -1,523 +0,0 @@
-//
-// 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 *reinterpret_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 *reinterpret_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 *reinterpret_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 *reinterpret_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 *reinterpret_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 *reinterpret_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/src/3rdparty/angle/src/common/version.h b/src/3rdparty/angle/src/common/version.h
deleted file mode 100644
index e7ffa7cab3..0000000000
--- a/src/3rdparty/angle/src/common/version.h
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/fuzz/translator_fuzzer.cpp b/src/3rdparty/angle/src/compiler/fuzz/translator_fuzzer.cpp
deleted file mode 100644
index 910af8be6f..0000000000
--- a/src/3rdparty/angle/src/compiler/fuzz/translator_fuzzer.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-//
-// 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.
-//
-
-// translator_fuzzer.cpp: A libfuzzer fuzzer for the shader translator.
-
-#include <cstddef>
-#include <cstdint>
-#include <iostream>
-#include <memory>
-#include <unordered_map>
-
-#include "angle_gl.h"
-#include "compiler/translator/Compiler.h"
-#include "compiler/translator/util.h"
-
-using namespace sh;
-
-struct TranslatorCacheKey
-{
- bool operator==(const TranslatorCacheKey &other) const
- {
- return type == other.type && spec == other.spec && output == other.output;
- }
-
- uint32_t type = 0;
- uint32_t spec = 0;
- uint32_t output = 0;
-};
-
-namespace std
-{
-
-template <>
-struct hash<TranslatorCacheKey>
-{
- std::size_t operator()(const TranslatorCacheKey &k) const
- {
- return (hash<uint32_t>()(k.type) << 1) ^ (hash<uint32_t>()(k.spec) >> 1) ^
- hash<uint32_t>()(k.output);
- }
-};
-} // namespace std
-
-struct TCompilerDeleter
-{
- void operator()(TCompiler *compiler) const { DeleteCompiler(compiler); }
-};
-
-using UniqueTCompiler = std::unique_ptr<TCompiler, TCompilerDeleter>;
-
-static std::unordered_map<TranslatorCacheKey, UniqueTCompiler> translators;
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
-{
- // Reserve some size for future compile options
- const size_t kHeaderSize = 128;
-
- if (size <= kHeaderSize)
- {
- return 0;
- }
-
- // Make sure the rest of data will be a valid C string so that we don't have to copy it.
- if (data[size - 1] != 0)
- {
- return 0;
- }
-
- uint32_t type = *reinterpret_cast<const uint32_t *>(data);
- uint32_t spec = *reinterpret_cast<const uint32_t *>(data + 4);
- uint32_t output = *reinterpret_cast<const uint32_t *>(data + 8);
- uint64_t options = *reinterpret_cast<const uint64_t *>(data + 12);
-
- if (type != GL_FRAGMENT_SHADER && type != GL_VERTEX_SHADER)
- {
- return 0;
- }
-
- if (spec != SH_GLES2_SPEC && type != SH_WEBGL_SPEC && spec != SH_GLES3_SPEC &&
- spec != SH_WEBGL2_SPEC)
- {
- return 0;
- }
-
- ShShaderOutput shaderOutput = static_cast<ShShaderOutput>(output);
- if (!(IsOutputGLSL(shaderOutput) || IsOutputESSL(shaderOutput)) &&
- (options & SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER) != 0u)
- {
- // This compiler option is only available in ESSL and GLSL.
- return 0;
- }
-
- std::vector<uint32_t> validOutputs;
- validOutputs.push_back(SH_ESSL_OUTPUT);
- validOutputs.push_back(SH_GLSL_COMPATIBILITY_OUTPUT);
- validOutputs.push_back(SH_GLSL_130_OUTPUT);
- validOutputs.push_back(SH_GLSL_140_OUTPUT);
- validOutputs.push_back(SH_GLSL_150_CORE_OUTPUT);
- validOutputs.push_back(SH_GLSL_330_CORE_OUTPUT);
- validOutputs.push_back(SH_GLSL_400_CORE_OUTPUT);
- validOutputs.push_back(SH_GLSL_410_CORE_OUTPUT);
- validOutputs.push_back(SH_GLSL_420_CORE_OUTPUT);
- validOutputs.push_back(SH_GLSL_430_CORE_OUTPUT);
- validOutputs.push_back(SH_GLSL_440_CORE_OUTPUT);
- validOutputs.push_back(SH_GLSL_450_CORE_OUTPUT);
- validOutputs.push_back(SH_HLSL_3_0_OUTPUT);
- validOutputs.push_back(SH_HLSL_4_1_OUTPUT);
- validOutputs.push_back(SH_HLSL_4_0_FL9_3_OUTPUT);
- bool found = false;
- for (auto valid : validOutputs)
- {
- found = found || (valid == output);
- }
- if (!found)
- {
- return 0;
- }
-
- size -= kHeaderSize;
- data += kHeaderSize;
-
- if (!sh::Initialize())
- {
- return 0;
- }
-
- TranslatorCacheKey key;
- key.type = type;
- key.spec = spec;
- key.output = output;
-
- if (translators.find(key) == translators.end())
- {
- UniqueTCompiler translator(
- ConstructCompiler(type, static_cast<ShShaderSpec>(spec), shaderOutput));
-
- if (translator == nullptr)
- {
- return 0;
- }
-
- ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
-
- // Enable all the extensions to have more coverage
- resources.OES_standard_derivatives = 1;
- resources.OES_EGL_image_external = 1;
- resources.OES_EGL_image_external_essl3 = 1;
- resources.NV_EGL_stream_consumer_external = 1;
- resources.ARB_texture_rectangle = 1;
- resources.EXT_blend_func_extended = 1;
- resources.EXT_draw_buffers = 1;
- resources.EXT_frag_depth = 1;
- resources.EXT_shader_texture_lod = 1;
- resources.WEBGL_debug_shader_precision = 1;
- resources.EXT_shader_framebuffer_fetch = 1;
- resources.NV_shader_framebuffer_fetch = 1;
- resources.ARM_shader_framebuffer_fetch = 1;
- resources.EXT_YUV_target = 1;
- resources.MaxDualSourceDrawBuffers = 1;
-
- if (!translator->Init(resources))
- {
- return 0;
- }
-
- translators[key] = std::move(translator);
- }
-
- auto &translator = translators[key];
-
- const char *shaderStrings[] = {reinterpret_cast<const char *>(data)};
- translator->compile(shaderStrings, 1, options);
-
- return 0;
-}
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
deleted file mode 100644
index c89bc9fa76..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/preprocessor/DiagnosticsBase.h"
-
-#include "common/debug.h"
-
-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_ESSL3:
- return "extension directive must occur before any non-preprocessor tokens in ESSL3";
- 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_ESSL1:
- 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
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
deleted file mode 100644
index ea37614606..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
+++ /dev/null
@@ -1,90 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
-#define COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
-
-#include <string>
-
-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_ESSL3,
- 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_ESSL1,
- 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
-
-#endif // COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.cpp b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.cpp
deleted file mode 100644
index 049dae9071..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/preprocessor/DirectiveHandlerBase.h"
-
-namespace pp
-{
-
-DirectiveHandler::~DirectiveHandler()
-{
-}
-
-} // namespace pp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.h b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.h
deleted file mode 100644
index 6c81d015f5..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
-#define COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
-
-#include <string>
-
-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) = 0;
-};
-
-} // namespace pp
-
-#endif // COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
deleted file mode 100644
index f6c5763990..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
+++ /dev/null
@@ -1,1000 +0,0 @@
-//
-// 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 "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
-{
-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 anonymous
-
-namespace pp
-{
-
-class DefinedParser : public Lexer
-{
- public:
- DefinedParser(Lexer *lexer, const MacroSet *macroSet, Diagnostics *diagnostics)
- : mLexer(lexer), mMacroSet(macroSet), mDiagnostics(diagnostics)
- {
- }
-
- protected:
- void lex(Token *token) override
- {
- const char kDefined[] = "defined";
-
- mLexer->lex(token);
- if (token->type != Token::IDENTIFIER)
- return;
- if (token->text != kDefined)
- return;
-
- bool paren = false;
- mLexer->lex(token);
- if (token->type == '(')
- {
- paren = true;
- mLexer->lex(token);
- }
-
- if (token->type != Token::IDENTIFIER)
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location, token->text);
- skipUntilEOD(mLexer, token);
- return;
- }
- MacroSet::const_iterator iter = mMacroSet->find(token->text);
- std::string expression = iter != mMacroSet->end() ? "1" : "0";
-
- if (paren)
- {
- mLexer->lex(token);
- if (token->type != ')')
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
- token->text);
- skipUntilEOD(mLexer, token);
- return;
- }
- }
-
- // We have a valid defined operator.
- // Convert the current token into a CONST_INT token.
- token->type = Token::CONST_INT;
- token->text = expression;
- }
-
- private:
- Lexer *mLexer;
- const MacroSet *mMacroSet;
- Diagnostics *mDiagnostics;
-};
-
-DirectiveParser::DirectiveParser(Tokenizer *tokenizer,
- MacroSet *macroSet,
- Diagnostics *diagnostics,
- DirectiveHandler *directiveHandler,
- int maxMacroExpansionDepth)
- : mPastFirstStatement(false),
- mSeenNonPreprocessorToken(false),
- mTokenizer(tokenizer),
- mMacroSet(macroSet),
- mDiagnostics(diagnostics),
- mDirectiveHandler(directiveHandler),
- mShaderVersion(100),
- mMaxMacroExpansionDepth(maxMacroExpansionDepth)
-{
-}
-
-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 (mShaderVersion >= 300)
- {
- mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3,
- token->location, token->text);
- valid = false;
- }
- else
- {
- mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1,
- token->location, token->text);
- }
- }
- 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,
- 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)
- {
- state = (version < 300) ? VERSION_ENDLINE : VERSION_PROFILE;
- }
- break;
- case VERSION_PROFILE:
- if (token->type != Token::IDENTIFIER || token->text != "es")
- {
- mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE, 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 (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);
- 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, mMaxMacroExpansionDepth);
-
- // 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));
-
- DefinedParser definedParser(mTokenizer, mMacroSet, mDiagnostics);
- MacroExpander macroExpander(&definedParser, mMacroSet, mDiagnostics, mMaxMacroExpansionDepth);
- 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
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.h b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.h
deleted file mode 100644
index 29c30a8239..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.h
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_PREPROCESSOR_DIRECTIVEPARSER_H_
-#define COMPILER_PREPROCESSOR_DIRECTIVEPARSER_H_
-
-#include "compiler/preprocessor/Lexer.h"
-#include "compiler/preprocessor/Macro.h"
-#include "compiler/preprocessor/SourceLocation.h"
-
-namespace pp
-{
-
-class Diagnostics;
-class DirectiveHandler;
-class Tokenizer;
-
-class DirectiveParser : public Lexer
-{
- public:
- DirectiveParser(Tokenizer *tokenizer,
- MacroSet *macroSet,
- Diagnostics *diagnostics,
- DirectiveHandler *directiveHandler,
- int maxMacroExpansionDepth);
- ~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;
- int mMaxMacroExpansionDepth;
-};
-
-} // namespace pp
-
-#endif // COMPILER_PREPROCESSOR_DIRECTIVEPARSER_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.h b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.h
deleted file mode 100644
index 0f2901b878..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_
-#define COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_
-
-#include "common/angleutils.h"
-#include "compiler/preprocessor/DiagnosticsBase.h"
-
-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
-
-#endif // COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
deleted file mode 100644
index 68d7cc3958..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-This file contains the Yacc grammar for GLSL ES preprocessor expression.
-
-IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
-WHICH GENERATES THE GLSL ES preprocessor expression parser.
-*/
-
-%{
-//
-// 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 <cassert>
-#include <sstream>
-#include <stdint.h>
-
-#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
-{
- pp::Diagnostics* diagnostics;
- pp::Lexer* lexer;
- pp::Token* token;
- int* result;
- bool parsePresetToken;
-
- pp::ExpressionParser::ErrorSettings errorSettings;
- bool *valid;
-
- void startIgnoreErrors() { ++ignoreErrors; }
- void endIgnoreErrors() { --ignoreErrors; }
-
- bool isIgnoringErrors() { return ignoreErrors > 0; }
-
- int ignoreErrors;
-};
-} // namespace
-%}
-
-%pure-parser
-%name-prefix "pp"
-%parse-param {Context *context}
-%lex-param {Context *context}
-
-%{
-static int yylex(YYSTYPE* lvalp, Context* context);
-static void yyerror(Context* context, const char* reason);
-%}
-
-%token TOK_CONST_INT
-%token TOK_IDENTIFIER
-%left TOK_OP_OR
-%left TOK_OP_AND
-%left '|'
-%left '^'
-%left '&'
-%left TOK_OP_EQ TOK_OP_NE
-%left '<' '>' TOK_OP_LE TOK_OP_GE
-%left TOK_OP_LEFT TOK_OP_RIGHT
-%left '+' '-'
-%left '*' '/' '%'
-%right TOK_UNARY
-
-%%
-
-input
- : expression {
- *(context->result) = static_cast<int>($1);
- YYACCEPT;
- }
-;
-
-expression
- : TOK_CONST_INT
- | TOK_IDENTIFIER {
- 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;
- }
- $$ = $1;
- }
- | expression TOK_OP_OR {
- if ($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();
- }
- } expression {
- if ($1 != 0)
- {
- context->endIgnoreErrors();
- $$ = static_cast<YYSTYPE>(1);
- }
- else
- {
- $$ = $1 || $4;
- }
- }
- | expression TOK_OP_AND {
- if ($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();
- }
- } expression {
- if ($1 == 0)
- {
- context->endIgnoreErrors();
- $$ = static_cast<YYSTYPE>(0);
- }
- else
- {
- $$ = $1 && $4;
- }
- }
- | expression '|' expression {
- $$ = $1 | $3;
- }
- | expression '^' expression {
- $$ = $1 ^ $3;
- }
- | expression '&' expression {
- $$ = $1 & $3;
- }
- | expression TOK_OP_NE expression {
- $$ = $1 != $3;
- }
- | expression TOK_OP_EQ expression {
- $$ = $1 == $3;
- }
- | expression TOK_OP_GE expression {
- $$ = $1 >= $3;
- }
- | expression TOK_OP_LE expression {
- $$ = $1 <= $3;
- }
- | expression '>' expression {
- $$ = $1 > $3;
- }
- | expression '<' expression {
- $$ = $1 < $3;
- }
- | expression TOK_OP_RIGHT expression {
- if ($3 < 0 || $3 > 31)
- {
- if (!context->isIgnoringErrors())
- {
- std::ostringstream stream;
- stream << $1 << " >> " << $3;
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
- context->token->location,
- text.c_str());
- *(context->valid) = false;
- }
- $$ = static_cast<YYSTYPE>(0);
- }
- else if ($1 < 0)
- {
- // Logical shift right.
- $$ = static_cast<YYSTYPE>(static_cast<UNSIGNED_TYPE>($1) >> $3);
- }
- else
- {
- $$ = $1 >> $3;
- }
- }
- | expression TOK_OP_LEFT expression {
- if ($3 < 0 || $3 > 31)
- {
- if (!context->isIgnoringErrors())
- {
- std::ostringstream stream;
- stream << $1 << " << " << $3;
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
- context->token->location,
- text.c_str());
- *(context->valid) = false;
- }
- $$ = 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.
- $$ = static_cast<YYSTYPE>(static_cast<UNSIGNED_TYPE>($1) << $3);
- }
- }
- | expression '-' expression {
- $$ = gl::WrappingDiff<YYSTYPE>($1, $3);
- }
- | expression '+' expression {
- $$ = gl::WrappingSum<YYSTYPE>($1, $3);
- }
- | expression '%' expression {
- if ($3 == 0)
- {
- if (!context->isIgnoringErrors())
- {
- std::ostringstream stream;
- stream << $1 << " % " << $3;
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
- context->token->location,
- text.c_str());
- *(context->valid) = false;
- }
- $$ = static_cast<YYSTYPE>(0);
- }
- else if (($1 == std::numeric_limits<YYSTYPE>::min()) && ($3 == -1))
- {
- // Check for the special case where the minimum representable number is
- // divided by -1. If left alone this has undefined results.
- $$ = 0;
- }
- else
- {
- $$ = $1 % $3;
- }
- }
- | expression '/' expression {
- if ($3 == 0)
- {
- if (!context->isIgnoringErrors())
- {
- std::ostringstream stream;
- stream << $1 << " / " << $3;
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
- context->token->location,
- text.c_str());
- *(context->valid) = false;
- }
- $$ = static_cast<YYSTYPE>(0);
- }
- else if (($1 == std::numeric_limits<YYSTYPE>::min()) && ($3 == -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.
- $$ = std::numeric_limits<YYSTYPE>::max();
- }
- else
- {
- $$ = $1 / $3;
- }
- }
- | expression '*' expression {
- $$ = gl::WrappingMul($1, $3);
- }
- | '!' expression %prec TOK_UNARY {
- $$ = ! $2;
- }
- | '~' expression %prec TOK_UNARY {
- $$ = ~ $2;
- }
- | '-' expression %prec TOK_UNARY {
- // Check for negation of minimum representable integer to prevent undefined signed int
- // overflow.
- if ($2 == std::numeric_limits<YYSTYPE>::min())
- {
- $$ = std::numeric_limits<YYSTYPE>::min();
- }
- else
- {
- $$ = -$2;
- }
- }
- | '+' expression %prec TOK_UNARY {
- $$ = + $2;
- }
- | '(' expression ')' {
- $$ = $2;
- }
-;
-
-%%
-
-int yylex(YYSTYPE *lvalp, Context *context)
-{
- pp::Token *token = context->token;
- if (!context->parsePresetToken)
- {
- context->lexer->lex(token);
- }
- context->parsePresetToken = false;
-
- int type = 0;
-
- switch (token->type)
- {
- case pp::Token::CONST_INT: {
- unsigned int val = 0;
- int testVal = 0;
- if (!token->uValue(&val) || (!token->iValue(&testVal) &&
- context->errorSettings.integerLiteralsMustFit32BitSignedRange))
- {
- context->diagnostics->report(pp::Diagnostics::PP_INTEGER_OVERFLOW,
- token->location, token->text);
- *(context->valid) = false;
- }
- *lvalp = static_cast<YYSTYPE>(val);
- type = TOK_CONST_INT;
- break;
- }
- case pp::Token::IDENTIFIER:
- *lvalp = static_cast<YYSTYPE>(-1);
- type = TOK_IDENTIFIER;
- break;
- case pp::Token::OP_OR:
- type = TOK_OP_OR;
- break;
- case pp::Token::OP_AND:
- type = TOK_OP_AND;
- break;
- case pp::Token::OP_NE:
- type = TOK_OP_NE;
- break;
- case pp::Token::OP_EQ:
- type = TOK_OP_EQ;
- break;
- case pp::Token::OP_GE:
- type = TOK_OP_GE;
- break;
- case pp::Token::OP_LE:
- type = TOK_OP_LE;
- break;
- case pp::Token::OP_RIGHT:
- type = TOK_OP_RIGHT;
- break;
- case pp::Token::OP_LEFT:
- type = TOK_OP_LEFT;
- break;
- case '|':
- case '^':
- case '&':
- 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(pp::Diagnostics::PP_INVALID_EXPRESSION,
- context->token->location,
- reason);
-}
-
-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
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Input.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Input.cpp
deleted file mode 100644
index 0f2327b823..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/Input.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-//
-// 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 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
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Input.h b/src/3rdparty/angle/src/compiler/preprocessor/Input.h
deleted file mode 100644
index 8c7c7ee19e..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/Input.h
+++ /dev/null
@@ -1,54 +0,0 @@
-//
-// 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 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
-
-#endif // COMPILER_PREPROCESSOR_INPUT_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Lexer.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Lexer.cpp
deleted file mode 100644
index 89cb3cf44e..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/Lexer.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/preprocessor/Lexer.h"
-
-namespace pp
-{
-
-Lexer::~Lexer()
-{
-}
-
-} // namespace pp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Lexer.h b/src/3rdparty/angle/src/compiler/preprocessor/Lexer.h
deleted file mode 100644
index 775bc0a202..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/Lexer.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_PREPROCESSOR_LEXER_H_
-#define COMPILER_PREPROCESSOR_LEXER_H_
-
-#include "common/angleutils.h"
-
-namespace pp
-{
-
-struct Token;
-
-class Lexer : angle::NonCopyable
-{
- public:
- virtual ~Lexer();
-
- virtual void lex(Token *token) = 0;
-};
-
-} // namespace pp
-
-#endif // COMPILER_PREPROCESSOR_LEXER_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp
deleted file mode 100644
index 52e2312fe6..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// 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 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
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Macro.h b/src/3rdparty/angle/src/compiler/preprocessor/Macro.h
deleted file mode 100644
index c42e172ef9..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/Macro.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_PREPROCESSOR_MACRO_H_
-#define COMPILER_PREPROCESSOR_MACRO_H_
-
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-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
-
-#endif // COMPILER_PREPROCESSOR_MACRO_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
deleted file mode 100644
index d88d3a6853..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
+++ /dev/null
@@ -1,481 +0,0 @@
-//
-// 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 <algorithm>
-
-#include "common/debug.h"
-#include "compiler/preprocessor/DiagnosticsBase.h"
-#include "compiler/preprocessor/Token.h"
-
-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 (auto 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,
- int allowedMacroExpansionDepth)
- : mLexer(lexer),
- mMacroSet(macroSet),
- mDiagnostics(diagnostics),
- mTotalTokensInContexts(0),
- mAllowedMacroExpansionDepth(allowedMacroExpansionDepth),
- 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;
-
- 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 (mAllowedMacroExpansionDepth < 1)
- {
- mDiagnostics->report(Diagnostics::PP_MACRO_INVOCATION_CHAIN_TOO_DEEP, token.location,
- token.text);
- return false;
- }
- MacroExpander expander(&lexer, mMacroSet, mDiagnostics, mAllowedMacroExpansionDepth - 1);
-
- 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
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.h b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.h
deleted file mode 100644
index fae7676fb0..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.h
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_PREPROCESSOR_MACROEXPANDER_H_
-#define COMPILER_PREPROCESSOR_MACROEXPANDER_H_
-
-#include <memory>
-#include <vector>
-
-#include "compiler/preprocessor/Lexer.h"
-#include "compiler/preprocessor/Macro.h"
-
-namespace pp
-{
-
-class Diagnostics;
-struct SourceLocation;
-
-class MacroExpander : public Lexer
-{
- public:
- MacroExpander(Lexer *lexer,
- MacroSet *macroSet,
- Diagnostics *diagnostics,
- int allowedMacroExpansionDepth);
- ~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;
-
- std::unique_ptr<Token> mReserveToken;
- std::vector<MacroContext *> mContextStack;
- size_t mTotalTokensInContexts;
-
- int mAllowedMacroExpansionDepth;
-
- bool mDeferReenablingMacros;
- std::vector<std::shared_ptr<Macro>> mMacrosToReenable;
-
- class ScopedMacroReenabler;
-};
-
-} // namespace pp
-
-#endif // COMPILER_PREPROCESSOR_MACROEXPANDER_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
deleted file mode 100644
index 349c7b06c7..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-//
-// 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 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.maxMacroExpansionDepth),
- macroExpander(&directiveParser, &macroSet, diag, settings.maxMacroExpansionDepth)
- {
- }
-};
-
-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
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.h b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.h
deleted file mode 100644
index 2fe504f7f9..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.h
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// 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 "common/angleutils.h"
-
-namespace pp
-{
-
-class Diagnostics;
-class DirectiveHandler;
-struct PreprocessorImpl;
-struct Token;
-
-struct PreprocessorSettings : private angle::NonCopyable
-{
- PreprocessorSettings() : maxMacroExpansionDepth(1000) {}
- int maxMacroExpansionDepth;
-};
-
-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
-
-#endif // COMPILER_PREPROCESSOR_PREPROCESSOR_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/SourceLocation.h b/src/3rdparty/angle/src/compiler/preprocessor/SourceLocation.h
deleted file mode 100644
index 51908a3b4b..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/SourceLocation.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_PREPROCESSOR_SOURCELOCATION_H_
-#define COMPILER_PREPROCESSOR_SOURCELOCATION_H_
-
-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
-
-#endif // COMPILER_PREPROCESSOR_SOURCELOCATION_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Token.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Token.cpp
deleted file mode 100644
index ce0ce94f49..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/Token.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-// 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 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);
-}
-
-bool Token::fValue(float *value) const
-{
- ASSERT(type == CONST_FLOAT);
- return numeric_lex_float(text, value);
-}
-
-std::ostream &operator<<(std::ostream &out, const Token &token)
-{
- if (token.hasLeadingSpace())
- out << " ";
-
- out << token.text;
- return out;
-}
-
-} // namespace pp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Token.h b/src/3rdparty/angle/src/compiler/preprocessor/Token.h
deleted file mode 100644
index 26732ab64d..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/Token.h
+++ /dev/null
@@ -1,109 +0,0 @@
-//
-// 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 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;
- bool fValue(float *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);
-
-} // namepsace pp
-
-#endif // COMPILER_PREPROCESSOR_TOKEN_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.h b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.h
deleted file mode 100644
index af4fd7ce7b..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.h
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// 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 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
-
-#endif // COMPILER_PREPROCESSOR_TOKENIZER_H_
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
deleted file mode 100644
index 096812d45f..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
-//
-// 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.
-*/
-
-%top{
-//
-// 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!
-}
-
-%{
-#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
-
-// 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 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_USER_ACTION \
- do \
- { \
- pp::Input* input = &yyextra->input; \
- 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);
-
-%}
-
-%option noyywrap nounput never-interactive
-%option reentrant bison-bridge bison-locations
-%option prefix="pp"
-%option extra-type="pp::Tokenizer::Context*"
-%x COMMENT
-
-NEWLINE \n|\r|\r\n
-IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]*
-PUNCTUATOR [][<>(){}.+-/*%^|&~=!:;,?]
-
-DECIMAL_CONSTANT [1-9][0-9]*[uU]?
-OCTAL_CONSTANT 0[0-7]*[uU]?
-HEXADECIMAL_CONSTANT 0[xX][0-9a-fA-F]+[uU]?
-
-DIGIT [0-9]
-EXPONENT_PART [eE][+-]?{DIGIT}+
-FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
-
-%%
-
- /* Line comment */
-"//"[^\r\n]*
-
- /* Block comment */
- /* Line breaks are just counted - not returned. */
- /* The comment is replaced by a single space. */
-"/*" { BEGIN(COMMENT); }
-<COMMENT>[^*\r\n]+
-<COMMENT>"*"
-<COMMENT>{NEWLINE} {
- if (yylineno == INT_MAX)
- {
- *yylval = "Integer overflow on line number";
- return pp::Token::GOT_ERROR;
- }
- ++yylineno;
-}
-<COMMENT>"*/" {
- yyextra->leadingSpace = true;
- BEGIN(INITIAL);
-}
-
-# {
- // # is only valid at start of line for preprocessor directives.
- yylval->assign(1, yytext[0]);
- return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER;
-}
-
-{IDENTIFIER} {
- yylval->assign(yytext, yyleng);
- return pp::Token::IDENTIFIER;
-}
-
-({DECIMAL_CONSTANT}[uU]?)|({OCTAL_CONSTANT}[uU]?)|({HEXADECIMAL_CONSTANT}[uU]?) {
- yylval->assign(yytext, yyleng);
- return pp::Token::CONST_INT;
-}
-
-({DIGIT}+{EXPONENT_PART}[fF]?)|({FRACTIONAL_CONSTANT}{EXPONENT_PART}?[fF]?) {
- yylval->assign(yytext, yyleng);
- return pp::Token::CONST_FLOAT;
-}
-
- /* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
- /* Rule to catch all invalid integers and floats. */
-({DIGIT}+[_a-zA-Z0-9.]*)|("."{DIGIT}+[_a-zA-Z0-9.]*) {
- yylval->assign(yytext, yyleng);
- return pp::Token::PP_NUMBER;
-}
-
-"++" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_INC;
-}
-"--" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_DEC;
-}
-"<<" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_LEFT;
-}
-">>" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_RIGHT;
-}
-"<=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_LE;
-}
-">=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_GE;
-}
-"==" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_EQ;
-}
-"!=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_NE;
-}
-"&&" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_AND;
-}
-"^^" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_XOR;
-}
-"||" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_OR;
-}
-"+=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_ADD_ASSIGN;
-}
-"-=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_SUB_ASSIGN;
-}
-"*=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_MUL_ASSIGN;
-}
-"/=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_DIV_ASSIGN;
-}
-"%=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_MOD_ASSIGN;
-}
-"<<=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_LEFT_ASSIGN;
-}
-">>=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_RIGHT_ASSIGN;
-}
-"&=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_AND_ASSIGN;
-}
-"^=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_XOR_ASSIGN;
-}
-"|=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_OR_ASSIGN;
-}
-
-{PUNCTUATOR} {
- yylval->assign(1, yytext[0]);
- return yytext[0];
-}
-
-[ \t\v\f]+ { yyextra->leadingSpace = true; }
-
-{NEWLINE} {
- if (yylineno == INT_MAX)
- {
- *yylval = "Integer overflow on line number";
- return pp::Token::GOT_ERROR;
- }
- ++yylineno;
- yylval->assign(1, '\n');
- return '\n';
-}
-
-. {
- yylval->assign(1, yytext[0]);
- return pp::Token::PP_OTHER;
-}
-
-<*><<EOF>> {
- // YY_USER_ACTION is not invoked for handling EOF.
- // Set the location for EOF token manually.
- pp::Input* input = &yyextra->input;
- 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(pp::Diagnostics::PP_TOKENIZER_ERROR,
- pp::SourceLocation(yyfileno, yylineno),
- "Integer overflow on line number");
- }
- else if (YY_START == COMMENT)
- {
- yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
- pp::SourceLocation(yyfileno, yylineno),
- "EOF while in a comment");
- }
- yyterminate();
-}
-
-%%
-
-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
-
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h b/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h
deleted file mode 100644
index 6ea779ab8f..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// numeric_lex.h: Functions to extract numeric values from string.
-
-#ifndef COMPILER_PREPROCESSOR_NUMERICLEX_H_
-#define COMPILER_PREPROCESSOR_NUMERICLEX_H_
-
-#include <cmath>
-#include <sstream>
-
-namespace pp
-{
-
-inline std::ios::fmtflags numeric_base_int(const std::string &str)
-{
- if ((str.size() >= 2) && (str[0] == '0') && (str[1] == 'x' || str[1] == 'X'))
- {
- return std::ios::hex;
- }
- if ((str.size() >= 1) && (str[0] == '0'))
- {
- return std::ios::oct;
- }
- return std::ios::dec;
-}
-
-// The following functions parse the given string to extract a numerical
-// value of the given type. These functions assume that the string is
-// of the correct form. They can only fail if the parsed value is too big,
-// in which case false is returned.
-
-template <typename IntType>
-bool numeric_lex_int(const std::string &str, IntType *value)
-{
- std::istringstream stream(str);
- // This should not be necessary, but MSVS has a buggy implementation.
- // It returns incorrect results if the base is not specified.
- stream.setf(numeric_base_int(str), std::ios::basefield);
-
- stream >> (*value);
- return !stream.fail();
-}
-
-template <typename FloatType>
-bool numeric_lex_float(const std::string &str, FloatType *value)
-{
-// On 64-bit Intel Android, istringstream is broken. Until this is fixed in
-// a newer NDK, don't use it. Android doesn't have locale support, so this
-// doesn't have to force the C locale.
-// TODO(thakis): Remove this once this bug has been fixed in the NDK and
-// that NDK has been rolled into chromium.
-#if defined(ANGLE_PLATFORM_ANDROID) && __x86_64__
- *value = strtod(str.c_str(), nullptr);
- return errno != ERANGE;
-#else
- std::istringstream stream(str);
- // Force "C" locale so that decimal character is always '.', and
- // not dependent on the current locale.
- stream.imbue(std::locale::classic());
-
- stream >> (*value);
- return !stream.fail() && std::isfinite(*value);
-#endif
-}
-
-} // namespace pp.
-
-#endif // COMPILER_PREPROCESSOR_NUMERICLEX_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/ASTMetadataHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/ASTMetadataHLSL.cpp
deleted file mode 100644
index b04fc28259..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ASTMetadataHLSL.cpp
+++ /dev/null
@@ -1,462 +0,0 @@
-//
-// 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/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.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("texture2D");
- mGradientBuiltinFunctions.insert("texture2DProj");
- mGradientBuiltinFunctions.insert("textureCube");
-
- // ESSL 300 builtin gradient functions
- mGradientBuiltinFunctions.insert("texture");
- mGradientBuiltinFunctions.insert("textureProj");
- mGradientBuiltinFunctions.insert("textureOffset");
- mGradientBuiltinFunctions.insert("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();
- default:
- break;
- }
- }
-
- return true;
- }
-
- bool visitAggregate(Visit visit, TIntermAggregate *node) override
- {
- if (visit == PreVisit)
- {
- if (node->getOp() == EOpCallFunctionInAST)
- {
- size_t calleeIndex = mDag.findIndex(node->getFunctionSymbolInfo());
- ASSERT(calleeIndex != CallDAG::InvalidIndex && calleeIndex < mIndex);
-
- if ((*mMetadataList)[calleeIndex].mUsesGradient)
- {
- onGradient();
- }
- }
- else if (node->getOp() == EOpCallBuiltInFunction)
- {
- if (mGradientBuiltinFunctions.find(node->getFunctionSymbolInfo()->getName()) !=
- 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<TString> 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->getFunctionSymbolInfo());
- 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->getFunctionSymbolInfo());
- 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;
-};
-}
-
-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/src/3rdparty/angle/src/compiler/translator/ASTMetadataHLSL.h b/src/3rdparty/angle/src/compiler/translator/ASTMetadataHLSL.h
deleted file mode 100644
index 550a522b86..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ASTMetadataHLSL.h
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/AddAndTrueToLoopCondition.cpp b/src/3rdparty/angle/src/compiler/translator/AddAndTrueToLoopCondition.cpp
deleted file mode 100644
index 6a05104233..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/AddAndTrueToLoopCondition.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// 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/AddAndTrueToLoopCondition.h"
-
-#include "compiler/translator/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.
- TConstantUnion *trueConstant = new TConstantUnion();
- trueConstant->setBConst(true);
- TIntermTyped *trueValue = new TIntermConstantUnion(trueConstant, TType(EbtBool));
-
- // 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/src/3rdparty/angle/src/compiler/translator/AddAndTrueToLoopCondition.h b/src/3rdparty/angle/src/compiler/translator/AddAndTrueToLoopCondition.h
deleted file mode 100644
index 34debe0ed9..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/AddAndTrueToLoopCondition.h
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// 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_ADDANDTRUETOLOOPCONDITION_H_
-#define COMPILER_TRANSLATOR_ADDANDTRUETOLOOPCONDITION_H_
-
-class TIntermNode;
-namespace sh
-{
-
-void AddAndTrueToLoopCondition(TIntermNode *root);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_ADDANDTRUETOLOOPCONDITION_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/AddDefaultReturnStatements.cpp b/src/3rdparty/angle/src/compiler/translator/AddDefaultReturnStatements.cpp
deleted file mode 100644
index 4dfe60c0bc..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/AddDefaultReturnStatements.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// 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/AddDefaultReturnStatements.h"
-
-#include "compiler/translator/IntermNode.h"
-#include "compiler/translator/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/src/3rdparty/angle/src/compiler/translator/AddDefaultReturnStatements.h b/src/3rdparty/angle/src/compiler/translator/AddDefaultReturnStatements.h
deleted file mode 100644
index 40a70ad8c2..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/AddDefaultReturnStatements.h
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// 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_ADDDEFAULTRETURNSTATEMENTS_H_
-#define COMPILER_TRANSLATOR_ADDDEFAULTRETURNSTATEMENTS_H_
-
-class TIntermBlock;
-
-namespace sh
-{
-
-void AddDefaultReturnStatements(TIntermBlock *root);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_ADDDEFAULTRETURNSTATEMENTS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/ArrayReturnValueToOutParameter.cpp b/src/3rdparty/angle/src/compiler/translator/ArrayReturnValueToOutParameter.cpp
deleted file mode 100644
index 17721fb0dc..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ArrayReturnValueToOutParameter.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-//
-// 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/ArrayReturnValueToOutParameter.h"
-
-#include <map>
-
-#include "compiler/translator/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.h"
-
-namespace sh
-{
-
-namespace
-{
-
-void CopyAggregateChildren(TIntermAggregateBase *from, TIntermAggregateBase *to)
-{
- const TIntermSequence *fromSequence = from->getSequence();
- for (size_t ii = 0; ii < fromSequence->size(); ++ii)
- {
- to->getSequence()->push_back(fromSequence->at(ii));
- }
-}
-
-TIntermSymbol *CreateReturnValueSymbol(const TSymbolUniqueId &id, const TType &type)
-{
- TIntermSymbol *node = new TIntermSymbol(id, "angle_return", type);
- node->setInternal(true);
- node->getTypePointer()->setQualifier(EvqOut);
- return node;
-}
-
-TIntermAggregate *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);
- TIntermAggregate *replacementCall = TIntermAggregate::CreateFunctionCall(
- TType(EbtVoid), originalCall->getFunctionSymbolInfo()->getId(),
- originalCall->getFunctionSymbolInfo()->getNameObj(), replacementArguments);
- replacementCall->setLine(originalCall->getLine());
- return replacementCall;
-}
-
-class ArrayReturnValueToOutParameterTraverser : private TIntermTraverser
-{
- public:
- static void apply(TIntermNode *root, TSymbolTable *symbolTable);
-
- private:
- ArrayReturnValueToOutParameterTraverser(TSymbolTable *symbolTable);
-
- bool visitFunctionPrototype(Visit visit, 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;
-
- // Set when traversal is inside a function with array return value.
- TIntermFunctionDefinition *mFunctionWithArrayReturnValue;
-
- // Map from function symbol ids to array return value ids.
- std::map<int, TSymbolUniqueId *> mReturnValueIds;
-};
-
-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;
-}
-
-bool ArrayReturnValueToOutParameterTraverser::visitFunctionPrototype(Visit visit,
- TIntermFunctionPrototype *node)
-{
- if (visit == PreVisit && node->isArray())
- {
- // Replace the whole prototype node with another node that has the out parameter
- // added. Also set the function to return void.
- TIntermFunctionPrototype *replacement =
- new TIntermFunctionPrototype(TType(EbtVoid), node->getFunctionSymbolInfo()->getId());
- CopyAggregateChildren(node, replacement);
- const TSymbolUniqueId &functionId = node->getFunctionSymbolInfo()->getId();
- if (mReturnValueIds.find(functionId.get()) == mReturnValueIds.end())
- {
- mReturnValueIds[functionId.get()] = new TSymbolUniqueId(mSymbolTable);
- }
- replacement->getSequence()->push_back(
- CreateReturnValueSymbol(*mReturnValueIds[functionId.get()], node->getType()));
- *replacement->getFunctionSymbolInfo() = *node->getFunctionSymbolInfo();
- replacement->setLine(node->getLine());
-
- queueReplacement(replacement, OriginalNode::IS_DROPPED);
- }
- return false;
-}
-
-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)
- {
- nextTemporaryId();
- TIntermSequence replacements;
- replacements.push_back(createTempDeclaration(node->getType()));
- TIntermSymbol *returnSymbol = createTempSymbol(node->getType());
- replacements.push_back(CreateReplacementCall(node, returnSymbol));
- 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->getFunctionSymbolInfo()->getId();
- ASSERT(mReturnValueIds.find(functionId.get()) != mReturnValueIds.end());
- const TSymbolUniqueId &returnValueId = *mReturnValueIds[functionId.get()];
- TIntermSymbol *returnValueSymbol =
- CreateReturnValueSymbol(returnValueId, expression->getType());
- 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/src/3rdparty/angle/src/compiler/translator/ArrayReturnValueToOutParameter.h b/src/3rdparty/angle/src/compiler/translator/ArrayReturnValueToOutParameter.h
deleted file mode 100644
index 469c7a3b14..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ArrayReturnValueToOutParameter.h
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// The ArrayReturnValueToOutParameter function changes return values of an array type to out
-// parameters in function definitions, prototypes and call sites.
-
-#ifndef COMPILER_TRANSLATOR_ARRAYRETURNVALUETOOUTPARAMETER_H_
-#define COMPILER_TRANSLATOR_ARRAYRETURNVALUETOOUTPARAMETER_H_
-
-namespace sh
-{
-
-class TIntermNode;
-class TSymbolTable;
-
-void ArrayReturnValueToOutParameter(TIntermNode *root, TSymbolTable *symbolTable);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_ARRAYRETURNVALUETOOUTPARAMETER_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/BaseTypes.h b/src/3rdparty/angle/src/compiler/translator/BaseTypes.h
deleted file mode 100644
index b2070f3baf..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/BaseTypes.h
+++ /dev/null
@@ -1,1073 +0,0 @@
-//
-// 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 "common/debug.h"
-#include "GLSLANG/ShaderLang.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,
- EbtGVec4, // non type: represents vec4, ivec4, and uvec4
- EbtGenType, // non type: represents float, vec2, vec3, and vec4
- EbtGenIType, // non type: represents int, ivec2, ivec3, and ivec4
- EbtGenUType, // non type: represents uint, uvec2, uvec3, and uvec4
- EbtGenBType, // non type: represents bool, bvec2, bvec3, and bvec4
- EbtVec, // non type: represents vec2, vec3, and vec4
- EbtIVec, // non type: represents ivec2, ivec3, and ivec4
- EbtUVec, // non type: represents uvec2, uvec3, and uvec4
- EbtBVec, // non type: represents bvec2, bvec3, and bvec4
- EbtYuvCscStandardEXT, // Only valid if EXT_YUV_target exists.
- EbtGuardSamplerBegin, // non type: see implementation of IsSampler()
- EbtSampler2D,
- 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,
- EbtISampler2D,
- EbtISampler3D,
- EbtISamplerCube,
- EbtISampler2DArray,
- EbtISampler2DMS,
- EbtUSampler2D,
- EbtUSampler3D,
- EbtUSamplerCube,
- EbtUSampler2DArray,
- EbtUSampler2DMS,
- EbtSampler2DShadow,
- EbtSamplerCubeShadow,
- EbtSampler2DArrayShadow,
- EbtGuardSamplerEnd, // non type: see implementation of IsSampler()
- EbtGSampler2D, // non type: represents sampler2D, isampler2D, and usampler2D
- EbtGSampler3D, // non type: represents sampler3D, isampler3D, and usampler3D
- EbtGSamplerCube, // non type: represents samplerCube, isamplerCube, and usamplerCube
- EbtGSampler2DArray, // non type: represents sampler2DArray, isampler2DArray, and
- // usampler2DArray
- EbtGSampler2DMS, // non type: represents sampler2DMS, isampler2DMS, and usampler2DMS
-
- // images
- EbtGuardImageBegin,
- EbtImage2D,
- EbtIImage2D,
- EbtUImage2D,
- EbtImage3D,
- EbtIImage3D,
- EbtUImage3D,
- EbtImage2DArray,
- EbtIImage2DArray,
- EbtUImage2DArray,
- EbtImageCube,
- EbtIImageCube,
- EbtUImageCube,
- EbtGuardImageEnd,
-
- EbtGuardGImageBegin,
- EbtGImage2D, // non type: represents image2D, uimage2D, iimage2D
- EbtGImage3D, // non type: represents image3D, uimage3D, iimage3D
- EbtGImage2DArray, // non type: represents image2DArray, uimage2DArray, iimage2DArray
- EbtGImageCube, // non type: represents imageCube, uimageCube, iimageCube
- EbtGuardGImageEnd,
-
- EbtStruct,
- EbtInterfaceBlock,
- EbtAddress, // should be deprecated??
-
- EbtAtomicCounter,
-
- // end of list
- EbtLast
-};
-
-inline TBasicType convertGImageToFloatImage(TBasicType type)
-{
- switch (type)
- {
- case EbtGImage2D:
- return EbtImage2D;
- case EbtGImage3D:
- return EbtImage3D;
- case EbtGImage2DArray:
- return EbtImage2DArray;
- case EbtGImageCube:
- return EbtImageCube;
- default:
- UNREACHABLE();
- }
- return EbtLast;
-}
-
-inline TBasicType convertGImageToIntImage(TBasicType type)
-{
- switch (type)
- {
- case EbtGImage2D:
- return EbtIImage2D;
- case EbtGImage3D:
- return EbtIImage3D;
- case EbtGImage2DArray:
- return EbtIImage2DArray;
- case EbtGImageCube:
- return EbtIImageCube;
- default:
- UNREACHABLE();
- }
- return EbtLast;
-}
-
-inline TBasicType convertGImageToUnsignedImage(TBasicType type)
-{
- switch (type)
- {
- case EbtGImage2D:
- return EbtUImage2D;
- case EbtGImage3D:
- return EbtUImage3D;
- case EbtGImage2DArray:
- return EbtUImage2DArray;
- case EbtGImageCube:
- return EbtUImageCube;
- default:
- UNREACHABLE();
- }
- return EbtLast;
-}
-
-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 IsGImage(TBasicType type)
-{
- return type > EbtGuardGImageBegin && type < EbtGuardGImageEnd;
-}
-
-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 EbtUSampler2D:
- case EbtUSampler3D:
- case EbtUSamplerCube:
- case EbtUSampler2DArray:
- case EbtUSampler2DMS:
- return true;
- case EbtSampler2D:
- case EbtSampler3D:
- case EbtSamplerCube:
- case EbtSamplerExternalOES:
- case EbtSamplerExternal2DY2YEXT:
- case EbtSampler2DRect:
- case EbtSampler2DArray:
- case EbtSampler2DShadow:
- case EbtSamplerCubeShadow:
- case EbtSampler2DArrayShadow:
- case EbtSampler2DMS:
- return false;
- default:
- assert(!IsSampler(type));
- }
-
- return false;
-}
-
-inline bool IsSampler2DMS(TBasicType type)
-{
- switch (type)
- {
- case EbtSampler2DMS:
- case EbtISampler2DMS:
- case EbtUSampler2DMS:
- 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;
-}
-
-inline bool IsSampler2D(TBasicType type)
-{
- switch (type)
- {
- case EbtSampler2D:
- case EbtISampler2D:
- case EbtUSampler2D:
- case EbtSampler2DArray:
- case EbtISampler2DArray:
- case EbtUSampler2DArray:
- case EbtSampler2DRect:
- case EbtSamplerExternalOES:
- case EbtSamplerExternal2DY2YEXT:
- case EbtSampler2DShadow:
- case EbtSampler2DArrayShadow:
- case EbtSampler2DMS:
- case EbtISampler2DMS:
- case EbtUSampler2DMS:
- return true;
- case EbtSampler3D:
- case EbtISampler3D:
- case EbtUSampler3D:
- case EbtISamplerCube:
- case EbtUSamplerCube:
- case EbtSamplerCube:
- case EbtSamplerCubeShadow:
- return false;
- default:
- assert(!IsSampler(type));
- }
-
- return false;
-}
-
-inline bool IsSamplerCube(TBasicType type)
-{
- switch (type)
- {
- case EbtSamplerCube:
- case EbtISamplerCube:
- case EbtUSamplerCube:
- case EbtSamplerCubeShadow:
- return true;
- case EbtSampler2D:
- case EbtSampler3D:
- case EbtSamplerExternalOES:
- case EbtSamplerExternal2DY2YEXT:
- case EbtSampler2DRect:
- case EbtSampler2DArray:
- case EbtSampler2DMS:
- case EbtISampler2D:
- case EbtISampler3D:
- case EbtISampler2DArray:
- case EbtISampler2DMS:
- case EbtUSampler2D:
- case EbtUSampler3D:
- case EbtUSampler2DArray:
- case EbtUSampler2DMS:
- 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 EbtISampler2D:
- case EbtISamplerCube:
- case EbtISampler2DArray:
- case EbtISampler2DMS:
- case EbtUSampler2D:
- case EbtUSamplerCube:
- case EbtUSampler2DArray:
- case EbtUSampler2DMS:
- case EbtSampler2DShadow:
- case EbtSamplerCubeShadow:
- case EbtSampler2DArrayShadow:
- return false;
- default:
- assert(!IsSampler(type));
- }
-
- return false;
-}
-
-inline bool IsSamplerArray(TBasicType type)
-{
- switch (type)
- {
- case EbtSampler2DArray:
- case EbtISampler2DArray:
- case EbtUSampler2DArray:
- case EbtSampler2DArrayShadow:
- return true;
- case EbtSampler2D:
- case EbtISampler2D:
- case EbtUSampler2D:
- case EbtSampler2DRect:
- case EbtSamplerExternalOES:
- case 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 EbtUSampler2D:
- case EbtUSampler3D:
- case EbtUSamplerCube:
- case EbtUSampler2DArray:
- case EbtUSampler2DMS:
- case EbtSampler2D:
- case EbtSampler3D:
- case EbtSamplerCube:
- case EbtSamplerExternalOES:
- case EbtSamplerExternal2DY2YEXT:
- case EbtSampler2DRect:
- case EbtSampler2DArray:
- case EbtSampler2DMS:
- 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,
-
- // 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 OES_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);
-}
-
-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;
- }
-
- 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 || 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 sh::WorkGroupSize &localSizeIn) const
- {
- return localSize.isWorkGroupSizeMatching(localSizeIn);
- }
-
- int location;
- unsigned int locationsSpecified;
- TLayoutMatrixPacking matrixPacking;
- TLayoutBlockStorage blockStorage;
-
- // Compute shader layout qualifiers.
- sh::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;
-
- 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)
- {
- }
-};
-
-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 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 std::string &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/src/3rdparty/angle/src/compiler/translator/BreakVariableAliasingInInnerLoops.cpp b/src/3rdparty/angle/src/compiler/translator/BreakVariableAliasingInInnerLoops.cpp
deleted file mode 100644
index d6a1e025de..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/BreakVariableAliasingInInnerLoops.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-//
-// 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/IntermNode_util.h"
-#include "compiler/translator/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/src/3rdparty/angle/src/compiler/translator/BreakVariableAliasingInInnerLoops.h b/src/3rdparty/angle/src/compiler/translator/BreakVariableAliasingInInnerLoops.h
deleted file mode 100644
index b1d906f919..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/BreakVariableAliasingInInnerLoops.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// 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_BREAKVARIABLEALIASINGININNERLOOPS_H_
-#define COMPILER_TRANSLATOR_BREAKVARIABLEALIASINGININNERLOOPS_H_
-
-class TIntermNode;
-
-namespace sh
-{
-
-void BreakVariableAliasingInInnerLoops(TIntermNode *root);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_BREAKVARIABLEALIASINGININNERLOOPS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp
deleted file mode 100644
index 905e634fd1..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp
+++ /dev/null
@@ -1,355 +0,0 @@
-//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/translator/BuiltInFunctionEmulator.h"
-#include "angle_gl.h"
-#include "compiler/translator/Cache.h"
-#include "compiler/translator/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.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 (visit == PreVisit)
- {
- bool needToEmulate =
- mEmulator.setFunctionCalled(node->getOp(), node->getOperand()->getType());
- if (needToEmulate)
- node->setUseEmulatedFunction();
- }
- return true;
- }
-
- bool visitAggregate(Visit visit, TIntermAggregate *node) override
- {
- if (visit == PreVisit)
- {
- // 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;
- }
- const TIntermSequence &sequence = *(node->getSequence());
- bool needToEmulate = false;
- // Right now we only handle built-in functions with two to four parameters.
- if (sequence.size() == 2)
- {
- TIntermTyped *param1 = sequence[0]->getAsTyped();
- TIntermTyped *param2 = sequence[1]->getAsTyped();
- if (!param1 || !param2)
- return true;
- needToEmulate = mEmulator.setFunctionCalled(node->getOp(), param1->getType(),
- param2->getType());
- }
- else if (sequence.size() == 3)
- {
- TIntermTyped *param1 = sequence[0]->getAsTyped();
- TIntermTyped *param2 = sequence[1]->getAsTyped();
- TIntermTyped *param3 = sequence[2]->getAsTyped();
- if (!param1 || !param2 || !param3)
- return true;
- needToEmulate = mEmulator.setFunctionCalled(node->getOp(), param1->getType(),
- param2->getType(), param3->getType());
- }
- else if (sequence.size() == 4)
- {
- TIntermTyped *param1 = sequence[0]->getAsTyped();
- TIntermTyped *param2 = sequence[1]->getAsTyped();
- TIntermTyped *param3 = sequence[2]->getAsTyped();
- TIntermTyped *param4 = sequence[3]->getAsTyped();
- if (!param1 || !param2 || !param3 || !param4)
- return true;
- needToEmulate =
- mEmulator.setFunctionCalled(node->getOp(), param1->getType(), param2->getType(),
- param3->getType(), param4->getType());
- }
- else
- {
- return true;
- }
-
- if (needToEmulate)
- node->setUseEmulatedFunction();
- }
- return true;
- }
-
- private:
- BuiltInFunctionEmulator &mEmulator;
-};
-
-BuiltInFunctionEmulator::BuiltInFunctionEmulator()
-{
-}
-
-FunctionId BuiltInFunctionEmulator::addEmulatedFunction(TOperator op,
- const TType *param,
- const char *emulatedFunctionDefinition)
-{
- FunctionId id(op, param);
- mEmulatedFunctions[id] = std::string(emulatedFunctionDefinition);
- return id;
-}
-
-FunctionId BuiltInFunctionEmulator::addEmulatedFunction(TOperator op,
- const TType *param1,
- const TType *param2,
- const char *emulatedFunctionDefinition)
-{
- FunctionId id(op, param1, param2);
- mEmulatedFunctions[id] = std::string(emulatedFunctionDefinition);
- return id;
-}
-
-FunctionId BuiltInFunctionEmulator::addEmulatedFunctionWithDependency(
- const FunctionId &dependency,
- TOperator op,
- const TType *param1,
- const TType *param2,
- const char *emulatedFunctionDefinition)
-{
- FunctionId id(op, param1, param2);
- mEmulatedFunctions[id] = std::string(emulatedFunctionDefinition);
- mFunctionDependencies[id] = dependency;
- return id;
-}
-
-FunctionId BuiltInFunctionEmulator::addEmulatedFunction(TOperator op,
- const TType *param1,
- const TType *param2,
- const TType *param3,
- const char *emulatedFunctionDefinition)
-{
- FunctionId id(op, param1, param2, param3);
- mEmulatedFunctions[id] = std::string(emulatedFunctionDefinition);
- return id;
-}
-
-FunctionId BuiltInFunctionEmulator::addEmulatedFunction(TOperator op,
- const TType *param1,
- const TType *param2,
- const TType *param3,
- const TType *param4,
- const char *emulatedFunctionDefinition)
-{
- FunctionId id(op, param1, param2, param3, param4);
- mEmulatedFunctions[id] = std::string(emulatedFunctionDefinition);
- return id;
-}
-
-FunctionId BuiltInFunctionEmulator::addEmulatedFunctionWithDependency(
- const FunctionId &dependency,
- TOperator op,
- const TType *param1,
- const TType *param2,
- const TType *param3,
- const TType *param4,
- const char *emulatedFunctionDefinition)
-{
- FunctionId id(op, param1, param2, param3, param4);
- mEmulatedFunctions[id] = std::string(emulatedFunctionDefinition);
- mFunctionDependencies[id] = dependency;
- return id;
-}
-
-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";
- }
-}
-
-bool BuiltInFunctionEmulator::setFunctionCalled(TOperator op, const TType &param)
-{
- return setFunctionCalled(FunctionId(op, &param));
-}
-
-bool BuiltInFunctionEmulator::setFunctionCalled(TOperator op,
- const TType &param1,
- const TType &param2)
-{
- return setFunctionCalled(FunctionId(op, &param1, &param2));
-}
-
-bool BuiltInFunctionEmulator::setFunctionCalled(TOperator op,
- const TType &param1,
- const TType &param2,
- const TType &param3)
-{
- return setFunctionCalled(FunctionId(op, &param1, &param2, &param3));
-}
-
-bool BuiltInFunctionEmulator::setFunctionCalled(TOperator op,
- const TType &param1,
- const TType &param2,
- const TType &param3,
- const TType &param4)
-{
- return setFunctionCalled(FunctionId(op, &param1, &param2, &param3, &param4));
-}
-
-const char *BuiltInFunctionEmulator::findEmulatedFunction(const FunctionId &functionId) const
-{
- for (const auto &queryFunction : mQueryFunctions)
- {
- const char *result = queryFunction(functionId);
- if (result)
- {
- return result;
- }
- }
-
- const auto &result = mEmulatedFunctions.find(functionId);
- if (result != mEmulatedFunctions.end())
- {
- return result->second.c_str();
- }
-
- return nullptr;
-}
-
-bool BuiltInFunctionEmulator::setFunctionCalled(const FunctionId &functionId)
-{
- if (!findEmulatedFunction(functionId))
- {
- return false;
- }
-
- for (size_t i = 0; i < mFunctions.size(); ++i)
- {
- if (mFunctions[i] == functionId)
- return true;
- }
- // If the function depends on another, mark the dependency as called.
- auto dependency = mFunctionDependencies.find(functionId);
- if (dependency != mFunctionDependencies.end())
- {
- setFunctionCalled((*dependency).second);
- }
- // Copy the functionId if it needs to be stored, to make sure that the TType pointers inside
- // remain valid and constant.
- mFunctions.push_back(functionId.getCopy());
- 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";
-}
-
-FunctionId::FunctionId()
- : mOp(EOpNull),
- mParam1(TCache::getType(EbtVoid)),
- mParam2(TCache::getType(EbtVoid)),
- mParam3(TCache::getType(EbtVoid)),
- mParam4(TCache::getType(EbtVoid))
-{
-}
-
-FunctionId::FunctionId(TOperator op, const TType *param)
- : mOp(op),
- mParam1(param),
- mParam2(TCache::getType(EbtVoid)),
- mParam3(TCache::getType(EbtVoid)),
- mParam4(TCache::getType(EbtVoid))
-{
-}
-
-FunctionId::FunctionId(TOperator op, const TType *param1, const TType *param2)
- : mOp(op),
- mParam1(param1),
- mParam2(param2),
- mParam3(TCache::getType(EbtVoid)),
- mParam4(TCache::getType(EbtVoid))
-{
-}
-
-FunctionId::FunctionId(TOperator op, const TType *param1, const TType *param2, const TType *param3)
- : mOp(op), mParam1(param1), mParam2(param2), mParam3(param3), mParam4(TCache::getType(EbtVoid))
-{
-}
-
-FunctionId::FunctionId(TOperator op,
- const TType *param1,
- const TType *param2,
- const TType *param3,
- const TType *param4)
- : mOp(op), mParam1(param1), mParam2(param2), mParam3(param3), mParam4(param4)
-{
-}
-
-bool FunctionId::operator==(const FunctionId &other) const
-{
- return (mOp == other.mOp && *mParam1 == *other.mParam1 && *mParam2 == *other.mParam2 &&
- *mParam3 == *other.mParam3 && *mParam4 == *other.mParam4);
-}
-
-bool FunctionId::operator<(const FunctionId &other) const
-{
- if (mOp != other.mOp)
- return mOp < other.mOp;
- if (*mParam1 != *other.mParam1)
- return *mParam1 < *other.mParam1;
- if (*mParam2 != *other.mParam2)
- return *mParam2 < *other.mParam2;
- if (*mParam3 != *other.mParam3)
- return *mParam3 < *other.mParam3;
- if (*mParam4 != *other.mParam4)
- return *mParam4 < *other.mParam4;
- return false; // all fields are equal
-}
-
-FunctionId FunctionId::getCopy() const
-{
- return FunctionId(mOp, new TType(*mParam1), new TType(*mParam2), new TType(*mParam3),
- new TType(*mParam4));
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h
deleted file mode 100644
index 5f15f66224..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h
+++ /dev/null
@@ -1,183 +0,0 @@
-//
-// 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"
-#include "compiler/translator/IntermNode.h"
-#include "compiler/translator/ParamType.h"
-
-namespace sh
-{
-
-struct MiniFunctionId
-{
- constexpr MiniFunctionId(TOperator op = EOpNull,
- ParamType paramType1 = ParamType::Void,
- ParamType paramType2 = ParamType::Void,
- ParamType paramType3 = ParamType::Void,
- ParamType paramType4 = ParamType::Void)
- : op(op),
- paramType1(paramType1),
- paramType2(paramType2),
- paramType3(paramType3),
- paramType4(paramType4)
- {
- }
-
- TOperator op;
- ParamType paramType1;
- ParamType paramType2;
- ParamType paramType3;
- ParamType paramType4;
-};
-
-class FunctionId final
-{
- public:
- FunctionId();
- FunctionId(TOperator op, const TType *param);
- FunctionId(TOperator op, const TType *param1, const TType *param2);
- FunctionId(TOperator op, const TType *param1, const TType *param2, const TType *param3);
- FunctionId(TOperator op,
- const TType *param1,
- const TType *param2,
- const TType *param3,
- const TType *param4);
-
- FunctionId(const FunctionId &) = default;
- FunctionId &operator=(const FunctionId &) = default;
-
- bool operator==(const FunctionId &other) const;
- bool operator<(const FunctionId &other) const;
-
- FunctionId getCopy() const;
-
- private:
- friend bool operator==(const MiniFunctionId &miniId, const FunctionId &functionId);
- TOperator mOp;
-
- // The memory that these TType objects use is freed by PoolAllocator. The
- // BuiltInFunctionEmulator's lifetime can extend until after the memory pool is freed, but
- // that's not an issue since this class never destructs these objects.
- const TType *mParam1;
- const TType *mParam2;
- const TType *mParam3;
- const TType *mParam4;
-};
-
-inline bool operator==(ParamType paramType, const TType *type)
-{
- return SameParamType(paramType, type->getBasicType(), type->getNominalSize(),
- type->getSecondarySize());
-}
-
-inline bool operator==(const MiniFunctionId &miniId, const FunctionId &functionId)
-{
- return miniId.op == functionId.mOp && miniId.paramType1 == functionId.mParam1 &&
- miniId.paramType2 == functionId.mParam2 && miniId.paramType3 == functionId.mParam3 &&
- miniId.paramType4 == functionId.mParam4;
-}
-
-using BuiltinQueryFunc = const char *(const FunctionId &);
-
-//
-// 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.
- FunctionId addEmulatedFunction(TOperator op,
- const TType *param,
- const char *emulatedFunctionDefinition);
- FunctionId addEmulatedFunction(TOperator op,
- const TType *param1,
- const TType *param2,
- const char *emulatedFunctionDefinition);
- FunctionId addEmulatedFunction(TOperator op,
- const TType *param1,
- const TType *param2,
- const TType *param3,
- const char *emulatedFunctionDefinition);
- FunctionId addEmulatedFunction(TOperator op,
- const TType *param1,
- const TType *param2,
- const TType *param3,
- const TType *param4,
- const char *emulatedFunctionDefinition);
-
- FunctionId addEmulatedFunctionWithDependency(const FunctionId &dependency,
- TOperator op,
- const TType *param1,
- const TType *param2,
- const char *emulatedFunctionDefinition);
- FunctionId addEmulatedFunctionWithDependency(const FunctionId &dependency,
- TOperator op,
- const TType *param1,
- const TType *param2,
- const TType *param3,
- const TType *param4,
- 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(TOperator op, const TType &param);
- bool setFunctionCalled(TOperator op, const TType &param1, const TType &param2);
- bool setFunctionCalled(TOperator op,
- const TType &param1,
- const TType &param2,
- const TType &param3);
- bool setFunctionCalled(TOperator op,
- const TType &param1,
- const TType &param2,
- const TType &param3,
- const TType &param4);
-
- bool setFunctionCalled(const FunctionId &functionId);
-
- const char *findEmulatedFunction(const FunctionId &functionId) const;
-
- // Map from function id to emulated function definition
- std::map<FunctionId, std::string> mEmulatedFunctions;
-
- // Map from dependent functions to their dependencies. This structure allows each function to
- // have at most one dependency.
- std::map<FunctionId, FunctionId> mFunctionDependencies;
-
- // Called function ids
- std::vector<FunctionId> mFunctions;
-
- // Constexpr function tables.
- std::vector<BuiltinQueryFunc *> mQueryFunctions;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATOR_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp
deleted file mode 100644
index 27ee04da35..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "angle_gl.h"
-#include "compiler/translator/BuiltInFunctionEmulator.h"
-#include "compiler/translator/BuiltInFunctionEmulatorGLSL.h"
-#include "compiler/translator/Cache.h"
-#include "compiler/translator/SymbolTable.h"
-#include "compiler/translator/VersionGLSL.h"
-
-namespace sh
-{
-
-void InitBuiltInAbsFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *emu,
- sh::GLenum shaderType)
-{
- if (shaderType == GL_VERTEX_SHADER)
- {
- const TType *int1 = TCache::getType(EbtInt);
- emu->addEmulatedFunction(EOpAbs, 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;
-
- const TType *float1 = TCache::getType(EbtFloat);
- const TType *float2 = TCache::getType(EbtFloat, 2);
- const TType *float3 = TCache::getType(EbtFloat, 3);
- const TType *float4 = TCache::getType(EbtFloat, 4);
-
- // !(x > 0.0 || x < 0.0 || x == 0.0) will be optimized and always equal to false.
- emu->addEmulatedFunction(
- EOpIsNan, float1,
- "bool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? false : x != 0.0; }");
- emu->addEmulatedFunction(
- EOpIsNan, 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(
- EOpIsNan, 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(
- EOpIsNan, 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)
-{
- const TType *float1 = TCache::getType(EbtFloat);
- auto floatFuncId = emu->addEmulatedFunction(
- EOpAtan, 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");
- for (int dim = 2; dim <= 4; ++dim)
- {
- const TType *floatVec = TCache::getType(EbtFloat, static_cast<unsigned char>(dim));
- std::stringstream ss;
- 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(floatFuncId, EOpAtan, floatVec, floatVec,
- 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)
- {
- const TType *float2 = TCache::getType(EbtFloat, 2);
- const TType *uint1 = TCache::getType(EbtUInt);
-
- // clang-format off
- emu->addEmulatedFunction(EOpPackUnorm2x16, 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(EOpUnpackUnorm2x16, 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)
- {
- const TType *float2 = TCache::getType(EbtFloat, 2);
- const TType *uint1 = TCache::getType(EbtUInt);
-
- // clang-format off
- emu->addEmulatedFunction(EOpPackSnorm2x16, 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(EOpUnpackSnorm2x16, 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(EOpPackHalf2x16, 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(EOpUnpackHalf2x16, 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/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorGLSL.h b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorGLSL.h
deleted file mode 100644
index e1b4779bd5..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorGLSL.h
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp
deleted file mode 100644
index e78d86d00a..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-//
-// 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 "angle_gl.h"
-#include "compiler/translator/BuiltInFunctionEmulator.h"
-#include "compiler/translator/BuiltInFunctionEmulatorHLSL.h"
-#include "compiler/translator/SymbolTable.h"
-#include "compiler/translator/VersionGLSL.h"
-
-namespace sh
-{
-
-// Defined in emulated_builtin_functions_hlsl_autogen.cpp.
-const char *FindHLSLFunction(const FunctionId &functionID);
-
-void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator *emu,
- int targetGLSLVersion)
-{
- if (targetGLSLVersion < GLSL_VERSION_130)
- return;
-
- TType *float1 = new TType(EbtFloat);
- TType *float2 = new TType(EbtFloat, 2);
- TType *float3 = new TType(EbtFloat, 3);
- TType *float4 = new TType(EbtFloat, 4);
-
- emu->addEmulatedFunction(EOpIsNan, float1,
- "bool isnan_emu(float x)\n"
- "{\n"
- " return (x > 0.0 || x < 0.0) ? false : x != 0.0;\n"
- "}\n"
- "\n");
-
- emu->addEmulatedFunction(
- EOpIsNan, 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(
- EOpIsNan, 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(
- EOpIsNan, 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)
-{
- TType *int1 = new TType(EbtInt);
- TType *int2 = new TType(EbtInt, 2);
- TType *int3 = new TType(EbtInt, 3);
- TType *int4 = new TType(EbtInt, 4);
- TType *uint1 = new TType(EbtUInt);
- TType *uint2 = new TType(EbtUInt, 2);
- TType *uint3 = new TType(EbtUInt, 3);
- TType *uint4 = new TType(EbtUInt, 4);
-
- 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
- FunctionId umulExtendedUint1 = emu->addEmulatedFunction(
- EOpUmulExtended, 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(
- umulExtendedUint1, EOpUmulExtended, 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(
- umulExtendedUint1, EOpUmulExtended, 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(
- umulExtendedUint1, EOpUmulExtended, 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.
- FunctionId imulExtendedInt1 = emu->addEmulatedFunctionWithDependency(
- umulExtendedUint1, EOpImulExtended, 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(
- imulExtendedInt1, EOpImulExtended, 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(
- imulExtendedInt1, EOpImulExtended, 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(
- imulExtendedInt1, EOpImulExtended, 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/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorHLSL.h b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorHLSL.h
deleted file mode 100644
index 48da73f58e..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulatorHLSL.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/Cache.cpp b/src/3rdparty/angle/src/compiler/translator/Cache.cpp
deleted file mode 100644
index 417e82403a..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Cache.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// 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.
-//
-
-// Cache.cpp: Implements a cache for various commonly created objects.
-
-#include <limits>
-
-#include "common/angleutils.h"
-#include "common/debug.h"
-#include "compiler/translator/Cache.h"
-
-namespace sh
-{
-
-namespace
-{
-
-class TScopedAllocator : angle::NonCopyable
-{
- public:
- TScopedAllocator(TPoolAllocator *allocator) : mPreviousAllocator(GetGlobalPoolAllocator())
- {
- SetGlobalPoolAllocator(allocator);
- }
- ~TScopedAllocator() { SetGlobalPoolAllocator(mPreviousAllocator); }
-
- private:
- TPoolAllocator *mPreviousAllocator;
-};
-
-} // namespace
-
-TCache::TypeKey::TypeKey(TBasicType basicType,
- TPrecision precision,
- TQualifier qualifier,
- unsigned char primarySize,
- unsigned char secondarySize)
-{
- static_assert(sizeof(components) <= sizeof(value), "TypeKey::value is too small");
-
- const size_t MaxEnumValue = std::numeric_limits<EnumComponentType>::max();
-
- // TODO: change to static_assert() once we deprecate MSVC 2013 support
- ASSERT(MaxEnumValue >= EbtLast && MaxEnumValue >= EbpLast && MaxEnumValue >= EvqLast &&
- "TypeKey::EnumComponentType is too small");
-
- value = 0;
- components.basicType = static_cast<EnumComponentType>(basicType);
- components.precision = static_cast<EnumComponentType>(precision);
- components.qualifier = static_cast<EnumComponentType>(qualifier);
- components.primarySize = primarySize;
- components.secondarySize = secondarySize;
-}
-
-TCache *TCache::sCache = nullptr;
-
-TCache::TCache()
-{
-}
-
-void TCache::initialize()
-{
- if (sCache == nullptr)
- {
- sCache = new TCache();
- }
-}
-
-void TCache::destroy()
-{
- SafeDelete(sCache);
-}
-
-const TType *TCache::getType(TBasicType basicType,
- TPrecision precision,
- TQualifier qualifier,
- unsigned char primarySize,
- unsigned char secondarySize)
-{
- TypeKey key(basicType, precision, qualifier, primarySize, secondarySize);
- auto it = sCache->mTypes.find(key);
- if (it != sCache->mTypes.end())
- {
- return it->second;
- }
-
- TScopedAllocator scopedAllocator(&sCache->mAllocator);
-
- TType *type = new TType(basicType, precision, qualifier, primarySize, secondarySize);
- type->realize();
- sCache->mTypes.insert(std::make_pair(key, type));
-
- return type;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/Cache.h b/src/3rdparty/angle/src/compiler/translator/Cache.h
deleted file mode 100644
index a182b07f51..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Cache.h
+++ /dev/null
@@ -1,84 +0,0 @@
-//
-// 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.
-//
-
-// Cache.h: Implements a cache for various commonly created objects.
-
-#ifndef COMPILER_TRANSLATOR_CACHE_H_
-#define COMPILER_TRANSLATOR_CACHE_H_
-
-#include <stdint.h>
-#include <string.h>
-#include <map>
-
-#include "compiler/translator/Types.h"
-#include "compiler/translator/PoolAlloc.h"
-
-namespace sh
-{
-
-class TCache
-{
- public:
- static void initialize();
- static void destroy();
-
- static const TType *getType(TBasicType basicType, TPrecision precision)
- {
- return getType(basicType, precision, EvqTemporary, 1, 1);
- }
- static const TType *getType(TBasicType basicType,
- unsigned char primarySize = 1,
- unsigned char secondarySize = 1)
- {
- return getType(basicType, EbpUndefined, EvqGlobal, primarySize, secondarySize);
- }
- static const TType *getType(TBasicType basicType,
- TQualifier qualifier,
- unsigned char primarySize = 1,
- unsigned char secondarySize = 1)
- {
- return getType(basicType, EbpUndefined, qualifier, primarySize, secondarySize);
- }
- static const TType *getType(TBasicType basicType,
- TPrecision precision,
- TQualifier qualifier,
- unsigned char primarySize,
- unsigned char secondarySize);
-
- private:
- TCache();
-
- union TypeKey {
- TypeKey(TBasicType basicType,
- TPrecision precision,
- TQualifier qualifier,
- unsigned char primarySize,
- unsigned char secondarySize);
-
- typedef uint8_t EnumComponentType;
- struct
- {
- EnumComponentType basicType;
- EnumComponentType precision;
- EnumComponentType qualifier;
- unsigned char primarySize;
- unsigned char secondarySize;
- } components;
- uint64_t value;
-
- bool operator<(const TypeKey &other) const { return value < other.value; }
- };
- typedef std::map<TypeKey, const TType *> TypeMap;
-
- TypeMap mTypes;
- TPoolAllocator mAllocator;
-
- static TCache *sCache;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_CACHE_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/CallDAG.cpp b/src/3rdparty/angle/src/compiler/translator/CallDAG.cpp
deleted file mode 100644
index 5f54e80898..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/CallDAG.cpp
+++ /dev/null
@@ -1,346 +0,0 @@
-//
-// 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/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.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, true),
- mDiagnostics(diagnostics),
- mCurrentFunction(nullptr),
- mCurrentIndex(0)
- {
- }
-
- InitResult assignIndices()
- {
- int skipped = 0;
- for (auto &it : mFunctions)
- {
- // Skip unimplemented functions
- if (it.second.node)
- {
- 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.node)
- {
- continue;
- }
- ASSERT(data.index < records->size());
- Record &record = (*records)[data.index];
-
- record.name = data.name.data();
- record.node = data.node;
-
- record.callees.reserve(data.callees.size());
- for (auto &callee : data.callees)
- {
- record.callees.push_back(static_cast<int>(callee->index));
- }
-
- (*idToIndex)[data.node->getFunctionSymbolInfo()->getId().get()] =
- static_cast<int>(data.index);
- }
- }
-
- private:
- struct CreatorFunctionData
- {
- CreatorFunctionData() : node(nullptr), index(0), indexAssigned(false), visiting(false) {}
-
- std::set<CreatorFunctionData *> callees;
- TIntermFunctionDefinition *node;
- TString name;
- size_t index;
- bool indexAssigned;
- bool visiting;
- };
-
- bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override
- {
- // Create the record if need be and remember the node.
- if (visit == PreVisit)
- {
- auto it = mFunctions.find(node->getFunctionSymbolInfo()->getId().get());
-
- if (it == mFunctions.end())
- {
- mCurrentFunction = &mFunctions[node->getFunctionSymbolInfo()->getId().get()];
- mCurrentFunction->name = node->getFunctionSymbolInfo()->getName();
- }
- else
- {
- mCurrentFunction = &it->second;
- ASSERT(mCurrentFunction->name == node->getFunctionSymbolInfo()->getName());
- }
-
- mCurrentFunction->node = node;
- }
- else if (visit == PostVisit)
- {
- mCurrentFunction = nullptr;
- }
- return true;
- }
-
- bool visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) override
- {
- ASSERT(visit == PreVisit);
- if (mCurrentFunction != nullptr)
- {
- return false;
- }
-
- // Function declaration, create an empty record.
- auto &record = mFunctions[node->getFunctionSymbolInfo()->getId().get()];
- record.name = node->getFunctionSymbolInfo()->getName();
-
- // No need to traverse the parameters.
- return false;
- }
-
- // Aggregates the AST node for each function as well as the name of the functions called by it
- bool visitAggregate(Visit visit, TIntermAggregate *node) override
- {
- if (visit == PreVisit && node->getOp() == EOpCallFunctionInAST)
- {
- // Function call, add the callees
- auto it = mFunctions.find(node->getFunctionSymbolInfo()->getId().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;
-
- 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->node)
- {
- 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 TFunctionSymbolInfo *functionInfo) const
-{
- auto it = mFunctionIdToIndex.find(functionInfo->getId().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];
-}
-
-const CallDAG::Record &CallDAG::getRecord(const TIntermAggregate *function) const
-{
- size_t index = findIndex(function->getFunctionSymbolInfo());
- 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/src/3rdparty/angle/src/compiler/translator/CallDAG.h b/src/3rdparty/angle/src/compiler/translator/CallDAG.h
deleted file mode 100644
index 155081c9a2..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/CallDAG.h
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// 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 function.
-// Records are accessed by index but a function symbol id can be converted
-// to the index of the corresponding record. The records mostly contain the
-// AST node of the function and the indices of the function's callees.
-//
-// In addition, records are in reverse topological order: a function F being
-// called by a function G will have index index(F) < index(G), that way
-// depth-first analysis becomes analysis in the order of indices.
-
-class CallDAG : angle::NonCopyable
-{
- public:
- CallDAG();
- ~CallDAG();
-
- struct Record
- {
- std::string name;
- TIntermFunctionDefinition *node;
- 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 TFunctionSymbolInfo *functionInfo) const;
-
- const Record &getRecordFromIndex(size_t index) const;
- const Record &getRecord(const TIntermAggregate *function) 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/src/3rdparty/angle/src/compiler/translator/ClampPointSize.cpp b/src/3rdparty/angle/src/compiler/translator/ClampPointSize.cpp
deleted file mode 100644
index 8598a137f5..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ClampPointSize.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// 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/ClampPointSize.h"
-
-#include "compiler/translator/FindSymbolNode.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/RunAtTheEndOfShader.h"
-#include "compiler/translator/SymbolTable.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, TString("gl_PointSize"), EbtFloat))
- {
- return;
- }
-
- TIntermSymbol *pointSizeNode = ReferenceBuiltInVariable("gl_PointSize", *symbolTable, 100);
-
- 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/src/3rdparty/angle/src/compiler/translator/ClampPointSize.h b/src/3rdparty/angle/src/compiler/translator/ClampPointSize.h
deleted file mode 100644
index 0c71ae6b0d..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ClampPointSize.h
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// 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_CLAMPPOINTSIZE_H_
-#define COMPILER_TRANSLATOR_CLAMPPOINTSIZE_H_
-
-namespace sh
-{
-
-class TIntermBlock;
-class TSymbolTable;
-
-void ClampPointSize(TIntermBlock *root, float maxPointSize, TSymbolTable *symbolTable);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_CLAMPPOINTSIZE_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/CodeGen.cpp b/src/3rdparty/angle/src/compiler/translator/CodeGen.cpp
deleted file mode 100644
index 3e25cc2339..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/CodeGen.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/CollectVariables.cpp b/src/3rdparty/angle/src/compiler/translator/CollectVariables.cpp
deleted file mode 100644
index bd8cbc971a..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/CollectVariables.cpp
+++ /dev/null
@@ -1,869 +0,0 @@
-//
-// 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/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.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_OES_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 TString &name, std::vector<VarT> *infoList)
-{
- // TODO(zmo): optimize this function.
- for (size_t ii = 0; ii < infoList->size(); ++ii)
- {
- if ((*infoList)[ii].name.c_str() == name)
- return &((*infoList)[ii]);
- }
-
- return nullptr;
-}
-
-// Note that this shouldn't be called for interface blocks - static use information is collected for
-// individual fields in case of interface blocks.
-void MarkStaticallyUsed(ShaderVariable *variable)
-{
- if (!variable->staticUse)
- {
- if (variable->isStruct())
- {
- // Conservatively assume all fields are statically used as well.
- for (auto &field : variable->fields)
- {
- MarkStaticallyUsed(&field);
- }
- }
- variable->staticUse = true;
- }
-}
-
-ShaderVariable *FindVariableInInterfaceBlock(const TString &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;
- 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,
- int shaderVersion,
- GLenum shaderType,
- const TExtensionBehavior &extensionBehavior);
-
- void visitSymbol(TIntermSymbol *symbol) override;
- bool visitDeclaration(Visit, TIntermDeclaration *node) override;
- bool visitBinary(Visit visit, TIntermBinary *binaryNode) override;
-
- private:
- std::string getMappedName(const TName &name) const;
-
- void setCommonVariableProperties(const TType &type,
- const TName &name,
- ShaderVariable *variableOut) const;
-
- Attribute recordAttribute(const TIntermSymbol &variable) const;
- OutputVariable recordOutputVariable(const TIntermSymbol &variable) const;
- Varying recordVarying(const TIntermSymbol &variable) const;
- void recordInterfaceBlock(const TType &interfaceBlockType,
- InterfaceBlock *interfaceBlock) const;
- Uniform recordUniform(const TIntermSymbol &variable) const;
-
- void setBuiltInInfoFromSymbolTable(const char *name, ShaderVariable *info);
-
- void recordBuiltInVaryingUsed(const char *name,
- bool *addedFlag,
- std::vector<Varying> *varyings);
- void recordBuiltInFragmentOutputUsed(const char *name, bool *addedFlag);
- void recordBuiltInAttributeUsed(const char *name, bool *addedFlag);
- InterfaceBlock *recordGLInUsed(const TType &glInType);
- InterfaceBlock *findNamedInterfaceBlock(const TString &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;
-
- // 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;
-
- int mShaderVersion;
- 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,
- int shaderVersion,
- 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),
- 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),
- mShaderVersion(shaderVersion),
- mShaderType(shaderType),
- mExtensionBehavior(extensionBehavior)
-{
-}
-
-std::string CollectVariablesTraverser::getMappedName(const TName &name) const
-{
- return HashName(name, mHashFunction, nullptr).c_str();
-}
-
-void CollectVariablesTraverser::setBuiltInInfoFromSymbolTable(const char *name,
- ShaderVariable *info)
-{
- TVariable *symbolTableVar =
- reinterpret_cast<TVariable *>(mSymbolTable->findBuiltIn(name, mShaderVersion));
- ASSERT(symbolTableVar);
- const TType &type = symbolTableVar->getType();
-
- info->name = name;
- info->mappedName = name;
- info->type = GLVariableType(type);
- info->precision = GLVariablePrecision(type);
- if (auto *arraySizes = type.getArraySizes())
- {
- info->arraySizes.assign(arraySizes->begin(), arraySizes->end());
- }
-}
-
-void CollectVariablesTraverser::recordBuiltInVaryingUsed(const char *name,
- bool *addedFlag,
- std::vector<Varying> *varyings)
-{
- ASSERT(varyings);
- if (!(*addedFlag))
- {
- Varying info;
- setBuiltInInfoFromSymbolTable(name, &info);
- info.staticUse = true;
- info.isInvariant = mSymbolTable->isVaryingInvariant(name);
- varyings->push_back(info);
- (*addedFlag) = true;
- }
-}
-
-void CollectVariablesTraverser::recordBuiltInFragmentOutputUsed(const char *name, bool *addedFlag)
-{
- if (!(*addedFlag))
- {
- OutputVariable info;
- setBuiltInInfoFromSymbolTable(name, &info);
- info.staticUse = true;
- mOutputVariables->push_back(info);
- (*addedFlag) = true;
- }
-}
-
-void CollectVariablesTraverser::recordBuiltInAttributeUsed(const char *name, bool *addedFlag)
-{
- if (!(*addedFlag))
- {
- Attribute info;
- setBuiltInInfoFromSymbolTable(name, &info);
- info.staticUse = 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(glInType, &info);
- info.staticUse = true;
-
- mPerVertexInAdded = true;
- mInBlocks->push_back(info);
- return &mInBlocks->back();
- }
- else
- {
- return FindVariable("gl_PerVertex", mInBlocks);
- }
-}
-
-// We want to check whether a uniform/varying is statically used
-// because we only count the used ones in packing computing.
-// Also, gl_FragCoord, gl_PointCoord, and gl_FrontFacing count
-// toward varying counting if they are statically used in a fragment
-// shader.
-void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol)
-{
- ASSERT(symbol != nullptr);
-
- if (symbol->getName().isInternal())
- {
- // Internal variables are not collected.
- return;
- }
-
- ShaderVariable *var = nullptr;
- const TString &symbolName = symbol->getName().getString();
-
- if (IsVaryingIn(symbol->getQualifier()))
- {
- var = FindVariable(symbolName, mInputVaryings);
- }
- else if (IsVaryingOut(symbol->getQualifier()))
- {
- var = FindVariable(symbolName, mOutputVaryings);
- }
- else if (symbol->getType().getBasicType() == EbtInterfaceBlock)
- {
- UNREACHABLE();
- }
- else if (symbolName == "gl_DepthRange")
- {
- ASSERT(symbol->getQualifier() == 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;
-
- ShaderVariable nearInfo(GL_FLOAT);
- const char kNearName[] = "near";
- nearInfo.name = kNearName;
- nearInfo.mappedName = kNearName;
- nearInfo.precision = GL_HIGH_FLOAT;
- nearInfo.staticUse = true;
-
- ShaderVariable farInfo(GL_FLOAT);
- const char kFarName[] = "far";
- farInfo.name = kFarName;
- farInfo.mappedName = kFarName;
- farInfo.precision = GL_HIGH_FLOAT;
- farInfo.staticUse = true;
-
- ShaderVariable diffInfo(GL_FLOAT);
- const char kDiffName[] = "diff";
- diffInfo.name = kDiffName;
- diffInfo.mappedName = kDiffName;
- diffInfo.precision = GL_HIGH_FLOAT;
- diffInfo.staticUse = true;
-
- info.fields.push_back(nearInfo);
- info.fields.push_back(farInfo);
- info.fields.push_back(diffInfo);
-
- mUniforms->push_back(info);
- mDepthRangeAdded = true;
- }
- }
- else
- {
- switch (symbol->getQualifier())
- {
- 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.compare(0, 3, "gl_") != 0 || var);
- }
- break;
- case EvqBuffer:
- {
- const TInterfaceBlock *interfaceBlock = symbol->getType().getInterfaceBlock();
- var =
- FindVariableInInterfaceBlock(symbolName, interfaceBlock, mShaderStorageBlocks);
- }
- break;
- case EvqFragCoord:
- recordBuiltInVaryingUsed("gl_FragCoord", &mFragCoordAdded, mInputVaryings);
- return;
- case EvqFrontFacing:
- recordBuiltInVaryingUsed("gl_FrontFacing", &mFrontFacingAdded, mInputVaryings);
- return;
- case EvqPointCoord:
- recordBuiltInVaryingUsed("gl_PointCoord", &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. gl_InstanceID is not added to the symbol table for ESSL1 shaders
- // which makes it necessary to populate the type information explicitly instead of
- // extracting it from the symbol table.
- if (!mInstanceIDAdded)
- {
- Attribute info;
- const char kName[] = "gl_InstanceID";
- info.name = kName;
- info.mappedName = kName;
- info.type = GL_INT;
- info.precision = GL_HIGH_INT; // Defined by spec.
- info.staticUse = true;
- info.location = -1;
- mAttribs->push_back(info);
- mInstanceIDAdded = true;
- }
- return;
- case EvqVertexID:
- recordBuiltInAttributeUsed("gl_VertexID", &mVertexIDAdded);
- return;
- case EvqPosition:
- recordBuiltInVaryingUsed("gl_Position", &mPositionAdded, mOutputVaryings);
- return;
- case EvqPointSize:
- recordBuiltInVaryingUsed("gl_PointSize", &mPointSizeAdded, mOutputVaryings);
- return;
- case EvqLastFragData:
- recordBuiltInVaryingUsed("gl_LastFragData", &mLastFragDataAdded, mInputVaryings);
- return;
- case EvqFragColor:
- recordBuiltInFragmentOutputUsed("gl_FragColor", &mFragColorAdded);
- return;
- case EvqFragData:
- if (!mFragDataAdded)
- {
- OutputVariable info;
- setBuiltInInfoFromSymbolTable("gl_FragData", &info);
- if (!IsExtensionEnabled(mExtensionBehavior, TExtension::EXT_draw_buffers))
- {
- ASSERT(info.arraySizes.size() == 1u);
- info.arraySizes.back() = 1u;
- }
- info.staticUse = true;
- mOutputVariables->push_back(info);
- mFragDataAdded = true;
- }
- return;
- case EvqFragDepthEXT:
- recordBuiltInFragmentOutputUsed("gl_FragDepthEXT", &mFragDepthEXTAdded);
- return;
- case EvqFragDepth:
- recordBuiltInFragmentOutputUsed("gl_FragDepth", &mFragDepthAdded);
- return;
- case EvqSecondaryFragColorEXT:
- recordBuiltInFragmentOutputUsed("gl_SecondaryFragColorEXT",
- &mSecondaryFragColorEXTAdded);
- return;
- case EvqSecondaryFragDataEXT:
- recordBuiltInFragmentOutputUsed("gl_SecondaryFragDataEXT",
- &mSecondaryFragDataEXTAdded);
- return;
- case EvqInvocationID:
- recordBuiltInVaryingUsed("gl_InvocationID", &mInvocationIDAdded, mInputVaryings);
- break;
- case EvqPrimitiveIDIn:
- recordBuiltInVaryingUsed("gl_PrimitiveIDIn", &mPrimitiveIDInAdded, mInputVaryings);
- break;
- case EvqPrimitiveID:
- if (mShaderType == GL_GEOMETRY_SHADER_OES)
- {
- recordBuiltInVaryingUsed("gl_PrimitiveID", &mPrimitiveIDAdded, mOutputVaryings);
- }
- else
- {
- ASSERT(mShaderType == GL_FRAGMENT_SHADER);
- recordBuiltInVaryingUsed("gl_PrimitiveID", &mPrimitiveIDAdded, mInputVaryings);
- }
- break;
- case EvqLayer:
- if (mShaderType == GL_GEOMETRY_SHADER_OES)
- {
- recordBuiltInVaryingUsed("gl_Layer", &mLayerAdded, mOutputVaryings);
- }
- else if (mShaderType == GL_FRAGMENT_SHADER)
- {
- recordBuiltInVaryingUsed("gl_Layer", &mLayerAdded, mInputVaryings);
- }
- else
- {
- ASSERT(mShaderType == GL_VERTEX_SHADER &&
- IsExtensionEnabled(mExtensionBehavior, TExtension::OVR_multiview));
- }
- break;
- default:
- break;
- }
- }
- if (var)
- {
- MarkStaticallyUsed(var);
- }
-}
-
-void CollectVariablesTraverser::setCommonVariableProperties(const TType &type,
- const TName &name,
- ShaderVariable *variableOut) const
-{
- ASSERT(variableOut);
-
- 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;
- variableOut->structName = structure->name().c_str();
-
- const TFieldList &fields = structure->fields();
-
- for (TField *field : fields)
- {
- // Regardless of the variable type (uniform, in/out etc.) its fields are always plain
- // ShaderVariable objects.
- ShaderVariable fieldVariable;
- setCommonVariableProperties(*field->type(), TName(field->name()), &fieldVariable);
- variableOut->fields.push_back(fieldVariable);
- }
- }
- variableOut->name = name.getString().c_str();
- variableOut->mappedName = getMappedName(name);
-
- if (auto *arraySizes = type.getArraySizes())
- {
- variableOut->arraySizes.assign(arraySizes->begin(), arraySizes->end());
- }
-}
-
-Attribute CollectVariablesTraverser::recordAttribute(const TIntermSymbol &variable) const
-{
- const TType &type = variable.getType();
- ASSERT(!type.getStruct());
-
- Attribute attribute;
- setCommonVariableProperties(type, variable.getName(), &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.getName(), &outputVariable);
-
- outputVariable.location = type.getLayoutQualifier().location;
- return outputVariable;
-}
-
-Varying CollectVariablesTraverser::recordVarying(const TIntermSymbol &variable) const
-{
- const TType &type = variable.getType();
-
- Varying varying;
- setCommonVariableProperties(type, variable.getName(), &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(std::string(variable.getSymbol().c_str())) ||
- type.isInvariant())
- {
- varying.isInvariant = true;
- }
- break;
- default:
- break;
- }
-
- varying.interpolation = GetInterpolationType(type.getQualifier());
- return varying;
-}
-
-// TODO(jiawei.shao@intel.com): implement GL_OES_shader_io_blocks.
-void CollectVariablesTraverser::recordInterfaceBlock(const TType &interfaceBlockType,
- InterfaceBlock *interfaceBlock) const
-{
- ASSERT(interfaceBlockType.getBasicType() == EbtInterfaceBlock);
- ASSERT(interfaceBlock);
-
- const TInterfaceBlock *blockType = interfaceBlockType.getInterfaceBlock();
- ASSERT(blockType);
-
- interfaceBlock->name = blockType->name().c_str();
- interfaceBlock->mappedName = getMappedName(TName(blockType->name()));
- interfaceBlock->instanceName =
- (blockType->hasInstanceName() ? blockType->instanceName().c_str() : "");
- 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)
- {
- interfaceBlock->isRowMajorLayout = (blockType->matrixPacking() == EmpRowMajor);
- interfaceBlock->binding = blockType->blockBinding();
- interfaceBlock->layout = GetBlockLayoutType(blockType->blockStorage());
- }
-
- // Gather field information
- for (const TField *field : blockType->fields())
- {
- const TType &fieldType = *field->type();
-
- InterfaceBlockField fieldVariable;
- setCommonVariableProperties(fieldType, TName(field->name()), &fieldVariable);
- fieldVariable.isRowMajorLayout =
- (fieldType.getLayoutQualifier().matrixPacking == EmpRowMajor);
- interfaceBlock->fields.push_back(fieldVariable);
- }
-}
-
-Uniform CollectVariablesTraverser::recordUniform(const TIntermSymbol &variable) const
-{
- Uniform uniform;
- setCommonVariableProperties(variable.getType(), variable.getName(), &uniform);
- uniform.binding = variable.getType().getLayoutQualifier().binding;
- uniform.location = variable.getType().getLayoutQualifier().location;
- uniform.offset = variable.getType().getLayoutQualifier().offset;
- 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.getName().isInternal())
- {
- // Internal variables are not collected.
- continue;
- }
-
- // TODO(jiawei.shao@intel.com): implement GL_OES_shader_io_blocks.
- if (typedNode.getBasicType() == EbtInterfaceBlock)
- {
- InterfaceBlock interfaceBlock;
- recordInterfaceBlock(variable.getType(), &interfaceBlock);
-
- switch (qualifier)
- {
- case EvqUniform:
- mUniformBlocks->push_back(interfaceBlock);
- break;
- case EvqBuffer:
- mShaderStorageBlocks->push_back(interfaceBlock);
- break;
- default:
- UNREACHABLE();
- }
- }
- else
- {
- 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_OES_shader_io_blocks.
-InterfaceBlock *CollectVariablesTraverser::findNamedInterfaceBlock(const TString &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 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);
- namedBlock->staticUse = true;
- unsigned int fieldIndex = static_cast<unsigned int>(constantUnion->getIConst(0));
- ASSERT(fieldIndex < namedBlock->fields.size());
- namedBlock->fields[fieldIndex].staticUse = 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,
- int shaderVersion,
- GLenum shaderType,
- const TExtensionBehavior &extensionBehavior)
-{
- CollectVariablesTraverser collect(attributes, outputVariables, uniforms, inputVaryings,
- outputVaryings, uniformBlocks, shaderStorageBlocks, inBlocks,
- hashFunction, symbolTable, shaderVersion, shaderType,
- extensionBehavior);
- root->traverse(&collect);
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/CollectVariables.h b/src/3rdparty/angle/src/compiler/translator/CollectVariables.h
deleted file mode 100644
index 4d0d1192e0..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/CollectVariables.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// 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,
- int shaderVersion,
- GLenum shaderType,
- const TExtensionBehavior &extensionBehavior);
-}
-
-#endif // COMPILER_TRANSLATOR_COLLECTVARIABLES_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/Common.h b/src/3rdparty/angle/src/compiler/translator/Common.h
deleted file mode 100644
index cb3a680d85..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Common.h
+++ /dev/null
@@ -1,138 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_TRANSLATOR_COMMON_H_
-#define COMPILER_TRANSLATOR_COMMON_H_
-
-#include <map>
-#include <sstream>
-#include <string>
-#include <unordered_map>
-#include <vector>
-#include <limits>
-#include <stdio.h>
-
-#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;
-inline TString *NewPoolTString(const char *s)
-{
- void *memory = GetGlobalPoolAllocator()->allocate(sizeof(TString));
- return new (memory) TString(s);
-}
-
-//
-// 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;
-}
-
-} // 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/src/3rdparty/angle/src/compiler/translator/Compiler.cpp b/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
deleted file mode 100644
index 2f411cb58c..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
+++ /dev/null
@@ -1,1169 +0,0 @@
-//
-// 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/AddAndTrueToLoopCondition.h"
-#include "compiler/translator/Cache.h"
-#include "compiler/translator/CallDAG.h"
-#include "compiler/translator/ClampPointSize.h"
-#include "compiler/translator/CollectVariables.h"
-#include "compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h"
-#include "compiler/translator/DeferGlobalInitializers.h"
-#include "compiler/translator/EmulateGLFragColorBroadcast.h"
-#include "compiler/translator/EmulatePrecision.h"
-#include "compiler/translator/Initialize.h"
-#include "compiler/translator/InitializeVariables.h"
-#include "compiler/translator/IntermNodePatternMatcher.h"
-#include "compiler/translator/IsASTDepthBelowLimit.h"
-#include "compiler/translator/OutputTree.h"
-#include "compiler/translator/ParseContext.h"
-#include "compiler/translator/PruneNoOps.h"
-#include "compiler/translator/RegenerateStructNames.h"
-#include "compiler/translator/RemoveArrayLengthMethod.h"
-#include "compiler/translator/RemoveEmptySwitchStatements.h"
-#include "compiler/translator/RemoveInvariantDeclaration.h"
-#include "compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h"
-#include "compiler/translator/RemovePow.h"
-#include "compiler/translator/RemoveUnreferencedVariables.h"
-#include "compiler/translator/RewriteDoWhile.h"
-#include "compiler/translator/ScalarizeVecAndMatConstructorArgs.h"
-#include "compiler/translator/SeparateDeclarations.h"
-#include "compiler/translator/SimplifyLoopConditions.h"
-#include "compiler/translator/SplitSequenceOperator.h"
-#include "compiler/translator/UnfoldShortCircuitAST.h"
-#include "compiler/translator/UseInterfaceBlockFields.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/VectorizeVectorScalarArithmetic.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;
- 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 IsWebGLBasedSpec(ShShaderSpec spec)
-{
- return (spec == SH_WEBGL_SPEC || spec == SH_WEBGL2_SPEC || spec == SH_WEBGL3_SPEC);
-}
-
-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 ((compileOptions & SH_DONT_REMOVE_INVARIANT_FOR_FRAGMENT_INPUT) == 0 &&
- 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_OES:
- return resources.MaxGeometryUniformComponents / 4;
- default:
- UNREACHABLE();
- return -1;
- }
-}
-
-namespace
-{
-
-class TScopedPoolAllocator
-{
- public:
- TScopedPoolAllocator(TPoolAllocator *allocator) : mAllocator(allocator)
- {
- mAllocator->push();
- SetGlobalPoolAllocator(mAllocator);
- }
- ~TScopedPoolAllocator()
- {
- SetGlobalPoolAllocator(nullptr);
- mAllocator->pop();
- }
-
- private:
- TPoolAllocator *mAllocator;
-};
-
-class TScopedSymbolTableLevel
-{
- public:
- TScopedSymbolTableLevel(TSymbolTable *table) : mTable(table)
- {
- ASSERT(mTable->atBuiltInLevel());
- mTable->push();
- }
- ~TScopedSymbolTableLevel()
- {
- while (!mTable->atBuiltInLevel())
- 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;
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-} // namespace
-
-TShHandleBase::TShHandleBase()
-{
- allocator.push();
- SetGlobalPoolAllocator(&allocator);
-}
-
-TShHandleBase::~TShHandleBase()
-{
- SetGlobalPoolAllocator(nullptr);
- allocator.popAll();
-}
-
-TCompiler::TCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
- : variablesCollected(false),
- mGLPositionInitialized(false),
- shaderType(type),
- shaderSpec(spec),
- outputType(output),
- maxUniformVectors(0),
- maxExpressionComplexity(0),
- maxCallStackDepth(0),
- maxFunctionParameters(0),
- fragmentPrecisionHigh(false),
- clampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC),
- builtInFunctionEmulator(),
- mDiagnostics(infoSink.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(shaderSpec) && shaderVersion == 100) ||
- (compileOptions & SH_VALIDATE_LOOP_INDEXING);
-}
-
-bool TCompiler::Init(const ShBuiltInResources &resources)
-{
- shaderVersion = 100;
-
- maxUniformVectors = GetMaxUniformVectorsForShaderType(shaderType, resources);
-
- maxExpressionComplexity = resources.MaxExpressionComplexity;
- maxCallStackDepth = resources.MaxCallStackDepth;
- maxFunctionParameters = resources.MaxFunctionParameters;
-
- SetGlobalPoolAllocator(&allocator);
-
- // Generate built-in symbol table.
- if (!InitBuiltInSymbolTable(resources))
- return false;
- InitExtensionBehavior(resources, extensionBehavior);
- fragmentPrecisionHigh = resources.FragmentPrecisionHigh == 1;
-
- arrayBoundsClamper.SetClampingStrategy(resources.ArrayIndexClampingStrategy);
- clampingStrategy = resources.ArrayIndexClampingStrategy;
-
- hashFunction = resources.HashFunction;
-
- 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(extensionBehavior);
-
- // 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(symbolTable, extensionBehavior, shaderType, shaderSpec,
- compileOptions, true, &mDiagnostics, getResources());
-
- parseContext.setFragmentPrecisionHighOnESSL1(fragmentPrecisionHigh);
-
- // We preserve symbols at the built-in level from compile-to-compile.
- // Start pushing the user-defined symbols at global level.
- TScopedSymbolTableLevel scopedSymbolLevel(&symbolTable);
-
- // Parse shader.
- if (PaParseStrings(numStrings - firstSource, &shaderStrings[firstSource], nullptr,
- &parseContext) != 0)
- {
- return nullptr;
- }
-
- if (parseContext.getTreeRoot() == nullptr)
- {
- return nullptr;
- }
-
- setASTMetadata(parseContext);
-
- if (MapSpecToShaderVersion(shaderSpec) < shaderVersion)
- {
- mDiagnostics.globalError("unsupported shader version");
- return nullptr;
- }
-
- TIntermBlock *root = parseContext.getTreeRoot();
- if (!checkAndSimplifyAST(root, parseContext, compileOptions))
- {
- return nullptr;
- }
-
- return root;
-}
-
-void TCompiler::setASTMetadata(const TParseContext &parseContext)
-{
- shaderVersion = parseContext.getShaderVersion();
-
- mPragma = parseContext.pragma();
- symbolTable.setGlobalInvariant(mPragma.stdgl.invariantAll);
-
- mComputeShaderLocalSizeDeclared = parseContext.isComputeShaderLocalSizeDeclared();
- mComputeShaderLocalSize = parseContext.getComputeShaderLocalSize();
-
- mNumViews = parseContext.getNumViews();
-
- // Highp might have been auto-enabled based on shader version
- fragmentPrecisionHigh = parseContext.getFragmentPrecisionHigh();
-
- if (shaderType == GL_GEOMETRY_SHADER_OES)
- {
- 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;
- }
-
- // 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);
-
- // 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 may have left switch
- // statements that only contained an empty declaration inside the final case in an invalid
- // state. Relies on that PruneNoOps has already been run.
- RemoveNoOpCasesFromEndOfSwitchStatements(root, &symbolTable);
-
- // Remove empty switch statements - this makes output simpler.
- RemoveEmptySwitchStatements(root);
-
- // 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
- functionMetadata.clear();
- functionMetadata.resize(mCallDag.size());
- if (!tagUsedFunctions())
- {
- return false;
- }
-
- if (!(compileOptions & SH_DONT_PRUNE_UNUSED_FUNCTIONS))
- {
- pruneUnusedFunctions(root);
- }
-
- if (shaderVersion >= 310 && !ValidateVaryingLocations(root, &mDiagnostics, shaderType))
- {
- return false;
- }
-
- if (shaderVersion >= 300 && shaderType == GL_FRAGMENT_SHADER &&
- !ValidateOutputs(root, getExtensionBehavior(), compileResources.MaxDrawBuffers,
- &mDiagnostics))
- {
- return false;
- }
-
- if (shouldRunLoopAndIndexingValidation(compileOptions) &&
- !ValidateLimitations(root, shaderType, &symbolTable, shaderVersion, &mDiagnostics))
- {
- return false;
- }
-
- // Fail compilation if precision emulation not supported.
- if (getResources().WEBGL_debug_shader_precision && getPragma().debugShaderPrecision &&
- !EmulatePrecision::SupportedInLanguage(outputType))
- {
- 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)
- {
- arrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root);
- }
-
- if ((compileOptions & SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW) &&
- parseContext.isExtensionEnabled(TExtension::OVR_multiview) &&
- getShaderType() != GL_COMPUTE_SHADER)
- {
- DeclareAndInitBuiltinsForInstancedMultiview(root, mNumViews, shaderType, compileOptions,
- outputType, &symbolTable);
- }
-
- // This pass might emit short circuits so keep it before the short circuit unfolding
- if (compileOptions & SH_REWRITE_DO_WHILE_LOOPS)
- RewriteDoWhile(root, &symbolTable);
-
- if (compileOptions & SH_ADD_AND_TRUE_TO_LOOP_CONDITION)
- sh::AddAndTrueToLoopCondition(root);
-
- if (compileOptions & SH_UNFOLD_SHORT_CIRCUIT)
- {
- UnfoldShortCircuitAST unfoldShortCircuit;
- root->traverse(&unfoldShortCircuit);
- unfoldShortCircuit.updateTree();
- }
-
- if (compileOptions & SH_REMOVE_POW_WITH_CONSTANT_EXPONENT)
- {
- RemovePow(root);
- }
-
- if (compileOptions & SH_REGENERATE_STRUCT_NAMES)
- {
- RegenerateStructNames gen(&symbolTable, shaderVersion);
- root->traverse(&gen);
- }
-
- if (shaderType == GL_FRAGMENT_SHADER && shaderVersion == 100 &&
- compileResources.EXT_draw_buffers && compileResources.MaxDrawBuffers > 1 &&
- IsExtensionEnabled(extensionBehavior, TExtension::EXT_draw_buffers))
- {
- EmulateGLFragColorBroadcast(root, compileResources.MaxDrawBuffers, &outputVariables,
- &symbolTable, shaderVersion);
- }
-
- // 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,
- &getSymbolTable(), getShaderVersion());
-
- // Note that separate declarations need to be run before other AST transformations that
- // generate new statements from expressions.
- SeparateDeclarations(root);
-
- SplitSequenceOperator(root, IntermNodePatternMatcher::kArrayLengthMethod, &getSymbolTable(),
- getShaderVersion());
-
- RemoveArrayLengthMethod(root);
-
- RemoveUnreferencedVariables(root, &symbolTable);
-
- // Built-in function emulation needs to happen after validateLimitations pass.
- // TODO(jmadill): Remove global pool allocator.
- GetGlobalPoolAllocator()->lock();
- initBuiltInFunctionEmulator(&builtInFunctionEmulator, compileOptions);
- GetGlobalPoolAllocator()->unlock();
- builtInFunctionEmulator.markBuiltInFunctionsForEmulation(root);
-
- if (compileOptions & SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS)
- {
- ScalarizeVecAndMatConstructorArgs(root, shaderType, fragmentPrecisionHigh, &symbolTable);
- }
-
- if (shouldCollectVariables(compileOptions))
- {
- ASSERT(!variablesCollected);
- CollectVariables(root, &attributes, &outputVariables, &uniforms, &inputVaryings,
- &outputVaryings, &uniformBlocks, &shaderStorageBlocks, &inBlocks,
- hashFunction, &symbolTable, shaderVersion, shaderType, extensionBehavior);
- collectInterfaceBlocks();
- variablesCollected = true;
- if (compileOptions & SH_USE_UNUSED_STANDARD_SHARED_BLOCKS)
- {
- useAllMembersInUnusedStandardAndSharedBlocks(root);
- }
- if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS)
- {
- // 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, uniforms))
- {
- mDiagnostics.globalError("too many uniforms");
- return false;
- }
- }
- if (compileOptions & SH_INIT_OUTPUT_VARIABLES)
- {
- initializeOutputVariables(root);
- }
- }
-
- // Removing invariant declarations must be done after collecting variables.
- // Otherwise, built-in invariant declarations don't apply.
- if (RemoveInvariant(shaderType, shaderVersion, outputType, compileOptions))
- {
- RemoveInvariantDeclaration(root);
- }
-
- // 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 (shaderType == GL_VERTEX_SHADER && !mGLPositionInitialized &&
- ((compileOptions & SH_INIT_GL_POSITION) || (outputType == SH_GLSL_COMPATIBILITY_OUTPUT)))
- {
- initializeGLPosition(root);
- mGLPositionInitialized = true;
- }
-
- // 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, &symbolTable);
-
- 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(), getShaderVersion());
- }
-
- InitializeUninitializedLocals(root, getShaderVersion(), canUseLoopsToInitialize,
- &getSymbolTable());
- }
-
- if (getShaderType() == GL_VERTEX_SHADER && (compileOptions & SH_CLAMP_POINT_SIZE))
- {
- ClampPointSize(root, compileResources.MaxPointSize, &getSymbolTable());
- }
-
- if (compileOptions & SH_REWRITE_VECTOR_SCALAR_ARITHMETIC)
- {
- VectorizeVectorScalarArithmetic(root, &getSymbolTable());
- }
-
- return true;
-}
-
-bool TCompiler::compile(const char *const shaderStrings[],
- size_t numStrings,
- ShCompileOptions compileOptionsIn)
-{
-#if defined(ANGLE_ENABLE_FUZZER_CORPUS_OUTPUT)
- DumpFuzzerCase(shaderStrings, numStrings, shaderType, shaderSpec, outputType, 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, infoSink.info);
-
- if (compileOptions & SH_OBJECT_CODE)
- {
- PerformanceDiagnostics perfDiagnostics(&mDiagnostics);
- translate(root, compileOptions, &perfDiagnostics);
- }
-
- // 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;
- }
-
- compileResources = resources;
- setResourceString();
-
- ASSERT(symbolTable.isEmpty());
- symbolTable.push(); // COMMON_BUILTINS
- symbolTable.push(); // ESSL1_BUILTINS
- symbolTable.push(); // ESSL3_BUILTINS
- symbolTable.push(); // ESSL3_1_BUILTINS
- symbolTable.push(); // GLSL_BUILTINS
-
- switch (shaderType)
- {
- case GL_FRAGMENT_SHADER:
- symbolTable.setDefaultPrecision(EbtInt, EbpMedium);
- break;
- case GL_VERTEX_SHADER:
- case GL_COMPUTE_SHADER:
- case GL_GEOMETRY_SHADER_OES:
- symbolTable.setDefaultPrecision(EbtInt, EbpHigh);
- symbolTable.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);
-
- symbolTable.setDefaultPrecision(EbtAtomicCounter, EbpHigh);
-
- InsertBuiltInFunctions(shaderType, shaderSpec, resources, symbolTable);
-
- IdentifyBuiltIns(shaderType, shaderSpec, resources, symbolTable);
-
- return true;
-}
-
-void TCompiler::initSamplerDefaultPrecision(TBasicType samplerType)
-{
- ASSERT(samplerType > EbtGuardSamplerBegin && samplerType < EbtGuardSamplerEnd);
- symbolTable.setDefaultPrecision(samplerType, EbpLow);
-}
-
-void TCompiler::setResourceString()
-{
- std::ostringstream strstream;
-
- // clang-format off
- strstream << ":MaxVertexAttribs:" << compileResources.MaxVertexAttribs
- << ":MaxVertexUniformVectors:" << compileResources.MaxVertexUniformVectors
- << ":MaxVaryingVectors:" << compileResources.MaxVaryingVectors
- << ":MaxVertexTextureImageUnits:" << compileResources.MaxVertexTextureImageUnits
- << ":MaxCombinedTextureImageUnits:" << compileResources.MaxCombinedTextureImageUnits
- << ":MaxTextureImageUnits:" << compileResources.MaxTextureImageUnits
- << ":MaxFragmentUniformVectors:" << compileResources.MaxFragmentUniformVectors
- << ":MaxDrawBuffers:" << compileResources.MaxDrawBuffers
- << ":OES_standard_derivatives:" << compileResources.OES_standard_derivatives
- << ":OES_EGL_image_external:" << compileResources.OES_EGL_image_external
- << ":OES_EGL_image_external_essl3:" << compileResources.OES_EGL_image_external_essl3
- << ":NV_EGL_stream_consumer_external:" << compileResources.NV_EGL_stream_consumer_external
- << ":ARB_texture_rectangle:" << compileResources.ARB_texture_rectangle
- << ":EXT_draw_buffers:" << compileResources.EXT_draw_buffers
- << ":FragmentPrecisionHigh:" << compileResources.FragmentPrecisionHigh
- << ":MaxExpressionComplexity:" << compileResources.MaxExpressionComplexity
- << ":MaxCallStackDepth:" << compileResources.MaxCallStackDepth
- << ":MaxFunctionParameters:" << compileResources.MaxFunctionParameters
- << ":EXT_blend_func_extended:" << compileResources.EXT_blend_func_extended
- << ":EXT_frag_depth:" << compileResources.EXT_frag_depth
- << ":EXT_shader_texture_lod:" << compileResources.EXT_shader_texture_lod
- << ":EXT_shader_framebuffer_fetch:" << compileResources.EXT_shader_framebuffer_fetch
- << ":NV_shader_framebuffer_fetch:" << compileResources.NV_shader_framebuffer_fetch
- << ":ARM_shader_framebuffer_fetch:" << compileResources.ARM_shader_framebuffer_fetch
- << ":OVR_multiview:" << compileResources.OVR_multiview
- << ":EXT_YUV_target:" << compileResources.EXT_YUV_target
- << ":OES_geometry_shader:" << compileResources.OES_geometry_shader
- << ":MaxVertexOutputVectors:" << compileResources.MaxVertexOutputVectors
- << ":MaxFragmentInputVectors:" << compileResources.MaxFragmentInputVectors
- << ":MinProgramTexelOffset:" << compileResources.MinProgramTexelOffset
- << ":MaxProgramTexelOffset:" << compileResources.MaxProgramTexelOffset
- << ":MaxDualSourceDrawBuffers:" << compileResources.MaxDualSourceDrawBuffers
- << ":MaxViewsOVR:" << compileResources.MaxViewsOVR
- << ":NV_draw_buffers:" << compileResources.NV_draw_buffers
- << ":WEBGL_debug_shader_precision:" << compileResources.WEBGL_debug_shader_precision
- << ":MinProgramTextureGatherOffset:" << compileResources.MinProgramTextureGatherOffset
- << ":MaxProgramTextureGatherOffset:" << compileResources.MaxProgramTextureGatherOffset
- << ":MaxImageUnits:" << compileResources.MaxImageUnits
- << ":MaxVertexImageUniforms:" << compileResources.MaxVertexImageUniforms
- << ":MaxFragmentImageUniforms:" << compileResources.MaxFragmentImageUniforms
- << ":MaxComputeImageUniforms:" << compileResources.MaxComputeImageUniforms
- << ":MaxCombinedImageUniforms:" << compileResources.MaxCombinedImageUniforms
- << ":MaxCombinedShaderOutputResources:" << compileResources.MaxCombinedShaderOutputResources
- << ":MaxComputeWorkGroupCountX:" << compileResources.MaxComputeWorkGroupCount[0]
- << ":MaxComputeWorkGroupCountY:" << compileResources.MaxComputeWorkGroupCount[1]
- << ":MaxComputeWorkGroupCountZ:" << compileResources.MaxComputeWorkGroupCount[2]
- << ":MaxComputeWorkGroupSizeX:" << compileResources.MaxComputeWorkGroupSize[0]
- << ":MaxComputeWorkGroupSizeY:" << compileResources.MaxComputeWorkGroupSize[1]
- << ":MaxComputeWorkGroupSizeZ:" << compileResources.MaxComputeWorkGroupSize[2]
- << ":MaxComputeUniformComponents:" << compileResources.MaxComputeUniformComponents
- << ":MaxComputeTextureImageUnits:" << compileResources.MaxComputeTextureImageUnits
- << ":MaxComputeAtomicCounters:" << compileResources.MaxComputeAtomicCounters
- << ":MaxComputeAtomicCounterBuffers:" << compileResources.MaxComputeAtomicCounterBuffers
- << ":MaxVertexAtomicCounters:" << compileResources.MaxVertexAtomicCounters
- << ":MaxFragmentAtomicCounters:" << compileResources.MaxFragmentAtomicCounters
- << ":MaxCombinedAtomicCounters:" << compileResources.MaxCombinedAtomicCounters
- << ":MaxAtomicCounterBindings:" << compileResources.MaxAtomicCounterBindings
- << ":MaxVertexAtomicCounterBuffers:" << compileResources.MaxVertexAtomicCounterBuffers
- << ":MaxFragmentAtomicCounterBuffers:" << compileResources.MaxFragmentAtomicCounterBuffers
- << ":MaxCombinedAtomicCounterBuffers:" << compileResources.MaxCombinedAtomicCounterBuffers
- << ":MaxAtomicCounterBufferSize:" << compileResources.MaxAtomicCounterBufferSize
- << ":MaxGeometryUniformComponents:" << compileResources.MaxGeometryUniformComponents
- << ":MaxGeometryUniformBlocks:" << compileResources.MaxGeometryUniformBlocks
- << ":MaxGeometryInputComponents:" << compileResources.MaxGeometryInputComponents
- << ":MaxGeometryOutputComponents:" << compileResources.MaxGeometryOutputComponents
- << ":MaxGeometryOutputVertices:" << compileResources.MaxGeometryOutputVertices
- << ":MaxGeometryTotalOutputComponents:" << compileResources.MaxGeometryTotalOutputComponents
- << ":MaxGeometryTextureImageUnits:" << compileResources.MaxGeometryTextureImageUnits
- << ":MaxGeometryAtomicCounterBuffers:" << compileResources.MaxGeometryAtomicCounterBuffers
- << ":MaxGeometryAtomicCounters:" << compileResources.MaxGeometryAtomicCounters
- << ":MaxGeometryShaderStorageBlocks:" << compileResources.MaxGeometryShaderStorageBlocks
- << ":MaxGeometryShaderInvocations:" << compileResources.MaxGeometryShaderInvocations
- << ":MaxGeometryImageUniforms:" << compileResources.MaxGeometryImageUniforms;
- // clang-format on
-
- builtInResourcesString = strstream.str();
-}
-
-void TCompiler::collectInterfaceBlocks()
-{
- ASSERT(interfaceBlocks.empty());
- interfaceBlocks.reserve(uniformBlocks.size() + shaderStorageBlocks.size() + inBlocks.size());
- interfaceBlocks.insert(interfaceBlocks.end(), uniformBlocks.begin(), uniformBlocks.end());
- interfaceBlocks.insert(interfaceBlocks.end(), shaderStorageBlocks.begin(),
- shaderStorageBlocks.end());
- interfaceBlocks.insert(interfaceBlocks.end(), inBlocks.begin(), inBlocks.end());
-}
-
-void TCompiler::clearResults()
-{
- arrayBoundsClamper.Cleanup();
- infoSink.info.erase();
- infoSink.obj.erase();
- infoSink.debug.erase();
- mDiagnostics.resetErrorCount();
-
- attributes.clear();
- outputVariables.clear();
- uniforms.clear();
- inputVaryings.clear();
- outputVaryings.clear();
- interfaceBlocks.clear();
- uniformBlocks.clear();
- shaderStorageBlocks.clear();
- inBlocks.clear();
- variablesCollected = false;
- mGLPositionInitialized = false;
-
- mNumViews = -1;
-
- mGeometryShaderInputPrimitiveType = EptUndefined;
- mGeometryShaderOutputPrimitiveType = EptUndefined;
- mGeometryShaderInvocations = 0;
- mGeometryShaderMaxVertices = -1;
-
- builtInFunctionEmulator.cleanup();
-
- nameMap.clear();
-
- mSourcePath = nullptr;
-}
-
-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;
- auto &record = mCallDag.getRecordFromIndex(i);
-
- for (auto &calleeIndex : record.callees)
- {
- depth = std::max(depth, depths[calleeIndex] + 1);
- }
-
- depths[i] = depth;
-
- if (depth >= maxCallStackDepth)
- {
- // Trace back the function chain to have a meaningful info log.
- std::stringstream errorStream;
- errorStream << "Call stack too deep (larger than " << maxCallStackDepth
- << ") with the following call chain: " << record.name;
-
- int currentFunction = static_cast<int>(i);
- int currentDepth = depth;
-
- while (currentFunction != -1)
- {
- errorStream << " -> " << mCallDag.getRecordFromIndex(currentFunction).name;
-
- int nextFunction = -1;
- for (auto &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).name == "main")
- {
- internalTagUsedFunction(i);
- return true;
- }
- }
-
- mDiagnostics.globalError("Missing main()");
- return false;
-}
-
-void TCompiler::internalTagUsedFunction(size_t index)
-{
- if (functionMetadata[index].used)
- {
- return;
- }
-
- functionMetadata[index].used = true;
-
- for (int calleeIndex : mCallDag.getRecordFromIndex(index).callees)
- {
- internalTagUsedFunction(calleeIndex);
- }
-}
-
-// A predicate for the stl that returns if a top-level node is unused
-class TCompiler::UnusedPredicate
-{
- public:
- UnusedPredicate(const CallDAG *callDag, const std::vector<FunctionMetadata> *metadatas)
- : mCallDag(callDag), mMetadatas(metadatas)
- {
- }
-
- bool operator()(TIntermNode *node)
- {
- const TIntermFunctionPrototype *asFunctionPrototype = node->getAsFunctionPrototypeNode();
- const TIntermFunctionDefinition *asFunctionDefinition = node->getAsFunctionDefinition();
-
- const TFunctionSymbolInfo *functionInfo = nullptr;
-
- if (asFunctionDefinition)
- {
- functionInfo = asFunctionDefinition->getFunctionSymbolInfo();
- }
- else if (asFunctionPrototype)
- {
- functionInfo = asFunctionPrototype->getFunctionSymbolInfo();
- }
- if (functionInfo == nullptr)
- {
- return false;
- }
-
- size_t callDagIndex = mCallDag->findIndex(functionInfo);
- 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, &functionMetadata);
- 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, maxExpressionComplexity))
- {
- mDiagnostics.globalError("Expression too complex.");
- return false;
- }
-
- if (!ValidateMaxParameters(root, 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 variablesCollected;
-}
-
-void TCompiler::initializeGLPosition(TIntermBlock *root)
-{
- InitVariableList list;
- sh::ShaderVariable var(GL_FLOAT_VEC4);
- var.name = "gl_Position";
- list.push_back(var);
- InitializeVariables(root, list, &symbolTable, shaderVersion, extensionBehavior, false);
-}
-
-void TCompiler::useAllMembersInUnusedStandardAndSharedBlocks(TIntermBlock *root)
-{
- sh::InterfaceBlockList list;
-
- for (auto block : uniformBlocks)
- {
- if (!block.staticUse &&
- (block.layout == sh::BLOCKLAYOUT_STD140 || block.layout == sh::BLOCKLAYOUT_SHARED))
- {
- list.push_back(block);
- }
- }
-
- sh::UseInterfaceBlockFields(root, list, symbolTable);
-}
-
-void TCompiler::initializeOutputVariables(TIntermBlock *root)
-{
- InitVariableList list;
- if (shaderType == GL_VERTEX_SHADER || shaderType == GL_GEOMETRY_SHADER_OES)
- {
- for (auto var : outputVaryings)
- {
- list.push_back(var);
- if (var.name == "gl_Position")
- {
- ASSERT(!mGLPositionInitialized);
- mGLPositionInitialized = true;
- }
- }
- }
- else
- {
- ASSERT(shaderType == GL_FRAGMENT_SHADER);
- for (auto var : outputVariables)
- {
- list.push_back(var);
- }
- }
- InitializeVariables(root, list, &symbolTable, shaderVersion, extensionBehavior, false);
-}
-
-const TExtensionBehavior &TCompiler::getExtensionBehavior() const
-{
- return extensionBehavior;
-}
-
-const char *TCompiler::getSourcePath() const
-{
- return mSourcePath;
-}
-
-const ShBuiltInResources &TCompiler::getResources() const
-{
- return compileResources;
-}
-
-const ArrayBoundsClamper &TCompiler::getArrayBoundsClamper() const
-{
- return arrayBoundsClamper;
-}
-
-ShArrayIndexClampingStrategy TCompiler::getArrayIndexClampingStrategy() const
-{
- return clampingStrategy;
-}
-
-const BuiltInFunctionEmulator &TCompiler::getBuiltInFunctionEmulator() const
-{
- return builtInFunctionEmulator;
-}
-
-void TCompiler::writePragma(ShCompileOptions compileOptions)
-{
- if (!(compileOptions & SH_FLATTEN_PRAGMA_STDGL_INVARIANT_ALL))
- {
- TInfoSinkBase &sink = infoSink.obj;
- if (mPragma.stdgl.invariantAll)
- sink << "#pragma STDGL invariant(all)\n";
- }
-}
-
-bool TCompiler::isVaryingDefined(const char *varyingName)
-{
- ASSERT(variablesCollected);
- for (size_t ii = 0; ii < inputVaryings.size(); ++ii)
- {
- if (inputVaryings[ii].name == varyingName)
- {
- return true;
- }
- }
- for (size_t ii = 0; ii < outputVaryings.size(); ++ii)
- {
- if (outputVaryings[ii].name == varyingName)
- {
- return true;
- }
- }
-
- return false;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/Compiler.h b/src/3rdparty/angle/src/compiler/translator/Compiler.h
deleted file mode 100644
index 753cfb8e7b..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Compiler.h
+++ /dev/null
@@ -1,308 +0,0 @@
-//
-// 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 "third_party/compiler/ArrayBoundsClamper.h"
-
-namespace sh
-{
-
-class TCompiler;
-class TParseContext;
-#ifdef ANGLE_ENABLE_HLSL
-class TranslatorHLSL;
-#endif // ANGLE_ENABLE_HLSL
-
-//
-// Helper function to identify specs that are based on the WebGL spec.
-//
-bool IsWebGLBasedSpec(ShShaderSpec spec);
-
-//
-// 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.
- TPoolAllocator allocator;
-};
-
-//
-// The base class for the machine dependent compiler to derive from
-// for managing object code from the compile.
-//
-class TCompiler : public TShHandleBase
-{
- public:
- TCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
- ~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 shaderVersion; }
- TInfoSink &getInfoSink() { return infoSink; }
-
- 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 attributes; }
- const std::vector<sh::OutputVariable> &getOutputVariables() const { return outputVariables; }
- const std::vector<sh::Uniform> &getUniforms() const { return uniforms; }
- const std::vector<sh::Varying> &getInputVaryings() const { return inputVaryings; }
- const std::vector<sh::Varying> &getOutputVaryings() const { return outputVaryings; }
- const std::vector<sh::InterfaceBlock> &getInterfaceBlocks() const { return interfaceBlocks; }
- const std::vector<sh::InterfaceBlock> &getUniformBlocks() const { return uniformBlocks; }
- const std::vector<sh::InterfaceBlock> &getShaderStorageBlocks() const
- {
- return shaderStorageBlocks;
- }
- const std::vector<sh::InterfaceBlock> &getInBlocks() const { return inBlocks; }
-
- ShHashFunction64 getHashFunction() const { return hashFunction; }
- NameMap &getNameMap() { return nameMap; }
- TSymbolTable &getSymbolTable() { return symbolTable; }
- ShShaderSpec getShaderSpec() const { return shaderSpec; }
- ShShaderOutput getOutputType() const { return outputType; }
- const std::string &getBuiltInResourcesString() const { return builtInResourcesString; }
-
- 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 shaderType; }
-
- protected:
- // 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();
- // 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;
- // 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);
- // 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> attributes;
- std::vector<sh::OutputVariable> outputVariables;
- std::vector<sh::Uniform> uniforms;
- std::vector<sh::Varying> inputVaryings;
- std::vector<sh::Varying> outputVaryings;
- std::vector<sh::InterfaceBlock> interfaceBlocks;
- std::vector<sh::InterfaceBlock> uniformBlocks;
- std::vector<sh::InterfaceBlock> shaderStorageBlocks;
- std::vector<sh::InterfaceBlock> inBlocks;
-
- private:
- // 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 initSamplerDefaultPrecision(TBasicType samplerType);
-
- void collectInterfaceBlocks();
-
- bool variablesCollected;
-
- 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);
-
- // 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 shaderType;
- ShShaderSpec shaderSpec;
- ShShaderOutput outputType;
-
- struct FunctionMetadata
- {
- FunctionMetadata() : used(false) {}
- bool used;
- };
-
- CallDAG mCallDag;
- std::vector<FunctionMetadata> functionMetadata;
-
- int maxUniformVectors;
- int maxExpressionComplexity;
- int maxCallStackDepth;
- int maxFunctionParameters;
-
- ShBuiltInResources compileResources;
- std::string builtInResourcesString;
-
- // Built-in symbol table for the given language, spec, and resources.
- // It is preserved from compile-to-compile.
- TSymbolTable symbolTable;
- // Built-in extensions with default behavior.
- TExtensionBehavior extensionBehavior;
- bool fragmentPrecisionHigh;
-
- ArrayBoundsClamper arrayBoundsClamper;
- ShArrayIndexClampingStrategy clampingStrategy;
- BuiltInFunctionEmulator builtInFunctionEmulator;
-
- // Results of compilation.
- int shaderVersion;
- TInfoSink infoSink; // Output sink.
- 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.
- ShHashFunction64 hashFunction;
- NameMap nameMap;
-
- TPragma mPragma;
-};
-
-//
-// This is the interface between the machine independent code
-// and the machine dependent code.
-//
-// The machine dependent code should derive from the classes
-// above. Then Construct*() and Delete*() will create and
-// destroy the machine dependent objects, which contain the
-// above machine independent information.
-//
-TCompiler *ConstructCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
-void DeleteCompiler(TCompiler *);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_COMPILER_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/ConstantUnion.cpp b/src/3rdparty/angle/src/compiler/translator/ConstantUnion.cpp
deleted file mode 100644
index 7004aedee3..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ConstantUnion.cpp
+++ /dev/null
@@ -1,681 +0,0 @@
-//
-// 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"
-
-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
-{
- 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:
- 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
-{
- return i == iConst;
-}
-
-bool TConstantUnion::operator==(const unsigned int u) const
-{
- return u == uConst;
-}
-
-bool TConstantUnion::operator==(const float f) const
-{
- 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
-{
- if (constant.type != type)
- return false;
-
- 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;
- }
-}
-
-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
-{
- ASSERT(type == constant.type);
- 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
- }
-}
-
-bool TConstantUnion::operator<(const TConstantUnion &constant) const
-{
- ASSERT(type == constant.type);
- 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
- }
-}
-
-// static
-TConstantUnion TConstantUnion::add(const TConstantUnion &lhs,
- const TConstantUnion &rhs,
- TDiagnostics *diag,
- const TSourceLoc &line)
-{
- TConstantUnion returnValue;
- ASSERT(lhs.type == rhs.type);
- 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();
- }
-
- return returnValue;
-}
-
-// static
-TConstantUnion TConstantUnion::sub(const TConstantUnion &lhs,
- const TConstantUnion &rhs,
- TDiagnostics *diag,
- const TSourceLoc &line)
-{
- TConstantUnion returnValue;
- ASSERT(lhs.type == rhs.type);
- 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();
- }
-
- return returnValue;
-}
-
-// static
-TConstantUnion TConstantUnion::mul(const TConstantUnion &lhs,
- const TConstantUnion &rhs,
- TDiagnostics *diag,
- const TSourceLoc &line)
-{
- TConstantUnion returnValue;
- ASSERT(lhs.type == rhs.type);
- 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();
- }
-
- 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/src/3rdparty/angle/src/compiler/translator/ConstantUnion.h b/src/3rdparty/angle/src/compiler/translator/ConstantUnion.h
deleted file mode 100644
index c1b3db9070..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ConstantUnion.h
+++ /dev/null
@@ -1,117 +0,0 @@
-//
-// 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/Common.h"
-#include "compiler/translator/BaseTypes.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/src/3rdparty/angle/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.cpp b/src/3rdparty/angle/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.cpp
deleted file mode 100644
index ce9828f1f9..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-//
-// 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/DeclareAndInitBuiltinsForInstancedMultiview.h"
-
-#include "compiler/translator/FindMain.h"
-#include "compiler/translator/InitializeVariables.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.h"
-#include "compiler/translator/util.h"
-
-namespace sh
-{
-
-namespace
-{
-
-class ReplaceVariableTraverser : public TIntermTraverser
-{
- public:
- ReplaceVariableTraverser(const TString &symbolName, TIntermSymbol *newSymbol)
- : TIntermTraverser(true, false, false), mSymbolName(symbolName), mNewSymbol(newSymbol)
- {
- }
-
- void visitSymbol(TIntermSymbol *node) override
- {
- TName &name = node->getName();
- if (name.getString() == mSymbolName)
- {
- queueReplacement(mNewSymbol->deepCopy(), OriginalNode::IS_DROPPED);
- }
- }
-
- private:
- TString mSymbolName;
- TIntermSymbol *mNewSymbol;
-};
-
-TIntermSymbol *CreateGLInstanceIDSymbol(const TSymbolTable &symbolTable)
-{
- return ReferenceBuiltInVariable("gl_InstanceID", symbolTable, 300);
-}
-
-// Adds the InstanceID and ViewID_OVR initializers to the end of the initializers' sequence.
-void InitializeViewIDAndInstanceID(TIntermTyped *viewIDSymbol,
- TIntermTyped *instanceIDSymbol,
- 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(CreateGLInstanceIDSymbol(symbolTable));
- 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, instanceIDSymbol->deepCopy(), 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, viewIDSymbol->deepCopy(), normalizedViewID);
- initializers->push_back(viewIDInitializer);
-}
-
-// Replaces every occurrence of a symbol with the name specified in symbolName with newSymbolNode.
-void ReplaceSymbol(TIntermBlock *root, const TString &symbolName, TIntermSymbol *newSymbolNode)
-{
- ReplaceVariableTraverser traverser(symbolName, newSymbolNode);
- root->traverse(&traverser);
- traverser.updateTree();
-}
-
-void DeclareGlobalVariable(TIntermBlock *root, TIntermTyped *typedNode)
-{
- TIntermSequence *globalSequence = root->getSequence();
- TIntermDeclaration *declaration = new TIntermDeclaration();
- declaration->appendDeclarator(typedNode->deepCopy());
- globalSequence->insert(globalSequence->begin(), declaration);
-}
-
-// 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(TIntermTyped *viewIDSymbol,
- TIntermTyped *multiviewBaseViewLayerIndexSymbol,
- TIntermSequence *initializers,
- const TSymbolTable &symbolTable)
-{
- // Create an int(ViewID_OVR) node.
- TIntermSequence *viewIDSymbolCastArguments = new TIntermSequence();
- viewIDSymbolCastArguments->push_back(viewIDSymbol);
- TIntermAggregate *viewIDAsInt = TIntermAggregate::CreateConstructor(
- TType(EbtInt, EbpHigh, EvqTemporary), viewIDSymbolCastArguments);
-
- // Create a gl_ViewportIndex node.
- TIntermSymbol *viewportIndexSymbol =
- ReferenceBuiltInVariable("gl_ViewportIndex", symbolTable, 0);
-
- // 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 = ReferenceBuiltInVariable("gl_Layer", symbolTable, 0);
-
- // Create an int(ViewID_OVR) + multiviewBaseViewLayerIndex node
- TIntermBinary *sumOfViewIDAndBaseViewIndex =
- new TIntermBinary(EOpAdd, viewIDAsInt->deepCopy(), multiviewBaseViewLayerIndexSymbol);
-
- // 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, multiviewBaseViewLayerIndexSymbol->deepCopy(),
- 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;
- TIntermSymbol *viewIDSymbol = new TIntermSymbol(symbolTable->nextUniqueId(), "ViewID_OVR",
- TType(EbtUInt, EbpHigh, viewIDQualifier));
- viewIDSymbol->setInternal(true);
-
- DeclareGlobalVariable(root, viewIDSymbol);
- ReplaceSymbol(root, "gl_ViewID_OVR", viewIDSymbol);
- if (shaderType == GL_VERTEX_SHADER)
- {
- // Replacing gl_InstanceID with InstanceID should happen before adding the initializers of
- // InstanceID and ViewID.
- TIntermSymbol *instanceIDSymbol = new TIntermSymbol(
- symbolTable->nextUniqueId(), "InstanceID", TType(EbtInt, EbpHigh, EvqGlobal));
- instanceIDSymbol->setInternal(true);
- DeclareGlobalVariable(root, instanceIDSymbol);
- ReplaceSymbol(root, "gl_InstanceID", instanceIDSymbol);
-
- TIntermSequence *initializers = new TIntermSequence();
- InitializeViewIDAndInstanceID(viewIDSymbol, instanceIDSymbol, 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.
- TIntermSymbol *multiviewBaseViewLayerIndexSymbol =
- new TIntermSymbol(symbolTable->nextUniqueId(), "multiviewBaseViewLayerIndex",
- TType(EbtInt, EbpHigh, EvqUniform));
- multiviewBaseViewLayerIndexSymbol->setInternal(true);
- DeclareGlobalVariable(root, multiviewBaseViewLayerIndexSymbol);
-
- // Setting a value to gl_ViewportIndex or gl_Layer should happen after ViewID_OVR's
- // initialization.
- SelectViewIndexInVertexShader(viewIDSymbol->deepCopy(),
- multiviewBaseViewLayerIndexSymbol->deepCopy(),
- 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 \ No newline at end of file
diff --git a/src/3rdparty/angle/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h b/src/3rdparty/angle/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h
deleted file mode 100644
index b4ab05fd0e..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// 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_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_
-#define COMPILER_TRANSLATOR_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_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ \ No newline at end of file
diff --git a/src/3rdparty/angle/src/compiler/translator/DeferGlobalInitializers.cpp b/src/3rdparty/angle/src/compiler/translator/DeferGlobalInitializers.cpp
deleted file mode 100644
index 67d51ea87b..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/DeferGlobalInitializers.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-//
-// 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/DeferGlobalInitializers.h"
-
-#include "compiler/translator/FindMain.h"
-#include "compiler/translator/InitializeVariables.h"
-#include "compiler/translator/IntermNode.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/SymbolTable.h"
-
-namespace sh
-{
-
-namespace
-{
-
-void GetDeferredInitializers(TIntermDeclaration *declaration,
- bool initializeUninitializedGlobals,
- bool canUseLoopsToInitialize,
- TIntermSequence *deferredInitializersOut,
- 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->getAsConstantUnion() == nullptr &&
- !expression->isConstructorWithOnlyConstantUnionParameters())))
- {
- // 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 has not been constant
- // folded, 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)
- {
- symbolNode->getTypePointer()->setQualifier(EvqGlobal);
- }
-
- 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.
- if (symbolNode->getName().isInternal())
- return;
-
- if (symbolNode->getQualifier() == EvqGlobal && symbolNode->getSymbol() != "")
- {
- TIntermSequence *initCode =
- CreateInitCode(symbolNode, canUseLoopsToInitialize, 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);
-
- TSymbolUniqueId initGlobalsFunctionId(symbolTable);
-
- const char *kInitGlobalsFunctionName = "initGlobals";
-
- TIntermFunctionPrototype *initGlobalsFunctionPrototype =
- CreateInternalFunctionPrototypeNode(TType(), kInitGlobalsFunctionName, initGlobalsFunctionId);
- root->getSequence()->insert(root->getSequence()->begin(), initGlobalsFunctionPrototype);
- TIntermFunctionDefinition *initGlobalsFunctionDefinition = CreateInternalFunctionDefinitionNode(
- TType(), kInitGlobalsFunctionName, initGlobalsBlock, initGlobalsFunctionId);
- root->appendStatement(initGlobalsFunctionDefinition);
-
- TIntermAggregate *initGlobalsCall = CreateInternalFunctionCallNode(
- TType(), kInitGlobalsFunctionName, initGlobalsFunctionId, new TIntermSequence());
-
- TIntermBlock *mainBody = FindMainBody(root);
- mainBody->getSequence()->insert(mainBody->getSequence()->begin(), initGlobalsCall);
-}
-
-} // namespace
-
-void DeferGlobalInitializers(TIntermBlock *root,
- bool initializeUninitializedGlobals,
- bool canUseLoopsToInitialize,
- TSymbolTable *symbolTable)
-{
- TIntermSequence *deferredInitializers = new TIntermSequence();
-
- // 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, deferredInitializers, symbolTable);
- }
- }
-
- // Add the function with initialization and the call to that.
- if (!deferredInitializers->empty())
- {
- InsertInitCallToMain(root, deferredInitializers, symbolTable);
- }
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/DeferGlobalInitializers.h b/src/3rdparty/angle/src/compiler/translator/DeferGlobalInitializers.h
deleted file mode 100644
index 86930a585f..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/DeferGlobalInitializers.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// 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_DEFERGLOBALINITIALIZERS_H_
-#define COMPILER_TRANSLATOR_DEFERGLOBALINITIALIZERS_H_
-
-namespace sh
-{
-
-class TIntermBlock;
-class TSymbolTable;
-
-void DeferGlobalInitializers(TIntermBlock *root,
- bool initializeUninitializedGlobals,
- bool canUseLoopsToInitialize,
- TSymbolTable *symbolTable);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_DEFERGLOBALINITIALIZERS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/Diagnostics.cpp b/src/3rdparty/angle/src/compiler/translator/Diagnostics.cpp
deleted file mode 100644
index 1744e5ab3e..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Diagnostics.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// 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 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 pp::SourceLocation &loc, const char *reason, const char *token)
-{
- writeInfo(SH_ERROR, loc, reason, token);
-}
-
-void TDiagnostics::warning(const 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)
-{
- 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)
-{
- pp::SourceLocation srcLoc;
- srcLoc.file = loc.first_file;
- srcLoc.line = loc.first_line;
- warning(srcLoc, reason, token);
-}
-
-void TDiagnostics::print(ID id, const 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/src/3rdparty/angle/src/compiler/translator/Diagnostics.h b/src/3rdparty/angle/src/compiler/translator/Diagnostics.h
deleted file mode 100644
index 55b88991df..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Diagnostics.h
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// 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 pp::Diagnostics, angle::NonCopyable
-{
- public:
- TDiagnostics(TInfoSinkBase &infoSink);
- ~TDiagnostics() override;
-
- int numErrors() const { return mNumErrors; }
- int numWarnings() const { return mNumWarnings; }
-
- void error(const pp::SourceLocation &loc, const char *reason, const char *token);
- void warning(const 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 pp::SourceLocation &loc,
- const char *reason,
- const char *token);
-
- void print(ID id, const 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/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.cpp b/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.cpp
deleted file mode 100644
index 485e66670c..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-//
-// 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/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 pp::SourceLocation &loc, const std::string &msg)
-{
- mDiagnostics.error(loc, msg.c_str(), "");
-}
-
-void TDirectiveHandler::handlePragma(const 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(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 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 pp::SourceLocation &loc, int version)
-{
- if (version == 100 || version == 300 || version == 310)
- {
- mShaderVersion = version;
- }
- else
- {
- std::stringstream stream;
- stream << version;
- std::string str = stream.str();
- mDiagnostics.error(loc, "version number not supported", str.c_str());
- }
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.h b/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.h
deleted file mode 100644
index 8e8cb9bbf6..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.h
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_
-#define COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_
-
-#include "common/angleutils.h"
-#include "compiler/translator/ExtensionBehavior.h"
-#include "compiler/translator/Pragma.h"
-#include "compiler/preprocessor/DirectiveHandlerBase.h"
-#include "GLSLANG/ShaderLang.h"
-
-namespace sh
-{
-class TDiagnostics;
-
-class TDirectiveHandler : public 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 pp::SourceLocation &loc, const std::string &msg) override;
-
- void handlePragma(const pp::SourceLocation &loc,
- const std::string &name,
- const std::string &value,
- bool stdgl) override;
-
- void handleExtension(const pp::SourceLocation &loc,
- const std::string &name,
- const std::string &behavior) override;
-
- void handleVersion(const pp::SourceLocation &loc, int version) 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/src/3rdparty/angle/src/compiler/translator/EmulateGLFragColorBroadcast.cpp b/src/3rdparty/angle/src/compiler/translator/EmulateGLFragColorBroadcast.cpp
deleted file mode 100644
index 189ea341eb..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/EmulateGLFragColorBroadcast.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-//
-// 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/EmulateGLFragColorBroadcast.h"
-
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/IntermTraverse.h"
-#include "compiler/translator/RunAtTheEndOfShader.h"
-
-namespace sh
-{
-
-namespace
-{
-
-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(TString("gl_FragData"), *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->getSymbol() == "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 anonymous
-
-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/src/3rdparty/angle/src/compiler/translator/EmulateGLFragColorBroadcast.h b/src/3rdparty/angle/src/compiler/translator/EmulateGLFragColorBroadcast.h
deleted file mode 100644
index e652b7e07e..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/EmulateGLFragColorBroadcast.h
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// 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_EMULATEGLFRAGCOLORBROADCAST_H_
-#define COMPILER_TRANSLATOR_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);
-}
-
-#endif // COMPILER_TRANSLATOR_EMULATEGLFRAGCOLORBROADCAST_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/EmulatePrecision.cpp b/src/3rdparty/angle/src/compiler/translator/EmulatePrecision.cpp
deleted file mode 100644
index ba09fd77df..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/EmulatePrecision.cpp
+++ /dev/null
@@ -1,751 +0,0 @@
-//
-// 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/EmulatePrecision.h"
-
-#include <memory>
-
-namespace sh
-{
-
-namespace
-{
-
-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;
- 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;
- 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;
- 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;
- 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;
- 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);
-}
-
-TIntermAggregate *createInternalFunctionCallNode(const TType &type,
- TString name,
- TIntermSequence *arguments)
-{
- TName nameObj(name);
- nameObj.setInternal(true);
- TIntermAggregate *callNode =
- TIntermAggregate::Create(type, EOpCallInternalRawFunction, arguments);
- callNode->getFunctionSymbolInfo()->setNameObj(nameObj);
- return callNode;
-}
-
-TIntermAggregate *createRoundingFunctionCallNode(TIntermTyped *roundedChild)
-{
- TString roundFunctionName;
- if (roundedChild->getPrecision() == EbpMedium)
- roundFunctionName = "angle_frm";
- else
- roundFunctionName = "angle_frl";
- TIntermSequence *arguments = new TIntermSequence();
- arguments->push_back(roundedChild);
- TIntermAggregate *callNode =
- createInternalFunctionCallNode(roundedChild->getType(), roundFunctionName, arguments);
- callNode->getFunctionSymbolInfo()->setKnownToNotHaveSideEffects(true);
- return callNode;
-}
-
-TIntermAggregate *createCompoundAssignmentFunctionCallNode(TIntermTyped *left,
- TIntermTyped *right,
- const char *opNameStr)
-{
- std::stringstream strstr;
- if (left->getPrecision() == EbpMedium)
- strstr << "angle_compound_" << opNameStr << "_frm";
- else
- strstr << "angle_compound_" << opNameStr << "_frl";
- TString functionName = strstr.str().c_str();
- TIntermSequence *arguments = new TIntermSequence();
- arguments->push_back(left);
- arguments->push_back(right);
- return createInternalFunctionCallNode(left->getType(), functionName, arguments);
-}
-
-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 anonymous
-
-EmulatePrecision::EmulatePrecision(TSymbolTable *symbolTable, int shaderVersion)
- : TLValueTrackingTraverser(true, true, true, symbolTable, shaderVersion),
- 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::visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node)
-{
- return false;
-}
-
-bool EmulatePrecision::visitAggregate(Visit visit, TIntermAggregate *node)
-{
- if (visit != PreVisit)
- return true;
- switch (node->getOp())
- {
- case EOpCallInternalRawFunction:
- case EOpCallFunctionInAST:
- // User-defined function return values are not rounded. The calculations that produced
- // the value inside the function definition should have been rounded.
- break;
- case EOpConstruct:
- if (node->getBasicType() == EbtStruct)
- {
- break;
- }
- default:
- TIntermNode *parent = getParentNode();
- if (canRoundFloat(node->getType()) && ParentUsesResult(parent, node) &&
- !ParentConstructorTakesCareOfRounding(parent, node))
- {
- TIntermNode *replacement = createRoundingFunctionCallNode(node);
- queueReplacement(replacement, OriginalNode::BECOMES_CHILD);
- }
- break;
- }
- 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));
- }
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/EmulatePrecision.h b/src/3rdparty/angle/src/compiler/translator/EmulatePrecision.h
deleted file mode 100644
index 8044465410..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/EmulatePrecision.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_TRANSLATOR_EMULATE_PRECISION_H_
-#define COMPILER_TRANSLATOR_EMULATE_PRECISION_H_
-
-#include "GLSLANG/ShaderLang.h"
-#include "common/angleutils.h"
-#include "compiler/translator/Compiler.h"
-#include "compiler/translator/InfoSink.h"
-#include "compiler/translator/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, int shaderVersion);
-
- 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;
- bool visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *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;
- }
- };
-
- typedef std::set<TypePair, TypePairComparator> EmulationSet;
- EmulationSet mEmulateCompoundAdd;
- EmulationSet mEmulateCompoundSub;
- EmulationSet mEmulateCompoundMul;
- EmulationSet mEmulateCompoundDiv;
-
- bool mDeclaringVariables;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_EMULATE_PRECISION_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/ExpandIntegerPowExpressions.cpp b/src/3rdparty/angle/src/compiler/translator/ExpandIntegerPowExpressions.cpp
deleted file mode 100644
index f17dd73657..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ExpandIntegerPowExpressions.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-//
-// 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/ExpandIntegerPowExpressions.h"
-
-#include <cmath>
-#include <cstdlib>
-
-#include "compiler/translator/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;
- nextTemporaryId();
-}
-
-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 *constantNode = sequence->at(1)->getAsConstantUnion();
-
- // Test 1: check for a single constant.
- if (!constantNode || constantNode->getNominalSize() != 1)
- {
- return true;
- }
-
- const TConstantUnion *constant = constantNode->getUnionArrayPointer();
-
- TConstantUnion asFloat;
- asFloat.cast(EbtFloat, *constant);
-
- float value = asFloat.getFConst();
-
- // Test 2: value is in the problematic range.
- if (value < -5.0f || value > 9.0f)
- {
- return true;
- }
-
- // Test 3: value is integer or pretty close to an integer.
- float absval = std::abs(value);
- float frac = absval - std::round(absval);
- if (frac > 0.0001f)
- {
- return true;
- }
-
- // Test 4: skip -1, 0, and 1
- int exponent = static_cast<int>(value);
- int n = std::abs(exponent);
- if (n < 2)
- {
- return true;
- }
-
- // Potential problem case detected, apply workaround.
- nextTemporaryId();
-
- TIntermTyped *lhs = sequence->at(0)->getAsTyped();
- ASSERT(lhs);
-
- TIntermDeclaration *init = createTempInitDeclaration(lhs);
- TIntermTyped *current = createTempSymbol(lhs->getType());
-
- insertStatementInParentBlock(init);
-
- // Create a chain of n-1 multiples.
- for (int i = 1; i < n; ++i)
- {
- TIntermBinary *mul = new TIntermBinary(EOpMul, current, createTempSymbol(lhs->getType()));
- 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/src/3rdparty/angle/src/compiler/translator/ExpandIntegerPowExpressions.h b/src/3rdparty/angle/src/compiler/translator/ExpandIntegerPowExpressions.h
deleted file mode 100644
index 0074e5d663..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ExpandIntegerPowExpressions.h
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// 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_EXPANDINTEGERPOWEXPRESSIONS_H_
-#define COMPILER_TRANSLATOR_EXPANDINTEGERPOWEXPRESSIONS_H_
-
-namespace sh
-{
-
-class TIntermNode;
-class TSymbolTable;
-
-void ExpandIntegerPowExpressions(TIntermNode *root, TSymbolTable *symbolTable);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_EXPANDINTEGERPOWEXPRESSIONS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.cpp b/src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.cpp
deleted file mode 100644
index 3f910b9050..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// 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(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_geometry_shader) \
- OP(OES_standard_derivatives) \
- OP(OVR_multiview)
-
-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/src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.h b/src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.h
deleted file mode 100644
index 09cc03f10f..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.h
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// 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,
- 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_geometry_shader,
- OES_standard_derivatives,
- OVR_multiview
-};
-
-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/src/3rdparty/angle/src/compiler/translator/ExtensionGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/ExtensionGLSL.cpp
deleted file mode 100644
index 5b5dc580e9..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ExtensionGLSL.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/ExtensionGLSL.h b/src/3rdparty/angle/src/compiler/translator/ExtensionGLSL.h
deleted file mode 100644
index a1b9cb2225..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ExtensionGLSL.h
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// 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/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/src/3rdparty/angle/src/compiler/translator/FindMain.cpp b/src/3rdparty/angle/src/compiler/translator/FindMain.cpp
deleted file mode 100644
index 7417fbac8a..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/FindMain.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// 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/FindMain.h"
-
-#include "compiler/translator/IntermNode.h"
-
-namespace sh
-{
-
-TIntermFunctionDefinition *FindMain(TIntermBlock *root)
-{
- for (TIntermNode *node : *root->getSequence())
- {
- TIntermFunctionDefinition *nodeFunction = node->getAsFunctionDefinition();
- if (nodeFunction != nullptr && nodeFunction->getFunctionSymbolInfo()->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/src/3rdparty/angle/src/compiler/translator/FindMain.h b/src/3rdparty/angle/src/compiler/translator/FindMain.h
deleted file mode 100644
index bf2c45d871..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/FindMain.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// 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_FINDMAIN_H_
-#define COMPILER_TRANSLATOR_FINDMAIN_H_
-
-namespace sh
-{
-
-class TIntermBlock;
-class TIntermFunctionDefinition;
-
-TIntermFunctionDefinition *FindMain(TIntermBlock *root);
-TIntermBlock *FindMainBody(TIntermBlock *root);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_FINDMAIN_H_ \ No newline at end of file
diff --git a/src/3rdparty/angle/src/compiler/translator/FindSymbolNode.cpp b/src/3rdparty/angle/src/compiler/translator/FindSymbolNode.cpp
deleted file mode 100644
index a2a10f128d..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/FindSymbolNode.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// 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/FindSymbolNode.h"
-
-#include "compiler/translator/IntermTraverse.h"
-
-namespace sh
-{
-
-namespace
-{
-
-class SymbolFinder : public TIntermTraverser
-{
- public:
- SymbolFinder(const TString &symbolName, TBasicType basicType)
- : TIntermTraverser(true, false, false),
- mSymbolName(symbolName),
- mNodeFound(nullptr),
- mBasicType(basicType)
- {
- }
-
- void visitSymbol(TIntermSymbol *node)
- {
- if (node->getBasicType() == mBasicType && node->getSymbol() == mSymbolName)
- {
- mNodeFound = node;
- }
- }
-
- bool isFound() const { return mNodeFound != nullptr; }
- const TIntermSymbol *getNode() const { return mNodeFound; }
-
- private:
- TString mSymbolName;
- TIntermSymbol *mNodeFound;
- TBasicType mBasicType;
-};
-
-} // anonymous namespace
-
-const TIntermSymbol *FindSymbolNode(TIntermNode *root,
- const TString &symbolName,
- TBasicType basicType)
-{
- SymbolFinder finder(symbolName, basicType);
- root->traverse(&finder);
- return finder.getNode();
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/FindSymbolNode.h b/src/3rdparty/angle/src/compiler/translator/FindSymbolNode.h
deleted file mode 100644
index 08dfb9a222..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/FindSymbolNode.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// 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_FIND_SYMBOL_H_
-#define COMPILER_TRANSLATOR_FIND_SYMBOL_H_
-
-#include "compiler/translator/BaseTypes.h"
-#include "compiler/translator/Common.h"
-
-namespace sh
-{
-
-class TIntermNode;
-class TIntermSymbol;
-
-const TIntermSymbol *FindSymbolNode(TIntermNode *root,
- const TString &symbolName,
- TBasicType basicType);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_FIND_SYMBOL_H_ \ No newline at end of file
diff --git a/src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.cpp b/src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.cpp
deleted file mode 100644
index fba837f55c..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// 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/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, TInterfaceBlock *block);
-
- std::vector<MappedStruct> mMappedStructs;
-};
-
-void FlagStd140StructsTraverser::mapBlockStructMembers(TIntermSymbol *blockDeclarator,
- 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)
- {
- 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/src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.h b/src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.h
deleted file mode 100644
index f548d8b6ed..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.h
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// 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);
-}
-
-#endif // COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/HashNames.cpp b/src/3rdparty/angle/src/compiler/translator/HashNames.cpp
deleted file mode 100644
index 6bc90faf94..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/HashNames.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// 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/IntermNode.h"
-
-namespace sh
-{
-
-namespace
-{
-
-// GLSL ES 3.00.6 section 3.9: the maximum length of an identifier is 1024 characters.
-static const unsigned int kESSLMaxIdentifierLength = 1024u;
-
-static const char *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.
-static const char *kUnhashedNamePrefix = "_u";
-static const unsigned int kUnhashedNamePrefixLength = 2u;
-
-TString HashName(const TString &name, ShHashFunction64 hashFunction)
-{
- ASSERT(!name.empty());
- ASSERT(hashFunction);
- khronos_uint64_t number = (*hashFunction)(name.c_str(), name.length());
- TStringStream stream;
- stream << kHashedNamePrefix << std::hex << number;
- TString hashedName = stream.str();
- return hashedName;
-}
-
-} // anonymous namespace
-
-TString HashName(const TName &name, ShHashFunction64 hashFunction, NameMap *nameMap)
-{
- if (name.getString().empty() || name.isInternal())
- {
- return name.getString();
- }
- if (hashFunction == nullptr)
- {
- if (name.getString().length() + kUnhashedNamePrefixLength > 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.getString();
- }
- return kUnhashedNamePrefix + name.getString();
- }
- if (nameMap)
- {
- NameMap::const_iterator it = nameMap->find(name.getString().c_str());
- if (it != nameMap->end())
- return it->second.c_str();
- }
- TString hashedName = HashName(name.getString(), hashFunction);
- if (nameMap)
- {
- (*nameMap)[name.getString().c_str()] = hashedName.c_str();
- }
- return hashedName;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/HashNames.h b/src/3rdparty/angle/src/compiler/translator/HashNames.h
deleted file mode 100644
index 28e861b309..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/HashNames.h
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#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 TName;
-
-// 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.
-TString HashName(const TName &name, ShHashFunction64 hashFunction, NameMap *nameMap);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_HASHNAMES_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/ImageFunctionHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/ImageFunctionHLSL.cpp
deleted file mode 100644
index 40b5e1f1e2..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ImageFunctionHLSL.cpp
+++ /dev/null
@@ -1,304 +0,0 @@
-//
-// 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/UtilsHLSL.h"
-
-namespace sh
-{
-
-// static
-void ImageFunctionHLSL::OutputImageFunctionArgumentList(
- TInfoSinkBase &out,
- const ImageFunctionHLSL::ImageFunction &imageFunction)
-{
- if (imageFunction.readonly)
- {
- out << TextureString(imageFunction.image, imageFunction.imageInternalFormat) << " tex";
- }
- else
- {
- out << RWTextureString(imageFunction.image, imageFunction.imageInternalFormat) << " tex";
- }
-
- 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 TString &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 TString &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 TString &imageReference)
-{
- if (IsImage3D(imageFunction.image) || IsImage2DArray(imageFunction.image) ||
- IsImage2D(imageFunction.image) || IsImageCube(imageFunction.image))
- {
- out << " " << imageReference << "[p] = data;\n";
- }
- else
- UNREACHABLE();
-}
-
-TString ImageFunctionHLSL::ImageFunction::name() const
-{
- TString name = "gl_image";
- if (readonly)
- {
- name += TextureTypeSuffix(image, imageInternalFormat);
- }
- else
- {
- name += RWTextureTypeSuffix(image, imageInternalFormat);
- }
-
- switch (method)
- {
- case Method::SIZE:
- name += "Size";
- break;
- case Method::LOAD:
- name += "Load";
- break;
- case Method::STORE:
- name += "Store";
- break;
- default:
- UNREACHABLE();
- }
-
- return name;
-}
-
-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, imageInternalFormat, readonly, method) <
- std::tie(rhs.image, rhs.imageInternalFormat, rhs.readonly, rhs.method);
-}
-
-TString ImageFunctionHLSL::useImageFunction(const TString &name,
- const TBasicType &type,
- TLayoutImageInternalFormat imageInternalFormat,
- bool readonly)
-{
- ASSERT(IsImage(type));
- ImageFunction imageFunction;
- imageFunction.image = type;
- imageFunction.imageInternalFormat = imageInternalFormat;
- imageFunction.readonly = readonly;
-
- 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)
- {
- // Function header
- out << imageFunction.getReturnType() << " " << imageFunction.name() << "(";
-
- OutputImageFunctionArgumentList(out, imageFunction);
-
- out << ")\n"
- "{\n";
-
- TString imageReference("tex");
-
- 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/src/3rdparty/angle/src/compiler/translator/ImageFunctionHLSL.h b/src/3rdparty/angle/src/compiler/translator/ImageFunctionHLSL.h
deleted file mode 100644
index 9db17a6bbf..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ImageFunctionHLSL.h
+++ /dev/null
@@ -1,76 +0,0 @@
-//
-// 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.
- TString useImageFunction(const TString &name,
- const TBasicType &type,
- TLayoutImageInternalFormat imageInternalFormat,
- bool readonly);
-
- void imageFunctionHeader(TInfoSinkBase &out);
-
- 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
- };
-
- TString name() const;
-
- bool operator<(const ImageFunction &rhs) const;
-
- const char *getReturnType() const;
-
- TBasicType image;
- TLayoutImageInternalFormat imageInternalFormat;
- bool readonly;
- Method method;
- };
-
- static void OutputImageFunctionArgumentList(
- TInfoSinkBase &out,
- const ImageFunctionHLSL::ImageFunction &imageFunction);
- static void OutputImageSizeFunctionBody(TInfoSinkBase &out,
- const ImageFunctionHLSL::ImageFunction &imageFunction,
- const TString &imageReference);
- static void OutputImageLoadFunctionBody(TInfoSinkBase &out,
- const ImageFunctionHLSL::ImageFunction &imageFunction,
- const TString &imageReference);
- static void OutputImageStoreFunctionBody(TInfoSinkBase &out,
- const ImageFunctionHLSL::ImageFunction &imageFunction,
- const TString &imageReference);
- using ImageFunctionSet = std::set<ImageFunction>;
- ImageFunctionSet mUsesImage;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_IMAGEFUNCTIONHLSL_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/InfoSink.cpp b/src/3rdparty/angle/src/compiler/translator/InfoSink.cpp
deleted file mode 100644
index db26aa67e8..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/InfoSink.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/translator/InfoSink.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;
- }
-}
-
-void TInfoSinkBase::location(int file, int line)
-{
- TPersistStringStream stream;
- if (line)
- stream << file << ":" << line;
- else
- stream << file << ":? ";
- stream << ": ";
-
- sink.append(stream.str());
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/InfoSink.h b/src/3rdparty/angle/src/compiler/translator/InfoSink.h
deleted file mode 100644
index 2705f48d59..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/InfoSink.h
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#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
-{
-
-// Returns the fractional part of the given floating-point number.
-inline float fractionalPart(float f)
-{
- float intPart = 0.0f;
- return modff(f, &intPart);
-}
-
-//
-// 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;
- 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;
- }
- // 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;
- 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/src/3rdparty/angle/src/compiler/translator/Initialize.cpp b/src/3rdparty/angle/src/compiler/translator/Initialize.cpp
deleted file mode 100644
index 6f8baee96b..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Initialize.cpp
+++ /dev/null
@@ -1,1135 +0,0 @@
-//
-// 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.
-//
-
-//
-// Create symbols that declare built-in definitions, add built-ins that
-// cannot be expressed in the files, and establish mappings between
-// built-in functions and operators.
-//
-
-#include "compiler/translator/Initialize.h"
-#include "compiler/translator/Cache.h"
-
-#include "compiler/translator/IntermNode.h"
-#include "angle_gl.h"
-
-namespace sh
-{
-
-void InsertBuiltInFunctions(sh::GLenum type,
- ShShaderSpec spec,
- const ShBuiltInResources &resources,
- TSymbolTable &symbolTable)
-{
- const TType *voidType = TCache::getType(EbtVoid);
- const TType *float1 = TCache::getType(EbtFloat);
- const TType *float2 = TCache::getType(EbtFloat, 2);
- const TType *float3 = TCache::getType(EbtFloat, 3);
- const TType *float4 = TCache::getType(EbtFloat, 4);
- const TType *int1 = TCache::getType(EbtInt);
- const TType *int2 = TCache::getType(EbtInt, 2);
- const TType *int3 = TCache::getType(EbtInt, 3);
- const TType *uint1 = TCache::getType(EbtUInt);
- const TType *bool1 = TCache::getType(EbtBool);
- const TType *genType = TCache::getType(EbtGenType);
- const TType *genIType = TCache::getType(EbtGenIType);
- const TType *genUType = TCache::getType(EbtGenUType);
- const TType *genBType = TCache::getType(EbtGenBType);
-
- //
- // Angle and Trigonometric Functions.
- //
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpRadians, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpDegrees, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpSin, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpCos, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpTan, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpAsin, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpAcos, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpAtan, genType, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpAtan, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpSinh, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpCosh, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpTanh, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpAsinh, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpAcosh, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpAtanh, genType, genType);
-
- //
- // Exponential Functions.
- //
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpPow, genType, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpExp, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpLog, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpExp2, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpLog2, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpSqrt, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpInverseSqrt, genType, genType);
-
- //
- // Common Functions.
- //
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpAbs, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpAbs, genIType, genIType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpSign, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpSign, genIType, genIType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpFloor, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpTrunc, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpRound, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpRoundEven, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpCeil, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpFract, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpMod, genType, genType, float1);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpMod, genType, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpMin, genType, genType, float1);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpMin, genType, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMin, genIType, genIType, genIType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMin, genIType, genIType, int1);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMin, genUType, genUType, genUType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMin, genUType, genUType, uint1);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpMax, genType, genType, float1);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpMax, genType, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMax, genIType, genIType, genIType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMax, genIType, genIType, int1);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMax, genUType, genUType, genUType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMax, genUType, genUType, uint1);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpClamp, genType, genType, float1, float1);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpClamp, genType, genType, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpClamp, genIType, genIType, int1, int1);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpClamp, genIType, genIType, genIType, genIType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpClamp, genUType, genUType, uint1, uint1);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpClamp, genUType, genUType, genUType, genUType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpMix, genType, genType, genType, float1);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpMix, genType, genType, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMix, genType, genType, genType, genBType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpStep, genType, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpStep, genType, float1, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpSmoothStep, genType, genType, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpSmoothStep, genType, float1, float1, genType);
-
- const TType *outGenType = TCache::getType(EbtGenType, EvqOut);
- const TType *outGenIType = TCache::getType(EbtGenIType, EvqOut);
-
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpModf, genType, genType, outGenType);
-
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpIsNan, genBType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpIsInf, genBType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpFloatBitsToInt, genIType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpFloatBitsToUint, genUType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpIntBitsToFloat, genType, genIType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpUintBitsToFloat, genType, genUType);
-
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpFrexp, genType, genType, outGenIType);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpLdexp, genType, genType, genIType);
-
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpPackSnorm2x16, uint1, float2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpPackUnorm2x16, uint1, float2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpPackHalf2x16, uint1, float2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpUnpackSnorm2x16, float2, uint1);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpUnpackUnorm2x16, float2, uint1);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpUnpackHalf2x16, float2, uint1);
-
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpPackUnorm4x8, uint1, float4);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpPackSnorm4x8, uint1, float4);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpUnpackUnorm4x8, float4, uint1);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpUnpackSnorm4x8, float4, uint1);
-
- //
- // Geometric Functions.
- //
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpLength, float1, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpDistance, float1, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpDot, float1, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpCross, float3, float3, float3);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpNormalize, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpFaceforward, genType, genType, genType,
- genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpReflect, genType, genType, genType);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpRefract, genType, genType, genType, float1);
-
- const TType *mat2 = TCache::getType(EbtFloat, 2, 2);
- const TType *mat3 = TCache::getType(EbtFloat, 3, 3);
- const TType *mat4 = TCache::getType(EbtFloat, 4, 4);
- const TType *mat2x3 = TCache::getType(EbtFloat, 2, 3);
- const TType *mat3x2 = TCache::getType(EbtFloat, 3, 2);
- const TType *mat2x4 = TCache::getType(EbtFloat, 2, 4);
- const TType *mat4x2 = TCache::getType(EbtFloat, 4, 2);
- const TType *mat3x4 = TCache::getType(EbtFloat, 3, 4);
- const TType *mat4x3 = TCache::getType(EbtFloat, 4, 3);
-
- //
- // Matrix Functions.
- //
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpMulMatrixComponentWise, mat2, mat2, mat2);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpMulMatrixComponentWise, mat3, mat3, mat3);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpMulMatrixComponentWise, mat4, mat4, mat4);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat2x3, mat2x3, mat2x3);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat3x2, mat3x2, mat3x2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat2x4, mat2x4, mat2x4);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat4x2, mat4x2, mat4x2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat3x4, mat3x4, mat3x4);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat4x3, mat4x3, mat4x3);
-
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat2, float2, float2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat3, float3, float3);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat4, float4, float4);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat2x3, float3, float2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat3x2, float2, float3);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat2x4, float4, float2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat4x2, float2, float4);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat3x4, float4, float3);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat4x3, float3, float4);
-
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat2, mat2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat3, mat3);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat4, mat4);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat2x3, mat3x2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat3x2, mat2x3);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat2x4, mat4x2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat4x2, mat2x4);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat3x4, mat4x3);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat4x3, mat3x4);
-
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpDeterminant, float1, mat2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpDeterminant, float1, mat3);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpDeterminant, float1, mat4);
-
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpInverse, mat2, mat2);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpInverse, mat3, mat3);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpInverse, mat4, mat4);
-
- const TType *vec = TCache::getType(EbtVec);
- const TType *ivec = TCache::getType(EbtIVec);
- const TType *uvec = TCache::getType(EbtUVec);
- const TType *bvec = TCache::getType(EbtBVec);
-
- //
- // Vector relational functions.
- //
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpLessThanComponentWise, bvec, vec, vec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpLessThanComponentWise, bvec, ivec, ivec);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpLessThanComponentWise, bvec, uvec, uvec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpLessThanEqualComponentWise, bvec, vec, vec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpLessThanEqualComponentWise, bvec, ivec, ivec);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpLessThanEqualComponentWise, bvec, uvec, uvec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpGreaterThanComponentWise, bvec, vec, vec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpGreaterThanComponentWise, bvec, ivec, ivec);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpGreaterThanComponentWise, bvec, uvec, uvec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpGreaterThanEqualComponentWise, bvec, vec, vec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpGreaterThanEqualComponentWise, bvec, ivec,
- ivec);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpGreaterThanEqualComponentWise, bvec, uvec, uvec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpEqualComponentWise, bvec, vec, vec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpEqualComponentWise, bvec, ivec, ivec);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpEqualComponentWise, bvec, uvec, uvec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpEqualComponentWise, bvec, bvec, bvec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpNotEqualComponentWise, bvec, vec, vec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpNotEqualComponentWise, bvec, ivec, ivec);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpNotEqualComponentWise, bvec, uvec, uvec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpNotEqualComponentWise, bvec, bvec, bvec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpAny, bool1, bvec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpAll, bool1, bvec);
- symbolTable.insertBuiltInOp(COMMON_BUILTINS, EOpLogicalNotComponentWise, bvec, bvec);
-
- //
- // Integer functions
- //
- const TType *outGenUType = TCache::getType(EbtGenUType, EvqOut);
-
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitfieldExtract, genIType, genIType, int1,
- int1);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitfieldExtract, genUType, genUType, int1,
- int1);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitfieldInsert, genIType, genIType, genIType,
- int1, int1);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitfieldInsert, genUType, genUType, genUType,
- int1, int1);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitfieldReverse, genIType, genIType);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitfieldReverse, genUType, genUType);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitCount, genIType, genIType);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitCount, genIType, genUType);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpFindLSB, genIType, genIType);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpFindLSB, genIType, genUType);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpFindMSB, genIType, genIType);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpFindMSB, genIType, genUType);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpUaddCarry, genUType, genUType, genUType,
- outGenUType);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpUsubBorrow, genUType, genUType, genUType,
- outGenUType);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpUmulExtended, voidType, genUType, genUType,
- outGenUType, outGenUType);
- symbolTable.insertBuiltInOp(ESSL3_1_BUILTINS, EOpImulExtended, voidType, genIType, genIType,
- outGenIType, outGenIType);
-
- const TType *sampler2D = TCache::getType(EbtSampler2D);
- const TType *samplerCube = TCache::getType(EbtSamplerCube);
-
- //
- // Texture Functions for GLSL ES 1.0
- //
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3);
-
- if (resources.OES_EGL_image_external || resources.NV_EGL_stream_consumer_external)
- {
- const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES);
-
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", samplerExternalOES, float2);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES,
- float3);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES,
- float4);
- }
-
- if (resources.ARB_texture_rectangle)
- {
- const TType *sampler2DRect = TCache::getType(EbtSampler2DRect);
-
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRect", sampler2DRect, float2);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRectProj", sampler2DRect,
- float3);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRectProj", sampler2DRect,
- float4);
- }
-
- if (resources.EXT_shader_texture_lod)
- {
- /* The *Grad* variants are new to both vertex and fragment shaders; the fragment
- * shader specific pieces are added separately below.
- */
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4,
- "texture2DGradEXT", sampler2D, float2, float2, float2);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4,
- "texture2DProjGradEXT", sampler2D, float3, float2, float2);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4,
- "texture2DProjGradEXT", sampler2D, float4, float2, float2);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4,
- "textureCubeGradEXT", samplerCube, float3, float3, float3);
- }
-
- if (type == GL_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2, float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3,
- float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4,
- float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3,
- float1);
-
- if (resources.OES_standard_derivatives)
- {
- symbolTable.insertBuiltInOp(ESSL1_BUILTINS, EOpDFdx,
- TExtension::OES_standard_derivatives, genType, genType);
- symbolTable.insertBuiltInOp(ESSL1_BUILTINS, EOpDFdy,
- TExtension::OES_standard_derivatives, genType, genType);
- symbolTable.insertBuiltInOp(ESSL1_BUILTINS, EOpFwidth,
- TExtension::OES_standard_derivatives, genType, genType);
- }
-
- if (resources.EXT_shader_texture_lod)
- {
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4,
- "texture2DLodEXT", sampler2D, float2, float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4,
- "texture2DProjLodEXT", sampler2D, float3, float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4,
- "texture2DProjLodEXT", sampler2D, float4, float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4,
- "textureCubeLodEXT", samplerCube, float3, float1);
- }
- }
-
- if (type == GL_VERTEX_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLod", sampler2D, float2,
- float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float3,
- float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float4,
- float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeLod", samplerCube, float3,
- float1);
- }
-
- const TType *gvec4 = TCache::getType(EbtGVec4);
-
- const TType *gsampler2D = TCache::getType(EbtGSampler2D);
- const TType *gsamplerCube = TCache::getType(EbtGSamplerCube);
- const TType *gsampler3D = TCache::getType(EbtGSampler3D);
- const TType *gsampler2DArray = TCache::getType(EbtGSampler2DArray);
- const TType *gsampler2DMS = TCache::getType(EbtGSampler2DMS);
-
- //
- // Texture Functions for GLSL ES 3.0
- //
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2D, float2, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler3D, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsamplerCube, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2DArray, float3, float1);
-
- if (resources.OES_EGL_image_external_essl3)
- {
- const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "texture", samplerExternalOES, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES,
- float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES,
- float4);
- }
-
- if (resources.EXT_YUV_target)
- {
- const TType *samplerExternal2DY2YEXT = TCache::getType(EbtSamplerExternal2DY2YEXT);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4, "texture",
- samplerExternal2DY2YEXT, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4, "textureProj",
- samplerExternal2DY2YEXT, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4, "textureProj",
- samplerExternal2DY2YEXT, float4);
-
- const TType *yuvCscStandardEXT = TCache::getType(EbtYuvCscStandardEXT);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float3, "rgb_2_yuv",
- float3, yuvCscStandardEXT);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float3, "yuv_2_rgb",
- float3, yuvCscStandardEXT);
- }
-
- if (type == GL_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3,
- float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4, float1);
-
- if (resources.OES_EGL_image_external_essl3)
- {
- const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "texture", samplerExternalOES, float2,
- float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES,
- float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES,
- float4, float1);
- }
-
- if (resources.EXT_YUV_target)
- {
- const TType *samplerExternal2DY2YEXT = TCache::getType(EbtSamplerExternal2DY2YEXT);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4, "texture",
- samplerExternal2DY2YEXT, float2, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4,
- "textureProj", samplerExternal2DY2YEXT, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4,
- "textureProj", samplerExternal2DY2YEXT, float4, float1);
- }
- }
-
- const TType *sampler2DShadow = TCache::getType(EbtSampler2DShadow);
- const TType *samplerCubeShadow = TCache::getType(EbtSamplerCubeShadow);
- const TType *sampler2DArrayShadow = TCache::getType(EbtSampler2DArrayShadow);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DArrayShadow, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLod", sampler2DShadow, float3,
- float1);
-
- if (type == GL_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3,
- float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4,
- float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4,
- float1);
- }
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsampler2D, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler3D, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsamplerCube, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler2DArray, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", sampler2DShadow, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerCubeShadow, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", sampler2DArrayShadow, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsampler2DMS);
-
- if (resources.OES_EGL_image_external_essl3)
- {
- const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerExternalOES, int1);
- }
-
- if (resources.EXT_YUV_target)
- {
- const TType *samplerExternal2DY2YEXT = TCache::getType(EbtSamplerExternal2DY2YEXT);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, int2, "textureSize",
- samplerExternal2DY2YEXT, int1);
- }
-
- if (type == GL_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpDFdx, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpDFdy, genType, genType);
- symbolTable.insertBuiltInOp(ESSL3_BUILTINS, EOpFwidth, genType, genType);
- }
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3,
- int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3,
- int2);
-
- if (type == GL_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2,
- float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3,
- float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3,
- int2, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3,
- int2, float1);
- }
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4,
- int2);
-
- if (type == GL_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3,
- int2, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4,
- int2, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4,
- int3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow,
- float4, int2, float1);
- }
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2D, float2, float1,
- int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler3D, float3, float1,
- int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLodOffset", sampler2DShadow, float3,
- float1, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2DArray, float3,
- float1, int2);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float4, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler3D, float4, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLod", sampler2DShadow, float4,
- float1);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float3,
- float1, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float4,
- float1, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler3D, float4,
- float1, int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLodOffset", sampler2DShadow,
- float4, float1, int2);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2D, int2, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler3D, int3, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2DArray, int3, int1);
-
- if (resources.OES_EGL_image_external_essl3)
- {
- const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "texelFetch", samplerExternalOES, int2,
- int1);
- }
-
- if (resources.EXT_YUV_target)
- {
- const TType *samplerExternal2DY2YEXT = TCache::getType(EbtSamplerExternal2DY2YEXT);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4, "texelFetch",
- samplerExternal2DY2YEXT, int2, int1);
- }
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2D, int2, int1,
- int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler3D, int3, int1,
- int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2DArray, int3,
- int1, int2);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2D, float2, float2,
- float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler3D, float3, float3,
- float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsamplerCube, float3, float3,
- float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DShadow, float3,
- float2, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", samplerCubeShadow, float4,
- float3, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2DArray, float3, float2,
- float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DArrayShadow, float4,
- float2, float2);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2D, float2,
- float2, float2, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler3D, float3,
- float3, float3, int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DShadow, float3,
- float2, float2, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2DArray, float3,
- float2, float2, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DArrayShadow,
- float4, float2, float2, int2);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float3, float2,
- float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float4, float2,
- float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler3D, float4, float3,
- float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGrad", sampler2DShadow, float4,
- float2, float2);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float3,
- float2, float2, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float4,
- float2, float2, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler3D, float4,
- float3, float3, int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGradOffset", sampler2DShadow,
- float4, float2, float2, int2);
-
- const TType *atomicCounter = TCache::getType(EbtAtomicCounter);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicCounter", atomicCounter);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicCounterIncrement", atomicCounter);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicCounterDecrement", atomicCounter);
-
- // Insert all atomic memory functions
- const TType *int1InOut = TCache::getType(EbtInt, EvqInOut);
- const TType *uint1InOut = TCache::getType(EbtUInt, EvqInOut);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicAdd", uint1InOut, uint1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicAdd", int1InOut, int1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicMin", uint1InOut, uint1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicMin", int1InOut, int1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicMax", uint1InOut, uint1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicMax", int1InOut, int1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicAnd", uint1InOut, uint1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicAnd", int1InOut, int1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicOr", uint1InOut, uint1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicOr", int1InOut, int1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicXor", uint1InOut, uint1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicXor", int1InOut, int1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicExchange", uint1InOut, uint1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicExchange", int1InOut, int1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicCompSwap", uint1InOut, uint1, uint1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicCompSwap", int1InOut, int1, int1);
-
- const TType *gimage2D = TCache::getType(EbtGImage2D);
- const TType *gimage3D = TCache::getType(EbtGImage3D);
- const TType *gimage2DArray = TCache::getType(EbtGImage2DArray);
- const TType *gimageCube = TCache::getType(EbtGImageCube);
-
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimage2D, int2, gvec4);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimage3D, int3, gvec4);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimage2DArray, int3, gvec4);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimageCube, int3, gvec4);
-
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimage2D, int2);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimage3D, int3);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimage2DArray, int3);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimageCube, int3);
-
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int2, "imageSize", gimage2D);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int3, "imageSize", gimage3D);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int3, "imageSize", gimage2DArray);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int2, "imageSize", gimageCube);
-
- symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrier, voidType,
- "memoryBarrier");
- symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierAtomicCounter,
- voidType, "memoryBarrierAtomicCounter");
- symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierBuffer,
- voidType, "memoryBarrierBuffer");
- symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierImage, voidType,
- "memoryBarrierImage");
-
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "texelFetch", gsampler2DMS, int2, int1);
-
- // Insert all variations of textureGather.
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGather", gsampler2D, float2);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGather", gsampler2D, float2, int1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGather", gsampler2DArray, float3);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGather", gsampler2DArray, float3,
- int1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGather", gsamplerCube, float3);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGather", gsamplerCube, float3, int1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGather", sampler2DShadow, float2);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGather", sampler2DShadow, float2,
- float1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGather", sampler2DArrayShadow,
- float3);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGather", sampler2DArrayShadow,
- float3, float1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGather", samplerCubeShadow, float3);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGather", samplerCubeShadow, float3,
- float1);
-
- // Insert all variations of textureGatherOffset.
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGatherOffset", gsampler2D, float2,
- int2);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGatherOffset", gsampler2D, float2,
- int2, int1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGatherOffset", gsampler2DArray,
- float3, int2);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGatherOffset", gsampler2DArray,
- float3, int2, int1);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGatherOffset", sampler2DShadow,
- float2, float1, int2);
- symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGatherOffset", sampler2DArrayShadow,
- float3, float1, int2);
-
- if (type == GL_COMPUTE_SHADER)
- {
- symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpBarrier, voidType,
- "barrier");
- symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierShared,
- voidType, "memoryBarrierShared");
- symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpGroupMemoryBarrier,
- voidType, "groupMemoryBarrier");
- }
-
- if (type == GL_GEOMETRY_SHADER_OES)
- {
- TExtension extension = TExtension::OES_geometry_shader;
- symbolTable.insertBuiltInFunctionNoParametersExt(ESSL3_1_BUILTINS, extension, EOpEmitVertex,
- voidType, "EmitVertex");
- symbolTable.insertBuiltInFunctionNoParametersExt(ESSL3_1_BUILTINS, extension,
- EOpEndPrimitive, voidType, "EndPrimitive");
- }
-
- //
- // Depth range in window coordinates
- //
- TFieldList *fields = NewPoolTFieldList();
- TSourceLoc zeroSourceLoc = {0, 0, 0, 0};
- auto highpFloat1 = new TType(EbtFloat, EbpHigh, EvqGlobal, 1);
- TField *near = new TField(highpFloat1, NewPoolTString("near"), zeroSourceLoc);
- TField *far = new TField(highpFloat1, NewPoolTString("far"), zeroSourceLoc);
- TField *diff = new TField(highpFloat1, NewPoolTString("diff"), zeroSourceLoc);
- fields->push_back(near);
- fields->push_back(far);
- fields->push_back(diff);
- TStructure *depthRangeStruct =
- new TStructure(&symbolTable, NewPoolTString("gl_DepthRangeParameters"), fields);
- symbolTable.insertStructType(COMMON_BUILTINS, depthRangeStruct);
- TType depthRangeType(depthRangeStruct);
- depthRangeType.setQualifier(EvqUniform);
- symbolTable.insertVariable(COMMON_BUILTINS, "gl_DepthRange", depthRangeType);
-
- //
- // Implementation dependent built-in constants.
- //
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexAttribs", resources.MaxVertexAttribs,
- EbpMedium);
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexUniformVectors",
- resources.MaxVertexUniformVectors, EbpMedium);
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexTextureImageUnits",
- resources.MaxVertexTextureImageUnits, EbpMedium);
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxCombinedTextureImageUnits",
- resources.MaxCombinedTextureImageUnits, EbpMedium);
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxTextureImageUnits",
- resources.MaxTextureImageUnits, EbpMedium);
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxFragmentUniformVectors",
- resources.MaxFragmentUniformVectors, EbpMedium);
-
- symbolTable.insertConstInt(ESSL1_BUILTINS, "gl_MaxVaryingVectors", resources.MaxVaryingVectors,
- EbpMedium);
-
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxDrawBuffers", resources.MaxDrawBuffers,
- EbpMedium);
- if (resources.EXT_blend_func_extended)
- {
- symbolTable.insertConstIntExt(COMMON_BUILTINS, TExtension::EXT_blend_func_extended,
- "gl_MaxDualSourceDrawBuffersEXT",
- resources.MaxDualSourceDrawBuffers, EbpMedium);
- }
-
- symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxVertexOutputVectors",
- resources.MaxVertexOutputVectors, EbpMedium);
- symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxFragmentInputVectors",
- resources.MaxFragmentInputVectors, EbpMedium);
- symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MinProgramTexelOffset",
- resources.MinProgramTexelOffset, EbpMedium);
- symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxProgramTexelOffset",
- resources.MaxProgramTexelOffset, EbpMedium);
-
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxImageUnits", resources.MaxImageUnits,
- EbpMedium);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxVertexImageUniforms",
- resources.MaxVertexImageUniforms, EbpMedium);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxFragmentImageUniforms",
- resources.MaxFragmentImageUniforms, EbpMedium);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeImageUniforms",
- resources.MaxComputeImageUniforms, EbpMedium);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxCombinedImageUniforms",
- resources.MaxCombinedImageUniforms, EbpMedium);
-
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxCombinedShaderOutputResources",
- resources.MaxCombinedShaderOutputResources, EbpMedium);
-
- symbolTable.insertConstIvec3(ESSL3_1_BUILTINS, "gl_MaxComputeWorkGroupCount",
- resources.MaxComputeWorkGroupCount, EbpHigh);
- symbolTable.insertConstIvec3(ESSL3_1_BUILTINS, "gl_MaxComputeWorkGroupSize",
- resources.MaxComputeWorkGroupSize, EbpHigh);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeUniformComponents",
- resources.MaxComputeUniformComponents, EbpMedium);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeTextureImageUnits",
- resources.MaxComputeTextureImageUnits, EbpMedium);
-
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeAtomicCounters",
- resources.MaxComputeAtomicCounters, EbpMedium);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeAtomicCounterBuffers",
- resources.MaxComputeAtomicCounterBuffers, EbpMedium);
-
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxVertexAtomicCounters",
- resources.MaxVertexAtomicCounters, EbpMedium);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxFragmentAtomicCounters",
- resources.MaxFragmentAtomicCounters, EbpMedium);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxCombinedAtomicCounters",
- resources.MaxCombinedAtomicCounters, EbpMedium);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxAtomicCounterBindings",
- resources.MaxAtomicCounterBindings, EbpMedium);
-
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxVertexAtomicCounterBuffers",
- resources.MaxVertexAtomicCounterBuffers, EbpMedium);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxFragmentAtomicCounterBuffers",
- resources.MaxFragmentAtomicCounterBuffers, EbpMedium);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxCombinedAtomicCounterBuffers",
- resources.MaxCombinedAtomicCounterBuffers, EbpMedium);
- symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxAtomicCounterBufferSize",
- resources.MaxAtomicCounterBufferSize, EbpMedium);
-
- if (resources.OES_geometry_shader)
- {
- TExtension ext = TExtension::OES_geometry_shader;
- symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryInputComponents",
- resources.MaxGeometryInputComponents, EbpMedium);
- symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryOutputComponents",
- resources.MaxGeometryOutputComponents, EbpMedium);
- symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryImageUniforms",
- resources.MaxGeometryImageUniforms, EbpMedium);
- symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryTextureImageUnits",
- resources.MaxGeometryTextureImageUnits, EbpMedium);
- symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryOutputVertices",
- resources.MaxGeometryOutputVertices, EbpMedium);
- symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryTotalOutputComponents",
- resources.MaxGeometryTotalOutputComponents, EbpMedium);
- symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryUniformComponents",
- resources.MaxGeometryUniformComponents, EbpMedium);
- symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryAtomicCounters",
- resources.MaxGeometryAtomicCounters, EbpMedium);
- symbolTable.insertConstIntExt(ESSL3_1_BUILTINS, ext, "gl_MaxGeometryAtomicCounterBuffers",
- resources.MaxGeometryAtomicCounterBuffers, EbpMedium);
- }
-}
-
-void IdentifyBuiltIns(sh::GLenum type,
- ShShaderSpec spec,
- const ShBuiltInResources &resources,
- TSymbolTable &symbolTable)
-{
- //
- // Insert some special built-in variables that are not in
- // the built-in header files.
- //
-
- if (resources.OVR_multiview && type != GL_COMPUTE_SHADER)
- {
- symbolTable.insertVariableExt(ESSL3_BUILTINS, TExtension::OVR_multiview, "gl_ViewID_OVR",
- TType(EbtUInt, EbpHigh, EvqViewIDOVR, 1));
-
- // ESSL 1.00 doesn't have unsigned integers, so gl_ViewID_OVR is a signed integer in ESSL
- // 1.00. This is specified in the WEBGL_multiview spec.
- symbolTable.insertVariableExt(ESSL1_BUILTINS, TExtension::OVR_multiview, "gl_ViewID_OVR",
- TType(EbtInt, EbpHigh, EvqViewIDOVR, 1));
- }
-
- switch (type)
- {
- case GL_FRAGMENT_SHADER:
- {
- symbolTable.insertVariable(COMMON_BUILTINS, "gl_FragCoord",
- TType(EbtFloat, EbpMedium, EvqFragCoord, 4));
- symbolTable.insertVariable(COMMON_BUILTINS, "gl_FrontFacing",
- TType(EbtBool, EbpUndefined, EvqFrontFacing, 1));
- symbolTable.insertVariable(COMMON_BUILTINS, "gl_PointCoord",
- TType(EbtFloat, EbpMedium, EvqPointCoord, 2));
-
- symbolTable.insertVariable(ESSL1_BUILTINS, "gl_FragColor",
- TType(EbtFloat, EbpMedium, EvqFragColor, 4));
- TType fragData(EbtFloat, EbpMedium, EvqFragData, 4);
- if (spec != SH_WEBGL2_SPEC && spec != SH_WEBGL3_SPEC)
- {
- fragData.makeArray(resources.MaxDrawBuffers);
- }
- else
- {
- fragData.makeArray(1u);
- }
- symbolTable.insertVariable(ESSL1_BUILTINS, "gl_FragData", fragData);
-
- if (resources.EXT_blend_func_extended)
- {
- symbolTable.insertVariableExt(
- ESSL1_BUILTINS, TExtension::EXT_blend_func_extended, "gl_SecondaryFragColorEXT",
- TType(EbtFloat, EbpMedium, EvqSecondaryFragColorEXT, 4));
- TType secondaryFragData(EbtFloat, EbpMedium, EvqSecondaryFragDataEXT, 4, 1);
- secondaryFragData.makeArray(resources.MaxDualSourceDrawBuffers);
- symbolTable.insertVariableExt(ESSL1_BUILTINS, TExtension::EXT_blend_func_extended,
- "gl_SecondaryFragDataEXT", secondaryFragData);
- }
-
- if (resources.EXT_frag_depth)
- {
- symbolTable.insertVariableExt(
- ESSL1_BUILTINS, TExtension::EXT_frag_depth, "gl_FragDepthEXT",
- TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium,
- EvqFragDepthEXT, 1));
- }
-
- symbolTable.insertVariable(ESSL3_BUILTINS, "gl_FragDepth",
- TType(EbtFloat, EbpHigh, EvqFragDepth, 1));
-
- if (resources.EXT_shader_framebuffer_fetch || resources.NV_shader_framebuffer_fetch)
- {
- TType lastFragData(EbtFloat, EbpMedium, EvqLastFragData, 4, 1);
- lastFragData.makeArray(resources.MaxDrawBuffers);
-
- if (resources.EXT_shader_framebuffer_fetch)
- {
- symbolTable.insertVariableExt(ESSL1_BUILTINS,
- TExtension::EXT_shader_framebuffer_fetch,
- "gl_LastFragData", lastFragData);
- }
- else if (resources.NV_shader_framebuffer_fetch)
- {
- symbolTable.insertVariableExt(
- ESSL1_BUILTINS, TExtension::NV_shader_framebuffer_fetch, "gl_LastFragColor",
- TType(EbtFloat, EbpMedium, EvqLastFragColor, 4));
- symbolTable.insertVariableExt(ESSL1_BUILTINS,
- TExtension::NV_shader_framebuffer_fetch,
- "gl_LastFragData", lastFragData);
- }
- }
- else if (resources.ARM_shader_framebuffer_fetch)
- {
- symbolTable.insertVariableExt(
- ESSL1_BUILTINS, TExtension::ARM_shader_framebuffer_fetch, "gl_LastFragColorARM",
- TType(EbtFloat, EbpMedium, EvqLastFragColor, 4));
- }
-
- if (resources.OES_geometry_shader)
- {
- TExtension extension = TExtension::OES_geometry_shader;
- symbolTable.insertVariableExt(ESSL3_1_BUILTINS, extension, "gl_PrimitiveID",
- TType(EbtInt, EbpHigh, EvqPrimitiveID, 1));
- symbolTable.insertVariableExt(ESSL3_1_BUILTINS, extension, "gl_Layer",
- TType(EbtInt, EbpHigh, EvqLayer, 1));
- }
-
- break;
- }
- case GL_VERTEX_SHADER:
- {
- symbolTable.insertVariable(COMMON_BUILTINS, "gl_Position",
- TType(EbtFloat, EbpHigh, EvqPosition, 4));
- symbolTable.insertVariable(COMMON_BUILTINS, "gl_PointSize",
- TType(EbtFloat, EbpMedium, EvqPointSize, 1));
- symbolTable.insertVariable(ESSL3_BUILTINS, "gl_InstanceID",
- TType(EbtInt, EbpHigh, EvqInstanceID, 1));
- symbolTable.insertVariable(ESSL3_BUILTINS, "gl_VertexID",
- TType(EbtInt, EbpHigh, EvqVertexID, 1));
-
- // For internal use by ANGLE - not exposed to the parser.
- symbolTable.insertVariable(GLSL_BUILTINS, "gl_ViewportIndex",
- TType(EbtInt, EbpHigh, EvqViewportIndex));
- // gl_Layer exists in other shader stages in ESSL, but not in vertex shader so far.
- symbolTable.insertVariable(GLSL_BUILTINS, "gl_Layer", TType(EbtInt, EbpHigh, EvqLayer));
- break;
- }
- case GL_COMPUTE_SHADER:
- {
- symbolTable.insertVariable(ESSL3_1_BUILTINS, "gl_NumWorkGroups",
- TType(EbtUInt, EbpUndefined, EvqNumWorkGroups, 3));
- symbolTable.insertVariable(ESSL3_1_BUILTINS, "gl_WorkGroupSize",
- TType(EbtUInt, EbpUndefined, EvqWorkGroupSize, 3));
- symbolTable.insertVariable(ESSL3_1_BUILTINS, "gl_WorkGroupID",
- TType(EbtUInt, EbpUndefined, EvqWorkGroupID, 3));
- symbolTable.insertVariable(ESSL3_1_BUILTINS, "gl_LocalInvocationID",
- TType(EbtUInt, EbpUndefined, EvqLocalInvocationID, 3));
- symbolTable.insertVariable(ESSL3_1_BUILTINS, "gl_GlobalInvocationID",
- TType(EbtUInt, EbpUndefined, EvqGlobalInvocationID, 3));
- symbolTable.insertVariable(ESSL3_1_BUILTINS, "gl_LocalInvocationIndex",
- TType(EbtUInt, EbpUndefined, EvqLocalInvocationIndex, 1));
- break;
- }
-
- case GL_GEOMETRY_SHADER_OES:
- {
- TExtension extension = TExtension::OES_geometry_shader;
-
- // Add built-in interface block gl_PerVertex and the built-in array gl_in.
- // TODO(jiawei.shao@intel.com): implement GL_OES_geometry_point_size.
- const TString *glPerVertexString = NewPoolTString("gl_PerVertex");
- symbolTable.insertInterfaceBlockNameExt(ESSL3_1_BUILTINS, extension, glPerVertexString);
-
- TFieldList *fieldList = NewPoolTFieldList();
- TSourceLoc zeroSourceLoc = {0, 0, 0, 0};
- TField *glPositionField = new TField(new TType(EbtFloat, EbpHigh, EvqPosition, 4),
- NewPoolTString("gl_Position"), zeroSourceLoc);
- fieldList->push_back(glPositionField);
-
- TInterfaceBlock *glInBlock = new TInterfaceBlock(
- glPerVertexString, fieldList, NewPoolTString("gl_in"), TLayoutQualifier::Create());
-
- // The array size of gl_in is undefined until we get a valid input primitive
- // declaration.
- TType glInType(glInBlock, EvqPerVertexIn, TLayoutQualifier::Create());
- glInType.makeArray(0u);
- symbolTable.insertVariableExt(ESSL3_1_BUILTINS, extension, "gl_in", glInType);
-
- TType glPositionType(EbtFloat, EbpHigh, EvqPosition, 4);
- glPositionType.setInterfaceBlock(new TInterfaceBlock(
- glPerVertexString, fieldList, nullptr, TLayoutQualifier::Create()));
- symbolTable.insertVariableExt(ESSL3_1_BUILTINS, extension, "gl_Position",
- glPositionType);
- symbolTable.insertVariableExt(ESSL3_1_BUILTINS, extension, "gl_PrimitiveIDIn",
- TType(EbtInt, EbpHigh, EvqPrimitiveIDIn, 1));
- symbolTable.insertVariableExt(ESSL3_1_BUILTINS, extension, "gl_InvocationID",
- TType(EbtInt, EbpHigh, EvqInvocationID, 1));
- symbolTable.insertVariableExt(ESSL3_1_BUILTINS, extension, "gl_PrimitiveID",
- TType(EbtInt, EbpHigh, EvqPrimitiveID, 1));
- symbolTable.insertVariableExt(ESSL3_1_BUILTINS, extension, "gl_Layer",
- TType(EbtInt, EbpHigh, EvqLayer, 1));
-
- break;
- }
- default:
- UNREACHABLE();
- }
-}
-
-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.EXT_YUV_target)
- {
- extBehavior[TExtension::EXT_YUV_target] = EBhUndefined;
- }
- if (resources.OES_geometry_shader)
- {
- extBehavior[TExtension::OES_geometry_shader] = EBhUndefined;
- extBehavior[TExtension::EXT_geometry_shader] = 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/src/3rdparty/angle/src/compiler/translator/Initialize.h b/src/3rdparty/angle/src/compiler/translator/Initialize.h
deleted file mode 100644
index 2e61218a0f..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Initialize.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// 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 InsertBuiltInFunctions(sh::GLenum type,
- ShShaderSpec spec,
- const ShBuiltInResources &resources,
- TSymbolTable &table);
-
-void IdentifyBuiltIns(sh::GLenum type,
- ShShaderSpec spec,
- const ShBuiltInResources &resources,
- TSymbolTable &symbolTable);
-
-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/src/3rdparty/angle/src/compiler/translator/InitializeDll.cpp b/src/3rdparty/angle/src/compiler/translator/InitializeDll.cpp
deleted file mode 100644
index 43c215f52b..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/InitializeDll.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/translator/Cache.h"
-#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;
- }
-
- TCache::initialize();
-
- return true;
-}
-
-void DetachProcess()
-{
- FreePoolIndex();
- TCache::destroy();
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/InitializeDll.h b/src/3rdparty/angle/src/compiler/translator/InitializeDll.h
deleted file mode 100644
index 87f7251470..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/InitializeDll.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-#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/src/3rdparty/angle/src/compiler/translator/InitializeGlobals.h b/src/3rdparty/angle/src/compiler/translator/InitializeGlobals.h
deleted file mode 100644
index 9a67ed0e04..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/InitializeGlobals.h
+++ /dev/null
@@ -1,13 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_TRANSLATOR_INITIALIZEGLOBALS_H_
-#define COMPILER_TRANSLATOR_INITIALIZEGLOBALS_H_
-
-bool InitializePoolIndex();
-void FreePoolIndex();
-
-#endif // COMPILER_TRANSLATOR_INITIALIZEGLOBALS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp b/src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp
deleted file mode 100644
index aa1a042fac..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-//
-// 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/InitializeVariables.h"
-
-#include "angle_gl.h"
-#include "common/debug.h"
-#include "compiler/translator/FindMain.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.h"
-#include "compiler/translator/util.h"
-
-namespace sh
-{
-
-namespace
-{
-
-void AddArrayZeroInitSequence(const TIntermTyped *initializedNode,
- bool canUseLoopsToInitialize,
- TIntermSequence *initSequenceOut,
- TSymbolTable *symbolTable);
-
-void AddStructZeroInitSequence(const TIntermTyped *initializedNode,
- bool canUseLoopsToInitialize,
- 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,
- TIntermSequence *initSequenceOut,
- TSymbolTable *symbolTable)
-{
- if (initializedNode->isArray())
- {
- AddArrayZeroInitSequence(initializedNode, canUseLoopsToInitialize, initSequenceOut,
- symbolTable);
- }
- else if (initializedNode->getType().isStructureContainingArrays() ||
- initializedNode->getType().isNamelessStruct())
- {
- AddStructZeroInitSequence(initializedNode, canUseLoopsToInitialize, initSequenceOut,
- symbolTable);
- }
- else
- {
- initSequenceOut->push_back(CreateZeroInitAssignment(initializedNode));
- }
-}
-
-void AddStructZeroInitSequence(const TIntermTyped *initializedNode,
- bool canUseLoopsToInitialize,
- 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, initSequenceOut, symbolTable);
- }
-}
-
-void AddArrayZeroInitStatementList(const TIntermTyped *initializedNode,
- bool canUseLoopsToInitialize,
- 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, initSequenceOut, symbolTable);
- }
-}
-
-void AddArrayZeroInitForLoop(const TIntermTyped *initializedNode,
- TIntermSequence *initSequenceOut,
- TSymbolTable *symbolTable)
-{
- ASSERT(initializedNode->isArray());
- TSymbolUniqueId indexSymbol(symbolTable);
-
- TIntermSymbol *indexSymbolNode = CreateTempSymbolNode(indexSymbol, TType(EbtInt), EvqTemporary);
- TIntermDeclaration *indexInit =
- CreateTempInitDeclarationNode(indexSymbol, CreateZeroNode(TType(EbtInt)), EvqTemporary);
- TIntermConstantUnion *arraySizeNode = CreateIndexNode(initializedNode->getOutermostArraySize());
- TIntermBinary *indexSmallerThanSize =
- new TIntermBinary(EOpLessThan, indexSymbolNode->deepCopy(), arraySizeNode);
- TIntermUnary *indexIncrement = new TIntermUnary(EOpPreIncrement, indexSymbolNode->deepCopy());
-
- TIntermBlock *forLoopBody = new TIntermBlock();
- TIntermSequence *forLoopBodySeq = forLoopBody->getSequence();
-
- TIntermBinary *element = new TIntermBinary(EOpIndexIndirect, initializedNode->deepCopy(),
- indexSymbolNode->deepCopy());
- AddZeroInitSequence(element, true, forLoopBodySeq, symbolTable);
-
- TIntermLoop *forLoop =
- new TIntermLoop(ELoopFor, indexInit, indexSmallerThanSize, indexIncrement, forLoopBody);
- initSequenceOut->push_back(forLoop);
-}
-
-void AddArrayZeroInitSequence(const TIntermTyped *initializedNode,
- bool canUseLoopsToInitialize,
- 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, initSequenceOut,
- symbolTable);
- }
- else
- {
- AddArrayZeroInitForLoop(initializedNode, initSequenceOut, symbolTable);
- }
-}
-
-void InsertInitCode(TIntermSequence *mainBody,
- const InitVariableList &variables,
- TSymbolTable *symbolTable,
- int shaderVersion,
- const TExtensionBehavior &extensionBehavior,
- bool canUseLoopsToInitialize)
-{
- for (const auto &var : variables)
- {
- TString name = TString(var.name.c_str());
- size_t pos = name.find_last_of('[');
- if (pos != TString::npos)
- {
- name = name.substr(0, pos);
- }
-
- TIntermTyped *initializedSymbol = nullptr;
- if (var.isBuiltIn())
- {
- initializedSymbol = ReferenceBuiltInVariable(name, *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(name, *symbolTable);
- }
- ASSERT(initializedSymbol != nullptr);
-
- TIntermSequence *initCode =
- CreateInitCode(initializedSymbol, canUseLoopsToInitialize, symbolTable);
- mainBody->insert(mainBody->begin(), initCode->begin(), initCode->end());
- }
-}
-
-class InitializeLocalsTraverser : public TIntermTraverser
-{
- public:
- InitializeLocalsTraverser(int shaderVersion,
- TSymbolTable *symbolTable,
- bool canUseLoopsToInitialize)
- : TIntermTraverser(true, false, false, symbolTable),
- mShaderVersion(shaderVersion),
- mCanUseLoopsToInitialize(canUseLoopsToInitialize)
- {
- }
-
- 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->getSymbol() == "")
- {
- 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, 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;
-};
-
-} // namespace anonymous
-
-TIntermSequence *CreateInitCode(const TIntermTyped *initializedSymbol,
- bool canUseLoopsToInitialize,
- TSymbolTable *symbolTable)
-{
- TIntermSequence *initCode = new TIntermSequence();
- AddZeroInitSequence(initializedSymbol, canUseLoopsToInitialize, initCode, symbolTable);
- return initCode;
-}
-
-void InitializeUninitializedLocals(TIntermBlock *root,
- int shaderVersion,
- bool canUseLoopsToInitialize,
- TSymbolTable *symbolTable)
-{
- InitializeLocalsTraverser traverser(shaderVersion, symbolTable, canUseLoopsToInitialize);
- root->traverse(&traverser);
- traverser.updateTree();
-}
-
-void InitializeVariables(TIntermBlock *root,
- const InitVariableList &vars,
- TSymbolTable *symbolTable,
- int shaderVersion,
- const TExtensionBehavior &extensionBehavior,
- bool canUseLoopsToInitialize)
-{
- TIntermBlock *body = FindMainBody(root);
- InsertInitCode(body->getSequence(), vars, symbolTable, shaderVersion, extensionBehavior,
- canUseLoopsToInitialize);
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h b/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h
deleted file mode 100644
index 1a7b3c0f24..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// 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_INITIALIZEVARIABLES_H_
-#define COMPILER_TRANSLATOR_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,
- TSymbolTable *symbolTable);
-
-// Initialize all uninitialized local variables, so that undefined behavior is avoided.
-void InitializeUninitializedLocals(TIntermBlock *root,
- int shaderVersion,
- bool canUseLoopsToInitialize,
- 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);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_INITIALIZEVARIABLES_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/IntermNode.cpp b/src/3rdparty/angle/src/compiler/translator/IntermNode.cpp
deleted file mode 100644
index a57ffcb4bc..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/IntermNode.cpp
+++ /dev/null
@@ -1,3330 +0,0 @@
-//
-// 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/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,
- TQualifier qualifier)
-{
- if (constArray == nullptr)
- {
- return nullptr;
- }
- TIntermTyped *folded = new TIntermConstantUnion(constArray, originalNode->getType());
- folded->getTypePointer()->setQualifier(qualifier);
- 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]);
-}
-
-} // namespace anonymous
-
-////////////////////////////////////////////////////////////////
-//
-// Member functions of the nodes used for building the tree.
-//
-////////////////////////////////////////////////////////////////
-
-void TIntermTyped::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) \
- if (node == original) \
- { \
- node = static_cast<type *>(replacement); \
- return true; \
- }
-
-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;
-}
-
-bool TIntermBranch::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
-{
- REPLACE_IF_IS(mExpression, TIntermTyped, original, replacement);
- return false;
-}
-
-bool TIntermSwizzle::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
-{
- ASSERT(original->getAsTyped()->getType() == replacement->getAsTyped()->getType());
- REPLACE_IF_IS(mOperand, TIntermTyped, original, replacement);
- return false;
-}
-
-bool TIntermBinary::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
-{
- REPLACE_IF_IS(mLeft, TIntermTyped, original, replacement);
- REPLACE_IF_IS(mRight, TIntermTyped, original, replacement);
- return false;
-}
-
-bool TIntermUnary::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
-{
- ASSERT(original->getAsTyped()->getType() == replacement->getAsTyped()->getType());
- REPLACE_IF_IS(mOperand, TIntermTyped, original, replacement);
- return false;
-}
-
-bool TIntermInvariantDeclaration::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
-{
- REPLACE_IF_IS(mSymbol, TIntermSymbol, original, replacement);
- return false;
-}
-
-bool TIntermFunctionDefinition::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
-{
- REPLACE_IF_IS(mPrototype, TIntermFunctionPrototype, original, replacement);
- REPLACE_IF_IS(mBody, TIntermBlock, original, replacement);
- return false;
-}
-
-bool TIntermAggregate::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
-{
- return replaceChildNodeInternal(original, replacement);
-}
-
-bool TIntermBlock::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
-{
- return replaceChildNodeInternal(original, replacement);
-}
-
-bool TIntermFunctionPrototype::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
-{
- return replaceChildNodeInternal(original, replacement);
-}
-
-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;
-}
-
-TIntermAggregate *TIntermAggregate::CreateFunctionCall(const TFunction &func,
- TIntermSequence *arguments)
-{
- TIntermAggregate *callNode =
- new TIntermAggregate(func.getReturnType(), EOpCallFunctionInAST, arguments);
- callNode->getFunctionSymbolInfo()->setFromFunction(func);
- return callNode;
-}
-
-TIntermAggregate *TIntermAggregate::CreateFunctionCall(const TType &type,
- const TSymbolUniqueId &id,
- const TName &name,
- TIntermSequence *arguments)
-{
- TIntermAggregate *callNode = new TIntermAggregate(type, EOpCallFunctionInAST, arguments);
- callNode->getFunctionSymbolInfo()->setId(id);
- callNode->getFunctionSymbolInfo()->setNameObj(name);
- return callNode;
-}
-
-TIntermAggregate *TIntermAggregate::CreateBuiltInFunctionCall(const TFunction &func,
- TIntermSequence *arguments)
-{
- TIntermAggregate *callNode =
- new TIntermAggregate(func.getReturnType(), EOpCallBuiltInFunction, arguments);
- callNode->getFunctionSymbolInfo()->setFromFunction(func);
- // Note that name needs to be set before texture function type is determined.
- callNode->setBuiltInFunctionPrecision();
- return callNode;
-}
-
-TIntermAggregate *TIntermAggregate::CreateConstructor(const TType &type,
- TIntermSequence *arguments)
-{
- return new TIntermAggregate(type, EOpConstruct, arguments);
-}
-
-TIntermAggregate *TIntermAggregate::Create(const TType &type,
- TOperator op,
- TIntermSequence *arguments)
-{
- TIntermAggregate *node = new TIntermAggregate(type, op, arguments);
- ASSERT(op != EOpCallFunctionInAST); // Should use CreateFunctionCall
- ASSERT(op != EOpCallBuiltInFunction); // Should use CreateBuiltInFunctionCall
- ASSERT(!node->isConstructor()); // Should use CreateConstructor
- return node;
-}
-
-TIntermAggregate::TIntermAggregate(const TType &type, TOperator op, TIntermSequence *arguments)
- : TIntermOperator(op), mUseEmulatedFunction(false), mGotPrecisionFromChildren(false)
-{
- if (arguments != nullptr)
- {
- mArguments.swap(*arguments);
- }
- setTypePrecisionAndQualifier(type);
-}
-
-void TIntermAggregate::setTypePrecisionAndQualifier(const TType &type)
-{
- setType(type);
- mType.setQualifier(EvqTemporary);
- 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 (mFunctionInfo.getName().find("textureSize") == 0)
- mType.setPrecision(EbpHigh);
- else
- mType.setPrecision(precision);
-}
-
-TString TIntermAggregate::getSymbolTableMangledName() const
-{
- ASSERT(!isConstructor());
- switch (mOp)
- {
- case EOpCallInternalRawFunction:
- case EOpCallBuiltInFunction:
- case EOpCallFunctionInAST:
- return TFunction::GetMangledNameFromCall(mFunctionInfo.getName(), mArguments);
- default:
- TString opString = GetOperatorString(mOp);
- return TFunction::GetMangledNameFromCall(opString, mArguments);
- }
-}
-
-bool TIntermAggregate::hasSideEffects() const
-{
- if (isFunctionCall() && mFunctionInfo.isKnownToNotHaveSideEffects())
- {
- 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 TIntermFunctionPrototype::appendParameter(TIntermSymbol *parameter)
-{
- ASSERT(parameter != nullptr);
- mParameters.push_back(parameter);
-}
-
-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);
-}
-
-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;
-}
-
-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;
-}
-
-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;
-}
-
-bool TIntermCase::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
-{
- REPLACE_IF_IS(mCondition, TIntermTyped, original, replacement);
- return false;
-}
-
-TIntermTyped::TIntermTyped(const TIntermTyped &node) : TIntermNode(), mType(node.mType)
-{
- // 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 besides handling fields in TIntermTyped.
- mLine = node.mLine;
-}
-
-bool TIntermTyped::isConstructorWithOnlyConstantUnionParameters()
-{
- TIntermAggregate *constructor = getAsAggregate();
- if (!constructor || !constructor->isConstructor())
- {
- return false;
- }
- for (TIntermNode *&node : *constructor->getSequence())
- {
- if (!node->getAsConstantUnion())
- return false;
- }
- return true;
-}
-
-TIntermConstantUnion::TIntermConstantUnion(const TIntermConstantUnion &node) : TIntermTyped(node)
-{
- mUnionArrayPointer = node.mUnionArrayPointer;
-}
-
-void TFunctionSymbolInfo::setFromFunction(const TFunction &function)
-{
- setName(function.getName());
- setId(TSymbolUniqueId(function));
-}
-
-TFunctionSymbolInfo::TFunctionSymbolInfo(const TSymbolUniqueId &id)
- : mId(new TSymbolUniqueId(id)), mKnownToNotHaveSideEffects(false)
-{
-}
-
-TFunctionSymbolInfo::TFunctionSymbolInfo(const TFunctionSymbolInfo &info)
- : mName(info.mName), mId(nullptr), mKnownToNotHaveSideEffects(info.mKnownToNotHaveSideEffects)
-{
- if (info.mId)
- {
- mId = new TSymbolUniqueId(*info.mId);
- }
-}
-
-TFunctionSymbolInfo &TFunctionSymbolInfo::operator=(const TFunctionSymbolInfo &info)
-{
- mName = info.mName;
- if (info.mId)
- {
- mId = new TSymbolUniqueId(*info.mId);
- }
- else
- {
- mId = nullptr;
- }
- return *this;
-}
-
-void TFunctionSymbolInfo::setId(const TSymbolUniqueId &id)
-{
- mId = new TSymbolUniqueId(id);
-}
-
-const TSymbolUniqueId &TFunctionSymbolInfo::getId() const
-{
- ASSERT(mId);
- return *mId;
-}
-
-TIntermAggregate::TIntermAggregate(const TIntermAggregate &node)
- : TIntermOperator(node),
- mUseEmulatedFunction(node.mUseEmulatedFunction),
- mGotPrecisionFromChildren(node.mGotPrecisionFromChildren),
- mFunctionInfo(node.mFunctionInfo)
-{
- 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(mType, mOp, copySeq);
- *copyNode->getFunctionSymbolInfo() = mFunctionInfo;
- copyNode->setLine(mLine);
- return copyNode;
-}
-
-TIntermSwizzle::TIntermSwizzle(const TIntermSwizzle &node) : TIntermTyped(node)
-{
- TIntermTyped *operandCopy = node.mOperand->deepCopy();
- ASSERT(operandCopy != nullptr);
- mOperand = operandCopy;
- mSwizzleOffsets = node.mSwizzleOffsets;
-}
-
-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)
-{
- TIntermTyped *operandCopy = node.mOperand->deepCopy();
- ASSERT(operandCopy != nullptr);
- mOperand = operandCopy;
-}
-
-TIntermTernary::TIntermTernary(const TIntermTernary &node) : TIntermTyped(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)
- : TIntermTyped(TType(EbtFloat, EbpUndefined)),
- mOperand(operand),
- mSwizzleOffsets(swizzleOffsets)
-{
- ASSERT(mSwizzleOffsets.size() <= 4);
- promote();
-}
-
-TIntermUnary::TIntermUnary(TOperator op, TIntermTyped *operand)
- : TIntermOperator(op), mOperand(operand), mUseEmulatedFunction(false)
-{
- promote();
-}
-
-TIntermBinary::TIntermBinary(TOperator op, TIntermTyped *left, TIntermTyped *right)
- : TIntermOperator(op), mLeft(left), mRight(right), mAddIndexClamp(false)
-{
- promote();
-}
-
-TIntermInvariantDeclaration::TIntermInvariantDeclaration(TIntermSymbol *symbol, const TSourceLoc &line)
- : TIntermNode(), mSymbol(symbol)
-{
- ASSERT(symbol);
- setLine(line);
-}
-
-TIntermTernary::TIntermTernary(TIntermTyped *cond,
- TIntermTyped *trueExpression,
- TIntermTyped *falseExpression)
- : TIntermTyped(trueExpression->getType()),
- mCondition(cond),
- mTrueExpression(trueExpression),
- mFalseExpression(falseExpression)
-{
- 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)
-{
- // 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(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()
-{
- if (mCondition->getAsConstantUnion())
- {
- if (mCondition->getAsConstantUnion()->getBConst(0))
- {
- mTrueExpression->getTypePointer()->setQualifier(mType.getQualifier());
- return mTrueExpression;
- }
- else
- {
- mFalseExpression->getTypePointer()->setQualifier(mType.getQualifier());
- 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
-{
- int offsetCount[4] = {0u, 0u, 0u, 0u};
- for (const auto offset : mSwizzleOffsets)
- {
- offsetCount[offset]++;
- if (offsetCount[offset] > 1)
- {
- return true;
- }
- }
- return false;
-}
-
-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;
- }
-}
-
-const TConstantUnion *TIntermConstantUnion::foldIndexing(int index)
-{
- if (isArray())
- {
- ASSERT(index < static_cast<int>(getType().getOutermostArraySize()));
- TType arrayElementType = getType();
- arrayElementType.toArrayElementType();
- size_t arrayElementSize = arrayElementType.getObjectSize();
- return &mUnionArrayPointer[arrayElementSize * index];
- }
- else if (isMatrix())
- {
- ASSERT(index < getType().getCols());
- int size = getType().getRows();
- return &mUnionArrayPointer[size * index];
- }
- else if (isVector())
- {
- ASSERT(index < getType().getNominalSize());
- return &mUnionArrayPointer[index];
- }
- else
- {
- UNREACHABLE();
- return nullptr;
- }
-}
-
-TIntermTyped *TIntermSwizzle::fold()
-{
- 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] = *operandConstant->foldIndexing(mSwizzleOffsets.at(i));
- }
- return CreateFoldedNode(constArray, this, mType.getQualifier());
-}
-
-TIntermTyped *TIntermBinary::fold(TDiagnostics *diagnostics)
-{
- TIntermConstantUnion *leftConstant = mLeft->getAsConstantUnion();
- TIntermConstantUnion *rightConstant = mRight->getAsConstantUnion();
- switch (mOp)
- {
- case EOpComma:
- {
- if (mLeft->hasSideEffects())
- {
- return this;
- }
- mRight->getTypePointer()->setQualifier(mType.getQualifier());
- return mRight;
- }
- case EOpIndexDirect:
- {
- if (leftConstant == nullptr || rightConstant == nullptr)
- {
- return this;
- }
- int index = rightConstant->getIConst(0);
-
- const TConstantUnion *constArray = leftConstant->foldIndexing(index);
- if (!constArray)
- {
- return this;
- }
- return CreateFoldedNode(constArray, this, mType.getQualifier());
- }
- case EOpIndexDirectStruct:
- {
- if (leftConstant == nullptr || rightConstant == nullptr)
- {
- return this;
- }
- const TFieldList &fields = mLeft->getType().getStruct()->fields();
- size_t index = static_cast<size_t>(rightConstant->getIConst(0));
-
- size_t previousFieldsSize = 0;
- for (size_t i = 0; i < index; ++i)
- {
- previousFieldsSize += fields[i]->type()->getObjectSize();
- }
-
- const TConstantUnion *constArray = leftConstant->getUnionArrayPointer();
- return CreateFoldedNode(constArray + previousFieldsSize, this, mType.getQualifier());
- }
- case EOpIndexIndirect:
- case EOpIndexDirectInterfaceBlock:
- // Can never be constant folded.
- return this;
- default:
- {
- if (leftConstant == nullptr || rightConstant == nullptr)
- {
- return this;
- }
- TConstantUnion *constArray =
- leftConstant->foldBinary(mOp, rightConstant, diagnostics, mLeft->getLine());
- if (!constArray)
- {
- return this;
- }
-
- // Nodes may be constant folded without being qualified as constant.
- return CreateFoldedNode(constArray, this, mType.getQualifier());
- }
- }
-}
-
-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;
- }
-
- // Nodes may be constant folded without being qualified as constant.
- return CreateFoldedNode(constArray, this, mType.getQualifier());
-}
-
-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;
- }
- }
- TConstantUnion *constArray = nullptr;
- if (isConstructor())
- constArray = TIntermConstantUnion::FoldAggregateConstructor(this);
- else
- constArray = TIntermConstantUnion::FoldAggregateBuiltIn(this, diagnostics);
-
- // Nodes may be constant folded without being qualified as constant.
- return CreateFoldedNode(constArray, this, getQualifier());
-}
-
-//
-// 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.
-//
-TConstantUnion *TIntermConstantUnion::foldBinary(TOperator op,
- TIntermConstantUnion *rightNode,
- TDiagnostics *diagnostics,
- const TSourceLoc &line)
-{
- const TConstantUnion *leftArray = getUnionArrayPointer();
- const TConstantUnion *rightArray = rightNode->getUnionArrayPointer();
-
- ASSERT(leftArray && rightArray);
-
- size_t objectSize = getType().getObjectSize();
-
- // for a case like float f = vec4(2, 3, 4, 5) + 1.2;
- if (rightNode->getType().getObjectSize() == 1 && objectSize > 1)
- {
- rightArray = Vectorize(*rightNode->getUnionArrayPointer(), objectSize);
- }
- else if (rightNode->getType().getObjectSize() > 1 && objectSize == 1)
- {
- // for a case like float f = 1.2 + vec4(2, 3, 4, 5);
- leftArray = Vectorize(*getUnionArrayPointer(), rightNode->getType().getObjectSize());
- objectSize = rightNode->getType().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(getType().getBasicType() == EbtFloat && rightNode->getBasicType() == EbtFloat);
-
- const int leftCols = getCols();
- const int leftRows = getRows();
- const int rightCols = rightNode->getType().getCols();
- const int rightRows = rightNode->getType().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++)
- {
- switch (getType().getBasicType())
- {
- case EbtFloat:
- {
- ASSERT(op == EOpDiv);
- float dividend = leftArray[i].getFConst();
- float divisor = rightArray[i].getFConst();
- if (divisor == 0.0f)
- {
- if (dividend == 0.0f)
- {
- diagnostics->warning(
- getLine(),
- "Zero divided by zero during constant folding generated NaN",
- "/");
- resultArray[i].setFConst(std::numeric_limits<float>::quiet_NaN());
- }
- else
- {
- diagnostics->warning(getLine(),
- "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(getLine(),
- "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(
- getLine(), "Constant folded division overflowed to infinity",
- "/");
- }
- resultArray[i].setFConst(result);
- }
- break;
- }
- case EbtInt:
- if (rightArray[i] == 0)
- {
- diagnostics->warning(
- getLine(), "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(getLine(),
- "Negative modulus operator operand "
- "encountered during constant folding",
- "%");
- resultArray[i].setIConst(0);
- }
- else
- {
- resultArray[i].setIConst(lhs % divisor);
- }
- }
- }
- break;
-
- case EbtUInt:
- if (rightArray[i] == 0)
- {
- diagnostics->warning(
- getLine(), "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(rightNode->getBasicType() == EbtFloat);
-
- const int matrixCols = getCols();
- const int matrixRows = 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(getType().getBasicType() == EbtFloat);
-
- const int matrixCols = rightNode->getType().getCols();
- const int matrixRows = rightNode->getType().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(getType().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 = getUnionArrayPointer();
- 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 = getUnionArrayPointer();
- 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::FoldAggregateConstructor(TIntermAggregate *aggregate)
-{
- ASSERT(aggregate->getSequence()->size() > 0u);
- size_t resultSize = aggregate->getType().getObjectSize();
- TConstantUnion *resultArray = new TConstantUnion[resultSize];
- TBasicType basicType = aggregate->getBasicType();
-
- size_t resultIndex = 0u;
-
- if (aggregate->getSequence()->size() == 1u)
- {
- TIntermNode *argument = aggregate->getSequence()->front();
- TIntermConstantUnion *argumentConstant = argument->getAsConstantUnion();
- const TConstantUnion *argumentUnionArray = argumentConstant->getUnionArrayPointer();
- // Check the special case of constructing a matrix diagonal from a single scalar,
- // or a vector from a single scalar.
- if (argumentConstant->getType().getObjectSize() == 1u)
- {
- if (aggregate->isMatrix())
- {
- int resultCols = aggregate->getType().getCols();
- int resultRows = aggregate->getType().getRows();
- for (int col = 0; col < resultCols; ++col)
- {
- for (int row = 0; row < resultRows; ++row)
- {
- if (col == row)
- {
- resultArray[resultIndex].cast(basicType, argumentUnionArray[0]);
- }
- else
- {
- resultArray[resultIndex].setFConst(0.0f);
- }
- ++resultIndex;
- }
- }
- }
- else
- {
- while (resultIndex < resultSize)
- {
- resultArray[resultIndex].cast(basicType, argumentUnionArray[0]);
- ++resultIndex;
- }
- }
- ASSERT(resultIndex == resultSize);
- return resultArray;
- }
- else if (aggregate->isMatrix() && argumentConstant->isMatrix())
- {
- // The special case of constructing a matrix from a matrix.
- int argumentCols = argumentConstant->getType().getCols();
- int argumentRows = argumentConstant->getType().getRows();
- int resultCols = aggregate->getType().getCols();
- int resultRows = aggregate->getType().getRows();
- for (int col = 0; col < resultCols; ++col)
- {
- for (int row = 0; row < resultRows; ++row)
- {
- if (col < argumentCols && row < argumentRows)
- {
- resultArray[resultIndex].cast(basicType,
- argumentUnionArray[col * argumentRows + row]);
- }
- else if (col == row)
- {
- resultArray[resultIndex].setFConst(1.0f);
- }
- else
- {
- resultArray[resultIndex].setFConst(0.0f);
- }
- ++resultIndex;
- }
- }
- ASSERT(resultIndex == resultSize);
- return resultArray;
- }
- }
-
- for (TIntermNode *&argument : *aggregate->getSequence())
- {
- TIntermConstantUnion *argumentConstant = argument->getAsConstantUnion();
- size_t argumentSize = argumentConstant->getType().getObjectSize();
- const TConstantUnion *argumentUnionArray = argumentConstant->getUnionArrayPointer();
- for (size_t i = 0u; i < argumentSize; ++i)
- {
- if (resultIndex >= resultSize)
- break;
- resultArray[resultIndex].cast(basicType, argumentUnionArray[i]);
- ++resultIndex;
- }
- }
- ASSERT(resultIndex == resultSize);
- return resultArray;
-}
-
-bool TIntermAggregate::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;
- }
-}
-
-// 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->getUnionArrayPointer();
- 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 size = (*arguments)[0]->getAsTyped()->getNominalSize();
- angle::Matrix<float> result =
- GetMatrix(unionArrays[0], size).compMult(GetMatrix(unionArrays[1], size));
- 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;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/IntermNode.h b/src/3rdparty/angle/src/compiler/translator/IntermNode.h
deleted file mode 100644
index 2170916201..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/IntermNode.h
+++ /dev/null
@@ -1,917 +0,0 @@
-//
-// 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/Operator.h"
-#include "compiler/translator/SymbolUniqueId.h"
-#include "compiler/translator/Types.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 TIntermRaw;
-class TIntermBranch;
-
-class TSymbolTable;
-class TFunction;
-
-// Encapsulate an identifier string and track whether it is coming from the original shader code
-// (not internal) or from ANGLE (internal). Usually internal names shouldn't be decorated or hashed.
-class TName
-{
- public:
- POOL_ALLOCATOR_NEW_DELETE();
- explicit TName(const TString &name) : mName(name), mIsInternal(false) {}
- TName() : mName(), mIsInternal(false) {}
- TName(const TName &) = default;
- TName &operator=(const TName &) = default;
-
- const TString &getString() const { return mName; }
- void setString(const TString &string) { mName = string; }
- bool isInternal() const { return mIsInternal; }
- void setInternal(bool isInternal) { mIsInternal = isInternal; }
-
- private:
- TString mName;
- bool mIsInternal;
-};
-
-//
-// 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 *) = 0;
- virtual TIntermTyped *getAsTyped() { return 0; }
- virtual TIntermConstantUnion *getAsConstantUnion() { return 0; }
- virtual TIntermFunctionDefinition *getAsFunctionDefinition() { return nullptr; }
- virtual TIntermAggregate *getAsAggregate() { return 0; }
- 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 0; }
- virtual TIntermUnary *getAsUnaryNode() { return 0; }
- virtual TIntermTernary *getAsTernaryNode() { return nullptr; }
- virtual TIntermIfElse *getAsIfElseNode() { return nullptr; }
- virtual TIntermSwitch *getAsSwitchNode() { return 0; }
- virtual TIntermCase *getAsCaseNode() { return 0; }
- virtual TIntermSymbol *getAsSymbolNode() { return 0; }
- virtual TIntermLoop *getAsLoopNode() { return 0; }
- virtual TIntermRaw *getAsRawNode() { return 0; }
- virtual TIntermBranch *getAsBranchNode() { return 0; }
-
- // Replace a child node. Return true if |original| is a child
- // node and it is replaced; otherwise, return false.
- virtual bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) = 0;
-
- protected:
- TSourceLoc mLine;
-};
-
-//
-// This is just to help yacc.
-//
-struct TIntermNodePair
-{
- TIntermNode *node1;
- TIntermNode *node2;
-};
-
-//
-// Intermediate class for nodes that have a type.
-//
-class TIntermTyped : public TIntermNode
-{
- public:
- TIntermTyped(const TType &t) : mType(t) {}
-
- virtual TIntermTyped *deepCopy() const = 0;
-
- TIntermTyped *getAsTyped() override { return this; }
-
- // 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;
-
- void setType(const TType &t) { mType = t; }
- void setTypePreservePrecision(const TType &t);
- const TType &getType() const { return mType; }
- TType *getTypePointer() { return &mType; }
-
- TBasicType getBasicType() const { return mType.getBasicType(); }
- TQualifier getQualifier() const { return mType.getQualifier(); }
- TPrecision getPrecision() const { return mType.getPrecision(); }
- TMemoryQualifier getMemoryQualifier() const { return mType.getMemoryQualifier(); }
- int getCols() const { return mType.getCols(); }
- int getRows() const { return mType.getRows(); }
- int getNominalSize() const { return mType.getNominalSize(); }
- int getSecondarySize() const { return mType.getSecondarySize(); }
-
- bool isInterfaceBlock() const { return mType.isInterfaceBlock(); }
- bool isMatrix() const { return mType.isMatrix(); }
- bool isArray() const { return mType.isArray(); }
- bool isVector() const { return mType.isVector(); }
- bool isScalar() const { return mType.isScalar(); }
- bool isScalarInt() const { return mType.isScalarInt(); }
- const char *getBasicString() const { return mType.getBasicString(); }
- TString getCompleteString() const { return mType.getCompleteString(); }
-
- unsigned int getOutermostArraySize() const { return mType.getOutermostArraySize(); }
-
- bool isConstructorWithOnlyConstantUnionParameters();
-
- protected:
- TType mType;
-
- 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) override;
- 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) {}
-
- void traverse(TIntermTraverser *it) override;
- TIntermBranch *getAsBranchNode() override { return this; }
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- TOperator getFlowOp() { return mFlowOp; }
- TIntermTyped *getExpression() { return mExpression; }
-
- protected:
- TOperator mFlowOp;
- TIntermTyped *mExpression; // non-zero except for "return exp;" statements
-};
-
-//
-// Nodes that correspond to symbols or constants in the source code.
-//
-class TIntermSymbol : public TIntermTyped
-{
- public:
- // if symbol is initialized as symbol(sym), the memory comes from the poolallocator of sym.
- // If sym comes from per process globalpoolallocator, then it causes increased memory usage
- // per compile it is essential to use "symbol = sym" to assign to symbol
- TIntermSymbol(const TSymbolUniqueId &id, const TString &symbol, const TType &type)
- : TIntermTyped(type), mId(id), mSymbol(symbol)
- {
- }
-
- TIntermTyped *deepCopy() const override { return new TIntermSymbol(*this); }
-
- bool hasSideEffects() const override { return false; }
-
- int getId() const { return mId.get(); }
- const TString &getSymbol() const { return mSymbol.getString(); }
- const TName &getName() const { return mSymbol; }
- TName &getName() { return mSymbol; }
-
- void setInternal(bool internal) { mSymbol.setInternal(internal); }
-
- void traverse(TIntermTraverser *it) override;
- TIntermSymbol *getAsSymbolNode() override { return this; }
- bool replaceChildNode(TIntermNode *, TIntermNode *) override { return false; }
-
- protected:
- const TSymbolUniqueId mId;
- TName mSymbol;
-
- private:
- TIntermSymbol(const TIntermSymbol &) = default; // Note: not deleted, just private!
-};
-
-// A Raw node stores raw code, that the translator will insert verbatim
-// into the output stream. Useful for transformation operations that make
-// complex code that might not fit naturally into the GLSL model.
-class TIntermRaw : public TIntermTyped
-{
- public:
- TIntermRaw(const TType &type, const TString &rawText) : TIntermTyped(type), mRawText(rawText) {}
- TIntermRaw(const TIntermRaw &) = delete;
-
- TIntermTyped *deepCopy() const override
- {
- UNREACHABLE();
- return nullptr;
- }
-
- bool hasSideEffects() const override { return false; }
-
- TString getRawText() const { return mRawText; }
-
- void traverse(TIntermTraverser *it) override;
-
- TIntermRaw *getAsRawNode() override { return this; }
- bool replaceChildNode(TIntermNode *, TIntermNode *) override { return false; }
-
- protected:
- TString mRawText;
-};
-
-// 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 TIntermTyped
-{
- public:
- TIntermConstantUnion(const TConstantUnion *unionPointer, const TType &type)
- : TIntermTyped(type), mUnionArrayPointer(unionPointer)
- {
- ASSERT(unionPointer);
- }
-
- TIntermTyped *deepCopy() const override { return new TIntermConstantUnion(*this); }
-
- bool hasSideEffects() const override { return false; }
-
- const TConstantUnion *getUnionArrayPointer() const { return mUnionArrayPointer; }
-
- int getIConst(size_t index) const
- {
- return mUnionArrayPointer ? mUnionArrayPointer[index].getIConst() : 0;
- }
- unsigned int getUConst(size_t index) const
- {
- return mUnionArrayPointer ? mUnionArrayPointer[index].getUConst() : 0;
- }
- float getFConst(size_t index) const
- {
- return mUnionArrayPointer ? mUnionArrayPointer[index].getFConst() : 0.0f;
- }
- bool getBConst(size_t index) const
- {
- return mUnionArrayPointer ? mUnionArrayPointer[index].getBConst() : false;
- }
-
- void replaceConstantUnion(const TConstantUnion *safeConstantUnion)
- {
- ASSERT(safeConstantUnion);
- // Previous union pointer freed on pool deallocation.
- mUnionArrayPointer = safeConstantUnion;
- }
-
- TIntermConstantUnion *getAsConstantUnion() override { return this; }
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *, TIntermNode *) override { return false; }
-
- TConstantUnion *foldBinary(TOperator op,
- TIntermConstantUnion *rightNode,
- TDiagnostics *diagnostics,
- const TSourceLoc &line);
- const TConstantUnion *foldIndexing(int index);
- TConstantUnion *foldUnaryNonComponentWise(TOperator op);
- TConstantUnion *foldUnaryComponentWise(TOperator op, TDiagnostics *diagnostics);
-
- static TConstantUnion *FoldAggregateConstructor(TIntermAggregate *aggregate);
- static TConstantUnion *FoldAggregateBuiltIn(TIntermAggregate *aggregate,
- TDiagnostics *diagnostics);
-
- 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 TIntermTyped
-{
- 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) : TIntermTyped(TType(EbtFloat, EbpUndefined)), mOp(op) {}
- TIntermOperator(TOperator op, const TType &type) : TIntermTyped(type), mOp(op) {}
-
- TIntermOperator(const TIntermOperator &) = default;
-
- const TOperator mOp;
-};
-
-// Node for vector swizzles.
-class TIntermSwizzle : public TIntermTyped
-{
- 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; };
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- bool hasSideEffects() const override { return mOperand->hasSideEffects(); }
-
- TIntermTyped *getOperand() { return mOperand; }
- void writeOffsetsAsXYZW(TInfoSinkBase *out) const;
-
- bool hasDuplicateOffsets() const;
- bool offsetsMatch(int offset) const;
-
- TIntermTyped *fold();
-
- protected:
- TIntermTyped *mOperand;
- TVector<int> mSwizzleOffsets;
-
- 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);
-
- TIntermTyped *deepCopy() const override { return new TIntermBinary(*this); }
-
- static TOperator GetMulOpBasedOnOperands(const TType &left, const TType &right);
- static TOperator GetMulAssignOpBasedOnOperands(const TType &left, const TType &right);
- static TQualifier GetCommaQualifier(int shaderVersion,
- const TIntermTyped *left,
- const TIntermTyped *right);
-
- TIntermBinary *getAsBinaryNode() override { return this; };
- void traverse(TIntermTraverser *it) override;
- 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);
-
- void setAddIndexClamp() { mAddIndexClamp = true; }
- bool getAddIndexClamp() { return mAddIndexClamp; }
-
- protected:
- TIntermTyped *mLeft;
- TIntermTyped *mRight;
-
- // If set to true, wrap any EOpIndexIndirect with a clamp to bounds.
- bool mAddIndexClamp;
-
- private:
- void promote();
-
- TIntermBinary(const TIntermBinary &node); // Note: not deleted, just private!
-};
-
-//
-// Nodes for unary math operators.
-//
-class TIntermUnary : public TIntermOperator
-{
- public:
- TIntermUnary(TOperator op, TIntermTyped *operand);
-
- TIntermTyped *deepCopy() const override { return new TIntermUnary(*this); }
-
- void traverse(TIntermTraverser *it) override;
- TIntermUnary *getAsUnaryNode() override { return this; }
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- bool hasSideEffects() const override { return isAssignment() || mOperand->hasSideEffects(); }
-
- TIntermTyped *getOperand() { return mOperand; }
- TIntermTyped *fold(TDiagnostics *diagnostics);
-
- 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;
-
- private:
- void promote();
-
- TIntermUnary(const TIntermUnary &node); // note: not deleted, just private!
-};
-
-class TFunctionSymbolInfo
-{
- public:
- POOL_ALLOCATOR_NEW_DELETE();
- TFunctionSymbolInfo(const TSymbolUniqueId &id);
- TFunctionSymbolInfo() : mId(nullptr), mKnownToNotHaveSideEffects(false) {}
-
- TFunctionSymbolInfo(const TFunctionSymbolInfo &info);
- TFunctionSymbolInfo &operator=(const TFunctionSymbolInfo &info);
-
- void setFromFunction(const TFunction &function);
-
- void setNameObj(const TName &name) { mName = name; }
- const TName &getNameObj() const { return mName; }
-
- const TString &getName() const { return mName.getString(); }
- void setName(const TString &name) { mName.setString(name); }
- bool isMain() const { return mName.getString() == "main"; }
-
- void setKnownToNotHaveSideEffects(bool knownToNotHaveSideEffects)
- {
- mKnownToNotHaveSideEffects = knownToNotHaveSideEffects;
- }
- bool isKnownToNotHaveSideEffects() const { return mKnownToNotHaveSideEffects; }
-
- void setId(const TSymbolUniqueId &functionId);
- const TSymbolUniqueId &getId() const;
-
- bool isImageFunction() const
- {
- return getName() == "imageSize" || getName() == "imageLoad" || getName() == "imageStore";
- }
-
- private:
- TName mName;
- TSymbolUniqueId *mId;
- bool mKnownToNotHaveSideEffects;
-};
-
-typedef TVector<TIntermNode *> TIntermSequence;
-typedef TVector<int> TQualifierList;
-
-//
-// This is just to help yacc.
-//
-struct TIntermFunctionCallOrMethod
-{
- TIntermSequence *arguments;
- TIntermNode *thisNode;
-};
-
-// 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);
-
- // If using this, ensure that there's a consistent function definition with the same symbol id
- // added to the AST.
- static TIntermAggregate *CreateFunctionCall(const TType &type,
- const TSymbolUniqueId &id,
- const TName &name,
- TIntermSequence *arguments);
-
- static TIntermAggregate *CreateBuiltInFunctionCall(const TFunction &func,
- TIntermSequence *arguments);
- static TIntermAggregate *CreateConstructor(const TType &type,
- TIntermSequence *arguments);
- static TIntermAggregate *Create(const TType &type, TOperator op, 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;
-
- TIntermAggregate *getAsAggregate() override { return this; }
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- bool hasSideEffects() const override;
-
- static bool CanFoldAggregateBuiltInOp(TOperator op);
- TIntermTyped *fold(TDiagnostics *diagnostics);
-
- TIntermSequence *getSequence() override { return &mArguments; }
- const TIntermSequence *getSequence() const override { return &mArguments; }
-
- TString getSymbolTableMangledName() const;
-
- void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
- bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
-
- // Returns true if changing parameter precision may affect the return value.
- bool gotPrecisionFromChildren() const { return mGotPrecisionFromChildren; }
-
- TFunctionSymbolInfo *getFunctionSymbolInfo() { return &mFunctionInfo; }
- const TFunctionSymbolInfo *getFunctionSymbolInfo() const { return &mFunctionInfo; }
-
- 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;
-
- TFunctionSymbolInfo mFunctionInfo;
-
- private:
- TIntermAggregate(const TType &type, TOperator op, TIntermSequence *arguments);
-
- TIntermAggregate(const TIntermAggregate &node); // note: not deleted, just private!
-
- void setTypePrecisionAndQualifier(const TType &type);
-
- 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) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- // Only intended for initially building the block.
- void appendStatement(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 TIntermAggregateBase
-{
- public:
- // TODO(oetuaho@nvidia.com): See if TFunctionSymbolInfo could be added to constructor
- // parameters.
- TIntermFunctionPrototype(const TType &type, const TSymbolUniqueId &id)
- : TIntermTyped(type), mFunctionInfo(id)
- {
- }
- ~TIntermFunctionPrototype() {}
-
- TIntermFunctionPrototype *getAsFunctionPrototypeNode() override { return this; }
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- TIntermTyped *deepCopy() const override
- {
- UNREACHABLE();
- return nullptr;
- }
- bool hasSideEffects() const override
- {
- UNREACHABLE();
- return true;
- }
-
- // Only intended for initially building the declaration.
- void appendParameter(TIntermSymbol *parameter);
-
- TIntermSequence *getSequence() override { return &mParameters; }
- const TIntermSequence *getSequence() const override { return &mParameters; }
-
- TFunctionSymbolInfo *getFunctionSymbolInfo() { return &mFunctionInfo; }
- const TFunctionSymbolInfo *getFunctionSymbolInfo() const { return &mFunctionInfo; }
-
- protected:
- TIntermSequence mParameters;
-
- TFunctionSymbolInfo mFunctionInfo;
-};
-
-// 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) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- TIntermFunctionPrototype *getFunctionPrototype() const { return mPrototype; }
- TIntermBlock *getBody() const { return mBody; }
-
- const TFunctionSymbolInfo *getFunctionSymbolInfo() const
- {
- return mPrototype->getFunctionSymbolInfo();
- }
-
- 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; }
- void traverse(TIntermTraverser *it) override;
- 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; }
-
- TIntermSymbol *getSymbol() { return mSymbol; }
-
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- private:
- TIntermSymbol *mSymbol;
-};
-
-// For ternary operators like a ? b : c.
-class TIntermTernary : public TIntermTyped
-{
- public:
- TIntermTernary(TIntermTyped *cond, TIntermTyped *trueExpression, TIntermTyped *falseExpression);
-
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- TIntermTyped *getCondition() const { return mCondition; }
- TIntermTyped *getTrueExpression() const { return mTrueExpression; }
- TIntermTyped *getFalseExpression() const { return mFalseExpression; }
- TIntermTernary *getAsTernaryNode() override { return this; }
-
- TIntermTyped *deepCopy() const override { return new TIntermTernary(*this); }
-
- bool hasSideEffects() const override
- {
- return mCondition->hasSideEffects() || mTrueExpression->hasSideEffects() ||
- mFalseExpression->hasSideEffects();
- }
-
- TIntermTyped *fold();
-
- 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);
-
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- TIntermTyped *getCondition() const { return mCondition; }
- TIntermBlock *getTrueBlock() const { return mTrueBlock; }
- TIntermBlock *getFalseBlock() const { return mFalseBlock; }
- TIntermIfElse *getAsIfElseNode() override { return this; }
-
- protected:
- TIntermTyped *mCondition;
- TIntermBlock *mTrueBlock;
- TIntermBlock *mFalseBlock;
-};
-
-//
-// Switch statement.
-//
-class TIntermSwitch : public TIntermNode
-{
- public:
- TIntermSwitch(TIntermTyped *init, TIntermBlock *statementList);
-
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- TIntermSwitch *getAsSwitchNode() override { return this; }
-
- 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) {}
-
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- TIntermCase *getAsCaseNode() override { return this; }
-
- bool hasCondition() const { return mCondition != nullptr; }
- TIntermTyped *getCondition() const { return mCondition; }
-
- protected:
- TIntermTyped *mCondition;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_INTERMNODE_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/IntermNodePatternMatcher.cpp b/src/3rdparty/angle/src/compiler/translator/IntermNodePatternMatcher.cpp
deleted file mode 100644
index 567e8f7440..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/IntermNodePatternMatcher.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-//
-// 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/IntermNodePatternMatcher.h"
-
-#include "compiler/translator/IntermNode.h"
-
-namespace sh
-{
-
-IntermNodePatternMatcher::IntermNodePatternMatcher(const unsigned int mask) : mMask(mask)
-{
-}
-
-// 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;
- }
- }
- }
- 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()->name() == "")
- {
- return true;
- }
- }
- return false;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/IntermNodePatternMatcher.h b/src/3rdparty/angle/src/compiler/translator/IntermNodePatternMatcher.h
deleted file mode 100644
index 997fc2ef10..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/IntermNodePatternMatcher.h
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// 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_INTERMNODEPATTERNMATCHER_H_
-#define COMPILER_TRANSLATOR_INTERMNODEPATTERNMATCHER_H_
-
-namespace sh
-{
-
-class TIntermAggregate;
-class TIntermBinary;
-class TIntermDeclaration;
-class TIntermNode;
-class TIntermTernary;
-class TIntermUnary;
-
-class IntermNodePatternMatcher
-{
- public:
- 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
- };
- 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
diff --git a/src/3rdparty/angle/src/compiler/translator/IntermNode_util.cpp b/src/3rdparty/angle/src/compiler/translator/IntermNode_util.cpp
deleted file mode 100644
index 9f1f596c43..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/IntermNode_util.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-//
-// 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/IntermNode_util.h"
-
-#include "compiler/translator/SymbolTable.h"
-
-namespace sh
-{
-
-namespace
-{
-
-TName GetInternalFunctionName(const char *name)
-{
- TString nameStr(name);
- TName nameObj(nameStr);
- nameObj.setInternal(true);
- return nameObj;
-}
-
-const TFunction *LookUpBuiltInFunction(const TString &name,
- const TIntermSequence *arguments,
- const TSymbolTable &symbolTable,
- int shaderVersion)
-{
- TString mangledName = TFunction::GetMangledNameFromCall(name, *arguments);
- TSymbol *symbol = symbolTable.findBuiltIn(mangledName, shaderVersion);
- if (symbol)
- {
- ASSERT(symbol->isFunction());
- return static_cast<const TFunction *>(symbol);
- }
- return nullptr;
-}
-
-} // anonymous namespace
-
-TIntermFunctionPrototype *CreateInternalFunctionPrototypeNode(const TType &returnType,
- const char *name,
- const TSymbolUniqueId &functionId)
-{
- TIntermFunctionPrototype *functionNode = new TIntermFunctionPrototype(returnType, functionId);
- functionNode->getFunctionSymbolInfo()->setNameObj(GetInternalFunctionName(name));
- return functionNode;
-}
-
-TIntermFunctionDefinition *CreateInternalFunctionDefinitionNode(const TType &returnType,
- const char *name,
- TIntermBlock *functionBody,
- const TSymbolUniqueId &functionId)
-{
- TIntermFunctionPrototype *prototypeNode =
- CreateInternalFunctionPrototypeNode(returnType, name, functionId);
- return new TIntermFunctionDefinition(prototypeNode, functionBody);
-}
-
-TIntermAggregate *CreateInternalFunctionCallNode(const TType &returnType,
- const char *name,
- const TSymbolUniqueId &functionId,
- TIntermSequence *arguments)
-{
- TIntermAggregate *functionNode = TIntermAggregate::CreateFunctionCall(
- returnType, functionId, GetInternalFunctionName(name), arguments);
- return functionNode;
-}
-
-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;
- }
-
- if (type.getBasicType() == EbtVoid)
- {
- // Void array. This happens only on error condition, similarly to the case above. We don't
- // have a constructor operator for void, so this needs special handling. We'll end up with a
- // value without the array type, but that should not be a problem.
- while (constType.isArray())
- {
- constType.toArrayElementType();
- }
- return CreateZeroNode(constType);
- }
-
- 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;
-}
-
-TIntermSymbol *CreateTempSymbolNode(const TSymbolUniqueId &id,
- const TType &type,
- TQualifier qualifier)
-{
- TInfoSinkBase symbolNameOut;
- symbolNameOut << "s" << id.get();
- TString symbolName = symbolNameOut.c_str();
-
- TIntermSymbol *node = new TIntermSymbol(id, symbolName, type);
- node->setInternal(true);
-
- ASSERT(qualifier == EvqTemporary || qualifier == EvqConst || qualifier == EvqGlobal);
- node->getTypePointer()->setQualifier(qualifier);
-
- // TODO(oetuaho): Might be useful to sanitize layout qualifier etc. on the type of the created
- // symbol. This might need to be done in other places as well.
- return node;
-}
-
-TIntermDeclaration *CreateTempInitDeclarationNode(const TSymbolUniqueId &id,
- TIntermTyped *initializer,
- TQualifier qualifier)
-{
- ASSERT(initializer != nullptr);
- TIntermSymbol *tempSymbol = CreateTempSymbolNode(id, initializer->getType(), qualifier);
- TIntermDeclaration *tempDeclaration = new TIntermDeclaration();
- TIntermBinary *tempInit = new TIntermBinary(EOpInitialize, tempSymbol, initializer);
- tempDeclaration->appendDeclarator(tempInit);
- return tempDeclaration;
-}
-
-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 TString &name, const TSymbolTable &symbolTable)
-{
- TVariable *var = reinterpret_cast<TVariable *>(symbolTable.findGlobal(name));
- ASSERT(var);
- return new TIntermSymbol(var->getUniqueId(), name, var->getType());
-}
-
-TIntermSymbol *ReferenceBuiltInVariable(const TString &name,
- const TSymbolTable &symbolTable,
- int shaderVersion)
-{
- const TVariable *var =
- reinterpret_cast<const TVariable *>(symbolTable.findBuiltIn(name, shaderVersion, true));
- ASSERT(var);
- return new TIntermSymbol(var->getUniqueId(), name, var->getType());
-}
-
-TIntermTyped *CreateBuiltInFunctionCallNode(const TString &name,
- TIntermSequence *arguments,
- const TSymbolTable &symbolTable,
- int shaderVersion)
-{
- const TFunction *fn = LookUpBuiltInFunction(name, arguments, symbolTable, shaderVersion);
- ASSERT(fn);
- TOperator op = fn->getBuiltInOp();
- if (op != EOpNull)
- {
- if (arguments->size() == 1)
- {
- return new TIntermUnary(op, arguments->at(0)->getAsTyped());
- }
- return TIntermAggregate::Create(fn->getReturnType(), op, arguments);
- }
- return TIntermAggregate::CreateBuiltInFunctionCall(*fn, arguments);
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/IntermNode_util.h b/src/3rdparty/angle/src/compiler/translator/IntermNode_util.h
deleted file mode 100644
index 6f3b0674f0..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/IntermNode_util.h
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// 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"
-
-namespace sh
-{
-
-TIntermFunctionPrototype *CreateInternalFunctionPrototypeNode(const TType &returnType,
- const char *name,
- const TSymbolUniqueId &functionId);
-TIntermFunctionDefinition *CreateInternalFunctionDefinitionNode(const TType &returnType,
- const char *name,
- TIntermBlock *functionBody,
- const TSymbolUniqueId &functionId);
-TIntermAggregate *CreateInternalFunctionCallNode(const TType &returnType,
- const char *name,
- const TSymbolUniqueId &functionId,
- TIntermSequence *arguments);
-
-TIntermTyped *CreateZeroNode(const TType &type);
-TIntermConstantUnion *CreateIndexNode(int index);
-TIntermConstantUnion *CreateBoolNode(bool value);
-
-TIntermSymbol *CreateTempSymbolNode(const TSymbolUniqueId &id,
- const TType &type,
- TQualifier qualifier);
-TIntermDeclaration *CreateTempInitDeclarationNode(const TSymbolUniqueId &id,
- TIntermTyped *initializer,
- TQualifier qualifier);
-
-// 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 TString &name, const TSymbolTable &symbolTable);
-
-// Note: this can access desktop GLSL built-ins that are hidden from the parser.
-TIntermSymbol *ReferenceBuiltInVariable(const TString &name,
- const TSymbolTable &symbolTable,
- int shaderVersion);
-
-TIntermTyped *CreateBuiltInFunctionCallNode(const TString &name,
- TIntermSequence *arguments,
- const TSymbolTable &symbolTable,
- int shaderVersion);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_INTERMNODEUTIL_H_ \ No newline at end of file
diff --git a/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp b/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp
deleted file mode 100644
index 6c25c6c35a..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp
+++ /dev/null
@@ -1,983 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/translator/IntermTraverse.h"
-
-#include "compiler/translator/InfoSink.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/SymbolTable.h"
-
-namespace sh
-{
-
-void TIntermSymbol::traverse(TIntermTraverser *it)
-{
- it->traverseSymbol(this);
-}
-
-void TIntermRaw::traverse(TIntermTraverser *it)
-{
- it->traverseRaw(this);
-}
-
-void TIntermConstantUnion::traverse(TIntermTraverser *it)
-{
- it->traverseConstantUnion(this);
-}
-
-void TIntermSwizzle::traverse(TIntermTraverser *it)
-{
- it->traverseSwizzle(this);
-}
-
-void TIntermBinary::traverse(TIntermTraverser *it)
-{
- it->traverseBinary(this);
-}
-
-void TIntermUnary::traverse(TIntermTraverser *it)
-{
- it->traverseUnary(this);
-}
-
-void TIntermTernary::traverse(TIntermTraverser *it)
-{
- it->traverseTernary(this);
-}
-
-void TIntermIfElse::traverse(TIntermTraverser *it)
-{
- it->traverseIfElse(this);
-}
-
-void TIntermSwitch::traverse(TIntermTraverser *it)
-{
- it->traverseSwitch(this);
-}
-
-void TIntermCase::traverse(TIntermTraverser *it)
-{
- it->traverseCase(this);
-}
-
-void TIntermFunctionDefinition::traverse(TIntermTraverser *it)
-{
- it->traverseFunctionDefinition(this);
-}
-
-void TIntermBlock::traverse(TIntermTraverser *it)
-{
- it->traverseBlock(this);
-}
-
-void TIntermInvariantDeclaration::traverse(TIntermTraverser *it)
-{
- it->traverseInvariantDeclaration(this);
-}
-
-void TIntermDeclaration::traverse(TIntermTraverser *it)
-{
- it->traverseDeclaration(this);
-}
-
-void TIntermFunctionPrototype::traverse(TIntermTraverser *it)
-{
- it->traverseFunctionPrototype(this);
-}
-
-void TIntermAggregate::traverse(TIntermTraverser *it)
-{
- it->traverseAggregate(this);
-}
-
-void TIntermLoop::traverse(TIntermTraverser *it)
-{
- it->traverseLoop(this);
-}
-
-void TIntermBranch::traverse(TIntermTraverser *it)
-{
- it->traverseBranch(this);
-}
-
-TIntermTraverser::TIntermTraverser(bool preVisit,
- bool inVisit,
- bool postVisit,
- TSymbolTable *symbolTable)
- : preVisit(preVisit),
- inVisit(inVisit),
- postVisit(postVisit),
- mDepth(-1),
- mMaxDepth(0),
- mInGlobalScope(true),
- mSymbolTable(symbolTable),
- mTemporaryId(nullptr)
-{
-}
-
-TIntermTraverser::~TIntermTraverser()
-{
-}
-
-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);
-}
-
-TIntermSymbol *TIntermTraverser::createTempSymbol(const TType &type, TQualifier qualifier)
-{
- ASSERT(mTemporaryId != nullptr);
- // nextTemporaryId() needs to be called when the code wants to start using another temporary
- // symbol.
- return CreateTempSymbolNode(*mTemporaryId, type, qualifier);
-}
-
-TIntermSymbol *TIntermTraverser::createTempSymbol(const TType &type)
-{
- return createTempSymbol(type, EvqTemporary);
-}
-
-TIntermDeclaration *TIntermTraverser::createTempDeclaration(const TType &type)
-{
- ASSERT(mTemporaryId != nullptr);
- TIntermDeclaration *tempDeclaration = new TIntermDeclaration();
- tempDeclaration->appendDeclarator(CreateTempSymbolNode(*mTemporaryId, type, EvqTemporary));
- return tempDeclaration;
-}
-
-TIntermDeclaration *TIntermTraverser::createTempInitDeclaration(TIntermTyped *initializer,
- TQualifier qualifier)
-{
- ASSERT(mTemporaryId != nullptr);
- return CreateTempInitDeclarationNode(*mTemporaryId, initializer, qualifier);
-}
-
-TIntermDeclaration *TIntermTraverser::createTempInitDeclaration(TIntermTyped *initializer)
-{
- return createTempInitDeclaration(initializer, EvqTemporary);
-}
-
-TIntermBinary *TIntermTraverser::createTempAssignment(TIntermTyped *rightNode)
-{
- ASSERT(rightNode != nullptr);
- TIntermSymbol *tempSymbol = createTempSymbol(rightNode->getType());
- TIntermBinary *assignment = new TIntermBinary(EOpAssign, tempSymbol, rightNode);
- return assignment;
-}
-
-void TIntermTraverser::nextTemporaryId()
-{
- ASSERT(mSymbolTable);
- if (!mTemporaryId)
- {
- mTemporaryId = new TSymbolUniqueId(mSymbolTable);
- return;
- }
- *mTemporaryId = TSymbolUniqueId(mSymbolTable);
-}
-
-void TLValueTrackingTraverser::addToFunctionMap(const TSymbolUniqueId &id,
- TIntermSequence *paramSequence)
-{
- mFunctionMap[id.get()] = paramSequence;
-}
-
-bool TLValueTrackingTraverser::isInFunctionMap(const TIntermAggregate *callNode) const
-{
- ASSERT(callNode->getOp() == EOpCallFunctionInAST);
- return (mFunctionMap.find(callNode->getFunctionSymbolInfo()->getId().get()) !=
- mFunctionMap.end());
-}
-
-TIntermSequence *TLValueTrackingTraverser::getFunctionParameters(const TIntermAggregate *callNode)
-{
- ASSERT(isInFunctionMap(callNode));
- return mFunctionMap[callNode->getFunctionSymbolInfo()->getId().get()];
-}
-
-void TLValueTrackingTraverser::setInFunctionCallOutParameter(bool inOutParameter)
-{
- mInFunctionCallOutParameter = inOutParameter;
-}
-
-bool TLValueTrackingTraverser::isInFunctionCallOutParameter() const
-{
- return mInFunctionCallOutParameter;
-}
-
-//
-// Traverse the intermediate representation tree, and
-// call a node type specific function for each node.
-// Done recursively through the member function Traverse().
-// Node types can be skipped if their function to call is 0,
-// but their subtree will still be traversed.
-// Nodes with children can have their whole subtree skipped
-// if preVisit is turned on and the type specific function
-// returns false.
-//
-
-//
-// Traversal functions for terminals are straighforward....
-//
-void TIntermTraverser::traverseSymbol(TIntermSymbol *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
- visitSymbol(node);
-}
-
-void TIntermTraverser::traverseConstantUnion(TIntermConstantUnion *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
- visitConstantUnion(node);
-}
-
-void TIntermTraverser::traverseSwizzle(TIntermSwizzle *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- if (preVisit)
- visit = visitSwizzle(PreVisit, node);
-
- if (visit)
- {
- node->getOperand()->traverse(this);
- }
-
- if (visit && postVisit)
- visitSwizzle(PostVisit, node);
-}
-
-//
-// Traverse a binary node.
-//
-void TIntermTraverser::traverseBinary(TIntermBinary *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- //
- // visit the node before children if pre-visiting.
- //
- if (preVisit)
- visit = visitBinary(PreVisit, node);
-
- //
- // Visit the children, in the right order.
- //
- if (visit)
- {
- if (node->getLeft())
- node->getLeft()->traverse(this);
-
- if (inVisit)
- visit = visitBinary(InVisit, node);
-
- if (visit && node->getRight())
- node->getRight()->traverse(this);
- }
-
- //
- // Visit the node after the children, if requested and the traversal
- // hasn't been cancelled yet.
- //
- if (visit && postVisit)
- visitBinary(PostVisit, node);
-}
-
-void TLValueTrackingTraverser::traverseBinary(TIntermBinary *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- //
- // visit the node before children if pre-visiting.
- //
- if (preVisit)
- visit = visitBinary(PreVisit, node);
-
- //
- // Visit the children, in the right order.
- //
- if (visit)
- {
- // Some binary operations like indexing can be inside an expression which must be an
- // l-value.
- bool parentOperatorRequiresLValue = operatorRequiresLValue();
- bool parentInFunctionCallOutParameter = isInFunctionCallOutParameter();
- if (node->isAssignment())
- {
- ASSERT(!isLValueRequiredHere());
- setOperatorRequiresLValue(true);
- }
-
- if (node->getLeft())
- node->getLeft()->traverse(this);
-
- if (inVisit)
- visit = visitBinary(InVisit, node);
-
- if (node->isAssignment())
- setOperatorRequiresLValue(false);
-
- // 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);
- }
-
- if (visit && node->getRight())
- 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 (visit && postVisit)
- visitBinary(PostVisit, node);
-}
-
-//
-// Traverse a unary node. Same comments in binary node apply here.
-//
-void TIntermTraverser::traverseUnary(TIntermUnary *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- if (preVisit)
- visit = visitUnary(PreVisit, node);
-
- if (visit)
- {
- node->getOperand()->traverse(this);
- }
-
- if (visit && postVisit)
- visitUnary(PostVisit, node);
-}
-
-void TLValueTrackingTraverser::traverseUnary(TIntermUnary *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- if (preVisit)
- visit = visitUnary(PreVisit, node);
-
- 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 (visit && postVisit)
- visitUnary(PostVisit, node);
-}
-
-// Traverse a function definition node.
-void TIntermTraverser::traverseFunctionDefinition(TIntermFunctionDefinition *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- if (preVisit)
- visit = visitFunctionDefinition(PreVisit, node);
-
- if (visit)
- {
- mInGlobalScope = false;
-
- node->getFunctionPrototype()->traverse(this);
- if (inVisit)
- visit = visitFunctionDefinition(InVisit, node);
- node->getBody()->traverse(this);
-
- mInGlobalScope = true;
- }
-
- if (visit && postVisit)
- visitFunctionDefinition(PostVisit, node);
-}
-
-// Traverse a block node.
-void TIntermTraverser::traverseBlock(TIntermBlock *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
- pushParentBlock(node);
-
- bool visit = true;
-
- TIntermSequence *sequence = node->getSequence();
-
- if (preVisit)
- visit = visitBlock(PreVisit, node);
-
- if (visit)
- {
- for (auto *child : *sequence)
- {
- child->traverse(this);
- if (visit && inVisit)
- {
- if (child != sequence->back())
- visit = visitBlock(InVisit, node);
- }
-
- incrementParentBlockPos();
- }
- }
-
- if (visit && postVisit)
- visitBlock(PostVisit, node);
-
- popParentBlock();
-}
-
-void TIntermTraverser::traverseInvariantDeclaration(TIntermInvariantDeclaration *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- if (preVisit)
- {
- visit = visitInvariantDeclaration(PreVisit, node);
- }
-
- if (visit)
- {
- node->getSymbol()->traverse(this);
- if (postVisit)
- {
- visitInvariantDeclaration(PostVisit, node);
- }
- }
-}
-
-// Traverse a declaration node.
-void TIntermTraverser::traverseDeclaration(TIntermDeclaration *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- TIntermSequence *sequence = node->getSequence();
-
- if (preVisit)
- visit = visitDeclaration(PreVisit, node);
-
- if (visit)
- {
- for (auto *child : *sequence)
- {
- child->traverse(this);
- if (visit && inVisit)
- {
- if (child != sequence->back())
- visit = visitDeclaration(InVisit, node);
- }
- }
- }
-
- if (visit && postVisit)
- visitDeclaration(PostVisit, node);
-}
-
-void TIntermTraverser::traverseFunctionPrototype(TIntermFunctionPrototype *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- TIntermSequence *sequence = node->getSequence();
-
- if (preVisit)
- visit = visitFunctionPrototype(PreVisit, node);
-
- if (visit)
- {
- for (auto *child : *sequence)
- {
- child->traverse(this);
- if (visit && inVisit)
- {
- if (child != sequence->back())
- visit = visitFunctionPrototype(InVisit, node);
- }
- }
- }
-
- if (visit && postVisit)
- visitFunctionPrototype(PostVisit, node);
-}
-
-// Traverse an aggregate node. Same comments in binary node apply here.
-void TIntermTraverser::traverseAggregate(TIntermAggregate *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- TIntermSequence *sequence = node->getSequence();
-
- if (preVisit)
- visit = visitAggregate(PreVisit, node);
-
- if (visit)
- {
- for (auto *child : *sequence)
- {
- child->traverse(this);
- if (visit && inVisit)
- {
- if (child != sequence->back())
- visit = visitAggregate(InVisit, node);
- }
- }
- }
-
- if (visit && postVisit)
- visitAggregate(PostVisit, 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,
- int shaderVersion)
- : TIntermTraverser(preVisit, inVisit, postVisit, symbolTable),
- mOperatorRequiresLValue(false),
- mInFunctionCallOutParameter(false),
- mShaderVersion(shaderVersion)
-{
- ASSERT(symbolTable);
-}
-
-void TLValueTrackingTraverser::traverseFunctionPrototype(TIntermFunctionPrototype *node)
-{
- TIntermSequence *sequence = node->getSequence();
- addToFunctionMap(node->getFunctionSymbolInfo()->getId(), sequence);
-
- TIntermTraverser::traverseFunctionPrototype(node);
-}
-
-void TLValueTrackingTraverser::traverseAggregate(TIntermAggregate *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- TIntermSequence *sequence = node->getSequence();
-
- if (preVisit)
- visit = visitAggregate(PreVisit, node);
-
- if (visit)
- {
- if (node->getOp() == EOpCallFunctionInAST)
- {
- if (isInFunctionMap(node))
- {
- TIntermSequence *params = getFunctionParameters(node);
- TIntermSequence::iterator paramIter = params->begin();
- for (auto *child : *sequence)
- {
- ASSERT(paramIter != params->end());
- TQualifier qualifier = (*paramIter)->getAsTyped()->getQualifier();
- setInFunctionCallOutParameter(qualifier == EvqOut || qualifier == EvqInOut);
-
- child->traverse(this);
- if (visit && inVisit)
- {
- if (child != sequence->back())
- visit = visitAggregate(InVisit, node);
- }
-
- ++paramIter;
- }
- }
- else
- {
- // The node might not be in the function map in case we're in the middle of
- // transforming the AST, and have inserted function call nodes without inserting the
- // function definitions yet.
- setInFunctionCallOutParameter(false);
- for (auto *child : *sequence)
- {
- child->traverse(this);
- if (visit && inVisit)
- {
- if (child != sequence->back())
- visit = visitAggregate(InVisit, node);
- }
- }
- }
-
- setInFunctionCallOutParameter(false);
- }
- else
- {
- // Find the built-in function corresponding to this op so that we can determine the
- // in/out qualifiers of its parameters.
- TFunction *builtInFunc = nullptr;
- if (!node->isFunctionCall() && !node->isConstructor())
- {
- builtInFunc = static_cast<TFunction *>(
- mSymbolTable->findBuiltIn(node->getSymbolTableMangledName(), mShaderVersion));
- }
-
- size_t paramIndex = 0;
-
- for (auto *child : *sequence)
- {
- // This assumes that raw functions called with
- // EOpCallInternalRawFunction don't have out parameters.
- TQualifier qualifier = EvqIn;
- if (builtInFunc != nullptr)
- qualifier = builtInFunc->getParam(paramIndex).type->getQualifier();
- setInFunctionCallOutParameter(qualifier == EvqOut || qualifier == EvqInOut);
- child->traverse(this);
-
- if (visit && inVisit)
- {
- if (child != sequence->back())
- visit = visitAggregate(InVisit, node);
- }
-
- ++paramIndex;
- }
-
- setInFunctionCallOutParameter(false);
- }
- }
-
- if (visit && postVisit)
- visitAggregate(PostVisit, node);
-}
-
-//
-// Traverse a ternary node. Same comments in binary node apply here.
-//
-void TIntermTraverser::traverseTernary(TIntermTernary *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- if (preVisit)
- visit = visitTernary(PreVisit, node);
-
- if (visit)
- {
- node->getCondition()->traverse(this);
- if (node->getTrueExpression())
- node->getTrueExpression()->traverse(this);
- if (node->getFalseExpression())
- node->getFalseExpression()->traverse(this);
- }
-
- if (visit && postVisit)
- visitTernary(PostVisit, node);
-}
-
-// Traverse an if-else node. Same comments in binary node apply here.
-void TIntermTraverser::traverseIfElse(TIntermIfElse *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- if (preVisit)
- visit = visitIfElse(PreVisit, node);
-
- if (visit)
- {
- node->getCondition()->traverse(this);
- if (node->getTrueBlock())
- node->getTrueBlock()->traverse(this);
- if (node->getFalseBlock())
- node->getFalseBlock()->traverse(this);
- }
-
- if (visit && postVisit)
- visitIfElse(PostVisit, node);
-}
-
-//
-// Traverse a switch node. Same comments in binary node apply here.
-//
-void TIntermTraverser::traverseSwitch(TIntermSwitch *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- if (preVisit)
- visit = visitSwitch(PreVisit, node);
-
- if (visit)
- {
- node->getInit()->traverse(this);
- if (inVisit)
- visit = visitSwitch(InVisit, node);
- if (visit && node->getStatementList())
- node->getStatementList()->traverse(this);
- }
-
- if (visit && postVisit)
- visitSwitch(PostVisit, node);
-}
-
-//
-// Traverse a case node. Same comments in binary node apply here.
-//
-void TIntermTraverser::traverseCase(TIntermCase *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- if (preVisit)
- visit = visitCase(PreVisit, node);
-
- if (visit && node->getCondition())
- {
- node->getCondition()->traverse(this);
- }
-
- if (visit && postVisit)
- visitCase(PostVisit, node);
-}
-
-//
-// Traverse a loop node. Same comments in binary node apply here.
-//
-void TIntermTraverser::traverseLoop(TIntermLoop *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- if (preVisit)
- visit = visitLoop(PreVisit, node);
-
- if (visit)
- {
- if (node->getInit())
- node->getInit()->traverse(this);
-
- if (node->getCondition())
- node->getCondition()->traverse(this);
-
- if (node->getBody())
- node->getBody()->traverse(this);
-
- if (node->getExpression())
- node->getExpression()->traverse(this);
- }
-
- if (visit && postVisit)
- visitLoop(PostVisit, node);
-}
-
-//
-// Traverse a branch node. Same comments in binary node apply here.
-//
-void TIntermTraverser::traverseBranch(TIntermBranch *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
-
- bool visit = true;
-
- if (preVisit)
- visit = visitBranch(PreVisit, node);
-
- if (visit && node->getExpression())
- {
- node->getExpression()->traverse(this);
- }
-
- if (visit && postVisit)
- visitBranch(PostVisit, node);
-}
-
-void TIntermTraverser::traverseRaw(TIntermRaw *node)
-{
- ScopedNodeInTraversalPath addToPath(this, node);
- visitRaw(node);
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/IntermTraverse.h b/src/3rdparty/angle/src/compiler/translator/IntermTraverse.h
deleted file mode 100644
index f0300b586b..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/IntermTraverse.h
+++ /dev/null
@@ -1,355 +0,0 @@
-//
-// 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_INTERMTRAVERSE_H_
-#define COMPILER_TRANSLATOR_INTERMTRAVERSE_H_
-
-#include "compiler/translator/IntermNode.h"
-
-namespace sh
-{
-
-class TSymbolTable;
-class TSymbolUniqueId;
-
-enum Visit
-{
- PreVisit,
- InVisit,
- PostVisit
-};
-
-// 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.
-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 visitRaw(TIntermRaw *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 bool visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node)
- {
- return true;
- }
- 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; }
-
- // 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.
- virtual void traverseSymbol(TIntermSymbol *node);
- virtual void traverseRaw(TIntermRaw *node);
- virtual void traverseConstantUnion(TIntermConstantUnion *node);
- virtual void traverseSwizzle(TIntermSwizzle *node);
- virtual void traverseBinary(TIntermBinary *node);
- virtual void traverseUnary(TIntermUnary *node);
- virtual void traverseTernary(TIntermTernary *node);
- virtual void traverseIfElse(TIntermIfElse *node);
- virtual void traverseSwitch(TIntermSwitch *node);
- virtual void traverseCase(TIntermCase *node);
- virtual void traverseFunctionPrototype(TIntermFunctionPrototype *node);
- virtual void traverseFunctionDefinition(TIntermFunctionDefinition *node);
- virtual void traverseAggregate(TIntermAggregate *node);
- virtual void traverseBlock(TIntermBlock *node);
- virtual void traverseInvariantDeclaration(TIntermInvariantDeclaration *node);
- virtual void traverseDeclaration(TIntermDeclaration *node);
- virtual void traverseLoop(TIntermLoop *node);
- virtual void traverseBranch(TIntermBranch *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:
- // Should only be called from traverse*() functions
- void incrementDepth(TIntermNode *current)
- {
- mDepth++;
- mMaxDepth = std::max(mMaxDepth, mDepth);
- mPath.push_back(current);
- }
-
- // Should only be called from traverse*() functions
- void decrementDepth()
- {
- mDepth--;
- mPath.pop_back();
- }
-
- // RAII helper for incrementDepth/decrementDepth
- class ScopedNodeInTraversalPath
- {
- public:
- ScopedNodeInTraversalPath(TIntermTraverser *traverser, TIntermNode *current)
- : mTraverser(traverser)
- {
- mTraverser->incrementDepth(current);
- }
- ~ScopedNodeInTraversalPath() { mTraverser->decrementDepth(); }
-
- private:
- TIntermTraverser *mTraverser;
- };
-
- 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 *_parent,
- TIntermNode *_original,
- TIntermSequence _replacements)
- : parent(_parent), original(_original), replacements(_replacements)
- {
- }
-
- 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);
-
- // Helper to create a temporary symbol node with the given qualifier.
- TIntermSymbol *createTempSymbol(const TType &type, TQualifier qualifier);
- // Helper to create a temporary symbol node.
- TIntermSymbol *createTempSymbol(const TType &type);
- // Create a node that declares but doesn't initialize a temporary symbol.
- TIntermDeclaration *createTempDeclaration(const TType &type);
- // Create a node that initializes the current temporary symbol with initializer. The symbol will
- // have the given qualifier.
- TIntermDeclaration *createTempInitDeclaration(TIntermTyped *initializer, TQualifier qualifier);
- // Create a node that initializes the current temporary symbol with initializer.
- TIntermDeclaration *createTempInitDeclaration(TIntermTyped *initializer);
- // Create a node that assigns rightNode to the current temporary symbol.
- TIntermBinary *createTempAssignment(TIntermTyped *rightNode);
- // Increment temporary symbol index.
- void nextTemporaryId();
-
- 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 mDepth;
- int mMaxDepth;
-
- 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;
-
- TSymbolUniqueId *mTemporaryId;
-};
-
-// 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,
- int shaderVersion);
- virtual ~TLValueTrackingTraverser() {}
-
- void traverseBinary(TIntermBinary *node) final;
- void traverseUnary(TIntermUnary *node) final;
- void traverseFunctionPrototype(TIntermFunctionPrototype *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; }
-
- // Add a function encountered during traversal to the function map.
- void addToFunctionMap(const TSymbolUniqueId &id, TIntermSequence *paramSequence);
-
- // Return true if the prototype or definition of the function being called has been encountered
- // during traversal.
- bool isInFunctionMap(const TIntermAggregate *callNode) const;
-
- // Return the parameters sequence from the function definition or prototype.
- TIntermSequence *getFunctionParameters(const TIntermAggregate *callNode);
-
- // Track whether an l-value is required inside a function call.
- void setInFunctionCallOutParameter(bool inOutParameter);
- bool isInFunctionCallOutParameter() const;
-
- bool mOperatorRequiresLValue;
- bool mInFunctionCallOutParameter;
-
- // Map from function symbol id values to their parameter sequences
- TMap<int, TIntermSequence *> mFunctionMap;
-
- const int mShaderVersion;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_INTERMTRAVERSE_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/IsASTDepthBelowLimit.cpp b/src/3rdparty/angle/src/compiler/translator/IsASTDepthBelowLimit.cpp
deleted file mode 100644
index aaad4f3c68..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/IsASTDepthBelowLimit.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// 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/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, true, false), mDepthLimit(depthLimit)
- {
- }
-
- bool visitBinary(Visit, TIntermBinary *) override { return depthCheck(); }
- bool visitUnary(Visit, TIntermUnary *) override { return depthCheck(); }
- bool visitTernary(Visit, TIntermTernary *) override { return depthCheck(); }
- bool visitSwizzle(Visit, TIntermSwizzle *) override { return depthCheck(); }
- bool visitIfElse(Visit, TIntermIfElse *) override { return depthCheck(); }
- bool visitAggregate(Visit, TIntermAggregate *) override { return depthCheck(); }
- bool visitBlock(Visit, TIntermBlock *) override { return depthCheck(); }
- bool visitLoop(Visit, TIntermLoop *) override { return depthCheck(); }
- bool visitBranch(Visit, TIntermBranch *) override { return depthCheck(); }
-
- protected:
- bool depthCheck() const { return mMaxDepth < mDepthLimit; }
-
- int mDepthLimit;
-};
-
-} // anonymous namespace
-
-bool IsASTDepthBelowLimit(TIntermNode *root, int maxDepth)
-{
- MaxDepthTraverser traverser(maxDepth + 1);
- root->traverse(&traverser);
-
- return traverser.getMaxDepth() <= maxDepth;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/IsASTDepthBelowLimit.h b/src/3rdparty/angle/src/compiler/translator/IsASTDepthBelowLimit.h
deleted file mode 100644
index ef2f02c974..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/IsASTDepthBelowLimit.h
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/NodeSearch.h b/src/3rdparty/angle/src/compiler/translator/NodeSearch.h
deleted file mode 100644
index af86b8bde4..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/NodeSearch.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// 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_NODESEARCH_H_
-#define COMPILER_TRANSLATOR_NODESEARCH_H_
-
-#include "compiler/translator/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;
- }
-};
-}
-
-#endif // COMPILER_TRANSLATOR_NODESEARCH_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/Operator.cpp b/src/3rdparty/angle/src/compiler/translator/Operator.cpp
deleted file mode 100644
index 7a2156611a..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Operator.cpp
+++ /dev/null
@@ -1,385 +0,0 @@
-//
-// 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 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;
- }
-} \ No newline at end of file
diff --git a/src/3rdparty/angle/src/compiler/translator/Operator.h b/src/3rdparty/angle/src/compiler/translator/Operator.h
deleted file mode 100644
index 72f3dbf3f6..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Operator.h
+++ /dev/null
@@ -1,255 +0,0 @@
-//
-// 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,
-
- // 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);
-
-#endif // COMPILER_TRANSLATOR_OPERATOR_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/OutputESSL.cpp b/src/3rdparty/angle/src/compiler/translator/OutputESSL.cpp
deleted file mode 100644
index 50626c91c0..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/OutputESSL.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/OutputESSL.h b/src/3rdparty/angle/src/compiler/translator/OutputESSL.h
deleted file mode 100644
index e0c7bf2ae6..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/OutputESSL.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/OutputGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/OutputGLSL.cpp
deleted file mode 100644
index 1bad05dab9..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/OutputGLSL.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-//
-// 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();
-
- const TString &symbol = node->getSymbol();
- if (symbol == "gl_FragDepthEXT")
- {
- out << "gl_FragDepth";
- }
- else if (symbol == "gl_FragColor" && sh::IsGLSL130OrNewer(getShaderOutput()))
- {
- out << "webgl_FragColor";
- }
- else if (symbol == "gl_FragData" && sh::IsGLSL130OrNewer(getShaderOutput()))
- {
- out << "webgl_FragData";
- }
- else if (symbol == "gl_SecondaryFragColorEXT")
- {
- out << "angle_SecondaryFragColor";
- }
- else if (symbol == "gl_SecondaryFragDataEXT")
- {
- out << "angle_SecondaryFragData";
- }
- else
- {
- TOutputGLSLBase::visitSymbol(node);
- }
-}
-
-TString TOutputGLSL::translateTextureFunction(const TString &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", "textureCube", "texture",
- "textureCubeLod", "textureLod",
- // Extensions
- "texture2DLodEXT", "textureLod", "texture2DProjLodEXT", "textureProjLod",
- "textureCubeLodEXT", "textureLod", "texture2DGradEXT", "textureGrad",
- "texture2DProjGradEXT", "textureProjGrad", "textureCubeGradEXT", "textureGrad", nullptr,
- nullptr};
- const char **mapping =
- (sh::IsGLSL130OrNewer(getShaderOutput())) ? legacyToCoreRename : simpleRename;
-
- for (int i = 0; mapping[i] != nullptr; i += 2)
- {
- if (name == mapping[i])
- {
- return mapping[i + 1];
- }
- }
-
- return name;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/OutputGLSL.h b/src/3rdparty/angle/src/compiler/translator/OutputGLSL.h
deleted file mode 100644
index c80abec1a6..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/OutputGLSL.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// 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;
- TString translateTextureFunction(const TString &name) override;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_OUTPUTGLSL_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp
deleted file mode 100644
index edaf2ebebf..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp
+++ /dev/null
@@ -1,1357 +0,0 @@
-//
-// 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;
- }
- return true;
-}
-
-class CommaSeparatedListItemPrefixGenerator
-{
- public:
- CommaSeparatedListItemPrefixGenerator() : mFirst(true) {}
- private:
- bool mFirst;
-
- friend TInfoSinkBase &operator<<(TInfoSinkBase &out,
- CommaSeparatedListItemPrefixGenerator &gen);
-};
-
-TInfoSinkBase &operator<<(TInfoSinkBase &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, ", ", ")");
- }
-}
-
-void TOutputGLSLBase::writeLayoutQualifier(TIntermTyped *variable)
-{
- const TType &type = variable->getType();
-
- if (!NeedsToWriteLayoutQualifier(type))
- {
- 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 (type.getQualifier() == EvqFragmentOut)
- {
- if (layoutQualifier.yuv == true)
- {
- out << listItemPrefix << "yuv";
- }
- }
-
- if (IsOpaqueType(type.getBasicType()))
- {
- if (layoutQualifier.binding >= 0)
- {
- out << listItemPrefix << "binding = " << layoutQualifier.binding;
- }
- }
-
- 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;
- }
-
- out << ") ";
-}
-
-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)
-{
- TQualifier qualifier = type.getQualifier();
- TInfoSinkBase &out = objSink();
- if (type.isInvariant())
- {
- writeInvariantQualifier(type);
- }
- if (type.getBasicType() == EbtInterfaceBlock)
- {
- TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
- declareInterfaceBlockLayout(interfaceBlock);
- }
- if (qualifier != EvqTemporary && qualifier != EvqGlobal)
- {
- const char *qualifierString = mapQualifierToString(qualifier);
- if (qualifierString && qualifierString[0] != '\0')
- {
- out << qualifierString << " ";
- }
- }
-
- const TMemoryQualifier &memoryQualifier = type.getMemoryQualifier();
- if (memoryQualifier.readonly)
- {
- ASSERT(IsImage(type.getBasicType()));
- out << "readonly ";
- }
-
- if (memoryQualifier.writeonly)
- {
- ASSERT(IsImage(type.getBasicType()));
- out << "writeonly ";
- }
-
- if (memoryQualifier.coherent)
- {
- ASSERT(IsImage(type.getBasicType()));
- out << "coherent ";
- }
-
- if (memoryQualifier.restrictQualifier)
- {
- ASSERT(IsImage(type.getBasicType()));
- out << "restrict ";
- }
-
- if (memoryQualifier.volatileQualifier)
- {
- ASSERT(IsImage(type.getBasicType()));
- out << "volatile ";
- }
-
- // Declare the struct if we have not done so already.
- if (type.getBasicType() == EbtStruct && !structDeclared(type.getStruct()))
- {
- const TStructure *structure = type.getStruct();
-
- declareStruct(structure);
-
- if (!structure->name().empty())
- {
- mDeclaredStructs.insert(structure->uniqueId());
- }
- }
- else if (type.getBasicType() == EbtInterfaceBlock)
- {
- TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
- declareInterfaceBlock(interfaceBlock);
- }
- else
- {
- if (writeVariablePrecision(type.getPrecision()))
- out << " ";
- out << getTypeName(type);
- }
-}
-
-void TOutputGLSLBase::writeFunctionParameters(const TIntermSequence &args)
-{
- TInfoSinkBase &out = objSink();
- for (TIntermSequence::const_iterator iter = args.begin(); iter != args.end(); ++iter)
- {
- const TIntermSymbol *arg = (*iter)->getAsSymbolNode();
- ASSERT(arg != nullptr);
-
- const TType &type = arg->getType();
- writeVariableType(type);
-
- if (!arg->getName().getString().empty())
- out << " " << hashName(arg->getName());
- if (type.isArray())
- out << ArrayString(type);
-
- // Put a comma if this is not the last argument.
- if (iter != args.end() - 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(TName(structure->name())) << "(";
-
- 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 << hashVariableName(node->getName());
-
- if (mDeclaringVariable && node->getType().isArray())
- out << ArrayString(node->getType());
-}
-
-void TOutputGLSLBase::visitConstantUnion(TIntermConstantUnion *node)
-{
- writeConstantUnion(node->getType(), node->getUnionArrayPointer());
-}
-
-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)];
-
- TString fieldName = field->name();
- if (!mSymbolTable->findBuiltIn(structure->name(), mShaderVersion))
- fieldName = hashName(TName(fieldName));
-
- out << fieldName;
- 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)];
-
- TString fieldName = field->name();
- if (!mSymbolTable->findBuiltIn(interfaceBlock->name(), mShaderVersion))
- {
- fieldName = hashName(TName(fieldName));
- }
- else
- {
- ASSERT(interfaceBlock->name() == "gl_PerVertex");
- }
-
- out << fieldName;
- 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)
-{
- TString preString;
- TString 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.c_str(), nullptr, postString.c_str());
-
- 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 (mDepth > 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 (mDepth > 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 " << hashVariableName(symbol->getName());
- return false;
-}
-
-bool TOutputGLSLBase::visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node)
-{
- TInfoSinkBase &out = objSink();
- ASSERT(visit == PreVisit);
-
- const TType &type = node->getType();
- writeVariableType(type);
- if (type.isArray())
- out << ArrayString(type);
-
- out << " " << hashFunctionNameIfNeeded(*node->getFunctionSymbolInfo());
-
- out << "(";
- writeFunctionParameters(*(node->getSequence()));
- out << ")";
-
- return false;
-}
-
-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->getFunctionSymbolInfo()->getName());
- }
- else
- {
- out << hashFunctionNameIfNeeded(*node->getFunctionSymbolInfo());
- }
- 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 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);
- writeVariableType(variable->getType());
- if (variable->getAsSymbolNode() == nullptr ||
- !variable->getAsSymbolNode()->getSymbol().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.
- }
-}
-
-TString TOutputGLSLBase::getTypeName(const TType &type)
-{
- return GetTypeName(type, mHashFunction, &mNameMap);
-}
-
-TString TOutputGLSLBase::hashName(const TName &name)
-{
- return HashName(name, mHashFunction, &mNameMap);
-}
-
-TString TOutputGLSLBase::hashVariableName(const TName &name)
-{
- if (mSymbolTable->findBuiltIn(name.getString(), mShaderVersion) != nullptr ||
- name.getString().substr(0, 3) == "gl_")
- {
- if (mCompileOptions & SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM &&
- name.getString() == "gl_ViewID_OVR")
- {
- TName uniformName(TString("ViewID_OVR"));
- uniformName.setInternal(true);
- return hashName(uniformName);
- }
- return name.getString();
- }
- return hashName(name);
-}
-
-TString TOutputGLSLBase::hashFunctionNameIfNeeded(const TFunctionSymbolInfo &info)
-{
- if (info.isMain())
- {
- return info.getName();
- }
- else
- {
- return hashName(info.getNameObj());
- }
-}
-
-bool TOutputGLSLBase::structDeclared(const TStructure *structure) const
-{
- ASSERT(structure);
- if (structure->name().empty())
- {
- return false;
- }
-
- return (mDeclaredStructs.count(structure->uniqueId()) > 0);
-}
-
-void TOutputGLSLBase::declareStruct(const TStructure *structure)
-{
- TInfoSinkBase &out = objSink();
-
- out << "struct " << hashName(TName(structure->name())) << "{\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()) << " " << hashName(TName(field->name()));
- if (field->type()->isArray())
- out << ArrayString(*field->type());
- out << ";\n";
- }
- out << "}";
-}
-
-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;
- }
-
- out << ", ";
-
- if (interfaceBlock->blockBinding() > 0)
- {
- out << "binding = " << interfaceBlock->blockBinding();
- out << ", ";
- }
-
- switch (interfaceBlock->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 << ") ";
-}
-
-void TOutputGLSLBase::declareInterfaceBlock(const TInterfaceBlock *interfaceBlock)
-{
- TInfoSinkBase &out = objSink();
-
- out << hashName(TName(interfaceBlock->name())) << "{\n";
- const TFieldList &fields = interfaceBlock->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()) << " " << hashName(TName(field->name()));
- 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 false;
- }
-
- 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/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h
deleted file mode 100644
index 592a310be4..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h
+++ /dev/null
@@ -1,122 +0,0 @@
-//
-// 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/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, which are not
- // hashed.
- TString hashName(const TName &name);
-
- protected:
- TInfoSinkBase &objSink() { return mObjSink; }
- void writeFloat(TInfoSinkBase &out, float f);
- void writeTriplet(Visit visit, const char *preStr, const char *inStr, const char *postStr);
- virtual void writeLayoutQualifier(TIntermTyped *variable);
- void writeInvariantQualifier(const TType &type);
- void writeVariableType(const TType &type);
- virtual bool writeVariablePrecision(TPrecision precision) = 0;
- void writeFunctionParameters(const TIntermSequence &args);
- const TConstantUnion *writeConstantUnion(const TType &type, const TConstantUnion *pConstUnion);
- void writeConstructorTriplet(Visit visit, const TType &type);
- TString 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;
- bool visitFunctionPrototype(Visit visit, 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 visitCodeBlock(TIntermBlock *node);
-
- // Same as hashName(), but without hashing built-in variables.
- TString hashVariableName(const TName &name);
- // Same as hashName(), but without hashing internal functions or "main".
- TString hashFunctionNameIfNeeded(const TFunctionSymbolInfo &info);
- // Used to translate function names for differences between ESSL and GLSL
- virtual TString translateTextureFunction(const TString &name) { return name; }
-
- private:
- bool structDeclared(const TStructure *structure) const;
- void declareStruct(const TStructure *structure);
-
- void declareInterfaceBlockLayout(const TInterfaceBlock *interfaceBlock);
- void declareInterfaceBlock(const TInterfaceBlock *interfaceBlock);
-
- void writeBuiltInFunctionTriplet(Visit visit, TOperator op, bool useEmulatedFunction);
-
- const char *mapQualifierToString(TQualifier qialifier);
-
- 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/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
deleted file mode 100644
index d5ff761430..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
+++ /dev/null
@@ -1,3084 +0,0 @@
-//
-// 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 <algorithm>
-#include <cfloat>
-#include <stdio.h>
-
-#include "common/angleutils.h"
-#include "common/debug.h"
-#include "common/utilities.h"
-#include "compiler/translator/BuiltInFunctionEmulator.h"
-#include "compiler/translator/BuiltInFunctionEmulatorHLSL.h"
-#include "compiler/translator/ImageFunctionHLSL.h"
-#include "compiler/translator/InfoSink.h"
-#include "compiler/translator/NodeSearch.h"
-#include "compiler/translator/RemoveSwitchFallThrough.h"
-#include "compiler/translator/SearchSymbol.h"
-#include "compiler/translator/StructureHLSL.h"
-#include "compiler/translator/TextureFunctionHLSL.h"
-#include "compiler/translator/TranslatorHLSL.h"
-#include "compiler/translator/UniformHLSL.h"
-#include "compiler/translator/UtilsHLSL.h"
-#include "compiler/translator/blocklayout.h"
-#include "compiler/translator/util.h"
-
-namespace sh
-{
-
-namespace
-{
-
-TString ArrayHelperFunctionName(const char *prefix, const TType &type)
-{
- TStringStream fnName;
- 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);
-}
-
-bool IsInStd140InterfaceBlock(TIntermTyped *node)
-{
- TIntermBinary *binaryNode = node->getAsBinaryNode();
-
- if (binaryNode)
- {
- return IsInStd140InterfaceBlock(binaryNode->getLeft());
- }
-
- const TType &type = node->getType();
-
- // determine if we are in the standard layout
- const TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
- if (interfaceBlock)
- {
- return (interfaceBlock->blockStorage() == EbsStd140);
- }
-
- return false;
-}
-
-} // anonymous namespace
-
-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,
- const std::vector<Uniform> &uniforms,
- ShCompileOptions compileOptions,
- TSymbolTable *symbolTable,
- PerformanceDiagnostics *perfDiagnostics)
- : TIntermTraverser(true, true, true, symbolTable),
- mShaderType(shaderType),
- mShaderVersion(shaderVersion),
- mExtensionBehavior(extensionBehavior),
- mSourcePath(sourcePath),
- mOutputType(outputType),
- mCompileOptions(compileOptions),
- mNumRenderTargets(numRenderTargets),
- mCurrentFunctionMetadata(nullptr),
- mPerfDiagnostics(perfDiagnostics)
-{
- mInsideFunction = false;
-
- mUsesFragColor = false;
- mUsesFragData = false;
- mUsesDepthRange = false;
- mUsesFragCoord = false;
- mUsesPointCoord = false;
- mUsesFrontFacing = false;
- mUsesPointSize = false;
- mUsesInstanceID = false;
- mHasMultiviewExtensionEnabled =
- IsExtensionEnabled(mExtensionBehavior, TExtension::OVR_multiview);
- mUsesViewID = false;
- mUsesVertexID = false;
- mUsesFragDepth = false;
- mUsesNumWorkGroups = false;
- mUsesWorkGroupID = false;
- mUsesLocalInvocationID = false;
- mUsesGlobalInvocationID = false;
- mUsesLocalInvocationIndex = false;
- mUsesXor = false;
- mUsesDiscardRewriting = false;
- mUsesNestedBreak = false;
- mRequiresIEEEStrictCompiling = false;
-
- mUniqueIndex = 0;
-
- mOutputLod0Function = false;
- mInsideDiscontinuousLoop = false;
- mNestedLoopDepth = 0;
-
- mExcessiveLoopIndex = nullptr;
-
- mStructureHLSL = new StructureHLSL;
- mUniformHLSL = new UniformHLSL(shaderType, mStructureHLSL, outputType, uniforms);
- mTextureFunctionHLSL = new TextureFunctionHLSL;
- mImageFunctionHLSL = new ImageFunctionHLSL;
-
- 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.
- mUniformHLSL->reserveUniformRegisters(3);
- }
-
- // Reserve registers for the default uniform block and driver constants
- mUniformHLSL->reserveUniformBlockRegisters(2);
-}
-
-OutputHLSL::~OutputHLSL()
-{
- SafeDelete(mStructureHLSL);
- SafeDelete(mUniformHLSL);
- SafeDelete(mTextureFunctionHLSL);
- SafeDelete(mImageFunctionHLSL);
- 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::getUniformBlockRegisterMap() const
-{
- return mUniformHLSL->getUniformBlockRegisterMap();
-}
-
-const std::map<std::string, unsigned int> &OutputHLSL::getUniformRegisterMap() const
-{
- return mUniformHLSL->getUniformRegisterMap();
-}
-
-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;
- 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)
- {
- TInterfaceBlock *interfaceBlock =
- mappedStruct.blockDeclarator->getType().getInterfaceBlock();
- const TString &interfaceBlockName = interfaceBlock->name();
- const TName &instanceName = mappedStruct.blockDeclarator->getName();
- if (mReferencedUniformBlocks.count(interfaceBlockName) == 0 &&
- (instanceName.getString() == "" ||
- mReferencedUniformBlocks.count(instanceName.getString()) == 0))
- {
- continue;
- }
-
- 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 (instanceName.getString() != "")
- {
- unsigned int instanceStringArrayIndex = GL_INVALID_INDEX;
- if (isInstanceArray)
- instanceStringArrayIndex = instanceArrayIndex;
- TString instanceString = mUniformHLSL->uniformBlockInstanceString(
- *interfaceBlock, 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());
- }
-
- mappedStructs += " =\n";
- mappedStructs += structInitializerString(0, *structType, originalName);
- mappedStructs += ";\n";
- }
- }
- return mappedStructs;
-}
-
-void OutputHLSL::header(TInfoSinkBase &out,
- const std::vector<MappedStruct> &std140Structs,
- const BuiltInFunctionEmulator *builtInFunctionEmulator) const
-{
- TString varyings;
- TString attributes;
- TString mappedStructs = generateStructMapping(std140Structs);
-
- for (ReferencedSymbols::const_iterator varying = mReferencedVaryings.begin();
- varying != mReferencedVaryings.end(); varying++)
- {
- const TType &type = varying->second->getType();
- const TString &name = varying->second->getSymbol();
-
- // Program linking depends on this exact format
- varyings += "static " + InterpolationString(type.getQualifier()) + " " + TypeString(type) +
- " " + Decorate(name) + ArrayString(type) + " = " + initializer(type) + ";\n";
- }
-
- for (ReferencedSymbols::const_iterator attribute = mReferencedAttributes.begin();
- attribute != mReferencedAttributes.end(); attribute++)
- {
- const TType &type = attribute->second->getType();
- const TString &name = attribute->second->getSymbol();
-
- attributes += "static " + TypeString(type) + " " + Decorate(name) + ArrayString(type) +
- " = " + initializer(type) + ";\n";
- }
-
- out << mStructureHLSL->structsHeader();
-
- mUniformHLSL->uniformsHeader(out, mOutputType, mReferencedUniforms, mSymbolTable);
- out << mUniformHLSL->uniformBlocksHeader(mReferencedUniformBlocks);
-
- 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";
-
- if (mShaderType == GL_FRAGMENT_SHADER)
- {
- const bool usingMRTExtension =
- IsExtensionEnabled(mExtensionBehavior, TExtension::EXT_draw_buffers);
-
- out << "// Varyings\n";
- out << varyings;
- out << "\n";
-
- if (mShaderVersion >= 300)
- {
- for (ReferencedSymbols::const_iterator outputVariableIt =
- mReferencedOutputVariables.begin();
- outputVariableIt != mReferencedOutputVariables.end(); outputVariableIt++)
- {
- const TString &variableName = outputVariableIt->first;
- const TType &variableType = outputVariableIt->second->getType();
-
- out << "static " + TypeString(variableType) + " out_" + variableName +
- ArrayString(variableType) + " = " + initializer(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 (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)
- {
- mUniformHLSL->samplerMetadataUniforms(out, "c4");
- }
-
- 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 (!mappedStructs.empty())
- {
- out << "// Structures from std140 blocks with padding removed\n";
- out << "\n";
- out << mappedStructs;
- out << "\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";
- }
- }
- else if (mShaderType == GL_VERTEX_SHADER)
- {
- out << "// Attributes\n";
- out << attributes;
- 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";
- out << varyings;
- 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)
- {
- mUniformHLSL->samplerMetadataUniforms(out, "c4");
- }
-
- 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";
- }
-
- if (!mappedStructs.empty())
- {
- out << "// Structures from std140 blocks with padding removed\n";
- out << "\n";
- out << mappedStructs;
- out << "\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);
- mUniformHLSL->samplerMetadataUniforms(out, "c1");
- out << "};\n";
-
- // Follow built-in variables would be initialized in
- // DynamicHLSL::generateComputeShaderLinkHLSL, if they
- // are used in compute shader.
- if (mUsesWorkGroupID)
- {
- out << "static uint3 gl_WorkGroupID = uint3(0, 0, 0);\n";
- }
-
- if (mUsesLocalInvocationID)
- {
- out << "static uint3 gl_LocalInvocationID = uint3(0, 0, 0);\n";
- }
-
- if (mUsesGlobalInvocationID)
- {
- out << "static uint3 gl_GlobalInvocationID = uint3(0, 0, 0);\n";
- }
-
- if (mUsesLocalInvocationIndex)
- {
- out << "static uint gl_LocalInvocationIndex = uint(0);\n";
- }
- }
-
- bool getDimensionsIgnoresBaseLevel =
- (mCompileOptions & SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL) != 0;
- mTextureFunctionHLSL->textureFunctionHeader(out, mOutputType, getDimensionsIgnoresBaseLevel);
- mImageFunctionHLSL->imageFunctionHeader(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 (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 (mUsesNumWorkGroups)
- {
- out << "#define GL_USES_NUM_WORK_GROUPS\n";
- }
-
- if (mUsesWorkGroupID)
- {
- out << "#define GL_USES_WORK_GROUP_ID\n";
- }
-
- if (mUsesLocalInvocationID)
- {
- out << "#define GL_USES_LOCAL_INVOCATION_ID\n";
- }
-
- if (mUsesGlobalInvocationID)
- {
- out << "#define GL_USES_GLOBAL_INVOCATION_ID\n";
- }
-
- if (mUsesLocalInvocationIndex)
- {
- out << "#define GL_USES_LOCAL_INVOCATION_INDEX\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)
-{
- TInfoSinkBase &out = getInfoSink();
-
- // Handle accessing std140 structs by value
- if (IsInStd140InterfaceBlock(node) && node->getBasicType() == EbtStruct)
- {
- out << "map";
- }
-
- TString name = node->getSymbol();
-
- if (name == "gl_DepthRange")
- {
- mUsesDepthRange = true;
- out << name;
- }
- else
- {
- const TType &nodeType = node->getType();
- TQualifier qualifier = node->getQualifier();
-
- ensureStructDefined(nodeType);
-
- if (qualifier == EvqUniform)
- {
- const TInterfaceBlock *interfaceBlock = nodeType.getInterfaceBlock();
-
- if (interfaceBlock)
- {
- mReferencedUniformBlocks[interfaceBlock->name()] = node;
- }
- else
- {
- mReferencedUniforms[name] = node;
- }
-
- out << DecorateVariableIfNeeded(node->getName());
- }
- else if (qualifier == EvqAttribute || qualifier == EvqVertexIn)
- {
- mReferencedAttributes[name] = node;
- out << Decorate(name);
- }
- else if (IsVarying(qualifier))
- {
- mReferencedVaryings[name] = node;
- out << Decorate(name);
- if (name == "ViewID_OVR")
- {
- mUsesViewID = true;
- }
- }
- else if (qualifier == EvqFragmentOut)
- {
- mReferencedOutputVariables[name] = node;
- out << "out_" << name;
- }
- else if (qualifier == EvqFragColor)
- {
- out << "gl_Color[0]";
- mUsesFragColor = true;
- }
- else if (qualifier == EvqFragData)
- {
- out << "gl_Color";
- mUsesFragData = true;
- }
- else if (qualifier == EvqFragCoord)
- {
- mUsesFragCoord = true;
- out << name;
- }
- else if (qualifier == EvqPointCoord)
- {
- mUsesPointCoord = true;
- out << name;
- }
- else if (qualifier == EvqFrontFacing)
- {
- mUsesFrontFacing = true;
- out << name;
- }
- else if (qualifier == EvqPointSize)
- {
- mUsesPointSize = true;
- out << name;
- }
- else if (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(node->getName());
- }
- }
-}
-
-void OutputHLSL::visitRaw(TIntermRaw *node)
-{
- getInfoSink() << node->getRawText();
-}
-
-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);
- }
- outputAssign(visit, node->getType(), out);
- break;
- case EOpInitialize:
- if (visit == PreVisit)
- {
- TIntermSymbol *symbolNode = node->getLeft()->getAsSymbolNode();
- ASSERT(symbolNode);
- TIntermTyped *expression = node->getRight();
-
- // Global initializers must be constant at this point.
- ASSERT(symbolNode->getQualifier() != EvqGlobal ||
- canWriteAsHLSLLiteral(expression));
-
- // 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, expression))
- {
- // Skip initializing the rest of the expression
- return false;
- }
- else if (writeConstantInitialization(out, symbolNode, expression))
- {
- return false;
- }
- }
- else if (visit == InVisit)
- {
- out << " = ";
- }
- 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)
- {
- TInterfaceBlock *interfaceBlock = leftType.getInterfaceBlock();
- const int arrayIndex = node->getRight()->getAsConstantUnion()->getIConst(0);
- mReferencedUniformBlocks[interfaceBlock->instanceName()] =
- node->getLeft()->getAsSymbolNode();
- out << mUniformHLSL->uniformBlockInstanceString(*interfaceBlock, 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
- {
- outputTriplet(out, visit, "", "[", "]");
- }
- }
- break;
- case EOpIndexIndirect:
- // We do not currently support indirect references to interface blocks
- ASSERT(node->getLeft()->getBasicType() != EbtInterfaceBlock);
- 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:
- {
- bool structInStd140Block =
- node->getBasicType() == EbtStruct && IsInStd140InterfaceBlock(node->getLeft());
- if (visit == PreVisit && structInStd140Block)
- {
- 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 (structInStd140Block)
- {
- 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:
- outputTriplet(out, visit, "tanh(", "", ")");
- break;
- 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;
- default:
- UNREACHABLE();
- }
-
- return true;
-}
-
-TString OutputHLSL::samplerNamePrefixFromStruct(TIntermTyped *node)
-{
- if (node->getAsSymbolNode())
- {
- return node->getAsSymbolNode()->getSymbol();
- }
- TIntermBinary *nodeBinary = node->getAsBinaryNode();
- switch (nodeBinary->getOp())
- {
- case EOpIndexDirect:
- {
- int index = nodeBinary->getRight()->getAsConstantUnion()->getIConst(0);
-
- TInfoSinkBase prefixSink;
- prefixSink << samplerNamePrefixFromStruct(nodeBinary->getLeft()) << "_" << index;
- return TString(prefixSink.c_str());
- }
- case EOpIndexDirectStruct:
- {
- const TStructure *s = nodeBinary->getLeft()->getAsTyped()->getType().getStruct();
- int index = nodeBinary->getRight()->getAsConstantUnion()->getIConst(0);
- const TField *field = s->fields()[index];
-
- TInfoSinkBase prefixSink;
- prefixSink << samplerNamePrefixFromStruct(nodeBinary->getLeft()) << "_"
- << field->name();
- return TString(prefixSink.c_str());
- }
- default:
- UNREACHABLE();
- return TString("");
- }
-}
-
-bool OutputHLSL::visitBlock(Visit visit, TIntermBlock *node)
-{
- TInfoSinkBase &out = getInfoSink();
-
- if (mInsideFunction)
- {
- outputLineDirective(out, node->getLine().first_line);
- out << "{\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);
- out << "}\n";
- }
-
- return false;
-}
-
-bool OutputHLSL::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node)
-{
- TInfoSinkBase &out = getInfoSink();
-
- ASSERT(mCurrentFunctionMetadata == nullptr);
-
- size_t index = mCallDag.findIndex(node->getFunctionSymbolInfo());
- ASSERT(index != CallDAG::InvalidIndex);
- mCurrentFunctionMetadata = &mASTMetadataList[index];
-
- out << TypeString(node->getFunctionPrototype()->getType()) << " ";
-
- TIntermSequence *parameters = node->getFunctionPrototype()->getSequence();
-
- if (node->getFunctionSymbolInfo()->isMain())
- {
- out << "gl_main(";
- }
- else
- {
- out << DecorateFunctionIfNeeded(node->getFunctionSymbolInfo()->getNameObj())
- << DisambiguateFunctionName(parameters) << (mOutputLod0Function ? "Lod0(" : "(");
- }
-
- for (unsigned int i = 0; i < parameters->size(); i++)
- {
- TIntermSymbol *symbol = (*parameters)[i]->getAsSymbolNode();
-
- if (symbol)
- {
- ensureStructDefined(symbol->getType());
-
- out << argumentString(symbol);
-
- if (i < parameters->size() - 1)
- {
- out << ", ";
- }
- }
- else
- UNREACHABLE();
- }
-
- out << ")\n";
-
- mInsideFunction = true;
- // The function body node will output braces.
- node->getBody()->traverse(this);
- mInsideFunction = false;
-
- mCurrentFunctionMetadata = nullptr;
-
- bool needsLod0 = mASTMetadataList[index].mNeedsLod0;
- if (needsLod0 && !mOutputLod0Function && mShaderType == GL_FRAGMENT_SHADER)
- {
- ASSERT(!node->getFunctionSymbolInfo()->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 *variable = (*sequence)[0]->getAsTyped();
- ASSERT(sequence->size() == 1);
- ASSERT(variable);
-
- if (IsDeclarationWrittenOut(node))
- {
- TInfoSinkBase &out = getInfoSink();
- ensureStructDefined(variable->getType());
-
- if (!variable->getAsSymbolNode() ||
- variable->getAsSymbolNode()->getSymbol() != "") // Variable declaration
- {
- if (!mInsideFunction)
- {
- out << "static ";
- }
-
- out << TypeString(variable->getType()) + " ";
-
- TIntermSymbol *symbol = variable->getAsSymbolNode();
-
- if (symbol)
- {
- symbol->traverse(this);
- out << ArrayString(symbol->getType());
- out << " = " + initializer(symbol->getType());
- }
- else
- {
- variable->traverse(this);
- }
- }
- else if (variable->getAsSymbolNode() &&
- variable->getAsSymbolNode()->getSymbol() == "") // Type (struct) declaration
- {
- ASSERT(variable->getBasicType() == EbtStruct);
- // ensureStructDefined has already been called.
- }
- else
- UNREACHABLE();
- }
- else if (IsVaryingOut(variable->getQualifier()))
- {
- TIntermSymbol *symbol = variable->getAsSymbolNode();
- ASSERT(symbol); // Varying declarations can't have initializers.
-
- // Vertex outputs which are declared but not written to should still be declared to
- // allow successful linking.
- mReferencedVaryings[symbol->getSymbol()] = symbol;
- }
- }
- return false;
-}
-
-bool OutputHLSL::visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node)
-{
- // Do not do any translation
- return false;
-}
-
-bool OutputHLSL::visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node)
-{
- TInfoSinkBase &out = getInfoSink();
-
- ASSERT(visit == PreVisit);
- size_t index = mCallDag.findIndex(node->getFunctionSymbolInfo());
- // Skip the prototype if it is not implemented (and thus not used)
- if (index == CallDAG::InvalidIndex)
- {
- return false;
- }
-
- TIntermSequence *arguments = node->getSequence();
-
- TString name = DecorateFunctionIfNeeded(node->getFunctionSymbolInfo()->getNameObj());
- out << TypeString(node->getType()) << " " << name << DisambiguateFunctionName(arguments)
- << (mOutputLod0Function ? "Lod0(" : "(");
-
- for (unsigned int i = 0; i < arguments->size(); i++)
- {
- TIntermSymbol *symbol = (*arguments)[i]->getAsSymbolNode();
- ASSERT(symbol != nullptr);
-
- out << argumentString(symbol);
-
- if (i < arguments->size() - 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;
- }
-
- return 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;
- if (node->getOp() == EOpCallFunctionInAST)
- {
- if (node->isArray())
- {
- UNIMPLEMENTED();
- }
- size_t index = mCallDag.findIndex(node->getFunctionSymbolInfo());
- ASSERT(index != CallDAG::InvalidIndex);
- lod0 &= mASTMetadataList[index].mNeedsLod0;
-
- out << DecorateFunctionIfNeeded(node->getFunctionSymbolInfo()->getNameObj());
- 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->getFunctionSymbolInfo()->getNameObj()) << "(";
- }
- else if (node->getFunctionSymbolInfo()->isImageFunction())
- {
- TString name = node->getFunctionSymbolInfo()->getName();
- TType type = (*arguments)[0]->getAsTyped()->getType();
- TString imageFunctionName = mImageFunctionHLSL->useImageFunction(
- name, type.getBasicType(), type.getLayoutQualifier().imageInternalFormat,
- type.getMemoryQualifier().readonly);
- out << imageFunctionName << "(";
- }
- else
- {
- const TString &name = node->getFunctionSymbolInfo()->getName();
- 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();
- }
- TString 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<TIntermSymbol *> samplerSymbols;
- TString structName = samplerNamePrefixFromStruct(typedArg);
- argType.createSamplerSymbols("angle_" + structName, "", &samplerSymbols,
- nullptr, mSymbolTable);
- for (const TIntermSymbol *sampler : samplerSymbols)
- {
- if (mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT)
- {
- out << ", texture_" << sampler->getSymbol();
- out << ", sampler_" << sampler->getSymbol();
- }
- 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->getSymbol();
- }
- }
- }
-
- 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;
- 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->getUnionArrayPointer());
-}
-
-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())
- {
- out << "return ";
- }
- 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()->getId() == index->getId())
- {
- 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";
- }
-}
-
-TString OutputHLSL::argumentString(const TIntermSymbol *symbol)
-{
- TQualifier qualifier = symbol->getQualifier();
- const TType &type = symbol->getType();
- const TName &name = symbol->getName();
- TString nameStr;
-
- if (name.getString().empty()) // HLSL demands named arguments, also for prototypes
- {
- nameStr = "x" + str(mUniqueIndex++);
- }
- else
- {
- nameStr = DecorateVariableIfNeeded(name);
- }
-
- 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);
- return "const uint " + nameStr + ArrayString(type);
- }
- if (mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT)
- {
- return QualifierString(qualifier) + " " + TextureString(type.getBasicType()) +
- " texture_" + nameStr + ArrayString(type) + ", " + QualifierString(qualifier) +
- " " + SamplerString(type.getBasicType()) + " sampler_" + nameStr +
- ArrayString(type);
- }
- }
-
- TStringStream argString;
- argString << 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<TIntermSymbol *> samplerSymbols;
- type.createSamplerSymbols("angle" + nameStr, "", &samplerSymbols, nullptr, mSymbolTable);
- for (const TIntermSymbol *sampler : samplerSymbols)
- {
- const TType &samplerType = sampler->getType();
- if (mOutputType == SH_HLSL_4_1_OUTPUT)
- {
- argString << ", const uint " << sampler->getSymbol() << ArrayString(samplerType);
- }
- else if (mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT)
- {
- ASSERT(IsSampler(samplerType.getBasicType()));
- argString << ", " << QualifierString(qualifier) << " "
- << TextureString(samplerType.getBasicType()) << " texture_"
- << sampler->getSymbol() << ArrayString(samplerType) << ", "
- << QualifierString(qualifier) << " "
- << SamplerString(samplerType.getBasicType()) << " sampler_"
- << sampler->getSymbol() << ArrayString(samplerType);
- }
- else
- {
- ASSERT(IsSampler(samplerType.getBasicType()));
- argString << ", " << QualifierString(qualifier) << " " << TypeString(samplerType)
- << " " << sampler->getSymbol() << ArrayString(samplerType);
- }
- }
- }
-
- return argString.str();
-}
-
-TString OutputHLSL::initializer(const TType &type)
-{
- TString string;
-
- size_t size = type.getObjectSize();
- for (size_t component = 0; component < size; component++)
- {
- string += "0";
-
- if (component + 1 < size)
- {
- string += ", ";
- }
- }
-
- 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)
-{
- 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)
-{
- sh::SearchSymbol searchSymbol(symbolNode->getSymbol());
- expression->traverse(&searchSymbol);
-
- if (searchSymbol.foundMatch())
- {
- // 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::canWriteAsHLSLLiteral(TIntermTyped *expression)
-{
- // We support writing constant unions and constructors that only take constant unions as
- // parameters as HLSL literals.
- return !expression->getType().isArrayOfArrays() &&
- (expression->getAsConstantUnion() ||
- expression->isConstructorWithOnlyConstantUnionParameters());
-}
-
-bool OutputHLSL::writeConstantInitialization(TInfoSinkBase &out,
- TIntermSymbol *symbolNode,
- TIntermTyped *initializer)
-{
- if (canWriteAsHLSLLiteral(initializer))
- {
- symbolNode->traverse(this);
- ASSERT(!symbolNode->getType().isArrayOfArrays());
- if (symbolNode->getType().isArray())
- {
- out << "[" << symbolNode->getType().getOutermostArraySize() << "]";
- }
- out << " = {";
- if (initializer->getAsConstantUnion())
- {
- TIntermConstantUnion *nodeConst = initializer->getAsConstantUnion();
- const TConstantUnion *constUnion = nodeConst->getUnionArrayPointer();
- writeConstantUnionArray(out, constUnion, nodeConst->getType().getObjectSize());
- }
- else
- {
- TIntermAggregate *constructor = initializer->getAsAggregate();
- ASSERT(constructor != nullptr);
- for (TIntermNode *&node : *constructor->getSequence())
- {
- TIntermConstantUnion *nodeConst = node->getAsConstantUnion();
- ASSERT(nodeConst);
- const TConstantUnion *constUnion = nodeConst->getUnionArrayPointer();
- writeConstantUnionArray(out, constUnion, nodeConst->getType().getObjectSize());
- if (node != constructor->getSequence()->back())
- {
- out << ", ";
- }
- }
- }
- 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);
- }
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/OutputHLSL.h b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.h
deleted file mode 100644
index 014f4f5002..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/OutputHLSL.h
+++ /dev/null
@@ -1,248 +0,0 @@
-//
-// 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/IntermTraverse.h"
-
-class BuiltInFunctionEmulator;
-
-namespace sh
-{
-class StructureHLSL;
-class TextureFunctionHLSL;
-class TSymbolTable;
-class ImageFunctionHLSL;
-class UnfoldShortCircuit;
-class UniformHLSL;
-
-typedef std::map<TString, TIntermSymbol *> ReferencedSymbols;
-
-class OutputHLSL : public TIntermTraverser
-{
- public:
- OutputHLSL(sh::GLenum shaderType,
- int shaderVersion,
- const TExtensionBehavior &extensionBehavior,
- const char *sourcePath,
- ShShaderOutput outputType,
- int numRenderTargets,
- const std::vector<Uniform> &uniforms,
- ShCompileOptions compileOptions,
- TSymbolTable *symbolTable,
- PerformanceDiagnostics *perfDiagnostics);
-
- ~OutputHLSL();
-
- void output(TIntermNode *treeRoot, TInfoSinkBase &objSink);
-
- const std::map<std::string, unsigned int> &getUniformBlockRegisterMap() const;
- const std::map<std::string, unsigned int> &getUniformRegisterMap() const;
-
- static TString initializer(const TType &type);
-
- TInfoSinkBase &getInfoSink()
- {
- ASSERT(!mInfoSinkStack.empty());
- return *mInfoSinkStack.top();
- }
-
- static bool canWriteAsHLSLLiteral(TIntermTyped *expression);
-
- protected:
- 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 visitRaw(TIntermRaw *) 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;
- bool visitFunctionPrototype(Visit visit, 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);
- TString argumentString(const TIntermSymbol *symbol);
-
- 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);
-
- sh::GLenum mShaderType;
- int mShaderVersion;
- const TExtensionBehavior &mExtensionBehavior;
- const char *mSourcePath;
- const ShShaderOutput mOutputType;
- ShCompileOptions mCompileOptions;
-
- bool mInsideFunction;
-
- // 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;
-
- ReferencedSymbols mReferencedUniforms;
- ReferencedSymbols mReferencedUniformBlocks;
- ReferencedSymbols mReferencedAttributes;
- ReferencedSymbols mReferencedVaryings;
- ReferencedSymbols mReferencedOutputVariables;
-
- StructureHLSL *mStructureHLSL;
- UniformHLSL *mUniformHLSL;
- TextureFunctionHLSL *mTextureFunctionHLSL;
- ImageFunctionHLSL *mImageFunctionHLSL;
-
- // 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;
-
- int mNumRenderTargets;
-
- 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;
-
- PerformanceDiagnostics *mPerfDiagnostics;
-
- private:
- TString generateStructMapping(const std::vector<MappedStruct> &std140Structs) const;
- TString samplerNamePrefixFromStruct(TIntermTyped *node);
- bool ancestorEvaluatesToSamplerInStruct();
-};
-}
-
-#endif // COMPILER_TRANSLATOR_OUTPUTHLSL_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/OutputTree.cpp b/src/3rdparty/angle/src/compiler/translator/OutputTree.cpp
deleted file mode 100644
index 25e8298af3..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/OutputTree.cpp
+++ /dev/null
@@ -1,682 +0,0 @@
-//
-// 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/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.h"
-
-namespace sh
-{
-
-namespace
-{
-
-void OutputFunction(TInfoSinkBase &out, const char *str, TFunctionSymbolInfo *info)
-{
- const char *internal = info->getNameObj().isInternal() ? " (internal function)" : "";
- out << str << internal << ": " << info->getNameObj().getString() << " (symbol id "
- << info->getId().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) {}
-
- 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;
- bool visitFunctionPrototype(Visit visit, 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;
-
- TInfoSinkBase &mOut;
-};
-
-//
-// 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, mDepth);
-
- mOut << "'" << node->getSymbol() << "' ";
- mOut << "(symbol id " << node->getId() << ") ";
- mOut << "(" << node->getCompleteString() << ")";
- mOut << "\n";
-}
-
-bool TOutputTraverser::visitSwizzle(Visit visit, TIntermSwizzle *node)
-{
- OutputTreeText(mOut, node, mDepth);
- mOut << "vector swizzle (";
- node->writeOffsetsAsXYZW(&mOut);
- mOut << ")";
-
- mOut << " (" << node->getCompleteString() << ")";
- mOut << "\n";
- return true;
-}
-
-bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary *node)
-{
- OutputTreeText(mOut, node, mDepth);
-
- 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->getCompleteString() << ")";
-
- 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, mDepth + 1);
-
- // The following code finds the field name from the constant union
- const TConstantUnion *constantUnion = intermConstantUnion->getUnionArrayPointer();
- 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, mDepth);
-
- 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->getCompleteString() << ")";
-
- mOut << "\n";
-
- return true;
-}
-
-bool TOutputTraverser::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node)
-{
- OutputTreeText(mOut, node, mDepth);
- mOut << "Function Definition:\n";
- mOut << "\n";
- return true;
-}
-
-bool TOutputTraverser::visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node)
-{
- OutputTreeText(mOut, node, mDepth);
- mOut << "Invariant Declaration:\n";
- return true;
-}
-
-bool TOutputTraverser::visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node)
-{
- OutputTreeText(mOut, node, mDepth);
- OutputFunction(mOut, "Function Prototype", node->getFunctionSymbolInfo());
- mOut << " (" << node->getCompleteString() << ")";
- mOut << "\n";
-
- return true;
-}
-
-bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
-{
- OutputTreeText(mOut, node, mDepth);
-
- 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->getFunctionSymbolInfo());
- break;
- case EOpCallInternalRawFunction:
- OutputFunction(mOut, "Call an internal function with raw implementation",
- node->getFunctionSymbolInfo());
- break;
- case EOpCallBuiltInFunction:
- OutputFunction(mOut, "Call a built-in function", node->getFunctionSymbolInfo());
- 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->getCompleteString() << ")";
-
- mOut << "\n";
-
- return true;
-}
-
-bool TOutputTraverser::visitBlock(Visit visit, TIntermBlock *node)
-{
- OutputTreeText(mOut, node, mDepth);
- mOut << "Code block\n";
-
- return true;
-}
-
-bool TOutputTraverser::visitDeclaration(Visit visit, TIntermDeclaration *node)
-{
- OutputTreeText(mOut, node, mDepth);
- mOut << "Declaration\n";
-
- return true;
-}
-
-bool TOutputTraverser::visitTernary(Visit visit, TIntermTernary *node)
-{
- OutputTreeText(mOut, node, mDepth);
-
- mOut << "Ternary selection";
- mOut << " (" << node->getCompleteString() << ")\n";
-
- ++mDepth;
-
- OutputTreeText(mOut, node, mDepth);
- mOut << "Condition\n";
- node->getCondition()->traverse(this);
-
- OutputTreeText(mOut, node, mDepth);
- if (node->getTrueExpression())
- {
- mOut << "true case\n";
- node->getTrueExpression()->traverse(this);
- }
- if (node->getFalseExpression())
- {
- OutputTreeText(mOut, node, mDepth);
- mOut << "false case\n";
- node->getFalseExpression()->traverse(this);
- }
-
- --mDepth;
-
- return false;
-}
-
-bool TOutputTraverser::visitIfElse(Visit visit, TIntermIfElse *node)
-{
- OutputTreeText(mOut, node, mDepth);
-
- mOut << "If test\n";
-
- ++mDepth;
-
- OutputTreeText(mOut, node, mDepth);
- mOut << "Condition\n";
- node->getCondition()->traverse(this);
-
- OutputTreeText(mOut, node, mDepth);
- if (node->getTrueBlock())
- {
- mOut << "true case\n";
- node->getTrueBlock()->traverse(this);
- }
- else
- {
- mOut << "true case is null\n";
- }
-
- if (node->getFalseBlock())
- {
- OutputTreeText(mOut, node, mDepth);
- mOut << "false case\n";
- node->getFalseBlock()->traverse(this);
- }
-
- --mDepth;
-
- return false;
-}
-
-bool TOutputTraverser::visitSwitch(Visit visit, TIntermSwitch *node)
-{
- OutputTreeText(mOut, node, mDepth);
-
- mOut << "Switch\n";
-
- return true;
-}
-
-bool TOutputTraverser::visitCase(Visit visit, TIntermCase *node)
-{
- OutputTreeText(mOut, node, mDepth);
-
- 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, mDepth);
- switch (node->getUnionArrayPointer()[i].getType())
- {
- case EbtBool:
- if (node->getUnionArrayPointer()[i].getBConst())
- mOut << "true";
- else
- mOut << "false";
-
- mOut << " ("
- << "const bool"
- << ")";
- mOut << "\n";
- break;
- case EbtFloat:
- mOut << node->getUnionArrayPointer()[i].getFConst();
- mOut << " (const float)\n";
- break;
- case EbtInt:
- mOut << node->getUnionArrayPointer()[i].getIConst();
- mOut << " (const int)\n";
- break;
- case EbtUInt:
- mOut << node->getUnionArrayPointer()[i].getUConst();
- mOut << " (const uint)\n";
- break;
- case EbtYuvCscStandardEXT:
- mOut << getYuvCscStandardEXTString(
- node->getUnionArrayPointer()[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, mDepth);
-
- mOut << "Loop with condition ";
- if (node->getType() == ELoopDoWhile)
- mOut << "not ";
- mOut << "tested first\n";
-
- ++mDepth;
-
- OutputTreeText(mOut, node, mDepth);
- if (node->getCondition())
- {
- mOut << "Loop Condition\n";
- node->getCondition()->traverse(this);
- }
- else
- {
- mOut << "No loop condition\n";
- }
-
- OutputTreeText(mOut, node, mDepth);
- if (node->getBody())
- {
- mOut << "Loop Body\n";
- node->getBody()->traverse(this);
- }
- else
- {
- mOut << "No loop body\n";
- }
-
- if (node->getExpression())
- {
- OutputTreeText(mOut, node, mDepth);
- mOut << "Loop Terminal Expression\n";
- node->getExpression()->traverse(this);
- }
-
- --mDepth;
-
- return false;
-}
-
-bool TOutputTraverser::visitBranch(Visit visit, TIntermBranch *node)
-{
- OutputTreeText(mOut, node, mDepth);
-
- 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";
- ++mDepth;
- node->getExpression()->traverse(this);
- --mDepth;
- }
- 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/src/3rdparty/angle/src/compiler/translator/OutputTree.h b/src/3rdparty/angle/src/compiler/translator/OutputTree.h
deleted file mode 100644
index 9f11989cb1..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/OutputTree.h
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/OutputVulkanGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/OutputVulkanGLSL.cpp
deleted file mode 100644
index 6d11deb898..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/OutputVulkanGLSL.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-// 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.
-//
-// OutputVulkanGLSL:
-// Code that outputs shaders that fit GL_KHR_vulkan_glsl.
-// The shaders are then fed into glslang to spit out SPIR-V (libANGLE-side).
-// See: https://www.khronos.org/registry/vulkan/specs/misc/GL_KHR_vulkan_glsl.txt
-//
-
-#include "compiler/translator/OutputVulkanGLSL.h"
-
-#include "compiler/translator/util.h"
-
-namespace sh
-{
-
-TOutputVulkanGLSL::TOutputVulkanGLSL(TInfoSinkBase &objSink,
- ShArrayIndexClampingStrategy clampingStrategy,
- ShHashFunction64 hashFunction,
- NameMap &nameMap,
- TSymbolTable *symbolTable,
- sh::GLenum shaderType,
- int shaderVersion,
- ShShaderOutput output,
- ShCompileOptions compileOptions)
- : TOutputGLSL(objSink,
- clampingStrategy,
- hashFunction,
- nameMap,
- symbolTable,
- shaderType,
- shaderVersion,
- output,
- compileOptions)
-{
-}
-
-// TODO(jmadill): This is not complete.
-void TOutputVulkanGLSL::writeLayoutQualifier(TIntermTyped *variable)
-{
- const TType &type = variable->getType();
-
- bool needsCustomLayout =
- (type.getQualifier() == EvqAttribute || type.getQualifier() == EvqFragmentOut ||
- type.getQualifier() == EvqVertexIn || IsVarying(type.getQualifier()) ||
- IsSampler(type.getBasicType()));
-
- if (!NeedsToWriteLayoutQualifier(type) && !needsCustomLayout)
- {
- return;
- }
-
- TInfoSinkBase &out = objSink();
- const TLayoutQualifier &layoutQualifier = type.getLayoutQualifier();
- out << "layout(";
-
- // This isn't super clean, but it gets the job done.
- // See corresponding code in GlslangWrapper.cpp.
- // TODO(jmadill): Ensure declarations are separated.
-
- TIntermSymbol *symbol = variable->getAsSymbolNode();
- ASSERT(symbol);
-
- if (needsCustomLayout)
- {
- out << "@@ LAYOUT-" << symbol->getName().getString() << " @@";
- }
-
- if (IsImage(type.getBasicType()) && layoutQualifier.imageInternalFormat != EiifUnspecified)
- {
- ASSERT(type.getQualifier() == EvqTemporary || type.getQualifier() == EvqUniform);
- out << getImageInternalFormatString(layoutQualifier.imageInternalFormat);
- }
-
- out << ") ";
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/OutputVulkanGLSL.h b/src/3rdparty/angle/src/compiler/translator/OutputVulkanGLSL.h
deleted file mode 100644
index 6e5da8b53e..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/OutputVulkanGLSL.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// 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.
-//
-// OutputVulkanGLSL:
-// Code that outputs shaders that fit GL_KHR_vulkan_glsl.
-// The shaders are then fed into glslang to spit out SPIR-V (libANGLE-side).
-// See: https://www.khronos.org/registry/vulkan/specs/misc/GL_KHR_vulkan_glsl.txt
-//
-
-#include "compiler/translator/OutputGLSL.h"
-
-namespace sh
-{
-
-class TOutputVulkanGLSL : public TOutputGLSL
-{
- public:
- TOutputVulkanGLSL(TInfoSinkBase &objSink,
- ShArrayIndexClampingStrategy clampingStrategy,
- ShHashFunction64 hashFunction,
- NameMap &nameMap,
- TSymbolTable *symbolTable,
- sh::GLenum shaderType,
- int shaderVersion,
- ShShaderOutput output,
- ShCompileOptions compileOptions);
-
- protected:
- void writeLayoutQualifier(TIntermTyped *variable) override;
-};
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/ParamType.h b/src/3rdparty/angle/src/compiler/translator/ParamType.h
deleted file mode 100644
index dddb4e9901..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ParamType.h
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// 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.
-//
-// ParamType:
-// Helper type for built-in function emulator tables. Defines types for parameters.
-
-#ifndef COMPILER_TRANSLATOR_PARAMTYPE_H_
-#define COMPILER_TRANSLATOR_PARAMTYPE_H_
-
-#include "common/angleutils.h"
-#include "compiler/translator/BaseTypes.h"
-
-namespace sh
-{
-
-enum class ParamType : uint8_t
-{
- Void,
- Bool1,
- Bool2,
- Bool3,
- Bool4,
- Float1,
- Float2,
- Float3,
- Float4,
- Int1,
- Int2,
- Int3,
- Int4,
- Mat2,
- Mat3,
- Mat4,
- Uint1,
- Uint2,
- Uint3,
- Uint4,
- Last,
-};
-
-struct ParamTypeInfo
-{
- ParamType self;
- TBasicType basicType;
- int primarySize;
- int secondarySize;
-};
-
-constexpr ParamTypeInfo g_ParamTypeInfo[] = {
- {ParamType::Void, EbtVoid, 1, 1}, {ParamType::Bool1, EbtBool, 1, 1},
- {ParamType::Bool2, EbtBool, 2, 1}, {ParamType::Bool3, EbtBool, 3, 1},
- {ParamType::Bool4, EbtBool, 4, 1}, {ParamType::Float1, EbtFloat, 1, 1},
- {ParamType::Float2, EbtFloat, 2, 1}, {ParamType::Float3, EbtFloat, 3, 1},
- {ParamType::Float4, EbtFloat, 4, 1}, {ParamType::Int1, EbtInt, 1, 1},
- {ParamType::Int2, EbtInt, 2, 1}, {ParamType::Int3, EbtInt, 3, 1},
- {ParamType::Int4, EbtInt, 4, 1}, {ParamType::Mat2, EbtFloat, 2, 2},
- {ParamType::Mat3, EbtFloat, 3, 3}, {ParamType::Mat4, EbtFloat, 4, 4},
- {ParamType::Uint1, EbtUInt, 1, 1}, {ParamType::Uint2, EbtUInt, 2, 1},
- {ParamType::Uint3, EbtUInt, 3, 1}, {ParamType::Uint4, EbtUInt, 4, 1},
-};
-
-constexpr size_t ParamTypeIndex(ParamType paramType)
-{
- return static_cast<size_t>(paramType);
-}
-
-constexpr size_t NumParamTypes()
-{
- return ParamTypeIndex(ParamType::Last);
-}
-
-static_assert(ArraySize(g_ParamTypeInfo) == NumParamTypes(), "Invalid array size");
-
-constexpr TBasicType GetBasicType(ParamType paramType)
-{
- return g_ParamTypeInfo[ParamTypeIndex(paramType)].basicType;
-}
-
-constexpr int GetPrimarySize(ParamType paramType)
-{
- return g_ParamTypeInfo[ParamTypeIndex(paramType)].primarySize;
-}
-
-constexpr int GetSecondarySize(ParamType paramType)
-{
- return g_ParamTypeInfo[ParamTypeIndex(paramType)].secondarySize;
-}
-
-constexpr bool SameParamType(ParamType paramType,
- TBasicType basicType,
- int primarySize,
- int secondarySize)
-{
- return GetBasicType(paramType) == basicType && primarySize == GetPrimarySize(paramType) &&
- secondarySize == GetSecondarySize(paramType);
-}
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_PARAMTYPE_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/ParseContext.cpp b/src/3rdparty/angle/src/compiler/translator/ParseContext.cpp
deleted file mode 100644
index c97f91d781..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ParseContext.cpp
+++ /dev/null
@@ -1,6022 +0,0 @@
-//
-// 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/Cache.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/ValidateGlobalInitializer.h"
-#include "compiler/translator/ValidateSwitch.h"
-#include "compiler/translator/glslang.h"
-#include "compiler/translator/util.h"
-
-namespace sh
-{
-
-///////////////////////////////////////////////////////////////////////
-//
-// Sub- vector and matrix fields
-//
-////////////////////////////////////////////////////////////////////////
-
-namespace
-{
-
-const int kWebGLMaxStructNesting = 4;
-
-const std::array<const char *, 8> kAtomicBuiltin = {{"atomicAdd", "atomicMin", "atomicMax",
- "atomicAnd", "atomicOr", "atomicXor",
- "atomicExchange", "atomicCompSwap"}};
-
-bool IsAtomicBuiltin(const TString &name)
-{
- for (size_t i = 0; i < kAtomicBuiltin.size(); ++i)
- {
- if (name.compare(kAtomicBuiltin[i]) == 0)
- {
- return true;
- }
- }
- return false;
-}
-
-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->getSymbol().c_str();
- }
- 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, pp::PreprocessorSettings()),
- mScanner(nullptr),
- mUsesFragData(false),
- mUsesFragColor(false),
- mUsesSecondaryOutputs(false),
- 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),
- mGeometryShaderInputArraySize(0u)
-{
-}
-
-TParseContext::~TParseContext()
-{
-}
-
-bool TParseContext::parseVectorFields(const TSourceLoc &line,
- const TString &compString,
- int vecSize,
- TVector<int> *fieldOffsets)
-{
- ASSERT(fieldOffsets);
- size_t fieldCount = compString.size();
- if (fieldCount > 4u)
- {
- error(line, "illegal vector field selection", compString.c_str());
- 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.c_str());
- return false;
- }
- }
-
- for (unsigned int i = 0u; i < fieldOffsets->size(); ++i)
- {
- if ((*fieldOffsets)[i] >= vecSize)
- {
- error(line, "vector field selection out of range", compString.c_str());
- return false;
- }
-
- if (i > 0)
- {
- if (fieldSet[i] != fieldSet[i - 1])
- {
- error(line, "illegal - vector component fields not from the same set",
- compString.c_str());
- 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::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, TString left, TString right)
-{
- std::stringstream reasonStream;
- reasonStream << "cannot convert from '" << right << "' to '" << left << "'";
- std::string reason = reasonStream.str();
- error(line, reason.c_str(), op);
-}
-
-//
-// Same error message for all places unary operations don't work.
-//
-void TParseContext::unaryOpError(const TSourceLoc &line, const char *op, TString operand)
-{
- std::stringstream reasonStream;
- reasonStream << "wrong operand type - no operation '" << op
- << "' exists that takes an operand of type " << operand
- << " (or there is no acceptable conversion)";
- std::string reason = reasonStream.str();
- error(line, reason.c_str(), op);
-}
-
-//
-// Same error message for all binary operations don't work.
-//
-void TParseContext::binaryOpError(const TSourceLoc &line,
- const char *op,
- TString left,
- TString right)
-{
- std::stringstream 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)";
- std::string reason = reasonStream.str();
- error(line, reason.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;
- }
- }
- }
-}
-
-// 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)
-{
- TIntermSymbol *symNode = node->getAsSymbolNode();
- TIntermBinary *binaryNode = node->getAsBinaryNode();
- 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;
- }
-
- if (binaryNode)
- {
- switch (binaryNode->getOp())
- {
- case EOpIndexDirect:
- case EOpIndexIndirect:
- case EOpIndexDirectStruct:
- case EOpIndexDirectInterfaceBlock:
- 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";
- }
- }
-
- if (message.empty() && binaryNode == 0 && symNode == 0)
- {
- error(line, "l-value required", op);
-
- return false;
- }
-
- //
- // Everything else is okay, no error.
- //
- if (message.empty())
- return true;
-
- //
- // If we get here, we have an error and a message.
- //
- if (symNode)
- {
- const char *symbol = symNode->getSymbol().c_str();
- std::stringstream reasonStream;
- reasonStream << "l-value required (" << message << " \"" << symbol << "\")";
- std::string reason = reasonStream.str();
- error(line, reason.c_str(), op);
- }
- else
- {
- std::stringstream reasonStream;
- reasonStream << "l-value required (" << 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 TString &identifier)
-{
- static const char *reservedErrMsg = "reserved built-in name";
- if (identifier.compare(0, 3, "gl_") == 0)
- {
- error(line, reservedErrMsg, "gl_");
- return false;
- }
- if (sh::IsWebGLBasedSpec(mShaderSpec))
- {
- if (identifier.compare(0, 6, "webgl_") == 0)
- {
- error(line, reservedErrMsg, "webgl_");
- return false;
- }
- if (identifier.compare(0, 7, "_webgl_") == 0)
- {
- error(line, reservedErrMsg, "_webgl_");
- return false;
- }
- }
- if (identifier.find("__") != TString::npos)
- {
- error(line,
- "identifiers containing two consecutive underscores (__) are reserved as "
- "possible future keywords",
- identifier.c_str());
- 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)
- {
- 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 TString &identifier,
- const TBasicType &type)
-{
- if (type == EbtVoid)
- {
- error(line, "illegal use of type 'void'", identifier.c_str());
- 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;
- 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();
-
- // TODO(oetuaho@nvidia.com): Get rid of the constant == nullptr check here once all constant
- // expressions can be folded. Right now we don't allow constant expressions that ANGLE can't
- // fold as array size.
- 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())
- {
- error(line, "cannot declare arrays of arrays",
- TType(elementType).getCompleteString().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).
- if (mShaderVersion >= 300 && elementType.getBasicType() == EbtStruct &&
- sh::IsVarying(elementType.qualifier))
- {
- error(indexLocation, "cannot declare arrays of structs of this qualifier",
- TType(elementType).getCompleteString().c_str());
- return false;
- }
- return checkIsValidQualifierForArray(indexLocation, elementType);
-}
-
-// Enforce non-initializer type/qualifier rules.
-void TParseContext::checkCanBeDeclaredWithoutInitializer(const TSourceLoc &line,
- const TString &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.c_str());
- }
- else
- {
- error(line, "variables with qualifier 'const' must be initialized", identifier.c_str());
- }
- }
- // This will make the type sized if it isn't sized yet.
- checkIsNotUnsizedArray(line, "implicitly sized arrays need to be initialized",
- identifier.c_str(), 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 TString &identifier,
- const TType &type,
- TVariable **variable)
-{
- ASSERT((*variable) == nullptr);
-
- checkBindingIsValid(line, type);
-
- bool needsReservedCheck = true;
-
- // gl_LastFragData may be redeclared with a new precision qualifier
- if (type.isArray() && identifier.compare(0, 15, "gl_LastFragData") == 0)
- {
- const TVariable *maxDrawBuffers = static_cast<const TVariable *>(
- symbolTable.findBuiltIn("gl_MaxDrawBuffers", mShaderVersion));
- if (type.isArrayOfArrays())
- {
- error(line, "redeclaration of gl_LastFragData as an array of arrays",
- identifier.c_str());
- return false;
- }
- else if (static_cast<int>(type.getOutermostArraySize()) ==
- maxDrawBuffers->getConstPointer()->getIConst())
- {
- if (TSymbol *builtInSymbol = symbolTable.findBuiltIn(identifier, mShaderVersion))
- {
- needsReservedCheck = !checkCanUseExtension(line, builtInSymbol->getExtension());
- }
- }
- else
- {
- error(line, "redeclaration of gl_LastFragData with size != gl_MaxDrawBuffers",
- identifier.c_str());
- return false;
- }
- }
-
- if (needsReservedCheck && !checkIsNotReserved(line, identifier))
- return false;
-
- (*variable) = symbolTable.declareVariable(&identifier, type);
- if (!(*variable))
- {
- error(line, "redefinition", identifier.c_str());
- 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);
- ASSERT(extension != TExtension::EXT_geometry_shader);
- if (extension == TExtension::OES_geometry_shader)
- {
- // OES_geometry_shader and EXT_geometry_shader are always interchangeable.
- constexpr std::array<TExtension, 2u> extensions{
- {TExtension::EXT_geometry_shader, TExtension::OES_geometry_shader}};
- return checkCanUseOneOfExtensions(line, extensions);
- }
- 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 (isExtensionEnabled(TExtension::OVR_multiview) && 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", "");
- }
-}
-
-// 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 TString &layoutQualifierName,
- int versionRequired)
-{
-
- if (mShaderVersion < versionRequired)
- {
- error(location, "invalid layout qualifier: not supported", layoutQualifierName.c_str());
- }
-}
-
-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::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).type->getQualifier();
- TIntermTyped *argument = (*(fnCall->getSequence()))[i]->getAsTyped();
- if (!IsImage(argument->getBasicType()) && (IsQualifierUnspecified(qual) || qual == EvqIn ||
- qual == EvqInOut || qual == EvqConstReadOnly))
- {
- if (argument->getMemoryQualifier().writeonly)
- {
- error(argument->getLine(),
- "Writeonly value cannot be passed for 'in' or 'inout' parameters.",
- fnCall->getFunctionSymbolInfo()->getName().c_str());
- 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->getFunctionSymbolInfo()->getName().c_str());
- 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)
-{
- 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)
-{
- 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 TString *name,
- const TSymbol *symbol)
-{
- if (!symbol)
- {
- error(location, "undeclared identifier", name->c_str());
- return nullptr;
- }
-
- if (!symbol->isVariable())
- {
- error(location, "variable expected", name->c_str());
- return nullptr;
- }
-
- const TVariable *variable = static_cast<const TVariable *>(symbol);
-
- if (variable->getExtension() != TExtension::UNDEFINED)
- {
- checkCanUseExtension(location, variable->getExtension());
- }
-
- // Reject shaders using both gl_FragData and gl_FragColor
- TQualifier qualifier = variable->getType().getQualifier();
- if (qualifier == EvqFragData || qualifier == EvqSecondaryFragDataEXT)
- {
- mUsesFragData = true;
- }
- else if (qualifier == EvqFragColor || qualifier == EvqSecondaryFragColorEXT)
- {
- mUsesFragColor = true;
- }
- if (qualifier == EvqSecondaryFragDataEXT || qualifier == EvqSecondaryFragColorEXT)
- {
- mUsesSecondaryOutputs = true;
- }
-
- // This validation is not quite correct - it's only an error to write to
- // both FragData and FragColor. For simplicity, and because users shouldn't
- // be rewarded for reading from undefined varaibles, return an error
- // if they are both referenced, rather than assigned.
- if (mUsesFragData && mUsesFragColor)
- {
- const char *errorMessage = "cannot use both gl_FragData and gl_FragColor";
- if (mUsesSecondaryOutputs)
- {
- errorMessage =
- "cannot use both output variable sets (gl_FragData, gl_SecondaryFragDataEXT)"
- " and (gl_FragColor, gl_SecondaryFragColorEXT)";
- }
- error(location, errorMessage, name->c_str());
- }
-
- // GLSL ES 3.1 Revision 4, 7.1.3 Compute Shader Special Variables
- if (getShaderType() == GL_COMPUTE_SHADER && !mComputeShaderLocalSizeDeclared &&
- qualifier == 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 TString *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())
- {
- 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(mGeometryShaderInputArraySize > 0u);
-
- node = new TIntermSymbol(variable->getUniqueId(), variable->getName(), variableType);
- node->getTypePointer()->sizeOutermostUnsizedArray(mGeometryShaderInputArraySize);
- }
- else
- {
- node = new TIntermSymbol(variable->getUniqueId(), variable->getName(), variableType);
- }
- 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 TString &identifier,
- TType type,
- TIntermTyped *initializer,
- TIntermBinary **initNode)
-{
- ASSERT(initNode != nullptr);
- ASSERT(*initNode == nullptr);
-
- TVariable *variable = 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);
- }
- if (!declareVariable(line, identifier, type, &variable))
- {
- return false;
- }
-
- bool globalInitWarning = false;
- if (symbolTable.atGlobalLevel() &&
- !ValidateGlobalInitializer(initializer, this, &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
- //
- TQualifier qualifier = variable->getType().getQualifier();
- if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal) && (qualifier != EvqConst))
- {
- error(line, " cannot initialize this type of qualifier ",
- variable->getType().getQualifierString());
- return false;
- }
- //
- // test for and propagate constant
- //
-
- if (qualifier == EvqConst)
- {
- if (qualifier != initializer->getType().getQualifier())
- {
- std::stringstream reasonStream;
- reasonStream << "assigning non-constant to '" << variable->getType().getCompleteString()
- << "'";
- std::string reason = reasonStream.str();
- error(line, reason.c_str(), "=");
- variable->getType().setQualifier(EvqTemporary);
- return false;
- }
- if (type != initializer->getType())
- {
- error(line, " non-matching types for const initializer ",
- variable->getType().getQualifierString());
- variable->getType().setQualifier(EvqTemporary);
- return false;
- }
-
- // Save the constant folded value to the variable if possible. For example array
- // initializers are not folded, since that way copying the array literal to multiple places
- // in the shader is avoided.
- // TODO(oetuaho@nvidia.com): Consider constant folding array initialization in cases where
- // it would be beneficial.
- if (initializer->getAsConstantUnion())
- {
- variable->shareConstPointer(initializer->getAsConstantUnion()->getUnionArrayPointer());
- ASSERT(*initNode == nullptr);
- return true;
- }
- else if (initializer->getAsSymbolNode())
- {
- const TSymbol *symbol =
- symbolTable.find(initializer->getAsSymbolNode()->getSymbol(), 0);
- const TVariable *tVar = static_cast<const TVariable *>(symbol);
-
- const TConstantUnion *constArray = tVar->getConstPointer();
- if (constArray)
- {
- variable->shareConstPointer(constArray);
- ASSERT(*initNode == nullptr);
- return true;
- }
- }
- }
-
- TIntermSymbol *intermSymbol =
- new TIntermSymbol(variable->getUniqueId(), variable->getName(), variable->getType());
- intermSymbol->setLine(line);
- *initNode = createAssign(EOpInitialize, intermSymbol, initializer, line);
- if (*initNode == nullptr)
- {
- assignError(line, "=", intermSymbol->getCompleteString(), initializer->getCompleteString());
- return false;
- }
-
- return true;
-}
-
-TIntermNode *TParseContext::addConditionInitializer(const TPublicType &pType,
- const TString &identifier,
- TIntermTyped *initializer,
- const TSourceLoc &loc)
-{
- checkIsScalarBool(loc, pType);
- TIntermBinary *initNode = nullptr;
- TType type(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)
- {
- typedCond = cond->getAsTyped();
- }
- 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);
-
- // 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));
- 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().c_str());
- }
- }
-}
-
-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)
-{
- if (!IsAtomicCounter(type->getBasicType()))
- {
- return;
- }
-
- 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::checkGeometryShaderInputAndSetArraySize(const TSourceLoc &location,
- const char *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(mGeometryShaderInputArraySize > 0u);
- type->sizeOutermostUnsizedArray(mGeometryShaderInputArraySize);
- }
- 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 TString &identifier)
-{
- TType type(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.
- //
- // 3. Inputs in ESSL 1.00 fragment shaders (EvqVaryingIn). This is somewhat in violation of
- // the specification, but there are desktop OpenGL drivers that expect that this is the
- // behavior of the #pragma when specified in ESSL 1.00 fragment shaders.
- if (qualifier == EvqVaryingOut || qualifier == EvqVertexOut || qualifier == EvqVaryingIn)
- {
- type.setInvariant(true);
- }
- }
-
- checkGeometryShaderInputAndSetArraySize(identifierOrTypeLocation, identifier.c_str(), &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)
- {
- symbol = new TIntermSymbol(symbolTable.getEmptySymbolId(), "", type);
- }
- else if (IsAtomicCounter(publicType.getBasicType()))
- {
- setAtomicCounterBindingDefaultOffset(publicType, identifierOrTypeLocation);
- }
- }
- else
- {
- nonEmptyDeclarationErrorCheck(publicType, identifierOrTypeLocation);
-
- checkCanBeDeclaredWithoutInitializer(identifierOrTypeLocation, identifier, &type);
-
- checkAtomicCounterOffsetDoesNotOverlap(false, identifierOrTypeLocation, &type);
-
- TVariable *variable = nullptr;
- declareVariable(identifierOrTypeLocation, identifier, type, &variable);
-
- if (variable)
- {
- symbol = new TIntermSymbol(variable->getUniqueId(), identifier, type);
- }
- }
-
- 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 TString &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(elementType);
- arrayType.makeArrays(arraySizes);
-
- checkGeometryShaderInputAndSetArraySize(indexLocation, identifier.c_str(), &arrayType);
-
- checkCanBeDeclaredWithoutInitializer(identifierLocation, identifier, &arrayType);
-
- checkAtomicCounterOffsetDoesNotOverlap(false, identifierLocation, &arrayType);
-
- TVariable *variable = nullptr;
- declareVariable(identifierLocation, identifier, arrayType, &variable);
-
- TIntermDeclaration *declaration = new TIntermDeclaration();
- declaration->setLine(identifierLocation);
-
- if (variable)
- {
- TIntermSymbol *symbol = new TIntermSymbol(variable->getUniqueId(), identifier, arrayType);
- symbol->setLine(identifierLocation);
- declaration->appendDeclarator(symbol);
- }
-
- return declaration;
-}
-
-TIntermDeclaration *TParseContext::parseSingleInitDeclaration(const TPublicType &publicType,
- const TSourceLoc &identifierLocation,
- const TString &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(publicType);
- if (executeInitializer(identifierLocation, identifier, type, initializer, &initNode))
- {
- if (initNode)
- {
- declaration->appendDeclarator(initNode);
- }
- }
- return declaration;
-}
-
-TIntermDeclaration *TParseContext::parseSingleArrayInitDeclaration(
- TPublicType &elementType,
- const TSourceLoc &identifierLocation,
- const TString &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(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 TString *identifier,
- const TSymbol *symbol)
-{
- TTypeQualifier typeQualifier = typeQualifierBuilder.getVariableTypeQualifier(mDiagnostics);
-
- if (!typeQualifier.invariant)
- {
- error(identifierLoc, "Expected invariant", identifier->c_str());
- return nullptr;
- }
- if (!checkIsAtGlobalLevel(identifierLoc, "invariant varying"))
- {
- return nullptr;
- }
- if (!symbol)
- {
- error(identifierLoc, "undeclared identifier declared as invariant", identifier->c_str());
- 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(std::string(identifier->c_str()));
-
- TIntermSymbol *intermSymbol = new TIntermSymbol(variable->getUniqueId(), *identifier, type);
- intermSymbol->setLine(identifierLoc);
-
- return new TIntermInvariantDeclaration(intermSymbol, identifierLoc);
-}
-
-void TParseContext::parseDeclarator(TPublicType &publicType,
- const TSourceLoc &identifierLocation,
- const TString &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);
-
- TVariable *variable = nullptr;
- TType type(publicType);
-
- checkGeometryShaderInputAndSetArraySize(identifierLocation, identifier.c_str(), &type);
-
- checkCanBeDeclaredWithoutInitializer(identifierLocation, identifier, &type);
-
- checkAtomicCounterOffsetDoesNotOverlap(true, identifierLocation, &type);
-
- declareVariable(identifierLocation, identifier, type, &variable);
-
- if (variable)
- {
- TIntermSymbol *symbol = new TIntermSymbol(variable->getUniqueId(), identifier, type);
- symbol->setLine(identifierLocation);
- declarationOut->appendDeclarator(symbol);
- }
-}
-
-void TParseContext::parseArrayDeclarator(TPublicType &elementType,
- const TSourceLoc &identifierLocation,
- const TString &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(elementType);
- arrayType.makeArrays(arraySizes);
-
- checkGeometryShaderInputAndSetArraySize(identifierLocation, identifier.c_str(), &arrayType);
-
- checkCanBeDeclaredWithoutInitializer(identifierLocation, identifier, &arrayType);
-
- checkAtomicCounterOffsetDoesNotOverlap(true, identifierLocation, &arrayType);
-
- TVariable *variable = nullptr;
- declareVariable(identifierLocation, identifier, arrayType, &variable);
-
- if (variable)
- {
- TIntermSymbol *symbol =
- new TIntermSymbol(variable->getUniqueId(), identifier, arrayType);
- symbol->setLine(identifierLocation);
- declarationOut->appendDeclarator(symbol);
- }
- }
-}
-
-void TParseContext::parseInitDeclarator(const TPublicType &publicType,
- const TSourceLoc &identifierLocation,
- const TString &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(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 TString &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(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 (mGeometryShaderInputArraySize == 0u)
- {
- mGeometryShaderInputArraySize = inputArraySize;
- }
- else if (mGeometryShaderInputArraySize != 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;
- }
-
- 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("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;
- 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 (isExtensionEnabled(TExtension::OVR_multiview) &&
- 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.getName());
-
- TIntermFunctionPrototype *prototype =
- new TIntermFunctionPrototype(function.getReturnType(), TSymbolUniqueId(function));
- // TODO(oetuaho@nvidia.com): Instead of converting the function information here, the node could
- // point to the data that already exists in the symbol table.
- prototype->getFunctionSymbolInfo()->setFromFunction(function);
- prototype->setLine(location);
-
- for (size_t i = 0; i < function.getParamCount(); i++)
- {
- const TConstParameter &param = function.getParam(i);
-
- TIntermSymbol *symbol = nullptr;
-
- // 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.name != nullptr)
- {
- // Insert the parameter in the symbol table.
- if (insertParametersToSymbolTable)
- {
- TVariable *variable = symbolTable.declareVariable(param.name, *param.type);
- if (variable)
- {
- symbol = new TIntermSymbol(variable->getUniqueId(), variable->getName(),
- variable->getType());
- }
- else
- {
- error(location, "redefinition", param.name->c_str());
- }
- }
- // Unsized type of a named parameter should have already been checked and sanitized.
- ASSERT(!param.type->isUnsizedArray());
- }
- else
- {
- if (param.type->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.
- }
- }
- if (!symbol)
- {
- // The parameter had no name or declaring the symbol failed - either way, add a nameless
- // symbol.
- symbol = new TIntermSymbol(symbolTable.getEmptySymbolId(), "", *param.type);
- }
- symbol->setLine(location);
- prototype->appendParameter(symbol);
- }
- 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.
- TFunction *function = static_cast<TFunction *>(
- symbolTable.find(parsedFunction.getMangledName(), getShaderVersion()));
- if (function->hasPrototypeDeclaration() && 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");
- }
- function->setHasPrototypeDeclaration();
-
- 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)
-{
- // 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->getFunctionSymbolInfo()->getName().c_str());
- }
-
- 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,
- TFunction **function,
- TIntermFunctionPrototype **prototypeOut)
-{
- ASSERT(function);
- ASSERT(*function);
- const TSymbol *builtIn =
- symbolTable.findBuiltIn((*function)->getMangledName(), getShaderVersion());
-
- if (builtIn)
- {
- error(location, "built-in functions cannot be redefined", (*function)->getName().c_str());
- }
- else
- {
- TFunction *prevDec = static_cast<TFunction *>(
- symbolTable.find((*function)->getMangledName(), getShaderVersion()));
-
- // Note: 'prevDec' 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 != prevDec)
- {
- // Swap the parameters of the previous declaration to the parameters of the function
- // definition (parameter names may differ).
- prevDec->swapParameters(**function);
-
- // The function definition will share the same symbol as any previous declaration.
- *function = prevDec;
- }
-
- if ((*function)->isDefined())
- {
- error(location, "function already has a body", (*function)->getName().c_str());
- }
-
- (*function)->setDefined();
- }
-
- // Remember the return type for later checking for return statements.
- mCurrentFunctionType = &((*function)->getReturnType());
- mFunctionReturnsValue = false;
-
- *prototypeOut = createPrototypeNodeFromFunction(**function, location, true);
- setLoopNestingLevel(0);
-}
-
-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.
- //
- // Return types and parameter qualifiers must match in all redeclarations, so those are checked
- // here.
- //
- TFunction *prevDec =
- static_cast<TFunction *>(symbolTable.find(function->getMangledName(), getShaderVersion()));
-
- for (size_t i = 0u; i < function->getParamCount(); ++i)
- {
- auto &param = function->getParam(i);
- if (param.type->isStructSpecifier())
- {
- // ESSL 3.00.6 section 12.10.
- error(location, "Function parameter type cannot be a structure definition",
- function->getName().c_str());
- }
- }
-
- if (getShaderVersion() >= 300 &&
- symbolTable.hasUnmangledBuiltInForShaderVersion(function->getName().c_str(),
- getShaderVersion()))
- {
- // 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->getName().c_str());
- }
- else 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).type->getQualifier() !=
- function->getParam(i).type->getQualifier())
- {
- error(location,
- "function must have the same parameter qualifiers in all of its declarations",
- function->getParam(i).type->getQualifierString());
- }
- }
- }
-
- //
- // Check for previously declared variables using the same name.
- //
- TSymbol *prevSym = symbolTable.find(function->getName(), getShaderVersion());
- if (prevSym)
- {
- if (!prevSym->isFunction())
- {
- error(location, "redefinition of a function", function->getName().c_str());
- }
- }
- else
- {
- // Insert the unmangled name to detect potential future redefinition as a variable.
- symbolTable.getOuterLevel()->insertUnmangled(function);
- }
-
- // We're at the inner scope level of the function's arguments and body statement.
- // Add the function prototype to the surrounding scope instead.
- symbolTable.getOuterLevel()->insert(function);
-
- // Raise error message if main function takes any parameters or return anything other than void
- if (function->getName() == "main")
- {
- 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 TString *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
- error(location, "structures containing arrays can't be function return values",
- TType(type).getCompleteString().c_str());
- }
- }
-
- // Add the function as a prototype after parsing it (we do not support recursion)
- return new TFunction(&symbolTable, name, new TType(type));
-}
-
-TFunction *TParseContext::addNonConstructorFunc(const TString *name, const TSourceLoc &loc)
-{
- const TType *returnType = TCache::getType(EbtVoid, EbpUndefined);
- return new TFunction(&symbolTable, name, returnType);
-}
-
-TFunction *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 new TFunction(&symbolTable, nullptr, type, EOpConstruct);
-}
-
-void TParseContext::checkIsNotUnsizedArray(const TSourceLoc &line,
- const char *errorMessage,
- const char *token,
- TType *arrayType)
-{
- if (arrayType->isUnsizedArray())
- {
- error(line, errorMessage, token);
- arrayType->sizeUnsizedArrays(nullptr);
- }
-}
-
-TParameter TParseContext::parseParameterDeclarator(TType *type,
- const TString *name,
- const TSourceLoc &nameLoc)
-{
- ASSERT(type);
- checkIsNotUnsizedArray(nameLoc, "function parameter array must specify a size", name->c_str(),
- type);
- if (type->getBasicType() == EbtVoid)
- {
- error(nameLoc, "illegal use of type 'void'", name->c_str());
- }
- checkIsNotReserved(nameLoc, *name);
- TParameter param = {name, type};
- return param;
-}
-
-TParameter TParseContext::parseParameterDeclarator(const TPublicType &publicType,
- const TString *name,
- const TSourceLoc &nameLoc)
-{
- TType *type = new TType(publicType);
- return parseParameterDeclarator(type, name, nameLoc);
-}
-
-TParameter TParseContext::parseParameterArrayDeclarator(const TString *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(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)
- {
- 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(TIntermSequence *arguments,
- TType type,
- const TSourceLoc &line)
-{
- 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);
-
- // TODO(oetuaho@nvidia.com): Add support for folding array constructors.
- if (!constructorNode->isArray())
- {
- return constructorNode->fold(mDiagnostics);
- }
- return constructorNode;
-}
-
-//
-// Interface/uniform blocks
-// TODO(jiawei.shao@intel.com): implement GL_OES_shader_io_blocks.
-//
-TIntermDeclaration *TParseContext::addInterfaceBlock(
- const TTypeQualifierBuilder &typeQualifierBuilder,
- const TSourceLoc &nameLine,
- const TString &blockName,
- TFieldList *fieldList,
- const TString *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);
- }
-
- 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);
-
- if (!symbolTable.declareInterfaceBlockName(&blockName))
- {
- error(nameLine, "redefinition of an interface block name", blockName.c_str());
- }
-
- // 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);
- 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().c_str(), 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(&blockName, fieldList, instanceName, blockLayoutQualifier);
- TType interfaceBlockType(interfaceBlock, typeQualifier.qualifier, blockLayoutQualifier);
- if (arrayIndex != nullptr)
- {
- interfaceBlockType.makeArray(arraySize);
- }
-
- TString symbolName = "";
- const TSymbolUniqueId *symbolId = nullptr;
-
- if (!instanceName)
- {
- // define symbols for the members of the interface block
- for (size_t memberIndex = 0; memberIndex < fieldList->size(); ++memberIndex)
- {
- TField *field = (*fieldList)[memberIndex];
- TType *fieldType = field->type();
-
- // set parent pointer of the field variable
- fieldType->setInterfaceBlock(interfaceBlock);
-
- TVariable *fieldVariable = symbolTable.declareVariable(&field->name(), *fieldType);
-
- if (fieldVariable)
- {
- fieldVariable->setQualifier(typeQualifier.qualifier);
- }
- else
- {
- error(field->line(), "redefinition of an interface block member name",
- field->name().c_str());
- }
- }
- symbolId = &symbolTable.getEmptySymbolId();
- }
- else
- {
- checkIsNotReserved(instanceLine, *instanceName);
-
- // add a symbol for this interface block
- TVariable *instanceTypeDef = symbolTable.declareVariable(instanceName, interfaceBlockType);
- if (instanceTypeDef)
- {
- instanceTypeDef->setQualifier(typeQualifier.qualifier);
- symbolId = &instanceTypeDef->getUniqueId();
- }
- else
- {
- error(instanceLine, "redefinition of an interface block instance name",
- instanceName->c_str());
- }
- symbolName = *instanceName;
- }
-
- TIntermDeclaration *declaration = nullptr;
-
- if (symbolId)
- {
- TIntermSymbol *blockSymbol = new TIntermSymbol(*symbolId, symbolName, interfaceBlockType);
- blockSymbol->setLine(typeQualifier.line);
- declaration = new TIntermDeclaration();
- declaration->appendDeclarator(blockSymbol);
- declaration->setLine(nameLine);
- }
-
- exitStructDeclaration();
- return declaration;
-}
-
-void TParseContext::enterStructDeclaration(const TSourceLoc &line, const TString &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;
- reasonStream << "Reference of struct type " << field.type()->getStruct()->name().c_str()
- << " exceeds maximum allowed nesting level of " << kWebGLMaxStructNesting;
- std::string reason = reasonStream.str();
- error(line, reason.c_str(), field.name().c_str());
- 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()->getSymbol().c_str());
- }
- 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_OES);
- if (mGeometryShaderInputPrimitiveType == EptUndefined)
- {
- error(location, "missing input primitive declaration before indexing gl_in.", "[");
- return CreateZeroNode(TType(EbtFloat, EbpHigh, EvqConst));
- }
- }
-
- TIntermConstantUnion *indexConstantUnion = indexExpression->getAsConstantUnion();
-
- // TODO(oetuaho@nvidia.com): Get rid of indexConstantUnion == nullptr below once ANGLE is able
- // to constant fold all constant expressions. Right now we don't allow indexing interface blocks
- // or fragment outputs with expressions that ANGLE is not able to constant fold, even if the
- // index is a constant expression.
- if (indexExpression->getQualifier() != EvqConst || indexConstantUnion == nullptr)
- {
- if (baseExpression->isInterfaceBlock())
- {
- // TODO(jiawei.shao@intel.com): implement GL_OES_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)
- {
- 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 if (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);
- indexConstantUnion->replaceConstantUnion(safeConstantUnion);
- indexConstantUnion->getTypePointer()->setBasicType(EbtInt);
- }
-
- TIntermBinary *node =
- new TIntermBinary(EOpIndexDirect, baseExpression, indexExpression);
- node->setLine(location);
- return node->fold(mDiagnostics);
- }
- }
-
- 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);
- if (index >= arraySize)
- {
- std::stringstream reasonStream;
- 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 TString &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();
- }
- 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 node->fold(mDiagnostics);
- }
- else
- {
- error(dotLocation, " no such field in structure", fieldString.c_str());
- 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.c_str());
- return baseExpression;
- }
- }
- }
- else
- {
- if (mShaderVersion < 300)
- {
- error(dotLocation, " field selection requires structure or vector on left hand side",
- fieldString.c_str());
- }
- else
- {
- error(dotLocation,
- " field selection requires structure, vector, or interface block on left hand "
- "side",
- fieldString.c_str());
- }
- return baseExpression;
- }
-}
-
-TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &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.c_str());
- }
- 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_OES &&
- checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader))
- {
- checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
- qualifier.primitiveType = EptPoints;
- }
- else if (qualifierType == "lines" && mShaderType == GL_GEOMETRY_SHADER_OES &&
- checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader))
- {
- checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
- qualifier.primitiveType = EptLines;
- }
- else if (qualifierType == "lines_adjacency" && mShaderType == GL_GEOMETRY_SHADER_OES &&
- checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader))
- {
- checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
- qualifier.primitiveType = EptLinesAdjacency;
- }
- else if (qualifierType == "triangles" && mShaderType == GL_GEOMETRY_SHADER_OES &&
- checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader))
- {
- checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
- qualifier.primitiveType = EptTriangles;
- }
- else if (qualifierType == "triangles_adjacency" && mShaderType == GL_GEOMETRY_SHADER_OES &&
- checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader))
- {
- checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
- qualifier.primitiveType = EptTrianglesAdjacency;
- }
- else if (qualifierType == "line_strip" && mShaderType == GL_GEOMETRY_SHADER_OES &&
- checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader))
- {
- checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
- qualifier.primitiveType = EptLineStrip;
- }
- else if (qualifierType == "triangle_strip" && mShaderType == GL_GEOMETRY_SHADER_OES &&
- checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader))
- {
- checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
- qualifier.primitiveType = EptTriangleStrip;
- }
-
- else
- {
- error(qualifierTypeLine, "invalid layout qualifier", qualifierType.c_str());
- }
-
- return qualifier;
-}
-
-void TParseContext::parseLocalSize(const TString &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;
- 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;
- }
-}
-
-TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &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 (checkCanUseExtension(qualifierTypeLine, TExtension::OVR_multiview))
- {
- parseNumViews(intValue, intValueLine, intValueString, &qualifier.numViews);
- }
- }
- else if (qualifierType == "invocations" && mShaderType == GL_GEOMETRY_SHADER_OES &&
- checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader))
- {
- parseInvocations(intValue, intValueLine, intValueString, &qualifier.invocations);
- }
- else if (qualifierType == "max_vertices" && mShaderType == GL_GEOMETRY_SHADER_OES &&
- checkCanUseExtension(qualifierTypeLine, TExtension::OES_geometry_shader))
- {
- parseMaxVertices(intValue, intValueLine, intValueString, &qualifier.maxVertices);
- }
-
- else
- {
- error(qualifierTypeLine, "invalid layout qualifier", qualifierType.c_str());
- }
-
- 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 && !isExtensionEnabled(TExtension::OVR_multiview))
- {
- 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_OES:
- {
- 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_OES:
- {
- 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);
-}
-
-TField *TParseContext::parseStructDeclarator(TString *identifier, const TSourceLoc &loc)
-{
- checkIsNotReserved(loc, *identifier);
- TType *type = new TType(EbtVoid, EbpUndefined);
- return new TField(type, identifier, loc);
-}
-
-TField *TParseContext::parseStructArrayDeclarator(TString *identifier,
- const TSourceLoc &loc,
- const TVector<unsigned int> &arraySizes,
- const TSourceLoc &arraySizeLoc)
-{
- checkIsNotReserved(loc, *identifier);
-
- TType *type = new TType(EbtVoid, EbpUndefined);
- type->makeArrays(arraySizes);
-
- return new TField(type, identifier, loc);
-}
-
-void TParseContext::checkDoesNotHaveDuplicateFieldName(const TFieldList::const_iterator begin,
- const TFieldList::const_iterator end,
- const TString &name,
- const TSourceLoc &location)
-{
- for (auto fieldIter = begin; fieldIter != end; ++fieldIter)
- {
- if ((*fieldIter)->name() == name)
- {
- error(location, "duplicate field name in structure", name.c_str());
- }
- }
-}
-
-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,
- TFieldList *fieldList)
-{
- 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, fieldList);
-}
-
-TFieldList *TParseContext::addStructDeclaratorList(const TPublicType &typeSpecifier,
- TFieldList *declaratorList)
-{
- checkPrecisionSpecified(typeSpecifier.getLine(), typeSpecifier.precision,
- typeSpecifier.getBasicType());
-
- checkIsNonVoid(typeSpecifier.getLine(), (*declaratorList)[0]->name(),
- typeSpecifier.getBasicType());
-
- checkWorkGroupSizeIsNotSpecified(typeSpecifier.getLine(), typeSpecifier.layoutQualifier);
-
- for (TField *declarator : *declaratorList)
- {
- // Don't allow arrays of arrays in ESSL < 3.10.
- if (declarator->type()->isArray())
- {
- checkArrayElementIsNotArray(typeSpecifier.getLine(), typeSpecifier);
- }
-
- auto *declaratorArraySizes = declarator->type()->getArraySizes();
-
- TType *type = declarator->type();
- *type = TType(typeSpecifier);
- if (declaratorArraySizes != nullptr)
- {
- for (unsigned int arraySize : *declaratorArraySizes)
- {
- type->makeArray(arraySize);
- }
- }
-
- checkIsBelowStructNestingLimit(typeSpecifier.getLine(), *declarator);
- }
-
- return declaratorList;
-}
-
-TTypeSpecifierNonArray TParseContext::addStructure(const TSourceLoc &structLine,
- const TSourceLoc &nameLine,
- const TString *structName,
- TFieldList *fieldList)
-{
- TStructure *structure = new TStructure(&symbolTable, structName, fieldList);
-
- // 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 (!structName->empty())
- {
- checkIsNotReserved(nameLine, *structName);
- if (!symbolTable.declareStructType(structure))
- {
- error(nameLine, "redefinition of a struct", structName->c_str());
- }
- }
-
- // 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().c_str(), field.type());
-
- checkMemoryQualifierIsNotSpecified(field.type()->getMemoryQualifier(), field.line());
-
- 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, mShaderVersion, mDiagnostics, statementList, loc))
- {
- ASSERT(mDiagnostics->numErrors() > 0);
- return nullptr;
- }
-
- 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();
- // TODO(oetuaho@nvidia.com): Get rid of the conditionConst == nullptr check once all constant
- // expressions can be folded. Right now we don't allow constant expressions that ANGLE can't
- // fold in case labels.
- 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)
-{
- ASSERT(child != nullptr);
-
- switch (op)
- {
- case EOpLogicalNot:
- if (child->getBasicType() != EbtBool || child->isMatrix() || child->isArray() ||
- child->isVector())
- {
- unaryOpError(loc, GetOperatorString(op), child->getCompleteString());
- return nullptr;
- }
- break;
- case EOpBitwiseNot:
- if ((child->getBasicType() != EbtInt && child->getBasicType() != EbtUInt) ||
- child->isMatrix() || child->isArray())
- {
- unaryOpError(loc, GetOperatorString(op), child->getCompleteString());
- 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() ||
- IsOpaqueType(child->getBasicType()))
- {
- unaryOpError(loc, GetOperatorString(op), child->getCompleteString());
- return nullptr;
- }
- // Operators for built-ins are already type checked against their prototype.
- default:
- break;
- }
-
- if (child->getMemoryQualifier().writeonly)
- {
- unaryOpError(loc, GetOperatorString(op), child->getCompleteString());
- return nullptr;
- }
-
- TIntermUnary *node = new TIntermUnary(op, child);
- 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);
- 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);
-}
-
-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;
- case EOpIndexDirectStruct:
- UNREACHABLE();
-
- default:
- 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;
- }
-
- // GLSL ES 1.00 and 3.00 do not support implicit type casting.
- // So the basic type should usually match.
- if (!isBitShift && left->getBasicType() != right->getBasicType())
- {
- 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);
- node->setLine(loc);
-
- // See if we can fold constants.
- return node->fold(mDiagnostics);
-}
-
-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->getCompleteString(),
- right->getCompleteString());
- 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->getCompleteString(),
- right->getCompleteString());
- node = CreateBoolNode(false);
- node->setLine(loc);
- }
- return node;
-}
-
-TIntermBinary *TParseContext::createAssign(TOperator op,
- TIntermTyped *left,
- TIntermTyped *right,
- const TSourceLoc &loc)
-{
- if (binaryOpCommonCheck(op, left, right, loc))
- {
- if (op == EOpMulAssign)
- {
- op = TIntermBinary::GetMulAssignOpBasedOnOperands(left->getType(), right->getType());
- if (!isMultiplicationTypeCombinationValid(op, left->getType(), right->getType()))
- {
- return nullptr;
- }
- }
- TIntermBinary *node = new TIntermBinary(op, left, right);
- node->setLine(loc);
-
- return node;
- }
- return nullptr;
-}
-
-TIntermTyped *TParseContext::addAssign(TOperator op,
- TIntermTyped *left,
- TIntermTyped *right,
- const TSourceLoc &loc)
-{
- checkCanBeLValue(loc, "assign", left);
- TIntermTyped *node = createAssign(op, left, right, loc);
- if (node == nullptr)
- {
- assignError(loc, "assign", left->getCompleteString(), right->getCompleteString());
- return left;
- }
- 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 = new TIntermBinary(EOpComma, left, right);
- TQualifier resultQualifier = TIntermBinary::GetCommaQualifier(mShaderVersion, left, right);
- commaNode->getTypePointer()->setQualifier(resultQualifier);
- return commaNode->fold(mDiagnostics);
-}
-
-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)
- {
- 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::checkTextureGather(TIntermAggregate *functionCall)
-{
- ASSERT(functionCall->getOp() == EOpCallBuiltInFunction);
- const TString &name = functionCall->getFunctionSymbolInfo()->getName();
- bool isTextureGather = (name == "textureGather");
- bool isTextureGatherOffset = (name == "textureGatherOffset");
- if (isTextureGather || isTextureGatherOffset)
- {
- 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 ((isTextureGather && 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",
- name.c_str());
- }
- else
- {
- int component = componentConstantUnion->getIConst(0);
- if (component < 0 || component > 3)
- {
- error(functionCall->getLine(), "Component must be in the range [0;3]",
- name.c_str());
- }
- }
- }
- }
-}
-
-void TParseContext::checkTextureOffsetConst(TIntermAggregate *functionCall)
-{
- ASSERT(functionCall->getOp() == EOpCallBuiltInFunction);
- const TString &name = functionCall->getFunctionSymbolInfo()->getName();
- TIntermNode *offset = nullptr;
- TIntermSequence *arguments = functionCall->getSequence();
- bool useTextureGatherOffsetConstraints = false;
- if (name == "texelFetchOffset" || name == "textureLodOffset" ||
- name == "textureProjLodOffset" || name == "textureGradOffset" ||
- name == "textureProjGradOffset")
- {
- offset = arguments->back();
- }
- else if (name == "textureOffset" || name == "textureProjOffset")
- {
- // A bias parameter might follow the offset parameter.
- ASSERT(arguments->size() >= 3);
- offset = (*arguments)[2];
- }
- else if (name == "textureGatherOffset")
- {
- 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",
- name.c_str());
- }
- else
- {
- ASSERT(offsetConstantUnion->getBasicType() == EbtInt);
- size_t size = offsetConstantUnion->getType().getObjectSize();
- const TConstantUnion *values = offsetConstantUnion->getUnionArrayPointer();
- 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;
- 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 TString &name = functionCall->getFunctionSymbolInfo()->getName();
- if (IsAtomicBuiltin(name))
- {
- 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.",
- functionCall->getFunctionSymbolInfo()->getName().c_str());
- }
-}
-
-// GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
-void TParseContext::checkImageMemoryAccessForBuiltinFunctions(TIntermAggregate *functionCall)
-{
- ASSERT(functionCall->getOp() == EOpCallBuiltInFunction);
- const TString &name = functionCall->getFunctionSymbolInfo()->getName();
-
- if (name.compare(0, 5, "image") == 0)
- {
- TIntermSequence *arguments = functionCall->getSequence();
- TIntermTyped *imageNode = (*arguments)[0]->getAsTyped();
-
- const TMemoryQualifier &memoryQualifier = imageNode->getMemoryQualifier();
-
- if (name.compare(5, 5, "Store") == 0)
- {
- if (memoryQualifier.readonly)
- {
- error(imageNode->getLine(),
- "'imageStore' cannot be used with images qualified as 'readonly'",
- GetImageArgumentToken(imageNode));
- }
- }
- else if (name.compare(5, 4, "Load") == 0)
- {
- 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).type;
- 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));
- }
- }
- }
-}
-
-TIntermSequence *TParseContext::createEmptyArgumentsList()
-{
- return new TIntermSequence();
-}
-
-TIntermTyped *TParseContext::addFunctionCallOrMethod(TFunction *fnCall,
- TIntermSequence *arguments,
- TIntermNode *thisNode,
- const TSourceLoc &loc)
-{
- if (thisNode != nullptr)
- {
- return addMethod(fnCall, arguments, thisNode, loc);
- }
-
- TOperator op = fnCall->getBuiltInOp();
- if (op == EOpConstruct)
- {
- return addConstructor(arguments, fnCall->getReturnType(), loc);
- }
- else
- {
- ASSERT(op == EOpNull);
- return addNonConstructorFunctionCall(fnCall, arguments, loc);
- }
-}
-
-TIntermTyped *TParseContext::addMethod(TFunction *fnCall,
- TIntermSequence *arguments,
- TIntermNode *thisNode,
- const TSourceLoc &loc)
-{
- TIntermTyped *typedThis = thisNode->getAsTyped();
- // 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->getName() below is safe.
- if (fnCall->getName() != "length")
- {
- error(loc, "invalid method", fnCall->getName().c_str());
- }
- else if (!arguments->empty())
- {
- error(loc, "method takes no parameters", "length");
- }
- else if (typedThis == nullptr || !typedThis->isArray())
- {
- error(loc, "length can only be called on arrays", "length");
- }
- else if (typedThis->getQualifier() == EvqPerVertexIn &&
- mGeometryShaderInputPrimitiveType == EptUndefined)
- {
- ASSERT(mShaderType == GL_GEOMETRY_SHADER_OES);
- error(loc, "missing input primitive declaration before calling length on gl_in", "length");
- }
- else
- {
- TIntermUnary *node = new TIntermUnary(EOpArrayLength, typedThis);
- node->setLine(loc);
- return node->fold(mDiagnostics);
- }
- return CreateZeroNode(TType(EbtInt, EbpUndefined, EvqConst));
-}
-
-TIntermTyped *TParseContext::addNonConstructorFunctionCall(TFunction *fnCall,
- TIntermSequence *arguments,
- const TSourceLoc &loc)
-{
- // First find by unmangled name to check whether the function name has been
- // hidden by a variable name or struct typename.
- // If a function is found, check for one with a matching argument list.
- bool builtIn;
- const TSymbol *symbol = symbolTable.find(fnCall->getName(), mShaderVersion, &builtIn);
- if (symbol != nullptr && !symbol->isFunction())
- {
- error(loc, "function name expected", fnCall->getName().c_str());
- }
- else
- {
- symbol = symbolTable.find(TFunction::GetMangledNameFromCall(fnCall->getName(), *arguments),
- mShaderVersion, &builtIn);
- if (symbol == nullptr)
- {
- error(loc, "no matching overloaded function found", fnCall->getName().c_str());
- }
- else
- {
- const TFunction *fnCandidate = static_cast<const TFunction *>(symbol);
- //
- // A declared function.
- //
- if (builtIn && fnCandidate->getExtension() != TExtension::UNDEFINED)
- {
- checkCanUseExtension(loc, fnCandidate->getExtension());
- }
- TOperator op = fnCandidate->getBuiltInOp();
- if (builtIn && op != EOpNull)
- {
- // A function call mapped to a built-in operation.
- if (fnCandidate->getParamCount() == 1)
- {
- // Treat it like a built-in unary operator.
- TIntermNode *unaryParamNode = arguments->front();
- TIntermTyped *callNode = createUnaryMath(op, unaryParamNode->getAsTyped(), loc);
- ASSERT(callNode != nullptr);
- return callNode;
- }
- else
- {
- TIntermAggregate *callNode =
- TIntermAggregate::Create(fnCandidate->getReturnType(), op, arguments);
- callNode->setLine(loc);
-
- // Some built-in functions have out parameters too.
- functionCallRValueLValueErrorCheck(fnCandidate, callNode);
-
- if (TIntermAggregate::CanFoldAggregateBuiltInOp(callNode->getOp()))
- {
- // 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);
- }
- else
- {
- return callNode;
- }
- }
- }
- else
- {
- // This is a real function call
- TIntermAggregate *callNode = nullptr;
-
- // If builtIn == false, the function is user defined - could be an overloaded
- // built-in as well.
- // if builtIn == true, it's a builtIn function with no op associated with it.
- // This needs to happen after the function info including name is set.
- if (builtIn)
- {
- callNode = TIntermAggregate::CreateBuiltInFunctionCall(*fnCandidate, arguments);
- checkTextureOffsetConst(callNode);
- checkTextureGather(callNode);
- checkImageMemoryAccessForBuiltinFunctions(callNode);
- checkAtomicMemoryBuiltinFunctions(callNode);
- }
- else
- {
- callNode = TIntermAggregate::CreateFunctionCall(*fnCandidate, arguments);
- checkImageMemoryAccessForUserDefinedFunctions(fnCandidate, callNode);
- }
-
- functionCallRValueLValueErrorCheck(fnCandidate, callNode);
-
- callNode->setLine(loc);
-
- return callNode;
- }
- }
- }
-
- // 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())
- {
- std::stringstream reasonStream;
- reasonStream << "mismatching ternary operator operand types '"
- << trueExpression->getCompleteString() << " and '"
- << falseExpression->getCompleteString() << "'";
- std::string reason = reasonStream.str();
- error(loc, reason.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;
- }
-
- // Note that the node resulting from here can be a constant union without being qualified as
- // constant.
- TIntermTernary *node = new TIntermTernary(cond, trueExpression, falseExpression);
- node->setLine(loc);
-
- return node->fold();
-}
-
-//
-// 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/src/3rdparty/angle/src/compiler/translator/ParseContext.h b/src/3rdparty/angle/src/compiler/translator/ParseContext.h
deleted file mode 100644
index 8bfdbd5e3f..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ParseContext.h
+++ /dev/null
@@ -1,657 +0,0 @@
-//
-// 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/translator/Compiler.h"
-#include "compiler/translator/Diagnostics.h"
-#include "compiler/translator/DirectiveHandler.h"
-#include "compiler/translator/SymbolTable.h"
-#include "compiler/translator/QualifierTypes.h"
-#include "compiler/preprocessor/Preprocessor.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();
-
- const pp::Preprocessor &getPreprocessor() const { return mPreprocessor; }
- 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 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 TString *name,
- const TSymbol *symbol);
- TIntermTyped *parseVariableIdentifier(const TSourceLoc &location,
- const TString *name,
- const TSymbol *symbol);
-
- // Look at a '.' field selector string and change it into offsets for a vector.
- bool parseVectorFields(const TSourceLoc &line,
- const TString &compString,
- int vecSize,
- TVector<int> *fieldOffsets);
-
- void assignError(const TSourceLoc &line, const char *op, TString left, TString right);
- void unaryOpError(const TSourceLoc &line, const char *op, TString operand);
- void binaryOpError(const TSourceLoc &line, const char *op, TString left, TString right);
-
- // Check functions - the ones that return bool return false if an error was generated.
-
- bool checkIsNotReserved(const TSourceLoc &line, const TString &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 TString &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 TString &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 TString &identifier,
- TType type,
- TIntermTyped *initializer,
- TIntermBinary **initNode);
- TIntermNode *addConditionInitializer(const TPublicType &pType,
- const TString &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 TString &identifier);
- TIntermDeclaration *parseSingleArrayDeclaration(TPublicType &elementType,
- const TSourceLoc &identifierLocation,
- const TString &identifier,
- const TSourceLoc &indexLocation,
- const TVector<unsigned int> &arraySizes);
- TIntermDeclaration *parseSingleInitDeclaration(const TPublicType &publicType,
- const TSourceLoc &identifierLocation,
- const TString &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 TString &identifier,
- const TSourceLoc &indexLocation,
- const TVector<unsigned int> &arraySizes,
- const TSourceLoc &initLocation,
- TIntermTyped *initializer);
-
- TIntermInvariantDeclaration *parseInvariantDeclaration(
- const TTypeQualifierBuilder &typeQualifierBuilder,
- const TSourceLoc &identifierLoc,
- const TString *identifier,
- const TSymbol *symbol);
-
- void parseDeclarator(TPublicType &publicType,
- const TSourceLoc &identifierLocation,
- const TString &identifier,
- TIntermDeclaration *declarationOut);
- void parseArrayDeclarator(TPublicType &elementType,
- const TSourceLoc &identifierLocation,
- const TString &identifier,
- const TSourceLoc &arrayLocation,
- const TVector<unsigned int> &arraySizes,
- TIntermDeclaration *declarationOut);
- void parseInitDeclarator(const TPublicType &publicType,
- const TSourceLoc &identifierLocation,
- const TString &identifier,
- const TSourceLoc &initLocation,
- TIntermTyped *initializer,
- TIntermDeclaration *declarationOut);
-
- // Parse a declarator like "a[n] = initializer"
- void parseArrayInitDeclarator(const TPublicType &elementType,
- const TSourceLoc &identifierLocation,
- const TString &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,
- TFunction **function,
- TIntermFunctionPrototype **prototypeOut);
- TFunction *parseFunctionDeclarator(const TSourceLoc &location, TFunction *function);
- TFunction *parseFunctionHeader(const TPublicType &type,
- const TString *name,
- const TSourceLoc &location);
- TFunction *addNonConstructorFunc(const TString *name, const TSourceLoc &loc);
- TFunction *addConstructorFunc(const TPublicType &publicType);
- TParameter parseParameterDeclarator(const TPublicType &publicType,
- const TString *name,
- const TSourceLoc &nameLoc);
-
- TParameter parseParameterArrayDeclarator(const TString *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 TString &fieldString,
- const TSourceLoc &fieldLocation);
-
- // Parse declarator for a single field
- TField *parseStructDeclarator(TString *identifier, const TSourceLoc &loc);
- TField *parseStructArrayDeclarator(TString *identifier,
- const TSourceLoc &loc,
- const TVector<unsigned int> &arraySizes,
- const TSourceLoc &arraySizeLoc);
-
- void checkDoesNotHaveDuplicateFieldName(const TFieldList::const_iterator begin,
- const TFieldList::const_iterator end,
- const TString &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,
- TFieldList *fieldList);
- TFieldList *addStructDeclaratorList(const TPublicType &typeSpecifier, TFieldList *fieldList);
- TTypeSpecifierNonArray addStructure(const TSourceLoc &structLine,
- const TSourceLoc &nameLine,
- const TString *structName,
- TFieldList *fieldList);
-
- TIntermDeclaration *addInterfaceBlock(const TTypeQualifierBuilder &typeQualifierBuilder,
- const TSourceLoc &nameLine,
- const TString &blockName,
- TFieldList *fieldList,
- const TString *instanceName,
- const TSourceLoc &instanceLine,
- TIntermTyped *arrayIndex,
- const TSourceLoc &arrayIndexLine);
-
- void parseLocalSize(const TString &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);
- TLayoutQualifier parseLayoutQualifier(const TString &qualifierType,
- const TSourceLoc &qualifierTypeLine);
- TLayoutQualifier parseLayoutQualifier(const TString &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 TString &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 checkTextureGather(TIntermAggregate *functionCall);
- void checkTextureOffsetConst(TIntermAggregate *functionCall);
- void checkImageMemoryAccessForBuiltinFunctions(TIntermAggregate *functionCall);
- void checkImageMemoryAccessForUserDefinedFunctions(const TFunction *functionDefinition,
- const TIntermAggregate *functionCall);
- void checkAtomicMemoryBuiltinFunctions(TIntermAggregate *functionCall);
- TIntermSequence *createEmptyArgumentsList();
-
- // fnCall is only storing the built-in op, and function name or constructor type. arguments
- // has the arguments.
- TIntermTyped *addFunctionCallOrMethod(TFunction *fnCall,
- TIntermSequence *arguments,
- TIntermNode *thisNode,
- 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;
-
- // 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 TString &identifier,
- const TType &type,
- TVariable **variable);
-
- void checkCanBeDeclaredWithoutInitializer(const TSourceLoc &line,
- const TString &identifier,
- TType *type);
-
- TParameter parseParameterDeclarator(TType *type,
- const TString *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 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(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 char *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 char *token,
- TType *arrayType);
-
- TIntermTyped *addBinaryMathInternal(TOperator op,
- TIntermTyped *left,
- TIntermTyped *right,
- const TSourceLoc &loc);
- TIntermBinary *createAssign(TOperator op,
- TIntermTyped *left,
- TIntermTyped *right,
- const TSourceLoc &loc);
- TIntermTyped *createUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &loc);
-
- TIntermTyped *addMethod(TFunction *fnCall,
- TIntermSequence *arguments,
- TIntermNode *thisNode,
- const TSourceLoc &loc);
- TIntermTyped *addConstructor(TIntermSequence *arguments,
- TType type,
- const TSourceLoc &line);
- TIntermTyped *addNonConstructorFunctionCall(TFunction *fnCall,
- TIntermSequence *arguments,
- const TSourceLoc &loc);
-
- // 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;
- pp::Preprocessor mPreprocessor;
- void *mScanner;
- bool mUsesFragData; // track if we are using both gl_FragData and gl_FragColor
- bool mUsesFragColor;
- bool mUsesSecondaryOutputs; // Track if we are using either gl_SecondaryFragData or
- // gl_Secondary FragColor or both.
- 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 if all input array sizes are same and matches the latter input primitive declaration.
- unsigned int mGeometryShaderInputArraySize;
-};
-
-int PaParseStrings(size_t count,
- const char *const string[],
- const int length[],
- TParseContext *context);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_PARSECONTEXT_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/PoolAlloc.cpp b/src/3rdparty/angle/src/compiler/translator/PoolAlloc.cpp
deleted file mode 100644
index 0f1cd8b5c9..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/PoolAlloc.cpp
+++ /dev/null
@@ -1,360 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/translator/PoolAlloc.h"
-
-#include <stdint.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include "common/angleutils.h"
-#include "common/debug.h"
-#include "common/platform.h"
-#include "common/tls.h"
-#include "compiler/translator/InitializeGlobals.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;
-}
-
-TPoolAllocator *GetGlobalPoolAllocator()
-{
- assert(PoolIndex != TLS_INVALID_INDEX);
- return static_cast<TPoolAllocator *>(GetTLSValue(PoolIndex));
-}
-
-void SetGlobalPoolAllocator(TPoolAllocator *poolAllocator)
-{
- assert(PoolIndex != TLS_INVALID_INDEX);
- SetTLSValue(PoolIndex, poolAllocator);
-}
-
-//
-// Implement the functionality of the TPoolAllocator class, which
-// is documented in PoolAlloc.h.
-//
-TPoolAllocator::TPoolAllocator(int growthIncrement, int allocationAlignment)
- : alignment(allocationAlignment),
-#if !defined(ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC)
- pageSize(growthIncrement),
- freeList(0),
- inUseList(0),
- numCalls(0),
- totalBytes(0),
-#endif
- mLocked(false)
-{
- //
- // Adjust alignment to be at least pointer aligned and
- // power of 2.
- //
- size_t minAlign = sizeof(void *);
- alignment &= ~(minAlign - 1);
- if (alignment < minAlign)
- alignment = minAlign;
- size_t a = 1;
- while (a < alignment)
- a <<= 1;
- alignment = a;
- alignmentMask = a - 1;
-
-#if !defined(ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC)
- //
- // Don't allow page sizes we know are smaller than all common
- // OS page sizes.
- //
- if (pageSize < 4 * 1024)
- pageSize = 4 * 1024;
-
- //
- // A large currentPageOffset indicates a new page needs to
- // be obtained to allocate memory.
- //
- currentPageOffset = pageSize;
-
- //
- // Align header skip
- //
- headerSkip = minAlign;
- if (headerSkip < sizeof(tHeader))
- {
- headerSkip = (sizeof(tHeader) + alignmentMask) & ~alignmentMask;
- }
-#else // !defined(ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC)
- mStack.push_back({});
-#endif
-}
-
-TPoolAllocator::~TPoolAllocator()
-{
-#if !defined(ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC)
- while (inUseList)
- {
- tHeader *next = inUseList->nextPage;
- inUseList->~tHeader();
- delete[] reinterpret_cast<char *>(inUseList);
- inUseList = next;
- }
-
- // We should not check the guard blocks
- // here, because we did it already when the block was
- // placed into the free list.
- //
- while (freeList)
- {
- tHeader *next = freeList->nextPage;
- delete[] reinterpret_cast<char *>(freeList);
- freeList = next;
- }
-#else // !defined(ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC)
- for (auto &allocs : mStack)
- {
- for (auto alloc : allocs)
- {
- free(alloc);
- }
- }
- mStack.clear();
-#endif
-}
-
-// Support MSVC++ 6.0
-const unsigned char TAllocation::guardBlockBeginVal = 0xfb;
-const unsigned char TAllocation::guardBlockEndVal = 0xfe;
-const unsigned char TAllocation::userDataFill = 0xcd;
-
-#ifdef GUARD_BLOCKS
-const size_t TAllocation::guardBlockSize = 16;
-#else
-const size_t TAllocation::guardBlockSize = 0;
-#endif
-
-//
-// Check a single guard block for damage
-//
-void TAllocation::checkGuardBlock(unsigned char *blockMem,
- unsigned char val,
- const char *locText) const
-{
-#ifdef GUARD_BLOCKS
- for (size_t x = 0; x < guardBlockSize; x++)
- {
- if (blockMem[x] != val)
- {
- char assertMsg[80];
-
-// We don't print the assert message. It's here just to be helpful.
-#if defined(_MSC_VER)
- snprintf(assertMsg, sizeof(assertMsg),
- "PoolAlloc: Damage %s %Iu byte allocation at 0x%p\n", locText, size, data());
-#else
- snprintf(assertMsg, sizeof(assertMsg),
- "PoolAlloc: Damage %s %zu byte allocation at 0x%p\n", locText, size, data());
-#endif
- assert(0 && "PoolAlloc: Damage in guard block");
- }
- }
-#endif
-}
-
-void TPoolAllocator::push()
-{
-#if !defined(ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC)
- tAllocState state = {currentPageOffset, inUseList};
-
- mStack.push_back(state);
-
- //
- // Indicate there is no current page to allocate from.
- //
- currentPageOffset = pageSize;
-#else // !defined(ANGLE_TRANSLATOR_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 TPoolAllocator::pop()
-{
- if (mStack.size() < 1)
- return;
-
-#if !defined(ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC)
- tHeader *page = mStack.back().page;
- currentPageOffset = mStack.back().offset;
-
- while (inUseList != page)
- {
- // invoke destructor to free allocation list
- inUseList->~tHeader();
-
- tHeader *nextInUse = inUseList->nextPage;
- if (inUseList->pageCount > 1)
- delete[] reinterpret_cast<char *>(inUseList);
- else
- {
- inUseList->nextPage = freeList;
- freeList = inUseList;
- }
- inUseList = nextInUse;
- }
-
- mStack.pop_back();
-#else // !defined(ANGLE_TRANSLATOR_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 TPoolAllocator::popAll()
-{
- while (mStack.size() > 0)
- pop();
-}
-
-void *TPoolAllocator::allocate(size_t numBytes)
-{
- ASSERT(!mLocked);
-
-#if !defined(ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC)
- //
- // Just keep some interesting statistics.
- //
- ++numCalls;
- totalBytes += 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,
- // guardBlockSize=0 and this all gets optimized away.
- size_t allocationSize = TAllocation::allocationSize(numBytes);
- // 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 <= pageSize - currentPageOffset)
- {
- //
- // Safe to allocate from currentPageOffset.
- //
- unsigned char *memory = reinterpret_cast<unsigned char *>(inUseList) + currentPageOffset;
- currentPageOffset += allocationSize;
- currentPageOffset = (currentPageOffset + alignmentMask) & ~alignmentMask;
-
- return initializeAllocation(inUseList, memory, numBytes);
- }
-
- if (allocationSize > pageSize - headerSkip)
- {
- //
- // Do a multi-page allocation. Don't mix these with the others.
- // The OS is efficient and allocating and free-ing multiple pages.
- //
- size_t numBytesToAlloc = allocationSize + headerSkip;
- // Detect integer overflow.
- if (numBytesToAlloc < allocationSize)
- return 0;
-
- tHeader *memory = reinterpret_cast<tHeader *>(::new char[numBytesToAlloc]);
- if (memory == 0)
- return 0;
-
- // Use placement-new to initialize header
- new (memory) tHeader(inUseList, (numBytesToAlloc + pageSize - 1) / pageSize);
- inUseList = memory;
-
- currentPageOffset = pageSize; // make next allocation come from a new page
-
- // No guard blocks for multi-page allocations (yet)
- return reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(memory) + headerSkip);
- }
-
- //
- // Need a simple page to allocate from.
- //
- tHeader *memory;
- if (freeList)
- {
- memory = freeList;
- freeList = freeList->nextPage;
- }
- else
- {
- memory = reinterpret_cast<tHeader *>(::new char[pageSize]);
- if (memory == 0)
- return 0;
- }
-
- // Use placement-new to initialize header
- new (memory) tHeader(inUseList, 1);
- inUseList = memory;
-
- unsigned char *ret = reinterpret_cast<unsigned char *>(inUseList) + headerSkip;
- currentPageOffset = (headerSkip + allocationSize + alignmentMask) & ~alignmentMask;
-
- return initializeAllocation(inUseList, ret, numBytes);
-#else // !defined(ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC)
- void *alloc = malloc(numBytes + alignmentMask);
- mStack.back().push_back(alloc);
-
- intptr_t intAlloc = reinterpret_cast<intptr_t>(alloc);
- intAlloc = (intAlloc + alignmentMask) & ~alignmentMask;
- return reinterpret_cast<void *>(intAlloc);
-#endif
-}
-
-void TPoolAllocator::lock()
-{
- ASSERT(!mLocked);
- mLocked = true;
-}
-
-void TPoolAllocator::unlock()
-{
- ASSERT(mLocked);
- mLocked = false;
-}
-
-//
-// Check all allocations in a list for damage by calling check on each.
-//
-void TAllocation::checkAllocList() const
-{
- for (const TAllocation *alloc = this; alloc != 0; alloc = alloc->prevAlloc)
- alloc->check();
-}
diff --git a/src/3rdparty/angle/src/compiler/translator/PoolAlloc.h b/src/3rdparty/angle/src/compiler/translator/PoolAlloc.h
deleted file mode 100644
index ad63bc4cd6..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/PoolAlloc.h
+++ /dev/null
@@ -1,319 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_TRANSLATOR_POOLALLOC_H_
-#define COMPILER_TRANSLATOR_POOLALLOC_H_
-
-#ifdef _DEBUG
-#define 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.
-//
-// STL containers can use this allocator by using the pool_allocator
-// class as the allocator (second) template argument.
-//
-
-#include <stddef.h>
-#include <string.h>
-#include <vector>
-
-// If we are using guard blocks, we must track each indivual
-// allocation. If we aren't using guard blocks, these
-// never get instantiated, so won't have any impact.
-//
-
-class TAllocation
-{
- public:
- TAllocation(size_t size, unsigned char *mem, TAllocation *prev = 0)
- : size(size), mem(mem), prevAlloc(prev)
- {
-// Allocations are bracketed:
-// [allocationHeader][initialGuardBlock][userData][finalGuardBlock]
-// This would be cleaner with if (guardBlockSize)..., but that
-// makes the compiler print warnings about 0 length memsets,
-// even with the if() protecting them.
-#ifdef GUARD_BLOCKS
- memset(preGuard(), guardBlockBeginVal, guardBlockSize);
- memset(data(), userDataFill, size);
- memset(postGuard(), guardBlockEndVal, guardBlockSize);
-#endif
- }
-
- void check() const
- {
- checkGuardBlock(preGuard(), guardBlockBeginVal, "before");
- checkGuardBlock(postGuard(), guardBlockEndVal, "after");
- }
-
- void checkAllocList() const;
-
- // Return total size needed to accomodate user buffer of 'size',
- // plus our tracking data.
- inline static size_t allocationSize(size_t size)
- {
- return size + 2 * guardBlockSize + headerSize();
- }
-
- // Offset from surrounding buffer to get to user data buffer.
- inline static unsigned char *offsetAllocation(unsigned char *m)
- {
- return m + guardBlockSize + 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 mem + headerSize(); }
- unsigned char *data() const { return preGuard() + guardBlockSize; }
- unsigned char *postGuard() const { return data() + size; }
-
- size_t size; // size of the user data area
- unsigned char *mem; // beginning of our allocation (pts to header)
- TAllocation *prevAlloc; // prior allocation in the chain
-
- // Support MSVC++ 6.0
- const static unsigned char guardBlockBeginVal;
- const static unsigned char guardBlockEndVal;
- const static unsigned char userDataFill;
-
- const static size_t guardBlockSize;
-#ifdef GUARD_BLOCKS
- inline static size_t headerSize() { return sizeof(TAllocation); }
-#else
- inline static 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 TPoolAllocator
-{
- public:
- TPoolAllocator(int growthIncrement = 8 * 1024, int allocationAlignment = 16);
-
- //
- // Don't call the destructor just to free up the memory, call pop()
- //
- ~TPoolAllocator();
-
- //
- // Call push() to establish a new place to pop memory too. 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);
-
- //
- // 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 alignment; // all returned allocations will be aligned at
- // this granularity, which will be a power of 2
- size_t alignmentMask;
-
-#if !defined(ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC)
- friend struct tHeader;
-
- struct tHeader
- {
- tHeader(tHeader *nextPage, size_t pageCount)
- : nextPage(nextPage),
- pageCount(pageCount)
-#ifdef GUARD_BLOCKS
- ,
- lastAllocation(0)
-#endif
- {
- }
-
- ~tHeader()
- {
-#ifdef GUARD_BLOCKS
- if (lastAllocation)
- lastAllocation->checkAllocList();
-#endif
- }
-
- tHeader *nextPage;
- size_t pageCount;
-#ifdef GUARD_BLOCKS
- TAllocation *lastAllocation;
-#endif
- };
-
- struct tAllocState
- {
- size_t offset;
- tHeader *page;
- };
- typedef std::vector<tAllocState> tAllocStack;
-
- // Track allocations if and only if we're using guard blocks
- void *initializeAllocation(tHeader *block, unsigned char *memory, size_t numBytes)
- {
-#ifdef GUARD_BLOCKS
- new (memory) TAllocation(numBytes, memory, block->lastAllocation);
- block->lastAllocation = reinterpret_cast<TAllocation *>(memory);
-#endif
- // This is optimized entirely away if GUARD_BLOCKS is not defined.
- return TAllocation::offsetAllocation(memory);
- }
-
- size_t pageSize; // granularity of allocation from the OS
- size_t headerSkip; // amount of memory to skip to make room for the
- // header (basically, size of header, rounded
- // up to make it aligned
- size_t currentPageOffset; // next offset in top of inUseList to allocate from
- tHeader *freeList; // list of popped memory
- tHeader *inUseList; // list of all memory currently being used
- tAllocStack mStack; // stack of where to allocate from, to partition pool
-
- int numCalls; // just an interesting statistic
- size_t totalBytes; // just an interesting statistic
-
-#else // !defined(ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC)
- std::vector<std::vector<void *>> mStack;
-#endif
-
- TPoolAllocator &operator=(const TPoolAllocator &); // dont allow assignment operator
- TPoolAllocator(const TPoolAllocator &); // dont allow default copy constructor
- bool mLocked;
-};
-
-//
-// 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 TPoolAllocator *GetGlobalPoolAllocator();
-extern void SetGlobalPoolAllocator(TPoolAllocator *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 reinterpret_cast<pointer>(getAllocator().allocate(n * sizeof(T)));
- }
- pointer allocate(size_type n, const void *)
- {
- return reinterpret_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; }
-
- TPoolAllocator &getAllocator() const { return *GetGlobalPoolAllocator(); }
-};
-
-#endif // COMPILER_TRANSLATOR_POOLALLOC_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/Pragma.h b/src/3rdparty/angle/src/compiler/translator/Pragma.h
deleted file mode 100644
index 8c419fc17e..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Pragma.h
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#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/src/3rdparty/angle/src/compiler/translator/PruneNoOps.cpp b/src/3rdparty/angle/src/compiler/translator/PruneNoOps.cpp
deleted file mode 100644
index 6c9a02cd1c..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/PruneNoOps.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-//
-// 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/PruneNoOps.h"
-
-#include "compiler/translator/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);
-
- private:
- PruneNoOpsTraverser();
- 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)
-{
- PruneNoOpsTraverser prune;
- root->traverse(&prune);
- prune.updateTree();
-}
-
-PruneNoOpsTraverser::PruneNoOpsTraverser() : TIntermTraverser(true, false, false)
-{
-}
-
-bool PruneNoOpsTraverser::visitDeclaration(Visit, TIntermDeclaration *node)
-{
- TIntermSequence *sequence = node->getSequence();
- if (sequence->size() >= 1)
- {
- TIntermSymbol *sym = sequence->front()->getAsSymbolNode();
- // Prune declarations without a variable name, unless it's an interface block declaration.
- if (sym != nullptr && sym->getSymbol() == "" && !sym->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, sym, emptyReplacement));
- }
- else if (sym->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 (sym->getType().getQualifier() != EvqGlobal &&
- sym->getType().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."
-
- if (mInGlobalScope)
- {
- sym->getTypePointer()->setQualifier(EvqGlobal);
- }
- else
- {
- sym->getTypePointer()->setQualifier(EvqTemporary);
- }
- }
- }
- }
- 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)
-{
- PruneNoOpsTraverser::apply(root);
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/PruneNoOps.h b/src/3rdparty/angle/src/compiler/translator/PruneNoOps.h
deleted file mode 100644
index c421cecca4..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/PruneNoOps.h
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// 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_PRUNENOOPS_H_
-#define COMPILER_TRANSLATOR_PRUNENOOPS_H_
-
-namespace sh
-{
-class TIntermBlock;
-
-void PruneNoOps(TIntermBlock *root);
-}
-
-#endif // COMPILER_TRANSLATOR_PRUNENOOPS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/QualifierTypes.cpp b/src/3rdparty/angle/src/compiler/translator/QualifierTypes.cpp
deleted file mode 100644
index f748175957..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/QualifierTypes.cpp
+++ /dev/null
@@ -1,784 +0,0 @@
-//
-// 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 <algorithm>
-
-namespace sh
-{
-
-namespace
-{
-
-// 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]);
-}
-
-// 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,
- std::string *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 = "The invariant qualifier specified multiple times.";
- return true;
- }
- invariantFound = true;
- break;
- }
- case QtPrecision:
- {
- if (precisionFound)
- {
- *errorMessage = "The precision qualifier specified multiple times.";
- return true;
- }
- precisionFound = true;
- break;
- }
- case QtLayout:
- {
- if (layoutFound && !areQualifierChecksRelaxed)
- {
- *errorMessage = "The layout qualifier specified multiple times.";
- 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 =
- "The layout qualifier and invariant qualifier cannot coexist in the same "
- "declaration according to the grammar.";
- 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 = "The interpolation qualifier specified multiple times.";
- 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 = previousQualifierWrapper->getQualifierString().c_str();
- *errorMessage += " specified multiple times";
- 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 = previousQualifierWrapper->getQualifierString().c_str();
- *errorMessage += " specified multiple times";
- 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 = "Output layout location specified multiple times.";
- 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,
- std::string *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 = "The invariant qualifier has to be first in the expression.";
- return false;
- }
- break;
- case QtInterpolation:
- if (foundStorage)
- {
- *errorMessage = "Storage qualifiers have to be after interpolation qualifiers.";
- return false;
- }
- else if (foundPrecision)
- {
- *errorMessage =
- "Precision qualifiers have to be after interpolation qualifiers.";
- return false;
- }
- foundInterpolation = true;
- break;
- case QtLayout:
- if (foundStorage)
- {
- *errorMessage = "Storage qualifiers have to be after layout qualifiers.";
- return false;
- }
- else if (foundPrecision)
- {
- *errorMessage = "Precision qualifiers have to be after layout qualifiers.";
- return false;
- }
- break;
- case QtStorage:
- if (foundPrecision)
- {
- *errorMessage = "Precision qualifiers have to be after storage qualifiers.";
- return false;
- }
- foundStorage = true;
- break;
- case QtMemory:
- if (foundPrecision)
- {
- *errorMessage = "Precision qualifiers have to be after memory qualifiers.";
- 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 TString &qualifierString = qualifier->getQualifierString();
- diagnostics->error(qualifier->getLine(), "invalid qualifier combination",
- qualifierString.c_str());
- 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 TString &qualifierString = qualifier->getQualifierString();
- diagnostics->error(qualifier->getLine(), "invalid parameter qualifier",
- qualifierString.c_str());
- 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;
- }
-
- 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);
- std::string errorMessage;
- if (HasRepeatingQualifiers(mQualifiers, areQualifierChecksRelaxed, &errorMessage))
- {
- diagnostics->error(mQualifiers[0]->getLine(), errorMessage.c_str(), "qualifier sequence");
- return false;
- }
-
- if (!areQualifierChecksRelaxed && !AreQualifiersInOrder(mQualifiers, &errorMessage))
- {
- diagnostics->error(mQualifiers[0]->getLine(), errorMessage.c_str(), "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/src/3rdparty/angle/src/compiler/translator/QualifierTypes.h b/src/3rdparty/angle/src/compiler/translator/QualifierTypes.h
deleted file mode 100644
index 10bdeed89d..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/QualifierTypes.h
+++ /dev/null
@@ -1,191 +0,0 @@
-//
-// 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/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 TString 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 { return QtInvariant; }
- TString getQualifierString() const { return "invariant"; }
- unsigned int getRank() const;
-};
-
-class TInterpolationQualifierWrapper final : public TQualifierWrapperBase
-{
- public:
- TInterpolationQualifierWrapper(TQualifier interpolationQualifier, const TSourceLoc &line)
- : TQualifierWrapperBase(line), mInterpolationQualifier(interpolationQualifier)
- {
- }
- ~TInterpolationQualifierWrapper() {}
-
- TQualifierType getType() const { return QtInterpolation; }
- TString getQualifierString() const { return sh::getQualifierString(mInterpolationQualifier); }
- TQualifier getQualifier() const { return mInterpolationQualifier; }
- unsigned int getRank() const;
-
- private:
- TQualifier mInterpolationQualifier;
-};
-
-class TLayoutQualifierWrapper final : public TQualifierWrapperBase
-{
- public:
- TLayoutQualifierWrapper(TLayoutQualifier layoutQualifier, const TSourceLoc &line)
- : TQualifierWrapperBase(line), mLayoutQualifier(layoutQualifier)
- {
- }
- ~TLayoutQualifierWrapper() {}
-
- TQualifierType getType() const { return QtLayout; }
- TString getQualifierString() const { return "layout"; }
- const TLayoutQualifier &getQualifier() const { return mLayoutQualifier; }
- unsigned int getRank() const;
-
- private:
- TLayoutQualifier mLayoutQualifier;
-};
-
-class TStorageQualifierWrapper final : public TQualifierWrapperBase
-{
- public:
- TStorageQualifierWrapper(TQualifier storageQualifier, const TSourceLoc &line)
- : TQualifierWrapperBase(line), mStorageQualifier(storageQualifier)
- {
- }
- ~TStorageQualifierWrapper() {}
-
- TQualifierType getType() const { return QtStorage; }
- TString getQualifierString() const { return sh::getQualifierString(mStorageQualifier); }
- TQualifier getQualifier() const { return mStorageQualifier; }
- unsigned int getRank() const;
-
- private:
- TQualifier mStorageQualifier;
-};
-
-class TPrecisionQualifierWrapper final : public TQualifierWrapperBase
-{
- public:
- TPrecisionQualifierWrapper(TPrecision precisionQualifier, const TSourceLoc &line)
- : TQualifierWrapperBase(line), mPrecisionQualifier(precisionQualifier)
- {
- }
- ~TPrecisionQualifierWrapper() {}
-
- TQualifierType getType() const { return QtPrecision; }
- TString getQualifierString() const { return sh::getPrecisionString(mPrecisionQualifier); }
- TPrecision getQualifier() const { return mPrecisionQualifier; }
- unsigned int getRank() const;
-
- private:
- TPrecision mPrecisionQualifier;
-};
-
-class TMemoryQualifierWrapper final : public TQualifierWrapperBase
-{
- public:
- TMemoryQualifierWrapper(TQualifier memoryQualifier, const TSourceLoc &line)
- : TQualifierWrapperBase(line), mMemoryQualifier(memoryQualifier)
- {
- }
- ~TMemoryQualifierWrapper() {}
-
- TQualifierType getType() const { return QtMemory; }
- TString getQualifierString() const { return sh::getQualifierString(mMemoryQualifier); }
- TQualifier getQualifier() const { return mMemoryQualifier; }
- unsigned int getRank() const;
-
- 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/src/3rdparty/angle/src/compiler/translator/RecordConstantPrecision.cpp b/src/3rdparty/angle/src/compiler/translator/RecordConstantPrecision.cpp
deleted file mode 100644
index 5233a29f19..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RecordConstantPrecision.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-//
-// 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/RecordConstantPrecision.h"
-
-#include "compiler/translator/InfoSink.h"
-#include "compiler/translator/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.
- TIntermSequence insertions;
- insertions.push_back(createTempInitDeclaration(node, EvqConst));
- insertStatementsInParentBlock(insertions);
- queueReplacement(createTempSymbol(node->getType()), OriginalNode::IS_DROPPED);
- mFoundHigherPrecisionConstant = true;
-}
-
-void RecordConstantPrecisionTraverser::nextIteration()
-{
- nextTemporaryId();
- 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/src/3rdparty/angle/src/compiler/translator/RecordConstantPrecision.h b/src/3rdparty/angle/src/compiler/translator/RecordConstantPrecision.h
deleted file mode 100644
index f86c2a8693..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RecordConstantPrecision.h
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// 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_RECORDCONSTANTPRECISION_H_
-#define COMPILER_TRANSLATOR_RECORDCONSTANTPRECISION_H_
-
-namespace sh
-{
-class TIntermNode;
-class TSymbolTable;
-
-void RecordConstantPrecision(TIntermNode *root, TSymbolTable *symbolTable);
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_RECORDCONSTANTPRECISION_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.cpp b/src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.cpp
deleted file mode 100644
index 55fb124a42..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-//
-// 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 "common/debug.h"
-#include "compiler/translator/RegenerateStructNames.h"
-
-namespace sh
-{
-
-void RegenerateStructNames::visitSymbol(TIntermSymbol *symbol)
-{
- ASSERT(symbol);
- TType *type = symbol->getTypePointer();
- ASSERT(type);
- TStructure *userType = type->getStruct();
- if (!userType)
- return;
-
- if (mSymbolTable->findBuiltIn(userType->name(), mShaderVersion))
- {
- // Built-in struct, do not touch it.
- return;
- }
-
- int uniqueId = userType->uniqueId();
-
- 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}.
- const char kPrefix[] = "_webgl_struct_";
- if (userType->name().find(kPrefix) == 0)
- {
- // The name has already been regenerated.
- return;
- }
- std::string id = Str(uniqueId);
- TString tmp = kPrefix + TString(id.c_str());
- tmp += "_" + userType->name();
- 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/src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.h b/src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.h
deleted file mode 100644
index 293720b6a4..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.h
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_
-#define COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_
-
-#include "compiler/translator/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.h"
-
-#include <set>
-
-namespace sh
-{
-
-class RegenerateStructNames : public TIntermTraverser
-{
- public:
- RegenerateStructNames(TSymbolTable *symbolTable, int shaderVersion)
- : TIntermTraverser(true, false, false, symbolTable),
- mShaderVersion(shaderVersion),
- mScopeDepth(0)
- {
- }
-
- protected:
- void visitSymbol(TIntermSymbol *) override;
- bool visitBlock(Visit, TIntermBlock *block) override;
-
- private:
- int mShaderVersion;
-
- // Indicating the depth of the current scope.
- // The global scope is 1.
- int mScopeDepth;
-
- // If a struct's declared globally, push its ID in this set.
- std::set<int> mDeclaredGlobalStructs;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/RemoveArrayLengthMethod.cpp b/src/3rdparty/angle/src/compiler/translator/RemoveArrayLengthMethod.cpp
deleted file mode 100644
index e9e6a17013..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveArrayLengthMethod.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// 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/RemoveArrayLengthMethod.h"
-
-#include "compiler/translator/IntermNode.h"
-#include "compiler/translator/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/src/3rdparty/angle/src/compiler/translator/RemoveArrayLengthMethod.h b/src/3rdparty/angle/src/compiler/translator/RemoveArrayLengthMethod.h
deleted file mode 100644
index 3b2c6df824..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveArrayLengthMethod.h
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// 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.
-
-namespace sh
-{
-
-class TIntermBlock;
-
-void RemoveArrayLengthMethod(TIntermBlock *root);
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/RemoveDynamicIndexing.cpp b/src/3rdparty/angle/src/compiler/translator/RemoveDynamicIndexing.cpp
deleted file mode 100644
index 7766c1abc6..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveDynamicIndexing.cpp
+++ /dev/null
@@ -1,550 +0,0 @@
-//
-// 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 vectors and matrices,
-// replacing them with calls to functions that choose which component to return or write.
-//
-
-#include "compiler/translator/RemoveDynamicIndexing.h"
-
-#include "compiler/translator/Diagnostics.h"
-#include "compiler/translator/InfoSink.h"
-#include "compiler/translator/IntermNodePatternMatcher.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.h"
-
-namespace sh
-{
-
-namespace
-{
-
-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();
-}
-
-TIntermSymbol *CreateBaseSymbol(const TType &type, TQualifier qualifier, TSymbolTable *symbolTable)
-{
- TIntermSymbol *symbol = new TIntermSymbol(symbolTable->nextUniqueId(), "base", type);
- symbol->setInternal(true);
- symbol->getTypePointer()->setQualifier(qualifier);
- return symbol;
-}
-
-TIntermSymbol *CreateIndexSymbol(TSymbolTable *symbolTable)
-{
- TIntermSymbol *symbol =
- new TIntermSymbol(symbolTable->nextUniqueId(), "index", TType(EbtInt, EbpHigh));
- symbol->setInternal(true);
- symbol->getTypePointer()->setQualifier(EvqIn);
- return symbol;
-}
-
-TIntermSymbol *CreateValueSymbol(const TType &type, TSymbolTable *symbolTable)
-{
- TIntermSymbol *symbol = new TIntermSymbol(symbolTable->nextUniqueId(), "value", type);
- symbol->setInternal(true);
- symbol->getTypePointer()->setQualifier(EvqIn);
- return symbol;
-}
-
-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 = TType(indexedType.getBasicType(), indexedType.getPrecision());
- fieldType.setPrimarySize(static_cast<unsigned char>(indexedType.getRows()));
- return fieldType;
- }
- else
- {
- return TType(indexedType.getBasicType(), indexedType.getPrecision());
- }
-}
-
-// 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(TType type,
- bool write,
- const TSymbolUniqueId &functionId,
- TSymbolTable *symbolTable)
-{
- ASSERT(!type.isArray());
- // 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.
- type.setPrecision(EbpHigh);
-
- TType fieldType = GetFieldType(type);
- int numCases = 0;
- if (type.isMatrix())
- {
- numCases = type.getCols();
- }
- else
- {
- numCases = type.getNominalSize();
- }
-
- TType returnType(EbtVoid);
- if (!write)
- {
- returnType = fieldType;
- }
-
- std::string functionName = GetIndexFunctionName(type, write);
- TIntermFunctionPrototype *prototypeNode =
- CreateInternalFunctionPrototypeNode(returnType, functionName.c_str(), functionId);
-
- TQualifier baseQualifier = EvqInOut;
- if (!write)
- baseQualifier = EvqIn;
- TIntermSymbol *baseParam = CreateBaseSymbol(type, baseQualifier, symbolTable);
- prototypeNode->getSequence()->push_back(baseParam);
- TIntermSymbol *indexParam = CreateIndexSymbol(symbolTable);
- prototypeNode->getSequence()->push_back(indexParam);
- TIntermSymbol *valueParam = nullptr;
- if (write)
- {
- valueParam = CreateValueSymbol(fieldType, symbolTable);
- prototypeNode->getSequence()->push_back(valueParam);
- }
-
- 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));
- cond->setType(TType(EbtBool, EbpUndefined));
-
- // 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,
- int shaderVersion,
- 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, TSymbolUniqueId *> mIndexedVecAndMatrixTypes;
- std::map<TType, TSymbolUniqueId *> 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,
- int shaderVersion,
- PerformanceDiagnostics *perfDiagnostics)
- : TLValueTrackingTraverser(true, false, false, symbolTable, shaderVersion),
- 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,
- const TSymbolUniqueId &functionId)
-{
- ASSERT(node->getOp() == EOpIndexIndirect);
- TIntermSequence *arguments = new TIntermSequence();
- arguments->push_back(node->getLeft());
- arguments->push_back(index);
-
- TType fieldType = GetFieldType(node->getLeft()->getType());
- std::string functionName = GetIndexFunctionName(node->getLeft()->getType(), false);
- TIntermAggregate *indexingCall =
- CreateInternalFunctionCallNode(fieldType, functionName.c_str(), functionId, arguments);
- indexingCall->setLine(node->getLine());
- indexingCall->getFunctionSymbolInfo()->setKnownToNotHaveSideEffects(true);
- return indexingCall;
-}
-
-TIntermAggregate *CreateIndexedWriteFunctionCall(TIntermBinary *node,
- TIntermTyped *index,
- TIntermTyped *writtenValue,
- const TSymbolUniqueId &functionId)
-{
- 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(index->deepCopy());
- arguments->push_back(writtenValue);
-
- std::string functionName = GetIndexFunctionName(node->getLeft()->getType(), true);
- TIntermAggregate *indexedWriteCall =
- CreateInternalFunctionCallNode(TType(EbtVoid), functionName.c_str(), functionId, 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.
-
- // Init the temp variable holding the index
- TIntermDeclaration *initIndex = createTempInitDeclaration(node->getRight());
- insertStatementInParentBlock(initIndex);
- mUsedTreeInsertion = true;
-
- // Replace the index with the temp variable
- TIntermSymbol *tempIndex = createTempSymbol(node->getRight()->getType());
- queueReplacementWithParent(node, node->getRight(), tempIndex, OriginalNode::IS_DROPPED);
- }
- else if (IntermNodePatternMatcher::IsDynamicIndexingOfVectorOrMatrix(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();
- TSymbolUniqueId *indexingFunctionId = new TSymbolUniqueId(mSymbolTable);
- if (mIndexedVecAndMatrixTypes.find(type) == mIndexedVecAndMatrixTypes.end())
- {
- mIndexedVecAndMatrixTypes[type] = indexingFunctionId;
- }
- else
- {
- indexingFunctionId = 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::IsDynamicIndexingOfVectorOrMatrix(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
-
- TSymbolUniqueId *indexedWriteFunctionId = new TSymbolUniqueId(mSymbolTable);
- if (mWrittenVecAndMatrixTypes.find(type) == mWrittenVecAndMatrixTypes.end())
- {
- mWrittenVecAndMatrixTypes[type] = indexedWriteFunctionId;
- }
- else
- {
- indexedWriteFunctionId = mWrittenVecAndMatrixTypes[type];
- }
- TType fieldType = GetFieldType(type);
-
- TIntermSequence insertionsBefore;
- TIntermSequence insertionsAfter;
-
- // Store the index in a temporary signed int variable.
- TIntermTyped *indexInitializer = EnsureSignedInt(node->getRight());
- TIntermDeclaration *initIndex = createTempInitDeclaration(indexInitializer);
- initIndex->setLine(node->getLine());
- insertionsBefore.push_back(initIndex);
-
- // Create a node for referring to the index after the nextTemporaryId() call
- // below.
- TIntermSymbol *tempIndex = createTempSymbol(indexInitializer->getType());
-
- TIntermAggregate *indexingCall =
- CreateIndexFunctionCall(node, tempIndex, *indexingFunctionId);
-
- nextTemporaryId(); // From now on, creating temporary symbols that refer to the
- // field value.
- insertionsBefore.push_back(createTempInitDeclaration(indexingCall));
-
- TIntermAggregate *indexedWriteCall = CreateIndexedWriteFunctionCall(
- node, tempIndex, createTempSymbol(fieldType), *indexedWriteFunctionId);
- insertionsAfter.push_back(indexedWriteCall);
- insertStatementsInParentBlock(insertionsBefore, insertionsAfter);
- queueReplacement(createTempSymbol(fieldType), 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()), *indexingFunctionId);
- queueReplacement(indexingCall, OriginalNode::IS_DROPPED);
- }
- }
- }
- return !mUsedTreeInsertion;
-}
-
-void RemoveDynamicIndexingTraverser::nextIteration()
-{
- mUsedTreeInsertion = false;
- mRemoveIndexSideEffectsInSubtree = false;
- nextTemporaryId();
-}
-
-} // namespace
-
-void RemoveDynamicIndexing(TIntermNode *root,
- TSymbolTable *symbolTable,
- int shaderVersion,
- PerformanceDiagnostics *perfDiagnostics)
-{
- RemoveDynamicIndexingTraverser traverser(symbolTable, shaderVersion, 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/src/3rdparty/angle/src/compiler/translator/RemoveDynamicIndexing.h b/src/3rdparty/angle/src/compiler/translator/RemoveDynamicIndexing.h
deleted file mode 100644
index 543cf569a6..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveDynamicIndexing.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// 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 vectors and matrices,
-// replacing them with calls to functions that choose which component to return or write.
-//
-
-#ifndef COMPILER_TRANSLATOR_REMOVEDYNAMICINDEXING_H_
-#define COMPILER_TRANSLATOR_REMOVEDYNAMICINDEXING_H_
-
-namespace sh
-{
-
-class TIntermNode;
-class TSymbolTable;
-class PerformanceDiagnostics;
-
-void RemoveDynamicIndexing(TIntermNode *root,
- TSymbolTable *symbolTable,
- int shaderVersion,
- PerformanceDiagnostics *perfDiagnostics);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_REMOVEDYNAMICINDEXING_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/RemoveEmptySwitchStatements.cpp b/src/3rdparty/angle/src/compiler/translator/RemoveEmptySwitchStatements.cpp
deleted file mode 100644
index b39c912e9c..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveEmptySwitchStatements.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// 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.
-//
-// RemoveEmptySwitchStatements.cpp: Remove switch statements that have an empty statement list.
-
-#include "compiler/translator/RemoveEmptySwitchStatements.h"
-
-#include "compiler/translator/IntermTraverse.h"
-
-namespace sh
-{
-
-namespace
-{
-
-class RemoveEmptySwitchStatementsTraverser : public TIntermTraverser
-{
- public:
- RemoveEmptySwitchStatementsTraverser() : TIntermTraverser(true, false, false) {}
-
- bool visitSwitch(Visit visit, TIntermSwitch *node);
-};
-
-bool RemoveEmptySwitchStatementsTraverser::visitSwitch(Visit visit, TIntermSwitch *node)
-{
- if (node->getStatementList()->getSequence()->empty())
- {
- // Just output the init statement.
- if (node->getInit()->hasSideEffects())
- {
- queueReplacement(node->getInit(), OriginalNode::IS_DROPPED);
- }
- else
- {
- TIntermSequence emptyReplacement;
- ASSERT(getParentNode()->getAsBlock());
- mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(getParentNode()->getAsBlock(),
- node, emptyReplacement));
- }
- return false; // Nothing inside the child nodes to traverse.
- }
- return true;
-}
-
-} // anonymous namespace
-
-void RemoveEmptySwitchStatements(TIntermBlock *root)
-{
- RemoveEmptySwitchStatementsTraverser traverser;
- root->traverse(&traverser);
- traverser.updateTree();
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/RemoveEmptySwitchStatements.h b/src/3rdparty/angle/src/compiler/translator/RemoveEmptySwitchStatements.h
deleted file mode 100644
index 1018a50d82..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveEmptySwitchStatements.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//
-// 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.
-//
-// RemoveEmptySwitchStatements.h: Remove switch statements that have an empty statement list.
-
-#ifndef COMPILER_TRANSLATOR_REMOVEEMPTYSWITCHSTATEMENTS_H_
-#define COMPILER_TRANSLATOR_REMOVEEMPTYSWITCHSTATEMENTS_H_
-
-namespace sh
-{
-class TIntermBlock;
-
-void RemoveEmptySwitchStatements(TIntermBlock *root);
-}
-
-#endif // COMPILER_TRANSLATOR_REMOVEEMPTYSWITCHSTATEMENTS_H_ \ No newline at end of file
diff --git a/src/3rdparty/angle/src/compiler/translator/RemoveInvariantDeclaration.cpp b/src/3rdparty/angle/src/compiler/translator/RemoveInvariantDeclaration.cpp
deleted file mode 100644
index 4b533dc7b5..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveInvariantDeclaration.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// 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/RemoveInvariantDeclaration.h"
-
-#include "compiler/translator/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/src/3rdparty/angle/src/compiler/translator/RemoveInvariantDeclaration.h b/src/3rdparty/angle/src/compiler/translator/RemoveInvariantDeclaration.h
deleted file mode 100644
index cf9d4aa4c2..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveInvariantDeclaration.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//
-// 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_REMOVEINVARIANTDECLARATION_H_
-#define COMPILER_TRANSLATOR_REMOVEINVARIANTDECLARATION_H_
-
-class TIntermNode;
-namespace sh
-{
-
-void RemoveInvariantDeclaration(TIntermNode *root);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_REMOVEINVARIANTDECLARATION_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.cpp b/src/3rdparty/angle/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.cpp
deleted file mode 100644
index b86d64d7a3..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-//
-// 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.
-//
-// RemoveNoOpCasesFromEndOfSwitchStatements.cpp: Clean up cases from the end of a switch statement
-// that only contain no-ops.
-
-#include "compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h"
-
-#include "compiler/translator/IntermNode.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.h"
-
-namespace sh
-{
-
-namespace
-{
-
-bool AreEmptyBlocks(TIntermSequence *statements, size_t i);
-
-bool IsEmptyBlock(TIntermNode *node)
-{
- TIntermBlock *asBlock = node->getAsBlock();
- if (asBlock)
- {
- if (asBlock->getSequence()->empty())
- {
- return true;
- }
- return AreEmptyBlocks(asBlock->getSequence(), 0u);
- }
- // 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" starting from index i consist only of empty blocks
-// and no-op statements. Returns true also if there are no statements.
-bool AreEmptyBlocks(TIntermSequence *statements, size_t i)
-{
- for (; i < statements->size(); ++i)
- {
- if (!IsEmptyBlock(statements->at(i)))
- {
- return false;
- }
- }
- return true;
-}
-
-void RemoveNoOpCasesFromEndOfStatementList(TIntermBlock *statementList, TSymbolTable *symbolTable)
-{
- TIntermSequence *statements = statementList->getSequence();
-
- bool foundDeadCase = false;
- do
- {
- if (statements->empty())
- {
- return;
- }
-
- // Find the last case label.
- size_t i = statements->size();
- while (i > 0u && !(*statements)[i - 1]->getAsCaseNode())
- {
- --i;
- }
- // Now i is the index of the first statement following the last label inside the switch
- // statement.
- ASSERT(i > 0u);
-
- foundDeadCase = AreEmptyBlocks(statements, i);
- if (foundDeadCase)
- {
- statements->erase(statements->begin() + (i - 1u), statements->end());
- }
- } while (foundDeadCase);
-}
-
-class RemoveNoOpCasesFromEndOfSwitchTraverser : public TIntermTraverser
-{
- public:
- RemoveNoOpCasesFromEndOfSwitchTraverser(TSymbolTable *symbolTable)
- : TIntermTraverser(true, false, false, symbolTable)
- {
- }
-
- bool visitSwitch(Visit visit, TIntermSwitch *node) override;
-};
-
-bool RemoveNoOpCasesFromEndOfSwitchTraverser::visitSwitch(Visit visit, TIntermSwitch *node)
-{
- // Here we may mutate the statement list, but it's safe since traversal has not yet reached
- // there.
- RemoveNoOpCasesFromEndOfStatementList(node->getStatementList(), mSymbolTable);
- // Handle also nested switch statements.
- return true;
-}
-
-} // anonymous namespace
-
-void RemoveNoOpCasesFromEndOfSwitchStatements(TIntermBlock *root, TSymbolTable *symbolTable)
-{
- RemoveNoOpCasesFromEndOfSwitchTraverser traverser(symbolTable);
- root->traverse(&traverser);
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h b/src/3rdparty/angle/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h
deleted file mode 100644
index ebd75eb774..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// 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.
-//
-// RemoveNoOpCasesFromEndOfSwitchStatements.h: Clean up cases from the end of a switch statement
-// that only contain no-ops.
-
-#ifndef COMPILER_TRANSLATOR_REMOVENOOPCASESFROMENDOFSWITCHSTATEMENTS_H_
-#define COMPILER_TRANSLATOR_REMOVENOOPCASESFROMENDOFSWITCHSTATEMENTS_H_
-
-namespace sh
-{
-class TIntermBlock;
-class TSymbolTable;
-
-void RemoveNoOpCasesFromEndOfSwitchStatements(TIntermBlock *root, TSymbolTable *symbolTable);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_REMOVENOOPCASESFROMENDOFSWITCHSTATEMENTS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/RemovePow.cpp b/src/3rdparty/angle/src/compiler/translator/RemovePow.cpp
deleted file mode 100644
index b2cdac55f0..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemovePow.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-// 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/RemovePow.h"
-
-#include "compiler/translator/InfoSink.h"
-#include "compiler/translator/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();
-
- bool visitAggregate(Visit visit, TIntermAggregate *node) override;
-
- void nextIteration() { mNeedAnotherIteration = false; }
- bool needAnotherIteration() const { return mNeedAnotherIteration; }
-
- protected:
- bool mNeedAnotherIteration;
-};
-
-RemovePowTraverser::RemovePowTraverser()
- : TIntermTraverser(true, false, false), 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();
-
- TIntermUnary *log = new TIntermUnary(EOpLog2, x);
- log->setLine(node->getLine());
-
- TOperator op = TIntermBinary::GetMulOpBasedOnOperands(y->getType(), log->getType());
- TIntermBinary *mul = new TIntermBinary(op, y, log);
- mul->setLine(node->getLine());
-
- TIntermUnary *exp = new TIntermUnary(EOpExp2, mul);
- 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)
-{
- RemovePowTraverser traverser;
- // 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/src/3rdparty/angle/src/compiler/translator/RemovePow.h b/src/3rdparty/angle/src/compiler/translator/RemovePow.h
deleted file mode 100644
index 3cd84988a9..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemovePow.h
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// 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_REMOVEPOW_H_
-#define COMPILER_TRANSLATOR_REMOVEPOW_H_
-
-namespace sh
-{
-class TIntermNode;
-
-void RemovePow(TIntermNode *root);
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_REMOVEPOW_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.cpp b/src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.cpp
deleted file mode 100644
index dea949f448..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-//
-// 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/RemoveSwitchFallThrough.h"
-
-#include "compiler/translator/Diagnostics.h"
-#include "compiler/translator/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/src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.h b/src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.h
deleted file mode 100644
index 7a3b1963f2..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// 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_REMOVESWITCHFALLTHROUGH_H_
-#define COMPILER_TRANSLATOR_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_REMOVESWITCHFALLTHROUGH_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/RemoveUnreferencedVariables.cpp b/src/3rdparty/angle/src/compiler/translator/RemoveUnreferencedVariables.cpp
deleted file mode 100644
index 74b5e73f71..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveUnreferencedVariables.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
-//
-// 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/RemoveUnreferencedVariables.h"
-
-#include "compiler/translator/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.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;
- bool visitFunctionPrototype(Visit visit, 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());
- if (structIter == mStructIdRefCounts.end())
- {
- mStructIdRefCounts[structure->uniqueId()] = 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->getId());
- if (iter == mSymbolIdRefCounts.end())
- {
- mSymbolIdRefCounts[node->getId()] = 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;
-}
-
-bool CollectVariableRefCountsTraverser::visitFunctionPrototype(Visit visit,
- TIntermFunctionPrototype *node)
-{
- incrementStructTypeRefCount(node->getType());
- return true;
-}
-
-// 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()) != mStructIdRefCounts->end());
- unsigned int structRefCount = --(*mStructIdRefCounts)[structure->uniqueId()];
-
- 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();
- if ((*mStructIdRefCounts)[structId] > 1u)
- {
- // 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()->getSymbol().empty())
- {
- // Already an empty declaration - nothing to do.
- return;
- }
- queueReplacementWithParent(node, declarator,
- new TIntermSymbol(mSymbolTable->getEmptySymbolId(),
- TString(""), declarator->getType()),
- 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)
- {
- return true;
- }
-
- bool canRemoveVariable = false;
- TIntermSymbol *symbolNode = declarator->getAsSymbolNode();
- if (symbolNode != nullptr)
- {
- canRemoveVariable =
- (*mSymbolIdRefCounts)[symbolNode->getId()] == 1u || symbolNode->getSymbol().empty();
- }
- TIntermBinary *initNode = declarator->getAsBinaryNode();
- if (initNode != nullptr)
- {
- ASSERT(initNode->getLeft()->getAsSymbolNode());
- int symbolId = initNode->getLeft()->getAsSymbolNode()->getId();
- 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->getId()) != mSymbolIdRefCounts->end());
- --(*mSymbolIdRefCounts)[node->getId()];
-
- decrementStructTypeRefCount(node->getType());
- }
-}
-
-bool RemoveUnreferencedVariablesTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
-{
- if (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/src/3rdparty/angle/src/compiler/translator/RemoveUnreferencedVariables.h b/src/3rdparty/angle/src/compiler/translator/RemoveUnreferencedVariables.h
deleted file mode 100644
index 39c8327776..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RemoveUnreferencedVariables.h
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// 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_REMOVEUNREFERENCEDVARIABLES_H_
-#define COMPILER_TRANSLATOR_REMOVEUNREFERENCEDVARIABLES_H_
-
-namespace sh
-{
-
-class TIntermBlock;
-class TSymbolTable;
-
-void RemoveUnreferencedVariables(TIntermBlock *root, TSymbolTable *symbolTable);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_REMOVEUNREFERENCEDVARIABLES_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/RewriteDoWhile.cpp b/src/3rdparty/angle/src/compiler/translator/RewriteDoWhile.cpp
deleted file mode 100644
index dc3fb7a74e..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RewriteDoWhile.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-//
-// 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/RewriteDoWhile.h"
-
-#include "compiler/translator/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.
- nextTemporaryId();
-
- TType boolType = TType(EbtBool);
-
- // bool temp = false;
- TIntermDeclaration *tempDeclaration = nullptr;
- {
- TConstantUnion *falseConstant = new TConstantUnion();
- falseConstant->setBConst(false);
- TIntermTyped *falseValue = new TIntermConstantUnion(falseConstant, boolType);
-
- tempDeclaration = createTempInitDeclaration(falseValue);
- }
-
- // temp = true;
- TIntermBinary *assignTrue = nullptr;
- {
- TConstantUnion *trueConstant = new TConstantUnion();
- trueConstant->setBConst(true);
- TIntermTyped *trueValue = new TIntermConstantUnion(trueConstant, boolType);
-
- assignTrue = createTempAssignment(trueValue);
- }
-
- // 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());
-
- TIntermIfElse *innerIf = new TIntermIfElse(negatedCondition, breakBlock, nullptr);
-
- TIntermBlock *innerIfBlock = new TIntermBlock();
- innerIfBlock->getSequence()->push_back(innerIf);
-
- breakIf = new TIntermIfElse(createTempSymbol(boolType), innerIfBlock, nullptr);
- }
-
- // Assemble the replacement loops, reusing the do-while loop's body and inserting our
- // statements at the front.
- TIntermLoop *newLoop = nullptr;
- {
- TConstantUnion *trueConstant = new TConstantUnion();
- trueConstant->setBConst(true);
- TIntermTyped *trueValue = new TIntermConstantUnion(trueConstant, boolType);
-
- 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, trueValue, 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/src/3rdparty/angle/src/compiler/translator/RewriteDoWhile.h b/src/3rdparty/angle/src/compiler/translator/RewriteDoWhile.h
deleted file mode 100644
index e83bfc4b56..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RewriteDoWhile.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// 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_REWRITEDOWHILE_H_
-#define COMPILER_TRANSLATOR_REWRITEDOWHILE_H_
-
-namespace sh
-{
-
-class TIntermNode;
-class TSymbolTable;
-
-void RewriteDoWhile(TIntermNode *root, TSymbolTable *symbolTable);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_REWRITEDOWHILE_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp b/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp
deleted file mode 100644
index ed1bfad8a8..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// 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/RewriteElseBlocks.h"
-
-#include "compiler/translator/IntermNode.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/NodeSearch.h"
-#include "compiler/translator/SymbolTable.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);
-
- nextTemporaryId();
-
- TIntermDeclaration *storeCondition = createTempInitDeclaration(ifElse->getCondition());
-
- 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 = createTempSymbol(boolType);
- TIntermUnary *negatedCondition = new TIntermUnary(EOpLogicalNot, conditionSymbolElse);
- TIntermIfElse *falseIfElse =
- new TIntermIfElse(negatedCondition, ifElse->getFalseBlock(), negatedElse);
- falseBlock = EnsureBlock(falseIfElse);
- }
-
- TIntermSymbol *conditionSymbolSel = createTempSymbol(boolType);
- 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/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h b/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h
deleted file mode 100644
index 2586b5405c..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// 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_REWRITEELSEBLOCKS_H_
-#define COMPILER_TRANSLATOR_REWRITEELSEBLOCKS_H_
-
-namespace sh
-{
-
-class TIntermNode;
-class TSymbolTable;
-
-void RewriteElseBlocks(TIntermNode *node, TSymbolTable *symbolTable);
-}
-
-#endif // COMPILER_TRANSLATOR_REWRITEELSEBLOCKS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/RewriteTexelFetchOffset.cpp b/src/3rdparty/angle/src/compiler/translator/RewriteTexelFetchOffset.cpp
deleted file mode 100644
index b602e0c923..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RewriteTexelFetchOffset.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-//
-// 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/RewriteTexelFetchOffset.h"
-
-#include "common/angleutils.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.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;
- }
-
- if (node->getFunctionSymbolInfo()->getName() != "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/src/3rdparty/angle/src/compiler/translator/RewriteTexelFetchOffset.h b/src/3rdparty/angle/src/compiler/translator/RewriteTexelFetchOffset.h
deleted file mode 100644
index 694d709f8e..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RewriteTexelFetchOffset.h
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// 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_REWRITE_TEXELFETCHOFFSET_H_
-#define COMPILER_TRANSLATOR_REWRITE_TEXELFETCHOFFSET_H_
-
-class TIntermNode;
-class TSymbolTable;
-
-namespace sh
-{
-
-void RewriteTexelFetchOffset(TIntermNode *root, const TSymbolTable &symbolTable, int shaderVersion);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_REWRITE_TEXELFETCHOFFSET_H_ \ No newline at end of file
diff --git a/src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorFloat.cpp b/src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorFloat.cpp
deleted file mode 100644
index 696a49536c..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorFloat.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// 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/RewriteUnaryMinusOperatorFloat.h"
-
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/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/src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorFloat.h b/src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorFloat.h
deleted file mode 100644
index ccbfbcbd9e..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorFloat.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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_REWRITEUNARYMINUSOPERATORFLOAT_H_
-#define COMPILER_TRANSLATOR_REWRITEUNARYMINUSOPERATORFLOAT_H_
-
-class TIntermNode;
-namespace sh
-{
-
-void RewriteUnaryMinusOperatorFloat(TIntermNode *root);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_REWRITEUNARYMINUSOPERATORFLOAT_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorInt.cpp b/src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorInt.cpp
deleted file mode 100644
index fe2ef948b4..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorInt.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-//
-// 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/RewriteUnaryMinusOperatorInt.h"
-
-#include "compiler/translator/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);
- 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, opr->getType());
- oneNode->getTypePointer()->setQualifier(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 \ No newline at end of file
diff --git a/src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorInt.h b/src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorInt.h
deleted file mode 100644
index 50f0c442a7..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RewriteUnaryMinusOperatorInt.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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_REWRITEUNARYMINUSOPERATORINT_H_
-#define COMPILER_TRANSLATOR_REWRITEUNARYMINUSOPERATORINT_H_
-
-class TIntermNode;
-namespace sh
-{
-
-void RewriteUnaryMinusOperatorInt(TIntermNode *root);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_REWRITEUNARYMINUSOPERATORINT_H_ \ No newline at end of file
diff --git a/src/3rdparty/angle/src/compiler/translator/RunAtTheEndOfShader.cpp b/src/3rdparty/angle/src/compiler/translator/RunAtTheEndOfShader.cpp
deleted file mode 100644
index 3c4209c539..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RunAtTheEndOfShader.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-//
-// 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/RunAtTheEndOfShader.h"
-
-#include "compiler/translator/FindMain.h"
-#include "compiler/translator/IntermNode.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/IntermTraverse.h"
-#include "compiler/translator/SymbolTable.h"
-
-namespace sh
-{
-
-namespace
-{
-
-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.
- TSymbolUniqueId oldMainId(symbolTable);
- std::stringstream oldMainName;
- oldMainName << "main" << oldMainId.get();
- TIntermFunctionDefinition *oldMain = CreateInternalFunctionDefinitionNode(
- TType(EbtVoid), oldMainName.str().c_str(), main->getBody(), oldMainId);
-
- bool replaced = root->replaceChildNode(main, oldMain);
- ASSERT(replaced);
-
- // void main()
- TIntermFunctionPrototype *newMainProto = new TIntermFunctionPrototype(
- TType(EbtVoid), main->getFunctionPrototype()->getFunctionSymbolInfo()->getId());
- newMainProto->getFunctionSymbolInfo()->setName("main");
-
- // {
- // main0();
- // codeToRun
- // }
- TIntermBlock *newMainBody = new TIntermBlock();
- TIntermAggregate *oldMainCall = CreateInternalFunctionCallNode(
- TType(EbtVoid), oldMainName.str().c_str(), oldMainId, new TIntermSequence());
- newMainBody->appendStatement(oldMainCall);
- newMainBody->appendStatement(codeToRun);
-
- // Add the new main() to the root node.
- TIntermFunctionDefinition *newMain = new TIntermFunctionDefinition(newMainProto, newMainBody);
- root->appendStatement(newMain);
-}
-
-} // 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/src/3rdparty/angle/src/compiler/translator/RunAtTheEndOfShader.h b/src/3rdparty/angle/src/compiler/translator/RunAtTheEndOfShader.h
deleted file mode 100644
index ed94c28dae..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/RunAtTheEndOfShader.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// 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_RUNATTHEENDOFSHADER_H_
-#define COMPILER_TRANSLATOR_RUNATTHEENDOFSHADER_H_
-
-namespace sh
-{
-
-class TIntermBlock;
-class TIntermNode;
-class TSymbolTable;
-
-void RunAtTheEndOfShader(TIntermBlock *root, TIntermNode *codeToRun, TSymbolTable *symbolTable);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_RUNATTHEENDOFSHADER_H_ \ No newline at end of file
diff --git a/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp b/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp
deleted file mode 100644
index 746c16e2e6..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-//
-// 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 "common/debug.h"
-#include "compiler/translator/ScalarizeVecAndMatConstructorArgs.h"
-
-#include <algorithm>
-
-#include "angle_gl.h"
-#include "common/angleutils.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/IntermTraverse.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;
-}
-
-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)
- {
- }
-
- 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.
- void createTempVariable(TIntermTyped *original);
-
- std::vector<TIntermSequence> mBlockStack;
-
- sh::GLenum mShaderType;
- bool mFragmentPrecisionHigh;
-};
-
-bool ScalarizeArgsTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
-{
- if (visit == PreVisit && node->getOp() == EOpConstruct)
- {
- if (node->getType().isVector() && ContainsMatrixNode(*(node->getSequence())))
- scalarizeArgs(node, false, true);
- else if (node->getType().isMatrix() && ContainsVectorNode(*(node->getSequence())))
- 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 original(*sequence);
- sequence->clear();
- for (size_t ii = 0; ii < original.size(); ++ii)
- {
- ASSERT(size > 0);
- TIntermTyped *node = original[ii]->getAsTyped();
- ASSERT(node);
- createTempVariable(node);
- if (node->isScalar())
- {
- sequence->push_back(createTempSymbol(node->getType()));
- size--;
- }
- else if (node->isVector())
- {
- if (scalarizeVector)
- {
- int repeat = std::min(size, node->getNominalSize());
- size -= repeat;
- for (int index = 0; index < repeat; ++index)
- {
- TIntermSymbol *symbolNode = createTempSymbol(node->getType());
- TIntermBinary *newNode = ConstructVectorIndexBinaryNode(symbolNode, index);
- sequence->push_back(newNode);
- }
- }
- else
- {
- TIntermSymbol *symbolNode = createTempSymbol(node->getType());
- sequence->push_back(symbolNode);
- size -= node->getNominalSize();
- }
- }
- else
- {
- ASSERT(node->isMatrix());
- if (scalarizeMatrix)
- {
- int colIndex = 0, rowIndex = 0;
- int repeat = std::min(size, node->getCols() * node->getRows());
- size -= repeat;
- while (repeat > 0)
- {
- TIntermSymbol *symbolNode = createTempSymbol(node->getType());
- TIntermBinary *newNode =
- ConstructMatrixIndexBinaryNode(symbolNode, colIndex, rowIndex);
- sequence->push_back(newNode);
- rowIndex++;
- if (rowIndex >= node->getRows())
- {
- rowIndex = 0;
- colIndex++;
- }
- repeat--;
- }
- }
- else
- {
- TIntermSymbol *symbolNode = createTempSymbol(node->getType());
- sequence->push_back(symbolNode);
- size -= node->getCols() * node->getRows();
- }
- }
- }
-}
-
-void ScalarizeArgsTraverser::createTempVariable(TIntermTyped *original)
-{
- ASSERT(original);
- nextTemporaryId();
- TIntermDeclaration *decl = createTempInitDeclaration(original);
-
- TType type = original->getType();
- 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.
- TIntermBinary *init = decl->getSequence()->at(0)->getAsBinaryNode();
- init->getTypePointer()->setPrecision(mFragmentPrecisionHigh ? EbpHigh : EbpMedium);
- init->getLeft()->getTypePointer()->setPrecision(mFragmentPrecisionHigh ? EbpHigh
- : EbpMedium);
- }
-
- ASSERT(mBlockStack.size() > 0);
- TIntermSequence &sequence = mBlockStack.back();
- sequence.push_back(decl);
-}
-
-} // namespace anonymous
-
-void ScalarizeVecAndMatConstructorArgs(TIntermBlock *root,
- sh::GLenum shaderType,
- bool fragmentPrecisionHigh,
- TSymbolTable *symbolTable)
-{
- ScalarizeArgsTraverser scalarizer(shaderType, fragmentPrecisionHigh, symbolTable);
- root->traverse(&scalarizer);
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h b/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h
deleted file mode 100644
index b8f782d1ec..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// 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_SCALARIZEVECANDMATCONSTRUCTORARGS_H_
-#define COMPILER_TRANSLATOR_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_SCALARIZEVECANDMATCONSTRUCTORARGS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/SearchSymbol.cpp b/src/3rdparty/angle/src/compiler/translator/SearchSymbol.cpp
deleted file mode 100644
index 34c644d028..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SearchSymbol.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// SearchSymbol is an AST traverser to detect the use of a given symbol name
-//
-
-#include "compiler/translator/SearchSymbol.h"
-
-#include "compiler/translator/InfoSink.h"
-
-namespace sh
-{
-SearchSymbol::SearchSymbol(const TString &symbol)
- : TIntermTraverser(true, false, false), mSymbol(symbol)
-{
- match = false;
-}
-
-void SearchSymbol::traverse(TIntermNode *node)
-{
- node->traverse(this);
-}
-
-void SearchSymbol::visitSymbol(TIntermSymbol *symbolNode)
-{
- if (symbolNode->getSymbol() == mSymbol)
- {
- match = true;
- }
-}
-
-bool SearchSymbol::foundMatch() const
-{
- return match;
-}
-}
diff --git a/src/3rdparty/angle/src/compiler/translator/SearchSymbol.h b/src/3rdparty/angle/src/compiler/translator/SearchSymbol.h
deleted file mode 100644
index b8379e041f..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SearchSymbol.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// SearchSymbol is an AST traverser to detect the use of a given symbol name
-//
-
-#ifndef COMPILER_TRANSLATOR_SEARCHSYMBOL_H_
-#define COMPILER_TRANSLATOR_SEARCHSYMBOL_H_
-
-#include "compiler/translator/IntermTraverse.h"
-#include "compiler/translator/ParseContext.h"
-
-namespace sh
-{
-class SearchSymbol : public TIntermTraverser
-{
- public:
- SearchSymbol(const TString &symbol);
-
- void traverse(TIntermNode *node);
- void visitSymbol(TIntermSymbol *symbolNode) override;
-
- bool foundMatch() const;
-
- protected:
- const TString &mSymbol;
- bool match;
-};
-}
-
-#endif // COMPILER_TRANSLATOR_SEARCHSYMBOL_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/SeparateArrayInitialization.cpp b/src/3rdparty/angle/src/compiler/translator/SeparateArrayInitialization.cpp
deleted file mode 100644
index fe25823e38..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SeparateArrayInitialization.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// 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/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() && !sh::OutputHLSL::canWriteAsHLSLLiteral(initializer))
- {
- // 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/src/3rdparty/angle/src/compiler/translator/SeparateArrayInitialization.h b/src/3rdparty/angle/src/compiler/translator/SeparateArrayInitialization.h
deleted file mode 100644
index 3a9bb55dd1..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SeparateArrayInitialization.h
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// 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_SEPARATEARRAYINITIALIZATION_H_
-#define COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_
-
-namespace sh
-{
-class TIntermNode;
-
-void SeparateArrayInitialization(TIntermNode *root);
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/SeparateDeclarations.cpp b/src/3rdparty/angle/src/compiler/translator/SeparateDeclarations.cpp
deleted file mode 100644
index 9a066075c0..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SeparateDeclarations.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// 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/SeparateDeclarations.h"
-
-#include "compiler/translator/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/src/3rdparty/angle/src/compiler/translator/SeparateDeclarations.h b/src/3rdparty/angle/src/compiler/translator/SeparateDeclarations.h
deleted file mode 100644
index 8142faea1c..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SeparateDeclarations.h
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// 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_SEPARATEDECLARATIONS_H_
-#define COMPILER_TRANSLATOR_SEPARATEDECLARATIONS_H_
-
-namespace sh
-{
-class TIntermNode;
-
-void SeparateDeclarations(TIntermNode *root);
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_SEPARATEDECLARATIONS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/SeparateExpressionsReturningArrays.cpp b/src/3rdparty/angle/src/compiler/translator/SeparateExpressionsReturningArrays.cpp
deleted file mode 100644
index 01d627937c..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SeparateExpressionsReturningArrays.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-// 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/SeparateExpressionsReturningArrays.h"
-
-#include "compiler/translator/IntermNodePatternMatcher.h"
-#include "compiler/translator/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.
- insertions.push_back(createTempInitDeclaration(node->getLeft()));
- insertStatementsInParentBlock(insertions);
-
- queueReplacement(createTempSymbol(node->getType()), 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;
-
- TIntermSequence insertions;
- insertions.push_back(createTempInitDeclaration(node->shallowCopy()));
- insertStatementsInParentBlock(insertions);
-
- queueReplacement(createTempSymbol(node->getType()), OriginalNode::IS_DROPPED);
-
- return false;
-}
-
-void SeparateExpressionsTraverser::nextIteration()
-{
- mFoundArrayExpression = false;
- nextTemporaryId();
-}
-
-} // 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/src/3rdparty/angle/src/compiler/translator/SeparateExpressionsReturningArrays.h b/src/3rdparty/angle/src/compiler/translator/SeparateExpressionsReturningArrays.h
deleted file mode 100644
index f8eb438748..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SeparateExpressionsReturningArrays.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// 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_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_
-#define COMPILER_TRANSLATOR_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_
-
-namespace sh
-{
-class TIntermNode;
-class TSymbolTable;
-
-void SeparateExpressionsReturningArrays(TIntermNode *root, TSymbolTable *symbolTable);
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/Severity.h b/src/3rdparty/angle/src/compiler/translator/Severity.h
deleted file mode 100644
index 47808a16a7..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Severity.h
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp b/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp
deleted file mode 100644
index eeb13f2ec0..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp
+++ /dev/null
@@ -1,578 +0,0 @@
-//
-// 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 "compiler/translator/VariablePacker.h"
-#include "angle_gl.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:
- return GL_INVALID_VALUE;
-
- 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->EXT_YUV_target = 0;
- resources->OES_geometry_shader = 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 reinterpret_cast<void *>(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 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
-}
-
-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);
-
- return compiler->getGeometryShaderMaxVertices();
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/ShaderVars.cpp b/src/3rdparty/angle/src/compiler/translator/ShaderVars.cpp
deleted file mode 100644
index 4ab574e935..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ShaderVars.cpp
+++ /dev/null
@@ -1,586 +0,0 @@
-//
-// 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);
-}
-}
-// The ES 3.0 spec is not clear on this point, but the ES 3.1 spec, and discussion
-// on Khronos.org, clarifies that a smooth/flat mismatch produces a link error,
-// but auxiliary qualifier mismatch (centroid) does not.
-bool InterpolationTypesMatch(InterpolationType a, InterpolationType b)
-{
- return (GetNonAuxiliaryInterpolationType(a) == GetNonAuxiliaryInterpolationType(b));
-}
-
-ShaderVariable::ShaderVariable()
- : type(0), precision(0), flattenedOffsetInParentArrays(0), staticUse(false)
-{
-}
-
-ShaderVariable::ShaderVariable(GLenum typeIn)
- : type(typeIn), precision(0), flattenedOffsetInParentArrays(0), staticUse(false)
-{
-}
-
-ShaderVariable::ShaderVariable(GLenum typeIn, unsigned int arraySizeIn)
- : type(typeIn), precision(0), flattenedOffsetInParentArrays(0), staticUse(false)
-{
- 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),
- flattenedOffsetInParentArrays(other.flattenedOffsetInParentArrays),
- staticUse(other.staticUse),
- fields(other.fields),
- structName(other.structName)
-{
-}
-
-ShaderVariable &ShaderVariable::operator=(const ShaderVariable &other)
-{
- type = other.type;
- precision = other.precision;
- name = other.name;
- mappedName = other.mappedName;
- arraySizes = other.arraySizes;
- staticUse = other.staticUse;
- flattenedOffsetInParentArrays = other.flattenedOffsetInParentArrays;
- fields = other.fields;
- structName = other.structName;
- 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 || fields.size() != other.fields.size() ||
- structName != other.structName)
- {
- 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::getArraySizeProduct() const
-{
- return gl::ArraySizeProduct(arraySizes);
-}
-
-void ShaderVariable::indexIntoArray(unsigned int arrayIndex)
-{
- ASSERT(isArray());
- flattenedOffsetInParentArrays =
- arrayIndex + getOutermostArraySize() * flattenedOffsetInParentArrays;
- 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::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 (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), offset(-1)
-{
-}
-
-Uniform::~Uniform()
-{
-}
-
-Uniform::Uniform(const Uniform &other)
- : VariableWithLocation(other), binding(other.binding), offset(other.offset)
-{
-}
-
-Uniform &Uniform::operator=(const Uniform &other)
-{
- VariableWithLocation::operator=(other);
- binding = other.binding;
- offset = other.offset;
- return *this;
-}
-
-bool Uniform::operator==(const Uniform &other) const
-{
- return VariableWithLocation::operator==(other) && binding == other.binding &&
- offset == other.offset;
-}
-
-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 (location != -1 && other.location != -1 && location != other.location)
- {
- return false;
- }
- if (offset != other.offset)
- {
- 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()
-{
-}
-
-OutputVariable::~OutputVariable()
-{
-}
-
-OutputVariable::OutputVariable(const OutputVariable &other) : VariableWithLocation(other)
-{
-}
-
-OutputVariable &OutputVariable::operator=(const OutputVariable &other)
-{
- VariableWithLocation::operator=(other);
- return *this;
-}
-
-bool OutputVariable::operator==(const OutputVariable &other) const
-{
- return VariableWithLocation::operator==(other);
-}
-
-InterfaceBlockField::InterfaceBlockField() : isRowMajorLayout(false)
-{
-}
-
-InterfaceBlockField::~InterfaceBlockField()
-{
-}
-
-InterfaceBlockField::InterfaceBlockField(const InterfaceBlockField &other)
- : ShaderVariable(other), isRowMajorLayout(other.isRowMajorLayout)
-{
-}
-
-InterfaceBlockField &InterfaceBlockField::operator=(const InterfaceBlockField &other)
-{
- ShaderVariable::operator=(other);
- isRowMajorLayout = other.isRowMajorLayout;
- return *this;
-}
-
-bool InterfaceBlockField::operator==(const InterfaceBlockField &other) const
-{
- return (ShaderVariable::operator==(other) && isRowMajorLayout == other.isRowMajorLayout);
-}
-
-bool InterfaceBlockField::isSameInterfaceBlockFieldAtLinkTime(
- const InterfaceBlockField &other) const
-{
- return (ShaderVariable::isSameVariableAtLinkTime(other, true, true) &&
- isRowMajorLayout == other.isRowMajorLayout);
-}
-
-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),
- 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),
- 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;
- 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/src/3rdparty/angle/src/compiler/translator/SimplifyLoopConditions.cpp b/src/3rdparty/angle/src/compiler/translator/SimplifyLoopConditions.cpp
deleted file mode 100644
index 9704046839..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SimplifyLoopConditions.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-//
-// 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/SimplifyLoopConditions.h"
-
-#include "compiler/translator/IntermNodePatternMatcher.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/IntermTraverse.h"
-
-namespace sh
-{
-
-namespace
-{
-
-class SimplifyLoopConditionsTraverser : public TLValueTrackingTraverser
-{
- public:
- SimplifyLoopConditionsTraverser(unsigned int conditionsToSimplifyMask,
- TSymbolTable *symbolTable,
- int shaderVersion);
-
- 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,
- int shaderVersion)
- : TLValueTrackingTraverser(true, false, false, symbolTable, shaderVersion),
- 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)
- {
- nextTemporaryId();
-
- // 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; }
- TIntermSequence tempInitSeq;
- tempInitSeq.push_back(createTempInitDeclaration(node->getCondition()->deepCopy()));
- insertStatementsInParentBlock(tempInitSeq);
-
- TIntermBlock *newBody = new TIntermBlock();
- if (node->getBody())
- {
- newBody->getSequence()->push_back(node->getBody());
- }
- newBody->getSequence()->push_back(
- createTempAssignment(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(createTempSymbol(node->getCondition()->getType()));
- }
- else if (loopType == ELoopDoWhile)
- {
- // Transform:
- // do {
- // body;
- // } while (expr);
- // into
- // bool s0 = true;
- // do {
- // { body; }
- // s0 = expr;
- // } while (s0);
- TIntermSequence tempInitSeq;
- tempInitSeq.push_back(createTempInitDeclaration(CreateBoolNode(true)));
- insertStatementsInParentBlock(tempInitSeq);
-
- TIntermBlock *newBody = new TIntermBlock();
- if (node->getBody())
- {
- newBody->getSequence()->push_back(node->getBody());
- }
- newBody->getSequence()->push_back(
- createTempAssignment(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(createTempSymbol(node->getCondition()->getType()));
- }
- 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(createTempInitDeclaration(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(
- createTempAssignment(node->getCondition()->deepCopy()));
- }
-
- // Create "while(s0) { whileLoopBody }"
- TIntermLoop *whileLoop = new TIntermLoop(
- ELoopWhile, nullptr, createTempSymbol(conditionInitializer->getType()), 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,
- int shaderVersion)
-{
- SimplifyLoopConditionsTraverser traverser(conditionsToSimplifyMask, symbolTable, shaderVersion);
- root->traverse(&traverser);
- traverser.updateTree();
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/SimplifyLoopConditions.h b/src/3rdparty/angle/src/compiler/translator/SimplifyLoopConditions.h
deleted file mode 100644
index d8f95cd2c8..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SimplifyLoopConditions.h
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-// 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_SIMPLIFYLOOPCONDITIONS_H_
-#define COMPILER_TRANSLATOR_SIMPLIFYLOOPCONDITIONS_H_
-
-namespace sh
-{
-class TIntermNode;
-class TSymbolTable;
-
-void SimplifyLoopConditions(TIntermNode *root,
- unsigned int conditionsToSimplify,
- TSymbolTable *symbolTable,
- int shaderVersion);
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_SIMPLIFYLOOPCONDITIONS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/SplitSequenceOperator.cpp b/src/3rdparty/angle/src/compiler/translator/SplitSequenceOperator.cpp
deleted file mode 100644
index 5df3154560..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SplitSequenceOperator.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-//
-// 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/SplitSequenceOperator.h"
-
-#include "compiler/translator/IntermNodePatternMatcher.h"
-#include "compiler/translator/IntermTraverse.h"
-
-namespace sh
-{
-
-namespace
-{
-
-class SplitSequenceOperatorTraverser : public TLValueTrackingTraverser
-{
- public:
- SplitSequenceOperatorTraverser(unsigned int patternsToSplitMask,
- TSymbolTable *symbolTable,
- int shaderVersion);
-
- 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,
- int shaderVersion)
- : TLValueTrackingTraverser(true, false, true, symbolTable, shaderVersion),
- mFoundExpressionToSplit(false),
- mInsideSequenceOperator(0),
- mPatternToSplitMatcher(patternsToSplitMask)
-{
-}
-
-void SplitSequenceOperatorTraverser::nextIteration()
-{
- mFoundExpressionToSplit = false;
- mInsideSequenceOperator = 0;
- nextTemporaryId();
-}
-
-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,
- int shaderVersion)
-{
- SplitSequenceOperatorTraverser traverser(patternsToSplitMask, symbolTable, shaderVersion);
- // 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/src/3rdparty/angle/src/compiler/translator/SplitSequenceOperator.h b/src/3rdparty/angle/src/compiler/translator/SplitSequenceOperator.h
deleted file mode 100644
index 8f1a766775..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SplitSequenceOperator.h
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// 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_SPLITSEQUENCEOPERATOR_H_
-#define COMPILER_TRANSLATOR_SPLITSEQUENCEOPERATOR_H_
-
-namespace sh
-{
-
-class TIntermNode;
-class TSymbolTable;
-
-void SplitSequenceOperator(TIntermNode *root,
- int patternsToSplitMask,
- TSymbolTable *symbolTable,
- int shaderVersion);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_SPLITSEQUENCEOPERATOR_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/StructureHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/StructureHLSL.cpp
deleted file mode 100644
index 61a9431ceb..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/StructureHLSL.cpp
+++ /dev/null
@@ -1,594 +0,0 @@
-//
-// 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/util.h"
-#include "compiler/translator/UtilsHLSL.h"
-
-namespace sh
-{
-
-namespace
-{
-
-TString Define(const TStructure &structure,
- bool useHLSLRowMajorPacking,
- bool useStd140Packing,
- Std140PaddingHelper *padHelper)
-{
- const TFieldList &fields = structure.fields();
- const bool isNameless = (structure.name() == "");
- 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) + ";\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);
-
- 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/src/3rdparty/angle/src/compiler/translator/StructureHLSL.h b/src/3rdparty/angle/src/compiler/translator/StructureHLSL.h
deleted file mode 100644
index daced8f8d1..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/StructureHLSL.h
+++ /dev/null
@@ -1,98 +0,0 @@
-//
-// 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);
-};
-}
-
-#endif // COMPILER_TRANSLATOR_STRUCTUREHLSL_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp b/src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp
deleted file mode 100644
index 6c38461469..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp
+++ /dev/null
@@ -1,622 +0,0 @@
-//
-// 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 "compiler/translator/Cache.h"
-#include "compiler/translator/IntermNode.h"
-
-#include <stdio.h>
-#include <algorithm>
-
-namespace sh
-{
-
-namespace
-{
-
-static const char kFunctionMangledNameSeparator = '(';
-
-} // anonymous namespace
-
-TSymbol::TSymbol(TSymbolTable *symbolTable, const TString *n)
- : uniqueId(symbolTable->nextUniqueId()), name(n), extension(TExtension::UNDEFINED)
-{
-}
-
-//
-// Functions have buried pointers to delete.
-//
-TFunction::~TFunction()
-{
- clearParameters();
-}
-
-void TFunction::clearParameters()
-{
- for (TParamList::iterator i = parameters.begin(); i != parameters.end(); ++i)
- delete (*i).type;
- parameters.clear();
- mangledName = nullptr;
-}
-
-void TFunction::swapParameters(const TFunction &parametersSource)
-{
- clearParameters();
- for (auto parameter : parametersSource.parameters)
- {
- addParameter(parameter);
- }
-}
-
-const TString *TFunction::buildMangledName() const
-{
- std::string newName = getName().c_str();
- newName += kFunctionMangledNameSeparator;
-
- for (const auto &p : parameters)
- {
- newName += p.type->getMangledName();
- }
- return NewPoolTString(newName.c_str());
-}
-
-const TString &TFunction::GetMangledNameFromCall(const TString &functionName,
- const TIntermSequence &arguments)
-{
- std::string newName = functionName.c_str();
- newName += kFunctionMangledNameSeparator;
-
- for (TIntermNode *argument : arguments)
- {
- newName += argument->getAsTyped()->getType().getMangledName();
- }
- return *NewPoolTString(newName.c_str());
-}
-
-//
-// Symbol table levels are a map of pointers to symbols that have to be deleted.
-//
-TSymbolTableLevel::~TSymbolTableLevel()
-{
- for (tLevel::iterator it = level.begin(); it != level.end(); ++it)
- delete (*it).second;
-}
-
-bool TSymbolTableLevel::insert(TSymbol *symbol)
-{
- // returning true means symbol was added to the table
- tInsertResult result = level.insert(tLevelPair(symbol->getMangledName(), symbol));
-
- return result.second;
-}
-
-bool TSymbolTableLevel::insertUnmangled(TFunction *function)
-{
- // returning true means symbol was added to the table
- tInsertResult result = level.insert(tLevelPair(function->getName(), function));
-
- return result.second;
-}
-
-TSymbol *TSymbolTableLevel::find(const TString &name) const
-{
- tLevel::const_iterator it = level.find(name);
- if (it == level.end())
- return 0;
- else
- return (*it).second;
-}
-
-TSymbol *TSymbolTable::find(const TString &name,
- int shaderVersion,
- bool *builtIn,
- bool *sameScope) const
-{
- int level = currentLevel();
- TSymbol *symbol;
-
- do
- {
- if (level == GLSL_BUILTINS)
- level--;
- if (level == ESSL3_1_BUILTINS && shaderVersion != 310)
- level--;
- if (level == ESSL3_BUILTINS && shaderVersion < 300)
- level--;
- if (level == ESSL1_BUILTINS && shaderVersion != 100)
- level--;
-
- symbol = table[level]->find(name);
- } while (symbol == 0 && --level >= 0);
-
- if (builtIn)
- *builtIn = (level <= LAST_BUILTIN_LEVEL);
- if (sameScope)
- *sameScope = (level == currentLevel());
-
- return symbol;
-}
-
-TSymbol *TSymbolTable::findGlobal(const TString &name) const
-{
- ASSERT(table.size() > GLOBAL_LEVEL);
- return table[GLOBAL_LEVEL]->find(name);
-}
-
-TSymbol *TSymbolTable::findBuiltIn(const TString &name, int shaderVersion) const
-{
- return findBuiltIn(name, shaderVersion, false);
-}
-
-TSymbol *TSymbolTable::findBuiltIn(const TString &name,
- int shaderVersion,
- bool includeGLSLBuiltins) const
-{
- for (int level = LAST_BUILTIN_LEVEL; level >= 0; level--)
- {
- if (level == GLSL_BUILTINS && !includeGLSLBuiltins)
- level--;
- if (level == ESSL3_1_BUILTINS && shaderVersion != 310)
- level--;
- if (level == ESSL3_BUILTINS && shaderVersion < 300)
- level--;
- if (level == ESSL1_BUILTINS && shaderVersion != 100)
- level--;
-
- TSymbol *symbol = table[level]->find(name);
-
- if (symbol)
- return symbol;
- }
-
- return nullptr;
-}
-
-TSymbolTable::~TSymbolTable()
-{
- while (table.size() > 0)
- pop();
-}
-
-bool IsGenType(const TType *type)
-{
- if (type)
- {
- TBasicType basicType = type->getBasicType();
- return basicType == EbtGenType || basicType == EbtGenIType || basicType == EbtGenUType ||
- basicType == EbtGenBType;
- }
-
- return false;
-}
-
-bool IsVecType(const TType *type)
-{
- if (type)
- {
- TBasicType basicType = type->getBasicType();
- return basicType == EbtVec || basicType == EbtIVec || basicType == EbtUVec ||
- basicType == EbtBVec;
- }
-
- return false;
-}
-
-const TType *SpecificType(const TType *type, int size)
-{
- ASSERT(size >= 1 && size <= 4);
-
- if (!type)
- {
- return nullptr;
- }
-
- ASSERT(!IsVecType(type));
-
- switch (type->getBasicType())
- {
- case EbtGenType:
- return TCache::getType(EbtFloat, type->getQualifier(),
- static_cast<unsigned char>(size));
- case EbtGenIType:
- return TCache::getType(EbtInt, type->getQualifier(), static_cast<unsigned char>(size));
- case EbtGenUType:
- return TCache::getType(EbtUInt, type->getQualifier(), static_cast<unsigned char>(size));
- case EbtGenBType:
- return TCache::getType(EbtBool, type->getQualifier(), static_cast<unsigned char>(size));
- default:
- return type;
- }
-}
-
-const TType *VectorType(const TType *type, int size)
-{
- ASSERT(size >= 2 && size <= 4);
-
- if (!type)
- {
- return nullptr;
- }
-
- ASSERT(!IsGenType(type));
-
- switch (type->getBasicType())
- {
- case EbtVec:
- return TCache::getType(EbtFloat, static_cast<unsigned char>(size));
- case EbtIVec:
- return TCache::getType(EbtInt, static_cast<unsigned char>(size));
- case EbtUVec:
- return TCache::getType(EbtUInt, static_cast<unsigned char>(size));
- case EbtBVec:
- return TCache::getType(EbtBool, static_cast<unsigned char>(size));
- default:
- return type;
- }
-}
-
-TVariable *TSymbolTable::declareVariable(const TString *name, const TType &type)
-{
- return insertVariable(currentLevel(), name, type);
-}
-
-TVariable *TSymbolTable::declareStructType(TStructure *str)
-{
- return insertStructType(currentLevel(), str);
-}
-
-TInterfaceBlockName *TSymbolTable::declareInterfaceBlockName(const TString *name)
-{
- TInterfaceBlockName *blockNameSymbol = new TInterfaceBlockName(this, name);
- if (insert(currentLevel(), blockNameSymbol))
- {
- return blockNameSymbol;
- }
- return nullptr;
-}
-
-TInterfaceBlockName *TSymbolTable::insertInterfaceBlockNameExt(ESymbolLevel level,
- TExtension ext,
- const TString *name)
-{
- TInterfaceBlockName *blockNameSymbol = new TInterfaceBlockName(this, name);
- if (insert(level, ext, blockNameSymbol))
- {
- return blockNameSymbol;
- }
- return nullptr;
-}
-
-TVariable *TSymbolTable::insertVariable(ESymbolLevel level, const char *name, const TType &type)
-{
- return insertVariable(level, NewPoolTString(name), type);
-}
-
-TVariable *TSymbolTable::insertVariable(ESymbolLevel level, const TString *name, const TType &type)
-{
- TVariable *var = new TVariable(this, name, type);
- if (insert(level, var))
- {
- // Do lazy initialization for struct types, so we allocate to the current scope.
- if (var->getType().getBasicType() == EbtStruct)
- {
- var->getType().realize();
- }
- return var;
- }
- return nullptr;
-}
-
-TVariable *TSymbolTable::insertVariableExt(ESymbolLevel level,
- TExtension ext,
- const char *name,
- const TType &type)
-{
- TVariable *var = new TVariable(this, NewPoolTString(name), type);
- if (insert(level, ext, var))
- {
- if (var->getType().getBasicType() == EbtStruct)
- {
- var->getType().realize();
- }
- return var;
- }
- return nullptr;
-}
-
-TVariable *TSymbolTable::insertStructType(ESymbolLevel level, TStructure *str)
-{
- TVariable *var = new TVariable(this, &str->name(), TType(str), true);
- if (insert(level, var))
- {
- var->getType().realize();
- return var;
- }
- return nullptr;
-}
-
-void TSymbolTable::insertBuiltIn(ESymbolLevel level,
- TOperator op,
- TExtension ext,
- const TType *rvalue,
- const char *name,
- const TType *ptype1,
- const TType *ptype2,
- const TType *ptype3,
- const TType *ptype4,
- const TType *ptype5)
-{
- if (ptype1->getBasicType() == EbtGSampler2D)
- {
- insertUnmangledBuiltInName(name, level);
- bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name,
- TCache::getType(EbtSampler2D), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name,
- TCache::getType(EbtISampler2D), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name,
- TCache::getType(EbtUSampler2D), ptype2, ptype3, ptype4, ptype5);
- }
- else if (ptype1->getBasicType() == EbtGSampler3D)
- {
- insertUnmangledBuiltInName(name, level);
- bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name,
- TCache::getType(EbtSampler3D), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name,
- TCache::getType(EbtISampler3D), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name,
- TCache::getType(EbtUSampler3D), ptype2, ptype3, ptype4, ptype5);
- }
- else if (ptype1->getBasicType() == EbtGSamplerCube)
- {
- insertUnmangledBuiltInName(name, level);
- bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name,
- TCache::getType(EbtSamplerCube), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name,
- TCache::getType(EbtISamplerCube), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name,
- TCache::getType(EbtUSamplerCube), ptype2, ptype3, ptype4, ptype5);
- }
- else if (ptype1->getBasicType() == EbtGSampler2DArray)
- {
- insertUnmangledBuiltInName(name, level);
- bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name,
- TCache::getType(EbtSampler2DArray), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name,
- TCache::getType(EbtISampler2DArray), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name,
- TCache::getType(EbtUSampler2DArray), ptype2, ptype3, ptype4, ptype5);
- }
- else if (ptype1->getBasicType() == EbtGSampler2DMS)
- {
- insertUnmangledBuiltInName(name, level);
- bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name,
- TCache::getType(EbtSampler2DMS), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name,
- TCache::getType(EbtISampler2DMS), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name,
- TCache::getType(EbtUSampler2DMS), ptype2, ptype3, ptype4, ptype5);
- }
- else if (IsGImage(ptype1->getBasicType()))
- {
- insertUnmangledBuiltInName(name, level);
-
- const TType *floatType = TCache::getType(EbtFloat, 4);
- const TType *intType = TCache::getType(EbtInt, 4);
- const TType *unsignedType = TCache::getType(EbtUInt, 4);
-
- const TType *floatImage =
- TCache::getType(convertGImageToFloatImage(ptype1->getBasicType()));
- const TType *intImage = TCache::getType(convertGImageToIntImage(ptype1->getBasicType()));
- const TType *unsignedImage =
- TCache::getType(convertGImageToUnsignedImage(ptype1->getBasicType()));
-
- // GLSL ES 3.10, Revision 4, 8.12 Image Functions
- if (rvalue->getBasicType() == EbtGVec4)
- {
- // imageLoad
- insertBuiltIn(level, floatType, name, floatImage, ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, intType, name, intImage, ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, unsignedType, name, unsignedImage, ptype2, ptype3, ptype4, ptype5);
- }
- else if (rvalue->getBasicType() == EbtVoid)
- {
- // imageStore
- insertBuiltIn(level, rvalue, name, floatImage, ptype2, floatType, ptype4, ptype5);
- insertBuiltIn(level, rvalue, name, intImage, ptype2, intType, ptype4, ptype5);
- insertBuiltIn(level, rvalue, name, unsignedImage, ptype2, unsignedType, ptype4, ptype5);
- }
- else
- {
- // imageSize
- insertBuiltIn(level, rvalue, name, floatImage, ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, rvalue, name, intImage, ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, rvalue, name, unsignedImage, ptype2, ptype3, ptype4, ptype5);
- }
- }
- else if (IsGenType(rvalue) || IsGenType(ptype1) || IsGenType(ptype2) || IsGenType(ptype3) ||
- IsGenType(ptype4))
- {
- ASSERT(!ptype5);
- insertUnmangledBuiltInName(name, level);
- insertBuiltIn(level, op, ext, SpecificType(rvalue, 1), name, SpecificType(ptype1, 1),
- SpecificType(ptype2, 1), SpecificType(ptype3, 1), SpecificType(ptype4, 1));
- insertBuiltIn(level, op, ext, SpecificType(rvalue, 2), name, SpecificType(ptype1, 2),
- SpecificType(ptype2, 2), SpecificType(ptype3, 2), SpecificType(ptype4, 2));
- insertBuiltIn(level, op, ext, SpecificType(rvalue, 3), name, SpecificType(ptype1, 3),
- SpecificType(ptype2, 3), SpecificType(ptype3, 3), SpecificType(ptype4, 3));
- insertBuiltIn(level, op, ext, SpecificType(rvalue, 4), name, SpecificType(ptype1, 4),
- SpecificType(ptype2, 4), SpecificType(ptype3, 4), SpecificType(ptype4, 4));
- }
- else if (IsVecType(rvalue) || IsVecType(ptype1) || IsVecType(ptype2) || IsVecType(ptype3))
- {
- ASSERT(!ptype4 && !ptype5);
- insertUnmangledBuiltInName(name, level);
- insertBuiltIn(level, op, ext, VectorType(rvalue, 2), name, VectorType(ptype1, 2),
- VectorType(ptype2, 2), VectorType(ptype3, 2));
- insertBuiltIn(level, op, ext, VectorType(rvalue, 3), name, VectorType(ptype1, 3),
- VectorType(ptype2, 3), VectorType(ptype3, 3));
- insertBuiltIn(level, op, ext, VectorType(rvalue, 4), name, VectorType(ptype1, 4),
- VectorType(ptype2, 4), VectorType(ptype3, 4));
- }
- else
- {
- TFunction *function = new TFunction(this, NewPoolTString(name), rvalue, op, ext);
-
- function->addParameter(TConstParameter(ptype1));
-
- if (ptype2)
- {
- function->addParameter(TConstParameter(ptype2));
- }
-
- if (ptype3)
- {
- function->addParameter(TConstParameter(ptype3));
- }
-
- if (ptype4)
- {
- function->addParameter(TConstParameter(ptype4));
- }
-
- if (ptype5)
- {
- function->addParameter(TConstParameter(ptype5));
- }
-
- ASSERT(hasUnmangledBuiltInAtLevel(name, level));
- insert(level, function);
- }
-}
-
-void TSymbolTable::insertBuiltInOp(ESymbolLevel level,
- TOperator op,
- const TType *rvalue,
- const TType *ptype1,
- const TType *ptype2,
- const TType *ptype3,
- const TType *ptype4,
- const TType *ptype5)
-{
- const char *name = GetOperatorString(op);
- ASSERT(strlen(name) > 0);
- insertUnmangledBuiltInName(name, level);
- insertBuiltIn(level, op, TExtension::UNDEFINED, rvalue, name, ptype1, ptype2, ptype3, ptype4,
- ptype5);
-}
-
-void TSymbolTable::insertBuiltInOp(ESymbolLevel level,
- TOperator op,
- TExtension ext,
- const TType *rvalue,
- const TType *ptype1,
- const TType *ptype2,
- const TType *ptype3,
- const TType *ptype4,
- const TType *ptype5)
-{
- const char *name = GetOperatorString(op);
- insertUnmangledBuiltInName(name, level);
- insertBuiltIn(level, op, ext, rvalue, name, ptype1, ptype2, ptype3, ptype4, ptype5);
-}
-
-void TSymbolTable::insertBuiltInFunctionNoParameters(ESymbolLevel level,
- TOperator op,
- const TType *rvalue,
- const char *name)
-{
- insertUnmangledBuiltInName(name, level);
- insert(level, new TFunction(this, NewPoolTString(name), rvalue, op));
-}
-
-void TSymbolTable::insertBuiltInFunctionNoParametersExt(ESymbolLevel level,
- TExtension ext,
- TOperator op,
- const TType *rvalue,
- const char *name)
-{
- insertUnmangledBuiltInName(name, level);
- insert(level, new TFunction(this, NewPoolTString(name), rvalue, op, ext));
-}
-
-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>(precisionStack.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 = precisionStack[level]->find(baseType);
- if (it != precisionStack[level]->end())
- {
- prec = (*it).second;
- break;
- }
- level--;
- }
- return prec;
-}
-
-void TSymbolTable::insertUnmangledBuiltInName(const char *name, ESymbolLevel level)
-{
- ASSERT(level >= 0 && level < static_cast<ESymbolLevel>(table.size()));
- table[level]->insertUnmangledBuiltInName(std::string(name));
-}
-
-bool TSymbolTable::hasUnmangledBuiltInAtLevel(const char *name, ESymbolLevel level)
-{
- ASSERT(level >= 0 && level < static_cast<ESymbolLevel>(table.size()));
- return table[level]->hasUnmangledBuiltIn(std::string(name));
-}
-
-bool TSymbolTable::hasUnmangledBuiltInForShaderVersion(const char *name, int shaderVersion)
-{
- ASSERT(static_cast<ESymbolLevel>(table.size()) > LAST_BUILTIN_LEVEL);
-
- for (int level = LAST_BUILTIN_LEVEL; level >= 0; --level)
- {
- if (level == ESSL3_1_BUILTINS && shaderVersion != 310)
- {
- --level;
- }
- if (level == ESSL3_BUILTINS && shaderVersion < 300)
- {
- --level;
- }
- if (level == ESSL1_BUILTINS && shaderVersion != 100)
- {
- --level;
- }
-
- if (table[level]->hasUnmangledBuiltIn(name))
- {
- return true;
- }
- }
- return false;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/SymbolTable.h b/src/3rdparty/angle/src/compiler/translator/SymbolTable.h
deleted file mode 100644
index 5d792ec188..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SymbolTable.h
+++ /dev/null
@@ -1,545 +0,0 @@
-//
-// 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 <array>
-#include <assert.h>
-#include <set>
-
-#include "common/angleutils.h"
-#include "compiler/translator/ExtensionBehavior.h"
-#include "compiler/translator/InfoSink.h"
-#include "compiler/translator/IntermNode.h"
-#include "compiler/translator/SymbolUniqueId.h"
-
-namespace sh
-{
-
-// Symbol base class. (Can build functions or variables out of these...)
-class TSymbol : angle::NonCopyable
-{
- public:
- POOL_ALLOCATOR_NEW_DELETE();
- TSymbol(TSymbolTable *symbolTable, const TString *n);
-
- virtual ~TSymbol()
- {
- // don't delete name, it's from the pool
- }
-
- const TString &getName() const { return *name; }
- virtual const TString &getMangledName() const { return getName(); }
- virtual bool isFunction() const { return false; }
- virtual bool isVariable() const { return false; }
- const TSymbolUniqueId &getUniqueId() const { return uniqueId; }
- void relateToExtension(TExtension ext) { extension = ext; }
- TExtension getExtension() const { return extension; }
-
- private:
- const TSymbolUniqueId uniqueId;
- const TString *name;
- TExtension extension;
-};
-
-// Variable, meaning a symbol that's not a function.
-//
-// May store the value of a constant variable of any type (float, int, bool or struct).
-class TVariable : public TSymbol
-{
- public:
- ~TVariable() override {}
- bool isVariable() const override { return true; }
- TType &getType() { return type; }
- const TType &getType() const { return type; }
- bool isUserType() const { return userType; }
- void setQualifier(TQualifier qualifier) { type.setQualifier(qualifier); }
-
- const TConstantUnion *getConstPointer() const { return unionArray; }
-
- void shareConstPointer(const TConstantUnion *constArray) { unionArray = constArray; }
-
- private:
- friend class TSymbolTable;
-
- TVariable(TSymbolTable *symbolTable,
- const TString *name,
- const TType &t,
- bool isUserTypeDefinition = false)
- : TSymbol(symbolTable, name), type(t), userType(isUserTypeDefinition), unionArray(0)
- {
- }
-
- TType type;
-
- // Set to true if this represents a struct type, as opposed to a variable.
- bool userType;
-
- // we are assuming that Pool Allocator will free the memory
- // allocated to unionArray when this object is destroyed.
- const TConstantUnion *unionArray;
-};
-
-// Immutable version of TParameter.
-struct TConstParameter
-{
- TConstParameter() : name(nullptr), type(nullptr) {}
- explicit TConstParameter(const TString *n) : name(n), type(nullptr) {}
- explicit TConstParameter(const TType *t) : name(nullptr), type(t) {}
- TConstParameter(const TString *n, const TType *t) : name(n), type(t) {}
-
- // Both constructor arguments must be const.
- TConstParameter(TString *n, TType *t) = delete;
- TConstParameter(const TString *n, TType *t) = delete;
- TConstParameter(TString *n, const TType *t) = delete;
-
- const TString *const name;
- const TType *const type;
-};
-
-// The function sub-class of symbols and the parser will need to
-// share this definition of a function parameter.
-struct TParameter
-{
- // Destructively converts to TConstParameter.
- // This method resets name and type to nullptrs to make sure
- // their content cannot be modified after the call.
- TConstParameter turnToConst()
- {
- const TString *constName = name;
- const TType *constType = type;
- name = nullptr;
- type = nullptr;
- return TConstParameter(constName, constType);
- }
-
- const TString *name;
- TType *type;
-};
-
-// The function sub-class of a symbol.
-class TFunction : public TSymbol
-{
- public:
- TFunction(TSymbolTable *symbolTable,
- const TString *name,
- const TType *retType,
- TOperator tOp = EOpNull,
- TExtension ext = TExtension::UNDEFINED)
- : TSymbol(symbolTable, name),
- returnType(retType),
- mangledName(nullptr),
- op(tOp),
- defined(false),
- mHasPrototypeDeclaration(false)
- {
- relateToExtension(ext);
- }
- ~TFunction() override;
- bool isFunction() const override { return true; }
-
- void addParameter(const TConstParameter &p)
- {
- parameters.push_back(p);
- mangledName = nullptr;
- }
-
- void swapParameters(const TFunction &parametersSource);
-
- const TString &getMangledName() const override
- {
- if (mangledName == nullptr)
- {
- mangledName = buildMangledName();
- }
- return *mangledName;
- }
-
- static const TString &GetMangledNameFromCall(const TString &functionName,
- const TIntermSequence &arguments);
-
- const TType &getReturnType() const { return *returnType; }
-
- TOperator getBuiltInOp() const { return op; }
-
- void setDefined() { defined = true; }
- bool isDefined() { return defined; }
- void setHasPrototypeDeclaration() { mHasPrototypeDeclaration = true; }
- bool hasPrototypeDeclaration() const { return mHasPrototypeDeclaration; }
-
- size_t getParamCount() const { return parameters.size(); }
- const TConstParameter &getParam(size_t i) const { return parameters[i]; }
-
- private:
- void clearParameters();
-
- const TString *buildMangledName() const;
-
- typedef TVector<TConstParameter> TParamList;
- TParamList parameters;
- const TType *returnType;
- mutable const TString *mangledName;
- TOperator op;
- bool defined;
- bool mHasPrototypeDeclaration;
-};
-
-// Interface block name sub-symbol
-class TInterfaceBlockName : public TSymbol
-{
- public:
- virtual ~TInterfaceBlockName() {}
-
- private:
- friend class TSymbolTable;
- TInterfaceBlockName(TSymbolTable *symbolTable, const TString *name) : TSymbol(symbolTable, name)
- {
- }
-};
-
-class TSymbolTableLevel
-{
- public:
- typedef TUnorderedMap<TString, TSymbol *> tLevel;
- typedef tLevel::const_iterator const_iterator;
- typedef const tLevel::value_type tLevelPair;
- typedef std::pair<tLevel::iterator, bool> tInsertResult;
-
- TSymbolTableLevel() : mGlobalInvariant(false) {}
- ~TSymbolTableLevel();
-
- bool insert(TSymbol *symbol);
-
- // Insert a function using its unmangled name as the key.
- bool insertUnmangled(TFunction *function);
-
- TSymbol *find(const TString &name) const;
-
- void addInvariantVarying(const std::string &name) { mInvariantVaryings.insert(name); }
-
- bool isVaryingInvariant(const std::string &name)
- {
- return (mGlobalInvariant || mInvariantVaryings.count(name) > 0);
- }
-
- void setGlobalInvariant(bool invariant) { mGlobalInvariant = invariant; }
-
- void insertUnmangledBuiltInName(const std::string &name)
- {
- mUnmangledBuiltInNames.insert(name);
- }
-
- bool hasUnmangledBuiltIn(const std::string &name)
- {
- return mUnmangledBuiltInNames.count(name) > 0;
- }
-
- protected:
- tLevel level;
- std::set<std::string> mInvariantVaryings;
- bool mGlobalInvariant;
-
- private:
- std::set<std::string> mUnmangledBuiltInNames;
-};
-
-// Define ESymbolLevel as int rather than an enum since level can go
-// above GLOBAL_LEVEL and cause atBuiltInLevel() to fail if the
-// compiler optimizes the >= of the last element to ==.
-typedef int ESymbolLevel;
-const int COMMON_BUILTINS = 0;
-const int ESSL1_BUILTINS = 1;
-const int ESSL3_BUILTINS = 2;
-const int 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;
-const int GLOBAL_LEVEL = 5;
-
-class TSymbolTable : angle::NonCopyable
-{
- public:
- TSymbolTable() : mUniqueIdCounter(0), mEmptySymbolId(this)
- {
- // The symbol table cannot be used until push() is called, but
- // the lack of an initial call to push() can be used to detect
- // that the symbol table has not been preloaded with built-ins.
- }
-
- ~TSymbolTable();
-
- // When the symbol table is initialized with the built-ins, there should
- // 'push' calls, so that built-ins are at level 0 and the shader
- // globals are at level 1.
- bool isEmpty() const { return table.empty(); }
- bool atBuiltInLevel() const { return currentLevel() <= LAST_BUILTIN_LEVEL; }
- bool atGlobalLevel() const { return currentLevel() == GLOBAL_LEVEL; }
- void push()
- {
- table.push_back(new TSymbolTableLevel);
- precisionStack.push_back(new PrecisionStackLevel);
- }
-
- void pop()
- {
- delete table.back();
- table.pop_back();
-
- delete precisionStack.back();
- precisionStack.pop_back();
- }
-
- // The declare* entry points are used when parsing and declare symbols at the current scope.
- // They return the created symbol in case the declaration was successful, and nullptr if the
- // declaration failed due to redefinition.
- TVariable *declareVariable(const TString *name, const TType &type);
- TVariable *declareStructType(TStructure *str);
- TInterfaceBlockName *declareInterfaceBlockName(const TString *name);
-
- // The insert* entry points are used when initializing the symbol table with built-ins.
- // They return the created symbol in case the declaration was successful, and nullptr if the
- // declaration failed due to redefinition.
- TVariable *insertVariable(ESymbolLevel level, const char *name, const TType &type);
- TVariable *insertVariableExt(ESymbolLevel level,
- TExtension ext,
- const char *name,
- const TType &type);
- TVariable *insertStructType(ESymbolLevel level, TStructure *str);
- TInterfaceBlockName *insertInterfaceBlockNameExt(ESymbolLevel level,
- TExtension ext,
- const TString *name);
-
- bool insertConstInt(ESymbolLevel level, const char *name, int value, TPrecision precision)
- {
- TVariable *constant =
- new TVariable(this, NewPoolTString(name), TType(EbtInt, precision, EvqConst, 1));
- TConstantUnion *unionArray = new TConstantUnion[1];
- unionArray[0].setIConst(value);
- constant->shareConstPointer(unionArray);
- return insert(level, constant);
- }
-
- bool insertConstIntExt(ESymbolLevel level,
- TExtension ext,
- const char *name,
- int value,
- TPrecision precision)
- {
- TVariable *constant =
- new TVariable(this, NewPoolTString(name), TType(EbtInt, precision, EvqConst, 1));
- TConstantUnion *unionArray = new TConstantUnion[1];
- unionArray[0].setIConst(value);
- constant->shareConstPointer(unionArray);
- return insert(level, ext, constant);
- }
-
- bool insertConstIvec3(ESymbolLevel level,
- const char *name,
- const std::array<int, 3> &values,
- TPrecision precision)
- {
- TVariable *constantIvec3 =
- new TVariable(this, NewPoolTString(name), TType(EbtInt, precision, EvqConst, 3));
-
- TConstantUnion *unionArray = new TConstantUnion[3];
- for (size_t index = 0u; index < 3u; ++index)
- {
- unionArray[index].setIConst(values[index]);
- }
- constantIvec3->shareConstPointer(unionArray);
-
- return insert(level, constantIvec3);
- }
-
- void insertBuiltIn(ESymbolLevel level,
- TOperator op,
- TExtension ext,
- const TType *rvalue,
- const char *name,
- const TType *ptype1,
- const TType *ptype2 = 0,
- const TType *ptype3 = 0,
- const TType *ptype4 = 0,
- const TType *ptype5 = 0);
-
- void insertBuiltIn(ESymbolLevel level,
- const TType *rvalue,
- const char *name,
- const TType *ptype1,
- const TType *ptype2 = 0,
- const TType *ptype3 = 0,
- const TType *ptype4 = 0,
- const TType *ptype5 = 0)
- {
- insertUnmangledBuiltInName(name, level);
- insertBuiltIn(level, EOpNull, TExtension::UNDEFINED, rvalue, name, ptype1, ptype2, ptype3,
- ptype4, ptype5);
- }
-
- void insertBuiltIn(ESymbolLevel level,
- TExtension ext,
- const TType *rvalue,
- const char *name,
- const TType *ptype1,
- const TType *ptype2 = 0,
- const TType *ptype3 = 0,
- const TType *ptype4 = 0,
- const TType *ptype5 = 0)
- {
- insertUnmangledBuiltInName(name, level);
- insertBuiltIn(level, EOpNull, ext, rvalue, name, ptype1, ptype2, ptype3, ptype4, ptype5);
- }
-
- void insertBuiltInOp(ESymbolLevel level,
- TOperator op,
- const TType *rvalue,
- const TType *ptype1,
- const TType *ptype2 = 0,
- const TType *ptype3 = 0,
- const TType *ptype4 = 0,
- const TType *ptype5 = 0);
-
- void insertBuiltInOp(ESymbolLevel level,
- TOperator op,
- TExtension ext,
- const TType *rvalue,
- const TType *ptype1,
- const TType *ptype2 = 0,
- const TType *ptype3 = 0,
- const TType *ptype4 = 0,
- const TType *ptype5 = 0);
-
- void insertBuiltInFunctionNoParameters(ESymbolLevel level,
- TOperator op,
- const TType *rvalue,
- const char *name);
-
- void insertBuiltInFunctionNoParametersExt(ESymbolLevel level,
- TExtension ext,
- TOperator op,
- const TType *rvalue,
- const char *name);
-
- TSymbol *find(const TString &name,
- int shaderVersion,
- bool *builtIn = nullptr,
- bool *sameScope = nullptr) const;
-
- TSymbol *findGlobal(const TString &name) const;
-
- TSymbol *findBuiltIn(const TString &name, int shaderVersion) const;
-
- TSymbol *findBuiltIn(const TString &name, int shaderVersion, bool includeGLSLBuiltins) const;
-
- TSymbolTableLevel *getOuterLevel()
- {
- assert(currentLevel() >= 1);
- return table[currentLevel() - 1];
- }
-
- void setDefaultPrecision(TBasicType type, TPrecision prec)
- {
- int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1;
- // Uses map operator [], overwrites the current value
- (*precisionStack[indexOfLastElement])[type] = 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 std::string &originalName)
- {
- ASSERT(atGlobalLevel());
- table[currentLevel()]->addInvariantVarying(originalName);
- }
- // If this returns false, the varying could still be invariant
- // if it is set as invariant during the varying variable
- // declaration - this piece of information is stored in the
- // variable's type, not here.
- bool isVaryingInvariant(const std::string &originalName) const
- {
- ASSERT(atGlobalLevel());
- return table[currentLevel()]->isVaryingInvariant(originalName);
- }
-
- void setGlobalInvariant(bool invariant)
- {
- ASSERT(atGlobalLevel());
- table[currentLevel()]->setGlobalInvariant(invariant);
- }
-
- const TSymbolUniqueId nextUniqueId() { return TSymbolUniqueId(this); }
-
- // The empty symbol id is shared between all empty string ("") symbols. They are used in the
- // AST for unused function parameters and struct type declarations that don't declare a
- // variable, for example.
- const TSymbolUniqueId &getEmptySymbolId() { return mEmptySymbolId; }
-
- // Checks whether there is a built-in accessible by a shader with the specified version.
- bool hasUnmangledBuiltInForShaderVersion(const char *name, int shaderVersion);
-
- private:
- friend class TSymbolUniqueId;
- int nextUniqueIdValue() { return ++mUniqueIdCounter; }
-
- ESymbolLevel currentLevel() const { return static_cast<ESymbolLevel>(table.size() - 1); }
-
- TVariable *insertVariable(ESymbolLevel level, const TString *name, const TType &type);
-
- bool insert(ESymbolLevel level, TSymbol *symbol) { return table[level]->insert(symbol); }
-
- bool insert(ESymbolLevel level, TExtension ext, TSymbol *symbol)
- {
- symbol->relateToExtension(ext);
- return table[level]->insert(symbol);
- }
-
- // Used to insert unmangled functions to check redeclaration of built-ins in ESSL 3.00 and
- // above.
- void insertUnmangledBuiltInName(const char *name, ESymbolLevel level);
-
- bool hasUnmangledBuiltInAtLevel(const char *name, ESymbolLevel level);
-
- std::vector<TSymbolTableLevel *> table;
- typedef TMap<TBasicType, TPrecision> PrecisionStackLevel;
- std::vector<PrecisionStackLevel *> precisionStack;
-
- int mUniqueIdCounter;
-
- const TSymbolUniqueId mEmptySymbolId;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_SYMBOLTABLE_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/SymbolUniqueId.cpp b/src/3rdparty/angle/src/compiler/translator/SymbolUniqueId.cpp
deleted file mode 100644
index 2a68ae3e70..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SymbolUniqueId.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// 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.getUniqueId().get())
-{
-}
-
-int TSymbolUniqueId::get() const
-{
- return mId;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/SymbolUniqueId.h b/src/3rdparty/angle/src/compiler/translator/SymbolUniqueId.h
deleted file mode 100644
index 4bd5604246..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/SymbolUniqueId.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// 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(TSymbolTable *symbolTable);
- explicit TSymbolUniqueId(const TSymbol &symbol);
- TSymbolUniqueId(const TSymbolUniqueId &) = default;
- TSymbolUniqueId &operator=(const TSymbolUniqueId &) = default;
-
- int get() const;
-
- private:
- int mId;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_SYMBOLUNIQUEID_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/TextureFunctionHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/TextureFunctionHLSL.cpp
deleted file mode 100644
index d2b65a6c56..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/TextureFunctionHLSL.cpp
+++ /dev/null
@@ -1,1322 +0,0 @@
-//
-// 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/UtilsHLSL.h"
-
-namespace sh
-{
-
-namespace
-{
-
-void OutputIntTexCoordWrap(TInfoSinkBase &out,
- const char *wrapMode,
- const char *size,
- const TString &texCoord,
- const TString &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";
-
- // CLAMP_TO_EDGE
- out << "if (" << wrapMode << " == 1)\n";
- out << "{\n";
- out << " " << texCoordOutName << " = clamp(int(floor(" << size << " * " << texCoordOutName
- << "Offset)), 0, int(" << size << ") - 1);\n";
- out << "}\n";
-
- // MIRRORED_REPEAT
- out << "else if (" << wrapMode << " == 3)\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,
- TString *texCoordX,
- TString *texCoordY,
- TString *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 = "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 = "tiy";
-
- if (IsSamplerArray(textureFunction.sampler))
- {
- *texCoordZ = "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 = "tiz";
- }
-}
-
-void OutputHLSL4SampleFunctionPrefix(TInfoSinkBase &out,
- const TextureFunctionHLSL::TextureFunction &textureFunction,
- const TString &textureReference,
- const TString &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)
-{
- if (IsIntegerSampler(textureFunction.sampler) ||
- textureFunction.method == TextureFunctionHLSL::TextureFunction::FETCH)
- {
- switch (hlslCoords)
- {
- case 2:
- if (textureFunction.sampler == EbtSampler2DMS ||
- textureFunction.sampler == EbtISampler2DMS ||
- textureFunction.sampler == EbtUSampler2DMS)
- return "int2";
- else
- return "int3";
- case 3:
- 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
- {
- switch (textureFunction.sampler)
- {
- case EbtSampler2D:
- return 2;
- case EbtSampler2DMS:
- return 2;
- case EbtSampler3D:
- return 3;
- case EbtSamplerCube:
- return 3;
- case EbtSampler2DArray:
- return 3;
- case EbtSamplerExternalOES:
- return 2;
- case EbtISampler2D:
- return 2;
- case EbtISampler2DMS:
- return 2;
- case EbtISampler3D:
- return 3;
- case EbtISamplerCube:
- return 3;
- case EbtISampler2DArray:
- return 3;
- case EbtUSampler2D:
- return 2;
- case EbtUSampler2DMS:
- return 2;
- case EbtUSampler3D:
- return 3;
- case EbtUSamplerCube:
- return 3;
- case EbtUSampler2DArray:
- return 3;
- case EbtSampler2DShadow:
- return 2;
- case EbtSamplerCubeShadow:
- return 3;
- case EbtSampler2DArrayShadow:
- return 3;
- default:
- UNREACHABLE();
- }
- }
- 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 (textureFunction.sampler == EbtSampler2DMS ||
- textureFunction.sampler == EbtISampler2DMS ||
- textureFunction.sampler == EbtUSampler2DMS)
- out << ", int index";
- else
- out << ", int mip";
- break;
- case TextureFunctionHLSL::TextureFunction::GRAD:
- break;
- default:
- UNREACHABLE();
- }
-
- 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 EbtSampler2DMS:
- case EbtISampler2DMS:
- case EbtUSampler2DMS:
- case EbtSamplerExternalOES:
- out << ", int2 offset";
- break;
- default:
- UNREACHABLE();
- }
- }
-
- if (textureFunction.method == TextureFunctionHLSL::TextureFunction::BIAS ||
- textureFunction.method == TextureFunctionHLSL::TextureFunction::LOD0BIAS)
- {
- out << ", float bias";
- }
-}
-
-void GetTextureReference(TInfoSinkBase &out,
- const TextureFunctionHLSL::TextureFunction &textureFunction,
- const ShShaderOutput outputType,
- TString *textureReference,
- TString *samplerReference)
-{
- if (outputType == SH_HLSL_4_1_OUTPUT)
- {
- TString suffix = TextureGroupSuffix(textureFunction.sampler);
- if (TextureGroup(textureFunction.sampler) == HLSL_TEXTURE_2D)
- {
- *textureReference = TString("textures") + suffix + "[samplerIndex]";
- *samplerReference = TString("samplers") + suffix + "[samplerIndex]";
- }
- else
- {
- out << " const uint textureIndex = samplerIndex - textureIndexOffset" << suffix
- << ";\n";
- *textureReference = TString("textures") + suffix + "[textureIndex]";
- out << " const uint samplerArrayIndex = samplerIndex - samplerIndexOffset" << suffix
- << ";\n";
- *samplerReference = TString("samplers") + suffix + "[samplerArrayIndex]";
- }
- }
- else
- {
- *textureReference = "x";
- *samplerReference = "s";
- }
-}
-
-void OutputTextureSizeFunctionBody(TInfoSinkBase &out,
- const TextureFunctionHLSL::TextureFunction &textureFunction,
- const TString &textureReference,
- bool getDimensionsIgnoresBaseLevel)
-{
- if (IsSampler2DMS(textureFunction.sampler))
- {
- out << " uint width; uint height; uint samples;\n"
- << " " << textureReference << ".GetDimensions(width, height, 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,
- TString *texCoordX,
- TString *texCoordY,
- TString *texCoordZ)
-{
- if (textureFunction.proj)
- {
- TString proj("");
- switch (textureFunction.coords)
- {
- case 3:
- proj = " / t.z";
- break;
- case 4:
- proj = " / t.w";
- break;
- default:
- UNREACHABLE();
- }
- *texCoordX = "(" + *texCoordX + proj + ")";
- *texCoordY = "(" + *texCoordY + proj + ")";
- *texCoordZ = "(" + *texCoordZ + proj + ")";
- }
-}
-
-void OutputIntegerTextureSampleFunctionComputations(
- TInfoSinkBase &out,
- const TextureFunctionHLSL::TextureFunction &textureFunction,
- const ShShaderOutput outputType,
- const TString &textureReference,
- TString *texCoordX,
- TString *texCoordY,
- TString *texCoordZ)
-{
- if (!IsIntegerSampler(textureFunction.sampler))
- {
- return;
- }
- if (IsSamplerCube(textureFunction.sampler))
- {
- out << " float width; float height; float layers; float levels;\n";
-
- out << " uint mip = 0;\n";
-
- out << " " << textureReference
- << ".GetDimensions(mip, width, height, layers, levels);\n";
-
- out << " bool xMajor = abs(t.x) > abs(t.y) && abs(t.x) > abs(t.z);\n";
- out << " bool yMajor = abs(t.y) > abs(t.z) && abs(t.y) > abs(t.x);\n";
- out << " bool zMajor = abs(t.z) > abs(t.x) && abs(t.z) > abs(t.y);\n";
- out << " bool negative = (xMajor && t.x < 0.0f) || (yMajor && t.y < 0.0f) || "
- "(zMajor && t.z < 0.0f);\n";
-
- // FACE_POSITIVE_X = 000b
- // FACE_NEGATIVE_X = 001b
- // FACE_POSITIVE_Y = 010b
- // FACE_NEGATIVE_Y = 011b
- // FACE_POSITIVE_Z = 100b
- // FACE_NEGATIVE_Z = 101b
- out << " int face = (int)negative + (int)yMajor * 2 + (int)zMajor * 4;\n";
-
- out << " float u = xMajor ? -t.z : (yMajor && t.y < 0.0f ? -t.x : t.x);\n";
- out << " float v = yMajor ? t.z : (negative ? t.y : -t.y);\n";
- out << " float m = xMajor ? t.x : (yMajor ? t.y : t.z);\n";
-
- out << " t.x = (u * 0.5f / m) + 0.5f;\n";
- out << " t.y = (v * 0.5f / m) + 0.5f;\n";
-
- // 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)
- {
- out << " float2 tSized = float2(t.x * width, t.y * height);\n"
- " float2 dx = ddx(tSized);\n"
- " float2 dy = ddy(tSized);\n"
- " float lod = 0.5f * log2(max(dot(dx, dx), dot(dy, dy)));\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(mip, width, height, layers, levels);\n";
- }
-
- // Convert from normalized floating-point to integer
- *texCoordX = "int(floor(width * frac(" + *texCoordX + ")))";
- *texCoordY = "int(floor(height * frac(" + *texCoordY + ")))";
- *texCoordZ = "face";
- }
- else if (textureFunction.method != TextureFunctionHLSL::TextureFunction::FETCH)
- {
- if (IsSampler2D(textureFunction.sampler))
- {
- 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(0, 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(mip, width, height, layers, levels);\n";
- }
- else
- {
- 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(0, 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(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(0, 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(mip, width, height, depth, levels);\n";
- }
- else
- UNREACHABLE();
-
- OutputIntTexCoordWraps(out, textureFunction, texCoordX, texCoordY, texCoordZ);
- }
-}
-
-void OutputTextureSampleFunctionReturnStatement(
- TInfoSinkBase &out,
- const TextureFunctionHLSL::TextureFunction &textureFunction,
- const ShShaderOutput outputType,
- const TString &textureReference,
- const TString &samplerReference,
- const TString &texCoordX,
- const TString &texCoordY,
- const TString &texCoordZ)
-{
- out << " return ";
-
- // 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 (textureFunction.sampler == EbtSampler2DMS ||
- textureFunction.sampler == EbtISampler2DMS ||
- textureFunction.sampler == EbtUSampler2DMS)
- 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
-
-TString TextureFunctionHLSL::TextureFunction::name() const
-{
- TString name = "gl_texture";
-
- // 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 += TextureTypeSuffix(this->sampler);
-
- if (proj)
- {
- name += "Proj";
- }
-
- if (offset)
- {
- name += "Offset";
- }
-
- switch (method)
- {
- case IMPLICIT:
- break;
- case BIAS:
- break; // Extra parameter makes the signature unique
- case LOD:
- name += "Lod";
- break;
- case LOD0:
- name += "Lod0";
- break;
- case LOD0BIAS:
- name += "Lod0";
- break; // Extra parameter makes the signature unique
- case SIZE:
- name += "Size";
- break;
- case FETCH:
- name += "Fetch";
- break;
- case GRAD:
- name += "Grad";
- break;
- default:
- UNREACHABLE();
- }
-
- return name;
-}
-
-const char *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 EbtSampler2DArrayShadow:
- return "int3";
- default:
- UNREACHABLE();
- }
- }
- else // Sampling function
- {
- switch (sampler)
- {
- case EbtSampler2D:
- case EbtSampler2DMS:
- case EbtSampler3D:
- case EbtSamplerCube:
- case EbtSampler2DArray:
- case EbtSamplerExternalOES:
- return "float4";
- case EbtISampler2D:
- case EbtISampler2DMS:
- case EbtISampler3D:
- case EbtISamplerCube:
- case EbtISampler2DArray:
- return "int4";
- case EbtUSampler2D:
- case EbtUSampler2DMS:
- case EbtUSampler3D:
- case EbtUSamplerCube:
- case EbtUSampler2DArray:
- return "uint4";
- case EbtSampler2DShadow:
- case EbtSamplerCubeShadow:
- case EbtSampler2DArrayShadow:
- 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);
-}
-
-TString TextureFunctionHLSL::useTextureFunction(const TString &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
- 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)
- {
- 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.
- TString textureReference;
- TString samplerReference;
- GetTextureReference(out, textureFunction, outputType, &textureReference, &samplerReference);
-
- if (textureFunction.method == TextureFunction::SIZE)
- {
- OutputTextureSizeFunctionBody(out, textureFunction, textureReference,
- getDimensionsIgnoresBaseLevel);
- }
- else
- {
- TString texCoordX("t.x");
- TString texCoordY("t.y");
- TString texCoordZ("t.z");
- ProjectTextureCoordinates(textureFunction, &texCoordX, &texCoordY, &texCoordZ);
- OutputIntegerTextureSampleFunctionComputations(out, textureFunction, outputType,
- textureReference, &texCoordX, &texCoordY,
- &texCoordZ);
- OutputTextureSampleFunctionReturnStatement(out, textureFunction, outputType,
- textureReference, samplerReference,
- texCoordX, texCoordY, texCoordZ);
- }
-
- out << "}\n"
- "\n";
- }
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/TextureFunctionHLSL.h b/src/3rdparty/angle/src/compiler/translator/TextureFunctionHLSL.h
deleted file mode 100644
index 68bf8c0898..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/TextureFunctionHLSL.h
+++ /dev/null
@@ -1,76 +0,0 @@
-//
-// 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 "compiler/translator/BaseTypes.h"
-#include "compiler/translator/Common.h"
-#include "compiler/translator/InfoSink.h"
-#include "GLSLANG/ShaderLang.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
- };
-
- TString 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.
- TString useTextureFunction(const TString &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/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.cpp b/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.cpp
deleted file mode 100644
index 23c967f944..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-//
-// 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 "compiler/translator/BuiltInFunctionEmulatorGLSL.h"
-#include "compiler/translator/EmulatePrecision.h"
-#include "compiler/translator/RecordConstantPrecision.h"
-#include "compiler/translator/OutputESSL.h"
-#include "angle_gl.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(), shaderVer);
- 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 && isComputeShaderLocalSizeDeclared())
- {
- const sh::WorkGroupSize &localSize = getComputeShaderLocalSize();
- sink << "layout (local_size_x=" << localSize[0] << ", local_size_y=" << localSize[1]
- << ", local_size_z=" << localSize[2] << ") in;\n";
- }
-
- if (getShaderType() == GL_GEOMETRY_SHADER_OES)
- {
- WriteGeometryShaderLayoutQualifiers(
- sink, getGeometryShaderInputPrimitiveType(), getGeometryShaderInvocations(),
- getGeometryShaderOutputPrimitiveType(), getGeometryShaderMaxVertices());
- }
-
- // Write translated shader.
- TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(),
- &getSymbolTable(), getShaderType(), shaderVer, precisionEmulation,
- compileOptions);
-
- if (compileOptions & SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM)
- {
- TName uniformName(TString("ViewID_OVR"));
- uniformName.setInternal(true);
- sink << "highp uniform int " << outputESSL.hashName(uniformName) << ";\n";
- }
-
- root->traverse(&outputESSL);
-}
-
-bool TranslatorESSL::shouldFlattenPragmaStdglInvariantAll()
-{
- // Not necessary when translating to ESSL.
- return false;
-}
-
-void TranslatorESSL::writeExtensionBehavior(ShCompileOptions compileOptions)
-{
- TInfoSinkBase &sink = getInfoSink().obj;
- const TExtensionBehavior &extBehavior = getExtensionBehavior();
- const bool isMultiviewExtEmulated =
- (compileOptions &
- (SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM | SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW |
- SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER)) != 0u;
- for (TExtensionBehavior::const_iterator iter = extBehavior.begin(); iter != extBehavior.end();
- ++iter)
- {
- if (iter->second != EBhUndefined)
- {
- const bool isMultiview = (iter->first == TExtension::OVR_multiview);
- 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 && isMultiviewExtEmulated)
- {
- if (getShaderType() == GL_VERTEX_SHADER &&
- (compileOptions & SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER) != 0u)
- {
- // Emit the NV_viewport_array2 extension 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.
- sink << "#extension GL_NV_viewport_array2 : require\n";
- }
- }
- else if (iter->first == TExtension::OES_geometry_shader)
- {
- sink << "#ifdef GL_OES_geometry_shader\n"
- << "#extension GL_OES_geometry_shader : " << GetBehaviorString(iter->second)
- << "\n"
- << "#elif defined GL_EXT_geometry_shader\n"
- << "#extension GL_EXT_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
- {
- sink << "#extension " << GetExtensionNameString(iter->first) << " : "
- << GetBehaviorString(iter->second) << "\n";
- }
- }
- }
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.h b/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.h
deleted file mode 100644
index 24dc738513..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#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/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.cpp
deleted file mode 100644
index a14e69e5d5..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.cpp
+++ /dev/null
@@ -1,339 +0,0 @@
-//
-// 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/EmulatePrecision.h"
-#include "compiler/translator/ExtensionGLSL.h"
-#include "compiler/translator/OutputGLSL.h"
-#include "compiler/translator/RewriteTexelFetchOffset.h"
-#include "compiler/translator/RewriteUnaryMinusOperatorFloat.h"
-#include "compiler/translator/VersionGLSL.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(), getShaderVersion());
- 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 : outputVariables)
- {
- 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 && isComputeShaderLocalSizeDeclared())
- {
- const sh::WorkGroupSize &localSize = getComputeShaderLocalSize();
- sink << "layout (local_size_x=" << localSize[0] << ", local_size_y=" << localSize[1]
- << ", local_size_z=" << localSize[2] << ") in;\n";
- }
-
- if (getShaderType() == GL_GEOMETRY_SHADER_OES)
- {
- WriteGeometryShaderLayoutQualifiers(
- sink, getGeometryShaderInputPrimitiveType(), getGeometryShaderInvocations(),
- getGeometryShaderOutputPrimitiveType(), getGeometryShaderMaxVertices());
- }
-
- // Write translated shader.
- TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(),
- &getSymbolTable(), getShaderType(), getShaderVersion(), getOutputType(),
- compileOptions);
-
- if (compileOptions & SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM)
- {
- TName uniformName(TString("ViewID_OVR"));
- uniformName.setInternal(true);
- sink << "uniform int " << outputGLSL.hashName(uniformName) << ";\n";
- }
-
- 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::OES_geometry_shader)
- {
- sink << "#extension GL_ARB_geometry_shader4 : " << GetBehaviorString(iter.second)
- << "\n";
- }
- }
-
- const bool isMultiview = (iter.first == TExtension::OVR_multiview);
- if (isMultiview && getShaderType() == GL_VERTEX_SHADER &&
- (compileOptions & SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER) != 0u)
- {
- // Emit the NV_viewport_array2 extension 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.
- sink << "#extension GL_NV_viewport_array2 : require\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/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.h b/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.h
deleted file mode 100644
index 982d0e5ddc..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#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/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp
deleted file mode 100644
index 091a649cfc..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-//
-// 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/AddDefaultReturnStatements.h"
-#include "compiler/translator/ArrayReturnValueToOutParameter.h"
-#include "compiler/translator/BreakVariableAliasingInInnerLoops.h"
-#include "compiler/translator/EmulatePrecision.h"
-#include "compiler/translator/ExpandIntegerPowExpressions.h"
-#include "compiler/translator/IntermNodePatternMatcher.h"
-#include "compiler/translator/OutputHLSL.h"
-#include "compiler/translator/RemoveDynamicIndexing.h"
-#include "compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h"
-#include "compiler/translator/RewriteElseBlocks.h"
-#include "compiler/translator/RewriteTexelFetchOffset.h"
-#include "compiler/translator/RewriteUnaryMinusOperatorInt.h"
-#include "compiler/translator/SeparateArrayInitialization.h"
-#include "compiler/translator/SeparateDeclarations.h"
-#include "compiler/translator/SeparateExpressionsReturningArrays.h"
-#include "compiler/translator/SimplifyLoopConditions.h"
-#include "compiler/translator/SplitSequenceOperator.h"
-#include "compiler/translator/UnfoldShortCircuitToIf.h"
-#include "compiler/translator/WrapSwitchStatementsInBlocks.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;
-
- 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(), getShaderVersion());
-
- SplitSequenceOperator(root,
- IntermNodePatternMatcher::kExpressionReturningArray |
- IntermNodePatternMatcher::kUnfoldedShortCircuitExpression |
- IntermNodePatternMatcher::kDynamicIndexingOfVectorOrMatrixInLValue,
- &getSymbolTable(), getShaderVersion());
-
- // Note that SeparateDeclarations needs to be run before UnfoldShortCircuitToIf.
- UnfoldShortCircuitToIf(root, &getSymbolTable());
-
- 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(), getShaderVersion(), 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.
- if (WrapSwitchStatementsInBlocks(root))
- {
- // The WrapSwitchStatementsInBlocks step might introduce new no-op cases to the end of
- // switch statements, so make sure to clean up the AST.
- RemoveNoOpCasesFromEndOfSwitchStatements(root, &getSymbolTable());
- }
-
- bool precisionEmulation =
- getResources().WEBGL_debug_shader_precision && getPragma().debugShaderPrecision;
-
- if (precisionEmulation)
- {
- EmulatePrecision emulatePrecision(&getSymbolTable(), getShaderVersion());
- 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);
- }
-
- sh::OutputHLSL outputHLSL(getShaderType(), getShaderVersion(), getExtensionBehavior(),
- getSourcePath(), getOutputType(), numRenderTargets, getUniforms(),
- compileOptions, &getSymbolTable(), perfDiagnostics);
-
- outputHLSL.output(root, getInfoSink().obj);
-
- mUniformBlockRegisterMap = outputHLSL.getUniformBlockRegisterMap();
- mUniformRegisterMap = outputHLSL.getUniformRegisterMap();
-}
-
-bool TranslatorHLSL::shouldFlattenPragmaStdglInvariantAll()
-{
- // Not necessary when translating to HLSL.
- return false;
-}
-
-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;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h
deleted file mode 100644
index d7005a603c..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// 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 hasUniformBlock(const std::string &interfaceBlockName) const;
- unsigned int getUniformBlockRegister(const std::string &interfaceBlockName) const;
-
- const std::map<std::string, unsigned int> *getUniformRegisterMap() 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> mUniformBlockRegisterMap;
- std::map<std::string, unsigned int> mUniformRegisterMap;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_TRANSLATORHLSL_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/TranslatorVulkan.cpp b/src/3rdparty/angle/src/compiler/translator/TranslatorVulkan.cpp
deleted file mode 100644
index 0fe2a21f90..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/TranslatorVulkan.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-//
-// 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.
-//
-// TranslatorVulkan:
-// A GLSL-based translator that outputs shaders that fit GL_KHR_vulkan_glsl.
-// The shaders are then fed into glslang to spit out SPIR-V (libANGLE-side).
-// See: https://www.khronos.org/registry/vulkan/specs/misc/GL_KHR_vulkan_glsl.txt
-//
-
-#include "compiler/translator/TranslatorVulkan.h"
-
-#include "angle_gl.h"
-#include "common/utilities.h"
-#include "compiler/translator/OutputVulkanGLSL.h"
-#include "compiler/translator/util.h"
-
-namespace sh
-{
-
-class DeclareDefaultUniformsTraverser : public TIntermTraverser
-{
- public:
- DeclareDefaultUniformsTraverser(TInfoSinkBase *sink,
- ShHashFunction64 hashFunction,
- NameMap *nameMap)
- : TIntermTraverser(true, true, true),
- mSink(sink),
- mHashFunction(hashFunction),
- mNameMap(nameMap),
- mInDefaultUniform(false)
- {
- }
-
- bool visitDeclaration(Visit visit, TIntermDeclaration *node) override
- {
- const TIntermSequence &sequence = *(node->getSequence());
-
- // TODO(jmadill): Compound declarations.
- ASSERT(sequence.size() == 1);
-
- TIntermTyped *variable = sequence.front()->getAsTyped();
- const TType &type = variable->getType();
- bool isUniform = (type.getQualifier() == EvqUniform) && !IsOpaqueType(type.getBasicType());
-
- if (visit == PreVisit)
- {
- if (isUniform)
- {
- (*mSink) << " " << GetTypeName(type, mHashFunction, mNameMap) << " ";
- mInDefaultUniform = true;
- }
- }
- else if (visit == InVisit)
- {
- mInDefaultUniform = isUniform;
- }
- else if (visit == PostVisit)
- {
- if (isUniform)
- {
- (*mSink) << ";\n";
-
- // Remove the uniform declaration from the tree so it isn't parsed again.
- TIntermSequence emptyReplacement;
- mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(
- getParentNode()->getAsBlock(), node, emptyReplacement));
- }
-
- mInDefaultUniform = false;
- }
- return true;
- }
-
- void visitSymbol(TIntermSymbol *symbol) override
- {
- if (mInDefaultUniform)
- {
- const TName &name = symbol->getName();
- ASSERT(name.getString().substr(0, 3) != "gl_");
- (*mSink) << HashName(name, mHashFunction, mNameMap);
- }
- }
-
- private:
- TInfoSinkBase *mSink;
- ShHashFunction64 mHashFunction;
- NameMap *mNameMap;
- bool mInDefaultUniform;
-};
-
-TranslatorVulkan::TranslatorVulkan(sh::GLenum type, ShShaderSpec spec)
- : TCompiler(type, spec, SH_GLSL_450_CORE_OUTPUT)
-{
-}
-
-void TranslatorVulkan::translate(TIntermBlock *root,
- ShCompileOptions compileOptions,
- PerformanceDiagnostics * /*perfDiagnostics*/)
-{
- TInfoSinkBase &sink = getInfoSink().obj;
-
- sink << "#version 450 core\n";
-
- // Write out default uniforms into a uniform block assigned to a specific set/binding.
- int defaultUniformCount = 0;
- for (const auto &uniform : getUniforms())
- {
- if (!uniform.isBuiltIn() && uniform.staticUse && !gl::IsOpaqueType(uniform.type))
- {
- ++defaultUniformCount;
- }
- }
-
- if (defaultUniformCount > 0)
- {
- sink << "\nlayout(@@ DEFAULT-UNIFORMS-SET-BINDING @@) uniform defaultUniforms\n{\n";
-
- DeclareDefaultUniformsTraverser defaultTraverser(&sink, getHashFunction(), &getNameMap());
- root->traverse(&defaultTraverser);
- defaultTraverser.updateTree();
-
- sink << "};\n";
- }
-
- // 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)
- {
- bool hasGLFragColor = false;
- bool hasGLFragData = false;
-
- for (const auto &outputVar : outputVariables)
- {
- if (outputVar.name == "gl_FragColor")
- {
- ASSERT(!hasGLFragColor);
- hasGLFragColor = true;
- continue;
- }
- else if (outputVar.name == "gl_FragData")
- {
- ASSERT(!hasGLFragData);
- hasGLFragData = true;
- continue;
- }
- }
- ASSERT(!(hasGLFragColor && hasGLFragData));
- if (hasGLFragColor)
- {
- sink << "layout(location = 0) out vec4 webgl_FragColor;\n";
- }
- if (hasGLFragData)
- {
- sink << "layout(location = 0) out vec4 webgl_FragData[gl_MaxDrawBuffers];\n";
- }
- }
-
- // Write translated shader.
- TOutputVulkanGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(),
- getNameMap(), &getSymbolTable(), getShaderType(),
- getShaderVersion(), getOutputType(), compileOptions);
- root->traverse(&outputGLSL);
-}
-
-bool TranslatorVulkan::shouldFlattenPragmaStdglInvariantAll()
-{
- // Not necessary.
- return false;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/TranslatorVulkan.h b/src/3rdparty/angle/src/compiler/translator/TranslatorVulkan.h
deleted file mode 100644
index ef67b15ae1..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/TranslatorVulkan.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// 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.
-//
-// TranslatorVulkan:
-// A GLSL-based translator that outputs shaders that fit GL_KHR_vulkan_glsl.
-// The shaders are then fed into glslang to spit out SPIR-V (libANGLE-side).
-// See: https://www.khronos.org/registry/vulkan/specs/misc/GL_KHR_vulkan_glsl.txt
-//
-
-#ifndef COMPILER_TRANSLATOR_TRANSLATORVULKAN_H_
-#define COMPILER_TRANSLATOR_TRANSLATORVULKAN_H_
-
-#include "compiler/translator/Compiler.h"
-
-namespace sh
-{
-
-class TranslatorVulkan : public TCompiler
-{
- public:
- TranslatorVulkan(sh::GLenum type, ShShaderSpec spec);
-
- protected:
- void translate(TIntermBlock *root,
- ShCompileOptions compileOptions,
- PerformanceDiagnostics *perfDiagnostics) override;
- bool shouldFlattenPragmaStdglInvariantAll() override;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_TRANSLATORVULKAN_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/Types.cpp b/src/3rdparty/angle/src/compiler/translator/Types.cpp
deleted file mode 100644
index 530ffe3aeb..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Types.cpp
+++ /dev/null
@@ -1,1072 +0,0 @@
-//
-// 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/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 EbtISampler2D:
- return "isampler2D";
- case EbtISampler3D:
- return "isampler3D";
- case EbtISamplerCube:
- return "isamplerCube";
- case EbtISampler2DArray:
- return "isampler2DArray";
- case EbtISampler2DMS:
- return "isampler2DMS";
- case EbtUSampler2D:
- return "usampler2D";
- case EbtUSampler3D:
- return "usampler3D";
- case EbtUSamplerCube:
- return "usamplerCube";
- case EbtUSampler2DArray:
- return "usampler2DArray";
- case EbtUSampler2DMS:
- return "usampler2DMS";
- 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(TStructure *userDef)
- : 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(false),
- mMangledName(nullptr)
-{
-}
-
-TType::TType(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();
-}
-
-TString TType::getCompleteString() const
-{
- TStringStream stream;
-
- if (invariant)
- stream << "invariant ";
- if (qualifier != EvqTemporary && qualifier != EvqGlobal)
- stream << getQualifierString() << " ";
- if (precision != EbpUndefined)
- stream << getPrecisionString() << " ";
- if (mArraySizes)
- {
- for (auto arraySizeIter = mArraySizes->rbegin(); arraySizeIter != mArraySizes->rend();
- ++arraySizeIter)
- {
- stream << "array[" << (*arraySizeIter) << "] of ";
- }
- }
- if (isMatrix())
- stream << getCols() << "X" << getRows() << " matrix of ";
- else if (isVector())
- stream << getNominalSize() << "-component vector of ";
-
- stream << getBasicString();
- return stream.str();
-}
-
-//
-// Recursively generate mangled names.
-//
-const char *TType::buildMangledName() const
-{
- TString mangledName;
- if (isMatrix())
- mangledName += 'm';
- else if (isVector())
- mangledName += 'v';
-
- switch (type)
- {
- case EbtFloat:
- mangledName += 'f';
- break;
- case EbtInt:
- mangledName += 'i';
- break;
- case EbtUInt:
- mangledName += 'u';
- break;
- case EbtBool:
- mangledName += 'b';
- break;
- case EbtYuvCscStandardEXT:
- mangledName += "ycs";
- break;
- case EbtSampler2D:
- mangledName += "s2";
- break;
- case EbtSampler3D:
- mangledName += "s3";
- break;
- case EbtSamplerCube:
- mangledName += "sC";
- break;
- case EbtSampler2DArray:
- mangledName += "s2a";
- break;
- case EbtSamplerExternalOES:
- mangledName += "sext";
- break;
- case EbtSamplerExternal2DY2YEXT:
- mangledName += "sext2y2y";
- break;
- case EbtSampler2DRect:
- mangledName += "s2r";
- break;
- case EbtSampler2DMS:
- mangledName += "s2ms";
- break;
- case EbtISampler2D:
- mangledName += "is2";
- break;
- case EbtISampler3D:
- mangledName += "is3";
- break;
- case EbtISamplerCube:
- mangledName += "isC";
- break;
- case EbtISampler2DArray:
- mangledName += "is2a";
- break;
- case EbtISampler2DMS:
- mangledName += "is2ms";
- break;
- case EbtUSampler2D:
- mangledName += "us2";
- break;
- case EbtUSampler3D:
- mangledName += "us3";
- break;
- case EbtUSamplerCube:
- mangledName += "usC";
- break;
- case EbtUSampler2DArray:
- mangledName += "us2a";
- break;
- case EbtUSampler2DMS:
- mangledName += "us2ms";
- break;
- case EbtSampler2DShadow:
- mangledName += "s2s";
- break;
- case EbtSamplerCubeShadow:
- mangledName += "sCs";
- break;
- case EbtSampler2DArrayShadow:
- mangledName += "s2as";
- break;
- case EbtImage2D:
- mangledName += "im2";
- break;
- case EbtIImage2D:
- mangledName += "iim2";
- break;
- case EbtUImage2D:
- mangledName += "uim2";
- break;
- case EbtImage3D:
- mangledName += "im3";
- break;
- case EbtIImage3D:
- mangledName += "iim3";
- break;
- case EbtUImage3D:
- mangledName += "uim3";
- break;
- case EbtImage2DArray:
- mangledName += "im2a";
- break;
- case EbtIImage2DArray:
- mangledName += "iim2a";
- break;
- case EbtUImage2DArray:
- mangledName += "uim2a";
- break;
- case EbtImageCube:
- mangledName += "imc";
- break;
- case EbtIImageCube:
- mangledName += "iimc";
- break;
- case EbtUImageCube:
- mangledName += "uimc";
- break;
- case EbtAtomicCounter:
- mangledName += "ac";
- break;
- case EbtStruct:
- mangledName += mStructure->mangledName();
- break;
- case EbtInterfaceBlock:
- mangledName += mInterfaceBlock->mangledName();
- break;
- default:
- // EbtVoid, EbtAddress and non types
- break;
- }
-
- if (isMatrix())
- {
- mangledName += static_cast<char>('0' + getCols());
- mangledName += static_cast<char>('x');
- mangledName += static_cast<char>('0' + getRows());
- }
- else
- {
- mangledName += static_cast<char>('0' + getNominalSize());
- }
-
- if (mArraySizes)
- {
- for (unsigned int arraySize : *mArraySizes)
- {
- char buf[20];
- snprintf(buf, sizeof(buf), "%d", arraySize);
- mangledName += '[';
- mangledName += buf;
- mangledName += ']';
- }
- }
-
- mangledName += ';';
-
- // Copy string contents into a pool-allocated buffer, so we never need to call delete.
- size_t requiredSize = mangledName.size() + 1;
- char *buffer = reinterpret_cast<char *>(GetGlobalPoolAllocator()->allocate(requiredSize));
- memcpy(buffer, mangledName.c_str(), requiredSize);
- return buffer;
-}
-
-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(TInterfaceBlock *interfaceBlockIn)
-{
- if (mInterfaceBlock != interfaceBlockIn)
- {
- mInterfaceBlock = interfaceBlockIn;
- invalidateMangledName();
- }
-}
-
-void TType::setStruct(TStructure *s)
-{
- if (mStructure != s)
- {
- mStructure = s;
- invalidateMangledName();
- }
-}
-
-const char *TType::getMangledName() const
-{
- if (mMangledName == nullptr)
- {
- mMangledName = buildMangledName();
- }
-
- return mMangledName;
-}
-
-void TType::realize()
-{
- getMangledName();
-}
-
-void TType::invalidateMangledName()
-{
- mMangledName = nullptr;
-}
-
-// TStructure implementation.
-TStructure::TStructure(TSymbolTable *symbolTable, const TString *name, TFieldList *fields)
- : TFieldListCollection(name, fields),
- mDeepestNesting(0),
- mUniqueId(symbolTable->nextUniqueId()),
- mAtGlobalScope(false)
-{
-}
-
-bool TStructure::equals(const TStructure &other) const
-{
- return (uniqueId() == other.uniqueId());
-}
-
-bool TStructure::containsArrays() const
-{
- for (size_t i = 0; i < mFields->size(); ++i)
- {
- const TType *fieldType = (*mFields)[i]->type();
- if (fieldType->isArray() || fieldType->isStructureContainingArrays())
- return true;
- }
- return false;
-}
-
-bool TStructure::containsType(TBasicType type) const
-{
- for (size_t i = 0; i < mFields->size(); ++i)
- {
- const TType *fieldType = (*mFields)[i]->type();
- if (fieldType->getBasicType() == type || fieldType->isStructureContainingType(type))
- return true;
- }
- return false;
-}
-
-bool TStructure::containsSamplers() const
-{
- for (size_t i = 0; i < mFields->size(); ++i)
- {
- const TType *fieldType = (*mFields)[i]->type();
- if (IsSampler(fieldType->getBasicType()) || fieldType->isStructureContainingSamplers())
- return true;
- }
- return false;
-}
-
-void TType::createSamplerSymbols(const TString &namePrefix,
- const TString &apiNamePrefix,
- TVector<TIntermSymbol *> *outputSymbols,
- TMap<TIntermSymbol *, TString> *outputSymbolsToAPINames,
- TSymbolTable *symbolTable) const
-{
- if (isStructureContainingSamplers())
- {
- if (isArray())
- {
- TType elementType(*this);
- elementType.toArrayElementType();
- for (unsigned int arrayIndex = 0u; arrayIndex < getOutermostArraySize(); ++arrayIndex)
- {
- TStringStream elementName;
- elementName << namePrefix << "_" << arrayIndex;
- TStringStream elementApiName;
- elementApiName << apiNamePrefix << "[" << arrayIndex << "]";
- elementType.createSamplerSymbols(elementName.str(), elementApiName.str(),
- outputSymbols, outputSymbolsToAPINames,
- symbolTable);
- }
- }
- else
- {
- mStructure->createSamplerSymbols(namePrefix, apiNamePrefix, outputSymbols,
- outputSymbolsToAPINames, symbolTable);
- }
- return;
- }
-
- ASSERT(IsSampler(type));
- TIntermSymbol *symbol = new TIntermSymbol(symbolTable->nextUniqueId(), namePrefix, *this);
- outputSymbols->push_back(symbol);
- if (outputSymbolsToAPINames)
- {
- (*outputSymbolsToAPINames)[symbol] = apiNamePrefix;
- }
-}
-
-void TStructure::createSamplerSymbols(const TString &namePrefix,
- const TString &apiNamePrefix,
- TVector<TIntermSymbol *> *outputSymbols,
- TMap<TIntermSymbol *, TString> *outputSymbolsToAPINames,
- TSymbolTable *symbolTable) const
-{
- ASSERT(containsSamplers());
- for (auto &field : *mFields)
- {
- const TType *fieldType = field->type();
- if (IsSampler(fieldType->getBasicType()) || fieldType->isStructureContainingSamplers())
- {
- TString fieldName = namePrefix + "_" + field->name();
- TString fieldApiName = apiNamePrefix + "." + field->name();
- fieldType->createSamplerSymbols(fieldName, fieldApiName, outputSymbols,
- outputSymbolsToAPINames, symbolTable);
- }
- }
-}
-
-TString TFieldListCollection::buildMangledName(const TString &mangledNamePrefix) const
-{
- TString mangledName(mangledNamePrefix);
- mangledName += *mName;
- for (size_t i = 0; i < mFields->size(); ++i)
- {
- mangledName += '-';
- mangledName += (*mFields)[i]->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;
-}
-
-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 TStructure::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/src/3rdparty/angle/src/compiler/translator/Types.h b/src/3rdparty/angle/src/compiler/translator/Types.h
deleted file mode 100644
index 7dc84c5b1c..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/Types.h
+++ /dev/null
@@ -1,509 +0,0 @@
-//
-// 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/SymbolUniqueId.h"
-
-namespace sh
-{
-
-struct TPublicType;
-class TType;
-class TSymbol;
-class TIntermSymbol;
-class TSymbolTable;
-
-class TField : angle::NonCopyable
-{
- public:
- POOL_ALLOCATOR_NEW_DELETE();
- TField(TType *type, TString *name, const TSourceLoc &line)
- : mType(type), mName(name), mLine(line)
- {
- }
-
- // TODO(alokp): We should only return const type.
- // Fix it by tweaking grammar.
- TType *type() { return mType; }
- const TType *type() const { return mType; }
-
- const TString &name() const { return *mName; }
- const TSourceLoc &line() const { return mLine; }
-
- private:
- TType *mType;
- TString *mName;
- TSourceLoc mLine;
-};
-
-typedef TVector<TField *> TFieldList;
-inline TFieldList *NewPoolTFieldList()
-{
- void *memory = GetGlobalPoolAllocator()->allocate(sizeof(TFieldList));
- return new (memory) TFieldList;
-}
-
-class TFieldListCollection : angle::NonCopyable
-{
- public:
- const TString &name() const { return *mName; }
- const TFieldList &fields() const { return *mFields; }
-
- size_t objectSize() const
- {
- if (mObjectSize == 0)
- mObjectSize = calculateObjectSize();
- return mObjectSize;
- }
-
- // How many locations the field list consumes as a uniform.
- int getLocationCount() const;
-
- protected:
- TFieldListCollection(const TString *name, TFieldList *fields)
- : mName(name), mFields(fields), mObjectSize(0)
- {
- }
- TString buildMangledName(const TString &mangledNamePrefix) const;
- size_t calculateObjectSize() const;
-
- const TString *mName;
- TFieldList *mFields;
-
- mutable TString mMangledName;
- mutable size_t mObjectSize;
-};
-
-// May also represent interface blocks
-class TStructure : public TFieldListCollection
-{
- public:
- POOL_ALLOCATOR_NEW_DELETE();
- TStructure(TSymbolTable *symbolTable, const TString *name, TFieldList *fields);
-
- int deepestNesting() const
- {
- if (mDeepestNesting == 0)
- mDeepestNesting = calculateDeepestNesting();
- return mDeepestNesting;
- }
- bool containsArrays() const;
- bool containsType(TBasicType t) const;
- bool containsSamplers() const;
-
- void createSamplerSymbols(const TString &namePrefix,
- const TString &apiNamePrefix,
- TVector<TIntermSymbol *> *outputSymbols,
- TMap<TIntermSymbol *, TString> *outputSymbolsToAPINames,
- TSymbolTable *symbolTable) const;
-
- bool equals(const TStructure &other) const;
-
- int uniqueId() const { return mUniqueId.get(); }
-
- void setAtGlobalScope(bool atGlobalScope) { mAtGlobalScope = atGlobalScope; }
-
- bool atGlobalScope() const { return mAtGlobalScope; }
-
- const TString &mangledName() const
- {
- if (mMangledName.empty())
- mMangledName = buildMangledName("struct-");
- return mMangledName;
- }
-
- private:
- // TODO(zmo): Find a way to get rid of the const_cast in function
- // setName(). At the moment keep this function private so only
- // friend class RegenerateStructNames may call it.
- friend class RegenerateStructNames;
- void setName(const TString &name)
- {
- TString *mutableName = const_cast<TString *>(mName);
- *mutableName = name;
- }
-
- int calculateDeepestNesting() const;
-
- mutable int mDeepestNesting;
- const TSymbolUniqueId mUniqueId;
- bool mAtGlobalScope;
-};
-
-class TInterfaceBlock : public TFieldListCollection
-{
- public:
- POOL_ALLOCATOR_NEW_DELETE();
- TInterfaceBlock(const TString *name,
- TFieldList *fields,
- const TString *instanceName,
- const TLayoutQualifier &layoutQualifier)
- : TFieldListCollection(name, fields),
- mInstanceName(instanceName),
- mBlockStorage(layoutQualifier.blockStorage),
- mMatrixPacking(layoutQualifier.matrixPacking),
- mBinding(layoutQualifier.binding)
- {
- }
-
- const TString &instanceName() const { return *mInstanceName; }
- bool hasInstanceName() const { return mInstanceName != nullptr; }
- TLayoutBlockStorage blockStorage() const { return mBlockStorage; }
- TLayoutMatrixPacking matrixPacking() const { return mMatrixPacking; }
- int blockBinding() const { return mBinding; }
- const TString &mangledName() const
- {
- if (mMangledName.empty())
- mMangledName = buildMangledName("iblock-");
- return mMangledName;
- }
-
- private:
- const TString *mInstanceName; // for interface block instance names
- TLayoutBlockStorage mBlockStorage;
- TLayoutMatrixPacking mMatrixPacking;
- int mBinding;
-};
-
-//
-// 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);
- explicit TType(TStructure *userDef);
- TType(TInterfaceBlock *interfaceBlockIn,
- TQualifier qualifierIn,
- TLayoutQualifier layoutQualifierIn);
- TType(const TType &t);
- TType &operator=(const TType &t);
-
- TBasicType getBasicType() const { return type; }
- void setBasicType(TBasicType t);
-
- TPrecision getPrecision() const { return precision; }
- void setPrecision(TPrecision p) { precision = p; }
-
- 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();
-
- TInterfaceBlock *getInterfaceBlock() const { return mInterfaceBlock; }
- void setInterfaceBlock(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;
-
- TStructure *getStruct() { return mStructure; }
- const TStructure *getStruct() const { return mStructure; }
- void setStruct(TStructure *s);
-
- 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;
-
- TString getCompleteString() 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 { return mStructure ? mStructure->deepestNesting() : 0; }
-
- bool isNamelessStruct() const { return mStructure && mStructure->name() == ""; }
-
- bool isStructureContainingArrays() const
- {
- return mStructure ? mStructure->containsArrays() : false;
- }
-
- bool isStructureContainingType(TBasicType t) const
- {
- return mStructure ? mStructure->containsType(t) : false;
- }
-
- bool isStructureContainingSamplers() const
- {
- return mStructure ? mStructure->containsSamplers() : false;
- }
-
- bool isStructSpecifier() const { return mIsStructSpecifier; }
-
- void createSamplerSymbols(const TString &namePrefix,
- const TString &apiNamePrefix,
- TVector<TIntermSymbol *> *outputSymbols,
- TMap<TIntermSymbol *, TString> *outputSymbolsToAPINames,
- TSymbolTable *symbolTable) const;
-
- // Initializes all lazily-initialized members.
- void realize();
-
- 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.
- TInterfaceBlock *mInterfaceBlock;
-
- // 0 unless this is a struct
- 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
- 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(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; }
-
- 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/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp
deleted file mode 100644
index 4e4653bbe5..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// 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/UnfoldShortCircuitAST.h"
-
-namespace sh
-{
-
-namespace
-{
-
-// "x || y" is equivalent to "x ? true : y".
-TIntermTernary *UnfoldOR(TIntermTyped *x, TIntermTyped *y)
-{
- TConstantUnion *u = new TConstantUnion;
- u->setBConst(true);
- TIntermConstantUnion *trueNode =
- new TIntermConstantUnion(u, TType(EbtBool, EbpUndefined, EvqConst, 1));
- return new TIntermTernary(x, trueNode, y);
-}
-
-// "x && y" is equivalent to "x ? y : false".
-TIntermTernary *UnfoldAND(TIntermTyped *x, TIntermTyped *y)
-{
- TConstantUnion *u = new TConstantUnion;
- u->setBConst(false);
- TIntermConstantUnion *falseNode =
- new TIntermConstantUnion(u, TType(EbtBool, EbpUndefined, EvqConst, 1));
- return new TIntermTernary(x, y, falseNode);
-}
-
-} // namespace anonymous
-
-bool UnfoldShortCircuitAST::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;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h
deleted file mode 100644
index 7f377e6f15..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// 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_UNFOLDSHORTCIRCUITAST_H_
-#define COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_
-
-#include "common/angleutils.h"
-#include "compiler/translator/IntermTraverse.h"
-
-namespace sh
-{
-
-// 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 UnfoldShortCircuitAST : public TIntermTraverser
-{
- public:
- UnfoldShortCircuitAST() : TIntermTraverser(true, false, false) {}
-
- bool visitBinary(Visit visit, TIntermBinary *) override;
-};
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitToIf.cpp b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitToIf.cpp
deleted file mode 100644
index 774f1fc704..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitToIf.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-//
-// 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/UnfoldShortCircuitToIf.h"
-
-#include "compiler/translator/IntermNodePatternMatcher.h"
-#include "compiler/translator/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;
- TType boolType(EbtBool, EbpUndefined, EvqTemporary);
-
- ASSERT(node->getLeft()->getType() == boolType);
- insertions.push_back(createTempInitDeclaration(node->getLeft()));
-
- TIntermBlock *assignRightBlock = new TIntermBlock();
- ASSERT(node->getRight()->getType() == boolType);
- assignRightBlock->getSequence()->push_back(createTempAssignment(node->getRight()));
-
- TIntermUnary *notTempSymbol =
- new TIntermUnary(EOpLogicalNot, createTempSymbol(boolType));
- TIntermIfElse *ifNode = new TIntermIfElse(notTempSymbol, assignRightBlock, nullptr);
- insertions.push_back(ifNode);
-
- insertStatementsInParentBlock(insertions);
-
- queueReplacement(createTempSymbol(boolType), 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;
- TType boolType(EbtBool, EbpUndefined, EvqTemporary);
-
- ASSERT(node->getLeft()->getType() == boolType);
- insertions.push_back(createTempInitDeclaration(node->getLeft()));
-
- TIntermBlock *assignRightBlock = new TIntermBlock();
- ASSERT(node->getRight()->getType() == boolType);
- assignRightBlock->getSequence()->push_back(createTempAssignment(node->getRight()));
-
- TIntermIfElse *ifNode =
- new TIntermIfElse(createTempSymbol(boolType), assignRightBlock, nullptr);
- insertions.push_back(ifNode);
-
- insertStatementsInParentBlock(insertions);
-
- queueReplacement(createTempSymbol(boolType), 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 = createTempDeclaration(node->getType());
- insertions.push_back(tempDeclaration);
-
- TIntermBlock *trueBlock = new TIntermBlock();
- TIntermBinary *trueAssignment = createTempAssignment(node->getTrueExpression());
- trueBlock->getSequence()->push_back(trueAssignment);
-
- TIntermBlock *falseBlock = new TIntermBlock();
- TIntermBinary *falseAssignment = createTempAssignment(node->getFalseExpression());
- falseBlock->getSequence()->push_back(falseAssignment);
-
- TIntermIfElse *ifNode =
- new TIntermIfElse(node->getCondition()->getAsTyped(), trueBlock, falseBlock);
- insertions.push_back(ifNode);
-
- insertStatementsInParentBlock(insertions);
-
- TIntermSymbol *ternaryResult = createTempSymbol(node->getType());
- queueReplacement(ternaryResult, OriginalNode::IS_DROPPED);
-
- return false;
-}
-
-void UnfoldShortCircuitTraverser::nextIteration()
-{
- mFoundShortCircuit = false;
- nextTemporaryId();
-}
-
-} // 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/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitToIf.h b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitToIf.h
deleted file mode 100644
index 37dd83a8cf..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitToIf.h
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// 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_UNFOLDSHORTCIRCUIT_H_
-#define COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUIT_H_
-
-namespace sh
-{
-
-class TIntermNode;
-class TSymbolTable;
-
-void UnfoldShortCircuitToIf(TIntermNode *root, TSymbolTable *symbolTable);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUIT_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/UniformHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/UniformHLSL.cpp
deleted file mode 100644
index 9f18509438..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/UniformHLSL.cpp
+++ /dev/null
@@ -1,600 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// UniformHLSL.cpp:
-// Methods for GLSL to HLSL translation for uniforms and uniform blocks.
-//
-
-#include "compiler/translator/UniformHLSL.h"
-
-#include "common/utilities.h"
-#include "compiler/translator/StructureHLSL.h"
-#include "compiler/translator/UtilsHLSL.h"
-#include "compiler/translator/blocklayoutHLSL.h"
-#include "compiler/translator/util.h"
-
-namespace sh
-{
-
-namespace
-{
-
-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 OutputSamplerIndexArrayInitializer(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())
- {
- OutputSamplerIndexArrayInitializer(out, elementType,
- startIndex + i * elementType.getArraySizeProduct());
- }
- else
- {
- out << (startIndex + i);
- }
- }
- out << "}";
-}
-
-} // anonymous namespace
-
-UniformHLSL::UniformHLSL(sh::GLenum shaderType,
- StructureHLSL *structureHLSL,
- ShShaderOutput outputType,
- const std::vector<Uniform> &uniforms)
- : mUniformRegister(0),
- mUniformBlockRegister(0),
- mTextureRegister(0),
- mRWTextureRegister(0),
- mSamplerCount(0),
- mShaderType(shaderType),
- mStructureHLSL(structureHLSL),
- mOutputType(outputType),
- mUniforms(uniforms)
-{
-}
-
-void UniformHLSL::reserveUniformRegisters(unsigned int registerCount)
-{
- mUniformRegister = registerCount;
-}
-
-void UniformHLSL::reserveUniformBlockRegisters(unsigned int registerCount)
-{
- mUniformBlockRegister = registerCount;
-}
-
-const Uniform *UniformHLSL::findUniformByName(const TString &name) const
-{
- for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); ++uniformIndex)
- {
- if (mUniforms[uniformIndex].name == name.c_str())
- {
- return &mUniforms[uniformIndex];
- }
- }
-
- return nullptr;
-}
-
-unsigned int UniformHLSL::assignUniformRegister(const TType &type,
- const TString &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 = mRWTextureRegister;
- }
- else
- {
- registerIndex = mUniformRegister;
- }
-
- 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()))
- {
- mRWTextureRegister += registerCount;
- }
- else
- {
- mUniformRegister += registerCount;
- }
- if (outRegisterCount)
- {
- *outRegisterCount = registerCount;
- }
- return registerIndex;
-}
-
-unsigned int UniformHLSL::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 UniformHLSL::outputHLSLSamplerUniformGroup(
- TInfoSinkBase &out,
- const HLSLTextureGroup textureGroup,
- const TVector<const TIntermSymbol *> &group,
- const TMap<const TIntermSymbol *, TString> &samplerInStructSymbolsToAPINames,
- unsigned int *groupTextureRegisterIndex)
-{
- if (group.empty())
- {
- return;
- }
- unsigned int groupRegisterCount = 0;
- for (const TIntermSymbol *uniform : group)
- {
- const TType &type = uniform->getType();
- const TString &name = uniform->getSymbol();
- 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->getName())
- << ArrayString(type) << " = ";
- OutputSamplerIndexArrayInitializer(out, type, samplerArrayIndex);
- out << ";\n";
- }
- else
- {
- out << "static const uint " << DecorateVariableIfNeeded(uniform->getName()) << " = "
- << 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 UniformHLSL::outputHLSL4_0_FL9_3Sampler(TInfoSinkBase &out,
- const TType &type,
- const TName &name,
- const unsigned int registerIndex)
-{
- out << "uniform " << SamplerString(type.getBasicType()) << " sampler_"
- << DecorateVariableIfNeeded(name) << ArrayString(type) << " : register(s"
- << str(registerIndex) << ");\n";
- out << "uniform " << TextureString(type.getBasicType()) << " texture_"
- << DecorateVariableIfNeeded(name) << ArrayString(type) << " : register(t"
- << str(registerIndex) << ");\n";
-}
-
-void UniformHLSL::outputHLSL4_1_FL11Texture(TInfoSinkBase &out,
- const TType &type,
- const TName &name,
- const unsigned int registerIndex)
-{
- // TODO(xinghua.cao@intel.com): if image2D variable is bound on one layer of Texture3D or
- // Texture2DArray. Translate this variable to HLSL Texture3D object or HLSL Texture2DArray
- // object, or create a temporary Texture2D to save content of the layer and bind the
- // temporary Texture2D to image2D variable.
- out << "uniform "
- << TextureString(type.getBasicType(), type.getLayoutQualifier().imageInternalFormat) << " "
- << DecorateVariableIfNeeded(name) << ArrayString(type) << " : register(t"
- << str(registerIndex) << ");\n";
- return;
-}
-
-void UniformHLSL::outputHLSL4_1_FL11RWTexture(TInfoSinkBase &out,
- const TType &type,
- const TName &name,
- const unsigned int registerIndex)
-{
- // TODO(xinghua.cao@intel.com): if image2D variable is bound on one layer of Texture3D or
- // Texture2DArray. Translate this variable to HLSL RWTexture3D object or HLSL RWTexture2DArray
- // object, or create a temporary Texture2D to save content of the layer and bind the
- // temporary Texture2D to image2D variable.
- if (mShaderType == GL_COMPUTE_SHADER)
- {
- out << "uniform "
- << RWTextureString(type.getBasicType(), type.getLayoutQualifier().imageInternalFormat)
- << " " << DecorateVariableIfNeeded(name) << ArrayString(type) << " : register(u"
- << str(registerIndex) << ");\n";
- }
- else
- {
- // TODO(xinghua.cao@intel.com): Support images in vertex shader and fragment shader,
- // which are needed to sync binding value when linking program.
- }
- return;
-}
-
-void UniformHLSL::outputUniform(TInfoSinkBase &out,
- const TType &type,
- const TName &name,
- 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->name().empty())
- ? QualifiedStructNameString(*structure, false, false)
- : TypeString(type));
-
- const TString &registerString =
- TString("register(") + UniformRegisterPrefix(type) + str(registerIndex) + ")";
-
- out << "uniform " << typeName << " ";
-
- out << DecorateVariableIfNeeded(name);
-
- out << ArrayString(type) << " : " << registerString << ";\n";
-}
-
-void UniformHLSL::uniformsHeader(TInfoSinkBase &out,
- ShShaderOutput outputType,
- const ReferencedSymbols &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 TIntermSymbol *>> groupedSamplerUniforms(HLSL_TEXTURE_MAX + 1);
- TMap<const TIntermSymbol *, TString> samplerInStructSymbolsToAPINames;
- TVector<const TIntermSymbol *> imageUniformsHLSL41Output;
- for (auto &uniformIt : referencedUniforms)
- {
- // Output regular uniforms. Group sampler uniforms by type.
- const TIntermSymbol &uniform = *uniformIt.second;
- const TType &type = uniform.getType();
- const TName &name = uniform.getName();
-
- if (outputType == SH_HLSL_4_1_OUTPUT && IsSampler(type.getBasicType()))
- {
- HLSLTextureGroup group = TextureGroup(type.getBasicType());
- groupedSamplerUniforms[group].push_back(&uniform);
- }
- else if (outputType == SH_HLSL_4_0_FL9_3_OUTPUT && IsSampler(type.getBasicType()))
- {
- unsigned int registerIndex = assignUniformRegister(type, name.getString(), nullptr);
- outputHLSL4_0_FL9_3Sampler(out, type, name, registerIndex);
- }
- else if (outputType == SH_HLSL_4_1_OUTPUT && IsImage(type.getBasicType()))
- {
- imageUniformsHLSL41Output.push_back(&uniform);
- }
- else
- {
- if (type.isStructureContainingSamplers())
- {
- TVector<TIntermSymbol *> samplerSymbols;
- TMap<TIntermSymbol *, TString> symbolsToAPINames;
- type.createSamplerSymbols("angle_" + name.getString(), name.getString(),
- &samplerSymbols, &symbolsToAPINames, symbolTable);
- for (TIntermSymbol *sampler : samplerSymbols)
- {
- const TType &samplerType = sampler->getType();
-
- // Will use angle_ prefix instead of regular prefix.
- sampler->setInternal(true);
- const TName &samplerName = sampler->getName();
-
- 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, samplerName, registerIndex);
- }
- else
- {
- ASSERT(outputType == SH_HLSL_3_0_OUTPUT);
- unsigned int registerIndex = assignSamplerInStructUniformRegister(
- samplerType, symbolsToAPINames[sampler], nullptr);
- outputUniform(out, samplerType, samplerName, registerIndex);
- }
- }
- }
- unsigned int registerIndex = assignUniformRegister(type, name.getString(), nullptr);
- outputUniform(out, type, name, registerIndex);
- }
- }
-
- if (outputType == SH_HLSL_4_1_OUTPUT)
- {
- unsigned int groupTextureRegisterIndex = 0;
- // 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;
-
- for (const TIntermSymbol *image : imageUniformsHLSL41Output)
- {
- const TType &type = image->getType();
- const TName &name = image->getName();
- unsigned int registerIndex = assignUniformRegister(type, name.getString(), nullptr);
- if (type.getMemoryQualifier().readonly)
- {
- outputHLSL4_1_FL11Texture(out, type, name, registerIndex);
- }
- else
- {
- outputHLSL4_1_FL11RWTexture(out, type, name, registerIndex);
- }
- }
- }
-}
-
-void UniformHLSL::samplerMetadataUniforms(TInfoSinkBase &out, const char *reg)
-{
- // 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"
- " };\n"
- " SamplerMetadata samplerMetadata["
- << mSamplerCount << "] : packoffset(" << reg << ");\n";
- }
-}
-
-TString UniformHLSL::uniformBlocksHeader(const ReferencedSymbols &referencedInterfaceBlocks)
-{
- TString interfaceBlocks;
-
- for (ReferencedSymbols::const_iterator interfaceBlockIt = referencedInterfaceBlocks.begin();
- interfaceBlockIt != referencedInterfaceBlocks.end(); interfaceBlockIt++)
- {
- const TType &nodeType = interfaceBlockIt->second->getType();
- const TInterfaceBlock &interfaceBlock = *nodeType.getInterfaceBlock();
-
- // nodeType.isInterfaceBlock() == false means the node is a field of a uniform block which
- // doesn't have instance name, so this block cannot be an array.
- unsigned int interfaceBlockArraySize = 0u;
- if (nodeType.isInterfaceBlock() && nodeType.isArray())
- {
- interfaceBlockArraySize = nodeType.getOutermostArraySize();
- }
- unsigned int activeRegister = mUniformBlockRegister;
-
- mUniformBlockRegisterMap[interfaceBlock.name().c_str()] = activeRegister;
- mUniformBlockRegister += std::max(1u, interfaceBlockArraySize);
-
- // FIXME: interface block field names
-
- if (interfaceBlock.hasInstanceName())
- {
- interfaceBlocks += uniformBlockStructString(interfaceBlock);
- }
-
- if (interfaceBlockArraySize > 0)
- {
- for (unsigned int arrayIndex = 0; arrayIndex < interfaceBlockArraySize; arrayIndex++)
- {
- interfaceBlocks +=
- uniformBlockString(interfaceBlock, activeRegister + arrayIndex, arrayIndex);
- }
- }
- else
- {
- interfaceBlocks += uniformBlockString(interfaceBlock, activeRegister, GL_INVALID_INDEX);
- }
- }
-
- return (interfaceBlocks.empty() ? "" : ("// Uniform Blocks\n\n" + interfaceBlocks));
-}
-
-TString UniformHLSL::uniformBlockString(const TInterfaceBlock &interfaceBlock,
- unsigned int registerIndex,
- unsigned int arrayIndex)
-{
- const TString &arrayIndexString =
- (arrayIndex != GL_INVALID_INDEX ? Decorate(str(arrayIndex)) : "");
- const TString &blockName = interfaceBlock.name() + arrayIndexString;
- TString hlsl;
-
- hlsl += "cbuffer " + blockName + " : register(b" + str(registerIndex) +
- ")\n"
- "{\n";
-
- if (interfaceBlock.hasInstanceName())
- {
- hlsl += " " + InterfaceBlockStructName(interfaceBlock) + " " +
- uniformBlockInstanceString(interfaceBlock, arrayIndex) + ";\n";
- }
- else
- {
- const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
- hlsl += uniformBlockMembersString(interfaceBlock, blockStorage);
- }
-
- hlsl += "};\n\n";
-
- return hlsl;
-}
-
-TString UniformHLSL::uniformBlockInstanceString(const TInterfaceBlock &interfaceBlock,
- unsigned int arrayIndex)
-{
- if (!interfaceBlock.hasInstanceName())
- {
- return "";
- }
- else if (arrayIndex != GL_INVALID_INDEX)
- {
- return DecoratePrivate(interfaceBlock.instanceName()) + "_" + str(arrayIndex);
- }
- else
- {
- return Decorate(interfaceBlock.instanceName());
- }
-}
-
-TString UniformHLSL::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) + ";\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 UniformHLSL::uniformBlockStructString(const TInterfaceBlock &interfaceBlock)
-{
- const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
-
- return "struct " + InterfaceBlockStructName(interfaceBlock) +
- "\n"
- "{\n" +
- uniformBlockMembersString(interfaceBlock, blockStorage) + "};\n\n";
-}
-}
diff --git a/src/3rdparty/angle/src/compiler/translator/UniformHLSL.h b/src/3rdparty/angle/src/compiler/translator/UniformHLSL.h
deleted file mode 100644
index 8784e50533..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/UniformHLSL.h
+++ /dev/null
@@ -1,110 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// UniformHLSL.h:
-// Methods for GLSL to HLSL translation for uniforms and uniform blocks.
-//
-
-#ifndef COMPILER_TRANSLATOR_UNIFORMHLSL_H_
-#define COMPILER_TRANSLATOR_UNIFORMHLSL_H_
-
-#include "compiler/translator/OutputHLSL.h"
-#include "compiler/translator/UtilsHLSL.h"
-
-namespace sh
-{
-class StructureHLSL;
-class TSymbolTable;
-
-class UniformHLSL : angle::NonCopyable
-{
- public:
- UniformHLSL(sh::GLenum shaderType,
- StructureHLSL *structureHLSL,
- ShShaderOutput outputType,
- const std::vector<Uniform> &uniforms);
-
- void reserveUniformRegisters(unsigned int registerCount);
- void reserveUniformBlockRegisters(unsigned int registerCount);
- void uniformsHeader(TInfoSinkBase &out,
- ShShaderOutput outputType,
- const ReferencedSymbols &referencedUniforms,
- TSymbolTable *symbolTable);
-
- // Must be called after uniformsHeader
- void samplerMetadataUniforms(TInfoSinkBase &out, const char *reg);
-
- TString uniformBlocksHeader(const ReferencedSymbols &referencedInterfaceBlocks);
-
- // Used for direct index references
- static TString uniformBlockInstanceString(const TInterfaceBlock &interfaceBlock,
- unsigned int arrayIndex);
-
- const std::map<std::string, unsigned int> &getUniformBlockRegisterMap() const
- {
- return mUniformBlockRegisterMap;
- }
- const std::map<std::string, unsigned int> &getUniformRegisterMap() const
- {
- return mUniformRegisterMap;
- }
-
- private:
- TString uniformBlockString(const TInterfaceBlock &interfaceBlock,
- unsigned int registerIndex,
- unsigned int arrayIndex);
- TString uniformBlockMembersString(const TInterfaceBlock &interfaceBlock,
- TLayoutBlockStorage blockStorage);
- TString uniformBlockStructString(const TInterfaceBlock &interfaceBlock);
- const Uniform *findUniformByName(const TString &name) const;
-
- void outputHLSL4_0_FL9_3Sampler(TInfoSinkBase &out,
- const TType &type,
- const TName &name,
- const unsigned int registerIndex);
- void outputHLSL4_1_FL11Texture(TInfoSinkBase &out,
- const TType &type,
- const TName &name,
- const unsigned int registerIndex);
- void outputHLSL4_1_FL11RWTexture(TInfoSinkBase &out,
- const TType &type,
- const TName &name,
- const unsigned int registerIndex);
- void outputUniform(TInfoSinkBase &out,
- const TType &type,
- const TName &name,
- const unsigned int registerIndex);
-
- // Returns the uniform's register index
- unsigned int assignUniformRegister(const TType &type,
- const TString &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 TIntermSymbol *> &group,
- const TMap<const TIntermSymbol *, TString> &samplerInStructSymbolsToAPINames,
- unsigned int *groupTextureRegisterIndex);
-
- unsigned int mUniformRegister;
- unsigned int mUniformBlockRegister;
- unsigned int mTextureRegister;
- unsigned int mRWTextureRegister;
- unsigned int mSamplerCount;
- sh::GLenum mShaderType;
- StructureHLSL *mStructureHLSL;
- ShShaderOutput mOutputType;
-
- const std::vector<Uniform> &mUniforms;
- std::map<std::string, unsigned int> mUniformBlockRegisterMap;
- std::map<std::string, unsigned int> mUniformRegisterMap;
-};
-}
-
-#endif // COMPILER_TRANSLATOR_UNIFORMHLSL_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/UseInterfaceBlockFields.cpp b/src/3rdparty/angle/src/compiler/translator/UseInterfaceBlockFields.cpp
deleted file mode 100644
index 40bd42afad..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/UseInterfaceBlockFields.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// 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/UseInterfaceBlockFields.h"
-
-#include "compiler/translator/FindMain.h"
-#include "compiler/translator/IntermNode.h"
-#include "compiler/translator/IntermNode_util.h"
-#include "compiler/translator/SymbolTable.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)
-{
- TString name = TString(var.name.c_str());
- ASSERT(name.find_last_of('[') == TString::npos);
- TIntermSymbol *symbol = ReferenceGlobalVariable(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)
- {
- TString name(block.instanceName.c_str());
- TIntermSymbol *arraySymbol = ReferenceGlobalVariable(name, symbolTable);
- for (unsigned int i = 0u; i < block.arraySize; ++i)
- {
- TIntermBinary *elementSymbol =
- new TIntermBinary(EOpIndexDirect, arraySymbol->deepCopy(), CreateIndexNode(i));
- InsertUseCode(block, elementSymbol, sequence);
- }
- }
- else
- {
- TString name(block.instanceName.c_str());
- TIntermSymbol *blockSymbol = ReferenceGlobalVariable(name, symbolTable);
- InsertUseCode(block, blockSymbol, sequence);
- }
- }
-}
-
-} // namespace anonymous
-
-void UseInterfaceBlockFields(TIntermBlock *root,
- const InterfaceBlockList &blocks,
- const TSymbolTable &symbolTable)
-{
- TIntermBlock *mainBody = FindMainBody(root);
- InsertUseCode(mainBody->getSequence(), blocks, symbolTable);
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/UseInterfaceBlockFields.h b/src/3rdparty/angle/src/compiler/translator/UseInterfaceBlockFields.h
deleted file mode 100644
index 3e2a4815d4..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/UseInterfaceBlockFields.h
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// 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_USEINTERFACEBLOCKFIELDS_H_
-#define COMPILER_TRANSLATOR_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_USEINTERFACEBLOCKFIELDS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/UtilsHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/UtilsHLSL.cpp
deleted file mode 100644
index 8a77f0049a..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/UtilsHLSL.cpp
+++ /dev/null
@@ -1,970 +0,0 @@
-//
-// 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"
-
-namespace sh
-{
-
-TString SamplerString(const TBasicType type)
-{
- if (IsShadowSampler(type))
- {
- return "SamplerComparisonState";
- }
- else
- {
- return "SamplerState";
- }
-}
-
-TString 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 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 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 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();
- }
- }
- case EbtIImage2D:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32I:
- case EiifRGBA16I:
- case EiifRGBA8I:
- case EiifR32I:
- return HLSL_TEXTURE_2D_INT4;
- default:
- UNREACHABLE();
- }
- }
- case EbtUImage2D:
- {
- switch (imageInternalFormat)
- {
-
- case EiifRGBA32UI:
- case EiifRGBA16UI:
- case EiifRGBA8UI:
- case EiifR32UI:
- return HLSL_TEXTURE_2D_UINT4;
- default:
- UNREACHABLE();
- }
- }
- 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();
- }
- }
- case EbtIImage3D:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32I:
- case EiifRGBA16I:
- case EiifRGBA8I:
- case EiifR32I:
- return HLSL_TEXTURE_3D_INT4;
- default:
- UNREACHABLE();
- }
- }
- case EbtUImage3D:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32UI:
- case EiifRGBA16UI:
- case EiifRGBA8UI:
- case EiifR32UI:
- return HLSL_TEXTURE_3D_UINT4;
- default:
- UNREACHABLE();
- }
- }
- 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();
- }
- }
- case EbtIImage2DArray:
- case EbtIImageCube:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32I:
- case EiifRGBA16I:
- case EiifRGBA8I:
- case EiifR32I:
- return HLSL_TEXTURE_2D_ARRAY_INT4;
- default:
- UNREACHABLE();
- }
- }
- case EbtUImage2DArray:
- case EbtUImageCube:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32UI:
- case EiifRGBA16UI:
- case EiifRGBA8UI:
- case EiifR32UI:
- return HLSL_TEXTURE_2D_ARRAY_UINT4;
- default:
- UNREACHABLE();
- }
- }
- default:
- UNREACHABLE();
- }
- return HLSL_TEXTURE_UNKNOWN;
-}
-
-TString 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_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_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_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>";
-}
-
-TString TextureString(const TBasicType type, TLayoutImageInternalFormat imageInternalFormat)
-{
- return TextureString(TextureGroup(type, imageInternalFormat));
-}
-
-TString 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_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_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_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>";
-}
-
-TString TextureGroupSuffix(const TBasicType type, TLayoutImageInternalFormat imageInternalFormat)
-{
- return TextureGroupSuffix(TextureGroup(type, imageInternalFormat));
-}
-
-TString 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();
- }
- }
- case EbtIImageCube:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32I:
- case EiifRGBA16I:
- case EiifRGBA8I:
- case EiifR32I:
- return "Cube_int4_";
- default:
- UNREACHABLE();
- }
- }
- case EbtUImageCube:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32UI:
- case EiifRGBA16UI:
- case EiifRGBA8UI:
- case EiifR32UI:
- return "Cube_uint4_";
- default:
- UNREACHABLE();
- }
- }
- default:
- // All other types are identified by their group suffix
- return TextureGroupSuffix(type, imageInternalFormat);
- }
-}
-
-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();
- }
- }
- case EbtIImage2D:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32I:
- case EiifRGBA16I:
- case EiifRGBA8I:
- case EiifR32I:
- return HLSL_RWTEXTURE_2D_INT4;
- default:
- UNREACHABLE();
- }
- }
- case EbtUImage2D:
- {
- switch (imageInternalFormat)
- {
-
- case EiifRGBA32UI:
- case EiifRGBA16UI:
- case EiifRGBA8UI:
- case EiifR32UI:
- return HLSL_RWTEXTURE_2D_UINT4;
- default:
- UNREACHABLE();
- }
- }
- 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();
- }
- }
- case EbtIImage3D:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32I:
- case EiifRGBA16I:
- case EiifRGBA8I:
- case EiifR32I:
- return HLSL_RWTEXTURE_3D_INT4;
- default:
- UNREACHABLE();
- }
- }
- case EbtUImage3D:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32UI:
- case EiifRGBA16UI:
- case EiifRGBA8UI:
- case EiifR32UI:
- return HLSL_RWTEXTURE_3D_UINT4;
- default:
- UNREACHABLE();
- }
- }
- 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();
- }
- }
- case EbtIImage2DArray:
- case EbtIImageCube:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32I:
- case EiifRGBA16I:
- case EiifRGBA8I:
- case EiifR32I:
- return HLSL_RWTEXTURE_2D_ARRAY_INT4;
- default:
- UNREACHABLE();
- }
- }
- case EbtUImage2DArray:
- case EbtUImageCube:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32UI:
- case EiifRGBA16UI:
- case EiifRGBA8UI:
- case EiifR32UI:
- return HLSL_RWTEXTURE_2D_ARRAY_UINT4;
- default:
- UNREACHABLE();
- }
- }
- default:
- UNREACHABLE();
- }
- return HLSL_RWTEXTURE_UNKNOWN;
-}
-
-TString 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>";
-}
-
-TString RWTextureString(const TBasicType type, TLayoutImageInternalFormat imageInternalFormat)
-{
- return RWTextureString(RWTextureGroup(type, imageInternalFormat));
-}
-
-TString 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>";
-}
-
-TString RWTextureGroupSuffix(const TBasicType type, TLayoutImageInternalFormat imageInternalFormat)
-{
- return RWTextureGroupSuffix(RWTextureGroup(type, imageInternalFormat));
-}
-
-TString 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();
- }
- }
- case EbtIImageCube:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32I:
- case EiifRGBA16I:
- case EiifRGBA8I:
- case EiifR32I:
- return "RWCube_int4_";
- default:
- UNREACHABLE();
- }
- }
- case EbtUImageCube:
- {
- switch (imageInternalFormat)
- {
- case EiifRGBA32UI:
- case EiifRGBA16UI:
- case EiifRGBA8UI:
- case EiifR32UI:
- return "RWCube_uint4_";
- default:
- UNREACHABLE();
- }
- }
- default:
- // All other types are identified by their group suffix
- return TextureGroupSuffix(type, imageInternalFormat);
- }
-}
-
-TString DecorateField(const TString &string, const TStructure &structure)
-{
- if (structure.name().compare(0, 3, "gl_") != 0)
- {
- return Decorate(string);
- }
-
- return string;
-}
-
-TString DecoratePrivate(const TString &privateText)
-{
- return "dx_" + privateText;
-}
-
-TString Decorate(const TString &string)
-{
- if (string.compare(0, 3, "gl_") != 0)
- {
- return "_" + string;
- }
-
- return string;
-}
-
-TString DecorateVariableIfNeeded(const TName &name)
-{
- if (name.isInternal())
- {
- // The name should not have a prefix reserved for user-defined variables or functions.
- ASSERT(name.getString().compare(0, 2, "f_") != 0);
- ASSERT(name.getString().compare(0, 1, "_") != 0);
- return name.getString();
- }
- else
- {
- return Decorate(name.getString());
- }
-}
-
-TString DecorateFunctionIfNeeded(const TName &name)
-{
- if (name.isInternal())
- {
- // The name should not have a prefix reserved for user-defined variables or functions.
- ASSERT(name.getString().compare(0, 2, "f_") != 0);
- ASSERT(name.getString().compare(0, 1, "_") != 0);
- return name.getString();
- }
- ASSERT(name.getString().compare(0, 3, "gl_") != 0);
- // 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_" + name.getString();
-}
-
-TString TypeString(const TType &type)
-{
- const TStructure *structure = type.getStruct();
- if (structure)
- {
- const TString &typeName = structure->name();
- if (typeName != "")
- {
- 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:
- return "atomic_uint";
- default:
- break;
- }
- }
-
- UNREACHABLE();
- return "<unknown type>";
-}
-
-TString StructNameString(const TStructure &structure)
-{
- if (structure.name().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()) + "_" + structure.name();
-}
-
-TString QualifiedStructNameString(const TStructure &structure,
- bool useHLSLRowMajorPacking,
- bool useStd140Packing)
-{
- if (structure.name() == "")
- {
- return "";
- }
-
- TString prefix = "";
-
- // Structs packed with row-major matrices in HLSL are prefixed with "rm"
- // GLSL column-major maps to HLSL row-major, and the converse is true
-
- if (useStd140Packing)
- {
- prefix += "std_";
- }
-
- if (useHLSLRowMajorPacking)
- {
- prefix += "rm_";
- }
-
- return prefix + StructNameString(structure);
-}
-
-TString 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 "";
-}
-
-TString 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 TIntermSequence *parameters)
-{
- TString disambiguatingString;
- for (auto parameter : *parameters)
- {
- const TType &paramType = parameter->getAsTyped()->getType();
- // 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.
- disambiguatingString += "_" + 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()->name() != "");
- disambiguatingString += "_" + TypeString(paramType);
- }
- }
- return disambiguatingString;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/UtilsHLSL.h b/src/3rdparty/angle/src/compiler/translator/UtilsHLSL.h
deleted file mode 100644
index daeec8de41..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/UtilsHLSL.h
+++ /dev/null
@@ -1,129 +0,0 @@
-//
-// 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"
-
-class TName;
-
-namespace sh
-{
-
-// 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_INT4,
- HLSL_TEXTURE_3D_INT4,
- HLSL_TEXTURE_2D_ARRAY_INT4,
- HLSL_TEXTURE_2D_MS_INT4,
- HLSL_TEXTURE_2D_UINT4,
- HLSL_TEXTURE_3D_UINT4,
- HLSL_TEXTURE_2D_ARRAY_UINT4,
- HLSL_TEXTURE_2D_MS_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);
-TString TextureString(const HLSLTextureGroup textureGroup);
-TString TextureString(const TBasicType type,
- TLayoutImageInternalFormat imageInternalFormat = EiifUnspecified);
-TString TextureGroupSuffix(const HLSLTextureGroup type);
-TString TextureGroupSuffix(const TBasicType type,
- TLayoutImageInternalFormat imageInternalFormat = EiifUnspecified);
-TString TextureTypeSuffix(const TBasicType type,
- TLayoutImageInternalFormat imageInternalFormat = EiifUnspecified);
-HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
- TLayoutImageInternalFormat imageInternalFormat);
-TString RWTextureString(const HLSLRWTextureGroup textureGroup);
-TString RWTextureString(const TBasicType type, TLayoutImageInternalFormat imageInternalFormat);
-TString RWTextureGroupSuffix(const HLSLRWTextureGroup type);
-TString RWTextureGroupSuffix(const TBasicType type, TLayoutImageInternalFormat imageInternalFormat);
-TString RWTextureTypeSuffix(const TBasicType type, TLayoutImageInternalFormat imageInternalFormat);
-
-TString SamplerString(const TBasicType type);
-TString SamplerString(HLSLTextureGroup type);
-
-// Adds a prefix to user-defined names to avoid naming clashes.
-TString Decorate(const TString &string);
-TString DecorateVariableIfNeeded(const TName &name);
-TString DecorateFunctionIfNeeded(const TName &name);
-TString DecorateField(const TString &string, const TStructure &structure);
-TString DecoratePrivate(const TString &privateText);
-TString TypeString(const TType &type);
-TString StructNameString(const TStructure &structure);
-TString QualifiedStructNameString(const TStructure &structure,
- bool useHLSLRowMajorPacking,
- bool useStd140Packing);
-TString InterpolationString(TQualifier qualifier);
-TString QualifierString(TQualifier qualifier);
-// Parameters may need to be included in function names to disambiguate between overloaded
-// functions.
-TString DisambiguateFunctionName(const TIntermSequence *parameters);
-}
-
-#endif // COMPILER_TRANSLATOR_UTILSHLSL_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/ValidateGlobalInitializer.cpp b/src/3rdparty/angle/src/compiler/translator/ValidateGlobalInitializer.cpp
deleted file mode 100644
index 492972b60d..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ValidateGlobalInitializer.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// 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/IntermTraverse.h"
-#include "compiler/translator/ParseContext.h"
-
-namespace sh
-{
-
-namespace
-{
-
-class ValidateGlobalInitializerTraverser : public TIntermTraverser
-{
- public:
- ValidateGlobalInitializerTraverser(const TParseContext *context);
-
- void visitSymbol(TIntermSymbol *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; }
- bool issueWarning() const { return mIssueWarning; }
-
- private:
- const TParseContext *mContext;
- bool mIsValid;
- bool mIssueWarning;
-};
-
-void ValidateGlobalInitializerTraverser::visitSymbol(TIntermSymbol *node)
-{
- const TSymbol *sym =
- mContext->symbolTable.find(node->getSymbol(), mContext->getShaderVersion());
- if (sym->isVariable())
- {
- // ESSL 1.00 section 4.3 (or ESSL 3.00 section 4.3):
- // Global initializers must be constant expressions.
- const TVariable *var = static_cast<const TVariable *>(sym);
- switch (var->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 (mContext->getShaderVersion() >= 300)
- {
- mIsValid = false;
- }
- else
- {
- mIssueWarning = true;
- }
- break;
- default:
- mIsValid = false;
- }
- }
-}
-
-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(const TParseContext *context)
- : TIntermTraverser(true, false, false), mContext(context), mIsValid(true), mIssueWarning(false)
-{
-}
-
-} // namespace
-
-bool ValidateGlobalInitializer(TIntermTyped *initializer,
- const TParseContext *context,
- bool *warning)
-{
- ValidateGlobalInitializerTraverser validate(context);
- initializer->traverse(&validate);
- ASSERT(warning != nullptr);
- *warning = validate.issueWarning();
- return validate.isValid();
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/ValidateGlobalInitializer.h b/src/3rdparty/angle/src/compiler/translator/ValidateGlobalInitializer.h
deleted file mode 100644
index 2e7570667a..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ValidateGlobalInitializer.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// 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;
-class TParseContext;
-
-// Returns true if the initializer is valid.
-bool ValidateGlobalInitializer(TIntermTyped *initializer,
- const TParseContext *context,
- bool *warning);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_VALIDATEGLOBALINITIALIZER_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.cpp b/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.cpp
deleted file mode 100644
index 941f79ae51..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.cpp
+++ /dev/null
@@ -1,444 +0,0 @@
-//
-// 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/IntermTraverse.h"
-#include "compiler/translator/ParseContext.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->getId();
-}
-
-// 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->getId()) != 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,
- int shaderVersion,
- 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);
-
- bool withinLoopBody() const;
- 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,
- int shaderVersion,
- TDiagnostics *diagnostics)
- : TLValueTrackingTraverser(true, false, false, symbolTable, shaderVersion),
- 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->getSymbol().c_str());
- }
-}
-
-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);
-}
-
-bool ValidateLimitationsTraverser::withinLoopBody() const
-{
- return !mLoopSymbolIds.empty();
-}
-
-bool ValidateLimitationsTraverser::isLoopIndex(TIntermSymbol *symbol)
-{
- return std::find(mLoopSymbolIds.begin(), mLoopSymbolIds.end(), symbol->getId()) !=
- 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->getSymbol().c_str());
- return -1;
- }
-
- return symbol->getId();
-}
-
-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->getId() != indexSymbolId)
- {
- error(symbol->getLine(), "Expected loop index", symbol->getSymbol().c_str());
- 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->getSymbol().c_str());
- 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->getId() != indexSymbolId)
- {
- error(symbol->getLine(), "Expected loop index", symbol->getSymbol().c_str());
- 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->getSymbol().c_str());
- 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 anonymous
-
-bool ValidateLimitations(TIntermNode *root,
- GLenum shaderType,
- TSymbolTable *symbolTable,
- int shaderVersion,
- TDiagnostics *diagnostics)
-{
- ValidateLimitationsTraverser validate(shaderType, symbolTable, shaderVersion, diagnostics);
- root->traverse(&validate);
- return diagnostics->numErrors() == 0;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h b/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h
deleted file mode 100644
index 9149b8c216..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// 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,
- int shaderVersion,
- TDiagnostics *diagnostics);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_VALIDATELIMITATIONS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/ValidateMaxParameters.cpp b/src/3rdparty/angle/src/compiler/translator/ValidateMaxParameters.cpp
deleted file mode 100644
index 9dccbf413f..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ValidateMaxParameters.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// 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"
-
-namespace sh
-{
-
-bool ValidateMaxParameters(TIntermBlock *root, unsigned int maxParameters)
-{
- for (TIntermNode *node : *root->getSequence())
- {
- TIntermFunctionDefinition *definition = node->getAsFunctionDefinition();
- if (definition != nullptr &&
- definition->getFunctionPrototype()->getSequence()->size() > maxParameters)
- {
- return false;
- }
- }
- return true;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/ValidateMaxParameters.h b/src/3rdparty/angle/src/compiler/translator/ValidateMaxParameters.h
deleted file mode 100644
index dec7597da4..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ValidateMaxParameters.h
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/ValidateOutputs.cpp b/src/3rdparty/angle/src/compiler/translator/ValidateOutputs.cpp
deleted file mode 100644
index 26f0e81ba7..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ValidateOutputs.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-//
-// 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/IntermTraverse.h"
-#include "compiler/translator/ParseContext.h"
-
-namespace sh
-{
-
-namespace
-{
-void error(const TIntermSymbol &symbol, const char *reason, TDiagnostics *diagnostics)
-{
- diagnostics->error(symbol.getLine(), reason, symbol.getSymbol().c_str());
-}
-
-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<std::string> mVisitedSymbols;
-};
-
-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)
-{
- TString name = symbol->getSymbol();
- TQualifier qualifier = symbol->getQualifier();
-
- if (mVisitedSymbols.count(name.c_str()) == 1)
- return;
-
- mVisitedSymbols.insert(name.c_str());
-
- 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);
-
- 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);
-
- if (location + elementCount <= validOutputs.size())
- {
- for (size_t elementIndex = 0; elementIndex < elementCount; elementIndex++)
- {
- const size_t offsetLocation = location + elementIndex;
- if (validOutputs[offsetLocation])
- {
- std::stringstream strstr;
- strstr << "conflicting output locations with previously defined output '"
- << validOutputs[offsetLocation]->getSymbol() << "'";
- error(*symbol, strstr.str().c_str(), diagnostics);
- }
- else
- {
- validOutputs[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/src/3rdparty/angle/src/compiler/translator/ValidateOutputs.h b/src/3rdparty/angle/src/compiler/translator/ValidateOutputs.h
deleted file mode 100644
index e41ccd990c..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ValidateOutputs.h
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/ValidateSwitch.cpp b/src/3rdparty/angle/src/compiler/translator/ValidateSwitch.cpp
deleted file mode 100644
index 9f7a264e58..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ValidateSwitch.cpp
+++ /dev/null
@@ -1,319 +0,0 @@
-//
-// 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/IntermTraverse.h"
-
-namespace sh
-{
-
-namespace
-{
-
-class ValidateSwitch : public TIntermTraverser
-{
- public:
- static bool validate(TBasicType switchType,
- int shaderVersion,
- TDiagnostics *diagnostics,
- TIntermBlock *statementList,
- const TSourceLoc &loc);
-
- void visitSymbol(TIntermSymbol *) override;
- void visitConstantUnion(TIntermConstantUnion *) override;
- bool visitDeclaration(Visit, TIntermDeclaration *) override;
- bool visitBlock(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, int shaderVersion, TDiagnostics *context);
-
- bool validateInternal(const TSourceLoc &loc);
-
- TBasicType mSwitchType;
- int mShaderVersion;
- 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,
- int shaderVersion,
- TDiagnostics *diagnostics,
- TIntermBlock *statementList,
- const TSourceLoc &loc)
-{
- ValidateSwitch validate(switchType, shaderVersion, diagnostics);
- ASSERT(statementList);
- statementList->traverse(&validate);
- return validate.validateInternal(loc);
-}
-
-ValidateSwitch::ValidateSwitch(TBasicType switchType, int shaderVersion, TDiagnostics *diagnostics)
- : TIntermTraverser(true, false, true),
- mSwitchType(switchType),
- mShaderVersion(shaderVersion),
- mDiagnostics(diagnostics),
- mCaseTypeMismatch(false),
- mFirstCaseFound(false),
- mStatementBeforeCase(false),
- mLastStatementWasCase(false),
- mControlFlowDepth(0),
- mCaseInsideControlFlow(false),
- mDefaultCount(0),
- mDuplicateCases(false)
-{
-}
-
-void ValidateSwitch::visitSymbol(TIntermSymbol *)
-{
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
-}
-
-void ValidateSwitch::visitConstantUnion(TIntermConstantUnion *)
-{
- // Conditions of case labels are not traversed, so this is some other constant
- // Could be just a statement like "0;"
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
-}
-
-bool ValidateSwitch::visitDeclaration(Visit, TIntermDeclaration *)
-{
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
- return true;
-}
-
-bool ValidateSwitch::visitBlock(Visit, TIntermBlock *)
-{
- if (getParentNode() != nullptr)
- {
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
- }
- 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");
- }
- bool lastStatementWasCaseError = false;
- if (mLastStatementWasCase)
- {
- if (mShaderVersion == 300)
- {
- lastStatementWasCaseError = true;
- // This error has been proposed to be made optional in GLSL ES 3.00, but dEQP tests
- // still require it.
- mDiagnostics->error(
- loc, "no statement between the last label and the end of the switch statement",
- "switch");
- }
- else
- {
- // The error has been removed from GLSL ES 3.10.
- mDiagnostics->warning(
- loc, "no statement between the last label and the end of the switch statement",
- "switch");
- }
- }
- return !mStatementBeforeCase && !lastStatementWasCaseError && !mCaseInsideControlFlow &&
- !mCaseTypeMismatch && mDefaultCount <= 1 && !mDuplicateCases;
-}
-
-} // anonymous namespace
-
-bool ValidateSwitchStatementList(TBasicType switchType,
- int shaderVersion,
- TDiagnostics *diagnostics,
- TIntermBlock *statementList,
- const TSourceLoc &loc)
-{
- return ValidateSwitch::validate(switchType, shaderVersion, diagnostics, statementList, loc);
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/ValidateSwitch.h b/src/3rdparty/angle/src/compiler/translator/ValidateSwitch.h
deleted file mode 100644
index 2d2dd70f78..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ValidateSwitch.h
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// 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,
- int shaderVersion,
- TDiagnostics *diagnostics,
- TIntermBlock *statementList,
- const TSourceLoc &loc);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_VALIDATESWITCH_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/ValidateVaryingLocations.cpp b/src/3rdparty/angle/src/compiler/translator/ValidateVaryingLocations.cpp
deleted file mode 100644
index 9c36fcea78..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ValidateVaryingLocations.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-//
-// 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/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.getSymbol().c_str());
-}
-
-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_OES_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_OES_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;
- strstr << "'" << varying->getSymbol()
- << "' conflicting location with previously defined '"
- << locationMap[offsetLocation]->getSymbol() << "'";
- 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;
- }
-
- // 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_OES);
- 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/src/3rdparty/angle/src/compiler/translator/ValidateVaryingLocations.h b/src/3rdparty/angle/src/compiler/translator/ValidateVaryingLocations.h
deleted file mode 100644
index 1e53977c68..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/ValidateVaryingLocations.h
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp b/src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp
deleted file mode 100644
index 6dd396ff02..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp
+++ /dev/null
@@ -1,413 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// 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 "compiler/translator/VariablePacker.h"
-#include "common/utilities.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/src/3rdparty/angle/src/compiler/translator/VariablePacker.h b/src/3rdparty/angle/src/compiler/translator/VariablePacker.h
deleted file mode 100644
index 36b2104cd0..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/VariablePacker.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// 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/src/3rdparty/angle/src/compiler/translator/VectorizeVectorScalarArithmetic.cpp b/src/3rdparty/angle/src/compiler/translator/VectorizeVectorScalarArithmetic.cpp
deleted file mode 100644
index 1e79a60991..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/VectorizeVectorScalarArithmetic.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-// 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/VectorizeVectorScalarArithmetic.h"
-
-#include <set>
-
-#include "compiler/translator/IntermNode.h"
-#include "compiler/translator/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);
-
- nextTemporaryId();
- // gvec s0 = gvec(a);
- // s0 is called "tempAssignmentTarget" below.
- TIntermTyped *tempAssignmentTargetInitializer = Vectorize(left->deepCopy(), vecType, nullptr);
- TIntermDeclaration *tempAssignmentTargetDeclaration =
- createTempInitDeclaration(tempAssignmentTargetInitializer);
-
- // s0 *= b
- TOperator compoundAssignmentOp = argBinary->getOp();
- if (compoundAssignmentOp == EOpMulAssign)
- {
- compoundAssignmentOp = EOpVectorTimesScalarAssign;
- }
- TIntermBinary *replacementCompoundAssignment =
- new TIntermBinary(compoundAssignmentOp, createTempSymbol(vecType), right->deepCopy());
-
- // s0.x
- TVector<int> swizzleXOffset;
- swizzleXOffset.push_back(0);
- TIntermSwizzle *tempAssignmentTargetX =
- new TIntermSwizzle(createTempSymbol(vecType), 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
- TIntermBinary *replacementSequence =
- new TIntermBinary(EOpComma, replacementSequenceLeft, createTempSymbol(vecType));
-
- 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/src/3rdparty/angle/src/compiler/translator/VectorizeVectorScalarArithmetic.h b/src/3rdparty/angle/src/compiler/translator/VectorizeVectorScalarArithmetic.h
deleted file mode 100644
index 69f092e039..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/VectorizeVectorScalarArithmetic.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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_VECTORIZEVECTORSCALARARITHMETIC_H_
-#define COMPILER_TRANSLATOR_VECTORIZEVECTORSCALARARITHMETIC_H_
-
-namespace sh
-{
-
-class TIntermBlock;
-class TSymbolTable;
-
-void VectorizeVectorScalarArithmetic(TIntermBlock *root, TSymbolTable *symbolTable);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_VECTORIZEVECTORSCALARARITHMETIC_H_ \ No newline at end of file
diff --git a/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp
deleted file mode 100644
index 81688765b8..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/translator/VersionGLSL.h"
-
-#include "angle_gl.h"
-
-namespace sh
-{
-
-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->getSymbol() == "gl_PointCoord")
- {
- 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;
-}
-
-bool TVersionGLSL::visitFunctionPrototype(Visit, TIntermFunctionPrototype *node)
-{
- const TIntermSequence &params = *(node->getSequence());
- for (TIntermSequence::const_iterator iter = params.begin(); iter != params.end(); ++iter)
- {
- const TIntermTyped *param = (*iter)->getAsTyped();
- if (param->isArray())
- {
- TQualifier qualifier = param->getQualifier();
- if ((qualifier == EvqOut) || (qualifier == EvqInOut))
- {
- ensureVersionIsAtLeast(GLSL_VERSION_120);
- break;
- }
- }
- }
- // Fully processed. No need to visit children.
- return false;
-}
-
-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/src/3rdparty/angle/src/compiler/translator/VersionGLSL.h b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.h
deleted file mode 100644
index 8b82eb9615..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/VersionGLSL.h
+++ /dev/null
@@ -1,76 +0,0 @@
-//
-// 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/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;
- bool visitFunctionPrototype(Visit, 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/src/3rdparty/angle/src/compiler/translator/WrapSwitchStatementsInBlocks.cpp b/src/3rdparty/angle/src/compiler/translator/WrapSwitchStatementsInBlocks.cpp
deleted file mode 100644
index 85a11c998d..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/WrapSwitchStatementsInBlocks.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-//
-// 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/WrapSwitchStatementsInBlocks.h"
-
-#include "compiler/translator/IntermNode.h"
-#include "compiler/translator/IntermTraverse.h"
-
-namespace sh
-{
-
-namespace
-{
-
-class WrapSwitchStatementsInBlocksTraverser : public TIntermTraverser
-{
- public:
- WrapSwitchStatementsInBlocksTraverser() : TIntermTraverser(true, false, false), mDidWrap(false)
- {
- }
-
- bool visitSwitch(Visit visit, TIntermSwitch *node) override;
-
- bool didWrap() const { return mDidWrap; }
-
- private:
- bool mDidWrap;
-};
-
-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());
- }
- 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);
- mDidWrap = true;
-
- // 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.
-bool WrapSwitchStatementsInBlocks(TIntermBlock *root)
-{
- WrapSwitchStatementsInBlocksTraverser traverser;
- root->traverse(&traverser);
- traverser.updateTree();
- return traverser.didWrap();
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/WrapSwitchStatementsInBlocks.h b/src/3rdparty/angle/src/compiler/translator/WrapSwitchStatementsInBlocks.h
deleted file mode 100644
index bc0179926d..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/WrapSwitchStatementsInBlocks.h
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// 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_WRAPSWITCHSTATEMENTSINBLOCKS_H_
-#define COMPILER_TRANSLATOR_WRAPSWITCHSTATEMENTSINBLOCKS_H_
-
-namespace sh
-{
-
-class TIntermBlock;
-
-// Wrap switch statements in the AST into blocks when needed. Returns true if the AST was changed.
-bool WrapSwitchStatementsInBlocks(TIntermBlock *root);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_WRAPSWITCHSTATEMENTSINBLOCKS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/blocklayout.cpp b/src/3rdparty/angle/src/compiler/translator/blocklayout.cpp
deleted file mode 100644
index fd8c450c20..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/blocklayout.cpp
+++ /dev/null
@@ -1,281 +0,0 @@
-//
-// 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"
-
-namespace sh
-{
-
-namespace
-{
-bool IsRowMajorLayout(const InterfaceBlockField &var)
-{
- return var.isRowMajorLayout;
-}
-
-bool IsRowMajorLayout(const ShaderVariable &var)
-{
- return false;
-}
-
-template <typename VarT>
-void GetUniformBlockStructMemberInfo(const std::vector<VarT> &fields,
- const std::string &fieldName,
- sh::BlockLayoutEncoder *encoder,
- bool inRowMajorLayout,
- BlockLayoutMap *blockInfoOut)
-{
- encoder->enterAggregateType();
- GetUniformBlockInfo(fields, fieldName, encoder, inRowMajorLayout, blockInfoOut);
- encoder->exitAggregateType();
-}
-
-template <typename VarT>
-void GetUniformBlockStructArrayMemberInfo(const VarT &field,
- unsigned int arrayNestingIndex,
- const std::string &arrayName,
- sh::BlockLayoutEncoder *encoder,
- bool inRowMajorLayout,
- BlockLayoutMap *blockInfoOut)
-{
- // Nested arrays are processed starting from outermost (arrayNestingIndex 0u) and ending at the
- // innermost.
- const unsigned int currentArraySize = field.getNestedArraySize(arrayNestingIndex);
- for (unsigned int arrayElement = 0u; arrayElement < currentArraySize; ++arrayElement)
- {
- const std::string elementName = arrayName + ArrayString(arrayElement);
- if (arrayNestingIndex + 1u < field.arraySizes.size())
- {
- GetUniformBlockStructArrayMemberInfo(field, arrayNestingIndex + 1u, elementName,
- encoder, inRowMajorLayout, blockInfoOut);
- }
- else
- {
- GetUniformBlockStructMemberInfo(field.fields, elementName, encoder, inRowMajorLayout,
- blockInfoOut);
- }
- }
-}
-
-template <typename VarT>
-void GetUniformBlockArrayOfArraysMemberInfo(const VarT &field,
- unsigned int arrayNestingIndex,
- const std::string &arrayName,
- sh::BlockLayoutEncoder *encoder,
- bool inRowMajorLayout,
- BlockLayoutMap *blockInfoOut)
-{
- const unsigned int currentArraySize = field.getNestedArraySize(arrayNestingIndex);
- for (unsigned int arrayElement = 0u; arrayElement < currentArraySize; ++arrayElement)
- {
- const std::string elementName = arrayName + ArrayString(arrayElement);
- if (arrayNestingIndex + 2u < field.arraySizes.size())
- {
- GetUniformBlockArrayOfArraysMemberInfo(field, arrayNestingIndex + 1u, elementName,
- encoder, inRowMajorLayout, blockInfoOut);
- }
- else
- {
- std::vector<unsigned int> innermostArraySize(
- 1u, field.getNestedArraySize(arrayNestingIndex + 1u));
- (*blockInfoOut)[elementName] =
- encoder->encodeType(field.type, innermostArraySize, inRowMajorLayout);
- }
- }
-}
-
-} // anonymous namespace
-
-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 * BytesPerComponent),
- static_cast<int>(arrayStride * BytesPerComponent),
- static_cast<int>(matrixStride * BytesPerComponent),
- isRowMajorMatrix);
-
- advanceOffset(type, arraySizes, isRowMajorMatrix, arrayStride, matrixStride);
-
- return memberInfo;
-}
-
-// static
-size_t BlockLayoutEncoder::getBlockRegister(const BlockMemberInfo &info)
-{
- return (info.offset / BytesPerComponent) / ComponentsPerRegister;
-}
-
-// static
-size_t BlockLayoutEncoder::getBlockRegisterElement(const BlockMemberInfo &info)
-{
- return (info.offset / BytesPerComponent) % ComponentsPerRegister;
-}
-
-void BlockLayoutEncoder::nextRegister()
-{
- mCurrentOffset = rx::roundUp<size_t>(mCurrentOffset, ComponentsPerRegister);
-}
-
-Std140BlockEncoder::Std140BlockEncoder()
-{
-}
-
-void Std140BlockEncoder::enterAggregateType()
-{
- nextRegister();
-}
-
-void Std140BlockEncoder::exitAggregateType()
-{
- nextRegister();
-}
-
-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)) == BytesPerComponent);
-
- size_t baseAlignment = 0;
- int matrixStride = 0;
- int arrayStride = 0;
-
- if (gl::IsMatrixType(type))
- {
- baseAlignment = ComponentsPerRegister;
- matrixStride = ComponentsPerRegister;
-
- if (!arraySizes.empty())
- {
- const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
- arrayStride = ComponentsPerRegister * numRegisters;
- }
- }
- else if (!arraySizes.empty())
- {
- baseAlignment = ComponentsPerRegister;
- arrayStride = ComponentsPerRegister;
- }
- else
- {
- const int numComponents = gl::VariableComponentCount(type);
- baseAlignment = (numComponents == 3 ? 4u : static_cast<size_t>(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))
- {
- ASSERT(matrixStride == ComponentsPerRegister);
- const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
- mCurrentOffset += ComponentsPerRegister * numRegisters;
- }
- else
- {
- mCurrentOffset += gl::VariableComponentCount(type);
- }
-}
-
-template <typename VarT>
-void GetUniformBlockInfo(const std::vector<VarT> &fields,
- const std::string &prefix,
- sh::BlockLayoutEncoder *encoder,
- bool inRowMajorLayout,
- BlockLayoutMap *blockInfoOut)
-{
- for (const VarT &field : fields)
- {
- // Skip samplers. On Vulkan we use this for the default uniform block, so samplers may be
- // included.
- if (gl::IsSamplerType(field.type))
- {
- continue;
- }
-
- const std::string &fieldName = (prefix.empty() ? field.name : prefix + "." + field.name);
-
- if (field.isStruct())
- {
- bool rowMajorLayout = (inRowMajorLayout || IsRowMajorLayout(field));
-
- if (field.isArray())
- {
- GetUniformBlockStructArrayMemberInfo(field, 0u, fieldName, encoder, rowMajorLayout,
- blockInfoOut);
- }
- else
- {
- GetUniformBlockStructMemberInfo(field.fields, fieldName, encoder, rowMajorLayout,
- blockInfoOut);
- }
- }
- else if (field.isArrayOfArrays())
- {
- bool isRowMajorMatrix = (gl::IsMatrixType(field.type) && inRowMajorLayout);
- GetUniformBlockArrayOfArraysMemberInfo(field, 0u, fieldName, encoder, isRowMajorMatrix,
- blockInfoOut);
- }
- else
- {
- bool isRowMajorMatrix = (gl::IsMatrixType(field.type) && inRowMajorLayout);
- (*blockInfoOut)[fieldName] =
- encoder->encodeType(field.type, field.arraySizes, isRowMajorMatrix);
- }
- }
-}
-
-template void GetUniformBlockInfo(const std::vector<InterfaceBlockField> &,
- const std::string &,
- sh::BlockLayoutEncoder *,
- bool,
- BlockLayoutMap *);
-
-template void GetUniformBlockInfo(const std::vector<Uniform> &,
- const std::string &,
- sh::BlockLayoutEncoder *,
- bool,
- BlockLayoutMap *);
-
-template void GetUniformBlockInfo(const std::vector<ShaderVariable> &,
- const std::string &,
- sh::BlockLayoutEncoder *,
- bool,
- BlockLayoutMap *);
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/blocklayout.h b/src/3rdparty/angle/src/compiler/translator/blocklayout.h
deleted file mode 100644
index 2b7acf4e60..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/blocklayout.h
+++ /dev/null
@@ -1,144 +0,0 @@
-//
-// 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 "angle_gl.h"
-#include <GLSLANG/ShaderLang.h>
-
-namespace sh
-{
-struct ShaderVariable;
-struct InterfaceBlockField;
-struct Uniform;
-struct Varying;
-struct InterfaceBlock;
-
-struct BlockMemberInfo
-{
- BlockMemberInfo()
- : offset(-1),
- arrayStride(-1),
- matrixStride(-1),
- isRowMajorMatrix(false),
- topLevelArrayStride(-1)
- {
- }
-
- BlockMemberInfo(int offset, int arrayStride, int matrixStride, bool isRowMajorMatrix)
- : offset(offset),
- arrayStride(arrayStride),
- matrixStride(matrixStride),
- isRowMajorMatrix(isRowMajorMatrix),
- topLevelArrayStride(-1)
- {
- }
-
- BlockMemberInfo(int offset,
- int arrayStride,
- int matrixStride,
- bool isRowMajorMatrix,
- int topLevelArrayStride)
- : offset(offset),
- arrayStride(arrayStride),
- matrixStride(matrixStride),
- isRowMajorMatrix(isRowMajorMatrix),
- topLevelArrayStride(topLevelArrayStride)
- {
- }
-
- static BlockMemberInfo getDefaultBlockInfo() { return BlockMemberInfo(-1, -1, -1, false, -1); }
-
- int offset;
- int arrayStride;
- int matrixStride;
- bool isRowMajorMatrix;
- int topLevelArrayStride; // Only used for shader storage block members.
-};
-
-class BlockLayoutEncoder
-{
- public:
- BlockLayoutEncoder();
- virtual ~BlockLayoutEncoder() {}
-
- BlockMemberInfo encodeType(GLenum type,
- const std::vector<unsigned int> &arraySizes,
- bool isRowMajorMatrix);
-
- size_t getBlockSize() const { return mCurrentOffset * BytesPerComponent; }
-
- virtual void enterAggregateType() = 0;
- virtual void exitAggregateType() = 0;
-
- static const size_t BytesPerComponent = 4u;
- static const unsigned int ComponentsPerRegister = 4u;
-
- static size_t getBlockRegister(const BlockMemberInfo &info);
- static size_t getBlockRegisterElement(const BlockMemberInfo &info);
-
- protected:
- size_t mCurrentOffset;
-
- void nextRegister();
-
- 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;
-};
-
-// 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() override;
- void exitAggregateType() 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;
-};
-
-using BlockLayoutMap = std::map<std::string, BlockMemberInfo>;
-
-// Only valid to call with ShaderVariable, InterfaceBlockField and Uniform.
-template <typename VarT>
-void GetUniformBlockInfo(const std::vector<VarT> &fields,
- const std::string &prefix,
- sh::BlockLayoutEncoder *encoder,
- bool inRowMajorLayout,
- BlockLayoutMap *blockLayoutMap);
-
-} // namespace sh
-
-#endif // COMMON_BLOCKLAYOUT_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/blocklayoutHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/blocklayoutHLSL.cpp
deleted file mode 100644
index 867821f1ea..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/blocklayoutHLSL.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-//
-// 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()
-{
- nextRegister();
-}
-
-void HLSLBlockEncoder::exitAggregateType()
-{
-}
-
-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)) == BytesPerComponent);
-
- int matrixStride = 0;
- int arrayStride = 0;
-
- // if variables are not to be packed, or we're about to
- // pack a matrix or array, skip to the start of the next
- // register
- if (!isPacked() || gl::IsMatrixType(type) || !arraySizes.empty())
- {
- nextRegister();
- }
-
- if (gl::IsMatrixType(type))
- {
- matrixStride = ComponentsPerRegister;
-
- if (!arraySizes.empty())
- {
- const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
- arrayStride = ComponentsPerRegister * numRegisters;
- }
- }
- else if (!arraySizes.empty())
- {
- arrayStride = ComponentsPerRegister;
- }
- else if (isPacked())
- {
- int numComponents = gl::VariableComponentCount(type);
- if ((numComponents + (mCurrentOffset % ComponentsPerRegister)) > ComponentsPerRegister)
- {
- nextRegister();
- }
- }
-
- *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())
- {
- mCurrentOffset += arrayStride * (gl::ArraySizeProduct(arraySizes) - 1);
- }
-
- if (gl::IsMatrixType(type))
- {
- ASSERT(matrixStride == ComponentsPerRegister);
- const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
- const int numComponents = gl::MatrixComponentCount(type, isRowMajorMatrix);
- mCurrentOffset += ComponentsPerRegister * (numRegisters - 1);
- mCurrentOffset += numComponents;
- }
- else if (isPacked())
- {
- mCurrentOffset += gl::VariableComponentCount(type);
- }
- else
- {
- mCurrentOffset += ComponentsPerRegister;
- }
-}
-
-void HLSLBlockEncoder::skipRegisters(unsigned int numRegisters)
-{
- mCurrentOffset += (numRegisters * ComponentsPerRegister);
-}
-
-HLSLBlockEncoder::HLSLBlockEncoderStrategy HLSLBlockEncoder::GetStrategyFor(
- ShShaderOutput outputType)
-{
- switch (outputType)
- {
- case SH_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();
-
- for (size_t fieldIndex = 0; fieldIndex < variable.fields.size(); fieldIndex++)
- {
- HLSLVariableRegisterCount(variable.fields[fieldIndex], encoder);
- }
-
- encoder->exitAggregateType();
- }
- }
- else
- {
- // We operate only on varyings and uniforms, which do not have matrix layout qualifiers
- encoder->encodeType(variable.type, variable.arraySizes, false);
- }
-}
-
-unsigned int HLSLVariableRegisterCount(const Uniform &variable, ShShaderOutput outputType)
-{
- HLSLBlockEncoder encoder(HLSLBlockEncoder::GetStrategyFor(outputType), true);
- HLSLVariableRegisterCount(variable, &encoder);
-
- const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
- return static_cast<unsigned int>(rx::roundUp<size_t>(encoder.getBlockSize(), registerBytes) /
- registerBytes);
-}
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/blocklayoutHLSL.h b/src/3rdparty/angle/src/compiler/translator/blocklayoutHLSL.h
deleted file mode 100644
index 8f4a51a906..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/blocklayoutHLSL.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// 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 "angle_gl.h"
-#include "blocklayout.h"
-#include <GLSLANG/ShaderLang.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() override;
- void exitAggregateType() 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);
-}
-
-#endif // COMMON_BLOCKLAYOUTHLSL_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/emulated_builtin_function_data_hlsl.json b/src/3rdparty/angle/src/compiler/translator/emulated_builtin_function_data_hlsl.json
deleted file mode 100644
index 32e500fe67..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/emulated_builtin_function_data_hlsl.json
+++ /dev/null
@@ -1,1382 +0,0 @@
-[
- {
- "op":"mod",
- "return_type":"float",
- "args":[
- "float x",
- "float y"
- ],
- "body":[
- "return x - y * floor(x / y);"
- ]
- },
- {
- "op":"mod",
- "return_type":"float2",
- "args":[
- "float2 x",
- "float2 y"
- ],
- "body":[
- "return x - y * floor(x / y);"
- ]
- },
- {
- "op":"mod",
- "return_type":"float2",
- "args":[
- "float2 x",
- "float y"
- ],
- "body":[
- "return x - y * floor(x / y);"
- ]
- },
- {
- "op":"mod",
- "return_type":"float3",
- "args":[
- "float3 x",
- "float3 y"
- ],
- "body":[
- "return x - y * floor(x / y);"
- ]
- },
- {
- "op":"mod",
- "return_type":"float3",
- "args":[
- "float3 x",
- "float y"
- ],
- "body":[
- "return x - y * floor(x / y);"
- ]
- },
- {
- "op":"mod",
- "return_type":"float4",
- "args":[
- "float4 x",
- "float4 y"
- ],
- "body":[
- "return x - y * floor(x / y);"
- ]
- },
- {
- "op":"mod",
- "return_type":"float4",
- "args":[
- "float4 x",
- "float y"
- ],
- "body":[
- "return x - y * floor(x / y);"
- ]
- },
- {
- "op":"frexp",
- "return_type":"float",
- "args":[
- "float x",
- "out int exp"
- ],
- "body":[
- "float fexp;",
- "float mantissa = frexp(abs(x), fexp) * sign(x);",
- "exp = int(fexp);",
- "return mantissa;"
- ]
- },
- {
- "op":"frexp",
- "return_type":"float2",
- "args":[
- "float2 x",
- "out int2 exp"
- ],
- "body":[
- "float2 fexp;",
- "float2 mantissa = frexp(abs(x), fexp) * sign(x);",
- "exp = int2(fexp);",
- "return mantissa;"
- ]
- },
- {
- "op":"frexp",
- "return_type":"float3",
- "args":[
- "float3 x",
- "out int3 exp"
- ],
- "body":[
- "float3 fexp;",
- "float3 mantissa = frexp(abs(x), fexp) * sign(x);",
- "exp = int3(fexp);",
- "return mantissa;"
- ]
- },
- {
- "op":"frexp",
- "return_type":"float4",
- "args":[
- "float4 x",
- "out int4 exp"
- ],
- "body":[
- "float4 fexp;",
- "float4 mantissa = frexp(abs(x), fexp) * sign(x);",
- "exp = int4(fexp);",
- "return mantissa;"
- ]
- },
- {
- "op":"ldexp",
- "return_type":"float",
- "args":[
- "float x",
- "int exp"
- ],
- "body":[
- "return ldexp(x, float(exp));"
- ]
- },
- {
- "op":"ldexp",
- "return_type":"float2",
- "args":[
- "float2 x",
- "int2 exp"
- ],
- "body":[
- "return ldexp(x, float2(exp));"
- ]
- },
- {
- "op":"ldexp",
- "return_type":"float3",
- "args":[
- "float3 x",
- "int3 exp"
- ],
- "body":[
- "return ldexp(x, float3(exp));"
- ]
- },
- {
- "op":"ldexp",
- "return_type":"float4",
- "args":[
- "float4 x",
- "int4 exp"
- ],
- "body":[
- "return ldexp(x, float4(exp));"
- ]
- },
- {
- "op":"faceforward",
- "return_type":"float",
- "args":[
- "float N",
- "float I",
- "float Nref"
- ],
- "body":[
- "if(dot(Nref, I) >= 0)",
- "{",
- " return -N;",
- "}",
- "else",
- "{",
- " return N;",
- "}"
- ]
- },
- {
- "op":"faceforward",
- "return_type":"float2",
- "args":[
- "float2 N",
- "float2 I",
- "float2 Nref"
- ],
- "body":[
- "if(dot(Nref, I) >= 0)",
- "{",
- " return -N;",
- "}",
- "else",
- "{",
- " return N;",
- "}"
- ]
- },
- {
- "op":"faceforward",
- "return_type":"float3",
- "args":[
- "float3 N",
- "float3 I",
- "float3 Nref"
- ],
- "body":[
- "if(dot(Nref, I) >= 0)",
- "{",
- " return -N;",
- "}",
- "else",
- "{",
- " return N;",
- "}"
- ]
- },
- {
- "op":"faceforward",
- "return_type":"float4",
- "args":[
- "float4 N",
- "float4 I",
- "float4 Nref"
- ],
- "body":[
- "if(dot(Nref, I) >= 0)",
- "{",
- " return -N;",
- "}",
- "else",
- "{",
- " return N;",
- "}"
- ]
- },
- {
- "op":"atan",
- "return_type":"float",
- "args":[
- "float y",
- "float x"
- ],
- "body":[
- "if(x == 0 && y == 0) x = 1;",
- "return atan2(y, x);"
- ]
- },
- {
- "op":"atan",
- "return_type":"float2",
- "args":[
- "float2 y",
- "float2 x"
- ],
- "body":[
- "if(x[0] == 0 && y[0] == 0) x[0] = 1;",
- "if(x[1] == 0 && y[1] == 0) x[1] = 1;",
- "return float2(atan2(y[0], x[0]), atan2(y[1], x[1]));"
- ]
- },
- {
- "op":"atan",
- "return_type":"float3",
- "args":[
- "float3 y",
- "float3 x"
- ],
- "body":[
- "if(x[0] == 0 && y[0] == 0) x[0] = 1;",
- "if(x[1] == 0 && y[1] == 0) x[1] = 1;",
- "if(x[2] == 0 && y[2] == 0) x[2] = 1;",
- "return float3(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]));"
- ]
- },
- {
- "op":"atan",
- "return_type":"float4",
- "args":[
- "float4 y",
- "float4 x"
- ],
- "body":[
- "if(x[0] == 0 && y[0] == 0) x[0] = 1;",
- "if(x[1] == 0 && y[1] == 0) x[1] = 1;",
- "if(x[2] == 0 && y[2] == 0) x[2] = 1;",
- "if(x[3] == 0 && y[3] == 0) x[3] = 1;",
- "return float4(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], ",
- "x[2]), atan2(y[3], x[3]));"
- ]
- },
- {
- "op":"asinh",
- "return_type":"float",
- "args":[
- "in float x"
- ],
- "body":[
- "return log(x + sqrt(pow(x, 2.0) + 1.0));"
- ]
- },
- {
- "op":"asinh",
- "return_type":"float2",
- "args":[
- "in float2 x"
- ],
- "body":[
- "return log(x + sqrt(pow(x, 2.0) + 1.0));"
- ]
- },
- {
- "op":"asinh",
- "return_type":"float3",
- "args":[
- "in float3 x"
- ],
- "body":[
- "return log(x + sqrt(pow(x, 2.0) + 1.0));"
- ]
- },
- {
- "op":"asinh",
- "return_type":"float4",
- "args":[
- "in float4 x"
- ],
- "body":[
- "return log(x + sqrt(pow(x, 2.0) + 1.0));"
- ]
- },
- {
- "op":"acosh",
- "return_type":"float",
- "args":[
- "in float x"
- ],
- "body":[
- "return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));"
- ]
- },
- {
- "op":"acosh",
- "return_type":"float2",
- "args":[
- "in float2 x"
- ],
- "body":[
- "return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));"
- ]
- },
- {
- "op":"acosh",
- "return_type":"float3",
- "args":[
- "in float3 x"
- ],
- "body":[
- "return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));"
- ]
- },
- {
- "op":"acosh",
- "return_type":"float4",
- "args":[
- "in float4 x"
- ],
- "body":[
- "return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));"
- ]
- },
- {
- "op":"atanh",
- "return_type":"float",
- "args":[
- "in float x"
- ],
- "body":[
- "return 0.5 * log((1.0 + x) / (1.0 - x));"
- ]
- },
- {
- "op":"atanh",
- "return_type":"float2",
- "args":[
- "in float2 x"
- ],
- "body":[
- "return 0.5 * log((1.0 + x) / (1.0 - x));"
- ]
- },
- {
- "op":"atanh",
- "return_type":"float3",
- "args":[
- "in float3 x"
- ],
- "body":[
- "return 0.5 * log((1.0 + x) / (1.0 - x));"
- ]
- },
- {
- "op":"atanh",
- "return_type":"float4",
- "args":[
- "in float4 x"
- ],
- "body":[
- "return 0.5 * log((1.0 + x) / (1.0 - x));"
- ]
- },
- {
- "op":"roundEven",
- "return_type":"float",
- "args":[
- "in float x"
- ],
- "body":[
- "return (frac(x) == 0.5 && trunc(x) % 2.0 == 0.0) ? trunc(x) : round(x);"
- ]
- },
- {
- "op":"roundEven",
- "return_type":"float2",
- "args":[
- "in float2 x"
- ],
- "body":[
- "float2 v;",
- "v[0] = (frac(x[0]) == 0.5 && trunc(x[0]) % 2.0 == 0.0) ? trunc(x[0]) : round(x[0]);",
- "v[1] = (frac(x[1]) == 0.5 && trunc(x[1]) % 2.0 == 0.0) ? trunc(x[1]) : round(x[1]);",
- "return v;"
- ]
- },
- {
- "op":"roundEven",
- "return_type":"float3",
- "args":[
- "in float3 x"
- ],
- "body":[
- "float3 v;",
- "v[0] = (frac(x[0]) == 0.5 && trunc(x[0]) % 2.0 == 0.0) ? trunc(x[0]) : round(x[0]);",
- "v[1] = (frac(x[1]) == 0.5 && trunc(x[1]) % 2.0 == 0.0) ? trunc(x[1]) : round(x[1]);",
- "v[2] = (frac(x[2]) == 0.5 && trunc(x[2]) % 2.0 == 0.0) ? trunc(x[2]) : round(x[2]);",
- "return v;"
- ]
- },
- {
- "op":"roundEven",
- "return_type":"float4",
- "args":[
- "in float4 x"
- ],
- "body":[
- "float4 v;",
- "v[0] = (frac(x[0]) == 0.5 && trunc(x[0]) % 2.0 == 0.0) ? trunc(x[0]) : round(x[0]);",
- "v[1] = (frac(x[1]) == 0.5 && trunc(x[1]) % 2.0 == 0.0) ? trunc(x[1]) : round(x[1]);",
- "v[2] = (frac(x[2]) == 0.5 && trunc(x[2]) % 2.0 == 0.0) ? trunc(x[2]) : round(x[2]);",
- "v[3] = (frac(x[3]) == 0.5 && trunc(x[3]) % 2.0 == 0.0) ? trunc(x[3]) : round(x[3]);",
- "return v;"
- ]
- },
- {
- "op":"packSnorm2x16",
- "return_type":"uint",
- "args":[
- "in float2 v"
- ],
- "helper":[
- "int webgl_toSnorm16(in float x) {",
- " return int(round(clamp(x, -1.0, 1.0) * 32767.0));",
- "}"
- ],
- "body":[
- "int x = webgl_toSnorm16(v.x);",
- "int y = webgl_toSnorm16(v.y);",
- "return (asuint(y) << 16) | (asuint(x) & 0xffffu);"
- ]
- },
- {
- "op":"packUnorm2x16",
- "return_type":"uint",
- "args":[
- "in float2 v"
- ],
- "helper":[
- "uint webgl_toUnorm16(in float x) {",
- " return uint(round(clamp(x, 0.0, 1.0) * 65535.0));",
- "}"
- ],
- "body":[
- "uint x = webgl_toUnorm16(v.x);",
- "uint y = webgl_toUnorm16(v.y);",
- "return (y << 16) | x;"
- ]
- },
- {
- "op":"packHalf2x16",
- "return_type":"uint",
- "args":[
- "in float2 v"
- ],
- "body":[
- "uint x = f32tof16(v.x);",
- "uint y = f32tof16(v.y);",
- "return (y << 16) | x;"
- ]
- },
- {
- "op":"unpackSnorm2x16",
- "return_type":"float2",
- "args":[
- "in uint u"
- ],
- "helper":[
- "float webgl_fromSnorm16(in uint x) {",
- " int xi = asint(x & 0x7fffu) - asint(x & 0x8000u);",
- " return clamp(float(xi) / 32767.0, -1.0, 1.0);",
- "}"
- ],
- "body":[
- "uint y = (u >> 16);",
- "uint x = u;",
- "return float2(webgl_fromSnorm16(x), webgl_fromSnorm16(y));"
- ]
- },
- {
- "op":"unpackUnorm2x16",
- "return_type":"float2",
- "args":[
- "in uint u"
- ],
- "helper":[
- "float webgl_fromUnorm16(in uint x) {",
- " return float(x) / 65535.0;",
- "}"
- ],
- "body":[
- "uint y = (u >> 16);",
- "uint x = u & 0xffffu;",
- "return float2(webgl_fromUnorm16(x), webgl_fromUnorm16(y));"
- ]
- },
- {
- "op":"unpackHalf2x16",
- "return_type":"float2",
- "args":[
- "in uint u"
- ],
- "body":[
- "uint y = (u >> 16);",
- "uint x = u & 0xffffu;",
- "return float2(f16tof32(x), f16tof32(y));"
- ]
- },
- {
- "op":"packSnorm4x8",
- "return_type":"uint",
- "args":[
- "in float4 v"
- ],
- "helper":[
- "int webgl_toSnorm8(in float x) {",
- " return int(round(clamp(x, -1.0, 1.0) * 127.0));",
- "}"
- ],
- "body":[
- "int x = webgl_toSnorm8(v.x);",
- "int y = webgl_toSnorm8(v.y);",
- "int z = webgl_toSnorm8(v.z);",
- "int w = webgl_toSnorm8(v.w);",
- "return ((asuint(w) & 0xffu) << 24) | ((asuint(z) & 0xffu) << 16) ",
- "| ((asuint(y) & 0xffu) << 8) | (asuint(x) & 0xffu);"
- ]
- },
- {
- "op":"packUnorm4x8",
- "return_type":"uint",
- "args":[
- "in float4 v"
- ],
- "helper":[
- "uint webgl_toUnorm8(in float x) {",
- " return uint(round(clamp(x, 0.0, 1.0) * 255.0));",
- "}"
- ],
- "body":[
- "uint x = webgl_toUnorm8(v.x);",
- "uint y = webgl_toUnorm8(v.y);",
- "uint z = webgl_toUnorm8(v.z);",
- "uint w = webgl_toUnorm8(v.w);",
- "return (w << 24) | (z << 16) | (y << 8) | x;"
- ]
- },
- {
- "op":"unpackSnorm4x8",
- "return_type":"float4",
- "args":[
- "in uint u"
- ],
- "helper":[
- "float webgl_fromSnorm8(in uint x) {",
- " int xi = asint(x & 0x7fu) - asint(x & 0x80u);",
- " return clamp(float(xi) / 127.0, -1.0, 1.0);",
- "}"
- ],
- "body":[
- "uint w = (u >> 24);",
- "uint z = (u >> 16);",
- "uint y = (u >> 8);",
- "uint x = u;",
- "return float4(webgl_fromSnorm8(x), webgl_fromSnorm8(y), ",
- "webgl_fromSnorm8(z), webgl_fromSnorm8(w));"
- ]
- },
- {
- "op":"unpackUnorm4x8",
- "return_type":"float4",
- "args":[
- "in uint u"
- ],
- "helper":[
- "float webgl_fromUnorm8(in uint x) {",
- " return float(x) / 255.0;",
- "}"
- ],
- "body":[
- "uint w = (u >> 24) & 0xffu;",
- "uint z = (u >> 16) & 0xffu;",
- "uint y = (u >> 8) & 0xffu;",
- "uint x = u & 0xffu;",
- "return float4(webgl_fromUnorm8(x), webgl_fromUnorm8(y), ",
- "webgl_fromUnorm8(z), webgl_fromUnorm8(w));"
- ]
- },
- {
- "comment":[
- "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."
- ],
- "op":"outerProduct",
- "return_type":"float2x2",
- "args":[
- "in float2 c",
- "in float2 r"
- ],
- "body":[
- "return mul(float2x1(r), float1x2(c));"
- ]
- },
- {
- "op":"outerProduct",
- "return_type":"float3x3",
- "args":[
- "in float3 c",
- "in float3 r"
- ],
- "body":[
- "return mul(float3x1(r), float1x3(c));"
- ]
- },
- {
- "op":"outerProduct",
- "return_type":"float4x4",
- "args":[
- "in float4 c",
- "in float4 r"
- ],
- "body":[
- "return mul(float4x1(r), float1x4(c));"
- ]
- },
- {
- "op":"outerProduct",
- "return_type":"float2x3",
- "args":[
- "in float3 c",
- "in float2 r"
- ],
- "body":[
- "return mul(float2x1(r), float1x3(c));"
- ]
- },
- {
- "op":"outerProduct",
- "return_type":"float3x2",
- "args":[
- "in float2 c",
- "in float3 r"
- ],
- "body":[
- "return mul(float3x1(r), float1x2(c));"
- ]
- },
- {
- "op":"outerProduct",
- "return_type":"float2x4",
- "args":[
- "in float4 c",
- "in float2 r"
- ],
- "body":[
- "return mul(float2x1(r), float1x4(c));"
- ]
- },
- {
- "op":"outerProduct",
- "return_type":"float4x2",
- "args":[
- "in float2 c",
- "in float4 r"
- ],
- "body":[
- "return mul(float4x1(r), float1x2(c));"
- ]
- },
- {
- "op":"outerProduct",
- "return_type":"float3x4",
- "args":[
- "in float4 c",
- "in float3 r"
- ],
- "body":[
- "return mul(float3x1(r), float1x4(c));"
- ]
- },
- {
- "op":"outerProduct",
- "return_type":"float4x3",
- "args":[
- "in float3 c",
- "in float4 r"
- ],
- "body":[
- "return mul(float4x1(r), float1x3(c));"
- ]
- },
- {
- "comment":[
- "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."
- ],
- "op":"inverse",
- "return_type":"float2x2",
- "args":[
- "in float2x2 m"
- ],
- "body":[
- "float2x2 cof = { m[1][1], -m[0][1], -m[1][0], m[0][0] };",
- "return cof / determinant(transpose(m));"
- ]
- },
- {
- "comment":[
- "cofAB is the cofactor for column A and row B."
- ],
- "op":"inverse",
- "return_type":"float3x3",
- "args":[
- "in float3x3 m"
- ],
- "body":[
- "float cof00 = m[1][1] * m[2][2] - m[2][1] * m[1][2];",
- "float cof01 = -(m[1][0] * m[2][2] - m[2][0] * m[1][2]);",
- "float cof02 = m[1][0] * m[2][1] - m[2][0] * m[1][1];",
- "float cof10 = -(m[0][1] * m[2][2] - m[2][1] * m[0][2]);",
- "float cof11 = m[0][0] * m[2][2] - m[2][0] * m[0][2];",
- "float cof12 = -(m[0][0] * m[2][1] - m[2][0] * m[0][1]);",
- "float cof20 = m[0][1] * m[1][2] - m[1][1] * m[0][2];",
- "float cof21 = -(m[0][0] * m[1][2] - m[1][0] * m[0][2]);",
- "float cof22 = m[0][0] * m[1][1] - m[1][0] * m[0][1];",
- "float3x3 cof = { cof00, cof10, cof20, cof01, cof11, cof21, cof02, cof12, cof22 };",
- "return cof / determinant(transpose(m));"
- ]
- },
- {
- "op":"inverse",
- "return_type":"float4x4",
- "args":[
- "in float4x4 m"
- ],
- "body":[
- "float cof00 = m[1][1] * m[2][2] * m[3][3] + m[2][1] * m[3][2] * m[1][3] + m[3][1] * ",
- "m[1][2] * m[2][3]",
- " - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] - m[3][1] * m[2][2] * ",
- "m[1][3];",
- "float cof01 = -(m[1][0] * m[2][2] * m[3][3] + m[2][0] * m[3][2] * m[1][3] + m[3][0] * ",
- "m[1][2] * m[2][3]",
- " - m[1][0] * m[3][2] * m[2][3] - m[2][0] * m[1][2] * m[3][3] - m[3][0] * m[2][2] * ",
- "m[1][3]);",
- "float cof02 = m[1][0] * m[2][1] * m[3][3] + m[2][0] * m[3][1] * m[1][3] + m[3][0] * ",
- "m[1][1] * m[2][3]",
- " - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] - m[3][0] * m[2][1] * ",
- "m[1][3];",
- "float cof03 = -(m[1][0] * m[2][1] * m[3][2] + m[2][0] * m[3][1] * m[1][2] + m[3][0] * ",
- "m[1][1] * m[2][2]",
- " - m[1][0] * m[3][1] * m[2][2] - m[2][0] * m[1][1] * m[3][2] - m[3][0] * m[2][1] * ",
- "m[1][2]);",
- "float cof10 = -(m[0][1] * m[2][2] * m[3][3] + m[2][1] * m[3][2] * m[0][3] + m[3][1] * ",
- "m[0][2] * m[2][3]",
- " - m[0][1] * m[3][2] * m[2][3] - m[2][1] * m[0][2] * m[3][3] - m[3][1] * m[2][2] * ",
- "m[0][3]);",
- "float cof11 = m[0][0] * m[2][2] * m[3][3] + m[2][0] * m[3][2] * m[0][3] + m[3][0] * ",
- "m[0][2] * m[2][3]",
- " - m[0][0] * m[3][2] * m[2][3] - m[2][0] * m[0][2] * m[3][3] - m[3][0] * m[2][2] * ",
- "m[0][3];",
- "float cof12 = -(m[0][0] * m[2][1] * m[3][3] + m[2][0] * m[3][1] * m[0][3] + m[3][0] * ",
- "m[0][1] * m[2][3]",
- " - m[0][0] * m[3][1] * m[2][3] - m[2][0] * m[0][1] * m[3][3] - m[3][0] * m[2][1] * ",
- "m[0][3]);",
- "float cof13 = m[0][0] * m[2][1] * m[3][2] + m[2][0] * m[3][1] * m[0][2] + m[3][0] * ",
- "m[0][1] * m[2][2]",
- " - m[0][0] * m[3][1] * m[2][2] - m[2][0] * m[0][1] * m[3][2] - m[3][0] * m[2][1] * ",
- "m[0][2];",
- "float cof20 = m[0][1] * m[1][2] * m[3][3] + m[1][1] * m[3][2] * m[0][3] + m[3][1] * ",
- "m[0][2] * m[1][3]",
- " - m[0][1] * m[3][2] * m[1][3] - m[1][1] * m[0][2] * m[3][3] - m[3][1] * m[1][2] * ",
- "m[0][3];",
- "float cof21 = -(m[0][0] * m[1][2] * m[3][3] + m[1][0] * m[3][2] * m[0][3] + m[3][0] * ",
- "m[0][2] * m[1][3]",
- " - m[0][0] * m[3][2] * m[1][3] - m[1][0] * m[0][2] * m[3][3] - m[3][0] * m[1][2] * ",
- "m[0][3]);",
- "float cof22 = m[0][0] * m[1][1] * m[3][3] + m[1][0] * m[3][1] * m[0][3] + m[3][0] * ",
- "m[0][1] * m[1][3]",
- " - m[0][0] * m[3][1] * m[1][3] - m[1][0] * m[0][1] * m[3][3] - m[3][0] * m[1][1] * ",
- "m[0][3];",
- "float cof23 = -(m[0][0] * m[1][1] * m[3][2] + m[1][0] * m[3][1] * m[0][2] + m[3][0] * ",
- "m[0][1] * m[1][2]",
- " - m[0][0] * m[3][1] * m[1][2] - m[1][0] * m[0][1] * m[3][2] - m[3][0] * m[1][1] * ",
- "m[0][2]);",
- "float cof30 = -(m[0][1] * m[1][2] * m[2][3] + m[1][1] * m[2][2] * m[0][3] + m[2][1] * ",
- "m[0][2] * m[1][3]",
- " - m[0][1] * m[2][2] * m[1][3] - m[1][1] * m[0][2] * m[2][3] - m[2][1] * m[1][2] * ",
- "m[0][3]);",
- "float cof31 = m[0][0] * m[1][2] * m[2][3] + m[1][0] * m[2][2] * m[0][3] + m[2][0] * ",
- "m[0][2] * m[1][3]",
- " - m[0][0] * m[2][2] * m[1][3] - m[1][0] * m[0][2] * m[2][3] - m[2][0] * m[1][2] * ",
- "m[0][3];",
- "float cof32 = -(m[0][0] * m[1][1] * m[2][3] + m[1][0] * m[2][1] * m[0][3] + m[2][0] * ",
- "m[0][1] * m[1][3]",
- " - m[0][0] * m[2][1] * m[1][3] - m[1][0] * m[0][1] * m[2][3] - m[2][0] * m[1][1] * ",
- "m[0][3]);",
- "float cof33 = m[0][0] * m[1][1] * m[2][2] + m[1][0] * m[2][1] * m[0][2] + m[2][0] * ",
- "m[0][1] * m[1][2]",
- " - m[0][0] * m[2][1] * m[1][2] - m[1][0] * m[0][1] * m[2][2] - m[2][0] * m[1][1] * ",
- "m[0][2];",
- "float4x4 cof = { cof00, cof10, cof20, cof30, cof01, cof11, cof21, cof31,",
- " cof02, cof12, cof22, cof32, cof03, cof13, cof23, cof33 };",
- "return cof / determinant(transpose(m));"
- ]
- },
- {
- "comment":[
- "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."
- ],
- "op":"mix",
- "return_type":"float",
- "args":[
- "float x",
- "float y",
- "bool a"
- ],
- "body":[
- "return a ? y : x;"
- ]
- },
- {
- "op":"mix",
- "return_type":"float2",
- "args":[
- "float2 x",
- "float2 y",
- "bool2 a"
- ],
- "body":[
- "return a ? y : x;"
- ]
- },
- {
- "op":"mix",
- "return_type":"float3",
- "args":[
- "float3 x",
- "float3 y",
- "bool3 a"
- ],
- "body":[
- "return a ? y : x;"
- ]
- },
- {
- "op":"mix",
- "return_type":"float4",
- "args":[
- "float4 x",
- "float4 y",
- "bool4 a"
- ],
- "body":[
- "return a ? y : x;"
- ]
- },
- {
- "op":"bitfieldExtract",
- "return_type":"uint",
- "args":[
- "uint value",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return 0u;",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint mask = ((maskMsb - 1u) | maskMsb) << offset;",
- "return (value & mask) >> offset;"
- ]
- },
- {
- "op":"bitfieldExtract",
- "return_type":"uint2",
- "args":[
- "uint2 value",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return uint2(0u, 0u);",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint mask = ((maskMsb - 1u) | maskMsb) << offset;",
- "return (value & mask) >> offset;"
- ]
- },
- {
- "op":"bitfieldExtract",
- "return_type":"uint3",
- "args":[
- "uint3 value",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return uint3(0u, 0u, 0u);",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint mask = ((maskMsb - 1u) | maskMsb) << offset;",
- "return (value & mask) >> offset;"
- ]
- },
- {
- "op":"bitfieldExtract",
- "return_type":"uint4",
- "args":[
- "uint4 value",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return uint4(0u, 0u, 0u, 0u);",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint mask = ((maskMsb - 1u) | maskMsb) << offset;",
- "return (value & mask) >> offset;"
- ]
- },
- {
- "op":"bitfieldExtract",
- "return_type":"int",
- "args":[
- "int value",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return 0;",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint mask = ((maskMsb - 1u) | maskMsb) << offset;",
- "uint resultUnsigned = (asuint(value) & mask) >> offset;",
- "if (bits != 32 && (resultUnsigned & maskMsb) != 0)",
- "{",
- " uint higherBitsMask = ((1u << (32 - bits)) - 1u) << bits;",
- " resultUnsigned |= higherBitsMask;",
- "}",
- "return asint(resultUnsigned);"
- ]
- },
- {
- "op":"bitfieldExtract",
- "return_type":"int2",
- "args":[
- "int2 value",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return int2(0, 0);",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint mask = ((maskMsb - 1u) | maskMsb) << offset;",
- "uint2 resultUnsigned = (asuint(value) & mask) >> offset;",
- "if (bits != 32)",
- "{",
- " uint higherBitsMask = ((1u << (32 - bits)) - 1u) << bits;",
- " resultUnsigned |= ((resultUnsigned & maskMsb) >> (bits - 1)) * higherBitsMask;",
- "}",
- "return asint(resultUnsigned);"
- ]
- },
- {
- "op":"bitfieldExtract",
- "return_type":"int3",
- "args":[
- "int3 value",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return int3(0, 0, 0);",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint mask = ((maskMsb - 1u) | maskMsb) << offset;",
- "uint3 resultUnsigned = (asuint(value) & mask) >> offset;",
- "if (bits != 32)",
- "{",
- " uint higherBitsMask = ((1u << (32 - bits)) - 1u) << bits;",
- " resultUnsigned |= ((resultUnsigned & maskMsb) >> (bits - 1)) * higherBitsMask;",
- "}",
- "return asint(resultUnsigned);"
- ]
- },
- {
- "op":"bitfieldExtract",
- "return_type":"int4",
- "args":[
- "int4 value",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return int4(0, 0, 0, 0);",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint mask = ((maskMsb - 1u) | maskMsb) << offset;",
- "uint4 resultUnsigned = (asuint(value) & mask) >> offset;",
- "if (bits != 32)",
- "{",
- " uint higherBitsMask = ((1u << (32 - bits)) - 1u) << bits;",
- " resultUnsigned |= ((resultUnsigned & maskMsb) >> (bits - 1)) * higherBitsMask;",
- "}",
- "return asint(resultUnsigned);"
- ]
- },
- {
- "op":"bitfieldInsert",
- "return_type":"uint",
- "args":[
- "uint base",
- "uint insert",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return base;",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;",
- "uint baseMask = ~insertMask;",
- "return (base & baseMask) | ((insert << offset) & insertMask);"
- ]
- },
- {
- "op":"bitfieldInsert",
- "return_type":"uint2",
- "args":[
- "uint2 base",
- "uint2 insert",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return base;",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;",
- "uint baseMask = ~insertMask;",
- "return (base & baseMask) | ((insert << offset) & insertMask);"
- ]
- },
- {
- "op":"bitfieldInsert",
- "return_type":"uint3",
- "args":[
- "uint3 base",
- "uint3 insert",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return base;",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;",
- "uint baseMask = ~insertMask;",
- "return (base & baseMask) | ((insert << offset) & insertMask);"
- ]
- },
- {
- "op":"bitfieldInsert",
- "return_type":"uint4",
- "args":[
- "uint4 base",
- "uint4 insert",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return base;",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;",
- "uint baseMask = ~insertMask;",
- "return (base & baseMask) | ((insert << offset) & insertMask);"
- ]
- },
- {
- "op":"bitfieldInsert",
- "return_type":"int",
- "args":[
- "int base",
- "int insert",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return base;",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;",
- "uint baseMask = ~insertMask;",
- "uint resultUnsigned = (asuint(base) & baseMask) | ((asuint(insert) << offset) & ",
- " insertMask);",
- "return asint(resultUnsigned);"
- ]
- },
- {
- "op":"bitfieldInsert",
- "return_type":"int2",
- "args":[
- "int2 base",
- "int2 insert",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return base;",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;",
- "uint baseMask = ~insertMask;",
- "uint2 resultUnsigned = (asuint(base) & baseMask) | ((asuint(insert) << offset) & ",
- " insertMask);",
- "return asint(resultUnsigned);"
- ]
- },
- {
- "op":"bitfieldInsert",
- "return_type":"int3",
- "args":[
- "int3 base",
- "int3 insert",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return base;",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;",
- "uint baseMask = ~insertMask;",
- "uint3 resultUnsigned = (asuint(base) & baseMask) | ((asuint(insert) << offset) & ",
- " insertMask);",
- "return asint(resultUnsigned);"
- ]
- },
- {
- "op":"bitfieldInsert",
- "return_type":"int4",
- "args":[
- "int4 base",
- "int4 insert",
- "int offset",
- "int bits"
- ],
- "body":[
- "if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)",
- "{",
- " return base;",
- "}",
- "uint maskMsb = (1u << (bits - 1));",
- "uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;",
- "uint baseMask = ~insertMask;",
- "uint4 resultUnsigned = (asuint(base) & baseMask) | ((asuint(insert) << offset) & ",
- "insertMask);",
- "return asint(resultUnsigned);"
- ]
- },
- {
- "op":"uaddCarry",
- "return_type":"uint",
- "args":[
- "uint x",
- "uint y",
- "out uint carry"
- ],
- "body":[
- "carry = uint(x > (0xffffffffu - y));",
- "return x + y;"
- ]
- },
- {
- "op":"uaddCarry",
- "return_type":"uint2",
- "args":[
- "uint2 x",
- "uint2 y",
- "out uint2 carry"
- ],
- "body":[
- "carry = uint2(x > (0xffffffffu - y));",
- "return x + y;"
- ]
- },
- {
- "op":"uaddCarry",
- "return_type":"uint3",
- "args":[
- "uint3 x",
- "uint3 y",
- "out uint3 carry"
- ],
- "body":[
- "carry = uint3(x > (0xffffffffu - y));",
- "return x + y;"
- ]
- },
- {
- "op":"uaddCarry",
- "return_type":"uint4",
- "args":[
- "uint4 x",
- "uint4 y",
- "out uint4 carry"
- ],
- "body":[
- "carry = uint4(x > (0xffffffffu - y));",
- "return x + y;"
- ]
- },
- {
- "op":"usubBorrow",
- "return_type":"uint",
- "args":[
- "uint x",
- "uint y",
- "out uint borrow"
- ],
- "body":[
- "borrow = uint(x < y);",
- "return x - y;"
- ]
- },
- {
- "op":"usubBorrow",
- "return_type":"uint2",
- "args":[
- "uint2 x",
- "uint2 y",
- "out uint2 borrow"
- ],
- "body":[
- "borrow = uint2(x < y);",
- "return x - y;"
- ]
- },
- {
- "op":"usubBorrow",
- "return_type":"uint3",
- "args":[
- "uint3 x",
- "uint3 y",
- "out uint3 borrow"
- ],
- "body":[
- "borrow = uint3(x < y);",
- "return x - y;"
- ]
- },
- {
- "op":"usubBorrow",
- "return_type":"uint4",
- "args":[
- "uint4 x",
- "uint4 y",
- "out uint4 borrow"
- ],
- "body":[
- "borrow = uint4(x < y);",
- "return x - y;"
- ]
- }
-]
diff --git a/src/3rdparty/angle/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp b/src/3rdparty/angle/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp
deleted file mode 100644
index 288da5e0f5..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp
+++ /dev/null
@@ -1,859 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by gen_emulated_builtin_function_tables.py using data from
-// emulated_builtin_function_data_hlsl.json.
-//
-// 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.
-//
-// emulated_builtin_functions_hlsl:
-// HLSL code for emulating GLSL builtin functions not present in HLSL.
-
-#include "compiler/translator/BuiltInFunctionEmulator.h"
-
-namespace sh
-{
-
-namespace
-{
-
-struct FunctionPair
-{
- constexpr FunctionPair(const MiniFunctionId &idIn, const char *bodyIn) : id(idIn), body(bodyIn)
- {
- }
-
- MiniFunctionId id;
- const char *body;
-};
-
-constexpr FunctionPair g_hlslFunctions[] = {
- {{EOpMod, ParamType::Float1, ParamType::Float1},
- "float mod_emu(float x, float y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"},
- {{EOpMod, ParamType::Float2, ParamType::Float2},
- "float2 mod_emu(float2 x, float2 y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"},
- {{EOpMod, ParamType::Float2, ParamType::Float1},
- "float2 mod_emu(float2 x, float y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"},
- {{EOpMod, ParamType::Float3, ParamType::Float3},
- "float3 mod_emu(float3 x, float3 y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"},
- {{EOpMod, ParamType::Float3, ParamType::Float1},
- "float3 mod_emu(float3 x, float y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"},
- {{EOpMod, ParamType::Float4, ParamType::Float4},
- "float4 mod_emu(float4 x, float4 y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"},
- {{EOpMod, ParamType::Float4, ParamType::Float1},
- "float4 mod_emu(float4 x, float y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"},
- {{EOpFrexp, ParamType::Float1, ParamType::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"},
- {{EOpFrexp, ParamType::Float2, ParamType::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"},
- {{EOpFrexp, ParamType::Float3, ParamType::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"},
- {{EOpFrexp, ParamType::Float4, ParamType::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"},
- {{EOpLdexp, ParamType::Float1, ParamType::Int1},
- "float ldexp_emu(float x, int exp)\n"
- "{\n"
- " return ldexp(x, float(exp));\n"
- "}\n"},
- {{EOpLdexp, ParamType::Float2, ParamType::Int2},
- "float2 ldexp_emu(float2 x, int2 exp)\n"
- "{\n"
- " return ldexp(x, float2(exp));\n"
- "}\n"},
- {{EOpLdexp, ParamType::Float3, ParamType::Int3},
- "float3 ldexp_emu(float3 x, int3 exp)\n"
- "{\n"
- " return ldexp(x, float3(exp));\n"
- "}\n"},
- {{EOpLdexp, ParamType::Float4, ParamType::Int4},
- "float4 ldexp_emu(float4 x, int4 exp)\n"
- "{\n"
- " return ldexp(x, float4(exp));\n"
- "}\n"},
- {{EOpFaceforward, ParamType::Float1, ParamType::Float1, ParamType::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"},
- {{EOpFaceforward, ParamType::Float2, ParamType::Float2, ParamType::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"},
- {{EOpFaceforward, ParamType::Float3, ParamType::Float3, ParamType::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"},
- {{EOpFaceforward, ParamType::Float4, ParamType::Float4, ParamType::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"},
- {{EOpAtan, ParamType::Float1, ParamType::Float1},
- "float atan_emu(float y, float x)\n"
- "{\n"
- " if(x == 0 && y == 0) x = 1;\n"
- " return atan2(y, x);\n"
- "}\n"},
- {{EOpAtan, ParamType::Float2, ParamType::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"},
- {{EOpAtan, ParamType::Float3, ParamType::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"},
- {{EOpAtan, ParamType::Float4, ParamType::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"},
- {{EOpAsinh, ParamType::Float1},
- "float asinh_emu(in float x)\n"
- "{\n"
- " return log(x + sqrt(pow(x, 2.0) + 1.0));\n"
- "}\n"},
- {{EOpAsinh, ParamType::Float2},
- "float2 asinh_emu(in float2 x)\n"
- "{\n"
- " return log(x + sqrt(pow(x, 2.0) + 1.0));\n"
- "}\n"},
- {{EOpAsinh, ParamType::Float3},
- "float3 asinh_emu(in float3 x)\n"
- "{\n"
- " return log(x + sqrt(pow(x, 2.0) + 1.0));\n"
- "}\n"},
- {{EOpAsinh, ParamType::Float4},
- "float4 asinh_emu(in float4 x)\n"
- "{\n"
- " return log(x + sqrt(pow(x, 2.0) + 1.0));\n"
- "}\n"},
- {{EOpAcosh, ParamType::Float1},
- "float acosh_emu(in float x)\n"
- "{\n"
- " return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n"
- "}\n"},
- {{EOpAcosh, ParamType::Float2},
- "float2 acosh_emu(in float2 x)\n"
- "{\n"
- " return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n"
- "}\n"},
- {{EOpAcosh, ParamType::Float3},
- "float3 acosh_emu(in float3 x)\n"
- "{\n"
- " return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n"
- "}\n"},
- {{EOpAcosh, ParamType::Float4},
- "float4 acosh_emu(in float4 x)\n"
- "{\n"
- " return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n"
- "}\n"},
- {{EOpAtanh, ParamType::Float1},
- "float atanh_emu(in float x)\n"
- "{\n"
- " return 0.5 * log((1.0 + x) / (1.0 - x));\n"
- "}\n"},
- {{EOpAtanh, ParamType::Float2},
- "float2 atanh_emu(in float2 x)\n"
- "{\n"
- " return 0.5 * log((1.0 + x) / (1.0 - x));\n"
- "}\n"},
- {{EOpAtanh, ParamType::Float3},
- "float3 atanh_emu(in float3 x)\n"
- "{\n"
- " return 0.5 * log((1.0 + x) / (1.0 - x));\n"
- "}\n"},
- {{EOpAtanh, ParamType::Float4},
- "float4 atanh_emu(in float4 x)\n"
- "{\n"
- " return 0.5 * log((1.0 + x) / (1.0 - x));\n"
- "}\n"},
- {{EOpRoundEven, ParamType::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"},
- {{EOpRoundEven, ParamType::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"},
- {{EOpRoundEven, ParamType::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"},
- {{EOpRoundEven, ParamType::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"},
- {{EOpPackSnorm2x16, ParamType::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"},
- {{EOpPackUnorm2x16, ParamType::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"},
- {{EOpPackHalf2x16, ParamType::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"},
- {{EOpUnpackSnorm2x16, ParamType::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"},
- {{EOpUnpackUnorm2x16, ParamType::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"},
- {{EOpUnpackHalf2x16, ParamType::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"},
- {{EOpPackSnorm4x8, ParamType::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"},
- {{EOpPackUnorm4x8, ParamType::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"},
- {{EOpUnpackSnorm4x8, ParamType::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"},
- {{EOpUnpackUnorm4x8, ParamType::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.
- {{EOpOuterProduct, ParamType::Float2, ParamType::Float2},
- "float2x2 outerProduct_emu(in float2 c, in float2 r)\n"
- "{\n"
- " return mul(float2x1(r), float1x2(c));\n"
- "}\n"},
- {{EOpOuterProduct, ParamType::Float3, ParamType::Float3},
- "float3x3 outerProduct_emu(in float3 c, in float3 r)\n"
- "{\n"
- " return mul(float3x1(r), float1x3(c));\n"
- "}\n"},
- {{EOpOuterProduct, ParamType::Float4, ParamType::Float4},
- "float4x4 outerProduct_emu(in float4 c, in float4 r)\n"
- "{\n"
- " return mul(float4x1(r), float1x4(c));\n"
- "}\n"},
- {{EOpOuterProduct, ParamType::Float3, ParamType::Float2},
- "float2x3 outerProduct_emu(in float3 c, in float2 r)\n"
- "{\n"
- " return mul(float2x1(r), float1x3(c));\n"
- "}\n"},
- {{EOpOuterProduct, ParamType::Float2, ParamType::Float3},
- "float3x2 outerProduct_emu(in float2 c, in float3 r)\n"
- "{\n"
- " return mul(float3x1(r), float1x2(c));\n"
- "}\n"},
- {{EOpOuterProduct, ParamType::Float4, ParamType::Float2},
- "float2x4 outerProduct_emu(in float4 c, in float2 r)\n"
- "{\n"
- " return mul(float2x1(r), float1x4(c));\n"
- "}\n"},
- {{EOpOuterProduct, ParamType::Float2, ParamType::Float4},
- "float4x2 outerProduct_emu(in float2 c, in float4 r)\n"
- "{\n"
- " return mul(float4x1(r), float1x2(c));\n"
- "}\n"},
- {{EOpOuterProduct, ParamType::Float4, ParamType::Float3},
- "float3x4 outerProduct_emu(in float4 c, in float3 r)\n"
- "{\n"
- " return mul(float3x1(r), float1x4(c));\n"
- "}\n"},
- {{EOpOuterProduct, ParamType::Float3, ParamType::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.
- {{EOpInverse, ParamType::Mat2},
- "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.
- {{EOpInverse, ParamType::Mat3},
- "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"},
- {{EOpInverse, ParamType::Mat4},
- "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.
- {{EOpMix, ParamType::Float1, ParamType::Float1, ParamType::Bool1},
- "float mix_emu(float x, float y, bool a)\n"
- "{\n"
- " return a ? y : x;\n"
- "}\n"},
- {{EOpMix, ParamType::Float2, ParamType::Float2, ParamType::Bool2},
- "float2 mix_emu(float2 x, float2 y, bool2 a)\n"
- "{\n"
- " return a ? y : x;\n"
- "}\n"},
- {{EOpMix, ParamType::Float3, ParamType::Float3, ParamType::Bool3},
- "float3 mix_emu(float3 x, float3 y, bool3 a)\n"
- "{\n"
- " return a ? y : x;\n"
- "}\n"},
- {{EOpMix, ParamType::Float4, ParamType::Float4, ParamType::Bool4},
- "float4 mix_emu(float4 x, float4 y, bool4 a)\n"
- "{\n"
- " return a ? y : x;\n"
- "}\n"},
- {{EOpBitfieldExtract, ParamType::Uint1, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldExtract, ParamType::Uint2, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldExtract, ParamType::Uint3, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldExtract, ParamType::Uint4, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldExtract, ParamType::Int1, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldExtract, ParamType::Int2, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldExtract, ParamType::Int3, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldExtract, ParamType::Int4, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldInsert, ParamType::Uint1, ParamType::Uint1, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldInsert, ParamType::Uint2, ParamType::Uint2, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldInsert, ParamType::Uint3, ParamType::Uint3, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldInsert, ParamType::Uint4, ParamType::Uint4, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldInsert, ParamType::Int1, ParamType::Int1, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldInsert, ParamType::Int2, ParamType::Int2, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldInsert, ParamType::Int3, ParamType::Int3, ParamType::Int1, ParamType::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"},
- {{EOpBitfieldInsert, ParamType::Int4, ParamType::Int4, ParamType::Int1, ParamType::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"},
- {{EOpUaddCarry, ParamType::Uint1, ParamType::Uint1, ParamType::Uint1},
- "uint uaddCarry_emu(uint x, uint y, out uint carry)\n"
- "{\n"
- " carry = uint(x > (0xffffffffu - y));\n"
- " return x + y;\n"
- "}\n"},
- {{EOpUaddCarry, ParamType::Uint2, ParamType::Uint2, ParamType::Uint2},
- "uint2 uaddCarry_emu(uint2 x, uint2 y, out uint2 carry)\n"
- "{\n"
- " carry = uint2(x > (0xffffffffu - y));\n"
- " return x + y;\n"
- "}\n"},
- {{EOpUaddCarry, ParamType::Uint3, ParamType::Uint3, ParamType::Uint3},
- "uint3 uaddCarry_emu(uint3 x, uint3 y, out uint3 carry)\n"
- "{\n"
- " carry = uint3(x > (0xffffffffu - y));\n"
- " return x + y;\n"
- "}\n"},
- {{EOpUaddCarry, ParamType::Uint4, ParamType::Uint4, ParamType::Uint4},
- "uint4 uaddCarry_emu(uint4 x, uint4 y, out uint4 carry)\n"
- "{\n"
- " carry = uint4(x > (0xffffffffu - y));\n"
- " return x + y;\n"
- "}\n"},
- {{EOpUsubBorrow, ParamType::Uint1, ParamType::Uint1, ParamType::Uint1},
- "uint usubBorrow_emu(uint x, uint y, out uint borrow)\n"
- "{\n"
- " borrow = uint(x < y);\n"
- " return x - y;\n"
- "}\n"},
- {{EOpUsubBorrow, ParamType::Uint2, ParamType::Uint2, ParamType::Uint2},
- "uint2 usubBorrow_emu(uint2 x, uint2 y, out uint2 borrow)\n"
- "{\n"
- " borrow = uint2(x < y);\n"
- " return x - y;\n"
- "}\n"},
- {{EOpUsubBorrow, ParamType::Uint3, ParamType::Uint3, ParamType::Uint3},
- "uint3 usubBorrow_emu(uint3 x, uint3 y, out uint3 borrow)\n"
- "{\n"
- " borrow = uint3(x < y);\n"
- " return x - y;\n"
- "}\n"},
- {{EOpUsubBorrow, ParamType::Uint4, ParamType::Uint4, ParamType::Uint4},
- "uint4 usubBorrow_emu(uint4 x, uint4 y, out uint4 borrow)\n"
- "{\n"
- " borrow = uint4(x < y);\n"
- " return x - y;\n"
- "}\n"},
-};
-} // anonymous namespace
-
-const char *FindHLSLFunction(const FunctionId &functionID)
-{
- for (size_t index = 0; index < ArraySize(g_hlslFunctions); ++index)
- {
- const auto &function = g_hlslFunctions[index];
- if (function.id == functionID)
- {
- return function.body;
- }
- }
-
- return nullptr;
-}
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/glslang.h b/src/3rdparty/angle/src/compiler/translator/glslang.h
deleted file mode 100644
index e54c31ba3e..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/glslang.h
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/glslang.l b/src/3rdparty/angle/src/compiler/translator/glslang.l
deleted file mode 100644
index 858ffd96bb..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/glslang.l
+++ /dev/null
@@ -1,697 +0,0 @@
-/*
-//
-// 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).
-*/
-
-%top{
-//
-// 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 "-Wunused-function"
-#pragma GCC diagnostic ignored "-Wunused-variable"
-#pragma GCC diagnostic ignored "-Wswitch-enum"
-#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
-}
-
-%{
-#include "compiler/translator/glslang.h"
-#include "compiler/translator/ParseContext.h"
-#include "compiler/preprocessor/Token.h"
-#include "compiler/translator/util.h"
-#include "compiler/translator/length_limits.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_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_keyword_multiview_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 ES3_extension_keyword_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);
-%}
-
-%option noyywrap nounput never-interactive
-%option yylineno reentrant bison-bridge bison-locations
-%option extra-type="TParseContext*"
-%x FIELDS
-
-D [0-9]
-L [a-zA-Z_]
-H [a-fA-F0-9]
-E [Ee][+-]?{D}+
-O [0-7]
-
-%%
-
-%{
- TParseContext* context = yyextra;
-%}
-
-"invariant" { return INVARIANT; }
-"highp" { return HIGH_PRECISION; }
-"mediump" { return MEDIUM_PRECISION; }
-"lowp" { return LOW_PRECISION; }
-"precision" { return PRECISION; }
-
-"attribute" { return ES2_keyword_ES3_reserved(context, ATTRIBUTE); }
-"const" { return CONST_QUAL; }
-"uniform" { return UNIFORM; }
-"buffer" { return ES2_and_ES3_ident_ES3_1_keyword(context, BUFFER); }
-"varying" { return ES2_keyword_ES3_reserved(context, VARYING); }
-
-"break" { return BREAK; }
-"continue" { return CONTINUE; }
-"do" { return DO; }
-"for" { return FOR; }
-"while" { return WHILE; }
-
-"if" { return IF; }
-"else" { return ELSE; }
-"switch" { return ES2_reserved_ES3_keyword(context, SWITCH); }
-"case" { return ES2_ident_ES3_keyword(context, CASE); }
-"default" { return ES2_reserved_ES3_keyword(context, DEFAULT); }
-
-"centroid" { return ES2_ident_ES3_keyword(context, CENTROID); }
-"flat" { return ES2_reserved_ES3_keyword(context, FLAT); }
-"smooth" { return ES2_ident_ES3_keyword(context, SMOOTH); }
-
-"in" { return IN_QUAL; }
-"out" { return OUT_QUAL; }
-"inout" { return INOUT_QUAL; }
-"shared" { return ES2_and_ES3_ident_ES3_1_keyword(context, SHARED); }
-
-"float" { return FLOAT_TYPE; }
-"int" { return INT_TYPE; }
-"uint" { return ES2_ident_ES3_keyword(context, UINT_TYPE); }
-"void" { return VOID_TYPE; }
-"bool" { return BOOL_TYPE; }
-"true" { yylval->lex.b = true; return BOOLCONSTANT; }
-"false" { yylval->lex.b = false; return BOOLCONSTANT; }
-
-"discard" { return DISCARD; }
-"return" { return RETURN; }
-
-"mat2" { return MATRIX2; }
-"mat3" { return MATRIX3; }
-"mat4" { return MATRIX4; }
-
-"mat2x2" { return ES2_ident_ES3_keyword(context, MATRIX2); }
-"mat3x3" { return ES2_ident_ES3_keyword(context, MATRIX3); }
-"mat4x4" { return ES2_ident_ES3_keyword(context, MATRIX4); }
-
-"mat2x3" { return ES2_ident_ES3_keyword(context, MATRIX2x3); }
-"mat3x2" { return ES2_ident_ES3_keyword(context, MATRIX3x2); }
-"mat2x4" { return ES2_ident_ES3_keyword(context, MATRIX2x4); }
-"mat4x2" { return ES2_ident_ES3_keyword(context, MATRIX4x2); }
-"mat3x4" { return ES2_ident_ES3_keyword(context, MATRIX3x4); }
-"mat4x3" { return ES2_ident_ES3_keyword(context, MATRIX4x3); }
-
-"vec2" { return VEC2; }
-"vec3" { return VEC3; }
-"vec4" { return VEC4; }
-"ivec2" { return IVEC2; }
-"ivec3" { return IVEC3; }
-"ivec4" { return IVEC4; }
-"bvec2" { return BVEC2; }
-"bvec3" { return BVEC3; }
-"bvec4" { return BVEC4; }
-"uvec2" { return ES2_ident_ES3_keyword(context, UVEC2); }
-"uvec3" { return ES2_ident_ES3_keyword(context, UVEC3); }
-"uvec4" { return ES2_ident_ES3_keyword(context, UVEC4); }
-
-"sampler2D" { return SAMPLER2D; }
-"samplerCube" { return SAMPLERCUBE; }
-"samplerExternalOES" { return SAMPLER_EXTERNAL_OES; }
-"sampler3D" { return ES2_reserved_ES3_keyword(context, SAMPLER3D); }
-"sampler3DRect" { return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); }
-"sampler2DRect" { return SAMPLER2DRECT; }
-"sampler2DArray" { return ES2_ident_ES3_keyword(context, SAMPLER2DARRAY); }
-"sampler2DMS" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, SAMPLER2DMS); }
-"isampler2D" { return ES2_ident_ES3_keyword(context, ISAMPLER2D); }
-"isampler3D" { return ES2_ident_ES3_keyword(context, ISAMPLER3D); }
-"isamplerCube" { return ES2_ident_ES3_keyword(context, ISAMPLERCUBE); }
-"isampler2DArray" { return ES2_ident_ES3_keyword(context, ISAMPLER2DARRAY); }
-"isampler2DMS" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, ISAMPLER2DMS); }
-"usampler2D" { return ES2_ident_ES3_keyword(context, USAMPLER2D); }
-"usampler3D" { return ES2_ident_ES3_keyword(context, USAMPLER3D); }
-"usamplerCube" { return ES2_ident_ES3_keyword(context, USAMPLERCUBE); }
-"usampler2DArray" { return ES2_ident_ES3_keyword(context, USAMPLER2DARRAY); }
-"usampler2DMS" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, USAMPLER2DMS); }
-"sampler2DShadow" { return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); }
-"samplerCubeShadow" { return ES2_ident_ES3_keyword(context, SAMPLERCUBESHADOW); }
-"sampler2DArrayShadow" { return ES2_ident_ES3_keyword(context, SAMPLER2DARRAYSHADOW); }
-"__samplerExternal2DY2YEXT" { return ES3_extension_keyword_else_ident(context, TExtension::EXT_YUV_target, SAMPLEREXTERNAL2DY2YEXT); }
-
-"struct" { return STRUCT; }
-
-"layout" { return ES2_ident_ES3_keyword_multiview_keyword(context, LAYOUT); }
-
-"yuvCscStandardEXT" { return ES3_extension_keyword_else_ident(context, TExtension::EXT_YUV_target, YUVCSCSTANDARDEXT); }
-"itu_601" { return yuvcscstandardext_constant(context); }
-"itu_601_full_range" { return yuvcscstandardext_constant(context); }
-"itu_709" { return yuvcscstandardext_constant(context); }
-
-"image2D" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, IMAGE2D); }
-"iimage2D" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, IIMAGE2D); }
-"uimage2D" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, UIMAGE2D); }
-"image2DArray" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, IMAGE2DARRAY); }
-"iimage2DArray" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, IIMAGE2DARRAY); }
-"uimage2DArray" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, UIMAGE2DARRAY); }
-"image3D" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, IMAGE3D); }
-"uimage3D" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, UIMAGE3D); }
-"iimage3D" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, IIMAGE3D); }
-"iimageCube" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, IIMAGECUBE); }
-"uimageCube" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, UIMAGECUBE); }
-"imageCube" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, IMAGECUBE); }
-"readonly" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, READONLY); }
-"writeonly" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, WRITEONLY); }
-"coherent" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, COHERENT); }
-"restrict" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, RESTRICT); }
-"volatile" { return ES2_and_ES3_reserved_ES3_1_keyword(context, VOLATILE); }
-"atomic_uint" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, ATOMICUINT); }
-
- /* Reserved keywords for GLSL ES 3.00 that are not reserved for GLSL ES 1.00 */
-"resource" |
-"noperspective" |
-"patch" |
-"sample" |
-"subroutine" |
-"common" |
-"partition" |
-"active" |
-
-"filter" |
-"image1D" |
-"iimage1D" |
-"uimage1D" |
-"image1DArray" |
-"iimage1DArray" |
-"uimage1DArray" |
-"image1DShadow" |
-"image2DShadow" |
-"image1DArrayShadow" |
-"image2DArrayShadow" |
-"imageBuffer" |
-"iimageBuffer" |
-"uimageBuffer" |
-
-"sampler1DArray" |
-"sampler1DArrayShadow" |
-"isampler1D" |
-"isampler1DArray" |
-"usampler1D" |
-"usampler1DArray" |
-"isampler2DRect" |
-"usampler2DRect" |
-"samplerBuffer" |
-"isamplerBuffer" |
-"usamplerBuffer" |
-"sampler2DMSArray" |
-"isampler2DMSArray" |
-"usampler2DMSArray" {
- if (context->getShaderVersion() < 300) {
- yylval->lex.string = NewPoolTString(yytext);
- return check_type(yyscanner);
- }
- return reserved_word(yyscanner);
-}
-
- /* Reserved keywords in GLSL ES 1.00 that are not reserved in GLSL ES 3.00 */
-"packed" {
- if (context->getShaderVersion() >= 300)
- {
- yylval->lex.string = NewPoolTString(yytext);
- return check_type(yyscanner);
- }
-
- return reserved_word(yyscanner);
-}
-
- /* Reserved keywords */
-"asm" |
-
-"class" |
-"union" |
-"enum" |
-"typedef" |
-"template" |
-"this" |
-
-"goto" |
-
-"inline" |
-"noinline" |
-"public" |
-"static" |
-"extern" |
-"external" |
-"interface" |
-
-"long" |
-"short" |
-"double" |
-"half" |
-"fixed" |
-"unsigned" |
-"superp" |
-
-"input" |
-"output" |
-
-"hvec2" |
-"hvec3" |
-"hvec4" |
-"dvec2" |
-"dvec3" |
-"dvec4" |
-"fvec2" |
-"fvec3" |
-"fvec4" |
-
-"sampler1D" |
-"sampler1DShadow" |
-"sampler2DRectShadow" |
-
-"sizeof" |
-"cast" |
-
-"namespace" |
-"using" { return reserved_word(yyscanner); }
-
-{L}({L}|{D})* {
- yylval->lex.string = NewPoolTString(yytext);
- return check_type(yyscanner);
-}
-
-0[xX]{H}+ { return int_constant(context); }
-0{O}+ { return int_constant(context); }
-{D}+ { return int_constant(context); }
-
-0[xX]{H}+[uU] { return uint_constant(context); }
-0{O}+[uU] { return uint_constant(context); }
-{D}+[uU] { return uint_constant(context); }
-
-{D}+{E} { return float_constant(yyscanner); }
-{D}+"."{D}*({E})? { return float_constant(yyscanner); }
-"."{D}+({E})? { return float_constant(yyscanner); }
-
-{D}+{E}[fF] { return floatsuffix_check(context); }
-{D}+"."{D}*({E})?[fF] { return floatsuffix_check(context); }
-"."{D}+({E})?[fF] { return floatsuffix_check(context); }
-
-"+=" { return ADD_ASSIGN; }
-"-=" { return SUB_ASSIGN; }
-"*=" { return MUL_ASSIGN; }
-"/=" { return DIV_ASSIGN; }
-"%=" { return MOD_ASSIGN; }
-"<<=" { return LEFT_ASSIGN; }
-">>=" { return RIGHT_ASSIGN; }
-"&=" { return AND_ASSIGN; }
-"^=" { return XOR_ASSIGN; }
-"|=" { return OR_ASSIGN; }
-
-"++" { return INC_OP; }
-"--" { return DEC_OP; }
-"&&" { return AND_OP; }
-"||" { return OR_OP; }
-"^^" { return XOR_OP; }
-"<=" { return LE_OP; }
-">=" { return GE_OP; }
-"==" { return EQ_OP; }
-"!=" { return NE_OP; }
-"<<" { return LEFT_OP; }
-">>" { return RIGHT_OP; }
-";" { return SEMICOLON; }
-("{"|"<%") { return LEFT_BRACE; }
-("}"|"%>") { return RIGHT_BRACE; }
-"," { return COMMA; }
-":" { return COLON; }
-"=" { return EQUAL; }
-"(" { return LEFT_PAREN; }
-")" { return RIGHT_PAREN; }
-("["|"<:") { return LEFT_BRACKET; }
-("]"|":>") { return RIGHT_BRACKET; }
-"." { BEGIN(FIELDS); return DOT; }
-"!" { return BANG; }
-"-" { return DASH; }
-"~" { return TILDE; }
-"+" { return PLUS; }
-"*" { return STAR; }
-"/" { return SLASH; }
-"%" { return PERCENT; }
-"<" { return LEFT_ANGLE; }
-">" { return RIGHT_ANGLE; }
-"|" { return VERTICAL_BAR; }
-"^" { return CARET; }
-"&" { return AMPERSAND; }
-"?" { return QUESTION; }
-
-<FIELDS>{L}({L}|{D})* {
- BEGIN(INITIAL);
- yylval->lex.string = NewPoolTString(yytext);
- return FIELD_SELECTION;
-}
-<FIELDS>[ \t\v\f\r] {}
-<FIELDS>. {
- yyextra->error(*yylloc, "Illegal character at fieldname start", yytext);
- return 0;
-}
-
-[ \t\v\n\f\r] { }
-<*><<EOF>> { yyterminate(); }
-<*>. { assert(false); return 0; }
-
-%%
-
-yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
- pp::Token token;
- yyget_extra(yyscanner)->getPreprocessor().lex(&token);
- yy_size_t len = token.type == 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;
- TSymbol* symbol = yyextra->symbolTable.find(yytext, yyextra->getShaderVersion());
- if (symbol && symbol->isVariable()) {
- TVariable* variable = static_cast<TVariable*>(symbol);
- if (variable->isUserType()) {
- 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 = NewPoolTString(yytext);
- 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 = NewPoolTString(yytext);
- return check_type(yyscanner);
- }
-
- return token;
-}
-
-int ES2_ident_ES3_keyword_multiview_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
- // except when multiview extension is enabled
- if (context->getShaderVersion() < 300 && !context->isExtensionEnabled(TExtension::OVR_multiview))
- {
- yylval->lex.string = NewPoolTString(yytext);
- 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 = NewPoolTString(yytext);
- return check_type(yyscanner);
- }
-
- return token;
-}
-
-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 = NewPoolTString(yytext);
- 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 = NewPoolTString(yytext);
- return YUVCSCSTANDARDEXTCONSTANT;
- }
-
- yylval->lex.string = NewPoolTString(yytext);
- 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.
- 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/src/3rdparty/angle/src/compiler/translator/glslang.y b/src/3rdparty/angle/src/compiler/translator/glslang.y
deleted file mode 100644
index 3e506caac8..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/glslang.y
+++ /dev/null
@@ -1,1468 +0,0 @@
-/*
-//
-// 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 Yacc grammar for GLSL ES.
-Based on ANSI C Yacc grammar:
-http://www.lysator.liu.se/c/ANSI-C-grammar-y.html
-
-IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
-WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
-*/
-
-%{
-//
-// 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/Cache.h"
-#include "compiler/translator/SymbolTable.h"
-#include "compiler/translator/ParseContext.h"
-#include "GLSLANG/ShaderLang.h"
-
-#define YYENABLE_NLS 0
-
-using namespace sh;
-
-%}
-%expect 1 /* One shift reduce conflict because of if | else */
-%parse-param {TParseContext* context}
-%param {void *scanner}
-%define api.pure full
-%locations
-
-%code requires {
-#define YYLTYPE TSourceLoc
-#define YYLTYPE_IS_DECLARED 1
-}
-
-%union {
- struct {
- union {
- TString *string;
- float f;
- int i;
- unsigned int u;
- bool b;
- };
- TSymbol* symbol;
- } lex;
- struct {
- TOperator op;
- union {
- TIntermNode *intermNode;
- TIntermNodePair nodePair;
- TIntermFunctionCallOrMethod callOrMethodPair;
- 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;
- TParameter param;
- TField *field;
- TFieldList *fieldList;
- TQualifierWrapperBase *qualifierWrapper;
- TTypeQualifierBuilder *typeQualifierBuilder;
- };
- } interm;
-}
-
-%{
-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) { \
- if (context->getShaderType() != GL_VERTEX_SHADER) { \
- context->error(L, " supported in vertex shaders only", S); \
- } \
-}
-
-#define COMPUTE_ONLY(S, L) { \
- if (context->getShaderType() != GL_COMPUTE_SHADER) { \
- context->error(L, " supported in compute shaders only", S); \
- } \
-}
-
-#define ES2_ONLY(S, L) { \
- if (context->getShaderVersion() != 100) { \
- context->error(L, " supported in GLSL ES 1.00 only", S); \
- } \
-}
-
-#define ES3_OR_NEWER(TOKEN, LINE, REASON) { \
- if (context->getShaderVersion() < 300) { \
- context->error(LINE, REASON " supported in GLSL ES 3.00 and above only", TOKEN); \
- } \
-}
-
-#define ES3_OR_NEWER_OR_MULTIVIEW(TOKEN, LINE, REASON) { \
- if (context->getShaderVersion() < 300 && !context->isExtensionEnabled(TExtension::OVR_multiview)) { \
- context->error(LINE, REASON " supported in GLSL ES 3.00 and above only", TOKEN); \
- } \
-}
-
-#define ES3_1_ONLY(TOKEN, LINE, REASON) { \
- if (context->getShaderVersion() != 310) { \
- context->error(LINE, REASON " supported in GLSL ES 3.10 only", TOKEN); \
- } \
-}
-%}
-
-%token <lex> INVARIANT HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION
-%token <lex> ATTRIBUTE CONST_QUAL BOOL_TYPE FLOAT_TYPE INT_TYPE UINT_TYPE
-%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
-%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 VEC2 VEC3 VEC4 UVEC2 UVEC3 UVEC4
-%token <lex> MATRIX2 MATRIX3 MATRIX4 IN_QUAL OUT_QUAL INOUT_QUAL UNIFORM BUFFER VARYING
-%token <lex> MATRIX2x3 MATRIX3x2 MATRIX2x4 MATRIX4x2 MATRIX3x4 MATRIX4x3
-%token <lex> CENTROID FLAT SMOOTH
-%token <lex> READONLY WRITEONLY COHERENT RESTRICT VOLATILE SHARED
-%token <lex> STRUCT VOID_TYPE WHILE
-%token <lex> SAMPLER2D SAMPLERCUBE SAMPLER_EXTERNAL_OES SAMPLER2DRECT SAMPLER2DARRAY
-%token <lex> ISAMPLER2D ISAMPLER3D ISAMPLERCUBE ISAMPLER2DARRAY
-%token <lex> USAMPLER2D USAMPLER3D USAMPLERCUBE USAMPLER2DARRAY
-%token <lex> SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS
-%token <lex> SAMPLER3D SAMPLER3DRECT SAMPLER2DSHADOW SAMPLERCUBESHADOW SAMPLER2DARRAYSHADOW
-%token <lex> SAMPLEREXTERNAL2DY2YEXT
-%token <lex> IMAGE2D IIMAGE2D UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY
-%token <lex> IMAGECUBE IIMAGECUBE UIMAGECUBE
-%token <lex> ATOMICUINT
-%token <lex> LAYOUT
-%token <lex> YUVCSCSTANDARDEXT YUVCSCSTANDARDEXTCONSTANT
-
-%token <lex> IDENTIFIER TYPE_NAME FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT
-%token <lex> FIELD_SELECTION
-%token <lex> LEFT_OP RIGHT_OP
-%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
-%token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
-%token <lex> MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN
-%token <lex> SUB_ASSIGN
-
-%token <lex> LEFT_PAREN RIGHT_PAREN LEFT_BRACKET RIGHT_BRACKET LEFT_BRACE RIGHT_BRACE DOT
-%token <lex> COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT
-%token <lex> LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION
-
-%type <lex> identifier
-%type <interm.op> assignment_operator unary_operator
-%type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression
-%type <interm.intermTypedNode> expression integer_expression assignment_expression
-%type <interm.intermTypedNode> unary_expression multiplicative_expression additive_expression
-%type <interm.intermTypedNode> relational_expression equality_expression
-%type <interm.intermTypedNode> conditional_expression constant_expression
-%type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression
-%type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression
-%type <interm.intermTypedNode> function_call initializer
-
-%type <interm.intermNode> condition conditionopt
-%type <interm.intermBlock> translation_unit
-%type <interm.intermNode> function_definition statement simple_statement
-%type <interm.intermBlock> statement_list compound_statement_with_scope compound_statement_no_new_scope
-%type <interm.intermNode> declaration_statement selection_statement expression_statement
-%type <interm.intermNode> declaration external_declaration
-%type <interm.intermNode> for_init_statement
-%type <interm.nodePair> selection_rest_statement for_rest_statement
-%type <interm.intermSwitch> switch_statement
-%type <interm.intermCase> case_label
-%type <interm.intermNode> iteration_statement jump_statement statement_no_new_scope statement_with_scope
-%type <interm> single_declaration init_declarator_list
-
-%type <interm.param> parameter_declaration parameter_declarator parameter_type_specifier
-%type <interm.layoutQualifier> layout_qualifier_id_list layout_qualifier_id
-
-// Note: array_specifier guaranteed to be non-null.
-%type <interm.arraySizes> array_specifier
-
-%type <interm.type> fully_specified_type type_specifier
-
-%type <interm.precision> precision_qualifier
-%type <interm.layoutQualifier> layout_qualifier
-%type <interm.qualifier> interpolation_qualifier
-%type <interm.qualifierWrapper> storage_qualifier single_type_qualifier invariant_qualifier
-%type <interm.typeQualifierBuilder> type_qualifier
-
-%type <interm.typeSpecifierNonArray> type_specifier_nonarray struct_specifier
-%type <interm.type> type_specifier_no_prec
-%type <interm.field> struct_declarator
-%type <interm.fieldList> struct_declarator_list struct_declaration struct_declaration_list
-%type <interm.function> function_header function_declarator function_identifier
-%type <interm.function> function_header_with_parameters function_call_header
-%type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype
-%type <interm> function_call_or_method
-
-%type <lex> enter_struct
-
-%start translation_unit
-%%
-
-identifier
- : IDENTIFIER
- | TYPE_NAME
-
-variable_identifier
- : IDENTIFIER {
- // The symbol table search was done in the lexical phase
- $$ = context->parseVariableIdentifier(@1, $1.string, $1.symbol);
-
- // don't delete $1.string, it's used by error recovery, and the pool
- // pop will reclaim the memory
- }
- ;
-
-primary_expression
- : variable_identifier {
- $$ = $1;
- }
- | INTCONSTANT {
- TConstantUnion *unionArray = new TConstantUnion[1];
- unionArray->setIConst($1.i);
- $$ = context->addScalarLiteral(unionArray, @1);
- }
- | UINTCONSTANT {
- TConstantUnion *unionArray = new TConstantUnion[1];
- unionArray->setUConst($1.u);
- $$ = context->addScalarLiteral(unionArray, @1);
- }
- | FLOATCONSTANT {
- TConstantUnion *unionArray = new TConstantUnion[1];
- unionArray->setFConst($1.f);
- $$ = context->addScalarLiteral(unionArray, @1);
- }
- | BOOLCONSTANT {
- TConstantUnion *unionArray = new TConstantUnion[1];
- unionArray->setBConst($1.b);
- $$ = context->addScalarLiteral(unionArray, @1);
- }
- | YUVCSCSTANDARDEXTCONSTANT {
- if (!context->checkCanUseExtension(@1, TExtension::EXT_YUV_target))
- {
- context->error(@1, "unsupported value", $1.string->c_str());
- }
- TConstantUnion *unionArray = new TConstantUnion[1];
- unionArray->setYuvCscStandardEXTConst(getYuvCscStandardEXT($1.string->c_str()));
- $$ = context->addScalarLiteral(unionArray, @1);
- }
- | LEFT_PAREN expression RIGHT_PAREN {
- $$ = $2;
- }
- ;
-
-postfix_expression
- : primary_expression {
- $$ = $1;
- }
- | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET {
- $$ = context->addIndexExpression($1, @2, $3);
- }
- | function_call {
- $$ = $1;
- }
- | postfix_expression DOT FIELD_SELECTION {
- $$ = context->addFieldSelectionExpression($1, @2, *$3.string, @3);
- }
- | postfix_expression INC_OP {
- $$ = context->addUnaryMathLValue(EOpPostIncrement, $1, @2);
- }
- | postfix_expression DEC_OP {
- $$ = context->addUnaryMathLValue(EOpPostDecrement, $1, @2);
- }
- ;
-
-integer_expression
- : expression {
- context->checkIsScalarInteger($1, "[]");
- $$ = $1;
- }
- ;
-
-function_call
- : function_call_or_method {
- $$ = context->addFunctionCallOrMethod($1.function, $1.callOrMethodPair.arguments, $1.callOrMethodPair.thisNode, @1);
- }
- ;
-
-function_call_or_method
- : function_call_generic {
- $$ = $1;
- $$.callOrMethodPair.thisNode = nullptr;
- }
- | postfix_expression DOT function_call_generic {
- ES3_OR_NEWER("", @3, "methods");
- $$ = $3;
- $$.callOrMethodPair.thisNode = $1;
- }
- ;
-
-function_call_generic
- : function_call_header_with_parameters RIGHT_PAREN {
- $$ = $1;
- }
- | function_call_header_no_parameters RIGHT_PAREN {
- $$ = $1;
- }
- ;
-
-function_call_header_no_parameters
- : function_call_header VOID_TYPE {
- $$.function = $1;
- $$.callOrMethodPair.arguments = context->createEmptyArgumentsList();
- }
- | function_call_header {
- $$.function = $1;
- $$.callOrMethodPair.arguments = context->createEmptyArgumentsList();
- }
- ;
-
-function_call_header_with_parameters
- : function_call_header assignment_expression {
- $$.callOrMethodPair.arguments = context->createEmptyArgumentsList();
- $$.function = $1;
- $$.callOrMethodPair.arguments->push_back($2);
- }
- | function_call_header_with_parameters COMMA assignment_expression {
- $$.function = $1.function;
- $$.callOrMethodPair.arguments->push_back($3);
- }
- ;
-
-function_call_header
- : function_identifier LEFT_PAREN {
- $$ = $1;
- }
- ;
-
-// Grammar Note: Constructors look like functions, but are recognized as types.
-
-function_identifier
- : type_specifier_no_prec {
- $$ = context->addConstructorFunc($1);
- }
- | IDENTIFIER {
- $$ = context->addNonConstructorFunc($1.string, @1);
- }
- | FIELD_SELECTION {
- $$ = context->addNonConstructorFunc($1.string, @1);
- }
- ;
-
-unary_expression
- : postfix_expression {
- $$ = $1;
- }
- | INC_OP unary_expression {
- $$ = context->addUnaryMathLValue(EOpPreIncrement, $2, @1);
- }
- | DEC_OP unary_expression {
- $$ = context->addUnaryMathLValue(EOpPreDecrement, $2, @1);
- }
- | unary_operator unary_expression {
- $$ = context->addUnaryMath($1, $2, @1);
- }
- ;
-// Grammar Note: No traditional style type casts.
-
-unary_operator
- : PLUS { $$ = EOpPositive; }
- | DASH { $$ = EOpNegative; }
- | BANG { $$ = EOpLogicalNot; }
- | TILDE {
- ES3_OR_NEWER("~", @$, "bit-wise operator");
- $$ = EOpBitwiseNot;
- }
- ;
-// Grammar Note: No '*' or '&' unary ops. Pointers are not supported.
-
-multiplicative_expression
- : unary_expression { $$ = $1; }
- | multiplicative_expression STAR unary_expression {
- $$ = context->addBinaryMath(EOpMul, $1, $3, @2);
- }
- | multiplicative_expression SLASH unary_expression {
- $$ = context->addBinaryMath(EOpDiv, $1, $3, @2);
- }
- | multiplicative_expression PERCENT unary_expression {
- ES3_OR_NEWER("%", @2, "integer modulus operator");
- $$ = context->addBinaryMath(EOpIMod, $1, $3, @2);
- }
- ;
-
-additive_expression
- : multiplicative_expression { $$ = $1; }
- | additive_expression PLUS multiplicative_expression {
- $$ = context->addBinaryMath(EOpAdd, $1, $3, @2);
- }
- | additive_expression DASH multiplicative_expression {
- $$ = context->addBinaryMath(EOpSub, $1, $3, @2);
- }
- ;
-
-shift_expression
- : additive_expression { $$ = $1; }
- | shift_expression LEFT_OP additive_expression {
- ES3_OR_NEWER("<<", @2, "bit-wise operator");
- $$ = context->addBinaryMath(EOpBitShiftLeft, $1, $3, @2);
- }
- | shift_expression RIGHT_OP additive_expression {
- ES3_OR_NEWER(">>", @2, "bit-wise operator");
- $$ = context->addBinaryMath(EOpBitShiftRight, $1, $3, @2);
- }
- ;
-
-relational_expression
- : shift_expression { $$ = $1; }
- | relational_expression LEFT_ANGLE shift_expression {
- $$ = context->addBinaryMathBooleanResult(EOpLessThan, $1, $3, @2);
- }
- | relational_expression RIGHT_ANGLE shift_expression {
- $$ = context->addBinaryMathBooleanResult(EOpGreaterThan, $1, $3, @2);
- }
- | relational_expression LE_OP shift_expression {
- $$ = context->addBinaryMathBooleanResult(EOpLessThanEqual, $1, $3, @2);
- }
- | relational_expression GE_OP shift_expression {
- $$ = context->addBinaryMathBooleanResult(EOpGreaterThanEqual, $1, $3, @2);
- }
- ;
-
-equality_expression
- : relational_expression { $$ = $1; }
- | equality_expression EQ_OP relational_expression {
- $$ = context->addBinaryMathBooleanResult(EOpEqual, $1, $3, @2);
- }
- | equality_expression NE_OP relational_expression {
- $$ = context->addBinaryMathBooleanResult(EOpNotEqual, $1, $3, @2);
- }
- ;
-
-and_expression
- : equality_expression { $$ = $1; }
- | and_expression AMPERSAND equality_expression {
- ES3_OR_NEWER("&", @2, "bit-wise operator");
- $$ = context->addBinaryMath(EOpBitwiseAnd, $1, $3, @2);
- }
- ;
-
-exclusive_or_expression
- : and_expression { $$ = $1; }
- | exclusive_or_expression CARET and_expression {
- ES3_OR_NEWER("^", @2, "bit-wise operator");
- $$ = context->addBinaryMath(EOpBitwiseXor, $1, $3, @2);
- }
- ;
-
-inclusive_or_expression
- : exclusive_or_expression { $$ = $1; }
- | inclusive_or_expression VERTICAL_BAR exclusive_or_expression {
- ES3_OR_NEWER("|", @2, "bit-wise operator");
- $$ = context->addBinaryMath(EOpBitwiseOr, $1, $3, @2);
- }
- ;
-
-logical_and_expression
- : inclusive_or_expression { $$ = $1; }
- | logical_and_expression AND_OP inclusive_or_expression {
- $$ = context->addBinaryMathBooleanResult(EOpLogicalAnd, $1, $3, @2);
- }
- ;
-
-logical_xor_expression
- : logical_and_expression { $$ = $1; }
- | logical_xor_expression XOR_OP logical_and_expression {
- $$ = context->addBinaryMathBooleanResult(EOpLogicalXor, $1, $3, @2);
- }
- ;
-
-logical_or_expression
- : logical_xor_expression { $$ = $1; }
- | logical_or_expression OR_OP logical_xor_expression {
- $$ = context->addBinaryMathBooleanResult(EOpLogicalOr, $1, $3, @2);
- }
- ;
-
-conditional_expression
- : logical_or_expression { $$ = $1; }
- | logical_or_expression QUESTION expression COLON assignment_expression {
- $$ = context->addTernarySelection($1, $3, $5, @2);
- }
- ;
-
-assignment_expression
- : conditional_expression { $$ = $1; }
- | unary_expression assignment_operator assignment_expression {
- $$ = context->addAssign($2, $1, $3, @2);
- }
- ;
-
-assignment_operator
- : EQUAL { $$ = EOpAssign; }
- | MUL_ASSIGN { $$ = EOpMulAssign; }
- | DIV_ASSIGN { $$ = EOpDivAssign; }
- | MOD_ASSIGN {
- ES3_OR_NEWER("%=", @$, "integer modulus operator");
- $$ = EOpIModAssign;
- }
- | ADD_ASSIGN { $$ = EOpAddAssign; }
- | SUB_ASSIGN { $$ = EOpSubAssign; }
- | LEFT_ASSIGN {
- ES3_OR_NEWER("<<=", @$, "bit-wise operator");
- $$ = EOpBitShiftLeftAssign;
- }
- | RIGHT_ASSIGN {
- ES3_OR_NEWER(">>=", @$, "bit-wise operator");
- $$ = EOpBitShiftRightAssign;
- }
- | AND_ASSIGN {
- ES3_OR_NEWER("&=", @$, "bit-wise operator");
- $$ = EOpBitwiseAndAssign;
- }
- | XOR_ASSIGN {
- ES3_OR_NEWER("^=", @$, "bit-wise operator");
- $$ = EOpBitwiseXorAssign;
- }
- | OR_ASSIGN {
- ES3_OR_NEWER("|=", @$, "bit-wise operator");
- $$ = EOpBitwiseOrAssign;
- }
- ;
-
-expression
- : assignment_expression {
- $$ = $1;
- }
- | expression COMMA assignment_expression {
- $$ = context->addComma($1, $3, @2);
- }
- ;
-
-constant_expression
- : conditional_expression {
- context->checkIsConst($1);
- $$ = $1;
- }
- ;
-
-enter_struct
- : IDENTIFIER LEFT_BRACE {
- context->enterStructDeclaration(@1, *$1.string);
- $$ = $1;
- }
- ;
-
-declaration
- : function_prototype SEMICOLON {
- $$ = context->addFunctionPrototypeDeclaration(*($1.function), @1);
- }
- | init_declarator_list SEMICOLON {
- $$ = $1.intermDeclaration;
- }
- | PRECISION precision_qualifier type_specifier_no_prec SEMICOLON {
- context->parseDefaultPrecisionQualifier($2, $3, @1);
- $$ = nullptr;
- }
- | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE SEMICOLON {
- ES3_OR_NEWER($2.string->c_str(), @1, "interface blocks");
- $$ = context->addInterfaceBlock(*$1, @2, *$2.string, $3, NULL, @$, NULL, @$);
- }
- | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER SEMICOLON {
- ES3_OR_NEWER($2.string->c_str(), @1, "interface blocks");
- $$ = context->addInterfaceBlock(*$1, @2, *$2.string, $3, $5.string, @5, NULL, @$);
- }
- | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET SEMICOLON {
- ES3_OR_NEWER($2.string->c_str(), @1, "interface blocks");
- $$ = context->addInterfaceBlock(*$1, @2, *$2.string, $3, $5.string, @5, $7, @6);
- }
- | type_qualifier SEMICOLON {
- context->parseGlobalLayoutQualifier(*$1);
- $$ = nullptr;
- }
- | type_qualifier IDENTIFIER SEMICOLON // e.g. to qualify an existing variable as invariant
- {
- $$ = context->parseInvariantDeclaration(*$1, @2, $2.string, $2.symbol);
- }
- ;
-
-function_prototype
- : function_declarator RIGHT_PAREN {
- $$.function = context->parseFunctionDeclarator(@2, $1);
- context->exitFunctionDeclaration();
- }
- ;
-
-function_declarator
- : function_header {
- $$ = $1;
- }
- | function_header_with_parameters {
- $$ = $1;
- }
- ;
-
-
-function_header_with_parameters
- : function_header parameter_declaration {
- // Add the parameter
- $$ = $1;
- if ($2.type->getBasicType() != EbtVoid)
- {
- $1->addParameter($2.turnToConst());
- }
- }
- | function_header_with_parameters COMMA parameter_declaration {
- $$ = $1;
- // Only first parameter of one-parameter functions can be void
- // The check for named parameters not being void is done in parameter_declarator
- if ($3.type->getBasicType() == EbtVoid)
- {
- // This parameter > first is void
- context->error(@2, "cannot be a parameter type except for '(void)'", "void");
- }
- else
- {
- $1->addParameter($3.turnToConst());
- }
- }
- ;
-
-function_header
- : fully_specified_type IDENTIFIER LEFT_PAREN {
- $$ = context->parseFunctionHeader($1, $2.string, @2);
-
- context->symbolTable.push();
- context->enterFunctionDeclaration();
- }
- ;
-
-parameter_declarator
- // Type + name
- : type_specifier identifier {
- $$ = context->parseParameterDeclarator($1, $2.string, @2);
- }
- | type_specifier identifier array_specifier {
- $$ = context->parseParameterArrayDeclarator($2.string, @2, *($3), @3, &$1);
- }
- ;
-
-parameter_declaration
- : type_qualifier parameter_declarator {
- $$ = $2;
- context->checkIsParameterQualifierValid(@2, *$1, $2.type);
- }
- | parameter_declarator {
- $$ = $1;
- $$.type->setQualifier(EvqIn);
- }
- | type_qualifier parameter_type_specifier {
- $$ = $2;
- context->checkIsParameterQualifierValid(@2, *$1, $2.type);
- }
- | parameter_type_specifier {
- $$ = $1;
- $$.type->setQualifier(EvqIn);
- }
- ;
-
-parameter_type_specifier
- : type_specifier {
- TParameter param = { 0, new TType($1) };
- $$ = param;
- }
- ;
-
-init_declarator_list
- : single_declaration {
- $$ = $1;
- }
- | init_declarator_list COMMA identifier {
- $$ = $1;
- context->parseDeclarator($$.type, @3, *$3.string, $$.intermDeclaration);
- }
- | init_declarator_list COMMA identifier array_specifier {
- $$ = $1;
- context->parseArrayDeclarator($$.type, @3, *$3.string, @4, *($4), $$.intermDeclaration);
- }
- | init_declarator_list COMMA identifier array_specifier EQUAL initializer {
- ES3_OR_NEWER("=", @5, "first-class arrays (array initializer)");
- $$ = $1;
- context->parseArrayInitDeclarator($$.type, @3, *$3.string, @4, *($4), @5, $6, $$.intermDeclaration);
- }
- | init_declarator_list COMMA identifier EQUAL initializer {
- $$ = $1;
- context->parseInitDeclarator($$.type, @3, *$3.string, @4, $5, $$.intermDeclaration);
- }
- ;
-
-single_declaration
- : fully_specified_type {
- $$.type = $1;
- $$.intermDeclaration = context->parseSingleDeclaration($$.type, @1, "");
- }
- | fully_specified_type identifier {
- $$.type = $1;
- $$.intermDeclaration = context->parseSingleDeclaration($$.type, @2, *$2.string);
- }
- | fully_specified_type identifier array_specifier {
- $$.type = $1;
- $$.intermDeclaration = context->parseSingleArrayDeclaration($$.type, @2, *$2.string, @3, *($3));
- }
- | fully_specified_type identifier array_specifier EQUAL initializer {
- ES3_OR_NEWER("[]", @3, "first-class arrays (array initializer)");
- $$.type = $1;
- $$.intermDeclaration = context->parseSingleArrayInitDeclaration($$.type, @2, *$2.string, @3, *($3), @4, $5);
- }
- | fully_specified_type identifier EQUAL initializer {
- $$.type = $1;
- $$.intermDeclaration = context->parseSingleInitDeclaration($$.type, @2, *$2.string, @3, $4);
- }
- ;
-
-fully_specified_type
- : type_specifier {
- context->addFullySpecifiedType(&$1);
- $$ = $1;
- }
- | type_qualifier type_specifier {
- $$ = context->addFullySpecifiedType(*$1, $2);
- }
- ;
-
-interpolation_qualifier
- : SMOOTH {
- $$ = EvqSmooth;
- }
- | FLAT {
- $$ = EvqFlat;
- }
- ;
-
-type_qualifier
- : single_type_qualifier {
- $$ = context->createTypeQualifierBuilder(@1);
- $$->appendQualifier($1);
- }
- | type_qualifier single_type_qualifier {
- $$ = $1;
- $$->appendQualifier($2);
- }
- ;
-
-invariant_qualifier
- : INVARIANT {
- // empty
- }
- ;
-
-single_type_qualifier
- : storage_qualifier {
- context->checkLocalVariableConstStorageQualifier(*$1);
- $$ = $1;
- }
- | layout_qualifier {
- context->checkIsAtGlobalLevel(@1, "layout");
- $$ = new TLayoutQualifierWrapper($1, @1);
- }
- | precision_qualifier {
- $$ = new TPrecisionQualifierWrapper($1, @1);
- }
- | interpolation_qualifier {
- $$ = new TInterpolationQualifierWrapper($1, @1);
- }
- | invariant_qualifier {
- context->checkIsAtGlobalLevel(@1, "invariant");
- $$ = new TInvariantQualifierWrapper(@1);
- }
- ;
-
-
-storage_qualifier
- :
- ATTRIBUTE {
- VERTEX_ONLY("attribute", @1);
- ES2_ONLY("attribute", @1);
- $$ = context->parseGlobalStorageQualifier(EvqAttribute, @1);
- }
- | VARYING {
- ES2_ONLY("varying", @1);
- $$ = context->parseVaryingQualifier(@1);
- }
- | CONST_QUAL {
- $$ = new TStorageQualifierWrapper(EvqConst, @1);
- }
- | IN_QUAL {
- $$ = context->parseInQualifier(@1);
- }
- | OUT_QUAL {
- $$ = context->parseOutQualifier(@1);
- }
- | INOUT_QUAL {
- $$ = context->parseInOutQualifier(@1);
- }
- | CENTROID {
- ES3_OR_NEWER("centroid", @1, "storage qualifier");
- $$ = new TStorageQualifierWrapper(EvqCentroid, @1);
- }
- | UNIFORM {
- $$ = context->parseGlobalStorageQualifier(EvqUniform, @1);
- }
- | BUFFER {
- ES3_1_ONLY("buffer", @1, "storage qualifier");
- $$ = context->parseGlobalStorageQualifier(EvqBuffer, @1);
- }
- | READONLY {
- $$ = new TMemoryQualifierWrapper(EvqReadOnly, @1);
- }
- | WRITEONLY {
- $$ = new TMemoryQualifierWrapper(EvqWriteOnly, @1);
- }
- | COHERENT {
- $$ = new TMemoryQualifierWrapper(EvqCoherent, @1);
- }
- | RESTRICT {
- $$ = new TMemoryQualifierWrapper(EvqRestrict, @1);
- }
- | VOLATILE {
- $$ = new TMemoryQualifierWrapper(EvqVolatile, @1);
- }
- | SHARED {
- COMPUTE_ONLY("shared", @1);
- $$ = context->parseGlobalStorageQualifier(EvqShared, @1);
- }
- ;
-
-type_specifier
- : type_specifier_no_prec {
- $$ = $1;
- $$.precision = context->symbolTable.getDefaultPrecision($1.getBasicType());
- }
- ;
-
-precision_qualifier
- : HIGH_PRECISION {
- $$ = EbpHigh;
- }
- | MEDIUM_PRECISION {
- $$ = EbpMedium;
- }
- | LOW_PRECISION {
- $$ = EbpLow;
- }
- ;
-
-layout_qualifier
- : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN {
- ES3_OR_NEWER_OR_MULTIVIEW("layout", @1, "qualifier");
- $$ = $3;
- }
- ;
-
-layout_qualifier_id_list
- : layout_qualifier_id {
- $$ = $1;
- }
- | layout_qualifier_id_list COMMA layout_qualifier_id {
- $$ = context->joinLayoutQualifiers($1, $3, @3);
- }
- ;
-
-layout_qualifier_id
- : IDENTIFIER {
- $$ = context->parseLayoutQualifier(*$1.string, @1);
- }
- | IDENTIFIER EQUAL INTCONSTANT {
- $$ = context->parseLayoutQualifier(*$1.string, @1, $3.i, @3);
- }
- | IDENTIFIER EQUAL UINTCONSTANT {
- $$ = context->parseLayoutQualifier(*$1.string, @1, $3.i, @3);
- }
- | SHARED {
- $$ = context->parseLayoutQualifier("shared", @1);
- }
- ;
-
-type_specifier_no_prec
- : type_specifier_nonarray {
- $$.initialize($1, (context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary));
- }
- | type_specifier_nonarray array_specifier {
- $$.initialize($1, (context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary));
- $$.setArraySizes($2);
- }
- ;
-
-array_specifier
- : LEFT_BRACKET RIGHT_BRACKET {
- ES3_OR_NEWER("[]", @1, "implicitly sized array");
- $$ = new TVector<unsigned int>();
- $$->push_back(0u);
- }
- | LEFT_BRACKET constant_expression RIGHT_BRACKET {
- $$ = new TVector<unsigned int>();
- unsigned int size = context->checkIsValidArraySize(@1, $2);
- // Make the type an array even if size check failed.
- // This ensures useless error messages regarding a variable's non-arrayness won't follow.
- $$->push_back(size);
- }
- | array_specifier LEFT_BRACKET RIGHT_BRACKET {
- ES3_1_ONLY("[]", @2, "arrays of arrays");
- $$ = $1;
- $$->insert($$->begin(), 0u);
- }
- | array_specifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
- ES3_1_ONLY("[]", @2, "arrays of arrays");
- $$ = $1;
- unsigned int size = context->checkIsValidArraySize(@2, $3);
- // Make the type an array even if size check failed.
- // This ensures useless error messages regarding a variable's non-arrayness won't follow.
- $$->insert($$->begin(), size);
- }
- ;
-
-type_specifier_nonarray
- : VOID_TYPE {
- $$.initialize(EbtVoid, @1);
- }
- | FLOAT_TYPE {
- $$.initialize(EbtFloat, @1);
- }
- | INT_TYPE {
- $$.initialize(EbtInt, @1);
- }
- | UINT_TYPE {
- $$.initialize(EbtUInt, @1);
- }
- | BOOL_TYPE {
- $$.initialize(EbtBool, @1);
- }
- | VEC2 {
- $$.initialize(EbtFloat, @1);
- $$.setAggregate(2);
- }
- | VEC3 {
- $$.initialize(EbtFloat, @1);
- $$.setAggregate(3);
- }
- | VEC4 {
- $$.initialize(EbtFloat, @1);
- $$.setAggregate(4);
- }
- | BVEC2 {
- $$.initialize(EbtBool, @1);
- $$.setAggregate(2);
- }
- | BVEC3 {
- $$.initialize(EbtBool, @1);
- $$.setAggregate(3);
- }
- | BVEC4 {
- $$.initialize(EbtBool, @1);
- $$.setAggregate(4);
- }
- | IVEC2 {
- $$.initialize(EbtInt, @1);
- $$.setAggregate(2);
- }
- | IVEC3 {
- $$.initialize(EbtInt, @1);
- $$.setAggregate(3);
- }
- | IVEC4 {
- $$.initialize(EbtInt, @1);
- $$.setAggregate(4);
- }
- | UVEC2 {
- $$.initialize(EbtUInt, @1);
- $$.setAggregate(2);
- }
- | UVEC3 {
- $$.initialize(EbtUInt, @1);
- $$.setAggregate(3);
- }
- | UVEC4 {
- $$.initialize(EbtUInt, @1);
- $$.setAggregate(4);
- }
- | MATRIX2 {
- $$.initialize(EbtFloat, @1);
- $$.setMatrix(2, 2);
- }
- | MATRIX3 {
- $$.initialize(EbtFloat, @1);
- $$.setMatrix(3, 3);
- }
- | MATRIX4 {
- $$.initialize(EbtFloat, @1);
- $$.setMatrix(4, 4);
- }
- | MATRIX2x3 {
- $$.initialize(EbtFloat, @1);
- $$.setMatrix(2, 3);
- }
- | MATRIX3x2 {
- $$.initialize(EbtFloat, @1);
- $$.setMatrix(3, 2);
- }
- | MATRIX2x4 {
- $$.initialize(EbtFloat, @1);
- $$.setMatrix(2, 4);
- }
- | MATRIX4x2 {
- $$.initialize(EbtFloat, @1);
- $$.setMatrix(4, 2);
- }
- | MATRIX3x4 {
- $$.initialize(EbtFloat, @1);
- $$.setMatrix(3, 4);
- }
- | MATRIX4x3 {
- $$.initialize(EbtFloat, @1);
- $$.setMatrix(4, 3);
- }
- | YUVCSCSTANDARDEXT {
- if (!context->checkCanUseExtension(@1, TExtension::EXT_YUV_target))
- {
- context->error(@1, "unsupported type", "yuvCscStandardEXT");
- }
- $$.initialize(EbtYuvCscStandardEXT, @1);
- }
- | SAMPLER2D {
- $$.initialize(EbtSampler2D, @1);
- }
- | SAMPLER3D {
- $$.initialize(EbtSampler3D, @1);
- }
- | SAMPLERCUBE {
- $$.initialize(EbtSamplerCube, @1);
- }
- | SAMPLER2DARRAY {
- $$.initialize(EbtSampler2DArray, @1);
- }
- | SAMPLER2DMS {
- $$.initialize(EbtSampler2DMS, @1);
- }
- | ISAMPLER2D {
- $$.initialize(EbtISampler2D, @1);
- }
- | ISAMPLER3D {
- $$.initialize(EbtISampler3D, @1);
- }
- | ISAMPLERCUBE {
- $$.initialize(EbtISamplerCube, @1);
- }
- | ISAMPLER2DARRAY {
- $$.initialize(EbtISampler2DArray, @1);
- }
- | ISAMPLER2DMS {
- $$.initialize(EbtISampler2DMS, @1);
- }
- | USAMPLER2D {
- $$.initialize(EbtUSampler2D, @1);
- }
- | USAMPLER3D {
- $$.initialize(EbtUSampler3D, @1);
- }
- | USAMPLERCUBE {
- $$.initialize(EbtUSamplerCube, @1);
- }
- | USAMPLER2DARRAY {
- $$.initialize(EbtUSampler2DArray, @1);
- }
- | USAMPLER2DMS {
- $$.initialize(EbtUSampler2DMS, @1);
- }
- | SAMPLER2DSHADOW {
- $$.initialize(EbtSampler2DShadow, @1);
- }
- | SAMPLERCUBESHADOW {
- $$.initialize(EbtSamplerCubeShadow, @1);
- }
- | SAMPLER2DARRAYSHADOW {
- $$.initialize(EbtSampler2DArrayShadow, @1);
- }
- | SAMPLER_EXTERNAL_OES {
- 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(@1, extensions))
- {
- context->error(@1, "unsupported type", "samplerExternalOES");
- }
- $$.initialize(EbtSamplerExternalOES, @1);
- }
- | SAMPLEREXTERNAL2DY2YEXT {
- if (!context->checkCanUseExtension(@1, TExtension::EXT_YUV_target))
- {
- context->error(@1, "unsupported type", "__samplerExternal2DY2YEXT");
- }
- $$.initialize(EbtSamplerExternal2DY2YEXT, @1);
- }
- | SAMPLER2DRECT {
- if (!context->checkCanUseExtension(@1, TExtension::ARB_texture_rectangle))
- {
- context->error(@1, "unsupported type", "sampler2DRect");
- }
- $$.initialize(EbtSampler2DRect, @1);
- }
- | struct_specifier {
- $$ = $1;
- }
- | IMAGE2D {
- $$.initialize(EbtImage2D, @1);
- }
- | IIMAGE2D {
- $$.initialize(EbtIImage2D, @1);
- }
- | UIMAGE2D {
- $$.initialize(EbtUImage2D, @1);
- }
- | IMAGE3D {
- $$.initialize(EbtImage3D, @1);
- }
- | IIMAGE3D {
- $$.initialize(EbtIImage3D, @1);
- }
- | UIMAGE3D {
- $$.initialize(EbtUImage3D, @1);
- }
- | IMAGE2DARRAY {
- $$.initialize(EbtImage2DArray, @1);
- }
- | IIMAGE2DARRAY {
- $$.initialize(EbtIImage2DArray, @1);
- }
- | UIMAGE2DARRAY {
- $$.initialize(EbtUImage2DArray, @1);
- }
- | IMAGECUBE {
- $$.initialize(EbtImageCube, @1);
- }
- | IIMAGECUBE {
- $$.initialize(EbtIImageCube, @1);
- }
- | UIMAGECUBE {
- $$.initialize(EbtUImageCube, @1);
- }
- | ATOMICUINT {
- $$.initialize(EbtAtomicCounter, @1);
- }
- | TYPE_NAME {
- // This is for user defined type names. The lexical phase looked up the type.
- TType& structure = static_cast<TVariable*>($1.symbol)->getType();
- $$.initializeStruct(structure.getStruct(), false, @1);
- }
- ;
-
-struct_specifier
- : STRUCT identifier LEFT_BRACE { context->enterStructDeclaration(@2, *$2.string); } struct_declaration_list RIGHT_BRACE {
- $$ = context->addStructure(@1, @2, $2.string, $5);
- }
- | STRUCT LEFT_BRACE { context->enterStructDeclaration(@2, *$2.string); } struct_declaration_list RIGHT_BRACE {
- $$ = context->addStructure(@1, @$, NewPoolTString(""), $4);
- }
- ;
-
-struct_declaration_list
- : struct_declaration {
- $$ = context->addStructFieldList($1, @1);
- }
- | struct_declaration_list struct_declaration {
- $$ = context->combineStructFieldLists($1, $2, @2);
- }
- ;
-
-struct_declaration
- : type_specifier struct_declarator_list SEMICOLON {
- $$ = context->addStructDeclaratorList($1, $2);
- }
- | type_qualifier type_specifier struct_declarator_list SEMICOLON {
- // ES3 Only, but errors should be handled elsewhere
- $$ = context->addStructDeclaratorListWithQualifiers(*$1, &$2, $3);
- }
- ;
-
-struct_declarator_list
- : struct_declarator {
- $$ = NewPoolTFieldList();
- $$->push_back($1);
- }
- | struct_declarator_list COMMA struct_declarator {
- $$->push_back($3);
- }
- ;
-
-struct_declarator
- : identifier {
- $$ = context->parseStructDeclarator($1.string, @1);
- }
- | identifier array_specifier {
- $$ = context->parseStructArrayDeclarator($1.string, @1, *($2), @2);
- }
- ;
-
-initializer
- : assignment_expression { $$ = $1; }
- ;
-
-declaration_statement
- : declaration { $$ = $1; }
- ;
-
-statement
- : compound_statement_with_scope { $$ = $1; }
- | simple_statement { $$ = $1; }
- ;
-
-// Grammar Note: Labeled statements for SWITCH only; 'goto' is not supported.
-
-simple_statement
- : declaration_statement { $$ = $1; }
- | expression_statement { $$ = $1; }
- | selection_statement { $$ = $1; }
- | switch_statement { $$ = $1; }
- | case_label { $$ = $1; }
- | iteration_statement { $$ = $1; }
- | jump_statement { $$ = $1; }
- ;
-
-compound_statement_with_scope
- : LEFT_BRACE RIGHT_BRACE {
- $$ = new TIntermBlock();
- $$->setLine(@$);
- }
- | LEFT_BRACE { context->symbolTable.push(); } statement_list { context->symbolTable.pop(); } RIGHT_BRACE {
- $3->setLine(@$);
- $$ = $3;
- }
- ;
-
-statement_no_new_scope
- : compound_statement_no_new_scope { $$ = $1; }
- | simple_statement { $$ = $1; }
- ;
-
-statement_with_scope
- : { context->symbolTable.push(); } compound_statement_no_new_scope { context->symbolTable.pop(); $$ = $2; }
- | { context->symbolTable.push(); } simple_statement { context->symbolTable.pop(); $$ = $2; }
- ;
-
-compound_statement_no_new_scope
- // Statement that doesn't create a new scope for iteration_statement, function definition (scope is created for parameters)
- : LEFT_BRACE RIGHT_BRACE {
- $$ = new TIntermBlock();
- $$->setLine(@$);
- }
- | LEFT_BRACE statement_list RIGHT_BRACE {
- $2->setLine(@$);
- $$ = $2;
- }
- ;
-
-statement_list
- : statement {
- $$ = new TIntermBlock();
- $$->appendStatement($1);
- }
- | statement_list statement {
- $$ = $1;
- $$->appendStatement($2);
- }
- ;
-
-expression_statement
- : SEMICOLON { $$ = context->addEmptyStatement(@$); }
- | expression SEMICOLON { $$ = $1; }
- ;
-
-selection_statement
- : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
- $$ = context->addIfElse($3, $5, @1);
- }
- ;
-
-selection_rest_statement
- : statement_with_scope ELSE statement_with_scope {
- $$.node1 = $1;
- $$.node2 = $3;
- }
- | statement_with_scope {
- $$.node1 = $1;
- $$.node2 = nullptr;
- }
- ;
-
-// Note that we've diverged from the spec grammar here a bit for the sake of simplicity.
-// We're reusing compound_statement_with_scope instead of having separate rules for switch.
-switch_statement
- : SWITCH LEFT_PAREN expression RIGHT_PAREN { context->incrSwitchNestingLevel(); } compound_statement_with_scope {
- $$ = context->addSwitch($3, $6, @1);
- context->decrSwitchNestingLevel();
- }
- ;
-
-case_label
- : CASE constant_expression COLON {
- $$ = context->addCase($2, @1);
- }
- | DEFAULT COLON {
- $$ = context->addDefault(@1);
- }
- ;
-
-condition
- : expression {
- $$ = $1;
- context->checkIsScalarBool($1->getLine(), $1);
- }
- | fully_specified_type identifier EQUAL initializer {
- $$ = context->addConditionInitializer($1, *$2.string, $4, @2);
- }
- ;
-
-iteration_statement
- : WHILE LEFT_PAREN { context->symbolTable.push(); context->incrLoopNestingLevel(); } condition RIGHT_PAREN statement_no_new_scope {
- context->symbolTable.pop();
- $$ = context->addLoop(ELoopWhile, 0, $4, 0, $6, @1);
- context->decrLoopNestingLevel();
- }
- | DO { context->incrLoopNestingLevel(); } statement_with_scope WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
- $$ = context->addLoop(ELoopDoWhile, 0, $6, 0, $3, @4);
- context->decrLoopNestingLevel();
- }
- | FOR LEFT_PAREN { context->symbolTable.push(); context->incrLoopNestingLevel(); } for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
- context->symbolTable.pop();
- $$ = context->addLoop(ELoopFor, $4, $5.node1, reinterpret_cast<TIntermTyped*>($5.node2), $7, @1);
- context->decrLoopNestingLevel();
- }
- ;
-
-for_init_statement
- : expression_statement {
- $$ = $1;
- }
- | declaration_statement {
- $$ = $1;
- }
- ;
-
-conditionopt
- : condition {
- $$ = $1;
- }
- | /* May be null */ {
- $$ = nullptr;
- }
- ;
-
-for_rest_statement
- : conditionopt SEMICOLON {
- $$.node1 = $1;
- $$.node2 = 0;
- }
- | conditionopt SEMICOLON expression {
- $$.node1 = $1;
- $$.node2 = $3;
- }
- ;
-
-jump_statement
- : CONTINUE SEMICOLON {
- $$ = context->addBranch(EOpContinue, @1);
- }
- | BREAK SEMICOLON {
- $$ = context->addBranch(EOpBreak, @1);
- }
- | RETURN SEMICOLON {
- $$ = context->addBranch(EOpReturn, @1);
- }
- | RETURN expression SEMICOLON {
- $$ = context->addBranch(EOpReturn, $2, @1);
- }
- | DISCARD SEMICOLON {
- $$ = context->addBranch(EOpKill, @1);
- }
- ;
-
-// Grammar Note: No 'goto'. Gotos are not supported.
-
-translation_unit
- : external_declaration {
- $$ = new TIntermBlock();
- $$->setLine(@$);
- $$->appendStatement($1);
- context->setTreeRoot($$);
- }
- | translation_unit external_declaration {
- $$->appendStatement($2);
- }
- ;
-
-external_declaration
- : function_definition {
- $$ = $1;
- }
- | declaration {
- $$ = $1;
- }
- ;
-
-function_definition
- : function_prototype {
- context->parseFunctionDefinitionHeader(@1, &($1.function), &($1.intermFunctionPrototype));
- }
- compound_statement_no_new_scope {
- $$ = context->addFunctionDefinition($1.intermFunctionPrototype, $3, @1);
- }
- ;
-
-%%
-
-int glslang_parse(TParseContext* context) {
- return yyparse(context, context->getScanner());
-}
diff --git a/src/3rdparty/angle/src/compiler/translator/length_limits.h b/src/3rdparty/angle/src/compiler/translator/length_limits.h
deleted file mode 100644
index fcda639d71..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/length_limits.h
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/compiler/translator/util.cpp b/src/3rdparty/angle/src/compiler/translator/util.cpp
deleted file mode 100644
index 9738370c47..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/util.cpp
+++ /dev/null
@@ -1,714 +0,0 @@
-//
-// 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/SymbolTable.h"
-
-bool atoi_clamp(const char *str, unsigned int *value)
-{
- bool success = 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;
- 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;
- }
- 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 = 0;
- while (decimalMantissa >= 10u)
- {
- --normalizationExponentOffset;
- decimalMantissa /= 10u;
- }
- // 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)
-{
- // Try the standard float parsing path first.
- bool success = pp::numeric_lex_float(str, value);
-
- // If the standard path doesn't succeed, take the path 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.
- if (!success)
- *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();
- }
- }
- else if (type.isMatrix())
- {
- switch (type.getCols())
- {
- case 2:
- switch (type.getRows())
- {
- case 2:
- return GL_FLOAT_MAT2;
- case 3:
- return GL_FLOAT_MAT2x3;
- case 4:
- return GL_FLOAT_MAT2x4;
- default:
- UNREACHABLE();
- }
-
- case 3:
- switch (type.getRows())
- {
- case 2:
- return GL_FLOAT_MAT3x2;
- case 3:
- return GL_FLOAT_MAT3;
- case 4:
- return GL_FLOAT_MAT3x4;
- default:
- UNREACHABLE();
- }
-
- case 4:
- switch (type.getRows())
- {
- case 2:
- return GL_FLOAT_MAT4x2;
- case 3:
- return GL_FLOAT_MAT4x3;
- case 4:
- return GL_FLOAT_MAT4;
- default:
- UNREACHABLE();
- }
-
- default:
- UNREACHABLE();
- }
- }
- else
- {
- 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();
- }
- }
- 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();
- }
- }
- 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();
- }
- }
- 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 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 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 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:
- // Should be defined as the default precision by the parser
- default:
- UNREACHABLE();
- }
- }
- else if (type.getBasicType() == EbtInt || type.getBasicType() == EbtUInt)
- {
- switch (type.getPrecision())
- {
- case EbpHigh:
- return GL_HIGH_INT;
- case EbpMedium:
- return GL_MEDIUM_INT;
- case EbpLow:
- return GL_LOW_INT;
- case EbpUndefined:
- // Should be defined as the default precision by the parser
- default:
- UNREACHABLE();
- }
- }
-
- // Other types (boolean, sampler) don't have a precision
- return GL_NONE;
-}
-
-TString ArrayString(const TType &type)
-{
- TStringStream arrayString;
- if (!type.isArray())
- return arrayString.str();
-
- const TVector<unsigned int> &arraySizes = *type.getArraySizes();
- for (auto arraySizeIter = arraySizes.rbegin(); arraySizeIter != arraySizes.rend();
- ++arraySizeIter)
- {
- arrayString << "[";
- if (*arraySizeIter > 0)
- {
- arrayString << (*arraySizeIter);
- }
- arrayString << "]";
- }
- return arrayString.str();
-}
-
-TString GetTypeName(const TType &type, ShHashFunction64 hashFunction, NameMap *nameMap)
-{
- if (type.getBasicType() == EbtStruct)
- return HashName(TName(type.getStruct()->name()), hashFunction, nameMap);
- else
- return 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_OES) && 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();
- return INTERPOLATION_SMOOTH;
- }
-}
-
-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();
- return TType();
- }
-}
-
-// 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 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;
-}
-
-} // namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/util.h b/src/3rdparty/angle/src/compiler/translator/util.h
deleted file mode 100644
index 6d6dc95b3b..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/util.h
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_TRANSLATOR_UTIL_H_
-#define COMPILER_TRANSLATOR_UTIL_H_
-
-#include <stack>
-
-#include "angle_gl.h"
-#include <GLSLANG/ShaderLang.h>
-
-#include "compiler/translator/HashNames.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
-{
-class TSymbolTable;
-
-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.
-TString ArrayString(const TType &type);
-
-TString GetTypeName(const TType &type, ShHashFunction64 hashFunction, NameMap *nameMap);
-
-TType GetShaderVariableBasicType(const sh::ShaderVariable &var);
-
-bool IsBuiltinOutputVariable(TQualifier qualifier);
-bool IsBuiltinFragmentInputVariable(TQualifier qualifier);
-bool CanBeInvariantESSL1(TQualifier qualifier);
-bool CanBeInvariantESSL3OrGreater(TQualifier qualifier);
-bool IsOutputESSL(ShShaderOutput output);
-bool IsOutputGLSL(ShShaderOutput output);
-bool IsOutputHLSL(ShShaderOutput output);
-bool IsOutputVulkan(ShShaderOutput output);
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_UTIL_H_
diff --git a/src/3rdparty/angle/src/gpu_info_util/SystemInfo.cpp b/src/3rdparty/angle/src/gpu_info_util/SystemInfo.cpp
deleted file mode 100644
index f8d744342d..0000000000
--- a/src/3rdparty/angle/src/gpu_info_util/SystemInfo.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-//
-// 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 <sstream>
-
-#include "common/debug.h"
-#include "common/string_utils.h"
-
-namespace angle
-{
-
-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 IsAMD(VendorID vendorId)
-{
- return vendorId == kVendorID_AMD;
-}
-
-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 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 FindPrimaryGPU(SystemInfo *info)
-{
- ASSERT(!info->gpus.empty());
-
- // On dual-GPU systems we assume the non-Intel GPU is the primary one.
- int primary = 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[primary].vendorId))
- {
- primary = static_cast<int>(i);
- }
- }
-
- // Assume that a combination of AMD or Nvidia with Intel means Optimus or AMD Switchable
- info->primaryGPUIndex = primary;
- info->isOptimus = hasIntel && IsNvidia(info->gpus[primary].vendorId);
- info->isAMDSwitchable = hasIntel && IsAMD(info->gpus[primary].vendorId);
-}
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/gpu_info_util/SystemInfo.h b/src/3rdparty/angle/src/gpu_info_util/SystemInfo.h
deleted file mode 100644
index ada43f0a15..0000000000
--- a/src/3rdparty/angle/src/gpu_info_util/SystemInfo.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// 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;
-
-constexpr VendorID kVendorID_AMD = 0x1002;
-constexpr VendorID kVendorID_Intel = 0x8086;
-constexpr VendorID kVendorID_Nvidia = 0x10DE;
-constexpr VendorID kVendorID_Qualcomm = 0x5143;
-
-struct GPUDeviceInfo
-{
- GPUDeviceInfo();
- ~GPUDeviceInfo();
-
- GPUDeviceInfo(const GPUDeviceInfo &other);
-
- VendorID vendorId = 0;
- DeviceID deviceId = 0;
-
- std::string driverVendor;
- std::string driverVersion;
- std::string driverDate;
-};
-
-struct SystemInfo
-{
- SystemInfo();
- ~SystemInfo();
-
- SystemInfo(const SystemInfo &other);
-
- std::vector<GPUDeviceInfo> gpus;
- int primaryGPUIndex = -1;
- int activeGPUIndex = -1;
-
- bool isOptimus = false;
- bool isAMDSwitchable = false;
-
- // Only available on macOS
- std::string machineModelName;
- std::string machineModelVersion;
-
- // Only available on Windows, set even on failure.
- std::string primaryDisplayDeviceId;
-};
-
-bool GetSystemInfo(SystemInfo *info);
-
-bool IsAMD(VendorID vendorId);
-bool IsIntel(VendorID vendorId);
-bool IsNvidia(VendorID vendorId);
-bool IsQualcomm(VendorID vendorId);
-
-} // namespace angle
-
-#endif // GPU_INFO_UTIL_SYSTEM_INFO_H_
diff --git a/src/3rdparty/angle/src/gpu_info_util/SystemInfo_internal.h b/src/3rdparty/angle/src/gpu_info_util/SystemInfo_internal.h
deleted file mode 100644
index d2f6124662..0000000000
--- a/src/3rdparty/angle/src/gpu_info_util/SystemInfo_internal.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// 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);
-
-// In the case there are multiple GPUs, this finds the primary one and sets Optimus or AMD
-// Switchable
-void FindPrimaryGPU(SystemInfo *info);
-
-} // namespace angle
-
-#endif // GPU_INFO_UTIL_SYSTEM_INFO_INTERNAL_H_
diff --git a/src/3rdparty/angle/src/gpu_info_util/SystemInfo_libpci.cpp b/src/3rdparty/angle/src/gpu_info_util/SystemInfo_libpci.cpp
deleted file mode 100644
index 07c72872ad..0000000000
--- a/src/3rdparty/angle/src/gpu_info_util/SystemInfo_libpci.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-//
-// 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_libpci.cpp: implementation of the libPCI-specific parts of SystemInfo.h
-
-#include "gpu_info_util/SystemInfo_internal.h"
-
-#include <dlfcn.h>
-#include <pci/pci.h>
-#include <unistd.h>
-
-#include "common/angleutils.h"
-#include "common/debug.h"
-
-#if !defined(GPU_INFO_USE_LIBPCI)
-#error SystemInfo_libpci.cpp compiled without GPU_INFO_USE_LIBPCI
-#endif
-
-namespace angle
-{
-
-namespace
-{
-
-struct LibPCI : private angle::NonCopyable
-{
- LibPCI()
- {
- if (access("/sys/bus/pci/", F_OK) != 0 && access("/sys/bs/pci_express/", F_OK) != 0)
- {
- return;
- }
-
- mHandle = dlopen("libpci.so.3", RTLD_LAZY);
-
- if (mHandle == nullptr)
- {
- mHandle = dlopen("libpci.so", RTLD_LAZY);
- }
-
- if (mHandle == nullptr)
- {
- return;
- }
-
- mValid =
- (Alloc = reinterpret_cast<decltype(Alloc)>(dlsym(mHandle, "pci_alloc"))) != nullptr &&
- (Init = reinterpret_cast<decltype(Init)>(dlsym(mHandle, "pci_init"))) != nullptr &&
- (Cleanup = reinterpret_cast<decltype(Cleanup)>(dlsym(mHandle, "pci_cleanup"))) !=
- nullptr &&
- (ScanBus = reinterpret_cast<decltype(ScanBus)>(dlsym(mHandle, "pci_scan_bus"))) !=
- nullptr &&
- (FillInfo = reinterpret_cast<decltype(FillInfo)>(dlsym(mHandle, "pci_fill_info"))) !=
- nullptr &&
- (LookupName = reinterpret_cast<decltype(LookupName)>(
- dlsym(mHandle, "pci_lookup_name"))) != nullptr;
- }
-
- bool IsValid() const { return mValid; }
-
- ~LibPCI()
- {
- if (mHandle != nullptr)
- {
- dlclose(mHandle);
- }
- }
-
- decltype(&::pci_alloc) Alloc = nullptr;
- decltype(&::pci_init) Init = nullptr;
- decltype(&::pci_cleanup) Cleanup = nullptr;
- decltype(&::pci_scan_bus) ScanBus = nullptr;
- decltype(&::pci_fill_info) FillInfo = nullptr;
- decltype(&::pci_lookup_name) LookupName = nullptr;
-
- private:
- void *mHandle = nullptr;
- bool mValid = false;
-};
-
-} // anonymous namespace
-
-// Adds an entry per PCI GPU found and fills the device and vendor ID.
-bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo> *devices)
-{
- LibPCI pci;
- if (!pci.IsValid())
- {
- return false;
- }
-
- pci_access *access = pci.Alloc();
- ASSERT(access != nullptr);
- pci.Init(access);
- pci.ScanBus(access);
-
- for (pci_dev *device = access->devices; device != nullptr; device = device->next)
- {
- pci.FillInfo(device, PCI_FILL_IDENT | PCI_FILL_CLASS);
-
- // Skip non-GPU devices
- switch (device->device_class)
- {
- case PCI_CLASS_DISPLAY_VGA:
- case PCI_CLASS_DISPLAY_XGA:
- case PCI_CLASS_DISPLAY_3D:
- break;
- default:
- continue;
- }
-
- // Skip unknown devices
- if (device->vendor_id == 0 || device->device_id == 0)
- {
- continue;
- }
-
- GPUDeviceInfo info;
- info.vendorId = device->vendor_id;
- info.deviceId = device->device_id;
-
- devices->push_back(info);
- }
-
- pci.Cleanup(access);
-
- return true;
-}
-}
diff --git a/src/3rdparty/angle/src/gpu_info_util/SystemInfo_linux.cpp b/src/3rdparty/angle/src/gpu_info_util/SystemInfo_linux.cpp
deleted file mode 100644
index 98f000b069..0000000000
--- a/src/3rdparty/angle/src/gpu_info_util/SystemInfo_linux.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-//
-// 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_linux.cpp: implementation of the Linux-specific parts of SystemInfo.h
-
-#include "gpu_info_util/SystemInfo_internal.h"
-
-#include <cstring>
-#include <fstream>
-
-#include "common/angleutils.h"
-#include "common/debug.h"
-
-namespace angle
-{
-
-namespace
-{
-
-bool ReadWholeFile(const char *filename, std::string *content)
-{
- std::ifstream file(filename);
-
- if (!file)
- {
- return false;
- }
-
- *content = std::string(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());
- return true;
-}
-
-// Scan /sys/module/amdgpu/version.
-bool GetAMDBrahmaDriverVersion(std::string *version)
-{
- *version = "";
- std::string content;
-
- return ReadWholeFile("/sys/module/amdgpu/version", &content) &&
- ParseAMDBrahmaDriverVersion(content, version);
-}
-
-// Scan /etc/ati/amdpcsdb.default for "ReleaseVersion".
-bool GetAMDCatalystDriverVersion(std::string *version)
-{
- *version = "";
- std::string content;
-
- return ReadWholeFile("/etc/ati/amdpcsdb.default", &content) &&
- ParseAMDCatalystDriverVersion(content, version);
-}
-
-} // anonymous namespace
-
-#if !defined(GPU_INFO_USE_X11)
-bool GetNvidiaDriverVersionWithXNVCtrl(std::string *version)
-{
- return false;
-}
-#endif
-
-#if !defined(GPU_INFO_USE_LIBPCI)
-bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo> *devices)
-{
- return false;
-}
-#endif
-
-bool GetSystemInfo(SystemInfo *info)
-{
- if (!GetPCIDevicesWithLibPCI(&(info->gpus)))
- {
- return false;
- }
-
- if (info->gpus.size() == 0)
- {
- return false;
- }
-
- FindPrimaryGPU(info);
-
- for (size_t i = 0; i < info->gpus.size(); ++i)
- {
- GPUDeviceInfo *gpu = &info->gpus[i];
-
- // New GPUs might be added inside this loop, don't query for their driver version again
- if (!gpu->driverVendor.empty())
- {
- continue;
- }
-
- if (IsAMD(gpu->vendorId))
- {
- std::string version;
- if (GetAMDBrahmaDriverVersion(&version))
- {
- gpu->driverVendor = "AMD (Brahma)";
- gpu->driverVersion = std::move(version);
- }
- else if (GetAMDCatalystDriverVersion(&version))
- {
- gpu->driverVendor = "AMD (Catalyst)";
- gpu->driverVersion = std::move(version);
- }
- }
-
- if (IsNvidia(gpu->vendorId))
- {
- std::string version;
- if (GetNvidiaDriverVersionWithXNVCtrl(&version))
- {
- gpu->driverVendor = "Nvidia";
- gpu->driverVersion = std::move(version);
- }
- }
-
- // In dual-GPU cases the PCI scan sometimes only gives us the Intel GPU.
- // If we are able to query for the Nvidia driver version, it means there
- // was hidden Nvidia GPU, so we add it to the list and make it primary.
- if (IsIntel(gpu->vendorId) && info->gpus.size() == 1)
- {
- std::string version;
- if (GetNvidiaDriverVersionWithXNVCtrl(&version))
- {
- GPUDeviceInfo nvidiaInfo;
- nvidiaInfo.vendorId = kVendorID_Nvidia;
- nvidiaInfo.deviceId = 0;
- gpu->driverVendor = "Nvidia";
- gpu->driverVersion = std::move(version);
-
- info->gpus.emplace_back(std::move(nvidiaInfo));
- info->isOptimus = true;
- }
- }
- }
-
- return true;
-}
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/gpu_info_util/SystemInfo_mac.mm b/src/3rdparty/angle/src/gpu_info_util/SystemInfo_mac.mm
deleted file mode 100644
index 7a7a62d170..0000000000
--- a/src/3rdparty/angle/src/gpu_info_util/SystemInfo_mac.mm
+++ /dev/null
@@ -1,170 +0,0 @@
-//
-// 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.
-//
-
-// SystemInfo_mac.cpp: implementation of the Mac-specific parts of SystemInfo.h
-
-#include "gpu_info_util/SystemInfo_internal.h"
-
-#import <Cocoa/Cocoa.h>
-#import <IOKit/IOKitLib.h>
-
-namespace angle
-{
-
-namespace
-{
-
-std::string GetMachineModel()
-{
- io_service_t platformExpert = IOServiceGetMatchingService(
- kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
-
- if (platformExpert == IO_OBJECT_NULL)
- {
- return "";
- }
-
- CFDataRef modelData = static_cast<CFDataRef>(
- IORegistryEntryCreateCFProperty(platformExpert, CFSTR("model"), kCFAllocatorDefault, 0));
- if (modelData == nullptr)
- {
- IOObjectRelease(platformExpert);
- return "";
- }
-
- std::string result = reinterpret_cast<const char *>(CFDataGetBytePtr(modelData));
-
- IOObjectRelease(platformExpert);
- CFRelease(modelData);
-
- return result;
-}
-
-// Extracts one integer property from a registry entry.
-bool GetEntryProperty(io_registry_entry_t entry, CFStringRef name, uint32_t *value)
-{
- *value = 0;
-
- CFDataRef data = static_cast<CFDataRef>(
- IORegistryEntrySearchCFProperty(entry, kIOServicePlane, name, kCFAllocatorDefault,
- kIORegistryIterateRecursively | kIORegistryIterateParents));
-
- if (data == nullptr)
- {
- return false;
- }
-
- const uint32_t *valuePtr = reinterpret_cast<const uint32_t *>(CFDataGetBytePtr(data));
-
- if (valuePtr == nullptr)
- {
- CFRelease(data);
- return false;
- }
-
- *value = *valuePtr;
- CFRelease(data);
- return true;
-}
-
-// CGDisplayIOServicePort is deprecated as of macOS 10.9, but has no replacement, see
-// https://crbug.com/650837
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-
-// Find the info of the current GPU.
-bool GetActiveGPU(VendorID *vendorId, DeviceID *deviceId)
-{
- io_registry_entry_t port = CGDisplayIOServicePort(kCGDirectMainDisplay);
-
- return GetEntryProperty(port, CFSTR("vendor-id"), vendorId) &&
- GetEntryProperty(port, CFSTR("device-id"), deviceId);
-}
-
-#pragma clang diagnostic pop
-
-// Gathers the vendor and device IDs for the PCI GPUs
-bool GetPCIDevices(std::vector<GPUDeviceInfo> *devices)
-{
- // matchDictionary will be consumed by IOServiceGetMatchingServices, no need to release it.
- CFMutableDictionaryRef matchDictionary = IOServiceMatching("IOPCIDevice");
-
- io_iterator_t entryIterator;
- if (IOServiceGetMatchingServices(kIOMasterPortDefault, matchDictionary, &entryIterator) !=
- kIOReturnSuccess)
- {
- return false;
- }
-
- io_registry_entry_t entry = IO_OBJECT_NULL;
-
- while ((entry = IOIteratorNext(entryIterator)) != IO_OBJECT_NULL)
- {
- constexpr uint32_t kClassCodeDisplayVGA = 0x30000;
- uint32_t classCode;
- GPUDeviceInfo info;
-
- if (GetEntryProperty(entry, CFSTR("class-code"), &classCode) &&
- classCode == kClassCodeDisplayVGA &&
- GetEntryProperty(entry, CFSTR("vendor-id"), &info.vendorId) &&
- GetEntryProperty(entry, CFSTR("device-id"), &info.deviceId))
- {
- devices->push_back(info);
- }
-
- IOObjectRelease(entry);
- }
- IOObjectRelease(entryIterator);
-
- return true;
-}
-
-} // anonymous namespace
-
-bool GetSystemInfo(SystemInfo *info)
-{
- {
- int32_t major = 0;
- int32_t minor = 0;
- ParseMacMachineModel(GetMachineModel(), &info->machineModelName, &major, &minor);
- info->machineModelVersion = std::to_string(major) + "." + std::to_string(minor);
- }
-
- if (!GetPCIDevices(&(info->gpus)))
- {
- return false;
- }
-
- if (info->gpus.empty())
- {
- return false;
- }
-
- // Find the active GPU
- {
- VendorID activeVendor;
- DeviceID activeDevice;
- if (!GetActiveGPU(&activeVendor, &activeDevice))
- {
- return false;
- }
-
- for (size_t i = 0; i < info->gpus.size(); ++i)
- {
- if (info->gpus[i].vendorId == activeVendor && info->gpus[i].deviceId == activeDevice)
- {
- info->activeGPUIndex = i;
- break;
- }
- }
- }
-
- FindPrimaryGPU(info);
-
- return true;
-}
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/gpu_info_util/SystemInfo_win.cpp b/src/3rdparty/angle/src/gpu_info_util/SystemInfo_win.cpp
deleted file mode 100644
index 041fdad34d..0000000000
--- a/src/3rdparty/angle/src/gpu_info_util/SystemInfo_win.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-//
-// 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>
-
-#if defined(GPU_INFO_USE_SETUPAPI)
-// Remove parts of commctrl.h that have compile errors
-#define NOTOOLBAR
-#define NOTOOLTIPS
-#include <cfgmgr32.h>
-#include <setupapi.h>
-#elif defined(GPU_INFO_USE_DXGI)
-#include <dxgi.h>
-#include <d3d10.h>
-#else
-#error "SystemInfo_win needs at least GPU_INFO_USE_SETUPAPI or GPU_INFO_USE_DXGI defined"
-#endif
-
-#include <array>
-#include <sstream>
-
-namespace angle
-{
-
-namespace
-{
-
-// Returns the CM device ID of the primary GPU.
-std::string GetPrimaryDisplayDeviceId()
-{
- DISPLAY_DEVICEA displayDevice;
- displayDevice.cb = sizeof(DISPLAY_DEVICEA);
-
- for (int i = 0; EnumDisplayDevicesA(nullptr, i, &displayDevice, 0); ++i)
- {
- if (displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
- {
- return displayDevice.DeviceID;
- }
- }
-
- return "";
-}
-
-#if defined(GPU_INFO_USE_SETUPAPI)
-
-std::string GetRegistryStringValue(HKEY key, const char *valueName)
-{
- std::array<char, 255> value;
- DWORD valueSize = sizeof(value);
- if (RegQueryValueExA(key, valueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(value.data()),
- &valueSize) == ERROR_SUCCESS)
- {
- return value.data();
- }
- return "";
-}
-
-// Gathers information about the devices from the registry. The reason why we aren't using
-// a dedicated API such as DXGI is that we need information like the driver vendor and date.
-// DXGI doesn't provide a way to know the device registry key from an IDXGIAdapter.
-bool GetDevicesFromRegistry(std::vector<GPUDeviceInfo> *devices)
-{
- // Display adapter class GUID from
- // https://msdn.microsoft.com/en-us/library/windows/hardware/ff553426%28v=vs.85%29.aspx
- GUID displayClass = {
- 0x4d36e968, 0xe325, 0x11ce, {0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18}};
-
- HDEVINFO deviceInfo = SetupDiGetClassDevsW(&displayClass, nullptr, nullptr, DIGCF_PRESENT);
-
- if (deviceInfo == INVALID_HANDLE_VALUE)
- {
- return false;
- }
-
- // This iterates over the devices of the "Display adapter" class
- DWORD deviceIndex = 0;
- SP_DEVINFO_DATA deviceData;
- deviceData.cbSize = sizeof(deviceData);
- while (SetupDiEnumDeviceInfo(deviceInfo, deviceIndex++, &deviceData))
- {
- // The device and vendor IDs can be gathered directly, but information about the driver
- // requires some registry digging
- char fullDeviceID[MAX_DEVICE_ID_LEN];
- if (CM_Get_Device_IDA(deviceData.DevInst, fullDeviceID, MAX_DEVICE_ID_LEN, 0) != CR_SUCCESS)
- {
- continue;
- }
-
- GPUDeviceInfo device;
-
- if (!CMDeviceIDToDeviceAndVendorID(fullDeviceID, &device.vendorId, &device.deviceId))
- {
- continue;
- }
-
- // The driver key will end with something like {<displayClass>}/<4 digit number>.
- std::array<WCHAR, 255> value;
- if (!SetupDiGetDeviceRegistryPropertyW(deviceInfo, &deviceData, SPDRP_DRIVER, nullptr,
- reinterpret_cast<PBYTE>(value.data()), sizeof(value),
- nullptr))
- {
- continue;
- }
-
- std::wstring driverKey = L"System\\CurrentControlSet\\Control\\Class\\";
- driverKey += value.data();
-
- HKEY key;
- if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey.c_str(), 0, KEY_QUERY_VALUE, &key) !=
- ERROR_SUCCESS)
- {
- continue;
- }
-
- device.driverVersion = GetRegistryStringValue(key, "DriverVersion");
- device.driverDate = GetRegistryStringValue(key, "DriverDate");
- device.driverVendor = GetRegistryStringValue(key, "ProviderName");
-
- RegCloseKey(key);
-
- devices->push_back(device);
- }
-
- SetupDiDestroyDeviceInfoList(deviceInfo);
-
- return true;
-}
-
-#elif defined(GPU_INFO_USE_DXGI)
-
-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 true;
-}
-
-#else
-#error
-#endif
-
-} // anonymous namespace
-
-bool GetSystemInfo(SystemInfo *info)
-{
- // Get the CM device ID first so that it is returned even in error cases.
- info->primaryDisplayDeviceId = GetPrimaryDisplayDeviceId();
-
-#if defined(GPU_INFO_USE_SETUPAPI)
- if (!GetDevicesFromRegistry(&info->gpus))
- {
- return false;
- }
-#elif defined(GPU_INFO_USE_DXGI)
- if (!GetDevicesFromDXGI(&info->gpus))
- {
- return false;
- }
-#else
-#error
-#endif
-
- if (info->gpus.size() == 0)
- {
- return false;
- }
-
- FindPrimaryGPU(info);
-
- // Override the primary GPU index with what we gathered from EnumDisplayDevices
- uint32_t primaryVendorId = 0;
- uint32_t primaryDeviceId = 0;
-
- if (!CMDeviceIDToDeviceAndVendorID(info->primaryDisplayDeviceId, &primaryVendorId,
- &primaryDeviceId))
- {
- return false;
- }
-
- bool foundPrimary = false;
- for (size_t i = 0; i < info->gpus.size(); ++i)
- {
- if (info->gpus[i].vendorId == primaryVendorId && info->gpus[i].deviceId == primaryDeviceId)
- {
- info->primaryGPUIndex = static_cast<int>(i);
- foundPrimary = true;
- }
- }
- ASSERT(foundPrimary);
-
- // 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/src/3rdparty/angle/src/gpu_info_util/SystemInfo_x11.cpp b/src/3rdparty/angle/src/gpu_info_util/SystemInfo_x11.cpp
deleted file mode 100644
index 3513309f36..0000000000
--- a/src/3rdparty/angle/src/gpu_info_util/SystemInfo_x11.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// 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_x11.cpp: implementation of the X11-specific parts of SystemInfo.h
-
-#include "gpu_info_util/SystemInfo_internal.h"
-
-#include <X11/Xlib.h>
-
-#include "common/debug.h"
-#include "third_party/libXNVCtrl/NVCtrl.h"
-#include "third_party/libXNVCtrl/NVCtrlLib.h"
-
-#if !defined(GPU_INFO_USE_X11)
-#error SystemInfo_x11.cpp compiled without GPU_INFO_USE_X11
-#endif
-
-namespace angle
-{
-
-bool GetNvidiaDriverVersionWithXNVCtrl(std::string *version)
-{
- *version = "";
-
- int eventBase = 0;
- int errorBase = 0;
-
- Display *display = XOpenDisplay(nullptr);
-
- if (XNVCTRLQueryExtension(display, &eventBase, &errorBase))
- {
- int screenCount = ScreenCount(display);
- for (int screen = 0; screen < screenCount; ++screen)
- {
- char *buffer = nullptr;
- if (XNVCTRLIsNvScreen(display, screen) &&
- XNVCTRLQueryStringAttribute(display, screen, 0,
- NV_CTRL_STRING_NVIDIA_DRIVER_VERSION, &buffer))
- {
- ASSERT(buffer != nullptr);
- *version = buffer;
- XFree(buffer);
- return true;
- }
- }
- }
-
- return false;
-}
-}
diff --git a/src/3rdparty/angle/src/image_util/copyimage.cpp b/src/3rdparty/angle/src/image_util/copyimage.cpp
deleted file mode 100644
index cc07908158..0000000000
--- a/src/3rdparty/angle/src/image_util/copyimage.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/image_util/copyimage.h b/src/3rdparty/angle/src/image_util/copyimage.h
deleted file mode 100644
index bc8c1390eb..0000000000
--- a/src/3rdparty/angle/src/image_util/copyimage.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// 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, typename destType, typename colorDataType>
-void CopyPixel(const uint8_t *source, uint8_t *dest);
-
-void CopyBGRA8ToRGBA8(const uint8_t *source, uint8_t *dest);
-
-} // namespace angle
-
-#include "copyimage.inl"
-
-#endif // IMAGEUTIL_COPYIMAGE_H_
diff --git a/src/3rdparty/angle/src/image_util/copyimage.inl b/src/3rdparty/angle/src/image_util/copyimage.inl
deleted file mode 100644
index dbada81291..0000000000
--- a/src/3rdparty/angle/src/image_util/copyimage.inl
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// copyimage.inl: Defines image copying functions
-
-namespace angle
-{
-
-template <typename sourceType, typename colorDataType>
-inline 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>
-inline void WriteColor(const uint8_t *source, uint8_t *dest)
-{
- destType::writeColor(reinterpret_cast<destType*>(dest),
- reinterpret_cast<const Color<colorDataType>*>(source));
-}
-
-template <typename sourceType, typename destType, typename colorDataType>
-inline void CopyPixel(const uint8_t *source, uint8_t *dest)
-{
- colorDataType temp;
- ReadColor<sourceType, colorDataType>(source, &temp);
- WriteColor<destType, colorDataType>(&temp, dest);
-}
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/image_util/generatemip.h b/src/3rdparty/angle/src/image_util/generatemip.h
deleted file mode 100644
index a89db823b0..0000000000
--- a/src/3rdparty/angle/src/image_util/generatemip.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// 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.inl"
-
-#endif // IMAGEUTIL_GENERATEMIP_H_
diff --git a/src/3rdparty/angle/src/image_util/generatemip.inl b/src/3rdparty/angle/src/image_util/generatemip.inl
deleted file mode 100644
index ddf510c749..0000000000
--- a/src/3rdparty/angle/src/image_util/generatemip.inl
+++ /dev/null
@@ -1,268 +0,0 @@
-//
-// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// generatemip.inl: Defines the GenerateMip function, templated on the format
-// type of the image for which mip levels are being generated.
-
-#include "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/src/3rdparty/angle/src/image_util/imageformats.cpp b/src/3rdparty/angle/src/image_util/imageformats.cpp
deleted file mode 100644
index a4c86945b6..0000000000
--- a/src/3rdparty/angle/src/image_util/imageformats.cpp
+++ /dev/null
@@ -1,1722 +0,0 @@
-//
-// 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 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);
-}
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/image_util/imageformats.h b/src/3rdparty/angle/src/image_util/imageformats.h
deleted file mode 100644
index 65644cd8d9..0000000000
--- a/src/3rdparty/angle/src/image_util/imageformats.h
+++ /dev/null
@@ -1,700 +0,0 @@
-//
-// 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 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.");
-
-} // namespace angle
-
-#endif // IMAGEUTIL_IMAGEFORMATS_H_
diff --git a/src/3rdparty/angle/src/image_util/loadimage.cpp b/src/3rdparty/angle/src/image_util/loadimage.cpp
deleted file mode 100644
index 56ad3b32e3..0000000000
--- a/src/3rdparty/angle/src/image_util/loadimage.cpp
+++ /dev/null
@@ -1,1323 +0,0 @@
-//
-// 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 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 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 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/src/3rdparty/angle/src/image_util/loadimage.h b/src/3rdparty/angle/src/image_util/loadimage.h
deleted file mode 100644
index 3e8aac79c2..0000000000
--- a/src/3rdparty/angle/src/image_util/loadimage.h
+++ /dev/null
@@ -1,658 +0,0 @@
-//
-// 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 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 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);
-
-template <size_t blockWidth, size_t blockHeight, 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 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.inl"
-
-#endif // IMAGEUTIL_LOADIMAGE_H_
diff --git a/src/3rdparty/angle/src/image_util/loadimage.inl b/src/3rdparty/angle/src/image_util/loadimage.inl
deleted file mode 100644
index b8d590ca1b..0000000000
--- a/src/3rdparty/angle/src/image_util/loadimage.inl
+++ /dev/null
@@ -1,163 +0,0 @@
-//
-// 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 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;
-
- for (size_t z = 0; z < depth; ++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/src/3rdparty/angle/src/image_util/loadimage_etc.cpp b/src/3rdparty/angle/src/image_util/loadimage_etc.cpp
deleted file mode 100644
index 67f73837c0..0000000000
--- a/src/3rdparty/angle/src/image_util/loadimage_etc.cpp
+++ /dev/null
@@ -1,1729 +0,0 @@
-//
-// 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 block to bytes
- void decodeAsSingleChannel(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(getSingleChannel(i, j, isSigned));
- }
- else
- {
- *pixel = clampByte(getSingleChannel(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 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 getSingleChannel(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->decodeAsSingleChannel(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->decodeAsSingleChannel(destPixelsRed, x, y, width, height, 2,
- outputRowPitch, isSigned);
-
- uint8_t *destPixelsGreen = destPixelsRed + 1;
- const ETC2Block *sourceBlockGreen = sourceBlockRed + 1;
- sourceBlockGreen->decodeAsSingleChannel(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->decodeAsSingleChannel(
- 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 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/src/3rdparty/angle/src/libANGLE/AttributeMap.cpp b/src/3rdparty/angle/src/libANGLE/AttributeMap.cpp
deleted file mode 100644
index e10d3add7c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/AttributeMap.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-//
-// 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 (mAttributes.find(key) != 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;
-}
-}
diff --git a/src/3rdparty/angle/src/libANGLE/AttributeMap.h b/src/3rdparty/angle/src/libANGLE/AttributeMap.h
deleted file mode 100644
index eddc1b72d0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/AttributeMap.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// 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 <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;
- 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;
-};
-
-}
-
-#endif // LIBANGLE_ATTRIBUTEMAP_H_
diff --git a/src/3rdparty/angle/src/libANGLE/BinaryStream.h b/src/3rdparty/angle/src/libANGLE/BinaryStream.h
deleted file mode 100644
index 3e4c0934cf..0000000000
--- a/src/3rdparty/angle/src/libANGLE/BinaryStream.h
+++ /dev/null
@@ -1,261 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// BinaryStream.h: Provides binary serialization of simple types.
-
-#ifndef LIBANGLE_BINARYSTREAM_H_
-#define LIBANGLE_BINARYSTREAM_H_
-
-#include <cstddef>
-#include <string>
-#include <vector>
-#include <stdint.h>
-
-#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>());
- }
- }
-
- 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;
- }
-
- 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);
- }
- }
-
- 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/src/3rdparty/angle/src/libANGLE/Buffer.cpp b/src/3rdparty/angle/src/libANGLE/Buffer.cpp
deleted file mode 100644
index a1ebfc1acb..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Buffer.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-//
-// 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
-{
-
-BufferState::BufferState()
- : mLabel(),
- mUsage(BufferUsage::StaticDraw),
- mSize(0),
- mAccessFlags(0),
- mAccess(GL_WRITE_ONLY_OES),
- mMapped(GL_FALSE),
- mMapPointer(nullptr),
- mMapOffset(0),
- mMapLength(0)
-{
-}
-
-BufferState::~BufferState()
-{
-}
-
-Buffer::Buffer(rx::GLImplFactory *factory, GLuint id)
- : RefCountObject(id), mImpl(factory->createBuffer(mState))
-{
-}
-
-Buffer::~Buffer()
-{
- SafeDelete(mImpl);
-}
-
-Error Buffer::onDestroy(const Context *context)
-{
- // In tests, mImpl might be null.
- if (mImpl)
- mImpl->destroy(context);
- return NoError();
-}
-
-void Buffer::setLabel(const std::string &label)
-{
- mState.mLabel = label;
-}
-
-const std::string &Buffer::getLabel() const
-{
- return mState.mLabel;
-}
-
-Error Buffer::bufferData(const 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->getGLState().isRobustResourceInitEnabled() && !data && size > 0)
- {
- angle::MemoryBuffer *scratchBuffer = nullptr;
- ANGLE_TRY(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;
-
- return NoError();
-}
-
-Error 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));
-
- return NoError();
-}
-
-Error 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));
-
- return NoError();
-}
-
-Error 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();
-
- return NoError();
-}
-
-Error 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));
- }
-
- return NoError();
-}
-
-Error 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;
-
- return NoError();
-}
-
-void Buffer::onTransformFeedback()
-{
- mIndexRangeCache.clear();
-}
-
-void Buffer::onPixelUnpack()
-{
- mIndexRangeCache.clear();
-}
-
-Error Buffer::getIndexRange(const gl::Context *context,
- GLenum type,
- size_t offset,
- size_t count,
- bool primitiveRestartEnabled,
- IndexRange *outRange) const
-{
- if (mIndexRangeCache.findRange(type, offset, count, primitiveRestartEnabled, outRange))
- {
- return NoError();
- }
-
- ANGLE_TRY(
- mImpl->getIndexRange(context, type, offset, count, primitiveRestartEnabled, outRange));
-
- mIndexRangeCache.addRange(type, offset, count, primitiveRestartEnabled, *outRange);
-
- return NoError();
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Buffer.h b/src/3rdparty/angle/src/libANGLE/Buffer.h
deleted file mode 100644
index 86d4a9fd6f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Buffer.h
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// 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/angleutils.h"
-#include "libANGLE/Debug.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/IndexRangeCache.h"
-#include "libANGLE/PackedGLEnums.h"
-#include "libANGLE/RefCountObject.h"
-
-namespace rx
-{
-class BufferImpl;
-class GLImplFactory;
-};
-
-namespace gl
-{
-class Buffer;
-class Context;
-
-class BufferState final : angle::NonCopyable
-{
- public:
- BufferState();
- ~BufferState();
-
- const std::string &getLabel();
-
- 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; }
-
- private:
- friend class Buffer;
-
- std::string mLabel;
-
- BufferUsage mUsage;
- GLint64 mSize;
- GLbitfield mAccessFlags;
- GLenum mAccess;
- GLboolean mMapped;
- void *mMapPointer;
- GLint64 mMapOffset;
- GLint64 mMapLength;
-};
-
-class Buffer final : public RefCountObject, public LabeledObject
-{
- public:
- Buffer(rx::GLImplFactory *factory, GLuint id);
- ~Buffer() override;
- Error onDestroy(const Context *context) override;
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- Error bufferData(const Context *context,
- BufferBinding target,
- const void *data,
- GLsizeiptr size,
- BufferUsage usage);
- Error bufferSubData(const Context *context,
- BufferBinding target,
- const void *data,
- GLsizeiptr size,
- GLintptr offset);
- Error copyBufferSubData(const Context *context,
- Buffer *source,
- GLintptr sourceOffset,
- GLintptr destOffset,
- GLsizeiptr size);
- Error map(const Context *context, GLenum access);
- Error mapRange(const Context *context, GLintptr offset, GLsizeiptr length, GLbitfield access);
- Error unmap(const Context *context, GLboolean *result);
-
- void onTransformFeedback();
- void onPixelUnpack();
-
- Error getIndexRange(const gl::Context *context,
- GLenum 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; }
-
- rx::BufferImpl *getImplementation() const { return mImpl; }
-
- private:
- BufferState mState;
- rx::BufferImpl *mImpl;
-
- mutable IndexRangeCache mIndexRangeCache;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_BUFFER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Caps.cpp b/src/3rdparty/angle/src/libANGLE/Caps.cpp
deleted file mode 100644
index 44da2bbe27..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Caps.cpp
+++ /dev/null
@@ -1,1213 +0,0 @@
-//
-// 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/debug.h"
-#include "common/angleutils.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()
- : texturable(false),
- filterable(false),
- renderable(false),
- sampleCounts()
-{
-}
-
-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.renderable = internalFormatInfo.renderSupport(clientVersion, extensions);
- caps.filterable = internalFormatInfo.filterSupport(clientVersion, extensions);
-
- caps.sampleCounts.insert(0);
- if (internalFormatInfo.isRequiredRenderbufferFormat(clientVersion))
- {
- if ((clientVersion.major >= 3 && clientVersion.minor >= 1) ||
- (clientVersion.major >= 3 && internalFormatInfo.componentType != GL_UNSIGNED_INT &&
- internalFormatInfo.componentType != GL_INT))
- {
- caps.sampleCounts.insert(4);
- }
- }
-
- return caps;
-}
-
-TextureCapsMap::TextureCapsMap()
-{
-}
-
-TextureCapsMap::~TextureCapsMap()
-{
-}
-
-void TextureCapsMap::insert(GLenum internalFormat, const TextureCaps &caps)
-{
- angle::Format::ID formatID = angle::Format::InternalFormatToID(internalFormat);
- get(formatID) = caps;
-}
-
-void TextureCapsMap::clear()
-{
- mFormatData.fill(TextureCaps());
-}
-
-const TextureCaps &TextureCapsMap::get(GLenum internalFormat) const
-{
- angle::Format::ID formatID = angle::Format::InternalFormatToID(internalFormat);
- return get(formatID);
-}
-
-const TextureCaps &TextureCapsMap::get(angle::Format::ID formatID) const
-{
- return mFormatData[static_cast<size_t>(formatID)];
-}
-
-TextureCaps &TextureCapsMap::get(angle::Format::ID formatID)
-{
- return mFormatData[static_cast<size_t>(formatID)];
-}
-
-void TextureCapsMap::set(angle::Format::ID 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()
- : elementIndexUint(false),
- packedDepthStencil(false),
- getProgramBinary(false),
- rgb8rgba8(false),
- textureFormatBGRA8888(false),
- readFormatBGRA(false),
- pixelBufferObject(false),
- mapBuffer(false),
- mapBufferRange(false),
- colorBufferHalfFloat(false),
- textureHalfFloat(false),
- textureHalfFloatLinear(false),
- textureFloat(false),
- textureFloatLinear(false),
- textureRG(false),
- textureCompressionDXT1(false),
- textureCompressionDXT3(false),
- textureCompressionDXT5(false),
- textureCompressionS3TCsRGB(false),
- textureCompressionASTCHDR(false),
- textureCompressionASTCLDR(false),
- compressedETC1RGB8Texture(false),
- sRGB(false),
- depthTextures(false),
- depth32(false),
- textureStorage(false),
- textureNPOT(false),
- drawBuffers(false),
- textureFilterAnisotropic(false),
- maxTextureAnisotropy(0.0f),
- occlusionQueryBoolean(false),
- fence(false),
- disjointTimerQuery(false),
- queryCounterBitsTimeElapsed(0),
- queryCounterBitsTimestamp(0),
- robustness(false),
- robustBufferAccessBehavior(false),
- blendMinMax(false),
- framebufferBlit(false),
- framebufferMultisample(false),
- instancedArrays(false),
- packReverseRowOrder(false),
- standardDerivatives(false),
- shaderTextureLOD(false),
- fragDepth(false),
- multiview(false),
- maxViews(1u),
- textureUsage(false),
- translatedShaderSource(false),
- fboRenderMipmap(false),
- discardFramebuffer(false),
- debugMarker(false),
- eglImage(false),
- eglImageExternal(false),
- eglImageExternalEssl3(false),
- eglStreamConsumerExternal(false),
- unpackSubimage(false),
- packSubimage(false),
- vertexArrayObject(false),
- debug(false),
- maxDebugMessageLength(0),
- maxDebugLoggedMessages(0),
- maxDebugGroupStackDepth(0),
- maxLabelLength(0),
- noError(false),
- lossyETCDecode(false),
- bindUniformLocation(false),
- syncQuery(false),
- copyTexture(false),
- copyCompressedTexture(false),
- webglCompatibility(false),
- requestExtension(false),
- bindGeneratesResource(false),
- robustClientMemory(false),
- textureSRGBDecode(false),
- sRGBWriteControl(false),
- colorBufferFloatRGB(false),
- colorBufferFloatRGBA(false),
- colorBufferFloat(false),
- multisampleCompatibility(false),
- framebufferMixedSamples(false),
- textureNorm16(false),
- pathRendering(false),
- surfacelessContext(false),
- clientArrays(false),
- robustResourceInitialization(false),
- programCacheControl(false),
- textureRectangle(false),
- geometryShader(false),
- maxGeometryOutputVertices(0),
- maxGeometryShaderInvocations(0)
-{
-}
-
-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()
- : noFrontFacingSupport(false),
- noSampleAlphaToCoverageSupport(false),
- attributeZeroRequiresZeroDivisorInEXT(false),
- noSeparateStencilRefsAndMasks(false),
- shadersRequireIndexedLoopValidation(false),
- noSimultaneousConstantColorAndAlphaBlendFunc(false)
-{
-}
-
-static bool GetFormatSupportBase(const TextureCapsMap &textureCaps,
- const GLenum *requiredFormats,
- size_t requiredFormatsSize,
- bool requiresTexturing,
- bool requiresFiltering,
- bool requiresRendering)
-{
- 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 (requiresRendering && !cap.renderable)
- {
- return false;
- }
- }
-
- return true;
-}
-
-template <size_t N>
-static bool GetFormatSupport(const TextureCapsMap &textureCaps,
- const GLenum (&requiredFormats)[N],
- bool requiresTexturing,
- bool requiresFiltering,
- bool requiresRendering)
-{
- return GetFormatSupportBase(textureCaps, requiredFormats, N, requiresTexturing,
- requiresFiltering, requiresRendering);
-}
-
-// 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);
-}
-
-// Checks for GL_OES_rgb8_rgba8 support
-static bool DetermineRGB8AndRGBA8TextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGB8, GL_RGBA8,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, true, 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);
-}
-
-// Checks for GL_OES_color_buffer_half_float support
-static bool DetermineColorBufferHalfFloatSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGBA16F, GL_RGB16F, GL_RG16F, GL_R16F,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
-}
-
-// Checks for GL_OES_texture_half_float support
-static bool DetermineHalfFloatTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGB16F, GL_RGBA16F,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, false, false);
-}
-
-// Checks for GL_OES_texture_half_float_linear support
-static bool DetermineHalfFloatTextureFilteringSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGB16F, GL_RGBA16F,
- };
-
- return DetermineHalfFloatTextureSupport(textureCaps) &&
- GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-// Checks for GL_OES_texture_float support
-static bool DetermineFloatTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGB32F, GL_RGBA32F,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, false, false);
-}
-
-// Checks for GL_OES_texture_float_linear support
-static bool DetermineFloatTextureFilteringSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGB32F, GL_RGBA32F,
- };
-
- return DetermineFloatTextureSupport(textureCaps) &&
- GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-// Checks for GL_EXT_texture_rg support
-static bool DetermineRGHalfFloatTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_R16F, GL_RG16F,
- };
- return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-static bool DetermineRGFloatTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_R32F, GL_RG32F,
- };
- return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-static bool DetermineRGTextureSupport(const TextureCapsMap &textureCaps, bool checkHalfFloatFormats, bool checkFloatFormats)
-{
- if (checkHalfFloatFormats && !DetermineRGHalfFloatTextureSupport(textureCaps))
- {
- return false;
- }
-
- if (checkFloatFormats && !DetermineRGFloatTextureSupport(textureCaps))
- {
- return false;
- }
-
- constexpr GLenum requiredFormats[] = {
- GL_R8, GL_RG8,
- };
- return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-// 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);
-}
-
-// 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);
-}
-
-// 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);
-}
-
-// 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);
-}
-
-// Check for GL_KHR_texture_compression_astc_hdr and GL_KHR_texture_compression_astc_ldr
-static bool DetermineASTCTextureSupport(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);
-}
-
-// 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);
-}
-
-// Check for GL_ANGLE_texture_compression_dxt5
-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) &&
- GetFormatSupport(textureCaps, requiredRenderFormats, true, false, true);
-}
-
-// Check for GL_ANGLE_depth_texture
-static bool DetermineDepthTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT32_OES, GL_DEPTH24_STENCIL8_OES,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, true, 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);
-}
-
-// 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);
-}
-
-// 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);
-}
-
-// 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);
-}
-
-// 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) &&
- GetFormatSupport(textureCaps, requiredRenderFormats, true, false, true);
-}
-
-void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps)
-{
- packedDepthStencil = DeterminePackedDepthStencilSupport(textureCaps);
- rgb8rgba8 = DetermineRGB8AndRGBA8TextureSupport(textureCaps);
- textureFormatBGRA8888 = DetermineBGRA8TextureSupport(textureCaps);
- colorBufferHalfFloat = DetermineColorBufferHalfFloatSupport(textureCaps);
- textureHalfFloat = DetermineHalfFloatTextureSupport(textureCaps);
- textureHalfFloatLinear = DetermineHalfFloatTextureFilteringSupport(textureCaps);
- textureFloat = DetermineFloatTextureSupport(textureCaps);
- textureFloatLinear = DetermineFloatTextureFilteringSupport(textureCaps);
- textureRG = DetermineRGTextureSupport(textureCaps, textureHalfFloat, textureFloat);
- textureCompressionDXT1 = DetermineDXT1TextureSupport(textureCaps);
- textureCompressionDXT3 = DetermineDXT3TextureSupport(textureCaps);
- textureCompressionDXT5 = DetermineDXT5TextureSupport(textureCaps);
- textureCompressionS3TCsRGB = DetermineS3TCsRGBTextureSupport(textureCaps);
- textureCompressionASTCHDR = DetermineASTCTextureSupport(textureCaps);
- textureCompressionASTCLDR = textureCompressionASTCHDR;
- compressedETC1RGB8Texture = DetermineETC1RGB8TextureSupport(textureCaps);
- sRGB = DetermineSRGBTextureSupport(textureCaps);
- depthTextures = DetermineDepthTextureSupport(textureCaps);
- depth32 = DetermineDepth32Support(textureCaps);
- colorBufferFloatRGB = DetermineColorBufferFloatRGBSupport(textureCaps);
- colorBufferFloatRGBA = DetermineColorBufferFloatRGBASupport(textureCaps);
- colorBufferFloat = DetermineColorBufferFloatSupport(textureCaps);
- textureNorm16 = DetermineTextureNorm16Support(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_hdr"] = enableableExtension(&Extensions::textureCompressionASTCHDR);
- map["GL_KHR_texture_compression_astc_ldr"] = enableableExtension(&Extensions::textureCompressionASTCLDR);
- map["GL_OES_compressed_ETC1_RGB8_texture"] = enableableExtension(&Extensions::compressedETC1RGB8Texture);
- map["GL_EXT_sRGB"] = enableableExtension(&Extensions::sRGB);
- map["GL_ANGLE_depth_texture"] = esOnlyExtension(&Extensions::depthTextures);
- map["GL_OES_depth32"] = esOnlyExtension(&Extensions::depth32);
- map["GL_EXT_texture_storage"] = esOnlyExtension(&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::instancedArrays);
- 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_ANGLE_multiview"] = enableableExtension(&Extensions::multiview);
- 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"] = esOnlyExtension(&Extensions::eglImage);
- map["GL_OES_EGL_image_external"] = esOnlyExtension(&Extensions::eglImageExternal);
- map["GL_OES_EGL_image_external_essl3"] = esOnlyExtension(&Extensions::eglImageExternalEssl3);
- map["GL_NV_EGL_stream_consumer_external"] = esOnlyExtension(&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"] = esOnlyExtension(&Extensions::vertexArrayObject);
- map["GL_KHR_debug"] = esOnlyExtension(&Extensions::debug);
- // 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_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);
- // clang-format on
-
- return map;
- };
-
- static const ExtensionInfoMap extensionInfo = buildExtensionInfoMap();
- return extensionInfo;
-}
-
-TypePrecision::TypePrecision() : range({{0, 0}}), precision(0)
-{
-}
-
-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()
- : maxElementIndex(0),
- max3DTextureSize(0),
- max2DTextureSize(0),
- maxRectangleTextureSize(0),
- maxArrayTextureLayers(0),
- maxLODBias(0),
- maxCubeMapTextureSize(0),
- maxRenderbufferSize(0),
- minAliasedPointSize(0),
- maxAliasedPointSize(0),
- minAliasedLineWidth(0),
- maxAliasedLineWidth(0),
-
- // Table 20.40
- maxDrawBuffers(0),
- maxFramebufferWidth(0),
- maxFramebufferHeight(0),
- maxFramebufferSamples(0),
- maxColorAttachments(0),
- maxViewportWidth(0),
- maxViewportHeight(0),
- maxSampleMaskWords(0),
- maxColorTextureSamples(0),
- maxDepthTextureSamples(0),
- maxIntegerSamples(0),
- maxServerWaitTimeout(0),
-
- // Table 20.41
- maxVertexAttribRelativeOffset(0),
- maxVertexAttribBindings(0),
- maxVertexAttribStride(0),
- maxElementsIndices(0),
- maxElementsVertices(0),
-
- // Table 20.43
- maxVertexAttributes(0),
- maxVertexUniformComponents(0),
- maxVertexUniformVectors(0),
- maxVertexUniformBlocks(0),
- maxVertexOutputComponents(0),
- maxVertexTextureImageUnits(0),
- maxVertexAtomicCounterBuffers(0),
- maxVertexAtomicCounters(0),
- maxVertexImageUniforms(0),
- maxVertexShaderStorageBlocks(0),
-
- // Table 20.44
- maxFragmentUniformComponents(0),
- maxFragmentUniformVectors(0),
- maxFragmentUniformBlocks(0),
- maxFragmentInputComponents(0),
- maxTextureImageUnits(0),
- maxFragmentAtomicCounterBuffers(0),
- maxFragmentAtomicCounters(0),
- maxFragmentImageUniforms(0),
- maxFragmentShaderStorageBlocks(0),
- minProgramTextureGatherOffset(0),
- maxProgramTextureGatherOffset(0),
- minProgramTexelOffset(0),
- maxProgramTexelOffset(0),
-
- // Table 20.45
- maxComputeWorkGroupInvocations(0),
- maxComputeUniformBlocks(0),
- maxComputeTextureImageUnits(0),
- maxComputeSharedMemorySize(0),
- maxComputeUniformComponents(0),
- maxComputeAtomicCounterBuffers(0),
- maxComputeAtomicCounters(0),
- maxComputeImageUniforms(0),
- maxCombinedComputeUniformComponents(0),
- maxComputeShaderStorageBlocks(0),
-
- // Table 20.46
- maxUniformBufferBindings(0),
- maxUniformBlockSize(0),
- uniformBufferOffsetAlignment(0),
- maxCombinedUniformBlocks(0),
- maxCombinedVertexUniformComponents(0),
- maxCombinedFragmentUniformComponents(0),
- maxVaryingComponents(0),
- maxVaryingVectors(0),
- maxCombinedTextureImageUnits(0),
- maxCombinedShaderOutputResources(0),
-
- // Table 20.47
- maxUniformLocations(0),
- maxAtomicCounterBufferBindings(0),
- maxAtomicCounterBufferSize(0),
- maxCombinedAtomicCounterBuffers(0),
- maxCombinedAtomicCounters(0),
- maxImageUnits(0),
- maxCombinedImageUniforms(0),
- maxShaderStorageBufferBindings(0),
- maxShaderStorageBlockSize(0),
- maxCombinedShaderStorageBlocks(0),
- shaderStorageBufferOffsetAlignment(0),
-
- // Table 20.48
- maxTransformFeedbackInterleavedComponents(0),
- maxTransformFeedbackSeparateAttributes(0),
- maxTransformFeedbackSeparateComponents(0),
-
- // Table 20.49
- maxSamples(0)
-{
- for (size_t i = 0; i < 3; ++i)
- {
- maxComputeWorkGroupCount[i] = 0;
- maxComputeWorkGroupSize[i] = 0;
- }
-}
-
-Caps::Caps(const Caps &other) = default;
-Caps::~Caps() = default;
-
-Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensions)
-{
- Caps caps;
-
- 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.maxTextureImageUnits = 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.maxVertexUniformComponents = 1024;
- caps.maxVertexUniformVectors = 256;
- caps.maxVertexUniformBlocks = 12;
- caps.maxVertexOutputComponents = 64;
- caps.maxVertexTextureImageUnits = 16;
-
- // Table 6.32
- caps.maxFragmentUniformComponents = 896;
- caps.maxFragmentUniformVectors = 224;
- caps.maxFragmentUniformBlocks = 12;
- caps.maxFragmentInputComponents = 60;
- caps.maxTextureImageUnits = 16;
- caps.minProgramTexelOffset = -8;
- caps.maxProgramTexelOffset = 7;
-
- // Table 6.33
- caps.maxUniformBufferBindings = 24;
- caps.maxUniformBlockSize = 16384;
- caps.uniformBufferOffsetAlignment = 256;
- caps.maxCombinedUniformBlocks = 24;
- caps.maxCombinedVertexUniformComponents =
- caps.maxVertexUniformBlocks * (caps.maxUniformBlockSize / 4) +
- caps.maxVertexUniformComponents;
- caps.maxCombinedFragmentUniformComponents =
- caps.maxFragmentUniformBlocks * (caps.maxUniformBlockSize / 4) +
- caps.maxFragmentUniformComponents;
- 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.maxVertexAtomicCounterBuffers = 0;
- caps.maxVertexAtomicCounters = 0;
- caps.maxVertexImageUniforms = 0;
- caps.maxVertexShaderStorageBlocks = 0;
-
- // Table 20.44
- caps.maxFragmentUniformComponents = 1024;
- caps.maxFragmentUniformVectors = 256;
- caps.maxFragmentAtomicCounterBuffers = 0;
- caps.maxFragmentAtomicCounters = 0;
- caps.maxFragmentImageUniforms = 0;
- caps.maxFragmentShaderStorageBlocks = 0;
- caps.minProgramTextureGatherOffset = 0;
- caps.maxProgramTextureGatherOffset = 0;
-
- // Table 20.45
- caps.maxComputeWorkGroupCount = {{65535, 65535, 65535}};
- caps.maxComputeWorkGroupSize = {{128, 128, 64}};
- caps.maxComputeWorkGroupInvocations = 12;
- caps.maxComputeUniformBlocks = 12;
- caps.maxComputeTextureImageUnits = 16;
- caps.maxComputeSharedMemorySize = 16384;
- caps.maxComputeUniformComponents = 1024;
- caps.maxComputeAtomicCounterBuffers = 1;
- caps.maxComputeAtomicCounters = 8;
- caps.maxComputeImageUniforms = 4;
- caps.maxCombinedComputeUniformComponents =
- caps.maxComputeUniformBlocks * static_cast<GLuint>(caps.maxUniformBlockSize / 4) +
- caps.maxComputeUniformComponents;
- caps.maxComputeShaderStorageBlocks = 4;
-
- // Table 20.46
- caps.maxUniformBufferBindings = 36;
- caps.maxCombinedFragmentUniformComponents =
- caps.maxFragmentUniformBlocks * (caps.maxUniformBlockSize / 4) +
- caps.maxFragmentUniformComponents;
- 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;
- }
-
- return caps;
-}
-}
-
-namespace egl
-{
-
-Caps::Caps()
- : textureNPOT(false)
-{
-}
-
-DisplayExtensions::DisplayExtensions()
- : createContextRobustness(false),
- d3dShareHandleClientBuffer(false),
- d3dTextureClientBuffer(false),
- surfaceD3DTexture2DShareHandle(false),
- querySurfacePointer(false),
- windowFixedSize(false),
- keyedMutex(false),
- surfaceOrientation(false),
- postSubBuffer(false),
- createContext(false),
- deviceQuery(false),
- image(false),
- imageBase(false),
- imagePixmap(false),
- glTexture2DImage(false),
- glTextureCubemapImage(false),
- glTexture3DImage(false),
- glRenderbufferImage(false),
- getAllProcAddresses(false),
- flexibleSurfaceCompatibility(false),
- directComposition(false),
- createContextNoError(false),
- stream(false),
- streamConsumerGLTexture(false),
- streamConsumerGLTextureYUV(false),
- streamProducerD3DTextureNV12(false),
- createContextWebGLCompatibility(false),
- createContextBindGeneratesResource(false),
- getSyncValues(false),
- swapBuffersWithDamage(false),
- pixelFormatFloat(false),
- surfacelessContext(false),
- displayTextureShareGroup(false),
- createContextClientArrays(false),
- programCacheControl(false),
- robustResourceInitialization(false)
-{
-}
-
-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_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_ANGLE_flexible_surface_compatibility", flexibleSurfaceCompatibility, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_stream_producer_d3d_texture_nv12", streamProducerD3DTextureNV12, &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_EXT_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);
- // TODO(jmadill): Enable this when complete.
- //InsertExtensionString("KHR_create_context_no_error", createContextNoError, &extensionStrings);
- // clang-format on
-
- return extensionStrings;
-}
-
-DeviceExtensions::DeviceExtensions()
- : deviceD3D(false)
-{
-}
-
-std::vector<std::string> DeviceExtensions::getStrings() const
-{
- std::vector<std::string> extensionStrings;
-
- // | Extension name | Supported flag | Output vector |
- InsertExtensionString("EGL_ANGLE_device_d3d", deviceD3D, &extensionStrings);
-
- return extensionStrings;
-}
-
-ClientExtensions::ClientExtensions()
- : clientExtensions(false),
- platformBase(false),
- platformDevice(false),
- platformANGLE(false),
- platformANGLED3D(false),
- platformANGLEOpenGL(false),
- platformANGLEVulkan(false),
- deviceCreation(false),
- deviceCreationD3D11(false),
- x11Visual(false),
- experimentalPresentPath(false),
- clientGetAllProcAddresses(false)
-{
-}
-
-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_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);
- // clang-format on
-
- return extensionStrings;
-}
-
-} // namespace egl
diff --git a/src/3rdparty/angle/src/libANGLE/Caps.h b/src/3rdparty/angle/src/libANGLE/Caps.h
deleted file mode 100644
index 64bdf97112..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Caps.h
+++ /dev/null
@@ -1,758 +0,0 @@
-//
-// 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 <map>
-#include <set>
-#include <string>
-#include <vector>
-#include <array>
-
-namespace gl
-{
-
-struct Extensions;
-
-typedef std::set<GLuint> SupportedSampleSet;
-
-struct TextureCaps
-{
- TextureCaps();
- TextureCaps(const TextureCaps &other);
- ~TextureCaps();
-
- // Supports for basic texturing: glTexImage, glTexSubImage, etc
- bool texturable;
-
- // Support for linear or anisotropic filtering
- bool filterable;
-
- // Support for being used as a framebuffer attachment or renderbuffer format
- bool renderable;
-
- // Set of supported sample counts, only guaranteed to be valid in ES3.
- SupportedSampleSet sampleCounts;
-
- // Get the maximum number of samples supported
- GLuint getMaxSamples() const;
-
- // Get the number of supported samples that is at least as many as requested. Returns 0 if
- // there are no sample counts available
- GLuint getNearestSamples(GLuint requestedSamples) const;
-};
-
-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::Format::ID formatID) const;
- void set(angle::Format::ID formatID, const TextureCaps &caps);
-
- private:
- TextureCaps &get(angle::Format::ID formatID);
-
- // Indexed by angle::Format::ID
- std::array<TextureCaps, angle::kNumANGLEFormats> mFormatData;
-};
-
-void InitMinimumTextureCapsMap(const Version &clientVersion,
- const Extensions &extensions,
- TextureCapsMap *capsMap);
-
-struct Extensions
-{
- Extensions();
-
- // 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_hdr, GL_KHR_texture_compression_astc_ldr
- // 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
- void setTextureExtensionSupport(const TextureCapsMap &textureCaps);
-
- // ES2 Extension support
-
- // GL_OES_element_index_uint
- bool elementIndexUint;
-
- // GL_OES_packed_depth_stencil
- bool packedDepthStencil;
-
- // GL_OES_get_program_binary
- bool getProgramBinary;
-
- // GL_OES_rgb8_rgba8
- // Implies that TextureCaps for GL_RGB8 and GL_RGBA8 exist
- bool rgb8rgba8;
-
- // GL_EXT_texture_format_BGRA8888
- // Implies that TextureCaps for GL_BGRA8 exist
- bool textureFormatBGRA8888;
-
- // GL_EXT_read_format_bgra
- bool readFormatBGRA;
-
- // GL_NV_pixel_buffer_object
- bool pixelBufferObject;
-
- // GL_OES_mapbuffer and GL_EXT_map_buffer_range
- bool mapBuffer;
- bool mapBufferRange;
-
- // GL_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;
-
- // GL_OES_texture_half_float and GL_OES_texture_half_float_linear
- // Implies that TextureCaps for GL_RGB16F, GL_RGBA16F, GL_ALPHA32F_EXT, GL_LUMINANCE32F_EXT and
- // GL_LUMINANCE_ALPHA32F_EXT exist
- bool textureHalfFloat;
- bool textureHalfFloatLinear;
-
- // GL_OES_texture_float and GL_OES_texture_float_linear
- // Implies that TextureCaps for GL_RGB32F, GL_RGBA32F, GL_ALPHA16F_EXT, GL_LUMINANCE16F_EXT and
- // GL_LUMINANCE_ALPHA16F_EXT exist
- bool textureFloat;
- bool textureFloatLinear;
-
- // GL_EXT_texture_rg
- // Implies that TextureCaps for GL_R8, GL_RG8 (and floating point R/RG texture formats if floating point extensions
- // are also present) exist
- bool textureRG;
-
- // GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3 and GL_ANGLE_texture_compression_dxt5
- // Implies that TextureCaps 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;
- bool textureCompressionDXT3;
- bool textureCompressionDXT5;
-
- // 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;
-
- // GL_KHR_texture_compression_astc_hdr
- bool textureCompressionASTCHDR;
-
- // GL_KHR_texture_compression_astc_ldr
- bool textureCompressionASTCLDR;
-
- // GL_OES_compressed_ETC1_RGB8_texture
- // Implies that TextureCaps for GL_ETC1_RGB8_OES exist
- bool compressedETC1RGB8Texture;
-
- // GL_EXT_sRGB
- // Implies that TextureCaps for GL_SRGB8_ALPHA8 and GL_SRGB8 exist
- // TODO: Don't advertise this extension in ES3
- bool sRGB;
-
- // GL_ANGLE_depth_texture
- bool depthTextures;
-
- // GL_OES_depth32
- // Allows DEPTH_COMPONENT32_OES as a valid Renderbuffer format.
- bool depth32;
-
- // GL_EXT_texture_storage
- bool textureStorage;
-
- // GL_OES_texture_npot
- bool textureNPOT;
-
- // GL_EXT_draw_buffers
- bool drawBuffers;
-
- // GL_EXT_texture_filter_anisotropic
- bool textureFilterAnisotropic;
- GLfloat maxTextureAnisotropy;
-
- // GL_EXT_occlusion_query_boolean
- bool occlusionQueryBoolean;
-
- // GL_NV_fence
- bool fence;
-
- // GL_EXT_disjoint_timer_query
- bool disjointTimerQuery;
- GLuint queryCounterBitsTimeElapsed;
- GLuint queryCounterBitsTimestamp;
-
- // GL_EXT_robustness
- bool robustness;
-
- // GL_KHR_robust_buffer_access_behavior
- bool robustBufferAccessBehavior;
-
- // GL_EXT_blend_minmax
- bool blendMinMax;
-
- // GL_ANGLE_framebuffer_blit
- bool framebufferBlit;
-
- // GL_ANGLE_framebuffer_multisample
- bool framebufferMultisample;
-
- // GL_ANGLE_instanced_arrays
- bool instancedArrays;
-
- // GL_ANGLE_pack_reverse_row_order
- bool packReverseRowOrder;
-
- // GL_OES_standard_derivatives
- bool standardDerivatives;
-
- // GL_EXT_shader_texture_lod
- bool shaderTextureLOD;
-
- // GL_EXT_frag_depth
- bool fragDepth;
-
- // ANGLE_multiview
- bool multiview;
- GLuint maxViews;
-
- // GL_ANGLE_texture_usage
- bool textureUsage;
-
- // GL_ANGLE_translated_shader_source
- bool translatedShaderSource;
-
- // GL_OES_fbo_render_mipmap
- bool fboRenderMipmap;
-
- // GL_EXT_discard_framebuffer
- bool discardFramebuffer;
-
- // EXT_debug_marker
- bool debugMarker;
-
- // GL_OES_EGL_image
- bool eglImage;
-
- // GL_OES_EGL_image_external
- bool eglImageExternal;
-
- // GL_OES_EGL_image_external_essl3
- bool eglImageExternalEssl3;
-
- // NV_EGL_stream_consumer_external
- bool eglStreamConsumerExternal;
-
- // EXT_unpack_subimage
- bool unpackSubimage;
-
- // NV_pack_subimage
- bool packSubimage;
-
- // GL_OES_vertex_array_object
- bool vertexArrayObject;
-
- // GL_KHR_debug
- bool debug;
- GLuint maxDebugMessageLength;
- GLuint maxDebugLoggedMessages;
- GLuint maxDebugGroupStackDepth;
- GLuint maxLabelLength;
-
- // KHR_no_error
- bool noError;
-
- // GL_ANGLE_lossy_etc_decode
- bool lossyETCDecode;
-
- // GL_CHROMIUM_bind_uniform_location
- bool bindUniformLocation;
-
- // GL_CHROMIUM_sync_query
- bool syncQuery;
-
- // GL_CHROMIUM_copy_texture
- bool copyTexture;
-
- // GL_CHROMIUM_copy_compressed_texture
- bool copyCompressedTexture;
-
- // GL_ANGLE_webgl_compatibility
- bool webglCompatibility;
-
- // GL_ANGLE_request_extension
- bool requestExtension;
-
- // GL_CHROMIUM_bind_generates_resource
- bool bindGeneratesResource;
-
- // GL_ANGLE_robust_client_memory
- bool robustClientMemory;
-
- // GL_EXT_texture_sRGB_decode
- bool textureSRGBDecode;
-
- // GL_EXT_sRGB_write_control
- bool sRGBWriteControl;
-
- // GL_CHROMIUM_color_buffer_float_rgb
- bool colorBufferFloatRGB;
-
- // GL_CHROMIUM_color_buffer_float_rgba
- bool colorBufferFloatRGBA;
-
- // ES3 Extension support
-
- // GL_EXT_color_buffer_float
- bool colorBufferFloat;
-
- // GL_EXT_multisample_compatibility.
- // written against ES 3.1 but can apply to earlier versions.
- bool multisampleCompatibility;
-
- // GL_CHROMIUM_framebuffer_mixed_samples
- bool framebufferMixedSamples;
-
- // GL_EXT_texture_norm16
- // written against ES 3.1 but can apply to ES 3.0 as well.
- bool textureNorm16;
-
- // GL_CHROMIUM_path_rendering
- bool pathRendering;
-
- // GL_OES_surfaceless_context
- bool surfacelessContext;
-
- // GL_ANGLE_client_arrays
- bool clientArrays;
-
- // GL_ANGLE_robust_resource_initialization
- bool robustResourceInitialization;
-
- // GL_ANGLE_program_cache_control
- bool programCacheControl;
-
- // GL_ANGLE_texture_rectangle
- bool textureRectangle;
-
- // GL_EXT_geometry_shader
- bool geometryShader;
- // GL_EXT_geometry_shader (May 31, 2016) Table 20.43gs: Implementation dependent geometry shader
- // limits
- // TODO(jiawei.shao@intel.com): add all implementation dependent geometry shader limits.
- GLuint maxGeometryOutputVertices;
- GLuint maxGeometryShaderInvocations;
-};
-
-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;
-
- // Renderer doesn't support GL_SAMPLE_ALPHA_TO_COVERAGE
- bool noSampleAlphaToCoverageSupport;
-
- // In glVertexAttribDivisorANGLE, attribute zero must have a zero divisor
- bool attributeZeroRequiresZeroDivisorInEXT;
-
- // Unable to support different values for front and back faces for stencil refs and masks
- bool noSeparateStencilRefsAndMasks;
-
- // Renderer doesn't support non-constant indexing loops in fragment shader
- bool shadersRequireIndexedLoopValidation;
-
- // 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;
-};
-
-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;
- GLint precision;
-};
-
-struct Caps
-{
- Caps();
- Caps(const Caps &other);
- ~Caps();
-
- // ES 3.1 (April 29, 2015) 20.39: implementation dependent values
- GLuint64 maxElementIndex;
- GLuint max3DTextureSize;
- GLuint max2DTextureSize;
- GLuint maxRectangleTextureSize;
- GLuint maxArrayTextureLayers;
- GLfloat maxLODBias;
- GLuint maxCubeMapTextureSize;
- GLuint maxRenderbufferSize;
- GLfloat minAliasedPointSize;
- GLfloat maxAliasedPointSize;
- GLfloat minAliasedLineWidth;
- GLfloat maxAliasedLineWidth;
-
- // ES 3.1 (April 29, 2015) 20.40: implementation dependent values (cont.)
- GLuint maxDrawBuffers;
- GLuint maxFramebufferWidth;
- GLuint maxFramebufferHeight;
- GLuint maxFramebufferSamples;
- GLuint maxColorAttachments;
- GLuint maxViewportWidth;
- GLuint maxViewportHeight;
- GLuint maxSampleMaskWords;
- GLuint maxColorTextureSamples;
- GLuint maxDepthTextureSamples;
- GLuint maxIntegerSamples;
- GLuint64 maxServerWaitTimeout;
-
- // ES 3.1 (April 29, 2015) Table 20.41: Implementation dependent values (cont.)
- GLint maxVertexAttribRelativeOffset;
- GLuint maxVertexAttribBindings;
- GLint maxVertexAttribStride;
- GLuint maxElementsIndices;
- GLuint maxElementsVertices;
- 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;
-
- // ES 3.1 (April 29, 2015) Table 20.43: Implementation dependent Vertex shader limits
- GLuint maxVertexAttributes;
- GLuint maxVertexUniformComponents;
- GLuint maxVertexUniformVectors;
- GLuint maxVertexUniformBlocks;
- GLuint maxVertexOutputComponents;
- GLuint maxVertexTextureImageUnits;
- GLuint maxVertexAtomicCounterBuffers;
- GLuint maxVertexAtomicCounters;
- GLuint maxVertexImageUniforms;
- GLuint maxVertexShaderStorageBlocks;
-
- // ES 3.1 (April 29, 2015) Table 20.44: Implementation dependent Fragment shader limits
- GLuint maxFragmentUniformComponents;
- GLuint maxFragmentUniformVectors;
- GLuint maxFragmentUniformBlocks;
- GLuint maxFragmentInputComponents;
- GLuint maxTextureImageUnits;
- GLuint maxFragmentAtomicCounterBuffers;
- GLuint maxFragmentAtomicCounters;
- GLuint maxFragmentImageUniforms;
- GLuint maxFragmentShaderStorageBlocks;
- GLint minProgramTextureGatherOffset;
- GLuint maxProgramTextureGatherOffset;
- GLint minProgramTexelOffset;
- GLint maxProgramTexelOffset;
-
- // ES 3.1 (April 29, 2015) Table 20.45: implementation dependent compute shader limits
- std::array<GLuint, 3> maxComputeWorkGroupCount;
- std::array<GLuint, 3> maxComputeWorkGroupSize;
- GLuint maxComputeWorkGroupInvocations;
- GLuint maxComputeUniformBlocks;
- GLuint maxComputeTextureImageUnits;
- GLuint maxComputeSharedMemorySize;
- GLuint maxComputeUniformComponents;
- GLuint maxComputeAtomicCounterBuffers;
- GLuint maxComputeAtomicCounters;
- GLuint maxComputeImageUniforms;
- GLuint maxCombinedComputeUniformComponents;
- GLuint maxComputeShaderStorageBlocks;
-
- // ES 3.1 (April 29, 2015) Table 20.46: implementation dependent aggregate shader limits
- GLuint maxUniformBufferBindings;
- GLuint64 maxUniformBlockSize;
- GLuint uniformBufferOffsetAlignment;
- GLuint maxCombinedUniformBlocks;
- GLuint64 maxCombinedVertexUniformComponents;
- GLuint64 maxCombinedFragmentUniformComponents;
- GLuint maxVaryingComponents;
- GLuint maxVaryingVectors;
- GLuint maxCombinedTextureImageUnits;
- GLuint maxCombinedShaderOutputResources;
-
- // ES 3.1 (April 29, 2015) Table 20.47: implementation dependent aggregate shader limits (cont.)
- GLuint maxUniformLocations;
- GLuint maxAtomicCounterBufferBindings;
- GLuint maxAtomicCounterBufferSize;
- GLuint maxCombinedAtomicCounterBuffers;
- GLuint maxCombinedAtomicCounters;
- GLuint maxImageUnits;
- GLuint maxCombinedImageUniforms;
- GLuint maxShaderStorageBufferBindings;
- GLuint64 maxShaderStorageBlockSize;
- GLuint maxCombinedShaderStorageBlocks;
- GLuint shaderStorageBufferOffsetAlignment;
-
- // ES 3.1 (April 29, 2015) Table 20.48: implementation dependent transform feedback limits
- GLuint maxTransformFeedbackInterleavedComponents;
- GLuint maxTransformFeedbackSeparateAttributes;
- GLuint maxTransformFeedbackSeparateComponents;
-
- // ES 3.1 (April 29, 2015) Table 20.49: Framebuffer Dependent Values
- GLuint maxSamples;
-};
-
-Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensions);
-}
-
-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;
-
- // EGL_ANGLE_d3d_share_handle_client_buffer
- bool d3dShareHandleClientBuffer;
-
- // EGL_ANGLE_d3d_texture_client_buffer
- bool d3dTextureClientBuffer;
-
- // EGL_ANGLE_surface_d3d_texture_2d_share_handle
- bool surfaceD3DTexture2DShareHandle;
-
- // EGL_ANGLE_query_surface_pointer
- bool querySurfacePointer;
-
- // EGL_ANGLE_window_fixed_size
- bool windowFixedSize;
-
- // EGL_ANGLE_keyed_mutex
- bool keyedMutex;
-
- // EGL_ANGLE_surface_orientation
- bool surfaceOrientation;
-
- // EGL_NV_post_sub_buffer
- bool postSubBuffer;
-
- // EGL_KHR_create_context
- bool createContext;
-
- // EGL_EXT_device_query
- bool deviceQuery;
-
- // EGL_KHR_image
- bool image;
-
- // EGL_KHR_image_base
- bool imageBase;
-
- // EGL_KHR_image_pixmap
- bool imagePixmap;
-
- // EGL_KHR_gl_texture_2D_image
- bool glTexture2DImage;
-
- // EGL_KHR_gl_texture_cubemap_image
- bool glTextureCubemapImage;
-
- // EGL_KHR_gl_texture_3D_image
- bool glTexture3DImage;
-
- // EGL_KHR_gl_renderbuffer_image
- bool glRenderbufferImage;
-
- // EGL_KHR_get_all_proc_addresses
- bool getAllProcAddresses;
-
- // EGL_ANGLE_flexible_surface_compatibility
- bool flexibleSurfaceCompatibility;
-
- // EGL_ANGLE_direct_composition
- bool directComposition;
-
- // KHR_create_context_no_error
- bool createContextNoError;
-
- // EGL_KHR_stream
- bool stream;
-
- // EGL_KHR_stream_consumer_gltexture
- bool streamConsumerGLTexture;
-
- // EGL_NV_stream_consumer_gltexture_yuv
- bool streamConsumerGLTextureYUV;
-
- // EGL_ANGLE_stream_producer_d3d_texture_nv12
- bool streamProducerD3DTextureNV12;
-
- // EGL_ANGLE_create_context_webgl_compatibility
- bool createContextWebGLCompatibility;
-
- // EGL_CHROMIUM_create_context_bind_generates_resource
- bool createContextBindGeneratesResource;
-
- // EGL_CHROMIUM_get_sync_values
- bool getSyncValues;
-
- // EGL_EXT_swap_buffers_with_damage
- bool swapBuffersWithDamage;
-
- // EGL_EXT_pixel_format_float
- bool pixelFormatFloat;
-
- // EGL_KHR_surfaceless_context
- bool surfacelessContext;
-
- // EGL_ANGLE_display_texture_share_group
- bool displayTextureShareGroup;
-
- // EGL_ANGLE_create_context_client_arrays
- bool createContextClientArrays;
-
- // EGL_ANGLE_program_cache_control
- bool programCacheControl;
-
- // EGL_ANGLE_robust_resource_initialization
- bool robustResourceInitialization;
-};
-
-struct DeviceExtensions
-{
- DeviceExtensions();
-
- // Generate a vector of supported extension strings
- std::vector<std::string> getStrings() const;
-
- // EGL_ANGLE_device_d3d
- bool deviceD3D;
-};
-
-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;
-
- // EGL_EXT_platform_base
- bool platformBase;
-
- // EGL_EXT_platform_device
- bool platformDevice;
-
- // EGL_ANGLE_platform_angle
- bool platformANGLE;
-
- // EGL_ANGLE_platform_angle_d3d
- bool platformANGLED3D;
-
- // EGL_ANGLE_platform_angle_opengl
- bool platformANGLEOpenGL;
-
- // EGL_ANGLE_platform_angle_null
- bool platformANGLENULL;
-
- // EGL_ANGLE_platform_angle_vulkan
- bool platformANGLEVulkan;
-
- // EGL_ANGLE_device_creation
- bool deviceCreation;
-
- // EGL_ANGLE_device_creation_d3d11
- bool deviceCreationD3D11;
-
- // EGL_ANGLE_x11_visual
- bool x11Visual;
-
- // EGL_ANGLE_experimental_present_path
- bool experimentalPresentPath;
-
- // EGL_KHR_client_get_all_proc_addresses
- bool clientGetAllProcAddresses;
-};
-
-} // namespace egl
-
-#endif // LIBANGLE_CAPS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Compiler.cpp b/src/3rdparty/angle/src/libANGLE/Compiler.cpp
deleted file mode 100644
index 236c7e1fc2..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Compiler.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-//
-// 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/ContextState.h"
-#include "libANGLE/renderer/CompilerImpl.h"
-#include "libANGLE/renderer/GLImplFactory.h"
-
-namespace gl
-{
-
-namespace
-{
-
-// Global count of active shader compiler handles. Needed to know when to call sh::Initialize and
-// sh::Finalize.
-size_t activeCompilerHandles = 0;
-
-ShShaderSpec SelectShaderSpec(GLint majorVersion, GLint minorVersion, bool isWebGL)
-{
- if (majorVersion >= 3)
- {
- if (minorVersion == 1)
- {
- return isWebGL ? SH_WEBGL3_SPEC : SH_GLES3_1_SPEC;
- }
- else
- {
- return isWebGL ? SH_WEBGL2_SPEC : SH_GLES3_SPEC;
- }
- }
- return isWebGL ? SH_WEBGL_SPEC : SH_GLES2_SPEC;
-}
-
-} // anonymous namespace
-
-Compiler::Compiler(rx::GLImplFactory *implFactory, const ContextState &state)
- : mImplementation(implFactory->createCompiler()),
- mSpec(SelectShaderSpec(state.getClientMajorVersion(),
- state.getClientMinorVersion(),
- state.getExtensions().webglCompatibility)),
- mOutputType(mImplementation->getTranslatorOutputType()),
- mResources(),
- mFragmentCompiler(nullptr),
- mVertexCompiler(nullptr),
- mComputeCompiler(nullptr),
- mGeometryCompiler(nullptr)
-{
- ASSERT(state.getClientMajorVersion() == 2 || state.getClientMajorVersion() == 3);
-
- const gl::Caps &caps = state.getCaps();
- const gl::Extensions &extensions = state.getExtensions();
-
- sh::InitBuiltInResources(&mResources);
- mResources.MaxVertexAttribs = caps.maxVertexAttributes;
- mResources.MaxVertexUniformVectors = caps.maxVertexUniformVectors;
- mResources.MaxVaryingVectors = caps.maxVaryingVectors;
- mResources.MaxVertexTextureImageUnits = caps.maxVertexTextureImageUnits;
- mResources.MaxCombinedTextureImageUnits = caps.maxCombinedTextureImageUnits;
- mResources.MaxTextureImageUnits = caps.maxTextureImageUnits;
- mResources.MaxFragmentUniformVectors = caps.maxFragmentUniformVectors;
- mResources.MaxDrawBuffers = caps.maxDrawBuffers;
- mResources.OES_standard_derivatives = extensions.standardDerivatives;
- mResources.EXT_draw_buffers = extensions.drawBuffers;
- mResources.EXT_shader_texture_lod = extensions.shaderTextureLOD;
- mResources.OES_EGL_image_external = extensions.eglImageExternal;
- mResources.OES_EGL_image_external_essl3 = extensions.eglImageExternalEssl3;
- mResources.NV_EGL_stream_consumer_external = extensions.eglStreamConsumerExternal;
- mResources.ARB_texture_rectangle = extensions.textureRectangle;
- // 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;
- 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;
-
- // GLSL ES 3.1 constants
- mResources.MaxProgramTextureGatherOffset = caps.maxProgramTextureGatherOffset;
- mResources.MinProgramTextureGatherOffset = caps.minProgramTextureGatherOffset;
- mResources.MaxImageUnits = caps.maxImageUnits;
- mResources.MaxVertexImageUniforms = caps.maxVertexImageUniforms;
- mResources.MaxFragmentImageUniforms = caps.maxFragmentImageUniforms;
- mResources.MaxComputeImageUniforms = caps.maxComputeImageUniforms;
- 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.maxComputeUniformComponents;
- mResources.MaxComputeTextureImageUnits = caps.maxComputeTextureImageUnits;
-
- mResources.MaxComputeAtomicCounters = caps.maxComputeAtomicCounters;
- mResources.MaxComputeAtomicCounterBuffers = caps.maxComputeAtomicCounterBuffers;
-
- mResources.MaxVertexAtomicCounters = caps.maxVertexAtomicCounters;
- mResources.MaxFragmentAtomicCounters = caps.maxFragmentAtomicCounters;
- mResources.MaxCombinedAtomicCounters = caps.maxCombinedAtomicCounters;
- mResources.MaxAtomicCounterBindings = caps.maxAtomicCounterBufferBindings;
- mResources.MaxVertexAtomicCounterBuffers = caps.maxVertexAtomicCounterBuffers;
- mResources.MaxFragmentAtomicCounterBuffers = caps.maxFragmentAtomicCounterBuffers;
- 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.OES_geometry_shader = extensions.geometryShader;
- // TODO(jiawei.shao@intel.com): initialize all implementation dependent geometry shader limits.
- mResources.MaxGeometryOutputVertices = extensions.maxGeometryOutputVertices;
- mResources.MaxGeometryShaderInvocations = extensions.maxGeometryShaderInvocations;
-}
-
-Compiler::~Compiler()
-{
- if (mFragmentCompiler)
- {
- sh::Destruct(mFragmentCompiler);
- mFragmentCompiler = nullptr;
-
- ASSERT(activeCompilerHandles > 0);
- activeCompilerHandles--;
- }
-
- if (mVertexCompiler)
- {
- sh::Destruct(mVertexCompiler);
- mVertexCompiler = nullptr;
-
- ASSERT(activeCompilerHandles > 0);
- activeCompilerHandles--;
- }
-
- if (mComputeCompiler)
- {
- sh::Destruct(mComputeCompiler);
- mComputeCompiler = nullptr;
-
- ASSERT(activeCompilerHandles > 0);
- activeCompilerHandles--;
- }
-
- if (activeCompilerHandles == 0)
- {
- sh::Finalize();
- }
-
- ANGLE_SWALLOW_ERR(mImplementation->release());
-}
-
-ShHandle Compiler::getCompilerHandle(GLenum type)
-{
- ShHandle *compiler = nullptr;
- switch (type)
- {
- case GL_VERTEX_SHADER:
- compiler = &mVertexCompiler;
- break;
-
- case GL_FRAGMENT_SHADER:
- compiler = &mFragmentCompiler;
- break;
- case GL_COMPUTE_SHADER:
- compiler = &mComputeCompiler;
- break;
- case GL_GEOMETRY_SHADER_EXT:
- compiler = &mGeometryCompiler;
- break;
- default:
- UNREACHABLE();
- return nullptr;
- }
-
- if (!(*compiler))
- {
- if (activeCompilerHandles == 0)
- {
- sh::Initialize();
- }
-
- *compiler = sh::ConstructCompiler(type, mSpec, mOutputType, &mResources);
- ASSERT(*compiler);
- activeCompilerHandles++;
- }
-
- return *compiler;
-}
-
-const std::string &Compiler::getBuiltinResourcesString(GLenum type)
-{
- return sh::GetBuiltInResourcesString(getCompilerHandle(type));
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Compiler.h b/src/3rdparty/angle/src/libANGLE/Compiler.h
deleted file mode 100644
index b7f7e9f31b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Compiler.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// 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 "GLSLANG/ShaderLang.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/RefCountObject.h"
-
-namespace rx
-{
-class CompilerImpl;
-class GLImplFactory;
-}
-
-namespace gl
-{
-class ContextState;
-
-class Compiler final : public RefCountObjectNoID
-{
- public:
- Compiler(rx::GLImplFactory *implFactory, const ContextState &data);
-
- ShHandle getCompilerHandle(GLenum type);
- ShShaderOutput getShaderOutputType() const { return mOutputType; }
- const std::string &getBuiltinResourcesString(GLenum type);
-
- private:
- ~Compiler() override;
- std::unique_ptr<rx::CompilerImpl> mImplementation;
- ShShaderSpec mSpec;
- ShShaderOutput mOutputType;
- ShBuiltInResources mResources;
-
- ShHandle mFragmentCompiler;
- ShHandle mVertexCompiler;
- ShHandle mComputeCompiler;
- ShHandle mGeometryCompiler;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_COMPILER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Config.cpp b/src/3rdparty/angle/src/libANGLE/Config.cpp
deleted file mode 100644
index 172c312ae0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Config.cpp
+++ /dev/null
@@ -1,309 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Config.cpp: Implements the egl::Config class, describing the format, type
-// and size for an egl::Surface. Implements EGLConfig and related functionality.
-// [EGL 1.5] section 3.4 page 19.
-
-#include "libANGLE/Config.h"
-#include "libANGLE/AttributeMap.h"
-
-#include <algorithm>
-#include <vector>
-
-#include "angle_gl.h"
-#include <EGL/eglext.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_NONE),
- configCaveat(EGL_NONE),
- configID(0),
- conformant(0),
- depthSize(0),
- level(0),
- matchNativePixmap(EGL_FALSE),
- maxPBufferWidth(0),
- maxPBufferHeight(0),
- maxPBufferPixels(0),
- maxSwapInterval(0),
- minSwapInterval(0),
- nativeRenderable(EGL_FALSE),
- nativeVisualID(0),
- nativeVisualType(0),
- renderableType(0),
- sampleBuffers(0),
- samples(0),
- stencilSize(0),
- surfaceType(0),
- transparentType(EGL_NONE),
- transparentRedValue(0),
- transparentGreenValue(0),
- transparentBlueValue(0),
- optimalOrientation(0),
- colorComponentType(EGL_COLOR_COMPONENT_TYPE_FIXED_EXT)
-{
-}
-
-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) \
- if (x.attribute != y.attribute) \
- { \
- return x.attribute < y.attribute; \
- }
-
- 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:
-
- void scanForWantedComponents(const AttributeMap &attributeMap)
- {
- // [EGL 1.5] section 3.4.1.2 page 30
- // Sorting rule #3: by larger total number of color bits, not considering
- // components that are 0 or don't-care.
- for (auto attribIter = attributeMap.begin(); attribIter != attributeMap.end(); attribIter++)
- {
- EGLint attributeKey = attribIter->first;
- EGLint attributeValue = attribIter->second;
- if (attributeKey != 0 && attributeValue != EGL_DONT_CARE)
- {
- switch (attributeKey)
- {
- case EGL_RED_SIZE: mWantRed = true; break;
- case EGL_GREEN_SIZE: mWantGreen = true; break;
- case EGL_BLUE_SIZE: mWantBlue = true; break;
- case EGL_ALPHA_SIZE: mWantAlpha = true; break;
- case EGL_LUMINANCE_SIZE: mWantLuminance = true; break;
- }
- }
- }
- }
-
- EGLint wantedComponentsSize(const Config &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 == (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 == (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 == (EGLenum)attributeValue; break;
- case EGL_TRANSPARENT_BLUE_VALUE: match = config.transparentBlueValue == attributeValue; break;
- case EGL_TRANSPARENT_GREEN_VALUE: match = config.transparentGreenValue == attributeValue; break;
- case EGL_TRANSPARENT_RED_VALUE: match = config.transparentRedValue == attributeValue; break;
- case EGL_BIND_TO_TEXTURE_RGB: match = config.bindToTextureRGB == (EGLBoolean)attributeValue; break;
- case EGL_BIND_TO_TEXTURE_RGBA: match = config.bindToTextureRGBA == (EGLBoolean)attributeValue; break;
- case EGL_MIN_SWAP_INTERVAL: match = config.minSwapInterval == attributeValue; break;
- case EGL_MAX_SWAP_INTERVAL: match = config.maxSwapInterval == attributeValue; break;
- case EGL_LUMINANCE_SIZE: match = config.luminanceSize >= attributeValue; break;
- case EGL_ALPHA_MASK_SIZE: match = config.alphaMaskSize >= attributeValue; break;
- case EGL_COLOR_BUFFER_TYPE: match = config.colorBufferType == (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;
- default: UNREACHABLE();
- }
-
- if (!match)
- {
- break;
- }
- }
-
- if (match)
- {
- result.push_back(&config);
- }
- }
-
- // Sort the result
- std::sort(result.begin(), result.end(), ConfigSorter(attributeMap));
-
- return result;
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/Config.h b/src/3rdparty/angle/src/libANGLE/Config.h
deleted file mode 100644
index f2fbe8b95a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Config.h
+++ /dev/null
@@ -1,101 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Config.h: Defines the egl::Config class, describing the format, type
-// and size for an egl::Surface. Implements EGLConfig and related functionality.
-// [EGL 1.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
-};
-
-class ConfigSet
-{
- 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;
-
- private:
- typedef std::map<EGLint, Config> ConfigMap;
- ConfigMap mConfigs;
-};
-
-}
-
-#endif // INCLUDE_CONFIG_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Constants.h b/src/3rdparty/angle/src/libANGLE/Constants.h
deleted file mode 100644
index 2fe921af38..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Constants.h
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// 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"
-
-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_COMBINED_SHADER_UNIFORM_BUFFERS =
- IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS +
- IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS,
-
- 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,
-};
-}
-
-#endif // LIBANGLE_CONSTANTS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Context.cpp b/src/3rdparty/angle/src/libANGLE/Context.cpp
deleted file mode 100644
index f638beda58..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Context.cpp
+++ /dev/null
@@ -1,5558 +0,0 @@
-//
-// 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 <string.h>
-#include <iterator>
-#include <sstream>
-#include <vector>
-
-#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/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/Surface.h"
-#include "libANGLE/Texture.h"
-#include "libANGLE/TransformFeedback.h"
-#include "libANGLE/VertexArray.h"
-#include "libANGLE/Workarounds.h"
-#include "libANGLE/formatutils.h"
-#include "libANGLE/queryconversions.h"
-#include "libANGLE/queryutils.h"
-#include "libANGLE/renderer/ContextImpl.h"
-#include "libANGLE/renderer/EGLImplFactory.h"
-#include "libANGLE/renderer/Format.h"
-#include "libANGLE/validationES.h"
-
-namespace
-{
-
-#define ANGLE_HANDLE_ERR(X) \
- handleError(X); \
- return;
-#define ANGLE_CONTEXT_TRY(EXPR) ANGLE_TRY_TEMPLATE(EXPR, ANGLE_HANDLE_ERR);
-
-template <typename T>
-std::vector<gl::Path *> GatherPaths(gl::PathManager &resourceManager,
- GLsizei numPaths,
- const void *paths,
- GLuint pathBase)
-{
- std::vector<gl::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<gl::Path *> GatherPaths(gl::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<gl::Path *>();
-}
-
-template <typename T>
-gl::Error GetQueryObjectParameter(gl::Query *query, GLenum pname, T *params)
-{
- ASSERT(query != nullptr);
-
- switch (pname)
- {
- case GL_QUERY_RESULT_EXT:
- return query->getResult(params);
- case GL_QUERY_RESULT_AVAILABLE_EXT:
- {
- bool available;
- gl::Error error = query->isResultAvailable(&available);
- if (!error.isError())
- {
- *params = gl::CastFromStateValue<T>(pname, static_cast<GLuint>(available));
- }
- return error;
- }
- default:
- UNREACHABLE();
- return gl::InternalError() << "Unreachable Error";
- }
-}
-
-void MarkTransformFeedbackBufferUsage(gl::TransformFeedback *transformFeedback)
-{
- if (transformFeedback && transformFeedback->isActive() && !transformFeedback->isPaused())
- {
- for (size_t tfBufferIndex = 0; tfBufferIndex < transformFeedback->getIndexedBufferCount();
- tfBufferIndex++)
- {
- const gl::OffsetBindingPointer<gl::Buffer> &buffer =
- transformFeedback->getIndexedBuffer(tfBufferIndex);
- if (buffer.get() != nullptr)
- {
- buffer->onTransformFeedback();
- }
- }
- }
-}
-
-// 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));
-}
-
-gl::Version GetClientVersion(const egl::AttributeMap &attribs)
-{
- return gl::Version(GetClientMajorVersion(attribs), GetClientMinorVersion(attribs));
-}
-
-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 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));
-}
-
-} // anonymous namespace
-
-namespace gl
-{
-
-Context::Context(rx::EGLImplFactory *implFactory,
- const egl::Config *config,
- const Context *shareContext,
- TextureManager *shareTextures,
- MemoryProgramCache *memoryProgramCache,
- const egl::AttributeMap &attribs,
- const egl::DisplayExtensions &displayExtensions)
-
- : ValidationContext(shareContext,
- shareTextures,
- GetClientVersion(attribs),
- &mGLState,
- mCaps,
- mTextureCaps,
- mExtensions,
- mLimitations,
- GetNoError(attribs)),
- mImplementation(implFactory->createContext(mState)),
- mCompiler(),
- mConfig(config),
- mClientType(EGL_OPENGL_ES_API),
- mHasBeenCurrent(false),
- mContextLost(false),
- mResetStatus(GL_NO_ERROR),
- mContextLostForced(false),
- mResetStrategy(GetResetStrategy(attribs)),
- mRobustAccess(GetRobustAccess(attribs)),
- mCurrentSurface(static_cast<egl::Surface *>(EGL_NO_SURFACE)),
- mCurrentDisplay(static_cast<egl::Display *>(EGL_NO_DISPLAY)),
- mSurfacelessFramebuffer(nullptr),
- mWebGLContext(GetWebGLContext(attribs)),
- mMemoryProgramCache(memoryProgramCache),
- mScratchBuffer(1000u),
- mZeroFilledBuffer(1000u)
-{
- mImplementation->setMemoryProgramCache(memoryProgramCache);
-
- bool robustResourceInit = GetRobustResourceInit(attribs);
- initCaps(displayExtensions, robustResourceInit);
- initWorkarounds();
-
- mGLState.initialize(this, GetDebug(attribs), GetBindGeneratesResource(attribs),
- GetClientArraysEnabled(attribs), robustResourceInit,
- mMemoryProgramCache != nullptr);
-
- 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, GL_TEXTURE_2D);
- mZeroTextures[GL_TEXTURE_2D].set(this, zeroTexture2D);
-
- Texture *zeroTextureCube = new Texture(mImplementation.get(), 0, GL_TEXTURE_CUBE_MAP);
- mZeroTextures[GL_TEXTURE_CUBE_MAP].set(this, zeroTextureCube);
-
- if (getClientVersion() >= Version(3, 0))
- {
- // TODO: These could also be enabled via extension
- Texture *zeroTexture3D = new Texture(mImplementation.get(), 0, GL_TEXTURE_3D);
- mZeroTextures[GL_TEXTURE_3D].set(this, zeroTexture3D);
-
- Texture *zeroTexture2DArray = new Texture(mImplementation.get(), 0, GL_TEXTURE_2D_ARRAY);
- mZeroTextures[GL_TEXTURE_2D_ARRAY].set(this, zeroTexture2DArray);
- }
- if (getClientVersion() >= Version(3, 1))
- {
- Texture *zeroTexture2DMultisample =
- new Texture(mImplementation.get(), 0, GL_TEXTURE_2D_MULTISAMPLE);
- mZeroTextures[GL_TEXTURE_2D_MULTISAMPLE].set(this, zeroTexture2DMultisample);
-
- for (unsigned int i = 0; i < mCaps.maxAtomicCounterBufferBindings; i++)
- {
- bindBufferRange(BufferBinding::AtomicCounter, 0, i, 0, 0);
- }
-
- for (unsigned int i = 0; i < mCaps.maxShaderStorageBufferBindings; i++)
- {
- bindBufferRange(BufferBinding::ShaderStorage, i, 0, 0, 0);
- }
- }
-
- const Extensions &nativeExtensions = mImplementation->getNativeExtensions();
- if (nativeExtensions.textureRectangle)
- {
- Texture *zeroTextureRectangle =
- new Texture(mImplementation.get(), 0, GL_TEXTURE_RECTANGLE_ANGLE);
- mZeroTextures[GL_TEXTURE_RECTANGLE_ANGLE].set(this, zeroTextureRectangle);
- }
-
- if (nativeExtensions.eglImageExternal || nativeExtensions.eglStreamConsumerExternal)
- {
- Texture *zeroTextureExternal =
- new Texture(mImplementation.get(), 0, GL_TEXTURE_EXTERNAL_OES);
- mZeroTextures[GL_TEXTURE_EXTERNAL_OES].set(this, zeroTextureExternal);
- }
-
- mGLState.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 < mCaps.maxUniformBufferBindings; i++)
- {
- bindBufferRange(BufferBinding::Uniform, i, 0, 0, -1);
- }
-
- // Initialize dirty bit masks
- 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);
- 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);
- mClearDirtyObjects.set(State::DIRTY_OBJECT_DRAW_FRAMEBUFFER);
-
- mBlitDirtyBits.set(State::DIRTY_BIT_SCISSOR_TEST_ENABLED);
- mBlitDirtyBits.set(State::DIRTY_BIT_SCISSOR);
- mBlitDirtyBits.set(State::DIRTY_BIT_FRAMEBUFFER_SRGB);
- mBlitDirtyObjects.set(State::DIRTY_OBJECT_READ_FRAMEBUFFER);
- mBlitDirtyObjects.set(State::DIRTY_OBJECT_DRAW_FRAMEBUFFER);
-
- handleError(mImplementation->initialize());
-}
-
-egl::Error Context::onDestroy(const egl::Display *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 (auto &zeroTexture : mZeroTextures)
- {
- ANGLE_TRY(zeroTexture.second->onDestroy(this));
- zeroTexture.second.set(this, nullptr);
- }
- mZeroTextures.clear();
-
- SafeDelete(mSurfacelessFramebuffer);
-
- ANGLE_TRY(releaseSurface(display));
- releaseShaderCompiler();
-
- mGLState.reset(this);
-
- mState.mBuffers->release(this);
- mState.mShaderPrograms->release(this);
- mState.mTextures->release(this);
- mState.mRenderbuffers->release(this);
- mState.mSamplers->release(this);
- mState.mSyncs->release(this);
- mState.mPaths->release(this);
- mState.mFramebuffers->release(this);
- mState.mPipelines->release(this);
-
- mImplementation->onDestroy(this);
-
- return egl::NoError();
-}
-
-Context::~Context()
-{
-}
-
-egl::Error Context::makeCurrent(egl::Display *display, egl::Surface *surface)
-{
- mCurrentDisplay = display;
-
- if (!mHasBeenCurrent)
- {
- initRendererString();
- initVersionStrings();
- initExtensionStrings();
-
- int width = 0;
- int height = 0;
- if (surface != nullptr)
- {
- width = surface->getWidth();
- height = surface->getHeight();
- }
-
- mGLState.setViewportParams(0, 0, width, height);
- mGLState.setScissorParams(0, 0, width, height);
-
- mHasBeenCurrent = true;
- }
-
- // TODO(jmadill): Rework this when we support ContextImpl
- mGLState.setAllDirtyBits();
- mGLState.setAllDirtyObjects();
-
- ANGLE_TRY(releaseSurface(display));
-
- Framebuffer *newDefault = nullptr;
- if (surface != nullptr)
- {
- ANGLE_TRY(surface->setIsCurrent(this, true));
- mCurrentSurface = surface;
- newDefault = surface->getDefaultFramebuffer();
- }
- else
- {
- if (mSurfacelessFramebuffer == nullptr)
- {
- mSurfacelessFramebuffer = new Framebuffer(mImplementation.get());
- }
-
- newDefault = mSurfacelessFramebuffer;
- }
-
- // Update default framebuffer, the binding of the previous default
- // framebuffer (or lack of) will have a nullptr.
- {
- if (mGLState.getReadFramebuffer() == nullptr)
- {
- mGLState.setReadFramebufferBinding(newDefault);
- }
- if (mGLState.getDrawFramebuffer() == nullptr)
- {
- mGLState.setDrawFramebufferBinding(newDefault);
- }
- mState.mFramebuffers->setDefaultFramebuffer(newDefault);
- }
-
- // Notify the renderer of a context switch
- mImplementation->onMakeCurrent(this);
- return egl::NoError();
-}
-
-egl::Error Context::releaseSurface(const egl::Display *display)
-{
- // Remove the default framebuffer
- Framebuffer *currentDefault = nullptr;
- if (mCurrentSurface != nullptr)
- {
- currentDefault = mCurrentSurface->getDefaultFramebuffer();
- }
- else if (mSurfacelessFramebuffer != nullptr)
- {
- currentDefault = mSurfacelessFramebuffer;
- }
-
- if (mGLState.getReadFramebuffer() == currentDefault)
- {
- mGLState.setReadFramebufferBinding(nullptr);
- }
- if (mGLState.getDrawFramebuffer() == currentDefault)
- {
- mGLState.setDrawFramebufferBinding(nullptr);
- }
- mState.mFramebuffers->setDefaultFramebuffer(nullptr);
-
- if (mCurrentSurface)
- {
- ANGLE_TRY(mCurrentSurface->setIsCurrent(this, false));
- mCurrentSurface = nullptr;
- }
-
- return egl::NoError();
-}
-
-GLuint Context::createBuffer()
-{
- return mState.mBuffers->createBuffer();
-}
-
-GLuint Context::createProgram()
-{
- return mState.mShaderPrograms->createProgram(mImplementation.get());
-}
-
-GLuint Context::createShader(GLenum type)
-{
- return mState.mShaderPrograms->createShader(mImplementation.get(), mLimitations, type);
-}
-
-GLuint Context::createTexture()
-{
- return mState.mTextures->createTexture();
-}
-
-GLuint Context::createRenderbuffer()
-{
- return mState.mRenderbuffers->createRenderbuffer();
-}
-
-GLuint Context::createPaths(GLsizei range)
-{
- auto resultOrError = mState.mPaths->createPaths(mImplementation.get(), range);
- if (resultOrError.isError())
- {
- handleError(resultOrError.getError());
- return 0;
- }
- return resultOrError.getResult();
-}
-
-// Returns an unused framebuffer name
-GLuint Context::createFramebuffer()
-{
- return mState.mFramebuffers->createFramebuffer();
-}
-
-GLuint Context::createFenceNV()
-{
- GLuint handle = mFenceNVHandleAllocator.allocate();
- mFenceNVMap.assign(handle, new FenceNV(mImplementation->createFenceNV()));
- return handle;
-}
-
-GLuint Context::createProgramPipeline()
-{
- return mState.mPipelines->createProgramPipeline();
-}
-
-GLuint Context::createShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
-{
- UNIMPLEMENTED();
- return 0u;
-}
-
-void Context::deleteBuffer(GLuint buffer)
-{
- if (mState.mBuffers->getBuffer(buffer))
- {
- detachBuffer(buffer);
- }
-
- mState.mBuffers->deleteObject(this, buffer);
-}
-
-void Context::deleteShader(GLuint shader)
-{
- mState.mShaderPrograms->deleteShader(this, shader);
-}
-
-void Context::deleteProgram(GLuint program)
-{
- mState.mShaderPrograms->deleteProgram(this, program);
-}
-
-void Context::deleteTexture(GLuint texture)
-{
- if (mState.mTextures->getTexture(texture))
- {
- detachTexture(texture);
- }
-
- mState.mTextures->deleteObject(this, texture);
-}
-
-void Context::deleteRenderbuffer(GLuint renderbuffer)
-{
- if (mState.mRenderbuffers->getRenderbuffer(renderbuffer))
- {
- detachRenderbuffer(renderbuffer);
- }
-
- mState.mRenderbuffers->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.mSyncs->deleteObject(this, static_cast<GLuint>(reinterpret_cast<uintptr_t>(sync)));
-}
-
-void Context::deleteProgramPipeline(GLuint pipeline)
-{
- if (mState.mPipelines->getProgramPipeline(pipeline))
- {
- detachProgramPipeline(pipeline);
- }
-
- mState.mPipelines->deleteObject(this, pipeline);
-}
-
-void Context::deletePaths(GLuint first, GLsizei range)
-{
- mState.mPaths->deletePaths(first, range);
-}
-
-bool Context::hasPathData(GLuint path) const
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (pathObj == nullptr)
- return false;
-
- return pathObj->hasPathData();
-}
-
-bool Context::hasPath(GLuint path) const
-{
- return mState.mPaths->hasPath(path);
-}
-
-void Context::setPathCommands(GLuint path,
- GLsizei numCommands,
- const GLubyte *commands,
- GLsizei numCoords,
- GLenum coordType,
- const void *coords)
-{
- auto *pathObject = mState.mPaths->getPath(path);
-
- handleError(pathObject->setCommands(numCommands, commands, numCoords, coordType, coords));
-}
-
-void Context::setPathParameterf(GLuint path, GLenum pname, GLfloat value)
-{
- auto *pathObj = mState.mPaths->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::getPathParameterfv(GLuint path, GLenum pname, GLfloat *value) const
-{
- const auto *pathObj = mState.mPaths->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::setPathStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- mGLState.setPathStencilFunc(func, ref, mask);
-}
-
-void Context::deleteFramebuffer(GLuint framebuffer)
-{
- if (mState.mFramebuffers->getFramebuffer(framebuffer))
- {
- detachFramebuffer(framebuffer);
- }
-
- mState.mFramebuffers->deleteObject(this, framebuffer);
-}
-
-void Context::deleteFenceNV(GLuint fence)
-{
- FenceNV *fenceObject = nullptr;
- if (mFenceNVMap.erase(fence, &fenceObject))
- {
- mFenceNVHandleAllocator.release(fence);
- delete fenceObject;
- }
-}
-
-Buffer *Context::getBuffer(GLuint handle) const
-{
- return mState.mBuffers->getBuffer(handle);
-}
-
-Texture *Context::getTexture(GLuint handle) const
-{
- return mState.mTextures->getTexture(handle);
-}
-
-Renderbuffer *Context::getRenderbuffer(GLuint handle) const
-{
- return mState.mRenderbuffers->getRenderbuffer(handle);
-}
-
-Sync *Context::getSync(GLsync handle) const
-{
- return mState.mSyncs->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.mSamplers->getSampler(handle);
-}
-
-TransformFeedback *Context::getTransformFeedback(GLuint handle) const
-{
- return mTransformFeedbackMap.query(handle);
-}
-
-ProgramPipeline *Context::getProgramPipeline(GLuint handle) const
-{
- return mState.mPipelines->getProgramPipeline(handle);
-}
-
-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 getProgram(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;
- }
-}
-
-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)
-{
- LabeledObject *object = getLabeledObject(identifier, name);
- ASSERT(object != nullptr);
-
- std::string labelName = GetObjectLabelFromPointer(length, label);
- object->setLabel(labelName);
-
- // TODO(jmadill): Determine if the object is dirty based on 'name'. Conservatively assume the
- // specified object is active until we do this.
- mGLState.setObjectDirty(identifier);
-}
-
-void Context::objectPtrLabel(const void *ptr, GLsizei length, const GLchar *label)
-{
- LabeledObject *object = getLabeledObjectFromPtr(ptr);
- ASSERT(object != nullptr);
-
- std::string labelName = GetObjectLabelFromPointer(length, label);
- object->setLabel(labelName);
-}
-
-void Context::getObjectLabel(GLenum identifier,
- GLuint name,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *label) const
-{
- 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) const
-{
- LabeledObject *object = getLabeledObjectFromPtr(ptr);
- ASSERT(object != nullptr);
-
- const std::string &objectLabel = object->getLabel();
- GetObjectLabelBase(objectLabel, bufSize, length, label);
-}
-
-bool Context::isSampler(GLuint samplerName) const
-{
- return mState.mSamplers->isSampler(samplerName);
-}
-
-void Context::bindTexture(GLenum target, GLuint handle)
-{
- Texture *texture = nullptr;
-
- if (handle == 0)
- {
- texture = mZeroTextures[target].get();
- }
- else
- {
- texture = mState.mTextures->checkTextureAllocation(mImplementation.get(), handle, target);
- }
-
- ASSERT(texture);
- mGLState.setSamplerTexture(this, target, texture);
-}
-
-void Context::bindReadFramebuffer(GLuint framebufferHandle)
-{
- Framebuffer *framebuffer = mState.mFramebuffers->checkFramebufferAllocation(
- mImplementation.get(), mCaps, framebufferHandle);
- mGLState.setReadFramebufferBinding(framebuffer);
-}
-
-void Context::bindDrawFramebuffer(GLuint framebufferHandle)
-{
- Framebuffer *framebuffer = mState.mFramebuffers->checkFramebufferAllocation(
- mImplementation.get(), mCaps, framebufferHandle);
- mGLState.setDrawFramebufferBinding(framebuffer);
-}
-
-void Context::bindVertexArray(GLuint vertexArrayHandle)
-{
- VertexArray *vertexArray = checkVertexArrayAllocation(vertexArrayHandle);
- mGLState.setVertexArrayBinding(vertexArray);
-}
-
-void Context::bindVertexBuffer(GLuint bindingIndex,
- GLuint bufferHandle,
- GLintptr offset,
- GLsizei stride)
-{
- Buffer *buffer = mState.mBuffers->checkBufferAllocation(mImplementation.get(), bufferHandle);
- mGLState.bindVertexBuffer(this, bindingIndex, buffer, offset, stride);
-}
-
-void Context::bindSampler(GLuint textureUnit, GLuint samplerHandle)
-{
- ASSERT(textureUnit < mCaps.maxCombinedTextureImageUnits);
- Sampler *sampler =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), samplerHandle);
- mGLState.setSamplerBinding(this, textureUnit, sampler);
-}
-
-void Context::bindImageTexture(GLuint unit,
- GLuint texture,
- GLint level,
- GLboolean layered,
- GLint layer,
- GLenum access,
- GLenum format)
-{
- Texture *tex = mState.mTextures->getTexture(texture);
- mGLState.setImageUnit(this, unit, tex, level, layered, layer, access, format);
-}
-
-void Context::useProgram(GLuint program)
-{
- mGLState.setProgram(this, getProgram(program));
-}
-
-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);
- mGLState.setTransformFeedbackBinding(this, transformFeedback);
-}
-
-void Context::bindProgramPipeline(GLuint pipelineHandle)
-{
- ProgramPipeline *pipeline =
- mState.mPipelines->checkProgramPipelineAllocation(mImplementation.get(), pipelineHandle);
- mGLState.setProgramPipelineBinding(this, pipeline);
-}
-
-void Context::beginQuery(GLenum target, GLuint query)
-{
- Query *queryObject = getQuery(query, true, target);
- ASSERT(queryObject);
-
- // begin query
- ANGLE_CONTEXT_TRY(queryObject->begin());
-
- // set query as active for specified target only if begin succeeded
- mGLState.setActiveQuery(this, target, queryObject);
-}
-
-void Context::endQuery(GLenum target)
-{
- Query *queryObject = mGLState.getActiveQuery(target);
- ASSERT(queryObject);
-
- handleError(queryObject->end());
-
- // Always unbind the query, even if there was an error. This may delete the query object.
- mGLState.setActiveQuery(this, target, nullptr);
-}
-
-void Context::queryCounter(GLuint id, GLenum target)
-{
- ASSERT(target == GL_TIMESTAMP_EXT);
-
- Query *queryObject = getQuery(id, true, target);
- ASSERT(queryObject);
-
- handleError(queryObject->queryCounter());
-}
-
-void Context::getQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- switch (pname)
- {
- case GL_CURRENT_QUERY_EXT:
- params[0] = mGLState.getActiveQueryId(target);
- break;
- case GL_QUERY_COUNTER_BITS_EXT:
- switch (target)
- {
- case GL_TIME_ELAPSED_EXT:
- params[0] = getExtensions().queryCounterBitsTimeElapsed;
- break;
- case GL_TIMESTAMP_EXT:
- params[0] = getExtensions().queryCounterBitsTimestamp;
- break;
- default:
- UNREACHABLE();
- params[0] = 0;
- break;
- }
- break;
- default:
- UNREACHABLE();
- return;
- }
-}
-
-void Context::getQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- handleError(GetQueryObjectParameter(getQuery(id), pname, params));
-}
-
-void Context::getQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- handleError(GetQueryObjectParameter(getQuery(id), pname, params));
-}
-
-void Context::getQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- handleError(GetQueryObjectParameter(getQuery(id), pname, params));
-}
-
-void Context::getQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- handleError(GetQueryObjectParameter(getQuery(id), pname, params));
-}
-
-Framebuffer *Context::getFramebuffer(GLuint handle) const
-{
- return mState.mFramebuffers->getFramebuffer(handle);
-}
-
-FenceNV *Context::getFenceNV(GLuint handle)
-{
- return mFenceNVMap.query(handle);
-}
-
-Query *Context::getQuery(GLuint handle, bool create, GLenum type)
-{
- if (!mQueryMap.contains(handle))
- {
- return nullptr;
- }
-
- Query *query = mQueryMap.query(handle);
- if (!query && create)
- {
- 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::getTargetTexture(GLenum target) const
-{
- ASSERT(ValidTextureTarget(this, target) || ValidTextureExternalTarget(this, target));
- return mGLState.getTargetTexture(target);
-}
-
-Texture *Context::getSamplerTexture(unsigned int sampler, GLenum type) const
-{
- return mGLState.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 = mRobustAccess ? GL_TRUE : GL_FALSE;
- break;
- default:
- mGLState.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] = mCaps.minAliasedLineWidth;
- params[1] = mCaps.maxAliasedLineWidth;
- break;
- case GL_ALIASED_POINT_SIZE_RANGE:
- params[0] = mCaps.minAliasedPointSize;
- params[1] = mCaps.maxAliasedPointSize;
- break;
- case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
- ASSERT(mExtensions.textureFilterAnisotropic);
- *params = mExtensions.maxTextureAnisotropy;
- break;
- case GL_MAX_TEXTURE_LOD_BIAS:
- *params = mCaps.maxLODBias;
- break;
-
- case GL_PATH_MODELVIEW_MATRIX_CHROMIUM:
- case GL_PATH_PROJECTION_MATRIX_CHROMIUM:
- {
- ASSERT(mExtensions.pathRendering);
- const GLfloat *m = mGLState.getPathRenderingMatrix(pname);
- memcpy(params, m, 16 * sizeof(GLfloat));
- }
- break;
-
- default:
- mGLState.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 = mCaps.maxVertexAttributes;
- break;
- case GL_MAX_VERTEX_UNIFORM_VECTORS:
- *params = mCaps.maxVertexUniformVectors;
- break;
- case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
- *params = mCaps.maxVertexUniformComponents;
- break;
- case GL_MAX_VARYING_VECTORS:
- *params = mCaps.maxVaryingVectors;
- break;
- case GL_MAX_VARYING_COMPONENTS:
- *params = mCaps.maxVertexOutputComponents;
- break;
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
- *params = mCaps.maxCombinedTextureImageUnits;
- break;
- case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
- *params = mCaps.maxVertexTextureImageUnits;
- break;
- case GL_MAX_TEXTURE_IMAGE_UNITS:
- *params = mCaps.maxTextureImageUnits;
- break;
- case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
- *params = mCaps.maxFragmentUniformVectors;
- break;
- case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
- *params = mCaps.maxFragmentUniformComponents;
- break;
- case GL_MAX_RENDERBUFFER_SIZE:
- *params = mCaps.maxRenderbufferSize;
- break;
- case GL_MAX_COLOR_ATTACHMENTS_EXT:
- *params = mCaps.maxColorAttachments;
- break;
- case GL_MAX_DRAW_BUFFERS_EXT:
- *params = mCaps.maxDrawBuffers;
- break;
- // case GL_FRAMEBUFFER_BINDING: // now equivalent to
- // GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
- case GL_SUBPIXEL_BITS:
- *params = 4;
- break;
- case GL_MAX_TEXTURE_SIZE:
- *params = mCaps.max2DTextureSize;
- break;
- case GL_MAX_RECTANGLE_TEXTURE_SIZE_ANGLE:
- *params = mCaps.maxRectangleTextureSize;
- break;
- case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
- *params = mCaps.maxCubeMapTextureSize;
- break;
- case GL_MAX_3D_TEXTURE_SIZE:
- *params = mCaps.max3DTextureSize;
- break;
- case GL_MAX_ARRAY_TEXTURE_LAYERS:
- *params = mCaps.maxArrayTextureLayers;
- break;
- case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
- *params = mCaps.uniformBufferOffsetAlignment;
- break;
- case GL_MAX_UNIFORM_BUFFER_BINDINGS:
- *params = mCaps.maxUniformBufferBindings;
- break;
- case GL_MAX_VERTEX_UNIFORM_BLOCKS:
- *params = mCaps.maxVertexUniformBlocks;
- break;
- case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
- *params = mCaps.maxFragmentUniformBlocks;
- break;
- case GL_MAX_COMBINED_UNIFORM_BLOCKS:
- *params = mCaps.maxCombinedTextureImageUnits;
- break;
- case GL_MAX_VERTEX_OUTPUT_COMPONENTS:
- *params = mCaps.maxVertexOutputComponents;
- break;
- case GL_MAX_FRAGMENT_INPUT_COMPONENTS:
- *params = mCaps.maxFragmentInputComponents;
- break;
- case GL_MIN_PROGRAM_TEXEL_OFFSET:
- *params = mCaps.minProgramTexelOffset;
- break;
- case GL_MAX_PROGRAM_TEXEL_OFFSET:
- *params = 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 = mCaps.maxElementsIndices;
- break;
- case GL_MAX_ELEMENTS_VERTICES:
- *params = mCaps.maxElementsVertices;
- break;
- case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
- *params = mCaps.maxTransformFeedbackInterleavedComponents;
- break;
- case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
- *params = mCaps.maxTransformFeedbackSeparateAttributes;
- break;
- case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
- *params = mCaps.maxTransformFeedbackSeparateComponents;
- break;
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- *params = static_cast<GLint>(mCaps.compressedTextureFormats.size());
- break;
- case GL_MAX_SAMPLES_ANGLE:
- *params = mCaps.maxSamples;
- break;
- case GL_MAX_VIEWPORT_DIMS:
- {
- params[0] = mCaps.maxViewportWidth;
- params[1] = mCaps.maxViewportHeight;
- }
- break;
- case GL_COMPRESSED_TEXTURE_FORMATS:
- std::copy(mCaps.compressedTextureFormats.begin(), mCaps.compressedTextureFormats.end(),
- params);
- break;
- case GL_RESET_NOTIFICATION_STRATEGY_EXT:
- *params = mResetStrategy;
- break;
- case GL_NUM_SHADER_BINARY_FORMATS:
- *params = static_cast<GLint>(mCaps.shaderBinaryFormats.size());
- break;
- case GL_SHADER_BINARY_FORMATS:
- std::copy(mCaps.shaderBinaryFormats.begin(), mCaps.shaderBinaryFormats.end(), params);
- break;
- case GL_NUM_PROGRAM_BINARY_FORMATS:
- *params = static_cast<GLint>(mCaps.programBinaryFormats.size());
- break;
- case GL_PROGRAM_BINARY_FORMATS:
- std::copy(mCaps.programBinaryFormats.begin(), mCaps.programBinaryFormats.end(), params);
- break;
- case GL_NUM_EXTENSIONS:
- *params = static_cast<GLint>(mExtensionStrings.size());
- break;
-
- // GL_KHR_debug
- case GL_MAX_DEBUG_MESSAGE_LENGTH:
- *params = mExtensions.maxDebugMessageLength;
- break;
- case GL_MAX_DEBUG_LOGGED_MESSAGES:
- *params = mExtensions.maxDebugLoggedMessages;
- break;
- case GL_MAX_DEBUG_GROUP_STACK_DEPTH:
- *params = mExtensions.maxDebugGroupStackDepth;
- break;
- case GL_MAX_LABEL_LENGTH:
- *params = mExtensions.maxLabelLength;
- break;
-
- // GL_ANGLE_multiview
- case GL_MAX_VIEWS_ANGLE:
- *params = mExtensions.maxViews;
- break;
-
- // GL_EXT_disjoint_timer_query
- case GL_GPU_DISJOINT_EXT:
- *params = mImplementation->getGPUDisjoint();
- break;
- case GL_MAX_FRAMEBUFFER_WIDTH:
- *params = mCaps.maxFramebufferWidth;
- break;
- case GL_MAX_FRAMEBUFFER_HEIGHT:
- *params = mCaps.maxFramebufferHeight;
- break;
- case GL_MAX_FRAMEBUFFER_SAMPLES:
- *params = mCaps.maxFramebufferSamples;
- break;
- case GL_MAX_SAMPLE_MASK_WORDS:
- *params = mCaps.maxSampleMaskWords;
- break;
- case GL_MAX_COLOR_TEXTURE_SAMPLES:
- *params = mCaps.maxColorTextureSamples;
- break;
- case GL_MAX_DEPTH_TEXTURE_SAMPLES:
- *params = mCaps.maxDepthTextureSamples;
- break;
- case GL_MAX_INTEGER_SAMPLES:
- *params = mCaps.maxIntegerSamples;
- break;
- case GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET:
- *params = mCaps.maxVertexAttribRelativeOffset;
- break;
- case GL_MAX_VERTEX_ATTRIB_BINDINGS:
- *params = mCaps.maxVertexAttribBindings;
- break;
- case GL_MAX_VERTEX_ATTRIB_STRIDE:
- *params = mCaps.maxVertexAttribStride;
- break;
- case GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS:
- *params = mCaps.maxVertexAtomicCounterBuffers;
- break;
- case GL_MAX_VERTEX_ATOMIC_COUNTERS:
- *params = mCaps.maxVertexAtomicCounters;
- break;
- case GL_MAX_VERTEX_IMAGE_UNIFORMS:
- *params = mCaps.maxVertexImageUniforms;
- break;
- case GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS:
- *params = mCaps.maxVertexShaderStorageBlocks;
- break;
- case GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS:
- *params = mCaps.maxFragmentAtomicCounterBuffers;
- break;
- case GL_MAX_FRAGMENT_ATOMIC_COUNTERS:
- *params = mCaps.maxFragmentAtomicCounters;
- break;
- case GL_MAX_FRAGMENT_IMAGE_UNIFORMS:
- *params = mCaps.maxFragmentImageUniforms;
- break;
- case GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS:
- *params = mCaps.maxFragmentShaderStorageBlocks;
- break;
- case GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET:
- *params = mCaps.minProgramTextureGatherOffset;
- break;
- case GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET:
- *params = mCaps.maxProgramTextureGatherOffset;
- break;
- case GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS:
- *params = mCaps.maxComputeWorkGroupInvocations;
- break;
- case GL_MAX_COMPUTE_UNIFORM_BLOCKS:
- *params = mCaps.maxComputeUniformBlocks;
- break;
- case GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS:
- *params = mCaps.maxComputeTextureImageUnits;
- break;
- case GL_MAX_COMPUTE_SHARED_MEMORY_SIZE:
- *params = mCaps.maxComputeSharedMemorySize;
- break;
- case GL_MAX_COMPUTE_UNIFORM_COMPONENTS:
- *params = mCaps.maxComputeUniformComponents;
- break;
- case GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS:
- *params = mCaps.maxComputeAtomicCounterBuffers;
- break;
- case GL_MAX_COMPUTE_ATOMIC_COUNTERS:
- *params = mCaps.maxComputeAtomicCounters;
- break;
- case GL_MAX_COMPUTE_IMAGE_UNIFORMS:
- *params = mCaps.maxComputeImageUniforms;
- break;
- case GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS:
- *params = mCaps.maxCombinedComputeUniformComponents;
- break;
- case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS:
- *params = mCaps.maxComputeShaderStorageBlocks;
- break;
- case GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
- *params = mCaps.maxCombinedShaderOutputResources;
- break;
- case GL_MAX_UNIFORM_LOCATIONS:
- *params = mCaps.maxUniformLocations;
- break;
- case GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS:
- *params = mCaps.maxAtomicCounterBufferBindings;
- break;
- case GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE:
- *params = mCaps.maxAtomicCounterBufferSize;
- break;
- case GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS:
- *params = mCaps.maxCombinedAtomicCounterBuffers;
- break;
- case GL_MAX_COMBINED_ATOMIC_COUNTERS:
- *params = mCaps.maxCombinedAtomicCounters;
- break;
- case GL_MAX_IMAGE_UNITS:
- *params = mCaps.maxImageUnits;
- break;
- case GL_MAX_COMBINED_IMAGE_UNIFORMS:
- *params = mCaps.maxCombinedImageUniforms;
- break;
- case GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS:
- *params = mCaps.maxShaderStorageBufferBindings;
- break;
- case GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS:
- *params = mCaps.maxCombinedShaderStorageBlocks;
- break;
- case GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT:
- *params = mCaps.shaderStorageBufferOffsetAlignment;
- break;
- default:
- mGLState.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 = mCaps.maxElementIndex;
- break;
- case GL_MAX_UNIFORM_BLOCK_SIZE:
- *params = mCaps.maxUniformBlockSize;
- break;
- case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
- *params = mCaps.maxCombinedVertexUniformComponents;
- break;
- case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
- *params = mCaps.maxCombinedFragmentUniformComponents;
- break;
- case GL_MAX_SERVER_WAIT_TIMEOUT:
- *params = mCaps.maxServerWaitTimeout;
- break;
-
- // GL_EXT_disjoint_timer_query
- case GL_TIMESTAMP_EXT:
- *params = mImplementation->getTimestamp();
- break;
-
- case GL_MAX_SHADER_STORAGE_BLOCK_SIZE:
- *params = mCaps.maxShaderStorageBlockSize;
- break;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-void Context::getPointerv(GLenum pname, void **params) const
-{
- mGLState.getPointerv(pname, params);
-}
-
-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 = mCaps.maxComputeWorkGroupCount[index];
- break;
- case GL_MAX_COMPUTE_WORK_GROUP_SIZE:
- ASSERT(index < 3u);
- *data = mCaps.maxComputeWorkGroupSize[index];
- break;
- default:
- mGLState.getIntegeri_v(target, index, data);
- }
- }
- else
- {
- CastIndexedStateValues(this, nativeType, target, index, numParams, 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)
- {
- mGLState.getInteger64i_v(target, index, data);
- }
- else
- {
- CastIndexedStateValues(this, nativeType, target, index, numParams, 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)
- {
- mGLState.getBooleani_v(target, index, data);
- }
- else
- {
- CastIndexedStateValues(this, nativeType, target, index, numParams, data);
- }
-}
-
-void Context::getBufferParameteriv(BufferBinding target, GLenum pname, GLint *params)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- QueryBufferParameteriv(buffer, pname, params);
-}
-
-void Context::getFramebufferAttachmentParameteriv(GLenum target,
- GLenum attachment,
- GLenum pname,
- GLint *params)
-{
- const Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- QueryFramebufferAttachmentParameteriv(framebuffer, attachment, pname, params);
-}
-
-void Context::getRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer();
- QueryRenderbufferiv(this, renderbuffer, pname, params);
-}
-
-void Context::getTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- Texture *texture = getTargetTexture(target);
- QueryTexParameterfv(texture, pname, params);
-}
-
-void Context::getTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- Texture *texture = getTargetTexture(target);
- QueryTexParameteriv(texture, pname, params);
-}
-
-void Context::getTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- QueryTexLevelParameteriv(texture, target, level, pname, params);
-}
-
-void Context::getTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- QueryTexLevelParameterfv(texture, target, level, pname, params);
-}
-
-void Context::texParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- Texture *texture = getTargetTexture(target);
- SetTexParameterf(this, texture, pname, param);
- onTextureChange(texture);
-}
-
-void Context::texParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- Texture *texture = getTargetTexture(target);
- SetTexParameterfv(this, texture, pname, params);
- onTextureChange(texture);
-}
-
-void Context::texParameteri(GLenum target, GLenum pname, GLint param)
-{
- Texture *texture = getTargetTexture(target);
- SetTexParameteri(this, texture, pname, param);
- onTextureChange(texture);
-}
-
-void Context::texParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- Texture *texture = getTargetTexture(target);
- SetTexParameteriv(this, texture, pname, params);
- onTextureChange(texture);
-}
-
-void Context::drawArrays(GLenum mode, GLint first, GLsizei count)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(mImplementation->drawArrays(this, mode, first, count));
- MarkTransformFeedbackBufferUsage(mGLState.getCurrentTransformFeedback());
-}
-
-void Context::drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(
- mImplementation->drawArraysInstanced(this, mode, first, count, instanceCount));
- MarkTransformFeedbackBufferUsage(mGLState.getCurrentTransformFeedback());
-}
-
-void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(mImplementation->drawElements(this, mode, count, type, indices));
-}
-
-void Context::drawElementsInstanced(GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(
- mImplementation->drawElementsInstanced(this, mode, count, type, indices, instances));
-}
-
-void Context::drawRangeElements(GLenum mode,
- GLuint start,
- GLuint end,
- GLsizei count,
- GLenum type,
- const void *indices)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(
- mImplementation->drawRangeElements(this, mode, start, end, count, type, indices));
-}
-
-void Context::drawArraysIndirect(GLenum mode, const void *indirect)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(mImplementation->drawArraysIndirect(this, mode, indirect));
-}
-
-void Context::drawElementsIndirect(GLenum mode, GLenum type, const void *indirect)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(mImplementation->drawElementsIndirect(this, mode, type, indirect));
-}
-
-void Context::flush()
-{
- handleError(mImplementation->flush(this));
-}
-
-void Context::finish()
-{
- handleError(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);
- mImplementation->pushGroupMarker(length, marker);
-}
-
-void Context::popGroupMarker()
-{
- ASSERT(mImplementation);
- mImplementation->popGroupMarker();
-}
-
-void Context::bindUniformLocation(GLuint program, GLint location, const GLchar *name)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
-
- programObject->bindUniformLocation(location, name);
-}
-
-void Context::setCoverageModulation(GLenum components)
-{
- mGLState.setCoverageModulation(components);
-}
-
-void Context::loadPathRenderingMatrix(GLenum matrixMode, const GLfloat *matrix)
-{
- mGLState.loadPathRenderingMatrix(matrixMode, matrix);
-}
-
-void Context::loadPathRenderingIdentityMatrix(GLenum matrixMode)
-{
- GLfloat I[16];
- angle::Matrix<GLfloat>::setToIdentity(I);
-
- mGLState.loadPathRenderingMatrix(matrixMode, I);
-}
-
-void Context::stencilFillPath(GLuint path, GLenum fillMode, GLuint mask)
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (!pathObj)
- return;
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->stencilFillPath(pathObj, fillMode, mask);
-}
-
-void Context::stencilStrokePath(GLuint path, GLint reference, GLuint mask)
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (!pathObj)
- return;
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->stencilStrokePath(pathObj, reference, mask);
-}
-
-void Context::coverFillPath(GLuint path, GLenum coverMode)
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (!pathObj)
- return;
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->coverFillPath(pathObj, coverMode);
-}
-
-void Context::coverStrokePath(GLuint path, GLenum coverMode)
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (!pathObj)
- return;
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->coverStrokePath(pathObj, coverMode);
-}
-
-void Context::stencilThenCoverFillPath(GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode)
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (!pathObj)
- return;
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->stencilThenCoverFillPath(pathObj, fillMode, mask, coverMode);
-}
-
-void Context::stencilThenCoverStrokePath(GLuint path,
- GLint reference,
- GLuint mask,
- GLenum coverMode)
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (!pathObj)
- return;
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- 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.mPaths, numPaths, pathNameType, paths, pathBase);
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- 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.mPaths, numPaths, pathNameType, paths, pathBase);
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- 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.mPaths, numPaths, pathNameType, paths, pathBase);
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- 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.mPaths, numPaths, pathNameType, paths, pathBase);
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- 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.mPaths, numPaths, pathNameType, paths, pathBase);
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- 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.mPaths, numPaths, pathNameType, paths, pathBase);
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->stencilThenCoverStrokePathInstanced(pathObjects, coverMode, reference, mask,
- transformType, transformValues);
-}
-
-void Context::bindFragmentInputLocation(GLuint program, GLint location, const GLchar *name)
-{
- auto *programObject = getProgram(program);
-
- programObject->bindFragmentInputLocation(location, name);
-}
-
-void Context::programPathFragmentInputGen(GLuint program,
- GLint location,
- GLenum genMode,
- GLint components,
- const GLfloat *coeffs)
-{
- auto *programObject = getProgram(program);
-
- programObject->pathFragmentInputGen(this, location, genMode, components, coeffs);
-}
-
-GLuint Context::getProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- const auto *programObject = getProgram(program);
- return QueryProgramResourceIndex(programObject, programInterface, name);
-}
-
-void Context::getProgramResourceName(GLuint program,
- GLenum programInterface,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *name)
-{
- const auto *programObject = getProgram(program);
- QueryProgramResourceName(programObject, programInterface, index, bufSize, length, name);
-}
-
-GLint Context::getProgramResourceLocation(GLuint program,
- GLenum programInterface,
- const GLchar *name)
-{
- const auto *programObject = getProgram(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 auto *programObject = getProgram(program);
- QueryProgramResourceiv(programObject, programInterface, index, propCount, props, bufSize,
- length, params);
-}
-
-void Context::getProgramInterfaceiv(GLuint program,
- GLenum programInterface,
- GLenum pname,
- GLint *params)
-{
- const auto *programObject = getProgram(program);
- QueryProgramInterfaceiv(programObject, programInterface, pname, params);
-}
-
-void Context::handleError(const Error &error)
-{
- if (error.isError())
- {
- GLenum code = error.getCode();
- mErrors.insert(code);
- if (code == GL_OUT_OF_MEMORY && getWorkarounds().loseContextOnOutOfMemory)
- {
- markContextLost();
- }
-
- ASSERT(!error.getMessage().empty());
- mGLState.getDebug().insertMessage(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR, error.getID(),
- GL_DEBUG_SEVERITY_HIGH, error.getMessage());
- }
-}
-
-// Get one of the recorded errors and clear its flag, if any.
-// [OpenGL ES 2.0.24] section 2.5 page 13.
-GLenum Context::getError()
-{
- if (mErrors.empty())
- {
- return GL_NO_ERROR;
- }
- else
- {
- GLenum error = *mErrors.begin();
- mErrors.erase(mErrors.begin());
- return error;
- }
-}
-
-// NOTE: this function should not assume that this context is current!
-void Context::markContextLost()
-{
- if (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT)
- {
- mResetStatus = GL_UNKNOWN_CONTEXT_RESET_EXT;
- mContextLostForced = true;
- }
- mContextLost = true;
-}
-
-bool Context::isContextLost()
-{
- return mContextLost;
-}
-
-GLenum Context::getResetStatus()
-{
- // 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() != GL_NO_ERROR)
- {
- 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 == GL_NO_ERROR);
- mResetStatus = mImplementation->getResetStatus();
-
- if (mResetStatus != GL_NO_ERROR)
- {
- mContextLost = true;
- }
- }
- else if (!mContextLostForced && mResetStatus != GL_NO_ERROR)
- {
- // 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 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 mClientType;
-}
-
-EGLenum Context::getRenderBuffer() const
-{
- const Framebuffer *framebuffer = mState.mFramebuffers->getFramebuffer(0);
- if (framebuffer == nullptr)
- {
- return EGL_NONE;
- }
-
- const FramebufferAttachment *backAttachment = framebuffer->getAttachment(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,
- mCaps.maxVertexAttributes, mCaps.maxVertexAttribBindings);
-
- 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, 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.
- mGLState.detachTexture(this, mZeroTextures, texture);
-}
-
-void Context::detachBuffer(GLuint 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
- mGLState.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 (mGLState.removeReadFramebufferBinding(framebuffer) && framebuffer != 0)
- {
- bindReadFramebuffer(0);
- }
-
- if (mGLState.removeDrawFramebufferBinding(framebuffer) && framebuffer != 0)
- {
- bindDrawFramebuffer(0);
- }
-}
-
-void Context::detachRenderbuffer(GLuint renderbuffer)
-{
- mGLState.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 (mGLState.removeVertexArrayBinding(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 (mGLState.removeTransformFeedbackBinding(this, transformFeedback))
- {
- bindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
- }
-}
-
-void Context::detachSampler(GLuint sampler)
-{
- mGLState.detachSampler(this, sampler);
-}
-
-void Context::detachProgramPipeline(GLuint pipeline)
-{
- mGLState.detachProgramPipeline(this, pipeline);
-}
-
-void Context::vertexAttribDivisor(GLuint index, GLuint divisor)
-{
- mGLState.setVertexAttribDivisor(this, index, divisor);
-}
-
-void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- Sampler *samplerObject =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
- SetSamplerParameteri(samplerObject, pname, param);
- mGLState.setObjectDirty(GL_SAMPLER);
-}
-
-void Context::samplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- Sampler *samplerObject =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
- SetSamplerParameteriv(samplerObject, pname, param);
- mGLState.setObjectDirty(GL_SAMPLER);
-}
-
-void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- Sampler *samplerObject =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
- SetSamplerParameterf(samplerObject, pname, param);
- mGLState.setObjectDirty(GL_SAMPLER);
-}
-
-void Context::samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- Sampler *samplerObject =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
- SetSamplerParameterfv(samplerObject, pname, param);
- mGLState.setObjectDirty(GL_SAMPLER);
-}
-
-void Context::getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- const Sampler *samplerObject =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
- QuerySamplerParameteriv(samplerObject, pname, params);
- mGLState.setObjectDirty(GL_SAMPLER);
-}
-
-void Context::getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- const Sampler *samplerObject =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
- QuerySamplerParameterfv(samplerObject, pname, params);
- mGLState.setObjectDirty(GL_SAMPLER);
-}
-
-void Context::programParameteri(GLuint program, GLenum pname, GLint value)
-{
- gl::Program *programObject = getProgram(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;
- versionString << "OpenGL ES " << clientVersion.major << "." << clientVersion.minor << " (ANGLE "
- << ANGLE_VERSION_STRING << ")";
- mVersionString = MakeStaticString(versionString.str());
-
- std::ostringstream shadingLanguageVersionString;
- shadingLanguageVersionString << "OpenGL ES GLSL ES "
- << (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 : mExtensions.getStrings())
- {
- mExtensionStrings.push_back(MakeStaticString(extensionString));
- }
- mExtensionString = mergeExtensionStrings(mExtensionStrings);
-
- const gl::Extensions &nativeExtensions = mImplementation->getNativeExtensions();
-
- mRequestableExtensionStrings.clear();
- for (const auto &extensionInfo : GetExtensionInfoMap())
- {
- if (extensionInfo.second.Requestable &&
- !(mExtensions.*(extensionInfo.second.ExtensionsMember)) &&
- nativeExtensions.*(extensionInfo.second.ExtensionsMember))
- {
- mRequestableExtensionStrings.push_back(MakeStaticString(extensionInfo.first));
- }
- }
- mRequestableExtensionString = mergeExtensionStrings(mRequestableExtensionStrings);
-}
-
-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);
-
- const Extensions &nativeExtensions = mImplementation->getNativeExtensions();
- return extension != extensionInfos.end() && extension->second.Requestable &&
- nativeExtensions.*(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(mImplementation->getNativeExtensions().*(extension.ExtensionsMember));
-
- if (mExtensions.*(extension.ExtensionsMember))
- {
- // Extension already enabled
- return;
- }
-
- 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.mTextures->signalAllTexturesDirty();
- for (auto &zeroTexture : mZeroTextures)
- {
- zeroTexture.second->signalDirty(InitState::Initialized);
- }
-
- mState.mFramebuffers->invalidateFramebufferComplenessCache();
-}
-
-size_t Context::getRequestableExtensionStringCount() const
-{
- return mRequestableExtensionStrings.size();
-}
-
-void Context::beginTransformFeedback(GLenum primitiveMode)
-{
- TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
- ASSERT(transformFeedback != nullptr);
- ASSERT(!transformFeedback->isPaused());
-
- transformFeedback->begin(this, primitiveMode, mGLState.getProgram());
-}
-
-bool Context::hasActiveTransformFeedback(GLuint program) const
-{
- for (auto pair : mTransformFeedbackMap)
- {
- if (pair.second != nullptr && pair.second->hasBoundProgram(program))
- {
- return true;
- }
- }
- return false;
-}
-
-void Context::initCaps(const egl::DisplayExtensions &displayExtensions, bool robustResourceInit)
-{
- mCaps = mImplementation->getNativeCaps();
-
- mExtensions = mImplementation->getNativeExtensions();
-
- mLimitations = mImplementation->getNativeLimitations();
-
- if (getClientVersion() < Version(3, 0))
- {
- // Disable ES3+ extensions
- mExtensions.colorBufferFloat = false;
- mExtensions.eglImageExternalEssl3 = false;
- mExtensions.textureNorm16 = false;
- mExtensions.multiview = false;
- mExtensions.maxViews = 1u;
- }
-
- if (getClientVersion() < ES_3_1)
- {
- // Disable ES3.1+ extensions
- mExtensions.geometryShader = false;
- }
-
- if (getClientVersion() > Version(2, 0))
- {
- // FIXME(geofflang): Don't support EXT_sRGB in non-ES2 contexts
- // mExtensions.sRGB = false;
- }
-
- // Some extensions are always available because they are implemented in the GL layer.
- mExtensions.bindUniformLocation = true;
- mExtensions.vertexArrayObject = true;
- mExtensions.bindGeneratesResource = true;
- mExtensions.clientArrays = true;
- mExtensions.requestExtension = true;
-
- // Enable the no error extension if the context was created with the flag.
- mExtensions.noError = mSkipValidation;
-
- // Enable surfaceless to advertise we'll have the correct behavior when there is no default FBO
- mExtensions.surfacelessContext = displayExtensions.surfacelessContext;
-
- // Explicitly enable GL_KHR_debug
- mExtensions.debug = true;
- mExtensions.maxDebugMessageLength = 1024;
- mExtensions.maxDebugLoggedMessages = 1024;
- mExtensions.maxDebugGroupStackDepth = 1024;
- mExtensions.maxLabelLength = 1024;
-
- // Explicitly enable GL_ANGLE_robust_client_memory
- mExtensions.robustClientMemory = true;
-
- // Determine robust resource init availability from EGL.
- mExtensions.robustResourceInitialization = robustResourceInit;
-
- // mExtensions.robustBufferAccessBehavior is true only if robust access is true and the backend
- // supports it.
- mExtensions.robustBufferAccessBehavior =
- mRobustAccess && mExtensions.robustBufferAccessBehavior;
-
- // Enable the cache control query unconditionally.
- mExtensions.programCacheControl = true;
-
- // Apply implementation limits
- LimitCap(&mCaps.maxVertexAttributes, MAX_VERTEX_ATTRIBS);
-
- if (getClientVersion() < ES_3_1)
- {
- mCaps.maxVertexAttribBindings = mCaps.maxVertexAttributes;
- }
- else
- {
- LimitCap(&mCaps.maxVertexAttribBindings, MAX_VERTEX_ATTRIB_BINDINGS);
- }
-
- LimitCap(&mCaps.maxVertexUniformBlocks, IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS);
- LimitCap(&mCaps.maxVertexOutputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
- LimitCap(&mCaps.maxFragmentInputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
-
- // Limit textures as well, so we can use fast bitsets with texture bindings.
- LimitCap(&mCaps.maxCombinedTextureImageUnits, IMPLEMENTATION_MAX_ACTIVE_TEXTURES);
- LimitCap(&mCaps.maxVertexTextureImageUnits, IMPLEMENTATION_MAX_ACTIVE_TEXTURES / 2);
- LimitCap(&mCaps.maxTextureImageUnits, IMPLEMENTATION_MAX_ACTIVE_TEXTURES / 2);
-
- mCaps.maxSampleMaskWords = std::min<GLuint>(mCaps.maxSampleMaskWords, MAX_SAMPLE_MASK_WORDS);
-
- // WebGL compatibility
- mExtensions.webglCompatibility = mWebGLContext;
- for (const auto &extensionInfo : GetExtensionInfoMap())
- {
- // If this context is for WebGL, disable all enableable extensions
- if (mWebGLContext && extensionInfo.second.Requestable)
- {
- mExtensions.*(extensionInfo.second.ExtensionsMember) = false;
- }
- }
-
- // Generate texture caps
- updateCaps();
-}
-
-void Context::updateCaps()
-{
- mCaps.compressedTextureFormats.clear();
- 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(), mExtensions);
- formatCaps.renderable =
- formatCaps.renderable && formatInfo.renderSupport(getClientVersion(), mExtensions);
- formatCaps.filterable =
- formatCaps.filterable && formatInfo.filterSupport(getClientVersion(), 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.renderable ||
- (getClientVersion() < ES_3_1 &&
- (formatInfo.componentType == GL_INT || formatInfo.componentType == GL_UNSIGNED_INT)))
- {
- 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.componentType != GL_INT && formatInfo.componentType != GL_UNSIGNED_INT &&
- formatInfo.isRequiredRenderbufferFormat(getClientVersion()))
- {
- ASSERT(getClientVersion() < ES_3_0 || formatMaxSamples >= 4);
- mCaps.maxSamples = std::min(mCaps.maxSamples, formatMaxSamples);
- }
-
- // Handle GLES 3.1 MAX_*_SAMPLES values similarly to MAX_SAMPLES.
- if (getClientVersion() >= ES_3_1)
- {
- // 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.componentType == GL_INT ||
- formatInfo.componentType == GL_UNSIGNED_INT)
- {
- mCaps.maxIntegerSamples = std::min(mCaps.maxIntegerSamples, formatMaxSamples);
- }
-
- // GLES 3.1 section 19.3.1.
- if (formatCaps.texturable)
- {
- if (formatInfo.depthBits > 0)
- {
- mCaps.maxDepthTextureSamples =
- std::min(mCaps.maxDepthTextureSamples, formatMaxSamples);
- }
- else if (formatInfo.redBits > 0)
- {
- mCaps.maxColorTextureSamples =
- std::min(mCaps.maxColorTextureSamples, formatMaxSamples);
- }
- }
- }
- }
-
- if (formatCaps.texturable && formatInfo.compressed)
- {
- mCaps.compressedTextureFormats.push_back(sizedInternalFormat);
- }
-
- mTextureCaps.insert(sizedInternalFormat, formatCaps);
- }
-
- // If program binary is disabled, blank out the memory cache pointer.
- if (!mImplementation->getNativeExtensions().getProgramBinary)
- {
- mMemoryProgramCache = nullptr;
- }
-}
-
-void Context::initWorkarounds()
-{
- // Apply back-end workarounds.
- mImplementation->applyNativeWorkarounds(&mWorkarounds);
-
- // Lose the context upon out of memory error if the application is
- // expecting to watch for those events.
- mWorkarounds.loseContextOnOutOfMemory = (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
-}
-
-Error Context::prepareForDraw()
-{
- syncRendererState();
-
- if (isRobustResourceInitEnabled())
- {
- ANGLE_TRY(mGLState.clearUnclearedActiveTextures(this));
- ANGLE_TRY(mGLState.getDrawFramebuffer()->ensureDrawAttachmentsInitialized(this));
- }
-
- return NoError();
-}
-
-void Context::syncRendererState()
-{
- mGLState.syncDirtyObjects(this);
- const State::DirtyBits &dirtyBits = mGLState.getDirtyBits();
- mImplementation->syncState(this, dirtyBits);
- mGLState.clearDirtyBits();
-}
-
-void Context::syncRendererState(const State::DirtyBits &bitMask,
- const State::DirtyObjects &objectMask)
-{
- mGLState.syncDirtyObjects(this, objectMask);
- const State::DirtyBits &dirtyBits = (mGLState.getDirtyBits() & bitMask);
- mImplementation->syncState(this, dirtyBits);
- mGLState.clearDirtyBits(dirtyBits);
-}
-
-void Context::blitFramebuffer(GLint srcX0,
- GLint srcY0,
- GLint srcX1,
- GLint srcY1,
- GLint dstX0,
- GLint dstY0,
- GLint dstX1,
- GLint dstY1,
- GLbitfield mask,
- GLenum filter)
-{
- Framebuffer *drawFramebuffer = mGLState.getDrawFramebuffer();
- ASSERT(drawFramebuffer);
-
- Rectangle srcArea(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0);
- Rectangle dstArea(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0);
-
- syncStateForBlit();
-
- handleError(drawFramebuffer->blit(this, srcArea, dstArea, mask, filter));
-}
-
-void Context::clear(GLbitfield mask)
-{
- syncStateForClear();
- handleError(mGLState.getDrawFramebuffer()->clear(this, mask));
-}
-
-void Context::clearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *values)
-{
- syncStateForClear();
- handleError(mGLState.getDrawFramebuffer()->clearBufferfv(this, buffer, drawbuffer, values));
-}
-
-void Context::clearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *values)
-{
- syncStateForClear();
- handleError(mGLState.getDrawFramebuffer()->clearBufferuiv(this, buffer, drawbuffer, values));
-}
-
-void Context::clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values)
-{
- syncStateForClear();
- handleError(mGLState.getDrawFramebuffer()->clearBufferiv(this, buffer, drawbuffer, values));
-}
-
-void Context::clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- Framebuffer *framebufferObject = mGLState.getDrawFramebuffer();
- ASSERT(framebufferObject);
-
- // If a buffer is not present, the clear has no effect
- if (framebufferObject->getDepthbuffer() == nullptr &&
- framebufferObject->getStencilbuffer() == nullptr)
- {
- return;
- }
-
- syncStateForClear();
- handleError(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;
- }
-
- syncStateForReadPixels();
-
- Framebuffer *readFBO = mGLState.getReadFramebuffer();
- ASSERT(readFBO);
-
- Rectangle area(x, y, width, height);
- handleError(readFBO->readPixels(this, area, format, type, pixels));
-}
-
-void Context::copyTexImage2D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- // Only sync the read FBO
- mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER);
-
- Rectangle sourceArea(x, y, width, height);
-
- Framebuffer *framebuffer = mGLState.getReadFramebuffer();
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- handleError(texture->copyImage(this, target, level, sourceArea, internalformat, framebuffer));
-}
-
-void Context::copyTexSubImage2D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- if (width == 0 || height == 0)
- {
- return;
- }
-
- // Only sync the read FBO
- mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER);
-
- Offset destOffset(xoffset, yoffset, 0);
- Rectangle sourceArea(x, y, width, height);
-
- Framebuffer *framebuffer = mGLState.getReadFramebuffer();
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- handleError(texture->copySubImage(this, target, level, destOffset, sourceArea, framebuffer));
-}
-
-void Context::copyTexSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- if (width == 0 || height == 0)
- {
- return;
- }
-
- // Only sync the read FBO
- mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER);
-
- Offset destOffset(xoffset, yoffset, zoffset);
- Rectangle sourceArea(x, y, width, height);
-
- Framebuffer *framebuffer = mGLState.getReadFramebuffer();
- Texture *texture = getTargetTexture(target);
- handleError(texture->copySubImage(this, target, level, destOffset, sourceArea, framebuffer));
-}
-
-void Context::framebufferTexture2D(GLenum target,
- GLenum attachment,
- GLenum textarget,
- GLuint texture,
- GLint level)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (texture != 0)
- {
- Texture *textureObj = getTexture(texture);
-
- ImageIndex index = ImageIndex::MakeInvalid();
-
- if (textarget == GL_TEXTURE_2D)
- {
- index = ImageIndex::Make2D(level);
- }
- else if (textarget == GL_TEXTURE_RECTANGLE_ANGLE)
- {
- index = ImageIndex::MakeRectangle(level);
- }
- else if (textarget == GL_TEXTURE_2D_MULTISAMPLE)
- {
- ASSERT(level == 0);
- index = ImageIndex::Make2DMultisample();
- }
- else
- {
- ASSERT(IsCubeMapTextureTarget(textarget));
- index = ImageIndex::MakeCube(textarget, level);
- }
-
- framebuffer->setAttachment(this, GL_TEXTURE, attachment, index, textureObj);
- }
- else
- {
- framebuffer->resetAttachment(this, attachment);
- }
-
- mGLState.setObjectDirty(target);
-}
-
-void Context::framebufferRenderbuffer(GLenum target,
- GLenum attachment,
- GLenum renderbuffertarget,
- GLuint renderbuffer)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (renderbuffer != 0)
- {
- Renderbuffer *renderbufferObject = getRenderbuffer(renderbuffer);
-
- framebuffer->setAttachment(this, GL_RENDERBUFFER, attachment, gl::ImageIndex::MakeInvalid(),
- renderbufferObject);
- }
- else
- {
- framebuffer->resetAttachment(this, attachment);
- }
-
- mGLState.setObjectDirty(target);
-}
-
-void Context::framebufferTextureLayer(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLint layer)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (texture != 0)
- {
- Texture *textureObject = getTexture(texture);
-
- ImageIndex index = ImageIndex::MakeInvalid();
-
- if (textureObject->getTarget() == GL_TEXTURE_3D)
- {
- index = ImageIndex::Make3D(level, layer);
- }
- else
- {
- ASSERT(textureObject->getTarget() == GL_TEXTURE_2D_ARRAY);
- index = ImageIndex::Make2DArray(level, layer);
- }
-
- framebuffer->setAttachment(this, GL_TEXTURE, attachment, index, textureObject);
- }
- else
- {
- framebuffer->resetAttachment(this, attachment);
- }
-
- mGLState.setObjectDirty(target);
-}
-
-void Context::framebufferTextureMultiviewLayeredANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLint baseViewIndex,
- GLsizei numViews)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (texture != 0)
- {
- Texture *textureObj = getTexture(texture);
-
- ImageIndex index = ImageIndex::Make2DArrayRange(level, baseViewIndex, numViews);
- framebuffer->setAttachmentMultiviewLayered(this, GL_TEXTURE, attachment, index, textureObj,
- numViews, baseViewIndex);
- }
- else
- {
- framebuffer->resetAttachment(this, attachment);
- }
-
- mGLState.setObjectDirty(target);
-}
-
-void Context::framebufferTextureMultiviewSideBySideANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLsizei numViews,
- const GLint *viewportOffsets)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (texture != 0)
- {
- Texture *textureObj = getTexture(texture);
-
- ImageIndex index = ImageIndex::Make2D(level);
- framebuffer->setAttachmentMultiviewSideBySide(this, GL_TEXTURE, attachment, index,
- textureObj, numViews, viewportOffsets);
- }
- else
- {
- framebuffer->resetAttachment(this, attachment);
- }
-
- mGLState.setObjectDirty(target);
-}
-
-void Context::drawBuffers(GLsizei n, const GLenum *bufs)
-{
- Framebuffer *framebuffer = mGLState.getDrawFramebuffer();
- ASSERT(framebuffer);
- framebuffer->setDrawBuffers(n, bufs);
- mGLState.setObjectDirty(GL_DRAW_FRAMEBUFFER);
-}
-
-void Context::readBuffer(GLenum mode)
-{
- Framebuffer *readFBO = mGLState.getReadFramebuffer();
- readFBO->setReadBuffer(mode);
- mGLState.setObjectDirty(GL_READ_FRAMEBUFFER);
-}
-
-void Context::discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- // Only sync the FBO
- mGLState.syncDirtyObject(this, target);
-
- Framebuffer *framebuffer = mGLState.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.
- handleError(framebuffer->discard(this, numAttachments, attachments));
-}
-
-void Context::invalidateFramebuffer(GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments)
-{
- // Only sync the FBO
- mGLState.syncDirtyObject(this, target);
-
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (framebuffer->checkStatus(this) != GL_FRAMEBUFFER_COMPLETE)
- {
- return;
- }
-
- handleError(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
- mGLState.syncDirtyObject(this, target);
-
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (framebuffer->checkStatus(this) != GL_FRAMEBUFFER_COMPLETE)
- {
- return;
- }
-
- Rectangle area(x, y, width, height);
- handleError(framebuffer->invalidateSub(this, numAttachments, attachments, area));
-}
-
-void Context::texImage2D(GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels)
-{
- syncStateForTexImage();
-
- Extents size(width, height, 1);
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- handleError(texture->setImage(this, mGLState.getUnpackState(), target, level, internalformat,
- size, format, type, reinterpret_cast<const uint8_t *>(pixels)));
-}
-
-void Context::texImage3D(GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels)
-{
- syncStateForTexImage();
-
- Extents size(width, height, depth);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setImage(this, mGLState.getUnpackState(), target, level, internalformat,
- size, format, type, reinterpret_cast<const uint8_t *>(pixels)));
-}
-
-void Context::texSubImage2D(GLenum 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;
- }
-
- syncStateForTexImage();
-
- Box area(xoffset, yoffset, 0, width, height, 1);
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- handleError(texture->setSubImage(this, mGLState.getUnpackState(), target, level, area, format,
- type, reinterpret_cast<const uint8_t *>(pixels)));
-}
-
-void Context::texSubImage3D(GLenum 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;
- }
-
- syncStateForTexImage();
-
- Box area(xoffset, yoffset, zoffset, width, height, depth);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setSubImage(this, mGLState.getUnpackState(), target, level, area, format,
- type, reinterpret_cast<const uint8_t *>(pixels)));
-}
-
-void Context::compressedTexImage2D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLsizei imageSize,
- const void *data)
-{
- syncStateForTexImage();
-
- Extents size(width, height, 1);
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- handleError(texture->setCompressedImage(this, mGLState.getUnpackState(), target, level,
- internalformat, size, imageSize,
- reinterpret_cast<const uint8_t *>(data)));
-}
-
-void Context::compressedTexImage3D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLsizei imageSize,
- const void *data)
-{
- syncStateForTexImage();
-
- Extents size(width, height, depth);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setCompressedImage(this, mGLState.getUnpackState(), target, level,
- internalformat, size, imageSize,
- reinterpret_cast<const uint8_t *>(data)));
-}
-
-void Context::compressedTexSubImage2D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLsizei imageSize,
- const void *data)
-{
- syncStateForTexImage();
-
- Box area(xoffset, yoffset, 0, width, height, 1);
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- handleError(texture->setCompressedSubImage(this, mGLState.getUnpackState(), target, level, area,
- format, imageSize,
- reinterpret_cast<const uint8_t *>(data)));
-}
-
-void Context::compressedTexSubImage3D(GLenum 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;
- }
-
- syncStateForTexImage();
-
- Box area(xoffset, yoffset, zoffset, width, height, depth);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setCompressedSubImage(this, mGLState.getUnpackState(), target, level, area,
- format, imageSize,
- reinterpret_cast<const uint8_t *>(data)));
-}
-
-void Context::generateMipmap(GLenum target)
-{
- Texture *texture = getTargetTexture(target);
- handleError(texture->generateMipmap(this));
-}
-
-void Context::copyTextureCHROMIUM(GLuint sourceId,
- GLint sourceLevel,
- GLenum destTarget,
- GLuint destId,
- GLint destLevel,
- GLint internalFormat,
- GLenum destType,
- GLboolean unpackFlipY,
- GLboolean unpackPremultiplyAlpha,
- GLboolean unpackUnmultiplyAlpha)
-{
- syncStateForTexImage();
-
- gl::Texture *sourceTexture = getTexture(sourceId);
- gl::Texture *destTexture = getTexture(destId);
- handleError(destTexture->copyTexture(this, destTarget, destLevel, internalFormat, destType,
- sourceLevel, ConvertToBool(unpackFlipY),
- ConvertToBool(unpackPremultiplyAlpha),
- ConvertToBool(unpackUnmultiplyAlpha), sourceTexture));
-}
-
-void Context::copySubTextureCHROMIUM(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)
-{
- // Zero sized copies are valid but no-ops
- if (width == 0 || height == 0)
- {
- return;
- }
-
- syncStateForTexImage();
-
- gl::Texture *sourceTexture = getTexture(sourceId);
- gl::Texture *destTexture = getTexture(destId);
- Offset offset(xoffset, yoffset, 0);
- Rectangle area(x, y, width, height);
- handleError(destTexture->copySubTexture(this, destTarget, destLevel, offset, sourceLevel, area,
- ConvertToBool(unpackFlipY),
- ConvertToBool(unpackPremultiplyAlpha),
- ConvertToBool(unpackUnmultiplyAlpha), sourceTexture));
-}
-
-void Context::compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId)
-{
- syncStateForTexImage();
-
- gl::Texture *sourceTexture = getTexture(sourceId);
- gl::Texture *destTexture = getTexture(destId);
- handleError(destTexture->copyCompressedTexture(this, sourceTexture));
-}
-
-void Context::getBufferPointerv(BufferBinding target, GLenum pname, void **params)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- ASSERT(buffer);
-
- QueryBufferPointerv(buffer, pname, params);
-}
-
-void *Context::mapBuffer(BufferBinding target, GLenum access)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- ASSERT(buffer);
-
- Error error = buffer->map(this, access);
- if (error.isError())
- {
- handleError(error);
- return nullptr;
- }
-
- return buffer->getMapPointer();
-}
-
-GLboolean Context::unmapBuffer(BufferBinding target)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- ASSERT(buffer);
-
- GLboolean result;
- Error error = buffer->unmap(this, &result);
- if (error.isError())
- {
- handleError(error);
- return GL_FALSE;
- }
-
- return result;
-}
-
-void *Context::mapBufferRange(BufferBinding target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- ASSERT(buffer);
-
- Error error = buffer->mapRange(this, offset, length, access);
- if (error.isError())
- {
- handleError(error);
- 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
-}
-
-void Context::syncStateForReadPixels()
-{
- syncRendererState(mReadPixelsDirtyBits, mReadPixelsDirtyObjects);
-}
-
-void Context::syncStateForTexImage()
-{
- syncRendererState(mTexImageDirtyBits, mTexImageDirtyObjects);
-}
-
-void Context::syncStateForClear()
-{
- syncRendererState(mClearDirtyBits, mClearDirtyObjects);
-}
-
-void Context::syncStateForBlit()
-{
- syncRendererState(mBlitDirtyBits, mBlitDirtyObjects);
-}
-
-void Context::activeShaderProgram(GLuint pipeline, GLuint program)
-{
- UNIMPLEMENTED();
-}
-
-void Context::activeTexture(GLenum texture)
-{
- mGLState.setActiveSampler(texture - GL_TEXTURE0);
-}
-
-void Context::blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- mGLState.setBlendColor(clamp01(red), clamp01(green), clamp01(blue), clamp01(alpha));
-}
-
-void Context::blendEquation(GLenum mode)
-{
- mGLState.setBlendEquation(mode, mode);
-}
-
-void Context::blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- mGLState.setBlendEquation(modeRGB, modeAlpha);
-}
-
-void Context::blendFunc(GLenum sfactor, GLenum dfactor)
-{
- mGLState.setBlendFactors(sfactor, dfactor, sfactor, dfactor);
-}
-
-void Context::blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- mGLState.setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-void Context::clearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- mGLState.setColorClearValue(red, green, blue, alpha);
-}
-
-void Context::clearDepthf(GLfloat depth)
-{
- mGLState.setDepthClearValue(depth);
-}
-
-void Context::clearStencil(GLint s)
-{
- mGLState.setStencilClearValue(s);
-}
-
-void Context::colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- mGLState.setColorMask(ConvertToBool(red), ConvertToBool(green), ConvertToBool(blue),
- ConvertToBool(alpha));
-}
-
-void Context::cullFace(CullFaceMode mode)
-{
- mGLState.setCullMode(mode);
-}
-
-void Context::depthFunc(GLenum func)
-{
- mGLState.setDepthFunc(func);
-}
-
-void Context::depthMask(GLboolean flag)
-{
- mGLState.setDepthMask(ConvertToBool(flag));
-}
-
-void Context::depthRangef(GLfloat zNear, GLfloat zFar)
-{
- mGLState.setDepthRange(zNear, zFar);
-}
-
-void Context::disable(GLenum cap)
-{
- mGLState.setEnableFeature(cap, false);
-}
-
-void Context::disableVertexAttribArray(GLuint index)
-{
- mGLState.setEnableVertexAttribArray(index, false);
-}
-
-void Context::enable(GLenum cap)
-{
- mGLState.setEnableFeature(cap, true);
-}
-
-void Context::enableVertexAttribArray(GLuint index)
-{
- mGLState.setEnableVertexAttribArray(index, true);
-}
-
-void Context::frontFace(GLenum mode)
-{
- mGLState.setFrontFace(mode);
-}
-
-void Context::hint(GLenum target, GLenum mode)
-{
- switch (target)
- {
- case GL_GENERATE_MIPMAP_HINT:
- mGLState.setGenerateMipmapHint(mode);
- break;
-
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
- mGLState.setFragmentShaderDerivativeHint(mode);
- break;
-
- default:
- UNREACHABLE();
- return;
- }
-}
-
-void Context::lineWidth(GLfloat width)
-{
- mGLState.setLineWidth(width);
-}
-
-void Context::pixelStorei(GLenum pname, GLint param)
-{
- switch (pname)
- {
- case GL_UNPACK_ALIGNMENT:
- mGLState.setUnpackAlignment(param);
- break;
-
- case GL_PACK_ALIGNMENT:
- mGLState.setPackAlignment(param);
- break;
-
- case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
- mGLState.setPackReverseRowOrder(param != 0);
- break;
-
- case GL_UNPACK_ROW_LENGTH:
- ASSERT((getClientMajorVersion() >= 3) || getExtensions().unpackSubimage);
- mGLState.setUnpackRowLength(param);
- break;
-
- case GL_UNPACK_IMAGE_HEIGHT:
- ASSERT(getClientMajorVersion() >= 3);
- mGLState.setUnpackImageHeight(param);
- break;
-
- case GL_UNPACK_SKIP_IMAGES:
- ASSERT(getClientMajorVersion() >= 3);
- mGLState.setUnpackSkipImages(param);
- break;
-
- case GL_UNPACK_SKIP_ROWS:
- ASSERT((getClientMajorVersion() >= 3) || getExtensions().unpackSubimage);
- mGLState.setUnpackSkipRows(param);
- break;
-
- case GL_UNPACK_SKIP_PIXELS:
- ASSERT((getClientMajorVersion() >= 3) || getExtensions().unpackSubimage);
- mGLState.setUnpackSkipPixels(param);
- break;
-
- case GL_PACK_ROW_LENGTH:
- ASSERT((getClientMajorVersion() >= 3) || getExtensions().packSubimage);
- mGLState.setPackRowLength(param);
- break;
-
- case GL_PACK_SKIP_ROWS:
- ASSERT((getClientMajorVersion() >= 3) || getExtensions().packSubimage);
- mGLState.setPackSkipRows(param);
- break;
-
- case GL_PACK_SKIP_PIXELS:
- ASSERT((getClientMajorVersion() >= 3) || getExtensions().packSubimage);
- mGLState.setPackSkipPixels(param);
- break;
-
- default:
- UNREACHABLE();
- return;
- }
-}
-
-void Context::polygonOffset(GLfloat factor, GLfloat units)
-{
- mGLState.setPolygonOffsetParams(factor, units);
-}
-
-void Context::sampleCoverage(GLfloat value, GLboolean invert)
-{
- mGLState.setSampleCoverageParams(clamp01(value), ConvertToBool(invert));
-}
-
-void Context::sampleMaski(GLuint maskNumber, GLbitfield mask)
-{
- mGLState.setSampleMaskParams(maskNumber, mask);
-}
-
-void Context::scissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- mGLState.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)
- {
- mGLState.setStencilParams(func, ref, mask);
- }
-
- if (face == GL_BACK || face == GL_FRONT_AND_BACK)
- {
- mGLState.setStencilBackParams(func, ref, mask);
- }
-}
-
-void Context::stencilMaskSeparate(GLenum face, GLuint mask)
-{
- if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
- {
- mGLState.setStencilWritemask(mask);
- }
-
- if (face == GL_BACK || face == GL_FRONT_AND_BACK)
- {
- mGLState.setStencilBackWritemask(mask);
- }
-}
-
-void Context::stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
-{
- if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
- {
- mGLState.setStencilOperations(fail, zfail, zpass);
- }
-
- if (face == GL_BACK || face == GL_FRONT_AND_BACK)
- {
- mGLState.setStencilBackOperations(fail, zfail, zpass);
- }
-}
-
-void Context::vertexAttrib1f(GLuint index, GLfloat x)
-{
- GLfloat vals[4] = {x, 0, 0, 1};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib1fv(GLuint index, const GLfloat *values)
-{
- GLfloat vals[4] = {values[0], 0, 0, 1};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- GLfloat vals[4] = {x, y, 0, 1};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib2fv(GLuint index, const GLfloat *values)
-{
- GLfloat vals[4] = {values[0], values[1], 0, 1};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- GLfloat vals[4] = {x, y, z, 1};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib3fv(GLuint index, const GLfloat *values)
-{
- GLfloat vals[4] = {values[0], values[1], values[2], 1};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GLfloat vals[4] = {x, y, z, w};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib4fv(GLuint index, const GLfloat *values)
-{
- mGLState.setVertexAttribf(index, values);
-}
-
-void Context::vertexAttribPointer(GLuint index,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLsizei stride,
- const void *ptr)
-{
- mGLState.setVertexAttribPointer(this, index, mGLState.getTargetBuffer(BufferBinding::Array),
- size, type, ConvertToBool(normalized), false, stride, ptr);
-}
-
-void Context::vertexAttribFormat(GLuint attribIndex,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLuint relativeOffset)
-{
- mGLState.setVertexAttribFormat(attribIndex, size, type, ConvertToBool(normalized), false,
- relativeOffset);
-}
-
-void Context::vertexAttribIFormat(GLuint attribIndex,
- GLint size,
- GLenum type,
- GLuint relativeOffset)
-{
- mGLState.setVertexAttribFormat(attribIndex, size, type, false, true, relativeOffset);
-}
-
-void Context::vertexAttribBinding(GLuint attribIndex, GLuint bindingIndex)
-{
- mGLState.setVertexAttribBinding(this, attribIndex, bindingIndex);
-}
-
-void Context::vertexBindingDivisor(GLuint bindingIndex, GLuint divisor)
-{
- mGLState.setVertexBindingDivisor(bindingIndex, divisor);
-}
-
-void Context::viewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- mGLState.setViewportParams(x, y, width, height);
-}
-
-void Context::vertexAttribIPointer(GLuint index,
- GLint size,
- GLenum type,
- GLsizei stride,
- const void *pointer)
-{
- mGLState.setVertexAttribPointer(this, index, mGLState.getTargetBuffer(BufferBinding::Array),
- size, type, false, true, stride, pointer);
-}
-
-void Context::vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- GLint vals[4] = {x, y, z, w};
- mGLState.setVertexAttribi(index, vals);
-}
-
-void Context::vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- GLuint vals[4] = {x, y, z, w};
- mGLState.setVertexAttribu(index, vals);
-}
-
-void Context::vertexAttribI4iv(GLuint index, const GLint *v)
-{
- mGLState.setVertexAttribi(index, v);
-}
-
-void Context::vertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- mGLState.setVertexAttribu(index, v);
-}
-
-void Context::getVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- const VertexAttribCurrentValueData &currentValues =
- getGLState().getVertexAttribCurrentValue(index);
- const VertexArray *vao = getGLState().getVertexArray();
- QueryVertexAttribiv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
- currentValues, pname, params);
-}
-
-void Context::getVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- const VertexAttribCurrentValueData &currentValues =
- getGLState().getVertexAttribCurrentValue(index);
- const VertexArray *vao = getGLState().getVertexArray();
- QueryVertexAttribfv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
- currentValues, pname, params);
-}
-
-void Context::getVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- const VertexAttribCurrentValueData &currentValues =
- getGLState().getVertexAttribCurrentValue(index);
- const VertexArray *vao = getGLState().getVertexArray();
- QueryVertexAttribIiv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
- currentValues, pname, params);
-}
-
-void Context::getVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- const VertexAttribCurrentValueData &currentValues =
- getGLState().getVertexAttribCurrentValue(index);
- const VertexArray *vao = getGLState().getVertexArray();
- QueryVertexAttribIuiv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
- currentValues, pname, params);
-}
-
-void Context::getVertexAttribPointerv(GLuint index, GLenum pname, void **pointer)
-{
- const VertexAttribute &attrib = getGLState().getVertexArray()->getVertexAttribute(index);
- QueryVertexAttribPointerv(attrib, 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);
- mGLState.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));
- mGLState.getDebug().insertMessage(source, type, id, severity, std::move(msg));
-}
-
-void Context::debugMessageCallback(GLDEBUGPROCKHR callback, const void *userParam)
-{
- mGLState.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>(mGLState.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));
- mGLState.getDebug().pushGroup(source, id, std::move(msg));
- mImplementation->pushDebugGroup(source, id, length, message);
-}
-
-void Context::popDebugGroup()
-{
- mGLState.getDebug().popGroup();
- mImplementation->popDebugGroup();
-}
-
-void Context::bufferData(BufferBinding target, GLsizeiptr size, const void *data, BufferUsage usage)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- ASSERT(buffer);
- handleError(buffer->bufferData(this, target, data, size, usage));
-}
-
-void Context::bufferSubData(BufferBinding target,
- GLintptr offset,
- GLsizeiptr size,
- const void *data)
-{
- if (data == nullptr)
- {
- return;
- }
-
- Buffer *buffer = mGLState.getTargetBuffer(target);
- ASSERT(buffer);
- handleError(buffer->bufferSubData(this, target, data, size, offset));
-}
-
-void Context::attachShader(GLuint program, GLuint shader)
-{
- Program *programObject = mState.mShaderPrograms->getProgram(program);
- Shader *shaderObject = mState.mShaderPrograms->getShader(shader);
- ASSERT(programObject && shaderObject);
- programObject->attachShader(shaderObject);
-}
-
-const Workarounds &Context::getWorkarounds() const
-{
- return mWorkarounds;
-}
-
-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 = mGLState.getTargetBuffer(readTarget);
- Buffer *writeBuffer = mGLState.getTargetBuffer(writeTarget);
-
- handleError(writeBuffer->copyBufferSubData(this, readBuffer, readOffset, writeOffset, size));
-}
-
-void Context::bindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- Program *programObject = getProgram(program);
- // TODO(jmadill): Re-use this from the validation if possible.
- ASSERT(programObject);
- programObject->bindAttributeLocation(index, name);
-}
-
-void Context::bindBuffer(BufferBinding target, GLuint buffer)
-{
- Buffer *bufferObject = mState.mBuffers->checkBufferAllocation(mImplementation.get(), buffer);
- mGLState.setBufferBinding(this, target, bufferObject);
-}
-
-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 *bufferObject = mState.mBuffers->checkBufferAllocation(mImplementation.get(), buffer);
- mGLState.setIndexedBufferBinding(this, target, index, bufferObject, offset, size);
-}
-
-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.mRenderbuffers->checkRenderbufferAllocation(mImplementation.get(), renderbuffer);
- mGLState.setRenderbufferBinding(this, object);
-}
-
-void Context::texStorage2DMultisample(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLboolean fixedsamplelocations)
-{
- Extents size(width, height, 1);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setStorageMultisample(this, target, samples, internalformat, size,
- ConvertToBool(fixedsamplelocations)));
-}
-
-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.
- mGLState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER);
- const Framebuffer *framebuffer = mGLState.getDrawFramebuffer();
-
- switch (pname)
- {
- case GL_SAMPLE_POSITION:
- handleError(framebuffer->getSamplePosition(index, val));
- break;
- default:
- UNREACHABLE();
- }
-}
-
-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 = mGLState.getCurrentRenderbuffer();
- handleError(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 = mGLState.getCurrentRenderbuffer();
- handleError(
- renderbuffer->setStorageMultisample(this, samples, convertedInternalFormat, width, height));
-}
-
-void Context::getSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- const Sync *syncObject = getSync(sync);
- handleError(QuerySynciv(syncObject, pname, bufSize, length, values));
-}
-
-void Context::getFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- QueryFramebufferParameteriv(framebuffer, pname, params);
-}
-
-void Context::framebufferParameteri(GLenum target, GLenum pname, GLint param)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- SetFramebufferParameteri(framebuffer, pname, param);
-}
-
-Error Context::getScratchBuffer(size_t requstedSizeBytes,
- angle::MemoryBuffer **scratchBufferOut) const
-{
- if (!mScratchBuffer.get(requstedSizeBytes, scratchBufferOut))
- {
- return OutOfMemory() << "Failed to allocate internal buffer.";
- }
- return NoError();
-}
-
-Error Context::getZeroFilledBuffer(size_t requstedSizeBytes,
- angle::MemoryBuffer **zeroBufferOut) const
-{
- if (!mZeroFilledBuffer.getInitialized(requstedSizeBytes, zeroBufferOut, 0))
- {
- return OutOfMemory() << "Failed to allocate internal buffer.";
- }
- return NoError();
-}
-
-void Context::dispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ)
-{
- if (numGroupsX == 0u || numGroupsY == 0u || numGroupsZ == 0u)
- {
- return;
- }
-
- // TODO(jmadill): Dirty bits for compute.
- if (isRobustResourceInitEnabled())
- {
- ANGLE_CONTEXT_TRY(mGLState.clearUnclearedActiveTextures(this));
- }
-
- handleError(mImplementation->dispatchCompute(this, numGroupsX, numGroupsY, numGroupsZ));
-}
-
-void Context::dispatchComputeIndirect(GLintptr indirect)
-{
- UNIMPLEMENTED();
-}
-
-void Context::texStorage2D(GLenum target,
- GLsizei levels,
- GLenum internalFormat,
- GLsizei width,
- GLsizei height)
-{
- Extents size(width, height, 1);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setStorage(this, target, levels, internalFormat, size));
-}
-
-void Context::texStorage3D(GLenum target,
- GLsizei levels,
- GLenum internalFormat,
- GLsizei width,
- GLsizei height,
- GLsizei depth)
-{
- Extents size(width, height, depth);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setStorage(this, target, levels, internalFormat, size));
-}
-
-void Context::memoryBarrier(GLbitfield barriers)
-{
- UNIMPLEMENTED();
-}
-
-void Context::memoryBarrierByRegion(GLbitfield barriers)
-{
- UNIMPLEMENTED();
-}
-
-GLenum Context::checkFramebufferStatus(GLenum target)
-{
- Framebuffer *framebuffer = mGLState.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 = getProgram(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 = getProgram(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 = getProgram(program);
- ASSERT(programObject);
- programObject->getActiveUniform(index, bufsize, length, size, type, name);
-}
-
-void Context::getAttachedShaders(GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->getAttachedShaders(maxcount, count, shaders);
-}
-
-GLint Context::getAttribLocation(GLuint program, const GLchar *name)
-{
- Program *programObject = getProgram(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::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::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::getProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- QueryProgramiv(this, programObject, pname, params);
-}
-
-void Context::getProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- UNIMPLEMENTED();
-}
-
-void Context::getProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog)
-{
- Program *programObject = getProgram(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 = getShader(shader);
- ASSERT(shaderObject);
- QueryShaderiv(this, shaderObject, pname, params);
-}
-
-void Context::getShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *infolog)
-{
- Shader *shaderObject = getShader(shader);
- ASSERT(shaderObject);
- shaderObject->getInfoLog(this, 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:
- mCaps.vertexLowpFloat.get(range, precision);
- break;
- case GL_MEDIUM_FLOAT:
- mCaps.vertexMediumpFloat.get(range, precision);
- break;
- case GL_HIGH_FLOAT:
- mCaps.vertexHighpFloat.get(range, precision);
- break;
-
- case GL_LOW_INT:
- mCaps.vertexLowpInt.get(range, precision);
- break;
- case GL_MEDIUM_INT:
- mCaps.vertexMediumpInt.get(range, precision);
- break;
- case GL_HIGH_INT:
- mCaps.vertexHighpInt.get(range, precision);
- break;
-
- default:
- UNREACHABLE();
- return;
- }
- break;
-
- case GL_FRAGMENT_SHADER:
- switch (precisiontype)
- {
- case GL_LOW_FLOAT:
- mCaps.fragmentLowpFloat.get(range, precision);
- break;
- case GL_MEDIUM_FLOAT:
- mCaps.fragmentMediumpFloat.get(range, precision);
- break;
- case GL_HIGH_FLOAT:
- mCaps.fragmentHighpFloat.get(range, precision);
- break;
-
- case GL_LOW_INT:
- mCaps.fragmentLowpInt.get(range, precision);
- break;
- case GL_MEDIUM_INT:
- mCaps.fragmentMediumpInt.get(range, precision);
- break;
- case GL_HIGH_INT:
- 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 = getProgram(program);
- ASSERT(programObject);
- programObject->getUniformfv(this, location, params);
-}
-
-void Context::getUniformiv(GLuint program, GLint location, GLint *params)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->getUniformiv(this, location, params);
-}
-
-GLint Context::getUniformLocation(GLuint program, const GLchar *name)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- return programObject->getUniformLocation(name);
-}
-
-GLboolean Context::isBuffer(GLuint buffer)
-{
- if (buffer == 0)
- {
- return GL_FALSE;
- }
-
- return (getBuffer(buffer) ? GL_TRUE : GL_FALSE);
-}
-
-GLboolean Context::isEnabled(GLenum cap)
-{
- return mGLState.getEnableFeature(cap);
-}
-
-GLboolean Context::isFramebuffer(GLuint framebuffer)
-{
- if (framebuffer == 0)
- {
- return GL_FALSE;
- }
-
- return (getFramebuffer(framebuffer) ? GL_TRUE : GL_FALSE);
-}
-
-GLboolean Context::isProgram(GLuint program)
-{
- if (program == 0)
- {
- return GL_FALSE;
- }
-
- return (getProgram(program) ? GL_TRUE : GL_FALSE);
-}
-
-GLboolean Context::isRenderbuffer(GLuint renderbuffer)
-{
- if (renderbuffer == 0)
- {
- return GL_FALSE;
- }
-
- return (getRenderbuffer(renderbuffer) ? GL_TRUE : GL_FALSE);
-}
-
-GLboolean Context::isShader(GLuint shader)
-{
- if (shader == 0)
- {
- return GL_FALSE;
- }
-
- return (getShader(shader) ? GL_TRUE : GL_FALSE);
-}
-
-GLboolean Context::isTexture(GLuint texture)
-{
- if (texture == 0)
- {
- return GL_FALSE;
- }
-
- return (getTexture(texture) ? GL_TRUE : GL_FALSE);
-}
-
-void Context::linkProgram(GLuint program)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- handleError(programObject->link(this));
- mGLState.onProgramExecutableChange(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::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 = mGLState.getProgram();
- program->setUniform1fv(location, 1, &x);
-}
-
-void Context::uniform1fv(GLint location, GLsizei count, const GLfloat *v)
-{
- Program *program = mGLState.getProgram();
- program->setUniform1fv(location, count, v);
-}
-
-void Context::uniform1i(GLint location, GLint x)
-{
- Program *program = mGLState.getProgram();
- if (program->setUniform1iv(location, 1, &x) == Program::SetUniformResult::SamplerChanged)
- {
- mGLState.setObjectDirty(GL_PROGRAM);
- }
-}
-
-void Context::uniform1iv(GLint location, GLsizei count, const GLint *v)
-{
- Program *program = mGLState.getProgram();
- if (program->setUniform1iv(location, count, v) == Program::SetUniformResult::SamplerChanged)
- {
- mGLState.setObjectDirty(GL_PROGRAM);
- }
-}
-
-void Context::uniform2f(GLint location, GLfloat x, GLfloat y)
-{
- GLfloat xy[2] = {x, y};
- Program *program = mGLState.getProgram();
- program->setUniform2fv(location, 1, xy);
-}
-
-void Context::uniform2fv(GLint location, GLsizei count, const GLfloat *v)
-{
- Program *program = mGLState.getProgram();
- program->setUniform2fv(location, count, v);
-}
-
-void Context::uniform2i(GLint location, GLint x, GLint y)
-{
- GLint xy[2] = {x, y};
- Program *program = mGLState.getProgram();
- program->setUniform2iv(location, 1, xy);
-}
-
-void Context::uniform2iv(GLint location, GLsizei count, const GLint *v)
-{
- Program *program = mGLState.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 = mGLState.getProgram();
- program->setUniform3fv(location, 1, xyz);
-}
-
-void Context::uniform3fv(GLint location, GLsizei count, const GLfloat *v)
-{
- Program *program = mGLState.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 = mGLState.getProgram();
- program->setUniform3iv(location, 1, xyz);
-}
-
-void Context::uniform3iv(GLint location, GLsizei count, const GLint *v)
-{
- Program *program = mGLState.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 = mGLState.getProgram();
- program->setUniform4fv(location, 1, xyzw);
-}
-
-void Context::uniform4fv(GLint location, GLsizei count, const GLfloat *v)
-{
- Program *program = mGLState.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 = mGLState.getProgram();
- program->setUniform4iv(location, 1, xyzw);
-}
-
-void Context::uniform4iv(GLint location, GLsizei count, const GLint *v)
-{
- Program *program = mGLState.getProgram();
- program->setUniform4iv(location, count, v);
-}
-
-void Context::uniformMatrix2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix2fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix3fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix4fv(location, count, transpose, value);
-}
-
-void Context::validateProgram(GLuint program)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->validate(mCaps);
-}
-
-void Context::validateProgramPipeline(GLuint pipeline)
-{
- UNIMPLEMENTED();
-}
-
-void Context::getProgramBinary(GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- GLenum *binaryFormat,
- void *binary)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject != nullptr);
-
- handleError(programObject->saveBinary(this, binaryFormat, binary, bufSize, length));
-}
-
-void Context::programBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject != nullptr);
-
- handleError(programObject->loadBinary(this, binaryFormat, binary, length));
-}
-
-void Context::uniform1ui(GLint location, GLuint v0)
-{
- Program *program = mGLState.getProgram();
- program->setUniform1uiv(location, 1, &v0);
-}
-
-void Context::uniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- Program *program = mGLState.getProgram();
- const GLuint xy[] = {v0, v1};
- program->setUniform2uiv(location, 1, xy);
-}
-
-void Context::uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- Program *program = mGLState.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 = mGLState.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 = mGLState.getProgram();
- program->setUniform1uiv(location, count, value);
-}
-void Context::uniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniform2uiv(location, count, value);
-}
-
-void Context::uniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniform3uiv(location, count, value);
-}
-
-void Context::uniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- Program *program = mGLState.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 (getQuery(id, false, GL_NONE) != nullptr) ? GL_TRUE : GL_FALSE;
-}
-
-void Context::uniformMatrix2x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix2x3fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix3x2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix3x2fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix2x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix2x4fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix4x2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix4x2fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix3x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix3x4fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix4x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.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;
- }
-}
-
-bool Context::isVertexArray(GLuint array)
-{
- if (array == 0)
- {
- return GL_FALSE;
- }
-
- VertexArray *vao = getVertexArray(array);
- return (vao != nullptr ? GL_TRUE : GL_FALSE);
-}
-
-void Context::endTransformFeedback()
-{
- TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
- transformFeedback->end(this);
-}
-
-void Context::transformFeedbackVaryings(GLuint program,
- GLsizei count,
- const GLchar *const *varyings,
- GLenum bufferMode)
-{
- Program *programObject = getProgram(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 = getProgram(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;
- }
-}
-
-bool 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 ((transformFeedback != nullptr) ? GL_TRUE : GL_FALSE);
-}
-
-void Context::pauseTransformFeedback()
-{
- TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
- transformFeedback->pause();
-}
-
-void Context::resumeTransformFeedback()
-{
- TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
- transformFeedback->resume();
-}
-
-void Context::getUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- const Program *programObject = getProgram(program);
- programObject->getUniformuiv(this, location, params);
-}
-
-GLint Context::getFragDataLocation(GLuint program, const GLchar *name)
-{
- const Program *programObject = getProgram(program);
- return programObject->getFragDataLocation(name);
-}
-
-void Context::getUniformIndices(GLuint program,
- GLsizei uniformCount,
- const GLchar *const *uniformNames,
- GLuint *uniformIndices)
-{
- const Program *programObject = getProgram(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 = getProgram(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 = getProgram(program);
- return programObject->getUniformBlockIndex(uniformBlockName);
-}
-
-void Context::getActiveUniformBlockiv(GLuint program,
- GLuint uniformBlockIndex,
- GLenum pname,
- GLint *params)
-{
- const Program *programObject = getProgram(program);
- QueryActiveUniformBlockiv(programObject, uniformBlockIndex, pname, params);
-}
-
-void Context::getActiveUniformBlockName(GLuint program,
- GLuint uniformBlockIndex,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *uniformBlockName)
-{
- const Program *programObject = getProgram(program);
- programObject->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-void Context::uniformBlockBinding(GLuint program,
- GLuint uniformBlockIndex,
- GLuint uniformBlockBinding)
-{
- Program *programObject = getProgram(program);
- programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding);
-}
-
-GLsync Context::fenceSync(GLenum condition, GLbitfield flags)
-{
- GLuint handle = mState.mSyncs->createSync(mImplementation.get());
- GLsync syncHandle = reinterpret_cast<GLsync>(static_cast<uintptr_t>(handle));
-
- Sync *syncObject = getSync(syncHandle);
- Error error = syncObject->set(condition, flags);
- if (error.isError())
- {
- deleteSync(syncHandle);
- handleError(error);
- 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;
- handleError(syncObject->clientWait(flags, timeout, &result));
- return result;
-}
-
-void Context::waitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- Sync *syncObject = getSync(sync);
- handleError(syncObject->serverWait(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::getBufferParameteri64v(BufferBinding target, GLenum pname, GLint64 *params)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- QueryBufferParameteri64v(buffer, pname, params);
-}
-
-void Context::genSamplers(GLsizei count, GLuint *samplers)
-{
- for (int i = 0; i < count; i++)
- {
- samplers[i] = mState.mSamplers->createSampler();
- }
-}
-
-void Context::deleteSamplers(GLsizei count, const GLuint *samplers)
-{
- for (int i = 0; i < count; i++)
- {
- GLuint sampler = samplers[i];
-
- if (mState.mSamplers->getSampler(sampler))
- {
- detachSampler(sampler);
- }
-
- mState.mSamplers->deleteObject(this, sampler);
- }
-}
-
-void Context::getInternalformativ(GLenum target,
- GLenum internalformat,
- GLenum pname,
- GLsizei bufSize,
- GLint *params)
-{
- const TextureCaps &formatCaps = mTextureCaps.get(internalformat);
- QueryInternalFormativ(formatCaps, 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 = getProgram(program);
- ASSERT(programObject);
- if (programObject->setUniform1iv(location, count, value) ==
- Program::SetUniformResult::SamplerChanged)
- {
- mGLState.setObjectDirty(GL_PROGRAM);
- }
-}
-
-void Context::programUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform2iv(location, count, value);
-}
-
-void Context::programUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform3iv(location, count, value);
-}
-
-void Context::programUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform4iv(location, count, value);
-}
-
-void Context::programUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform1uiv(location, count, value);
-}
-
-void Context::programUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform2uiv(location, count, value);
-}
-
-void Context::programUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform3uiv(location, count, value);
-}
-
-void Context::programUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform4uiv(location, count, value);
-}
-
-void Context::programUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform1fv(location, count, value);
-}
-
-void Context::programUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform2fv(location, count, value);
-}
-
-void Context::programUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform3fv(location, count, value);
-}
-
-void Context::programUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform4fv(location, count, value);
-}
-
-void Context::programUniformMatrix2fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *programObject = getProgram(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 = getProgram(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 = getProgram(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 = getProgram(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 = getProgram(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 = getProgram(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 = getProgram(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 = getProgram(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 = getProgram(program);
- ASSERT(programObject);
- programObject->setUniformMatrix4x3fv(location, count, transpose, value);
-}
-
-void Context::onTextureChange(const Texture *texture)
-{
- // Conservatively assume all textures are dirty.
- // TODO(jmadill): More fine-grained update.
- mGLState.setObjectDirty(GL_TEXTURE);
-}
-
-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 (getProgramPipeline(pipeline) ? GL_TRUE : GL_FALSE);
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Context.h b/src/3rdparty/angle/src/libANGLE/Context.h
deleted file mode 100644
index 38c4e7b4d1..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Context.h
+++ /dev/null
@@ -1,1154 +0,0 @@
-//
-// 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/angleutils.h"
-#include "libANGLE/Caps.h"
-#include "libANGLE/Constants.h"
-#include "libANGLE/ContextState.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/HandleAllocator.h"
-#include "libANGLE/PackedGLEnums.h"
-#include "libANGLE/RefCountObject.h"
-#include "libANGLE/ResourceMap.h"
-#include "libANGLE/VertexAttribute.h"
-#include "libANGLE/Workarounds.h"
-#include "libANGLE/angletypes.h"
-
-namespace rx
-{
-class ContextImpl;
-class EGLImplFactory;
-}
-
-namespace egl
-{
-class AttributeMap;
-class Surface;
-struct Config;
-class Thread;
-}
-
-namespace gl
-{
-class Buffer;
-class Compiler;
-class FenceNV;
-class Sync;
-class Framebuffer;
-class MemoryProgramCache;
-class Program;
-class Query;
-class Renderbuffer;
-class Sampler;
-class Shader;
-class Texture;
-class TransformFeedback;
-class VertexArray;
-struct VertexAttribute;
-class ProgramPipeline;
-
-class Context final : public ValidationContext
-{
- public:
- Context(rx::EGLImplFactory *implFactory,
- const egl::Config *config,
- const Context *shareContext,
- TextureManager *shareTextures,
- MemoryProgramCache *memoryProgramCache,
- const egl::AttributeMap &attribs,
- const egl::DisplayExtensions &displayExtensions);
-
- egl::Error onDestroy(const egl::Display *display);
- ~Context() override;
-
- egl::Error makeCurrent(egl::Display *display, egl::Surface *surface);
- egl::Error releaseSurface(const egl::Display *display);
-
- // These create and destroy methods are merely pass-throughs to
- // ResourceManager, which owns these object types
- GLuint createBuffer();
- GLuint createShader(GLenum type);
- GLuint createProgram();
- GLuint createTexture();
- GLuint createRenderbuffer();
- GLuint createPaths(GLsizei range);
- GLuint createProgramPipeline();
- GLuint createShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings);
-
- void deleteBuffer(GLuint buffer);
- void deleteShader(GLuint shader);
- void deleteProgram(GLuint program);
- void deleteTexture(GLuint texture);
- void deleteRenderbuffer(GLuint renderbuffer);
- void deletePaths(GLuint first, GLsizei range);
- void deleteProgramPipeline(GLuint pipeline);
-
- // CHROMIUM_path_rendering
- bool hasPathData(GLuint path) const;
- bool hasPath(GLuint path) const;
- void setPathCommands(GLuint path,
- GLsizei numCommands,
- const GLubyte *commands,
- GLsizei numCoords,
- GLenum coordType,
- const void *coords);
- void setPathParameterf(GLuint path, GLenum pname, GLfloat value);
- void getPathParameterfv(GLuint path, GLenum pname, GLfloat *value) const;
- void setPathStencilFunc(GLenum func, GLint ref, GLuint mask);
-
- // Framebuffers are owned by the Context, so these methods do not pass through
- GLuint createFramebuffer();
- void deleteFramebuffer(GLuint framebuffer);
-
- // NV Fences are owned by the Context.
- GLuint createFenceNV();
- void deleteFenceNV(GLuint fence);
-
- void bindTexture(GLenum target, GLuint handle);
- void bindReadFramebuffer(GLuint framebufferHandle);
- void bindDrawFramebuffer(GLuint framebufferHandle);
- void bindVertexArray(GLuint vertexArrayHandle);
- void bindVertexBuffer(GLuint bindingIndex,
- GLuint bufferHandle,
- GLintptr offset,
- GLsizei stride);
- void bindSampler(GLuint textureUnit, GLuint samplerHandle);
- void bindImageTexture(GLuint unit,
- GLuint texture,
- GLint level,
- GLboolean layered,
- GLint layer,
- GLenum access,
- GLenum format);
- void useProgram(GLuint program);
- void useProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
- void bindTransformFeedback(GLenum target, GLuint transformFeedbackHandle);
- void bindProgramPipeline(GLuint pipelineHandle);
-
- void beginQuery(GLenum target, GLuint query);
- void endQuery(GLenum target);
- void queryCounter(GLuint id, GLenum target);
- void getQueryiv(GLenum target, GLenum pname, GLint *params);
- void getQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void getQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void getQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void getQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
-
- void vertexAttribDivisor(GLuint index, GLuint divisor);
- void vertexBindingDivisor(GLuint bindingIndex, GLuint divisor);
-
- void getBufferParameteriv(BufferBinding target, GLenum pname, GLint *params);
- void getFramebufferAttachmentParameteriv(GLenum target,
- GLenum attachment,
- GLenum pname,
- GLint *params);
- void getRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
-
- void getTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void getTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void getTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void getTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void texParameterf(GLenum target, GLenum pname, GLfloat param);
- void texParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void texParameteri(GLenum target, GLenum pname, GLint param);
- void texParameteriv(GLenum target, GLenum pname, const GLint *params);
-
- void samplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void samplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void samplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
-
- void getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
-
- void programParameteri(GLuint program, GLenum pname, GLint value);
-
- GLuint getProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name);
- void getProgramResourceName(GLuint program,
- GLenum programInterface,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *name);
- GLint getProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);
- void getProgramResourceiv(GLuint program,
- GLenum programInterface,
- GLuint index,
- GLsizei propCount,
- const GLenum *props,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params);
-
- void getProgramInterfaceiv(GLuint program,
- GLenum programInterface,
- GLenum pname,
- GLint *params);
-
- Buffer *getBuffer(GLuint handle) const;
- FenceNV *getFenceNV(GLuint handle);
- Sync *getSync(GLsync handle) const;
- Texture *getTexture(GLuint handle) const;
- 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, GLenum type);
- Query *getQuery(GLuint handle) const;
- TransformFeedback *getTransformFeedback(GLuint handle) const;
- ProgramPipeline *getProgramPipeline(GLuint handle) const;
-
- void objectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
- void objectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);
- void getObjectLabel(GLenum identifier,
- GLuint name,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *label) const;
- void getObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label) const;
-
- Texture *getTargetTexture(GLenum target) const;
- Texture *getSamplerTexture(unsigned int sampler, GLenum type) const;
-
- Compiler *getCompiler() const;
-
- bool isSampler(GLuint samplerName) const;
-
- bool isVertexArrayGenerated(GLuint vertexArray);
- bool isTransformFeedbackGenerated(GLuint vertexArray);
-
- void getBooleanv(GLenum pname, GLboolean *params);
- void getBooleanvImpl(GLenum pname, GLboolean *params);
- void getFloatv(GLenum pname, GLfloat *params);
- void getFloatvImpl(GLenum pname, GLfloat *params);
- void getIntegerv(GLenum pname, GLint *params);
- void getIntegervImpl(GLenum pname, GLint *params);
- void getInteger64vImpl(GLenum pname, GLint64 *params);
- void getPointerv(GLenum pname, void **params) const;
- void getBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void getIntegeri_v(GLenum target, GLuint index, GLint *data);
- void getInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- void activeShaderProgram(GLuint pipeline, GLuint program);
- void activeTexture(GLenum 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 srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void clearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void clearDepthf(GLfloat depth);
- void clearStencil(GLint s);
- void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void cullFace(CullFaceMode mode);
- void depthFunc(GLenum func);
- void depthMask(GLboolean flag);
- void depthRangef(GLfloat zNear, GLfloat zFar);
- void disable(GLenum cap);
- void disableVertexAttribArray(GLuint index);
- void enable(GLenum cap);
- void enableVertexAttribArray(GLuint index);
- void frontFace(GLenum mode);
- void hint(GLenum target, GLenum mode);
- void lineWidth(GLfloat width);
- void pixelStorei(GLenum pname, GLint param);
- void polygonOffset(GLfloat factor, GLfloat units);
- void sampleCoverage(GLfloat value, GLboolean invert);
- void sampleMaski(GLuint maskNumber, GLbitfield mask);
- void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void stencilMaskSeparate(GLenum face, GLuint mask);
- void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
- void vertexAttrib1f(GLuint index, GLfloat x);
- void vertexAttrib1fv(GLuint index, const GLfloat *values);
- void vertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void vertexAttrib2fv(GLuint index, const GLfloat *values);
- void vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void vertexAttrib3fv(GLuint index, const GLfloat *values);
- void vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void vertexAttrib4fv(GLuint index, const GLfloat *values);
- void vertexAttribFormat(GLuint attribIndex,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLuint relativeOffset);
- void vertexAttribIFormat(GLuint attribIndex, GLint size, GLenum type, GLuint relativeOffset);
- void vertexAttribBinding(GLuint attribIndex, GLuint bindingIndex);
- void vertexAttribPointer(GLuint index,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLsizei stride,
- const void *ptr);
- void vertexAttribIPointer(GLuint index,
- GLint size,
- GLenum type,
- GLsizei stride,
- const void *pointer);
- void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
-
- void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void vertexAttribI4iv(GLuint index, const GLint *v);
- void vertexAttribI4uiv(GLuint index, const GLuint *v);
- void getVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void getVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void getVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void getVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void getVertexAttribPointerv(GLuint index, GLenum pname, void **pointer);
-
- 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);
- void debugMessageCallback(GLDEBUGPROCKHR callback, const void *userParam);
- GLuint getDebugMessageLog(GLuint count,
- GLsizei bufSize,
- GLenum *sources,
- GLenum *types,
- GLuint *ids,
- GLenum *severities,
- GLsizei *lengths,
- GLchar *messageLog);
- void pushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message);
- void popDebugGroup();
-
- void clear(GLbitfield mask);
- void clearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *values);
- void clearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *values);
- void clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values);
- void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-
- void drawArrays(GLenum mode, GLint first, GLsizei count);
- void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
-
- void drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
- void drawElementsInstanced(GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances);
- void drawRangeElements(GLenum mode,
- GLuint start,
- GLuint end,
- GLsizei count,
- GLenum type,
- const void *indices);
- void drawArraysIndirect(GLenum mode, const void *indirect);
- void drawElementsIndirect(GLenum mode, GLenum type, const void *indirect);
-
- void blitFramebuffer(GLint srcX0,
- GLint srcY0,
- GLint srcX1,
- GLint srcY1,
- GLint dstX0,
- GLint dstY0,
- GLint dstX1,
- GLint dstY1,
- GLbitfield mask,
- GLenum filter);
-
- void readPixels(GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- void *pixels);
-
- void copyTexImage2D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border);
-
- void copyTexSubImage2D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height);
-
- void copyTexSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height);
-
- void framebufferTexture2D(GLenum target,
- GLenum attachment,
- GLenum textarget,
- GLuint texture,
- GLint level);
-
- void framebufferRenderbuffer(GLenum target,
- GLenum attachment,
- GLenum renderbuffertarget,
- GLuint renderbuffer);
-
- void framebufferTextureLayer(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLint layer);
- void framebufferTextureMultiviewLayeredANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLint baseViewIndex,
- GLsizei numViews);
- void framebufferTextureMultiviewSideBySideANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLsizei numViews,
- const GLint *viewportOffsets);
-
- void drawBuffers(GLsizei n, const GLenum *bufs);
- void readBuffer(GLenum mode);
-
- void discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);
- 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);
-
- void texImage2D(GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels);
- void texImage3D(GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels);
- void texSubImage2D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- const void *pixels);
- void texSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLenum type,
- const void *pixels);
- void compressedTexImage2D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLsizei imageSize,
- const void *data);
- void compressedTexImage3D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLsizei imageSize,
- const void *data);
- void compressedTexSubImage2D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLsizei imageSize,
- const void *data);
- void compressedTexSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLsizei imageSize,
- const void *data);
- void copyTextureCHROMIUM(GLuint sourceId,
- GLint sourceLevel,
- GLenum destTarget,
- GLuint destId,
- GLint destLevel,
- GLint internalFormat,
- GLenum destType,
- GLboolean unpackFlipY,
- GLboolean unpackPremultiplyAlpha,
- GLboolean unpackUnmultiplyAlpha);
- void copySubTextureCHROMIUM(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);
- void compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId);
-
- void generateMipmap(GLenum target);
-
- void flush();
- void finish();
-
- void getBufferPointerv(BufferBinding target, GLenum pname, void **params);
- void *mapBuffer(BufferBinding target, GLenum access);
- GLboolean unmapBuffer(BufferBinding target);
- void *mapBufferRange(BufferBinding target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access);
- void flushMappedBufferRange(BufferBinding target, GLintptr offset, GLsizeiptr length);
-
- void beginTransformFeedback(GLenum primitiveMode);
-
- bool hasActiveTransformFeedback(GLuint program) const;
-
- void insertEventMarker(GLsizei length, const char *marker);
- void pushGroupMarker(GLsizei length, const char *marker);
- void popGroupMarker();
-
- void bindUniformLocation(GLuint program, GLint location, const GLchar *name);
- void renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void renderbufferStorageMultisample(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height);
-
- void getSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-
- // CHROMIUM_framebuffer_mixed_samples
- void setCoverageModulation(GLenum components);
-
- // CHROMIUM_path_rendering
- void loadPathRenderingMatrix(GLenum matrixMode, const GLfloat *matrix);
- void loadPathRenderingIdentityMatrix(GLenum matrixMode);
- 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 numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues);
- void coverStrokePathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- 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 stencilStrokePathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLint reference,
- 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 program, GLint location, const GLchar *name);
- void programPathFragmentInputGen(GLuint program,
- GLint location,
- GLenum genMode,
- GLint components,
- const GLfloat *coeffs);
-
- void bufferData(BufferBinding target, GLsizeiptr size, const void *data, BufferUsage usage);
- void bufferSubData(BufferBinding target, GLintptr offset, GLsizeiptr size, const void *data);
- void attachShader(GLuint program, GLuint shader);
- void bindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void bindBuffer(BufferBinding target, GLuint buffer);
- void bindBufferBase(BufferBinding target, GLuint index, GLuint buffer);
- void bindBufferRange(BufferBinding target,
- GLuint index,
- GLuint buffer,
- GLintptr offset,
- GLsizeiptr size);
- void bindFramebuffer(GLenum target, GLuint framebuffer);
- void bindRenderbuffer(GLenum target, GLuint renderbuffer);
-
- void texStorage2DMultisample(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLboolean fixedsamplelocations);
-
- void getMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
-
- void copyBufferSubData(BufferBinding readTarget,
- BufferBinding writeTarget,
- GLintptr readOffset,
- GLintptr writeOffset,
- GLsizeiptr size);
-
- GLenum checkFramebufferStatus(GLenum target);
- void compileShader(GLuint shader);
- void deleteBuffers(GLsizei n, const GLuint *buffers);
- void deleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void deleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void deleteTextures(GLsizei n, const GLuint *textures);
- void detachShader(GLuint program, GLuint shader);
- 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 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 getProgramiv(GLuint program, GLenum pname, GLint *params);
- void getProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
- void getProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog);
- void getProgramPipelineInfoLog(GLuint pipeline,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *infoLog);
- void getShaderiv(GLuint shader, 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 getUniformfv(GLuint program, GLint location, GLfloat *params);
- void getUniformiv(GLuint program, GLint location, GLint *params);
- GLint getUniformLocation(GLuint program, const GLchar *name);
- 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 linkProgram(GLuint program);
- void releaseShaderCompiler();
- void shaderBinary(GLsizei n,
- 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 stencilMask(GLuint mask);
- void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void uniform1f(GLint location, GLfloat x);
- void uniform1fv(GLint location, GLsizei count, const GLfloat *v);
- void uniform1i(GLint location, GLint x);
- void uniform1iv(GLint location, GLsizei count, const GLint *v);
- void uniform2f(GLint location, GLfloat x, GLfloat y);
- void uniform2fv(GLint location, GLsizei count, const GLfloat *v);
- void uniform2i(GLint location, GLint x, GLint y);
- void uniform2iv(GLint location, GLsizei count, const GLint *v);
- void uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
- void uniform3fv(GLint location, GLsizei count, const GLfloat *v);
- void uniform3i(GLint location, GLint x, GLint y, GLint z);
- void uniform3iv(GLint location, GLsizei count, const GLint *v);
- void uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void uniform4fv(GLint location, GLsizei count, const GLfloat *v);
- void uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
- void uniform4iv(GLint location, GLsizei count, const GLint *v);
- 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 validateProgram(GLuint program);
- void validateProgramPipeline(GLuint pipeline);
-
- void genQueries(GLsizei n, GLuint *ids);
- void deleteQueries(GLsizei n, const GLuint *ids);
- GLboolean isQuery(GLuint id);
-
- void uniform1ui(GLint location, GLuint v0);
- void uniform2ui(GLint location, GLuint v0, GLuint v1);
- void uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void uniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void uniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void uniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void uniform4uiv(GLint location, GLsizei count, const GLuint *value);
-
- void uniformMatrix2x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
- void uniformMatrix3x2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
- void uniformMatrix2x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
- void uniformMatrix4x2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
- void uniformMatrix3x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
- void uniformMatrix4x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
- void deleteVertexArrays(GLsizei n, const GLuint *arrays);
- void genVertexArrays(GLsizei n, GLuint *arrays);
- bool isVertexArray(GLuint array);
-
- void endTransformFeedback();
- void transformFeedbackVaryings(GLuint program,
- GLsizei count,
- const GLchar *const *varyings,
- GLenum bufferMode);
- void getTransformFeedbackVarying(GLuint program,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLsizei *size,
- GLenum *type,
- GLchar *name);
-
- void deleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void genTransformFeedbacks(GLsizei n, GLuint *ids);
- bool isTransformFeedback(GLuint id);
- void pauseTransformFeedback();
- void resumeTransformFeedback();
-
- void getProgramBinary(GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- GLenum *binaryFormat,
- void *binary);
- void programBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
-
- void getUniformuiv(GLuint program, GLint location, GLuint *params);
- GLint getFragDataLocation(GLuint program, const GLchar *name);
- void getUniformIndices(GLuint program,
- GLsizei uniformCount,
- const GLchar *const *uniformNames,
- GLuint *uniformIndices);
- void getActiveUniformsiv(GLuint program,
- GLsizei uniformCount,
- const GLuint *uniformIndices,
- GLenum pname,
- GLint *params);
- GLuint getUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void getActiveUniformBlockiv(GLuint program,
- GLuint uniformBlockIndex,
- GLenum pname,
- GLint *params);
- void getActiveUniformBlockName(GLuint program,
- GLuint uniformBlockIndex,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *uniformBlockName);
- void uniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
-
- GLsync fenceSync(GLenum condition, GLbitfield flags);
- GLboolean isSync(GLsync sync);
- void deleteSync(GLsync sync);
- GLenum clientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void waitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void getInteger64v(GLenum pname, GLint64 *params);
-
- void getBufferParameteri64v(BufferBinding target, GLenum pname, GLint64 *params);
- void genSamplers(GLsizei count, GLuint *samplers);
- void deleteSamplers(GLsizei count, const GLuint *samplers);
- void getInternalformativ(GLenum target,
- GLenum internalformat,
- GLenum pname,
- GLsizei bufSize,
- GLint *params);
-
- void programUniform1i(GLuint program, GLint location, GLint v0);
- void programUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
- void programUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
- void programUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void programUniform1ui(GLuint program, GLint location, GLuint v0);
- void programUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
- void programUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
- void programUniform4ui(GLuint program,
- GLint location,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3);
- void programUniform1f(GLuint program, GLint location, GLfloat v0);
- void programUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
- void programUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void programUniform4f(GLuint program,
- GLint location,
- GLfloat v0,
- GLfloat v1,
- GLfloat v2,
- GLfloat v3);
- void programUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void programUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void programUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void programUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void programUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void programUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void programUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void programUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void programUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void programUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void programUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void programUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
-
- void programUniformMatrix2fv(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 programUniformMatrix4fv(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 programUniformMatrix3x2fv(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 programUniformMatrix4x2fv(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 programUniformMatrix4x3fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
- void deleteProgramPipelines(GLsizei n, const GLuint *pipelines);
- void genProgramPipelines(GLsizei n, GLuint *pipelines);
- GLboolean isProgramPipeline(GLuint pipeline);
-
- // Consumes the error.
- void handleError(const Error &error) override;
-
- GLenum getError();
- void markContextLost();
- bool isContextLost();
- GLenum getResetStatus();
- 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);
- void requestExtension(const char *name);
- size_t getRequestableExtensionStringCount() const;
-
- rx::ContextImpl *getImplementation() const { return mImplementation.get(); }
- const Workarounds &getWorkarounds() const;
-
- void getFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void framebufferParameteri(GLenum target, GLenum pname, GLint param);
-
- Error getScratchBuffer(size_t requestedSizeBytes, angle::MemoryBuffer **scratchBufferOut) const;
- Error getZeroFilledBuffer(size_t requstedSizeBytes, angle::MemoryBuffer **zeroBufferOut) const;
-
- void dispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ);
- void dispatchComputeIndirect(GLintptr indirect);
-
- MemoryProgramCache *getMemoryProgramCache() const { return mMemoryProgramCache; }
-
- template <EntryPoint EP, typename... ParamsT>
- void gatherParams(ParamsT &&... params);
-
- void texStorage2D(GLenum target,
- GLsizei levels,
- GLenum internalFormat,
- GLsizei width,
- GLsizei height);
- void texStorage3D(GLenum target,
- GLsizei levels,
- GLenum internalFormat,
- GLsizei width,
- GLsizei height,
- GLsizei depth);
-
- void memoryBarrier(GLbitfield barriers);
- void memoryBarrierByRegion(GLbitfield barriers);
-
- // Notification for a state change in a Texture.
- void onTextureChange(const Texture *texture);
-
- egl::Display *getCurrentDisplay() const { return mCurrentDisplay; }
- egl::Surface *getCurrentDrawSurface() const { return mCurrentSurface; }
- egl::Surface *getCurrentReadSurface() const { return mCurrentSurface; }
-
- bool isRobustResourceInitEnabled() const { return mGLState.isRobustResourceInitEnabled(); }
-
- private:
- Error prepareForDraw();
- void syncRendererState();
- void syncRendererState(const State::DirtyBits &bitMask, const State::DirtyObjects &objectMask);
- void syncStateForReadPixels();
- void syncStateForTexImage();
- void syncStateForClear();
- void syncStateForBlit();
- VertexArray *checkVertexArrayAllocation(GLuint vertexArrayHandle);
- TransformFeedback *checkTransformFeedbackAllocation(GLuint transformFeedback);
-
- void detachBuffer(GLuint buffer);
- void detachTexture(GLuint texture);
- void detachFramebuffer(GLuint framebuffer);
- void detachRenderbuffer(GLuint renderbuffer);
- void detachVertexArray(GLuint vertexArray);
- void detachTransformFeedback(GLuint transformFeedback);
- void detachSampler(GLuint sampler);
- void detachProgramPipeline(GLuint pipeline);
-
- void initRendererString();
- void initVersionStrings();
- void initExtensionStrings();
-
- void initCaps(const egl::DisplayExtensions &displayExtensions, bool robustResourceInit);
- void updateCaps();
- void initWorkarounds();
-
- LabeledObject *getLabeledObject(GLenum identifier, GLuint name) const;
- LabeledObject *getLabeledObjectFromPtr(const void *ptr) const;
-
- std::unique_ptr<rx::ContextImpl> mImplementation;
-
- // Caps to use for validation
- Caps mCaps;
- TextureCapsMap mTextureCaps;
- Extensions mExtensions;
- Limitations mLimitations;
-
- // Shader compiler. Lazily initialized hence the mutable value.
- mutable BindingPointer<Compiler> mCompiler;
-
- State mGLState;
-
- const egl::Config *mConfig;
- EGLenum mClientType;
-
- 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;
-
- // Recorded errors
- typedef std::set<GLenum> ErrorSet;
- ErrorSet mErrors;
-
- // Current/lost context flags
- bool mHasBeenCurrent;
- bool mContextLost;
- GLenum mResetStatus;
- bool mContextLostForced;
- GLenum mResetStrategy;
- bool mRobustAccess;
- egl::Surface *mCurrentSurface;
- egl::Display *mCurrentDisplay;
- Framebuffer *mSurfacelessFramebuffer;
- bool mWebGLContext;
- MemoryProgramCache *mMemoryProgramCache;
-
- State::DirtyBits mTexImageDirtyBits;
- State::DirtyObjects mTexImageDirtyObjects;
- State::DirtyBits mReadPixelsDirtyBits;
- State::DirtyObjects mReadPixelsDirtyObjects;
- State::DirtyBits mClearDirtyBits;
- State::DirtyObjects mClearDirtyObjects;
- State::DirtyBits mBlitDirtyBits;
- State::DirtyObjects mBlitDirtyObjects;
-
- Workarounds mWorkarounds;
-
- // Not really a property of context state. The size and contexts change per-api-call.
- mutable angle::ScratchBuffer mScratchBuffer;
- mutable angle::ScratchBuffer mZeroFilledBuffer;
-};
-
-template <EntryPoint EP, typename... ArgsT>
-ANGLE_INLINE void Context::gatherParams(ArgsT &&... args)
-{
- static_assert(sizeof(EntryPointParamType<EP>) <= kParamsBufferSize,
- "Params struct too large, please increase kParamsBufferSize.");
-
- mSavedArgsType = &EntryPointParamType<EP>::TypeInfo;
-
- // Skip doing any work for ParamsBase/Invalid type.
- if (!EntryPointParamType<EP>::TypeInfo.isValid())
- {
- return;
- }
-
- EntryPointParamType<EP> *objBuffer =
- reinterpret_cast<EntryPointParamType<EP> *>(mParamsBuffer.data());
- EntryPointParamType<EP>::template Factory<EP>(objBuffer, this, std::forward<ArgsT>(args)...);
-}
-
-} // namespace gl
-
-#endif // LIBANGLE_CONTEXT_H_
diff --git a/src/3rdparty/angle/src/libANGLE/ContextState.cpp b/src/3rdparty/angle/src/libANGLE/ContextState.cpp
deleted file mode 100644
index d109cca76d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ContextState.cpp
+++ /dev/null
@@ -1,839 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Data.cpp: Container class for all GL relevant state, caps and objects
-
-#include "libANGLE/ContextState.h"
-
-#include "libANGLE/Framebuffer.h"
-#include "libANGLE/ResourceManager.h"
-
-namespace gl
-{
-
-namespace
-{
-
-template <typename T>
-using ContextStateMember = T *(ContextState::*);
-
-template <typename T>
-T *AllocateOrGetSharedResourceManager(const ContextState *shareContextState,
- ContextStateMember<T> member)
-{
- if (shareContextState)
- {
- T *resourceManager = (*shareContextState).*member;
- resourceManager->addRef();
- return resourceManager;
- }
- else
- {
- return new T();
- }
-}
-
-TextureManager *AllocateOrGetSharedTextureManager(const ContextState *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();
- }
-}
-
-} // anonymous namespace
-
-ContextState::ContextState(ContextID contextIn,
- const ContextState *shareContextState,
- TextureManager *shareTextures,
- const Version &clientVersion,
- State *stateIn,
- const Caps &capsIn,
- const TextureCapsMap &textureCapsIn,
- const Extensions &extensionsIn,
- const Limitations &limitationsIn)
- : mClientVersion(clientVersion),
- mContext(contextIn),
- mState(stateIn),
- mCaps(capsIn),
- mTextureCaps(textureCapsIn),
- mExtensions(extensionsIn),
- mLimitations(limitationsIn),
- mBuffers(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mBuffers)),
- mShaderPrograms(
- AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mShaderPrograms)),
- mTextures(AllocateOrGetSharedTextureManager(shareContextState,
- shareTextures,
- &ContextState::mTextures)),
- mRenderbuffers(
- AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mRenderbuffers)),
- mSamplers(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mSamplers)),
- mSyncs(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mSyncs)),
- mPaths(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mPaths)),
- mFramebuffers(new FramebufferManager()),
- mPipelines(new ProgramPipelineManager())
-{
-}
-
-ContextState::~ContextState()
-{
- // Handles are released by the Context.
-}
-
-bool ContextState::isWebGL() const
-{
- return mExtensions.webglCompatibility;
-}
-
-bool ContextState::isWebGL1() const
-{
- return (isWebGL() && mClientVersion.major == 2);
-}
-
-const TextureCaps &ContextState::getTextureCap(GLenum internalFormat) const
-{
- return mTextureCaps.get(internalFormat);
-}
-
-ValidationContext::ValidationContext(const ValidationContext *shareContext,
- TextureManager *shareTextures,
- const Version &clientVersion,
- State *state,
- const Caps &caps,
- const TextureCapsMap &textureCaps,
- const Extensions &extensions,
- const Limitations &limitations,
- bool skipValidation)
- : mState(reinterpret_cast<ContextID>(this),
- shareContext ? &shareContext->mState : nullptr,
- shareTextures,
- clientVersion,
- state,
- caps,
- textureCaps,
- extensions,
- limitations),
- mSkipValidation(skipValidation),
- mDisplayTextureShareGroup(shareTextures != nullptr)
-{
-}
-
-ValidationContext::~ValidationContext()
-{
-}
-
-bool ValidationContext::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams)
-{
- // Please note: the query type returned for DEPTH_CLEAR_VALUE in this implementation
- // is FLOAT rather than INT, as would be suggested by the GL ES 2.0 spec. This is due
- // to the fact that it is stored internally as a float, and so would require conversion
- // if returned from Context::getIntegerv. Since this conversion is already implemented
- // in the case that one calls glGetIntegerv to retrieve a float-typed state variable, we
- // place DEPTH_CLEAR_VALUE with the floats. This should make no difference to the calling
- // application.
- switch (pname)
- {
- case GL_COMPRESSED_TEXTURE_FORMATS:
- {
- *type = GL_INT;
- *numParams = 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:
- 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;
- }
-
- // Check for ES3.0+ parameter names which are also exposed as ES2 extensions
- switch (pname)
- {
- // case 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;
- }
- }
-
- 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().multiview && pname == GL_MAX_VIEWS_ANGLE)
- {
- *type = GL_INT;
- *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_3D_TEXTURE_SIZE:
- case GL_MAX_ARRAY_TEXTURE_LAYERS:
- case GL_MAX_VERTEX_UNIFORM_BLOCKS:
- case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
- case GL_MAX_COMBINED_UNIFORM_BLOCKS:
- case GL_MAX_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 (getClientVersion() < Version(3, 1))
- {
- return false;
- }
-
- switch (pname)
- {
- case GL_ATOMIC_COUNTER_BUFFER_BINDING:
- case GL_DRAW_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:
- *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;
- }
-
- return false;
-}
-
-bool ValidationContext::getIndexedQueryParameterInfo(GLenum target,
- GLenum *type,
- unsigned int *numParams)
-{
- 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_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:
- {
- *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 *ValidationContext::getProgram(GLuint handle) const
-{
- return mState.mShaderPrograms->getProgram(handle);
-}
-
-Shader *ValidationContext::getShader(GLuint handle) const
-{
- return mState.mShaderPrograms->getShader(handle);
-}
-
-bool ValidationContext::isTextureGenerated(GLuint texture) const
-{
- return mState.mTextures->isHandleGenerated(texture);
-}
-
-bool ValidationContext::isBufferGenerated(GLuint buffer) const
-{
- return mState.mBuffers->isHandleGenerated(buffer);
-}
-
-bool ValidationContext::isRenderbufferGenerated(GLuint renderbuffer) const
-{
- return mState.mRenderbuffers->isHandleGenerated(renderbuffer);
-}
-
-bool ValidationContext::isFramebufferGenerated(GLuint framebuffer) const
-{
- return mState.mFramebuffers->isHandleGenerated(framebuffer);
-}
-
-bool ValidationContext::isProgramPipelineGenerated(GLuint pipeline) const
-{
- return mState.mPipelines->isHandleGenerated(pipeline);
-}
-
-bool ValidationContext::usingDisplayTextureShareGroup() const
-{
- return mDisplayTextureShareGroup;
-}
-
-GLenum ValidationContext::getConvertedRenderbufferFormat(GLenum internalformat) const
-{
- return mState.mExtensions.webglCompatibility && mState.mClientVersion.major == 2 &&
- internalformat == GL_DEPTH_STENCIL
- ? GL_DEPTH24_STENCIL8
- : internalformat;
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/ContextState.h b/src/3rdparty/angle/src/libANGLE/ContextState.h
deleted file mode 100644
index e6e9f4c6b0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ContextState.h
+++ /dev/null
@@ -1,164 +0,0 @@
-//
-// 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.
-//
-
-// ContextState: Container class for all GL context state, caps and objects.
-
-#ifndef LIBANGLE_CONTEXTSTATE_H_
-#define LIBANGLE_CONTEXTSTATE_H_
-
-#include "common/MemoryBuffer.h"
-#include "common/angleutils.h"
-#include "libANGLE/State.h"
-#include "libANGLE/Version.h"
-#include "libANGLE/params.h"
-
-namespace gl
-{
-class BufferManager;
-class ContextState;
-class FramebufferManager;
-class PathManager;
-class ProgramPipelineManager;
-class RenderbufferManager;
-class SamplerManager;
-class ShaderProgramManager;
-class SyncManager;
-class TextureManager;
-class ValidationContext;
-
-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 ContextState final : angle::NonCopyable
-{
- public:
- ContextState(ContextID context,
- const ContextState *shareContextState,
- TextureManager *shareTextures,
- const Version &clientVersion,
- State *state,
- const Caps &caps,
- const TextureCapsMap &textureCaps,
- const Extensions &extensions,
- const Limitations &limitations);
- ~ContextState();
-
- ContextID getContextID() const { return mContext; }
- GLint getClientMajorVersion() const { return mClientVersion.major; }
- GLint getClientMinorVersion() const { return mClientVersion.minor; }
- const Version &getClientVersion() const { return mClientVersion; }
- const State &getState() const { return *mState; }
- const Caps &getCaps() const { return mCaps; }
- const TextureCapsMap &getTextureCaps() const { return mTextureCaps; }
- const Extensions &getExtensions() const { return mExtensions; }
- const Limitations &getLimitations() const { return mLimitations; }
-
- const TextureCaps &getTextureCap(GLenum internalFormat) const;
-
- bool usingDisplayTextureShareGroup() const;
-
- bool isWebGL() const;
- bool isWebGL1() const;
-
- private:
- friend class Context;
- friend class ValidationContext;
-
- Version mClientVersion;
- ContextID mContext;
- State *mState;
- const Caps &mCaps;
- const TextureCapsMap &mTextureCaps;
- const Extensions &mExtensions;
- const Limitations &mLimitations;
-
- BufferManager *mBuffers;
- ShaderProgramManager *mShaderPrograms;
- TextureManager *mTextures;
- RenderbufferManager *mRenderbuffers;
- SamplerManager *mSamplers;
- SyncManager *mSyncs;
- PathManager *mPaths;
- FramebufferManager *mFramebuffers;
- ProgramPipelineManager *mPipelines;
-};
-
-class ValidationContext : angle::NonCopyable
-{
- public:
- ValidationContext(const ValidationContext *shareContext,
- TextureManager *shareTextures,
- const Version &clientVersion,
- State *state,
- const Caps &caps,
- const TextureCapsMap &textureCaps,
- const Extensions &extensions,
- const Limitations &limitations,
- bool skipValidation);
- virtual ~ValidationContext();
-
- virtual void handleError(const Error &error) = 0;
-
- const ContextState &getContextState() const { return mState; }
- GLint getClientMajorVersion() const { return mState.getClientMajorVersion(); }
- GLint getClientMinorVersion() const { return mState.getClientMinorVersion(); }
- const Version &getClientVersion() const { return mState.getClientVersion(); }
- const State &getGLState() const { return mState.getState(); }
- 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; }
-
- // Specific methods needed for validation.
- bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams);
- bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams);
-
- Program *getProgram(GLuint handle) const;
- Shader *getShader(GLuint handle) const;
-
- bool isTextureGenerated(GLuint texture) const;
- bool isBufferGenerated(GLuint buffer) const;
- 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(); }
-
- template <typename T>
- const T &getParams() const;
-
- protected:
- ContextState mState;
- bool mSkipValidation;
- bool mDisplayTextureShareGroup;
-
- // Caches entry point parameters and values re-used between layers.
- mutable const ParamTypeInfo *mSavedArgsType;
- static constexpr size_t kParamsBufferSize = 64u;
- mutable std::array<uint8_t, kParamsBufferSize> mParamsBuffer;
-};
-
-template <typename T>
-const T &ValidationContext::getParams() const
-{
- const T *params = reinterpret_cast<T *>(mParamsBuffer.data());
- ASSERT(mSavedArgsType->hasDynamicType(T::TypeInfo));
- return *params;
-}
-
-} // namespace gl
-
-#endif // LIBANGLE_CONTEXTSTATE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Debug.cpp b/src/3rdparty/angle/src/libANGLE/Debug.cpp
deleted file mode 100644
index 96f30df98c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Debug.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-//
-// 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 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()
- : mOutputEnabled(false),
- 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)
-{
- std::string messageCopy(message);
- insertMessage(source, type, id, severity, std::move(messageCopy));
-}
-
-void Debug::insertMessage(GLenum source,
- GLenum type,
- GLuint id,
- GLenum severity,
- std::string &&message)
-{
- 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));
-
- 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);
-}
-
-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
diff --git a/src/3rdparty/angle/src/libANGLE/Debug.h b/src/3rdparty/angle/src/libANGLE/Debug.h
deleted file mode 100644
index 2c15c25e9a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Debug.h
+++ /dev/null
@@ -1,129 +0,0 @@
-//
-// 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/angleutils.h"
-
-#include <deque>
-#include <string>
-#include <vector>
-
-namespace gl
-{
-
-class LabeledObject
-{
- public:
- virtual ~LabeledObject() {}
- virtual void setLabel(const std::string &label) = 0;
- virtual const std::string &getLabel() const = 0;
-};
-
-class Debug : angle::NonCopyable
-{
- public:
- Debug();
- ~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);
- void insertMessage(GLenum source,
- GLenum type,
- GLuint id,
- GLenum severity,
- std::string &&message);
-
- 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;
- std::deque<Message> mMessages;
- GLuint mMaxLoggedMessages;
- bool mOutputSynchronous;
- std::vector<Group> mGroups;
-};
-} // namespace gl
-
-#endif // LIBANGLE_DEBUG_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Device.cpp b/src/3rdparty/angle/src/libANGLE/Device.cpp
deleted file mode 100644
index 3ebf48b919..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Device.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-//
-// 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 <platform/Platform.h>
-#include <EGL/eglext.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(void *devicePointer, EGLint deviceType, Device **outDevice)
-{
- *outDevice = nullptr;
-
-#if defined(ANGLE_ENABLE_D3D11)
- if (deviceType == EGL_D3D11_DEVICE_ANGLE)
- {
- std::unique_ptr<rx::DeviceD3D> deviceD3D(new rx::DeviceD3D());
- ANGLE_TRY(deviceD3D->initialize(devicePointer, deviceType, EGL_TRUE));
- *outDevice = new Device(nullptr, deviceD3D.release());
- GetDeviceSet()->insert(*outDevice);
- return NoError();
- }
-#endif
-
- // Note that creating an EGL device from inputted D3D9 parameters isn't currently supported
- return EglBadAttribute();
-}
-
-egl::Error Device::CreateDevice(Display *owningDisplay, rx::DeviceImpl *impl, Device **outDevice)
-{
- *outDevice = new Device(owningDisplay, impl);
- GetDeviceSet()->insert(*outDevice);
- return NoError();
-}
-
-bool Device::IsValidDevice(Device *device)
-{
- const DeviceSet *deviceSet = GetDeviceSet();
- return deviceSet->find(device) != deviceSet->end();
-}
-
-Device::Device(Display *owningDisplay, rx::DeviceImpl *impl)
- : mOwningDisplay(owningDisplay), mImplementation(impl)
-{
- initDeviceExtensions();
-}
-
-Device::~Device()
-{
- ASSERT(GetDeviceSet()->find(this) != GetDeviceSet()->end());
- GetDeviceSet()->erase(this);
-
- if (mImplementation->deviceExternallySourced())
- {
- // If the device isn't externally sourced then it is up to the renderer to delete the impl
- SafeDelete(mImplementation);
- }
-}
-
-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;
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/Device.h b/src/3rdparty/angle/src/libANGLE/Device.h
deleted file mode 100644
index 4bc58ff043..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Device.h
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// 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/Error.h"
-#include "libANGLE/Display.h"
-
-namespace rx
-{
-class DeviceImpl;
-}
-
-namespace egl
-{
-class Device final : angle::NonCopyable
-{
- public:
- virtual ~Device();
-
- Error getDevice(EGLAttrib *value);
- Display *getOwningDisplay() { return mOwningDisplay; };
- EGLint getType();
-
- const DeviceExtensions &getExtensions() const;
- const std::string &getExtensionString() const;
-
- rx::DeviceImpl *getImplementation() { return mImplementation; }
-
- static egl::Error CreateDevice(void *devicePointer, EGLint deviceType, Device **outDevice);
- static egl::Error CreateDevice(Display *owningDisplay,
- rx::DeviceImpl *impl,
- Device **outDevice);
-
- static bool IsValidDevice(Device *device);
-
- private:
- Device(Display *owningDisplay, rx::DeviceImpl *impl);
- void initDeviceExtensions();
-
- Display *mOwningDisplay;
- rx::DeviceImpl *mImplementation;
-
- DeviceExtensions mDeviceExtensions;
- std::string mDeviceExtensionString;
-};
-
-}
-
-#endif // LIBANGLE_DEVICE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Display.cpp b/src/3rdparty/angle/src/libANGLE/Display.cpp
deleted file mode 100644
index 0bb0bb05b1..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Display.cpp
+++ /dev/null
@@ -1,1240 +0,0 @@
-//
-// 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 <platform/Platform.h>
-#include <EGL/eglext.h>
-
-#include "common/debug.h"
-#include "common/mathutil.h"
-#include "common/platform.h"
-#include "common/utilities.h"
-#include "libANGLE/Context.h"
-#include "libANGLE/Device.h"
-#include "libANGLE/histogram_macros.h"
-#include "libANGLE/Image.h"
-#include "libANGLE/Surface.h"
-#include "libANGLE/Stream.h"
-#include "libANGLE/ResourceManager.h"
-#include "libANGLE/renderer/DisplayImpl.h"
-#include "libANGLE/renderer/ImageImpl.h"
-#include "third_party/trace_event/trace_event.h"
-
-#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"
-#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;
-}
-
-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);
- 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_USE_OZONE)
- impl = new rx::DisplayOzone(state);
-#elif defined(ANGLE_PLATFORM_ANDROID)
- impl = new rx::DisplayAndroid(state);
-#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);
-#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
- // gl::Trace(gl::LOG_WARN, infoMessage);
-}
-
-void ANGLESetDefaultDisplayPlatform(angle::EGLDisplayType display)
-{
- angle::PlatformMethods *platformMethods = ANGLEPlatformCurrent();
- if (platformMethods->logError != angle::DefaultLogError)
- {
- // Don't reset pre-set Platform to Default
- return;
- }
-
- ANGLEResetDisplayPlatform(display);
- platformMethods->logError = Display_logError;
- platformMethods->logWarning = Display_logWarning;
- platformMethods->logInfo = Display_logInfo;
-}
-
-} // anonymous namespace
-
-DisplayState::DisplayState()
-{
-}
-
-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::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;
-}
-
-//static
-void Display::CleanupDisplays()
-{
- // ~Display takes care of removing the entry from the according map
- {
- ANGLEPlatformDisplayMap *displays = GetANGLEPlatformDisplayMap();
- while (!displays->empty())
- delete displays->begin()->second;
- }
-
- {
- DevicePlatformDisplayMap *displays = GetDevicePlatformDisplayMap();
- while (!displays->empty())
- delete displays->begin()->second;
- }
-}
-
-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),
- mPlatform(platform),
- mTextureManager(nullptr),
- mMemoryProgramCache(gl::kDefaultMaxProgramCacheMemoryBytes),
- mGlobalTextureShareGroupUsers(0),
- mProxyContext(this)
-{
-}
-
-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();
- }
-
- mProxyContext.reset(nullptr);
-
- SafeDelete(mDevice);
- SafeDelete(mImplementation);
-}
-
-void Display::setAttributes(rx::DisplayImpl *impl, const AttributeMap &attribMap)
-{
- ASSERT(!mInitialized);
-
- ASSERT(impl != nullptr);
- SafeDelete(mImplementation);
- mImplementation = impl;
-
- mAttributeMap = attribMap;
-}
-
-Error Display::initialize()
-{
- // 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);
- }
-
- gl::InitializeDebugAnnotations(&mAnnotator);
-
- SCOPED_ANGLE_HISTOGRAM_TIMER("GPU.ANGLE.DisplayInitializeMS");
- TRACE_EVENT0("gpu.angle", "egl::Display::initialize");
-
- ASSERT(mImplementation != nullptr);
-
- 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();
- }
-
- initDisplayExtensions();
- initVendorString();
-
- // Populate the Display's EGLDeviceEXT if the Display wasn't created using one
- if (mPlatform != EGL_PLATFORM_DEVICE_EXT)
- {
- if (mDisplayExtensions.deviceQuery)
- {
- rx::DeviceImpl *impl = nullptr;
- ANGLE_TRY(mImplementation->getDevice(&impl));
- ANGLE_TRY(Device::CreateDevice(this, impl, &mDevice));
- }
- else
- {
- mDevice = nullptr;
- }
- }
- else
- {
- // For EGL_PLATFORM_DEVICE_EXT, mDevice should always be populated using
- // an external device
- ASSERT(mDevice != nullptr);
- }
-
- mProxyContext.reset(nullptr);
- gl::Context *proxyContext = new gl::Context(mImplementation, nullptr, nullptr, nullptr, nullptr,
- egl::AttributeMap(), mDisplayExtensions);
- mProxyContext.reset(proxyContext);
-
- mInitialized = true;
-
- return NoError();
-}
-
-Error Display::terminate()
-{
- ANGLE_TRY(makeCurrent(nullptr, nullptr, nullptr));
-
- mMemoryProgramCache.clear();
-
- mProxyContext.reset(nullptr);
-
- while (!mContextSet.empty())
- {
- ANGLE_TRY(destroyContext(*mContextSet.begin()));
- }
-
- // 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 (!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);
-}
-
-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));
-
- 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
- {
- UNREACHABLE();
- }
- ASSERT(sibling != nullptr);
-
- angle::UniqueObjectPointer<Image, gl::Context> imagePtr(
- new Image(mImplementation, target, sibling, attribs), context);
- ANGLE_TRY(imagePtr->initialize());
-
- 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,
- gl::Context *shareContext,
- 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 should enable the cache.
- if (mAttributeMap.get(EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE, EGL_TRUE) == EGL_FALSE)
- {
- cachePointer = nullptr;
- }
-
- // A program cache size of zero indicates it should be disabled.
- if (mMemoryProgramCache.maxSize() == 0)
- {
- cachePointer = nullptr;
- }
-
- gl::Context *context =
- new gl::Context(mImplementation, configuration, shareContext, shareTextures, cachePointer,
- attribs, mDisplayExtensions);
-
- ASSERT(context != nullptr);
- mContextSet.insert(context);
-
- ASSERT(outContext != nullptr);
- *outContext = context;
- return NoError();
-}
-
-Error Display::makeCurrent(egl::Surface *drawSurface,
- egl::Surface *readSurface,
- gl::Context *context)
-{
- 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(mProxyContext.get());
- mImageSet.erase(iter);
-}
-
-void Display::destroyStream(egl::Stream *stream)
-{
- mStreamSet.erase(stream);
- SafeDelete(stream);
-}
-
-Error Display::destroyContext(gl::Context *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);
- return NoError();
-}
-
-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();
- }
-
- mDeviceLost = true;
-}
-
-Error Display::waitClient(const gl::Context *context) const
-{
- return mImplementation->waitClient(context);
-}
-
-Error Display::waitNative(const gl::Context *context, EGLint engine) const
-{
- 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::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;
-#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;
-
- 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;
-
- 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)
-{
- return mImplementation->validateClientBuffer(configuration, buftype, 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();
-}
-
-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;
-}
-
-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>(gl::kProgramHashLength);
-
- 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 angle::MemoryBuffer *programBinary = nullptr;
- gl::ProgramHash programHash;
- // 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>(gl::kProgramHashLength));
- memcpy(key, programHash.data(), gl::kProgramHashLength);
- }
-
- 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>(gl::kProgramHashLength);
-
- return NoError();
-}
-
-Error Display::programCachePopulate(const void *key,
- EGLint keysize,
- const void *binary,
- EGLint binarysize)
-{
- ASSERT(keysize == static_cast<EGLint>(gl::kProgramHashLength));
-
- gl::ProgramHash programHash;
- memcpy(programHash.data(), key, gl::kProgramHashLength);
-
- 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;
- }
-}
-
-} // namespace egl
diff --git a/src/3rdparty/angle/src/libANGLE/Display.h b/src/3rdparty/angle/src/libANGLE/Display.h
deleted file mode 100644
index 2a1c386d75..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Display.h
+++ /dev/null
@@ -1,219 +0,0 @@
-//
-// 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/Caps.h"
-#include "libANGLE/Config.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/LoggingAnnotator.h"
-#include "libANGLE/MemoryProgramCache.h"
-#include "libANGLE/Version.h"
-
-namespace gl
-{
-class Context;
-class TextureManager;
-}
-
-namespace rx
-{
-class DisplayImpl;
-}
-
-namespace egl
-{
-class Device;
-class Image;
-class Surface;
-class Stream;
-class Thread;
-
-using SurfaceSet = std::set<Surface *>;
-
-struct DisplayState final : private angle::NonCopyable
-{
- DisplayState();
- ~DisplayState();
-
- SurfaceSet surfaceSet;
-};
-
-// Constant coded here as a sanity limit.
-constexpr EGLAttrib kProgramCacheSizeAbsoluteMax = 0x4000000;
-
-class Display final : angle::NonCopyable
-{
- public:
- ~Display();
-
- Error initialize();
- Error terminate();
-
- static Display *GetDisplayFromDevice(Device *device, const AttributeMap &attribMap);
- static Display *GetDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay,
- const AttributeMap &attribMap);
- static void CleanupDisplays();
-
- static const ClientExtensions &GetClientExtensions();
- static const std::string &GetClientExtensionString();
-
- std::vector<const Config *> getConfigs(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,
- gl::Context *shareContext,
- const AttributeMap &attribs,
- gl::Context **outContext);
-
- Error makeCurrent(Surface *drawSurface, Surface *readSurface, gl::Context *context);
-
- Error destroySurface(Surface *surface);
- void destroyImage(Image *image);
- void destroyStream(Stream *stream);
- Error destroyContext(gl::Context *context);
-
- 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 isValidNativeWindow(EGLNativeWindowType window) const;
-
- Error validateClientBuffer(const Config *configuration,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
- const AttributeMap &attribs);
-
- static bool isValidDisplay(const Display *display);
- static bool isValidNativeDisplay(EGLNativeDisplayType display);
- static bool hasExistingWindowSurface(EGLNativeWindowType window);
-
- bool isDeviceLost() const;
- bool testDeviceLost();
- void notifyDeviceLost();
-
- Error waitClient(const gl::Context *context) const;
- Error waitNative(const gl::Context *context, EGLint engine) const;
-
- 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;
- EGLenum getPlatform() const { return mPlatform; }
-
- gl::Version getMaxSupportedESVersion() const;
-
- const DisplayState &getState() const { return mState; }
-
- gl::Context *getProxyContext() const { return mProxyContext.get(); }
-
- private:
- Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDevice);
-
- void setAttributes(rx::DisplayImpl *impl, const AttributeMap &attribMap);
-
- Error restoreLostDevice();
-
- void initDisplayExtensions();
- void initVendorString();
-
- DisplayState mState;
- rx::DisplayImpl *mImplementation;
-
- EGLNativeDisplayType mDisplayId;
- AttributeMap mAttributeMap;
-
- ConfigSet mConfigSet;
-
- typedef std::set<gl::Context*> ContextSet;
- ContextSet mContextSet;
-
- typedef std::set<Image *> ImageSet;
- ImageSet mImageSet;
-
- typedef std::set<Stream *> StreamSet;
- StreamSet mStreamSet;
-
- bool mInitialized;
- bool mDeviceLost;
-
- Caps mCaps;
-
- DisplayExtensions mDisplayExtensions;
- std::string mDisplayExtensionString;
-
- std::string mVendorString;
-
- Device *mDevice;
- EGLenum mPlatform;
- angle::LoggingAnnotator mAnnotator;
-
- gl::TextureManager *mTextureManager;
- gl::MemoryProgramCache mMemoryProgramCache;
- size_t mGlobalTextureShareGroupUsers;
-
- // This gl::Context is a simple proxy to the Display for the GL back-end entry points
- // that need access to implementation-specific data, like a Renderer object.
- angle::UniqueObjectPointer<gl::Context, Display> mProxyContext;
-};
-
-} // namespace egl
-
-#endif // LIBANGLE_DISPLAY_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Error.cpp b/src/3rdparty/angle/src/libANGLE/Error.cpp
deleted file mode 100644
index 388f0259fa..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Error.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-//
-// 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 gl
-{
-
-Error::Error(GLenum errorCode, std::string &&message)
- : mCode(errorCode), mID(errorCode), mMessage(EmplaceErrorString(std::move(message)))
-{
-}
-
-Error::Error(GLenum errorCode, GLuint 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;
-}
-
-bool Error::operator==(const Error &other) const
-{
- if (mCode != other.mCode)
- return false;
-
- // TODO(jmadill): Compare extended error codes instead of strings.
- if ((!mMessage || !other.mMessage) && (!mMessage != !other.mMessage))
- return false;
-
- return (*mMessage == *other.mMessage);
-}
-
-bool Error::operator!=(const Error &other) const
-{
- return !(*this == other);
-}
-
-std::ostream &operator<<(std::ostream &os, const Error &err)
-{
- return gl::FmtHexShort(os, err.getCode());
-}
-
-} // namespace gl
-
-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::FmtHexShort(os, err.getCode());
-}
-
-} // namespace egl
diff --git a/src/3rdparty/angle/src/libANGLE/Error.h b/src/3rdparty/angle/src/libANGLE/Error.h
deleted file mode 100644
index 1d57bb8707..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Error.h
+++ /dev/null
@@ -1,267 +0,0 @@
-//
-// 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 ResultT, typename ErrorBaseT, ErrorBaseT NoErrorVal>
-class ANGLE_NO_DISCARD ErrorOrResultBase
-{
- public:
- ErrorOrResultBase(const ErrorT &error) : mError(error) {}
- ErrorOrResultBase(ErrorT &&error) : mError(std::move(error)) {}
-
- ErrorOrResultBase(ResultT &&result) : mError(NoErrorVal), mResult(std::forward<ResultT>(result))
- {
- }
-
- ErrorOrResultBase(const ResultT &result) : mError(NoErrorVal), mResult(result) {}
-
- bool isError() const { return mError.isError(); }
- const ErrorT &getError() const { return mError; }
- ResultT &&getResult() { return std::move(mResult); }
-
- private:
- ErrorT mError;
- ResultT mResult;
-};
-
-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()); }
-
- template <typename ResultT>
- operator ErrorOrResultBase<ErrorT, ResultT, ErrorBaseT, NoErrorVal>()
- {
- return static_cast<ErrorT>(*this);
- }
-
- private:
- GLuint mID;
- std::ostringstream mErrorStream;
-};
-} // namespace angle
-
-namespace egl
-{
-class Error;
-} // namespace egl
-
-namespace gl
-{
-
-class ANGLE_NO_DISCARD Error final
-{
- public:
- explicit inline Error(GLenum errorCode);
- Error(GLenum errorCode, std::string &&message);
- Error(GLenum errorCode, GLuint id, std::string &&message);
- inline Error(const Error &other);
- inline Error(Error &&other);
- inline ~Error() = default;
-
- // automatic error type conversion
- inline Error(egl::Error &&eglErr);
- inline Error(egl::Error eglErr);
-
- inline Error &operator=(const Error &other);
- inline Error &operator=(Error &&other);
-
- inline GLenum getCode() const;
- inline GLuint getID() const;
- inline bool isError() const;
-
- const std::string &getMessage() const;
-
- // Useful for mocking and testing
- bool operator==(const Error &other) const;
- bool operator!=(const Error &other) const;
-
- private:
- void createMessageString() const;
-
- friend std::ostream &operator<<(std::ostream &os, const Error &err);
- friend class egl::Error;
-
- GLenum mCode;
- GLuint mID;
- mutable std::unique_ptr<std::string> mMessage;
-};
-
-template <typename ResultT>
-using ErrorOrResult = angle::ErrorOrResultBase<Error, ResultT, GLenum, GL_NO_ERROR>;
-
-namespace priv
-{
-
-template <GLenum EnumT>
-using ErrorStream = angle::ErrorStreamBase<Error, GLenum, GL_NO_ERROR, GLenum, EnumT>;
-
-} // namespace priv
-
-using InternalError = priv::ErrorStream<GL_INVALID_OPERATION>;
-
-using InvalidEnum = priv::ErrorStream<GL_INVALID_ENUM>;
-using InvalidValue = priv::ErrorStream<GL_INVALID_VALUE>;
-using InvalidOperation = priv::ErrorStream<GL_INVALID_OPERATION>;
-using StackOverflow = priv::ErrorStream<GL_STACK_OVERFLOW>;
-using StackUnderflow = priv::ErrorStream<GL_STACK_UNDERFLOW>;
-using OutOfMemory = priv::ErrorStream<GL_OUT_OF_MEMORY>;
-using InvalidFramebufferOperation = priv::ErrorStream<GL_INVALID_FRAMEBUFFER_OPERATION>;
-
-inline Error NoError()
-{
- return Error(GL_NO_ERROR);
-}
-
-using LinkResult = ErrorOrResult<bool>;
-
-} // namespace gl
-
-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;
-
- // automatic error type conversion
- inline Error(gl::Error &&glErr);
- inline Error(gl::Error glErr);
-
- 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;
-
- private:
- void createMessageString() const;
-
- friend std::ostream &operator<<(std::ostream &os, const Error &err);
- friend class gl::Error;
-
- EGLint mCode;
- EGLint mID;
- mutable std::unique_ptr<std::string> mMessage;
-};
-
-template <typename ResultT>
-using ErrorOrResult = angle::ErrorOrResultBase<Error, ResultT, EGLint, EGL_SUCCESS>;
-
-namespace priv
-{
-
-template <EGLint EnumT>
-using ErrorStream = angle::ErrorStreamBase<Error, EGLint, EGL_SUCCESS, EGLint, EnumT>;
-
-} // namespace priv
-
-using EglNotInitialized = priv::ErrorStream<EGL_NOT_INITIALIZED>;
-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 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 EglBadSurface = priv::ErrorStream<EGL_BAD_SURFACE>;
-using EglContextLost = priv::ErrorStream<EGL_CONTEXT_LOST>;
-using EglBadStream = priv::ErrorStream<EGL_BAD_STREAM_KHR>;
-using EglBadState = priv::ErrorStream<EGL_BAD_STATE_KHR>;
-using EglBadDevice = priv::ErrorStream<EGL_BAD_DEVICE_EXT>;
-
-inline Error NoError()
-{
- return Error(EGL_SUCCESS);
-}
-
-} // 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) \
- { \
- auto ANGLE_LOCAL_VAR = EXPR; \
- if (ANGLE_LOCAL_VAR.isError()) \
- { \
- FUNC(ANGLE_LOCAL_VAR); \
- } \
- } \
- ANGLE_EMPTY_STATEMENT
-
-#define ANGLE_RETURN(X) return X;
-#define ANGLE_TRY(EXPR) ANGLE_TRY_TEMPLATE(EXPR, ANGLE_RETURN);
-
-#define ANGLE_TRY_RESULT(EXPR, RESULT) \
- { \
- auto ANGLE_LOCAL_VAR = EXPR; \
- if (ANGLE_LOCAL_VAR.isError()) \
- { \
- return ANGLE_LOCAL_VAR.getError(); \
- } \
- RESULT = ANGLE_LOCAL_VAR.getResult(); \
- } \
- ANGLE_EMPTY_STATEMENT
-
-// TODO(jmadill): Introduce way to store errors to a const Context.
-#define ANGLE_SWALLOW_ERR(EXPR) \
- { \
- auto ANGLE_LOCAL_VAR = EXPR; \
- if (ANGLE_LOCAL_VAR.isError()) \
- { \
- ERR() << "Unhandled internal error: " << ANGLE_LOCAL_VAR; \
- } \
- } \
- ANGLE_EMPTY_STATEMENT
-
-#undef ANGLE_LOCAL_VAR
-#undef ANGLE_CONCAT2
-#undef ANGLE_CONCAT1
-
-#include "Error.inl"
-
-#endif // LIBANGLE_ERROR_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Error.inl b/src/3rdparty/angle/src/libANGLE/Error.inl
deleted file mode 100644
index 4632830ce0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Error.inl
+++ /dev/null
@@ -1,189 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Error.inl: Inline definitions of egl::Error and gl::Error classes which encapsulate API errors
-// and optional error messages.
-
-#include "common/angleutils.h"
-
-#include <cstdarg>
-
-namespace gl
-{
-
-Error::Error(GLenum errorCode)
- : mCode(errorCode),
- mID(errorCode)
-{
-}
-
-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))
-{
-}
-
-// automatic error type conversion
-Error::Error(egl::Error &&eglErr)
- : mCode(GL_INVALID_OPERATION),
- mID(0),
- mMessage(std::move(eglErr.mMessage))
-{
-}
-
-Error::Error(egl::Error eglErr)
- : mCode(GL_INVALID_OPERATION),
- mID(0),
- mMessage(std::move(eglErr.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;
-}
-
-GLenum Error::getCode() const
-{
- return mCode;
-}
-
-GLuint Error::getID() const
-{
- return mID;
-}
-
-bool Error::isError() const
-{
- return (mCode != GL_NO_ERROR);
-}
-
-} // namespace gl
-
-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))
-{
-}
-
-// automatic error type conversion
-Error::Error(gl::Error &&glErr)
- : mCode(EGL_BAD_ACCESS),
- mID(0),
- mMessage(std::move(glErr.mMessage))
-{
-}
-
-Error::Error(gl::Error glErr)
- : mCode(EGL_BAD_ACCESS),
- mID(0),
- mMessage(std::move(glErr.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);
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/ErrorStrings.h b/src/3rdparty/angle/src/libANGLE/ErrorStrings.h
deleted file mode 100644
index 93d64482d9..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ErrorStrings.h
+++ /dev/null
@@ -1,173 +0,0 @@
-//
-// 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_
-
-#define ERRMSG(name, message) \
- static const constexpr char *kError##name = static_cast<const char *>(message);
-#define ANGLE_VALIDATION_ERR(context, error, errorName) \
- context->handleError(error << kError##errorName)
-
-namespace gl
-{
-ERRMSG(BufferNotBound, "A buffer must be bound.");
-ERRMSG(CompressedTextureDimensionsMustMatchData,
- "Compressed texture dimensions must exactly match the dimensions of the data passed in.");
-ERRMSG(CompressedTexturesNotAttachable, "Compressed textures cannot be attached to a framebuffer.");
-ERRMSG(CubemapFacesEqualDimensions, "Each cubemap face must have equal width and height.");
-ERRMSG(CubemapIncomplete,
- "Texture is not cubemap complete. All cubemaps faces must be defined and be the same size.");
-ERRMSG(DefaultFramebufferInvalidAttachment,
- "Invalid attachment when the default framebuffer is bound.");
-ERRMSG(DefaultFramebufferTarget, "It is invalid to change default FBO's attachments");
-ERRMSG(EnumNotSupported, "Enum is not currently supported.");
-ERRMSG(EnumRequiresGLES31, "Enum requires GLES 3.1");
-ERRMSG(ES31Required, "OpenGL ES 3.1 Required");
-ERRMSG(ES3Required, "OpenGL ES 3.0 Required.");
-ERRMSG(ExceedsMaxElement, "Element value exceeds maximum element index.");
-ERRMSG(ExpectedProgramName, "Expected a program name, but found a shader name.");
-ERRMSG(ExpectedShaderName, "Expected a shader name, but found a program name.");
-ERRMSG(ExtensionNotEnabled, "Extension is not enabled.");
-ERRMSG(FeedbackLoop, "Feedback loop formed between Framebuffer and active Texture.");
-ERRMSG(FramebufferIncompleteAttachment,
- "Attachment type must be compatible with attachment object.");
-ERRMSG(GenerateMipmapNotAllowed, "Texture format does not support mipmap generation.");
-ERRMSG(IndexExceedsMaxActiveUniform, "Index exceeds program active uniform count.");
-ERRMSG(IndexExceedsMaxDrawBuffer, "Index exceeds MAX_DRAW_BUFFERS.");
-ERRMSG(IndexExceedsMaxVertexAttribute, "Index exceeds MAX_VERTEX_ATTRIBS.");
-ERRMSG(InsufficientBufferSize, "Insufficient buffer size.");
-ERRMSG(InsufficientVertexBufferSize, "Vertex buffer is not big enough for the draw call");
-ERRMSG(IntegerOverflow, "Integer overflow.");
-ERRMSG(InvalidAttachment, "Invalid Attachment Type.");
-ERRMSG(InvalidBlendEquation, "Invalid blend equation.");
-ERRMSG(InvalidBlendFunction, "Invalid blend function.");
-ERRMSG(InvalidBorder, "Border must be 0.");
-ERRMSG(InvalidBufferTypes, "Invalid buffer target enum.");
-ERRMSG(InvalidBufferUsage, "Invalid buffer usage enum.");
-ERRMSG(InvalidClearMask, "Invalid mask bits.");
-ERRMSG(InvalidConstantColor,
- "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.");
-ERRMSG(InvalidCoverMode, "Invalid cover mode.");
-ERRMSG(InvalidCullMode, "Cull mode not recognized.");
-ERRMSG(InvalidDebugSeverity, "Invalid debug severity.");
-ERRMSG(InvalidDebugSource, "Invalid debug source.");
-ERRMSG(InvalidDebugType, "Invalid debug type.");
-ERRMSG(InvalidDepthRange, "Near value cannot be greater than far.");
-ERRMSG(InvalidDrawMode, "Invalid draw mode.");
-ERRMSG(InvalidDrawModeTransformFeedback,
- "Draw mode must match current transform feedback object's draw mode.");
-ERRMSG(InvalidFillMode, "Invalid fill mode.");
-ERRMSG(InvalidFilterTexture, "Texture only supports NEAREST and LINEAR filtering.");
-ERRMSG(InvalidFormat, "Invalid format.");
-ERRMSG(InvalidFramebufferTarget, "Invalid framebuffer target.");
-ERRMSG(InvalidFramebufferTextureLevel, "Mipmap level must be 0 when attaching a texture.");
-ERRMSG(InvalidFramebufferAttachmentParameter, "Invalid parameter name for framebuffer attachment.");
-ERRMSG(InvalidInternalFormat, "Invalid internal format.");
-ERRMSG(InvalidMatrixMode, "Invalid matrix mode.");
-ERRMSG(InvalidMipLevel, "Level of detail outside of range.");
-ERRMSG(InvalidName, "Invalid name.");
-ERRMSG(InvalidNameCharacters, "Name contains invalid characters.");
-ERRMSG(InvalidPname, "Invalid pname.");
-ERRMSG(InvalidPrecision, "Invalid or unsupported precision type.");
-ERRMSG(InvalidProgramName, "Program object expected.");
-ERRMSG(InvalidQueryId, "Invalid query Id.");
-ERRMSG(InvalidQueryTarget, "Invalid query target.");
-ERRMSG(InvalidQueryType, "Invalid query type.");
-ERRMSG(InvalidRange, "Invalid range.");
-ERRMSG(InvalidRenderbufferInternalFormat, "Invalid renderbuffer internalformat.");
-ERRMSG(InvalidRenderbufferTarget, "Invalid renderbuffer target.");
-ERRMSG(InvalidRenderbufferTextureParameter, "Invalid parameter name for renderbuffer attachment.");
-ERRMSG(InvalidRenderbufferWidthHeight,
- "Renderbuffer width and height cannot be negative and cannot exceed maximum texture size.");
-ERRMSG(InvalidSampleMaskNumber,
- "MaskNumber cannot be greater than or equal to the value of MAX_SAMPLE_MASK_WORDS.");
-ERRMSG(InvalidSampler, "Sampler is not valid");
-ERRMSG(InvalidShaderName, "Shader object expected.");
-ERRMSG(InvalidShaderType, "Invalid shader type.");
-ERRMSG(InvalidStencil, "Invalid stencil.");
-ERRMSG(InvalidStencilBitMask, "Invalid stencil bit mask.");
-ERRMSG(InvalidTarget, "Invalid target.");
-ERRMSG(InvalidTextureFilterParam, "Texture filter not recognized.");
-ERRMSG(InvalidTextureRange, "Cannot be less than 0 or greater than maximum number of textures.");
-ERRMSG(InvalidTextureTarget, "Invalid or unsupported texture target.");
-ERRMSG(InvalidTextureWrap, "Texture wrap mode not recognized.");
-ERRMSG(InvalidType, "Invalid type.");
-ERRMSG(InvalidTypePureInt, "Invalid type, should be integer");
-ERRMSG(InvalidUnpackAlignment, "Unpack alignment must be 1, 2, 4, or 8.");
-ERRMSG(InvalidVertexAttrSize, "Vertex attribute size must be 1, 2, 3, or 4.");
-ERRMSG(InvalidWidth, "Invalid width.");
-ERRMSG(InvalidWrapModeTexture, "Invalid wrap mode for texture type.");
-ERRMSG(LevelNotZero, "Texture level must be zero.");
-ERRMSG(MismatchedByteCountType, "Buffer size does not align with data type.");
-ERRMSG(MismatchedFormat, "Format must match internal format.");
-ERRMSG(MismatchedTargetAndFormat, "Invalid texture target and format combination.");
-ERRMSG(MismatchedTypeAndFormat, "Invalid format and type combination.");
-ERRMSG(MismatchedVariableProgram, "Variable is not part of the current program.");
-ERRMSG(MissingReadAttachment, "Missing read attachment.");
-ERRMSG(MustHaveElementArrayBinding, "Must have element array buffer binding.");
-ERRMSG(NameBeginsWithGL, "Attributes that begin with 'gl_' are not allowed.");
-ERRMSG(NegativeAttachments, "Negative number of attachments.");
-ERRMSG(NegativeBufferSize, "Negative buffer size.");
-ERRMSG(NegativeCount, "Negative count.");
-ERRMSG(NegativeLength, "Negative length.");
-ERRMSG(NegativeMaxCount, "Negative maxcount.");
-ERRMSG(NegativeOffset, "Negative offset.");
-ERRMSG(NegativePrimcount, "Primcount must be greater than or equal to zero.");
-ERRMSG(NegativeSize, "Cannot have negative height or width.");
-ERRMSG(NegativeStart, "Cannot have negative start.");
-ERRMSG(NegativeStride, "Cannot have negative stride.");
-ERRMSG(NoSuchPath, "No such path object.");
-ERRMSG(NoTransformFeedbackOutputVariables,
- "The active program has specified no output variables to record.");
-ERRMSG(NoZeroDivisor, "At least one enabled attribute must have a divisor of zero.");
-ERRMSG(ObjectNotGenerated, "Object cannot be used because it has not been generated.");
-ERRMSG(OffsetMustBeMultipleOfType, "Offset must be a multiple of the passed in datatype.");
-ERRMSG(OutsideOfBounds, "Parameter outside of bounds.");
-ERRMSG(ParamOverflow, "The provided parameters overflow with the provided buffer.");
-ERRMSG(PixelDataNotNull, "Pixel data must be null.");
-ERRMSG(PixelDataNull, "Pixel data cannot be null.");
-ERRMSG(ProgramDoesNotExist, "Program doesn't exist.");
-ERRMSG(ProgramNotBound, "A program must be bound.");
-ERRMSG(ProgramNotLinked, "Program not linked.");
-ERRMSG(QueryActive, "Query is active.");
-ERRMSG(QueryExtensionNotEnabled, "Query extension not enabled.");
-ERRMSG(ReadBufferNone, "Read buffer is GL_NONE.");
-ERRMSG(RenderbufferNotBound, "A renderbuffer must be bound.");
-ERRMSG(ResourceMaxTextureSize, "Desired resource size is greater than max texture size.");
-ERRMSG(ShaderAttachmentHasShader, "Shader attachment already has a shader.");
-ERRMSG(ShaderSourceInvalidCharacters, "Shader source contains invalid characters.");
-ERRMSG(ShaderToDetachMustBeAttached,
- "Shader to be detached must be currently attached to the program.");
-ERRMSG(SourceTextureTooSmall, "The specified dimensions are outside of the bounds of the texture.");
-ERRMSG(StencilReferenceMaskOrMismatch,
- "Stencil reference and mask values must be the same for front facing and back facing "
- "triangles.");
-ERRMSG(StrideMustBeMultipleOfType, "Stride must be a multiple of the passed in datatype.");
-ERRMSG(TextureNotBound, "A texture must be bound.");
-ERRMSG(TextureNotPow2, "The texture is a non-power-of-two texture.");
-ERRMSG(TransformFeedbackDoesNotExist, "Transform feedback object that does not exist.");
-ERRMSG(TypeMismatch,
- "Passed in texture target and format must match the one originally used to define the "
- "texture.");
-ERRMSG(TypeNotUnsignedShortByte, "Only UNSIGNED_SHORT and UNSIGNED_BYTE types are supported.");
-ERRMSG(UniformSizeMismatch, "Uniform size does not match uniform method.");
-ERRMSG(UnknownParameter, "Unknown parameter value.");
-ERRMSG(VertexArrayNoBuffer, "An enabled vertex array has no buffer.");
-ERRMSG(VertexArrayNoBufferPointer, "An enabled vertex array has no buffer and no pointer.");
-ERRMSG(ViewportNegativeSize, "Viewport size cannot be negative.");
-ERRMSG(Webgl2NameLengthLimitExceeded, "Location lengths must not be greater than 1024 characters.");
-ERRMSG(WebglBindAttribLocationReservedPrefix,
- "Attributes that begin with 'webgl_', or '_webgl_' are not allowed.");
-ERRMSG(WebglNameLengthLimitExceeded,
- "Location name lengths must not be greater than 256 characters.");
-}
-#undef ERRMSG
-#endif // LIBANGLE_ERRORSTRINGS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Fence.cpp b/src/3rdparty/angle/src/libANGLE/Fence.cpp
deleted file mode 100644
index 9c4d381673..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Fence.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-//
-// 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, which support the GL_NV_fence
-// extension and GLES3 sync objects.
-
-#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);
-}
-
-Error FenceNV::set(GLenum condition)
-{
- Error error = mFence->set(condition);
- if (error.isError())
- {
- return error;
- }
-
- mCondition = condition;
- mStatus = GL_FALSE;
- mIsSet = true;
-
- return NoError();
-}
-
-Error FenceNV::test(GLboolean *outResult)
-{
- // Flush the command buffer by default
- Error error = mFence->test(&mStatus);
- if (error.isError())
- {
- return error;
- }
-
- *outResult = mStatus;
- return NoError();
-}
-
-Error FenceNV::finish()
-{
- ASSERT(mIsSet);
-
- gl::Error error = mFence->finish();
- if (error.isError())
- {
- return error;
- }
-
- mStatus = GL_TRUE;
-
- return NoError();
-}
-
-Sync::Sync(rx::SyncImpl *impl, GLuint id)
- : RefCountObject(id),
- mFence(impl),
- mLabel(),
- mCondition(GL_SYNC_GPU_COMMANDS_COMPLETE),
- mFlags(0)
-{
-}
-
-Error Sync::onDestroy(const Context *context)
-{
- return NoError();
-}
-
-Sync::~Sync()
-{
- SafeDelete(mFence);
-}
-
-void Sync::setLabel(const std::string &label)
-{
- mLabel = label;
-}
-
-const std::string &Sync::getLabel() const
-{
- return mLabel;
-}
-
-Error Sync::set(GLenum condition, GLbitfield flags)
-{
- Error error = mFence->set(condition, flags);
- if (error.isError())
- {
- return error;
- }
-
- mCondition = condition;
- mFlags = flags;
- return NoError();
-}
-
-Error Sync::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult)
-{
- ASSERT(mCondition != GL_NONE);
- return mFence->clientWait(flags, timeout, outResult);
-}
-
-Error Sync::serverWait(GLbitfield flags, GLuint64 timeout)
-{
- return mFence->serverWait(flags, timeout);
-}
-
-Error Sync::getStatus(GLint *outResult) const
-{
- return mFence->getStatus(outResult);
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Fence.h b/src/3rdparty/angle/src/libANGLE/Fence.h
deleted file mode 100644
index 24bc689ca3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Fence.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// 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 gl
-{
-
-class FenceNV final : angle::NonCopyable
-{
- public:
- explicit FenceNV(rx::FenceNVImpl *impl);
- virtual ~FenceNV();
-
- Error set(GLenum condition);
- Error test(GLboolean *outResult);
- Error finish();
-
- bool isSet() const { return mIsSet; }
- GLboolean getStatus() const { return mStatus; }
- GLenum getCondition() const { return mCondition; }
-
- private:
- rx::FenceNVImpl *mFence;
-
- bool mIsSet;
-
- GLboolean mStatus;
- GLenum mCondition;
-};
-
-class Sync final : public RefCountObject, public LabeledObject
-{
- public:
- Sync(rx::SyncImpl *impl, GLuint id);
- ~Sync() override;
-
- Error onDestroy(const Context *context) override;
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- Error set(GLenum condition, GLbitfield flags);
- Error clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult);
- Error serverWait(GLbitfield flags, GLuint64 timeout);
- Error getStatus(GLint *outResult) const;
-
- GLenum getCondition() const { return mCondition; }
- GLbitfield getFlags() const { return mFlags; }
-
- private:
- rx::SyncImpl *mFence;
-
- std::string mLabel;
-
- GLenum mCondition;
- GLbitfield mFlags;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_FENCE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Framebuffer.cpp b/src/3rdparty/angle/src/libANGLE/Framebuffer.cpp
deleted file mode 100644
index 48e71685b3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Framebuffer.cpp
+++ /dev/null
@@ -1,2182 +0,0 @@
-//
-// 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/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
-{
-
-void BindResourceChannel(OnAttachmentDirtyBinding *binding, FramebufferAttachmentObject *resource)
-{
- binding->bind(resource ? resource->getDirtyChannel() : nullptr);
-}
-
-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->getMultiviewLayout() != secondAttachment->getMultiviewLayout())
- {
- return false;
- }
- if (firstAttachment->getMultiviewViewportOffsets() !=
- secondAttachment->getMultiviewViewportOffsets())
- {
- 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;
- }
-
- const InternalFormat &format = *attachment.getFormat().info;
- if (!format.renderSupport(context->getClientVersion(), context->getExtensions()))
- {
- return false;
- }
-
- if (attachment.type() == GL_TEXTURE)
- {
- if (attachment.layer() >= size.depth)
- {
- 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->getTarget() == GL_TEXTURE_CUBE_MAP &&
- !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();
-
- // ES3.1 (section 9.4) requires that the value of TEXTURE_FIXED_SAMPLE_LOCATIONS should be
- // the same for all attached textures.
- bool fixedSampleloc = texture->getFixedSampleLocations(attachmentImageIndex.type,
- attachmentImageIndex.mipIndex);
- 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) ==
- gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_MAX,
- "Framebuffer Dirty bit mismatch");
-static_assert(static_cast<size_t>(IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS) ==
- gl::Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT,
- "Framebuffer Dirty bit mismatch");
-static_assert(static_cast<size_t>(IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS + 1) ==
- gl::Framebuffer::DIRTY_BIT_STENCIL_ATTACHMENT,
- "Framebuffer Dirty bit mismatch");
-
-Error InitAttachment(const Context *context, FramebufferAttachment *attachment)
-{
- ASSERT(attachment->isAttached());
- if (attachment->initState() == InitState::MayNeedInit)
- {
- ANGLE_TRY(attachment->initializeContents(context));
- }
- return NoError();
-}
-
-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->getGLState().getBlendState());
- case GL_DEPTH:
- return IsDepthMaskedOut(context->getGLState().getDepthStencilState());
- case GL_STENCIL:
- return IsStencilMaskedOut(context->getGLState().getDepthStencilState());
- case GL_DEPTH_STENCIL:
- return IsDepthMaskedOut(context->getGLState().getDepthStencilState()) &&
- IsStencilMaskedOut(context->getGLState().getDepthStencilState());
- default:
- UNREACHABLE();
- return true;
- }
-}
-
-} // anonymous namespace
-
-// This constructor is only used for default framebuffers.
-FramebufferState::FramebufferState()
- : mLabel(),
- mColorAttachments(1),
- mDrawBufferStates(1, GL_BACK),
- mReadBufferState(GL_BACK),
- mDefaultWidth(0),
- mDefaultHeight(0),
- mDefaultSamples(0),
- mDefaultFixedSampleLocations(GL_FALSE),
- mWebGLDepthStencilConsistent(true)
-{
- ASSERT(mDrawBufferStates.size() > 0);
- mEnabledDrawBuffers.set(0);
-}
-
-FramebufferState::FramebufferState(const Caps &caps)
- : mLabel(),
- mColorAttachments(caps.maxColorAttachments),
- mDrawBufferStates(caps.maxDrawBuffers, GL_NONE),
- mReadBufferState(GL_COLOR_ATTACHMENT0_EXT),
- mDefaultWidth(0),
- mDefaultHeight(0),
- mDefaultSamples(0),
- mDefaultFixedSampleLocations(GL_FALSE),
- mWebGLDepthStencilConsistent(true)
-{
- ASSERT(mDrawBufferStates.size() > 0);
- mDrawBufferStates[0] = GL_COLOR_ATTACHMENT0_EXT;
-}
-
-FramebufferState::~FramebufferState()
-{
-}
-
-const std::string &FramebufferState::getLabel()
-{
- return mLabel;
-}
-
-const FramebufferAttachment *FramebufferState::getAttachment(GLenum attachment) const
-{
- if (attachment >= GL_COLOR_ATTACHMENT0 && attachment <= GL_COLOR_ATTACHMENT15)
- {
- return getColorAttachment(attachment - GL_COLOR_ATTACHMENT0);
- }
-
- switch (attachment)
- {
- case GL_COLOR:
- case GL_BACK:
- return getColorAttachment(0);
- case GL_DEPTH:
- case GL_DEPTH_ATTACHMENT:
- return getDepthAttachment();
- case GL_STENCIL:
- case GL_STENCIL_ATTACHMENT:
- return getStencilAttachment();
- case GL_DEPTH_STENCIL:
- case GL_DEPTH_STENCIL_ATTACHMENT:
- 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::getStencilAttachment() const
-{
- return mStencilAttachment.isAttached() ? &mStencilAttachment : 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);
-}
-
-const gl::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));
- return getAttachment(mDrawBufferStates[drawBufferIdx]);
- }
- 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 gl::FramebufferAttachment &firstAttachment = mColorAttachments[firstAttachmentIdx];
- if (!firstAttachment.isAttached())
- {
- continue;
- }
-
- for (size_t secondAttachmentIdx = firstAttachmentIdx + 1;
- secondAttachmentIdx < mColorAttachments.size(); secondAttachmentIdx++)
- {
- const gl::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);
-}
-
-GLsizei FramebufferState::getNumViews() const
-{
- const FramebufferAttachment *attachment = getFirstNonNullAttachment();
- if (attachment == nullptr)
- {
- return FramebufferAttachment::kDefaultNumViews;
- }
- return attachment->getNumViews();
-}
-
-const std::vector<Offset> *FramebufferState::getViewportOffsets() const
-{
- const FramebufferAttachment *attachment = getFirstNonNullAttachment();
- if (attachment == nullptr)
- {
- return nullptr;
- }
- return &attachment->getMultiviewViewportOffsets();
-}
-
-GLenum FramebufferState::getMultiviewLayout() const
-{
- const FramebufferAttachment *attachment = getFirstNonNullAttachment();
- if (attachment == nullptr)
- {
- return GL_NONE;
- }
- return attachment->getMultiviewLayout();
-}
-
-int FramebufferState::getBaseViewIndex() const
-{
- const FramebufferAttachment *attachment = getFirstNonNullAttachment();
- if (attachment == nullptr)
- {
- return GL_NONE;
- }
- return attachment->getBaseViewIndex();
-}
-
-Box FramebufferState::getDimensions() const
-{
- ASSERT(attachmentsHaveSameDimensions());
- ASSERT(getFirstNonNullAttachment() != nullptr);
- Extents extents = getFirstNonNullAttachment()->getSize();
- return Box(0, 0, 0, extents.width, extents.height, extents.depth);
-}
-
-Framebuffer::Framebuffer(const Caps &caps, rx::GLImplFactory *factory, GLuint id)
- : mState(caps),
- mImpl(factory->createFramebuffer(mState)),
- mId(id),
- mCachedStatus(),
- mDirtyDepthAttachmentBinding(this, DIRTY_BIT_DEPTH_ATTACHMENT),
- mDirtyStencilAttachmentBinding(this, DIRTY_BIT_STENCIL_ATTACHMENT)
-{
- ASSERT(mId != 0);
- 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 egl::Display *display, egl::Surface *surface)
- : mState(),
- mImpl(surface->getImplementation()->createDefaultFramebuffer(mState)),
- mId(0),
- 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);
-
- const Context *proxyContext = display->getProxyContext();
-
- setAttachmentImpl(proxyContext, GL_FRAMEBUFFER_DEFAULT, GL_BACK, gl::ImageIndex::MakeInvalid(),
- surface, FramebufferAttachment::kDefaultNumViews,
- FramebufferAttachment::kDefaultBaseViewIndex,
- FramebufferAttachment::kDefaultMultiviewLayout,
- FramebufferAttachment::kDefaultViewportOffsets);
-
- if (surface->getConfig()->depthSize > 0)
- {
- setAttachmentImpl(
- proxyContext, GL_FRAMEBUFFER_DEFAULT, GL_DEPTH, gl::ImageIndex::MakeInvalid(), surface,
- FramebufferAttachment::kDefaultNumViews, FramebufferAttachment::kDefaultBaseViewIndex,
- FramebufferAttachment::kDefaultMultiviewLayout,
- FramebufferAttachment::kDefaultViewportOffsets);
- }
-
- if (surface->getConfig()->stencilSize > 0)
- {
- setAttachmentImpl(proxyContext, GL_FRAMEBUFFER_DEFAULT, GL_STENCIL,
- gl::ImageIndex::MakeInvalid(), surface,
- FramebufferAttachment::kDefaultNumViews,
- FramebufferAttachment::kDefaultBaseViewIndex,
- FramebufferAttachment::kDefaultMultiviewLayout,
- FramebufferAttachment::kDefaultViewportOffsets);
- }
-}
-
-Framebuffer::Framebuffer(rx::GLImplFactory *factory)
- : mState(),
- mImpl(factory->createFramebuffer(mState)),
- mId(0),
- 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);
-}
-
-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::destroyDefault(const egl::Display *display)
-{
- mImpl->destroyDefault(display);
-}
-
-void Framebuffer::setLabel(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, DIRTY_BIT_COLOR_ATTACHMENT_0 + colorIndex))
- {
- found = true;
- }
- }
-
- if (context->isWebGL1())
- {
- const std::array<FramebufferAttachment *, 3> attachments = {
- {&mState.mWebGLDepthStencilAttachment, &mState.mWebGLDepthAttachment,
- &mState.mWebGLStencilAttachment}};
- for (FramebufferAttachment *attachment : attachments)
- {
- if (attachment->isAttached() && attachment->type() == resourceType &&
- attachment->id() == resourceId)
- {
- resetAttachment(context, attachment->getBinding());
- found = true;
- }
- }
- }
- else
- {
- if (detachMatchingAttachment(context, &mState.mDepthAttachment, resourceType, resourceId,
- DIRTY_BIT_DEPTH_ATTACHMENT))
- {
- found = true;
- }
- if (detachMatchingAttachment(context, &mState.mStencilAttachment, resourceType, resourceId,
- DIRTY_BIT_STENCIL_ATTACHMENT))
- {
- found = true;
- }
- }
-
- return found;
-}
-
-bool Framebuffer::detachMatchingAttachment(const Context *context,
- FramebufferAttachment *attachment,
- GLenum matchType,
- GLuint matchId,
- size_t dirtyBit)
-{
- if (attachment->isAttached() && attachment->type() == matchType && attachment->id() == matchId)
- {
- attachment->detach(context);
- mDirtyBits.set(dirtyBit);
- mState.mResourceNeedsInit.set(dirtyBit, false);
- return true;
- }
-
- return false;
-}
-
-const FramebufferAttachment *Framebuffer::getColorbuffer(size_t colorAttachment) const
-{
- return mState.getColorAttachment(colorAttachment);
-}
-
-const FramebufferAttachment *Framebuffer::getDepthbuffer() const
-{
- return mState.getDepthAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getStencilbuffer() const
-{
- return mState.getStencilAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getDepthStencilBuffer() const
-{
- return mState.getDepthStencilAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getDepthOrStencilbuffer() const
-{
- return mState.getDepthOrStencilAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getStencilOrDepthStencilAttachment() const
-{
- return mState.getStencilOrDepthStencilAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getReadColorbuffer() const
-{
- return mState.getReadAttachment();
-}
-
-GLenum Framebuffer::getReadColorbufferType() const
-{
- const FramebufferAttachment *readAttachment = mState.getReadAttachment();
- return (readAttachment != nullptr ? readAttachment->type() : GL_NONE);
-}
-
-const FramebufferAttachment *Framebuffer::getFirstColorbuffer() const
-{
- return mState.getFirstColorAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getFirstNonNullAttachment() const
-{
- return mState.getFirstNonNullAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
-{
- return mState.getAttachment(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();
- for (size_t index = 0; index < count; ++index)
- {
- 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);
-}
-
-GLenum Framebuffer::getDrawbufferWriteType(size_t drawBuffer) const
-{
- const FramebufferAttachment *attachment = mState.getDrawBuffer(drawBuffer);
- if (attachment == nullptr)
- {
- return GL_NONE;
- }
-
- GLenum componentType = attachment->getFormat().info->componentType;
- switch (componentType)
- {
- case GL_INT:
- case GL_UNSIGNED_INT:
- return componentType;
-
- default:
- return GL_FLOAT;
- }
-}
-
-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::getNumColorBuffers() 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 (mId != 0)
- {
- mCachedStatus.reset();
- }
-}
-
-GLenum Framebuffer::checkStatus(const Context *context)
-{
- // The default framebuffer is always complete except when it is surfaceless in which
- // case it is always unsupported. We return early because the default framebuffer may
- // not be subject to the same rules as application FBOs. ie, it could have 0x0 size.
- if (mId == 0)
- {
- ASSERT(mCachedStatus.valid());
- ASSERT(mCachedStatus.value() == GL_FRAMEBUFFER_COMPLETE ||
- mCachedStatus.value() == GL_FRAMEBUFFER_UNDEFINED_OES);
- return mCachedStatus.value();
- }
-
- if (hasAnyDirtyBit() || !mCachedStatus.valid())
- {
- mCachedStatus = checkStatusImpl(context);
- }
-
- return mCachedStatus.value();
-}
-
-GLenum Framebuffer::checkStatusImpl(const Context *context)
-{
- const ContextState &state = context->getContextState();
-
- ASSERT(mId != 0);
-
- bool hasAttachments = false;
- Optional<unsigned int> colorbufferSize;
- Optional<int> samples;
- Optional<bool> fixedSampleLocations;
- bool hasRenderbuffer = false;
-
- const FramebufferAttachment *firstAttachment = getFirstNonNullAttachment();
-
- 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_ANGLE;
- }
-
- hasRenderbuffer = hasRenderbuffer || (colorAttachment.type() == GL_RENDERBUFFER);
- hasAttachments = true;
- }
- }
-
- 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_ANGLE;
- }
-
- hasRenderbuffer = hasRenderbuffer || (depthAttachment.type() == GL_RENDERBUFFER);
- hasAttachments = true;
- }
-
- 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_ANGLE;
- }
-
- hasRenderbuffer = hasRenderbuffer || (stencilAttachment.type() == GL_RENDERBUFFER);
- hasAttachments = true;
- }
-
- // 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_ANGLE;
- }
- }
- 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;
- }
- }
-
- syncState(context);
- if (!mImpl->checkStatus(context))
- {
- return GL_FRAMEBUFFER_UNSUPPORTED;
- }
-
- return GL_FRAMEBUFFER_COMPLETE;
-}
-
-Error 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);
-}
-
-Error 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->getGLState();
-
- 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();
- ASSERT(depthStencil.stencilBackMask == depthStencil.stencilMask);
- if (stencil && depthStencil.stencilMask != depthStencil.stencilWritemask)
- {
- return true;
- }
-
- return false;
-}
-
-Error Framebuffer::invalidateSub(const Context *context,
- size_t count,
- const GLenum *attachments,
- const gl::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);
-}
-
-Error Framebuffer::clear(const gl::Context *context, GLbitfield mask)
-{
- const auto &glState = context->getGLState();
- if (glState.isRasterizerDiscardEnabled())
- {
- return NoError();
- }
-
- const auto &blend = glState.getBlendState();
- const auto &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 (partialClearNeedsInit(context, color, depth, stencil))
- {
- ANGLE_TRY(ensureDrawAttachmentsInitialized(context));
- }
-
- ANGLE_TRY(mImpl->clear(context, mask));
-
- if (glState.isRobustResourceInitEnabled())
- {
- markDrawAttachmentsInitialized(color, depth, stencil);
- }
-
- return NoError();
-}
-
-Error Framebuffer::clearBufferfv(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLfloat *values)
-{
- if (context->getGLState().isRasterizerDiscardEnabled() ||
- IsClearBufferMaskedOut(context, buffer))
- {
- return NoError();
- }
-
- if (partialBufferClearNeedsInit(context, buffer))
- {
- ANGLE_TRY(ensureBufferInitialized(context, buffer, drawbuffer));
- }
-
- ANGLE_TRY(mImpl->clearBufferfv(context, buffer, drawbuffer, values));
-
- if (context->isRobustResourceInitEnabled())
- {
- markBufferInitialized(buffer, drawbuffer);
- }
- return NoError();
-}
-
-Error Framebuffer::clearBufferuiv(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLuint *values)
-{
- if (context->getGLState().isRasterizerDiscardEnabled() ||
- IsClearBufferMaskedOut(context, buffer))
- {
- return NoError();
- }
-
- if (partialBufferClearNeedsInit(context, buffer))
- {
- ANGLE_TRY(ensureBufferInitialized(context, buffer, drawbuffer));
- }
-
- ANGLE_TRY(mImpl->clearBufferuiv(context, buffer, drawbuffer, values));
-
- if (context->isRobustResourceInitEnabled())
- {
- markBufferInitialized(buffer, drawbuffer);
- }
- return NoError();
-}
-
-Error Framebuffer::clearBufferiv(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLint *values)
-{
- if (context->getGLState().isRasterizerDiscardEnabled() ||
- IsClearBufferMaskedOut(context, buffer))
- {
- return NoError();
- }
-
- if (partialBufferClearNeedsInit(context, buffer))
- {
- ANGLE_TRY(ensureBufferInitialized(context, buffer, drawbuffer));
- }
-
- ANGLE_TRY(mImpl->clearBufferiv(context, buffer, drawbuffer, values));
-
- if (context->isRobustResourceInitEnabled())
- {
- markBufferInitialized(buffer, drawbuffer);
- }
- return NoError();
-}
-
-Error Framebuffer::clearBufferfi(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- GLfloat depth,
- GLint stencil)
-{
- if (context->getGLState().isRasterizerDiscardEnabled() ||
- IsClearBufferMaskedOut(context, buffer))
- {
- return NoError();
- }
-
- if (partialBufferClearNeedsInit(context, buffer))
- {
- ANGLE_TRY(ensureBufferInitialized(context, buffer, drawbuffer));
- }
-
- ANGLE_TRY(mImpl->clearBufferfi(context, buffer, drawbuffer, depth, stencil));
-
- if (context->isRobustResourceInitEnabled())
- {
- markBufferInitialized(buffer, drawbuffer);
- }
- return NoError();
-}
-
-GLenum Framebuffer::getImplementationColorReadFormat(const Context *context) const
-{
- return mImpl->getImplementationColorReadFormat(context);
-}
-
-GLenum Framebuffer::getImplementationColorReadType(const Context *context) const
-{
- return mImpl->getImplementationColorReadType(context);
-}
-
-Error Framebuffer::readPixels(const gl::Context *context,
- const Rectangle &area,
- GLenum format,
- GLenum type,
- void *pixels)
-{
- ANGLE_TRY(ensureReadAttachmentInitialized(context, GL_COLOR_BUFFER_BIT));
- ANGLE_TRY(mImpl->readPixels(context, area, format, type, pixels));
-
- Buffer *unpackBuffer = context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
- if (unpackBuffer)
- {
- unpackBuffer->onPixelUnpack();
- }
-
- return NoError();
-}
-
-Error Framebuffer::blit(const gl::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 NoError();
- }
-
- auto *sourceFBO = context->getGLState().getReadFramebuffer();
- ANGLE_TRY(sourceFBO->ensureReadAttachmentInitialized(context, blitMask));
-
- // TODO(jmadill): Only clear if not the full FBO dimensions, and only specified bitmask.
- ANGLE_TRY(ensureDrawAttachmentsInitialized(context));
-
- return mImpl->blit(context, sourceArea, destArea, blitMask, filter);
-}
-
-int Framebuffer::getSamples(const Context *context)
-{
- if (complete(context))
- {
- return getCachedSamples(context);
- }
-
- return 0;
-}
-
-int Framebuffer::getCachedSamples(const Context *context)
-{
- // 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;
-}
-
-Error Framebuffer::getSamplePosition(size_t index, GLfloat *xy) const
-{
- ANGLE_TRY(mImpl->getSamplePosition(index, xy));
- return NoError();
-}
-
-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,
- FramebufferAttachment::kDefaultMultiviewLayout,
- FramebufferAttachment::kDefaultViewportOffsets);
-}
-
-void Framebuffer::setAttachment(const Context *context,
- GLenum type,
- GLenum binding,
- const ImageIndex &textureIndex,
- FramebufferAttachmentObject *resource,
- GLsizei numViews,
- GLuint baseViewIndex,
- GLenum multiviewLayout,
- const GLint *viewportOffsets)
-{
- // Context may be null in unit tests.
- if (!context || !context->isWebGL1())
- {
- setAttachmentImpl(context, type, binding, textureIndex, resource, numViews, baseViewIndex,
- multiviewLayout, viewportOffsets);
- return;
- }
-
- switch (binding)
- {
- case GL_DEPTH_STENCIL:
- case GL_DEPTH_STENCIL_ATTACHMENT:
- mState.mWebGLDepthStencilAttachment.attach(context, type, binding, textureIndex,
- resource, numViews, baseViewIndex,
- multiviewLayout, viewportOffsets);
- break;
- case GL_DEPTH:
- case GL_DEPTH_ATTACHMENT:
- mState.mWebGLDepthAttachment.attach(context, type, binding, textureIndex, resource,
- numViews, baseViewIndex, multiviewLayout,
- viewportOffsets);
- break;
- case GL_STENCIL:
- case GL_STENCIL_ATTACHMENT:
- mState.mWebGLStencilAttachment.attach(context, type, binding, textureIndex, resource,
- numViews, baseViewIndex, multiviewLayout,
- viewportOffsets);
- break;
- default:
- setAttachmentImpl(context, type, binding, textureIndex, resource, numViews,
- baseViewIndex, multiviewLayout, viewportOffsets);
- return;
- }
-
- commitWebGL1DepthStencilIfConsistent(context, numViews, baseViewIndex, multiviewLayout,
- viewportOffsets);
-}
-
-void Framebuffer::setAttachmentMultiviewLayered(const Context *context,
- GLenum type,
- GLenum binding,
- const ImageIndex &textureIndex,
- FramebufferAttachmentObject *resource,
- GLsizei numViews,
- GLint baseViewIndex)
-{
- setAttachment(context, type, binding, textureIndex, resource, numViews, baseViewIndex,
- GL_FRAMEBUFFER_MULTIVIEW_LAYERED_ANGLE,
- FramebufferAttachment::kDefaultViewportOffsets);
-}
-
-void Framebuffer::setAttachmentMultiviewSideBySide(const Context *context,
- GLenum type,
- GLenum binding,
- const ImageIndex &textureIndex,
- FramebufferAttachmentObject *resource,
- GLsizei numViews,
- const GLint *viewportOffsets)
-{
- setAttachment(context, type, binding, textureIndex, resource, numViews,
- FramebufferAttachment::kDefaultBaseViewIndex,
- GL_FRAMEBUFFER_MULTIVIEW_SIDE_BY_SIDE_ANGLE, viewportOffsets);
-}
-
-void Framebuffer::commitWebGL1DepthStencilIfConsistent(const Context *context,
- GLsizei numViews,
- GLuint baseViewIndex,
- GLenum multiviewLayout,
- const GLint *viewportOffsets)
-{
- 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::MakeInvalid();
- }
- };
-
- if (mState.mWebGLDepthAttachment.isAttached())
- {
- const auto &depth = mState.mWebGLDepthAttachment;
- setAttachmentImpl(context, depth.type(), GL_DEPTH_ATTACHMENT,
- getImageIndexIfTextureAttachment(depth), depth.getResource(), numViews,
- baseViewIndex, multiviewLayout, viewportOffsets);
- setAttachmentImpl(context, GL_NONE, GL_STENCIL_ATTACHMENT, ImageIndex::MakeInvalid(),
- nullptr, numViews, baseViewIndex, multiviewLayout, viewportOffsets);
- }
- else if (mState.mWebGLStencilAttachment.isAttached())
- {
- const auto &stencil = mState.mWebGLStencilAttachment;
- setAttachmentImpl(context, GL_NONE, GL_DEPTH_ATTACHMENT, ImageIndex::MakeInvalid(), nullptr,
- numViews, baseViewIndex, multiviewLayout, viewportOffsets);
- setAttachmentImpl(context, stencil.type(), GL_STENCIL_ATTACHMENT,
- getImageIndexIfTextureAttachment(stencil), stencil.getResource(),
- numViews, baseViewIndex, multiviewLayout, viewportOffsets);
- }
- else if (mState.mWebGLDepthStencilAttachment.isAttached())
- {
- const auto &depthStencil = mState.mWebGLDepthStencilAttachment;
- setAttachmentImpl(context, depthStencil.type(), GL_DEPTH_ATTACHMENT,
- getImageIndexIfTextureAttachment(depthStencil),
- depthStencil.getResource(), numViews, baseViewIndex, multiviewLayout,
- viewportOffsets);
- setAttachmentImpl(context, depthStencil.type(), GL_STENCIL_ATTACHMENT,
- getImageIndexIfTextureAttachment(depthStencil),
- depthStencil.getResource(), numViews, baseViewIndex, multiviewLayout,
- viewportOffsets);
- }
- else
- {
- setAttachmentImpl(context, GL_NONE, GL_DEPTH_ATTACHMENT, ImageIndex::MakeInvalid(), nullptr,
- numViews, baseViewIndex, multiviewLayout, viewportOffsets);
- setAttachmentImpl(context, GL_NONE, GL_STENCIL_ATTACHMENT, ImageIndex::MakeInvalid(),
- nullptr, numViews, baseViewIndex, multiviewLayout, viewportOffsets);
- }
-}
-
-void Framebuffer::setAttachmentImpl(const Context *context,
- GLenum type,
- GLenum binding,
- const ImageIndex &textureIndex,
- FramebufferAttachmentObject *resource,
- GLsizei numViews,
- GLuint baseViewIndex,
- GLenum multiviewLayout,
- const GLint *viewportOffsets)
-{
- 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, multiviewLayout,
- viewportOffsets);
- updateAttachment(context, &mState.mStencilAttachment, DIRTY_BIT_STENCIL_ATTACHMENT,
- &mDirtyStencilAttachmentBinding, type, binding, textureIndex,
- attachmentObj, numViews, baseViewIndex, multiviewLayout,
- viewportOffsets);
- break;
- }
-
- case GL_DEPTH:
- case GL_DEPTH_ATTACHMENT:
- updateAttachment(context, &mState.mDepthAttachment, DIRTY_BIT_DEPTH_ATTACHMENT,
- &mDirtyDepthAttachmentBinding, type, binding, textureIndex, resource,
- numViews, baseViewIndex, multiviewLayout, viewportOffsets);
- break;
-
- case GL_STENCIL:
- case GL_STENCIL_ATTACHMENT:
- updateAttachment(context, &mState.mStencilAttachment, DIRTY_BIT_STENCIL_ATTACHMENT,
- &mDirtyStencilAttachmentBinding, type, binding, textureIndex, resource,
- numViews, baseViewIndex, multiviewLayout, viewportOffsets);
- break;
-
- case GL_BACK:
- mState.mColorAttachments[0].attach(context, type, binding, textureIndex, resource,
- numViews, baseViewIndex, multiviewLayout,
- viewportOffsets);
- mDirtyBits.set(DIRTY_BIT_COLOR_ATTACHMENT_0);
- // No need for a resource binding for the default FBO, it's always complete.
- 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, multiviewLayout,
- viewportOffsets);
-
- // 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);
- }
- break;
- }
-
- mAttachedTextures.reset();
-}
-
-void Framebuffer::updateAttachment(const Context *context,
- FramebufferAttachment *attachment,
- size_t dirtyBit,
- OnAttachmentDirtyBinding *onDirtyBinding,
- GLenum type,
- GLenum binding,
- const ImageIndex &textureIndex,
- FramebufferAttachmentObject *resource,
- GLsizei numViews,
- GLuint baseViewIndex,
- GLenum multiviewLayout,
- const GLint *viewportOffsets)
-{
- attachment->attach(context, type, binding, textureIndex, resource, numViews, baseViewIndex,
- multiviewLayout, viewportOffsets);
- mDirtyBits.set(dirtyBit);
- mState.mResourceNeedsInit.set(dirtyBit, attachment->initState() == InitState::MayNeedInit);
- BindResourceChannel(onDirtyBinding, resource);
-}
-
-void Framebuffer::resetAttachment(const Context *context, GLenum binding)
-{
- setAttachment(context, GL_NONE, binding, ImageIndex::MakeInvalid(), nullptr);
-}
-
-void Framebuffer::syncState(const Context *context)
-{
- if (mDirtyBits.any())
- {
- mImpl->syncState(context, mDirtyBits);
- mDirtyBits.reset();
- if (mId != 0)
- {
- mCachedStatus.reset();
- }
- }
-}
-
-void Framebuffer::signal(size_t dirtyBit, InitState state)
-{
- // TOOD(jmadill): Make this only update individual attachments to do less work.
- mCachedStatus.reset();
-
- // Mark the appropriate init flag.
- mState.mResourceNeedsInit.set(dirtyBit, state == InitState::MayNeedInit);
-}
-
-bool Framebuffer::complete(const Context *context)
-{
- return (checkStatus(context) == GL_FRAMEBUFFER_COMPLETE);
-}
-
-bool Framebuffer::cachedComplete() const
-{
- return (mCachedStatus.valid() && mCachedStatus == GL_FRAMEBUFFER_COMPLETE);
-}
-
-bool Framebuffer::formsRenderingFeedbackLoopWith(const State &state) const
-{
- const Program *program = state.getProgram();
-
- // TODO(jmadill): Default framebuffer feedback loops.
- if (mId == 0)
- {
- return false;
- }
-
- // The bitset will skip inactive draw buffers.
- for (size_t drawIndex : mState.mEnabledDrawBuffers)
- {
- const FramebufferAttachment &attachment = mState.mColorAttachments[drawIndex];
- ASSERT(attachment.isAttached());
- if (attachment.type() == GL_TEXTURE)
- {
- // Validate the feedback loop.
- if (program->samplesFromTexture(state, attachment.id()))
- {
- return true;
- }
- }
- }
-
- // Validate depth-stencil feedback loop.
- const auto &dsState = state.getDepthStencilState();
-
- // We can skip the feedback loop checks if depth/stencil is masked out or disabled.
- const FramebufferAttachment *depth = getDepthbuffer();
- if (depth && depth->type() == GL_TEXTURE && dsState.depthTest && dsState.depthMask)
- {
- if (program->samplesFromTexture(state, depth->id()))
- {
- return true;
- }
- }
-
- // Note: we assume the front and back masks are the same for WebGL.
- const FramebufferAttachment *stencil = getStencilbuffer();
- ASSERT(dsState.stencilBackWritemask == dsState.stencilWritemask);
- if (stencil && stencil->type() == GL_TEXTURE && dsState.stencilTest &&
- dsState.stencilWritemask != 0)
- {
- // Skip the feedback loop check if depth/stencil point to the same resource.
- if (!depth || *stencil != *depth)
- {
- if (program->samplesFromTexture(state, stencil->id()))
- {
- return true;
- }
- }
- }
-
- return false;
-}
-
-bool Framebuffer::formsCopyingFeedbackLoopWith(GLuint copyTextureID,
- GLint copyTextureLevel,
- GLint copyTextureLayer) const
-{
- if (mId == 0)
- {
- // It seems impossible to form a texture copying feedback loop with the default FBO.
- return false;
- }
-
- const FramebufferAttachment *readAttachment = getReadColorbuffer();
- ASSERT(readAttachment);
-
- if (readAttachment->isTextureWithId(copyTextureID))
- {
- const auto &imageIndex = readAttachment->getTextureImageIndex();
- if (imageIndex.mipIndex == copyTextureLevel)
- {
- // Check 3D/Array texture layers.
- return imageIndex.layerIndex == ImageIndex::ENTIRE_LEVEL ||
- copyTextureLayer == ImageIndex::ENTIRE_LEVEL ||
- imageIndex.layerIndex == 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();
-}
-
-void Framebuffer::setDefaultWidth(GLint defaultWidth)
-{
- mState.mDefaultWidth = defaultWidth;
- mDirtyBits.set(DIRTY_BIT_DEFAULT_WIDTH);
-}
-
-void Framebuffer::setDefaultHeight(GLint defaultHeight)
-{
- mState.mDefaultHeight = defaultHeight;
- mDirtyBits.set(DIRTY_BIT_DEFAULT_HEIGHT);
-}
-
-void Framebuffer::setDefaultSamples(GLint defaultSamples)
-{
- mState.mDefaultSamples = defaultSamples;
- mDirtyBits.set(DIRTY_BIT_DEFAULT_SAMPLES);
-}
-
-void Framebuffer::setDefaultFixedSampleLocations(bool defaultFixedSampleLocations)
-{
- mState.mDefaultFixedSampleLocations = defaultFixedSampleLocations;
- mDirtyBits.set(DIRTY_BIT_DEFAULT_FIXED_SAMPLE_LOCATIONS);
-}
-
-// TODO(jmadill): Remove this kludge.
-GLenum Framebuffer::checkStatus(const ValidationContext *context)
-{
- return checkStatus(static_cast<const Context *>(context));
-}
-
-int Framebuffer::getSamples(const ValidationContext *context)
-{
- return getSamples(static_cast<const Context *>(context));
-}
-
-GLsizei Framebuffer::getNumViews() const
-{
- return mState.getNumViews();
-}
-
-GLint Framebuffer::getBaseViewIndex() const
-{
- return mState.getBaseViewIndex();
-}
-
-const std::vector<Offset> *Framebuffer::getViewportOffsets() const
-{
- return mState.getViewportOffsets();
-}
-
-GLenum Framebuffer::getMultiviewLayout() const
-{
- return mState.getMultiviewLayout();
-}
-
-Error Framebuffer::ensureDrawAttachmentsInitialized(const Context *context)
-{
- if (!context->isRobustResourceInitEnabled())
- {
- return NoError();
- }
-
- // 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 NoError();
-}
-
-Error Framebuffer::ensureReadAttachmentInitialized(const Context *context, GLbitfield blitMask)
-{
- if (!context->isRobustResourceInitEnabled() || mState.mResourceNeedsInit.none())
- {
- return NoError();
- }
-
- if ((blitMask & GL_COLOR_BUFFER_BIT) != 0 && mState.mReadBufferState != GL_NONE)
- {
- size_t readIndex = mState.getReadIndex();
- if (mState.mResourceNeedsInit[readIndex])
- {
- ANGLE_TRY(InitAttachment(context, &mState.mColorAttachments[readIndex]));
- mState.mResourceNeedsInit.reset(readIndex);
- }
- }
-
- if ((blitMask & GL_DEPTH_BUFFER_BIT) != 0 && hasDepth())
- {
- if (mState.mResourceNeedsInit[DIRTY_BIT_DEPTH_ATTACHMENT])
- {
- ANGLE_TRY(InitAttachment(context, &mState.mDepthAttachment));
- mState.mResourceNeedsInit.reset(DIRTY_BIT_DEPTH_ATTACHMENT);
- }
- }
-
- if ((blitMask & GL_STENCIL_BUFFER_BIT) != 0 && hasStencil())
- {
- if (mState.mResourceNeedsInit[DIRTY_BIT_STENCIL_ATTACHMENT])
- {
- ANGLE_TRY(InitAttachment(context, &mState.mStencilAttachment));
- mState.mResourceNeedsInit.reset(DIRTY_BIT_STENCIL_ATTACHMENT);
- }
- }
-
- return NoError();
-}
-
-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();
-}
-
-Error Framebuffer::ensureBufferInitialized(const Context *context,
- GLenum bufferType,
- GLint bufferIndex)
-{
- ASSERT(context->isRobustResourceInitEnabled());
-
- if (mState.mResourceNeedsInit.none())
- {
- return NoError();
- }
-
- 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 NoError();
-}
-
-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;
- }
-}
-
-bool Framebuffer::hasTextureAttachment(const Texture *texture) const
-{
- if (!mAttachedTextures.valid())
- {
- std::set<const FramebufferAttachmentObject *> attachedTextures;
-
- for (const auto &colorAttachment : mState.mColorAttachments)
- {
- if (colorAttachment.isAttached() && colorAttachment.type() == GL_TEXTURE)
- {
- attachedTextures.insert(colorAttachment.getResource());
- }
- }
-
- if (mState.mDepthAttachment.isAttached() && mState.mDepthAttachment.type() == GL_TEXTURE)
- {
- attachedTextures.insert(mState.mDepthAttachment.getResource());
- }
-
- if (mState.mStencilAttachment.isAttached() &&
- mState.mStencilAttachment.type() == GL_TEXTURE)
- {
- attachedTextures.insert(mState.mStencilAttachment.getResource());
- }
-
- mAttachedTextures = std::move(attachedTextures);
- }
-
- return (mAttachedTextures.value().count(texture) > 0);
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Framebuffer.h b/src/3rdparty/angle/src/libANGLE/Framebuffer.h
deleted file mode 100644
index 70223f0bc7..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Framebuffer.h
+++ /dev/null
@@ -1,389 +0,0 @@
-//
-// 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/Optional.h"
-#include "common/angleutils.h"
-#include "libANGLE/Constants.h"
-#include "libANGLE/Debug.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/FramebufferAttachment.h"
-#include "libANGLE/RefCountObject.h"
-#include "libANGLE/signal_utils.h"
-
-namespace rx
-{
-class GLImplFactory;
-class FramebufferImpl;
-class RenderbufferImpl;
-class SurfaceImpl;
-}
-
-namespace egl
-{
-class Display;
-class Surface;
-}
-
-namespace gl
-{
-class Context;
-class ContextState;
-class Framebuffer;
-class Renderbuffer;
-class State;
-class Texture;
-class TextureCapsMap;
-class ValidationContext;
-struct Caps;
-struct Extensions;
-struct ImageIndex;
-struct Rectangle;
-
-class FramebufferState final : angle::NonCopyable
-{
- public:
- FramebufferState();
- explicit FramebufferState(const Caps &caps);
- ~FramebufferState();
-
- const std::string &getLabel();
- size_t getReadIndex() const;
-
- const FramebufferAttachment *getAttachment(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 colorAttachmentsAreUniqueImages() const;
- Box getDimensions() 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; };
-
- bool hasDepth() const;
- bool hasStencil() const;
-
- GLenum getMultiviewLayout() const;
- GLsizei getNumViews() const;
- const std::vector<Offset> *getViewportOffsets() const;
- GLint getBaseViewIndex() const;
-
- private:
- friend class Framebuffer;
-
- std::string mLabel;
-
- std::vector<FramebufferAttachment> mColorAttachments;
- FramebufferAttachment mDepthAttachment;
- FramebufferAttachment mStencilAttachment;
-
- std::vector<GLenum> mDrawBufferStates;
- GLenum mReadBufferState;
- DrawBufferMask mEnabledDrawBuffers;
-
- GLint mDefaultWidth;
- GLint mDefaultHeight;
- GLint mDefaultSamples;
- bool mDefaultFixedSampleLocations;
-
- // 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 LabeledObject, public OnAttachmentDirtyReceiver
-{
- public:
- // Constructor to build application-defined framebuffers
- Framebuffer(const Caps &caps, rx::GLImplFactory *factory, GLuint id);
- // Constructor to build default framebuffers for a surface
- Framebuffer(const egl::Display *display, egl::Surface *surface);
- // Constructor to build a fake default framebuffer when surfaceless
- Framebuffer(rx::GLImplFactory *factory);
-
- ~Framebuffer() override;
- void onDestroy(const Context *context);
- void destroyDefault(const egl::Display *display);
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- rx::FramebufferImpl *getImplementation() const { return mImpl; }
-
- GLuint id() const { return mId; }
-
- void setAttachment(const Context *context,
- GLenum type,
- GLenum binding,
- const ImageIndex &textureIndex,
- FramebufferAttachmentObject *resource);
- void setAttachmentMultiviewLayered(const Context *context,
- GLenum type,
- GLenum binding,
- const ImageIndex &textureIndex,
- FramebufferAttachmentObject *resource,
- GLsizei numViews,
- GLint baseViewIndex);
- void setAttachmentMultiviewSideBySide(const Context *context,
- GLenum type,
- GLenum binding,
- const ImageIndex &textureIndex,
- FramebufferAttachmentObject *resource,
- GLsizei numViews,
- const GLint *viewportOffsets);
- void resetAttachment(const Context *context, GLenum binding);
-
- bool detachTexture(const Context *context, GLuint texture);
- bool detachRenderbuffer(const Context *context, GLuint renderbuffer);
-
- const FramebufferAttachment *getColorbuffer(size_t colorAttachment) const;
- const FramebufferAttachment *getDepthbuffer() const;
- const FramebufferAttachment *getStencilbuffer() const;
- const FramebufferAttachment *getDepthStencilBuffer() const;
- const FramebufferAttachment *getDepthOrStencilbuffer() const;
- const FramebufferAttachment *getStencilOrDepthStencilAttachment() const;
- const FramebufferAttachment *getReadColorbuffer() const;
- GLenum getReadColorbufferType() const;
- const FramebufferAttachment *getFirstColorbuffer() const;
- const FramebufferAttachment *getFirstNonNullAttachment() const;
-
- const FramebufferAttachment *getAttachment(GLenum attachment) const;
- GLenum getMultiviewLayout() const;
- GLsizei getNumViews() const;
- GLint getBaseViewIndex() const;
- const std::vector<Offset> *getViewportOffsets() 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;
- GLenum getDrawbufferWriteType(size_t drawBuffer) const;
- bool hasEnabledDrawBuffer() const;
-
- GLenum getReadBufferState() const;
- void setReadBuffer(GLenum buffer);
-
- size_t getNumColorBuffers() const;
- bool hasDepth() const;
- bool hasStencil() const;
-
- bool usingExtendedDrawBuffers() const;
-
- // This method calls checkStatus.
- int getSamples(const Context *context);
-
- Error getSamplePosition(size_t index, GLfloat *xy) const;
-
- GLint getDefaultWidth() const;
- GLint getDefaultHeight() const;
- GLint getDefaultSamples() const;
- bool getDefaultFixedSampleLocations() const;
- void setDefaultWidth(GLint defaultWidth);
- void setDefaultHeight(GLint defaultHeight);
- void setDefaultSamples(GLint defaultSamples);
- void setDefaultFixedSampleLocations(bool defaultFixedSampleLocations);
-
- void invalidateCompletenessCache();
-
- GLenum checkStatus(const Context *context);
-
- // TODO(jmadill): Remove this kludge.
- GLenum checkStatus(const ValidationContext *context);
- int getSamples(const ValidationContext *context);
-
- // For when we don't want to check completeness in getSamples().
- int getCachedSamples(const Context *context);
-
- // Helper for checkStatus == GL_FRAMEBUFFER_COMPLETE.
- bool complete(const Context *context);
- bool cachedComplete() const;
-
- bool hasValidDepthStencil() const;
-
- Error discard(const Context *context, size_t count, const GLenum *attachments);
- Error invalidate(const Context *context, size_t count, const GLenum *attachments);
- Error invalidateSub(const Context *context,
- size_t count,
- const GLenum *attachments,
- const gl::Rectangle &area);
-
- Error clear(const gl::Context *context, GLbitfield mask);
- Error clearBufferfv(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLfloat *values);
- Error clearBufferuiv(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLuint *values);
- Error clearBufferiv(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLint *values);
- Error clearBufferfi(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- GLfloat depth,
- GLint stencil);
-
- GLenum getImplementationColorReadFormat(const Context *context) const;
- GLenum getImplementationColorReadType(const Context *context) const;
- Error readPixels(const gl::Context *context,
- const gl::Rectangle &area,
- GLenum format,
- GLenum type,
- void *pixels);
-
- Error blit(const gl::Context *context,
- const Rectangle &sourceArea,
- const Rectangle &destArea,
- GLbitfield mask,
- GLenum filter);
-
- enum DirtyBitType : size_t
- {
- DIRTY_BIT_COLOR_ATTACHMENT_0,
- DIRTY_BIT_COLOR_ATTACHMENT_MAX =
- DIRTY_BIT_COLOR_ATTACHMENT_0 + gl::IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS,
- DIRTY_BIT_DEPTH_ATTACHMENT = DIRTY_BIT_COLOR_ATTACHMENT_MAX,
- DIRTY_BIT_STENCIL_ATTACHMENT,
- 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_UNKNOWN,
- DIRTY_BIT_MAX = DIRTY_BIT_UNKNOWN
- };
-
- typedef angle::BitSet<DIRTY_BIT_MAX> DirtyBits;
- bool hasAnyDirtyBit() const { return mDirtyBits.any(); }
-
- void syncState(const Context *context);
-
- // OnAttachmentChangedReceiver implementation
- void signal(size_t dirtyBit, InitState state) override;
-
- bool formsRenderingFeedbackLoopWith(const State &state) const;
- bool formsCopyingFeedbackLoopWith(GLuint copyTextureID,
- GLint copyTextureLevel,
- GLint copyTextureLayer) const;
-
- Error ensureDrawAttachmentsInitialized(const Context *context);
- Error ensureReadAttachmentInitialized(const Context *context, GLbitfield blitMask);
- Box getDimensions() const;
-
- bool hasTextureAttachment(const Texture *texture) const;
-
- private:
- bool detachResourceById(const Context *context, GLenum resourceType, GLuint resourceId);
- bool detachMatchingAttachment(const Context *context,
- FramebufferAttachment *attachment,
- GLenum matchType,
- GLuint matchId,
- size_t dirtyBit);
- GLenum checkStatusImpl(const Context *context);
- void setAttachment(const Context *context,
- GLenum type,
- GLenum binding,
- const ImageIndex &textureIndex,
- FramebufferAttachmentObject *resource,
- GLsizei numViews,
- GLuint baseViewIndex,
- GLenum multiviewLayout,
- const GLint *viewportOffsets);
- void commitWebGL1DepthStencilIfConsistent(const Context *context,
- GLsizei numViews,
- GLuint baseViewIndex,
- GLenum multiviewLayout,
- const GLint *viewportOffsets);
- void setAttachmentImpl(const Context *context,
- GLenum type,
- GLenum binding,
- const ImageIndex &textureIndex,
- FramebufferAttachmentObject *resource,
- GLsizei numViews,
- GLuint baseViewIndex,
- GLenum multiviewLayout,
- const GLint *viewportOffsets);
- void updateAttachment(const Context *context,
- FramebufferAttachment *attachment,
- size_t dirtyBit,
- OnAttachmentDirtyBinding *onDirtyBinding,
- GLenum type,
- GLenum binding,
- const ImageIndex &textureIndex,
- FramebufferAttachmentObject *resource,
- GLsizei numViews,
- GLuint baseViewIndex,
- GLenum multiviewLayout,
- const GLint *viewportOffsets);
-
- void markDrawAttachmentsInitialized(bool color, bool depth, bool stencil);
- void markBufferInitialized(GLenum bufferType, GLint bufferIndex);
- Error 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);
-
- FramebufferState mState;
- rx::FramebufferImpl *mImpl;
- GLuint mId;
-
- Optional<GLenum> mCachedStatus;
- std::vector<OnAttachmentDirtyBinding> mDirtyColorAttachmentBindings;
- OnAttachmentDirtyBinding mDirtyDepthAttachmentBinding;
- OnAttachmentDirtyBinding mDirtyStencilAttachmentBinding;
-
- DirtyBits mDirtyBits;
-
- // A cache of attached textures for quick validation of feedback loops.
- mutable Optional<std::set<const FramebufferAttachmentObject *>> mAttachedTextures;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_FRAMEBUFFER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/FramebufferAttachment.cpp b/src/3rdparty/angle/src/libANGLE/FramebufferAttachment.cpp
deleted file mode 100644
index cf6bd9c264..0000000000
--- a/src/3rdparty/angle/src/libANGLE/FramebufferAttachment.cpp
+++ /dev/null
@@ -1,385 +0,0 @@
-//
-// 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
-{
-
-namespace
-{
-
-std::vector<Offset> TransformViewportOffsetArrayToVectorOfOffsets(const GLint *viewportOffsets,
- GLsizei numViews)
-{
- const size_t numViewsAsSizeT = static_cast<size_t>(numViews);
- std::vector<Offset> offsetVector;
- offsetVector.reserve(numViewsAsSizeT);
- for (size_t i = 0u; i < numViewsAsSizeT; ++i)
- {
- offsetVector.emplace_back(Offset(viewportOffsets[i * 2u], viewportOffsets[i * 2u + 1u], 0));
- }
- return offsetVector;
-}
-
-} // namespace
-
-////// FramebufferAttachment::Target Implementation //////
-
-const GLsizei FramebufferAttachment::kDefaultNumViews = 1;
-const GLenum FramebufferAttachment::kDefaultMultiviewLayout = GL_NONE;
-const GLint FramebufferAttachment::kDefaultBaseViewIndex = 0;
-const GLint FramebufferAttachment::kDefaultViewportOffsets[2] = {0};
-
-std::vector<Offset> FramebufferAttachment::GetDefaultViewportOffsetVector()
-{
- return TransformViewportOffsetArrayToVectorOfOffsets(
- FramebufferAttachment::kDefaultViewportOffsets, FramebufferAttachment::kDefaultNumViews);
-}
-
-FramebufferAttachment::Target::Target()
- : mBinding(GL_NONE),
- mTextureIndex(ImageIndex::MakeInvalid())
-{
-}
-
-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),
- mMultiviewLayout(kDefaultMultiviewLayout),
- mBaseViewIndex(kDefaultBaseViewIndex),
- mViewportOffsets(GetDefaultViewportOffsetVector())
-{
-}
-
-FramebufferAttachment::FramebufferAttachment(const Context *context,
- GLenum type,
- GLenum binding,
- const ImageIndex &textureIndex,
- FramebufferAttachmentObject *resource)
- : mResource(nullptr)
-{
- attach(context, type, binding, textureIndex, resource, kDefaultNumViews, kDefaultBaseViewIndex,
- kDefaultMultiviewLayout, kDefaultViewportOffsets);
-}
-
-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(mMultiviewLayout, other.mMultiviewLayout);
- std::swap(mBaseViewIndex, other.mBaseViewIndex);
- std::swap(mViewportOffsets, other.mViewportOffsets);
- 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;
- mMultiviewLayout = kDefaultMultiviewLayout;
- mBaseViewIndex = kDefaultBaseViewIndex;
- mViewportOffsets = GetDefaultViewportOffsetVector();
-
- // 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,
- GLenum multiviewLayout,
- const GLint *viewportOffsets)
-{
- if (resource == nullptr)
- {
- detach(context);
- return;
- }
-
- mType = type;
- mTarget = Target(binding, textureIndex);
- mNumViews = numViews;
- mBaseViewIndex = baseViewIndex;
- mMultiviewLayout = multiviewLayout;
- if (multiviewLayout == GL_FRAMEBUFFER_MULTIVIEW_SIDE_BY_SIDE_ANGLE)
- {
- mViewportOffsets = TransformViewportOffsetArrayToVectorOfOffsets(viewportOffsets, numViews);
- }
- else
- {
- mViewportOffsets = GetDefaultViewportOffsetVector();
- }
- 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();
-}
-
-const ImageIndex &FramebufferAttachment::getTextureImageIndex() const
-{
- ASSERT(type() == GL_TEXTURE);
- return mTarget.textureIndex();
-}
-
-GLenum FramebufferAttachment::cubeMapFace() const
-{
- ASSERT(mType == GL_TEXTURE);
-
- const auto &index = mTarget.textureIndex();
- return IsCubeMapTextureTarget(index.type) ? index.type : GL_NONE;
-}
-
-GLint FramebufferAttachment::mipLevel() const
-{
- ASSERT(type() == GL_TEXTURE);
- return mTarget.textureIndex().mipIndex;
-}
-
-GLint FramebufferAttachment::layer() const
-{
- ASSERT(mType == GL_TEXTURE);
-
- const auto &index = mTarget.textureIndex();
-
- if (index.type == GL_TEXTURE_2D_ARRAY || index.type == GL_TEXTURE_3D)
- {
- return index.layerIndex;
- }
- return 0;
-}
-
-GLsizei FramebufferAttachment::getNumViews() const
-{
- return mNumViews;
-}
-
-GLenum FramebufferAttachment::getMultiviewLayout() const
-{
- return mMultiviewLayout;
-}
-
-GLint FramebufferAttachment::getBaseViewIndex() const
-{
- return mBaseViewIndex;
-}
-
-const std::vector<Offset> &FramebufferAttachment::getMultiviewViewportOffsets() const
-{
- return mViewportOffsets;
-}
-
-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 ||
- mMultiviewLayout != other.mMultiviewLayout || mBaseViewIndex != other.mBaseViewIndex ||
- mViewportOffsets != other.mViewportOffsets)
- {
- 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;
-}
-
-Error FramebufferAttachment::initializeContents(const Context *context)
-{
- ASSERT(mResource);
- ANGLE_TRY(mResource->initializeContents(context, mTarget.textureIndex()));
- setInitState(InitState::Initialized);
- return NoError();
-}
-
-void FramebufferAttachment::setInitState(InitState initState) const
-{
- ASSERT(mResource);
- mResource->setInitState(mTarget.textureIndex(), initState);
-}
-
-////// FramebufferAttachmentObject Implementation //////
-
-FramebufferAttachmentObject::FramebufferAttachmentObject()
-{
-}
-
-FramebufferAttachmentObject::~FramebufferAttachmentObject()
-{
-}
-
-Error FramebufferAttachmentObject::getAttachmentRenderTarget(
- const Context *context,
- GLenum binding,
- const ImageIndex &imageIndex,
- rx::FramebufferAttachmentRenderTarget **rtOut) const
-{
- return getAttachmentImpl()->getAttachmentRenderTarget(context, binding, imageIndex, rtOut);
-}
-
-OnAttachmentDirtyChannel *FramebufferAttachmentObject::getDirtyChannel()
-{
- return &mDirtyChannel;
-}
-
-Error 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.type == GL_TEXTURE_2D_ARRAY && imageIndex.hasLayer())
- {
- ImageIndex fullMipIndex = imageIndex;
- fullMipIndex.layerIndex = ImageIndex::ENTIRE_LEVEL;
- return getAttachmentImpl()->initializeContents(context, fullMipIndex);
- }
- else
- {
- return getAttachmentImpl()->initializeContents(context, imageIndex);
- }
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/FramebufferAttachment.h b/src/3rdparty/angle/src/libANGLE/FramebufferAttachment.h
deleted file mode 100644
index 5c0553a1d4..0000000000
--- a/src/3rdparty/angle/src/libANGLE/FramebufferAttachment.h
+++ /dev/null
@@ -1,250 +0,0 @@
-//
-// 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/angletypes.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/ImageIndex.h"
-#include "libANGLE/signal_utils.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 gl
-{
-class FramebufferAttachmentObject;
-struct Format;
-class Renderbuffer;
-class Texture;
-
-enum class InitState
-{
- MayNeedInit,
- Initialized,
-};
-
-using OnAttachmentDirtyBinding = angle::ChannelBinding<size_t, InitState>;
-using OnAttachmentDirtyChannel = angle::BroadcastChannel<size_t, InitState>;
-using OnAttachmentDirtyReceiver = angle::SignalReceiver<size_t, InitState>;
-
-// 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,
- GLenum multiviewLayout,
- const GLint *viewportOffsets);
-
- // 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;
- GLenum cubeMapFace() const;
- GLint mipLevel() const;
- GLint layer() const;
- GLsizei getNumViews() const;
- GLenum getMultiviewLayout() const;
- GLint getBaseViewIndex() const;
- const std::vector<Offset> &getMultiviewViewportOffsets() 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;
- const Format &getFormat() const;
- GLsizei getSamples() const;
- GLenum type() const { return mType; }
- bool isAttached() const { return mType != GL_NONE; }
-
- Renderbuffer *getRenderbuffer() const;
- Texture *getTexture() const;
- const egl::Surface *getSurface() const;
- FramebufferAttachmentObject *getResource() const;
- InitState initState() const;
- Error initializeContents(const Context *context);
- void setInitState(InitState initState) const;
-
- // "T" must be static_castable from FramebufferAttachmentRenderTarget
- template <typename T>
- gl::Error 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 std::vector<Offset> GetDefaultViewportOffsetVector();
- static const GLsizei kDefaultNumViews;
- static const GLenum kDefaultMultiviewLayout;
- static const GLint kDefaultBaseViewIndex;
- static const GLint kDefaultViewportOffsets[2];
-
- private:
- gl::Error 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;
- GLenum mMultiviewLayout;
- GLint mBaseViewIndex;
- std::vector<Offset> mViewportOffsets;
-};
-
-// A base class for objects that FBO Attachments may point to.
-class FramebufferAttachmentObject
-{
- public:
- FramebufferAttachmentObject();
- virtual ~FramebufferAttachmentObject();
-
- virtual Extents getAttachmentSize(const ImageIndex &imageIndex) const = 0;
- virtual const Format &getAttachmentFormat(GLenum binding,
- const ImageIndex &imageIndex) const = 0;
- virtual GLsizei getAttachmentSamples(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;
-
- Error getAttachmentRenderTarget(const Context *context,
- GLenum binding,
- const ImageIndex &imageIndex,
- rx::FramebufferAttachmentRenderTarget **rtOut) const;
-
- Error initializeContents(const Context *context, const ImageIndex &imageIndex);
-
- OnAttachmentDirtyChannel *getDirtyChannel();
-
- protected:
- virtual rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const = 0;
-
- OnAttachmentDirtyChannel mDirtyChannel;
-};
-
-inline Extents FramebufferAttachment::getSize() const
-{
- ASSERT(mResource);
- return mResource->getAttachmentSize(mTarget.textureIndex());
-}
-
-inline const 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 gl::Error FramebufferAttachment::getRenderTargetImpl(
- const Context *context,
- rx::FramebufferAttachmentRenderTarget **rtOut) const
-{
- ASSERT(mResource);
- return mResource->getAttachmentRenderTarget(context, mTarget.binding(), mTarget.textureIndex(),
- rtOut);
-}
-
-} // namespace gl
-
-#endif // LIBANGLE_FRAMEBUFFERATTACHMENT_H_
diff --git a/src/3rdparty/angle/src/libANGLE/HandleAllocator.cpp b/src/3rdparty/angle/src/libANGLE/HandleAllocator.cpp
deleted file mode 100644
index c3c184258f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/HandleAllocator.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// HandleAllocator.cpp: Implements the gl::HandleAllocator class, which is used
-// to allocate GL handles.
-
-#include "libANGLE/HandleAllocator.h"
-
-#include <algorithm>
-
-#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)
-{
- mUnallocatedList.push_back(HandleRange(1, std::numeric_limits<GLuint>::max()));
-}
-
-HandleAllocator::HandleAllocator(GLuint maximumHandleValue) : mBaseValue(1), mNextValue(1)
-{
- mUnallocatedList.push_back(HandleRange(1, maximumHandleValue));
-}
-
-HandleAllocator::~HandleAllocator()
-{
-}
-
-void HandleAllocator::setBaseHandle(GLuint value)
-{
- ASSERT(mBaseValue == mNextValue);
- mBaseValue = value;
- mNextValue = value;
-}
-
-GLuint HandleAllocator::allocate()
-{
- ASSERT(!mUnallocatedList.empty() || !mReleasedList.empty());
-
- // Allocate from released list, logarithmic time for pop_heap.
- if (!mReleasedList.empty())
- {
- std::pop_heap(mReleasedList.begin(), mReleasedList.end());
- GLuint reusedHandle = mReleasedList.back();
- mReleasedList.pop_back();
- 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++;
- }
-
- return freeListHandle;
-}
-
-void HandleAllocator::release(GLuint handle)
-{
- // Add to released list, logarithmic time for push_heap.
- mReleasedList.push_back(handle);
- std::push_heap(mReleasedList.begin(), mReleasedList.end());
-}
-
-void HandleAllocator::reserve(GLuint handle)
-{
- // Clear from released list -- might be a slow operation.
- if (!mReleasedList.empty())
- {
- auto releasedIt = std::find(mReleasedList.begin(), mReleasedList.end(), handle);
- if (releasedIt != mReleasedList.end())
- {
- mReleasedList.erase(releasedIt);
- return;
- }
- }
-
- // Not in released list, reserve in the unallocated list.
- auto boundIt = std::lower_bound(mUnallocatedList.begin(), mUnallocatedList.end(), handle, HandleRangeComparator());
-
- ASSERT(boundIt != mUnallocatedList.end());
-
- GLuint begin = boundIt->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;
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/HandleAllocator.h b/src/3rdparty/angle/src/libANGLE/HandleAllocator.h
deleted file mode 100644
index cd21d687f4..0000000000
--- a/src/3rdparty/angle/src/libANGLE/HandleAllocator.h
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// HandleAllocator.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();
-
- 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;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_HANDLEALLOCATOR_H_
diff --git a/src/3rdparty/angle/src/libANGLE/HandleRangeAllocator.cpp b/src/3rdparty/angle/src/libANGLE/HandleRangeAllocator.cpp
deleted file mode 100644
index 2a97ce939f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/HandleRangeAllocator.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/HandleRangeAllocator.h b/src/3rdparty/angle/src/libANGLE/HandleRangeAllocator.h
deleted file mode 100644
index 4d4b6f4f69..0000000000
--- a/src/3rdparty/angle/src/libANGLE/HandleRangeAllocator.h
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/Image.cpp b/src/3rdparty/angle/src/libANGLE/Image.cpp
deleted file mode 100644
index 04c757c2c4..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Image.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-//
-// 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/angletypes.h"
-#include "libANGLE/formatutils.h"
-#include "libANGLE/Texture.h"
-#include "libANGLE/Renderbuffer.h"
-#include "libANGLE/renderer/EGLImplFactory.h"
-#include "libANGLE/renderer/ImageImpl.h"
-
-namespace egl
-{
-
-namespace
-{
-gl::ImageIndex GetImageIndex(EGLenum eglTarget, const egl::AttributeMap &attribs)
-{
- if (eglTarget == EGL_GL_RENDERBUFFER)
- {
- return gl::ImageIndex::MakeInvalid();
- }
-
- GLenum target = egl_gl::EGLImageTargetToGLTextureTarget(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_TEXTURE_3D)
- {
- return gl::ImageIndex::Make3D(mip, layer);
- }
- else
- {
- ASSERT(layer == 0);
- return gl::ImageIndex::MakeGeneric(target, mip);
- }
-}
-} // anonymous namespace
-
-ImageSibling::ImageSibling(GLuint id)
- : RefCountObject(id), 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(context, imageTarget);
- imageTarget->addTargetSibling(this);
-}
-
-gl::Error 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(context, nullptr);
- }
- else
- {
- for (egl::Image *sourceImage : mSourcesOf)
- {
- ANGLE_TRY(sourceImage->orphanSibling(context, this));
- }
- mSourcesOf.clear();
- }
-
- return gl::NoError();
-}
-
-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);
-}
-
-ImageState::ImageState(EGLenum target, ImageSibling *buffer, const AttributeMap &attribs)
- : imageIndex(GetImageIndex(target, attribs)), source(buffer), targets()
-{
-}
-
-ImageState::~ImageState()
-{
-}
-
-Image::Image(rx::EGLImplFactory *factory,
- EGLenum target,
- ImageSibling *buffer,
- const AttributeMap &attribs)
- : RefCountObject(0),
- mState(target, buffer, attribs),
- mImplementation(factory->createImage(mState, target, attribs)),
- mOrphanedAndNeedsInit(false)
-{
- ASSERT(mImplementation != nullptr);
- ASSERT(buffer != nullptr);
-
- mState.source->addImageSource(this);
-}
-
-gl::Error Image::onDestroy(const gl::Context *context)
-{
- // 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());
-
- // Tell the source that it is no longer used by this image
- if (mState.source.get() != nullptr)
- {
- mState.source->removeImageSource(this);
- mState.source.set(context, nullptr);
- }
- return gl::NoError();
-}
-
-Image::~Image()
-{
- SafeDelete(mImplementation);
-}
-
-void Image::addTargetSibling(ImageSibling *sibling)
-{
- mState.targets.insert(sibling);
-}
-
-gl::Error Image::orphanSibling(const gl::Context *context, ImageSibling *sibling)
-{
- // notify impl
- ANGLE_TRY(mImplementation->orphan(context, sibling));
-
- if (mState.source.get() == sibling)
- {
- // If the sibling is the source, it cannot be a target.
- ASSERT(mState.targets.find(sibling) == mState.targets.end());
- mState.source.set(context, nullptr);
- mOrphanedAndNeedsInit =
- (sibling->initState(mState.imageIndex) == gl::InitState::MayNeedInit);
- }
- else
- {
- mState.targets.erase(sibling);
- }
-
- return gl::NoError();
-}
-
-const gl::Format &Image::getFormat() const
-{
- return mState.source->getAttachmentFormat(GL_NONE, mState.imageIndex);
-}
-
-size_t Image::getWidth() const
-{
- return mState.source->getAttachmentSize(mState.imageIndex).width;
-}
-
-size_t Image::getHeight() const
-{
- return mState.source->getAttachmentSize(mState.imageIndex).height;
-}
-
-size_t Image::getSamples() const
-{
- return mState.source->getAttachmentSamples(mState.imageIndex);
-}
-
-rx::ImageImpl *Image::getImplementation() const
-{
- return mImplementation;
-}
-
-Error Image::initialize()
-{
- return mImplementation->initialize();
-}
-
-bool Image::orphaned() const
-{
- return (mState.source.get() == 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);
-}
-
-} // namespace egl
diff --git a/src/3rdparty/angle/src/libANGLE/Image.h b/src/3rdparty/angle/src/libANGLE/Image.h
deleted file mode 100644
index d2f1b875c6..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Image.h
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-// 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/Error.h"
-#include "libANGLE/FramebufferAttachment.h"
-#include "libANGLE/RefCountObject.h"
-#include "libANGLE/formatutils.h"
-
-#include <set>
-
-namespace rx
-{
-class EGLImplFactory;
-class ImageImpl;
-}
-
-namespace egl
-{
-class Image;
-
-// 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::RefCountObject, public gl::FramebufferAttachmentObject
-{
- public:
- ImageSibling(GLuint id);
- ~ImageSibling() override;
-
- bool isEGLImageTarget() const;
- gl::InitState sourceEGLImageInitState() const;
- void setSourceEGLImageInitState(gl::InitState initState) const;
-
- protected:
- // Set the image target of this sibling
- void setTargetImage(const gl::Context *context, egl::Image *imageTarget);
-
- // Orphan all EGL image sources and targets
- gl::Error orphanImages(const gl::Context *context);
-
- 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;
- gl::BindingPointer<Image> mTargetOf;
-};
-
-struct ImageState : private angle::NonCopyable
-{
- ImageState(EGLenum target, ImageSibling *buffer, const AttributeMap &attribs);
- ~ImageState();
-
- gl::ImageIndex imageIndex;
- gl::BindingPointer<ImageSibling> source;
- std::set<ImageSibling *> targets;
-};
-
-class Image final : public gl::RefCountObject
-{
- public:
- Image(rx::EGLImplFactory *factory,
- EGLenum target,
- ImageSibling *buffer,
- const AttributeMap &attribs);
-
- gl::Error onDestroy(const gl::Context *context) override;
- ~Image() override;
-
- const gl::Format &getFormat() const;
- size_t getWidth() const;
- size_t getHeight() const;
- size_t getSamples() const;
-
- Error initialize();
-
- 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.
- gl::Error orphanSibling(const gl::Context *context, ImageSibling *sibling);
-
- ImageState mState;
- rx::ImageImpl *mImplementation;
- bool mOrphanedAndNeedsInit;
-};
-} // namespace egl
-
-#endif // LIBANGLE_IMAGE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/ImageIndex.cpp b/src/3rdparty/angle/src/libANGLE/ImageIndex.cpp
deleted file mode 100644
index 6f99f8ab54..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ImageIndex.cpp
+++ /dev/null
@@ -1,249 +0,0 @@
-#include "ImageIndex.h"
-//
-// 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 "libANGLE/Constants.h"
-#include "common/utilities.h"
-
-namespace gl
-{
-
-ImageIndex::ImageIndex(const ImageIndex &other)
- : type(other.type),
- mipIndex(other.mipIndex),
- layerIndex(other.layerIndex),
- numLayers(other.numLayers)
-{}
-
-ImageIndex &ImageIndex::operator=(const ImageIndex &other)
-{
- type = other.type;
- mipIndex = other.mipIndex;
- layerIndex = other.layerIndex;
- numLayers = other.numLayers;
- return *this;
-}
-
-bool ImageIndex::is3D() const
-{
- return type == GL_TEXTURE_3D || type == GL_TEXTURE_2D_ARRAY;
-}
-
-ImageIndex ImageIndex::Make2D(GLint mipIndex)
-{
- return ImageIndex(GL_TEXTURE_2D, mipIndex, ENTIRE_LEVEL, 1);
-}
-
-ImageIndex ImageIndex::MakeRectangle(GLint mipIndex)
-{
- return ImageIndex(GL_TEXTURE_RECTANGLE_ANGLE, mipIndex, ENTIRE_LEVEL, 1);
-}
-
-ImageIndex ImageIndex::MakeCube(GLenum target, GLint mipIndex)
-{
- ASSERT(gl::IsCubeMapTextureTarget(target));
- return ImageIndex(target, mipIndex,
- static_cast<GLint>(CubeMapTextureTargetToLayerIndex(target)), 1);
-}
-
-ImageIndex ImageIndex::Make2DArray(GLint mipIndex, GLint layerIndex)
-{
- return ImageIndex(GL_TEXTURE_2D_ARRAY, mipIndex, layerIndex, 1);
-}
-
-ImageIndex ImageIndex::Make2DArrayRange(GLint mipIndex, GLint layerIndex, GLint numLayers)
-{
- return ImageIndex(GL_TEXTURE_2D_ARRAY, mipIndex, layerIndex, numLayers);
-}
-
-ImageIndex ImageIndex::Make3D(GLint mipIndex, GLint layerIndex)
-{
- return ImageIndex(GL_TEXTURE_3D, mipIndex, layerIndex, 1);
-}
-
-ImageIndex ImageIndex::MakeGeneric(GLenum target, GLint mipIndex)
-{
- GLint layerIndex = IsCubeMapTextureTarget(target)
- ? static_cast<GLint>(CubeMapTextureTargetToLayerIndex(target))
- : ENTIRE_LEVEL;
- return ImageIndex(target, mipIndex, layerIndex, 1);
-}
-
-ImageIndex ImageIndex::Make2DMultisample()
-{
- return ImageIndex(GL_TEXTURE_2D_MULTISAMPLE, 0, ENTIRE_LEVEL, 1);
-}
-
-ImageIndex ImageIndex::MakeInvalid()
-{
- return ImageIndex(GL_NONE, -1, -1, -1);
-}
-
-bool ImageIndex::operator<(const ImageIndex &other) const
-{
- if (type != other.type)
- {
- return type < other.type;
- }
- else if (mipIndex != other.mipIndex)
- {
- return mipIndex < other.mipIndex;
- }
- else if (layerIndex != other.layerIndex)
- {
- return layerIndex < other.layerIndex;
- }
- else
- {
- return numLayers < other.numLayers;
- }
-}
-
-bool ImageIndex::operator==(const ImageIndex &other) const
-{
- return (type == other.type) && (mipIndex == other.mipIndex) &&
- (layerIndex == other.layerIndex) && (numLayers == other.numLayers);
-}
-
-bool ImageIndex::operator!=(const ImageIndex &other) const
-{
- return !(*this == other);
-}
-
-ImageIndex::ImageIndex(GLenum typeIn, GLint mipIndexIn, GLint layerIndexIn, GLint numLayersIn)
- : type(typeIn), mipIndex(mipIndexIn), layerIndex(layerIndexIn), numLayers(numLayersIn)
-{}
-
-ImageIndexIterator::ImageIndexIterator(const ImageIndexIterator &other) = default;
-
-ImageIndexIterator ImageIndexIterator::Make2D(GLint minMip, GLint maxMip)
-{
- return ImageIndexIterator(GL_TEXTURE_2D, Range<GLint>(minMip, maxMip),
- Range<GLint>(ImageIndex::ENTIRE_LEVEL, ImageIndex::ENTIRE_LEVEL),
- nullptr);
-}
-
-ImageIndexIterator ImageIndexIterator::MakeRectangle(GLint minMip, GLint maxMip)
-{
- return ImageIndexIterator(GL_TEXTURE_RECTANGLE_ANGLE, Range<GLint>(minMip, maxMip),
- Range<GLint>(ImageIndex::ENTIRE_LEVEL, ImageIndex::ENTIRE_LEVEL),
- nullptr);
-}
-
-ImageIndexIterator ImageIndexIterator::MakeCube(GLint minMip, GLint maxMip)
-{
- return ImageIndexIterator(GL_TEXTURE_CUBE_MAP, Range<GLint>(minMip, maxMip), Range<GLint>(0, 6),
- nullptr);
-}
-
-ImageIndexIterator ImageIndexIterator::Make3D(GLint minMip, GLint maxMip,
- GLint minLayer, GLint maxLayer)
-{
- return ImageIndexIterator(GL_TEXTURE_3D, Range<GLint>(minMip, maxMip),
- Range<GLint>(minLayer, maxLayer), nullptr);
-}
-
-ImageIndexIterator ImageIndexIterator::Make2DArray(GLint minMip, GLint maxMip,
- const GLsizei *layerCounts)
-{
- return ImageIndexIterator(GL_TEXTURE_2D_ARRAY, Range<GLint>(minMip, maxMip),
- Range<GLint>(0, IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS), layerCounts);
-}
-
-ImageIndexIterator ImageIndexIterator::Make2DMultisample()
-{
- return ImageIndexIterator(GL_TEXTURE_2D_MULTISAMPLE, Range<GLint>(0, 0),
- Range<GLint>(ImageIndex::ENTIRE_LEVEL, ImageIndex::ENTIRE_LEVEL),
- nullptr);
-}
-
-ImageIndexIterator::ImageIndexIterator(GLenum type,
- const Range<GLint> &mipRange,
- const Range<GLint> &layerRange,
- const GLsizei *layerCounts)
- : mType(type),
- mMipRange(mipRange),
- mLayerRange(layerRange),
- mLayerCounts(layerCounts),
- mCurrentMip(mipRange.low()),
- mCurrentLayer(layerRange.low())
-{}
-
-GLint ImageIndexIterator::maxLayer() const
-{
- if (mLayerCounts)
- {
- ASSERT(mCurrentMip >= 0);
- return (mCurrentMip < mMipRange.high()) ? mLayerCounts[mCurrentMip] : 0;
- }
- return mLayerRange.high();
-}
-
-ImageIndex ImageIndexIterator::next()
-{
- ASSERT(hasNext());
-
- ImageIndex value = current();
-
- // Iterate layers in the inner loop for now. We can add switchable
- // layer or mip iteration if we need it.
-
- if (mCurrentLayer != ImageIndex::ENTIRE_LEVEL)
- {
- if (mCurrentLayer < maxLayer() - 1)
- {
- mCurrentLayer++;
- }
- else if (mCurrentMip < mMipRange.high() - 1)
- {
- mCurrentMip++;
- mCurrentLayer = mLayerRange.low();
- }
- else
- {
- done();
- }
- }
- else if (mCurrentMip < mMipRange.high() - 1)
- {
- mCurrentMip++;
- mCurrentLayer = mLayerRange.low();
- }
- else
- {
- done();
- }
-
- return value;
-}
-
-ImageIndex ImageIndexIterator::current() const
-{
- ImageIndex value(mType, mCurrentMip, mCurrentLayer, 1);
-
- if (mType == GL_TEXTURE_CUBE_MAP)
- {
- value.type = LayerIndexToCubeMapTextureTarget(mCurrentLayer);
- }
-
- return value;
-}
-
-bool ImageIndexIterator::hasNext() const
-{
- return (mCurrentMip < mMipRange.high() || mCurrentLayer < maxLayer());
-}
-
-void ImageIndexIterator::done()
-{
- mCurrentMip = mMipRange.high();
- mCurrentLayer = maxLayer();
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/ImageIndex.h b/src/3rdparty/angle/src/libANGLE/ImageIndex.h
deleted file mode 100644
index 8e1b010325..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ImageIndex.h
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// 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/mathutil.h"
-
-#include "angle_gl.h"
-
-namespace gl
-{
-
-class ImageIndexIterator;
-
-struct ImageIndex
-{
- GLenum type;
- GLint mipIndex;
- GLint layerIndex;
- GLint numLayers;
-
- ImageIndex(const ImageIndex &other);
- ImageIndex &operator=(const ImageIndex &other);
-
- bool hasLayer() const { return layerIndex != ENTIRE_LEVEL; }
- bool is3D() const;
-
- static ImageIndex Make2D(GLint mipIndex);
- static ImageIndex MakeRectangle(GLint mipIndex);
- static ImageIndex MakeCube(GLenum target, GLint mipIndex);
- static ImageIndex Make2DArray(GLint mipIndex, GLint layerIndex);
- static ImageIndex Make2DArrayRange(GLint mipIndex, GLint layerIndex, GLint numLayers);
- static ImageIndex Make3D(GLint mipIndex, GLint layerIndex = ENTIRE_LEVEL);
- static ImageIndex MakeGeneric(GLenum target, GLint mipIndex);
- static ImageIndex Make2DMultisample();
-
- static ImageIndex MakeInvalid();
-
- static const GLint ENTIRE_LEVEL = static_cast<GLint>(-1);
-
- bool operator<(const ImageIndex &other) const;
- bool operator==(const ImageIndex &other) const;
- bool operator!=(const ImageIndex &other) const;
-
- private:
- friend class ImageIndexIterator;
-
- ImageIndex(GLenum typeIn, GLint mipIndexIn, GLint layerIndexIn, GLint numLayersIn);
-};
-
-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();
-
- ImageIndex next();
- ImageIndex current() const;
- bool hasNext() const;
-
- private:
-
- ImageIndexIterator(GLenum type, const Range<GLint> &mipRange,
- const Range<GLint> &layerRange, const GLsizei *layerCounts);
-
- GLint maxLayer() const;
- void done();
-
- GLenum mType;
- Range<GLint> mMipRange;
- Range<GLint> mLayerRange;
- const GLsizei *mLayerCounts;
- GLint mCurrentMip;
- GLint mCurrentLayer;
-};
-
-}
-
-#endif // LIBANGLE_IMAGE_INDEX_H_
diff --git a/src/3rdparty/angle/src/libANGLE/IndexRangeCache.cpp b/src/3rdparty/angle/src/libANGLE/IndexRangeCache.cpp
deleted file mode 100644
index 71a1392b1b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/IndexRangeCache.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-//
-// 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(GLenum type,
- size_t offset,
- size_t count,
- bool primitiveRestartEnabled,
- const IndexRange &range)
-{
- mIndexRangeCache[IndexRangeKey(type, offset, count, primitiveRestartEnabled)] = range;
-}
-
-bool IndexRangeCache::findRange(GLenum 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 + (GetTypeInfo(i->first.type).bytes * i->first.count);
-
- if (invalidateEnd < rangeStart || invalidateStart > rangeEnd)
- {
- ++i;
- }
- else
- {
- mIndexRangeCache.erase(i++);
- }
- }
-}
-
-void IndexRangeCache::clear()
-{
- mIndexRangeCache.clear();
-}
-
-IndexRangeCache::IndexRangeKey::IndexRangeKey()
- : IndexRangeCache::IndexRangeKey(GL_NONE, 0, 0, false)
-{
-}
-
-IndexRangeCache::IndexRangeKey::IndexRangeKey(GLenum 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;
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/IndexRangeCache.h b/src/3rdparty/angle/src/libANGLE/IndexRangeCache.h
deleted file mode 100644
index 3b183448e6..0000000000
--- a/src/3rdparty/angle/src/libANGLE/IndexRangeCache.h
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// 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 "common/angleutils.h"
-#include "common/mathutil.h"
-
-#include "angle_gl.h"
-
-#include <map>
-
-namespace gl
-{
-
-class IndexRangeCache
-{
- public:
- IndexRangeCache();
- ~IndexRangeCache();
-
- void addRange(GLenum type,
- size_t offset,
- size_t count,
- bool primitiveRestartEnabled,
- const IndexRange &range);
- bool findRange(GLenum 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(GLenum type, size_t offset, size_t count, bool primitiveRestart);
-
- bool operator<(const IndexRangeKey &rhs) const;
-
- GLenum type;
- size_t offset;
- size_t count;
- bool primitiveRestartEnabled;
- };
-
- typedef std::map<IndexRangeKey, IndexRange> IndexRangeMap;
- IndexRangeMap mIndexRangeCache;
-};
-
-}
-
-#endif // LIBANGLE_INDEXRANGECACHE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/LoggingAnnotator.cpp b/src/3rdparty/angle/src/libANGLE/LoggingAnnotator.cpp
deleted file mode 100644
index 799399e453..0000000000
--- a/src/3rdparty/angle/src/libANGLE/LoggingAnnotator.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// 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 <platform/Platform.h>
-
-namespace angle
-{
-
-bool LoggingAnnotator::getStatus()
-{
- return false;
-}
-
-void LoggingAnnotator::logMessage(const gl::LogMessage &msg) const
-{
- auto *plat = ANGLEPlatformCurrent();
- if (plat != nullptr)
- {
- switch (msg.getSeverity())
- {
- case gl::LOG_ERR:
- plat->logError(plat, msg.getMessage().c_str());
- break;
- case gl::LOG_WARN:
- plat->logWarning(plat, msg.getMessage().c_str());
- break;
- default:
- UNREACHABLE();
- }
- }
- else
- {
- gl::Trace(msg.getSeverity(), msg.getMessage().c_str());
- }
-}
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/libANGLE/LoggingAnnotator.h b/src/3rdparty/angle/src/libANGLE/LoggingAnnotator.h
deleted file mode 100644
index 5bec68e189..0000000000
--- a/src/3rdparty/angle/src/libANGLE/LoggingAnnotator.h
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// 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 wchar_t *eventName) override {}
- void endEvent() override {}
- void setMarker(const wchar_t *markerName) override {}
- bool getStatus() override;
- void logMessage(const gl::LogMessage &msg) const override;
-};
-
-} // namespace angle
-
-#endif // LIBANGLE_LOGGINGANNOTATOR_H_
diff --git a/src/3rdparty/angle/src/libANGLE/MemoryProgramCache.cpp b/src/3rdparty/angle/src/libANGLE/MemoryProgramCache.cpp
deleted file mode 100644
index 9eec12e3ea..0000000000
--- a/src/3rdparty/angle/src/libANGLE/MemoryProgramCache.cpp
+++ /dev/null
@@ -1,772 +0,0 @@
-//
-// 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
-{
-enum CacheResult
-{
- kCacheMiss,
- kCacheHitMemory,
- kCacheHitDisk,
- kCacheResultMax,
-};
-
-constexpr unsigned int kWarningLimit = 3;
-
-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->writeString(var.structName);
- 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->structName = stream->readString();
-}
-
-void WriteShaderVariableBuffer(BinaryOutputStream *stream, const ShaderVariableBuffer &var)
-{
- stream->writeInt(var.binding);
- stream->writeInt(var.dataSize);
-
- stream->writeInt(var.vertexStaticUse);
- stream->writeInt(var.fragmentStaticUse);
- stream->writeInt(var.computeStaticUse);
-
- 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>();
- var->vertexStaticUse = stream->readBool();
- var->fragmentStaticUse = stream->readBool();
- var->computeStaticUse = 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);
- stream->writeInt(var.blockInfo.offset);
- stream->writeInt(var.blockInfo.arrayStride);
- stream->writeInt(var.blockInfo.matrixStride);
- stream->writeInt(var.blockInfo.isRowMajorMatrix);
- stream->writeInt(var.blockInfo.topLevelArrayStride);
- stream->writeInt(var.topLevelArraySize);
- stream->writeInt(var.vertexStaticUse);
- stream->writeInt(var.fragmentStaticUse);
- stream->writeInt(var.computeStaticUse);
-}
-
-void LoadBufferVariable(BinaryInputStream *stream, BufferVariable *var)
-{
- LoadShaderVar(stream, var);
-
- var->bufferIndex = stream->readInt<int>();
- var->blockInfo.offset = stream->readInt<int>();
- var->blockInfo.arrayStride = stream->readInt<int>();
- var->blockInfo.matrixStride = stream->readInt<int>();
- var->blockInfo.isRowMajorMatrix = stream->readBool();
- var->blockInfo.topLevelArrayStride = stream->readInt<int>();
- var->topLevelArraySize = stream->readInt<int>();
- var->vertexStaticUse = stream->readBool();
- var->fragmentStaticUse = stream->readBool();
- var->computeStaticUse = 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);
-}
-
-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 Program::Bindings &bindings)
-{
- for (const auto &binding : bindings)
- {
- stream << binding.first << binding.second;
- }
- return stream;
-}
-
-HashStream &operator<<(HashStream &stream, const std::vector<std::string> &strings)
-{
- for (const auto &str : strings)
- {
- stream << str;
- }
- return stream;
-}
-
-} // anonymous namespace
-
-MemoryProgramCache::MemoryProgramCache(size_t maxCacheSizeBytes)
- : mProgramBinaryCache(maxCacheSizeBytes), mIssuedWarnings(0)
-{
-}
-
-MemoryProgramCache::~MemoryProgramCache()
-{
-}
-
-// static
-LinkResult MemoryProgramCache::Deserialize(const Context *context,
- const Program *program,
- ProgramState *state,
- const uint8_t *binary,
- size_t length,
- InfoLog &infoLog)
-{
- BinaryInputStream stream(binary, length);
-
- 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 false;
- }
-
- 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 false;
- }
-
- state->mComputeShaderLocalSize[0] = stream.readInt<int>();
- state->mComputeShaderLocalSize[1] = stream.readInt<int>();
- state->mComputeShaderLocalSize[2] = stream.readInt<int>();
-
- state->mNumViews = stream.readInt<int>();
-
- static_assert(MAX_VERTEX_ATTRIBS <= sizeof(unsigned long) * 8,
- "Too many vertex attribs for mask");
- state->mActiveAttribLocationsMask = stream.readInt<unsigned long>();
-
- unsigned int attribCount = stream.readInt<unsigned int>();
- ASSERT(state->mAttributes.empty());
- for (unsigned int attribIndex = 0; attribIndex < attribCount; ++attribIndex)
- {
- sh::Attribute attrib;
- LoadShaderVar(&stream, &attrib);
- attrib.location = stream.readInt<int>();
- state->mAttributes.push_back(attrib);
- }
-
- unsigned int uniformCount = stream.readInt<unsigned int>();
- ASSERT(state->mUniforms.empty());
- for (unsigned int uniformIndex = 0; uniformIndex < uniformCount; ++uniformIndex)
- {
- LinkedUniform uniform;
- LoadShaderVar(&stream, &uniform);
-
- uniform.bufferIndex = stream.readInt<int>();
- uniform.blockInfo.offset = stream.readInt<int>();
- uniform.blockInfo.arrayStride = stream.readInt<int>();
- uniform.blockInfo.matrixStride = stream.readInt<int>();
- uniform.blockInfo.isRowMajorMatrix = stream.readBool();
-
- uniform.typeInfo = &GetUniformTypeInfo(uniform.type);
-
- state->mUniforms.push_back(uniform);
- }
-
- const unsigned int uniformIndexCount = stream.readInt<unsigned int>();
- ASSERT(state->mUniformLocations.empty());
- for (unsigned int uniformIndexIndex = 0; uniformIndexIndex < uniformIndexCount;
- uniformIndexIndex++)
- {
- VariableLocation variable;
- stream.readInt(&variable.arrayIndex);
- stream.readInt(&variable.index);
- stream.readBool(&variable.ignored);
-
- state->mUniformLocations.push_back(variable);
- }
-
- unsigned int uniformBlockCount = stream.readInt<unsigned int>();
- ASSERT(state->mUniformBlocks.empty());
- for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < uniformBlockCount;
- ++uniformBlockIndex)
- {
- InterfaceBlock uniformBlock;
- LoadInterfaceBlock(&stream, &uniformBlock);
- state->mUniformBlocks.push_back(uniformBlock);
-
- state->mActiveUniformBlockBindings.set(uniformBlockIndex, uniformBlock.binding != 0);
- }
-
- unsigned int bufferVariableCount = stream.readInt<unsigned int>();
- ASSERT(state->mBufferVariables.empty());
- for (unsigned int index = 0; index < bufferVariableCount; ++index)
- {
- BufferVariable bufferVariable;
- LoadBufferVariable(&stream, &bufferVariable);
- state->mBufferVariables.push_back(bufferVariable);
- }
-
- unsigned int shaderStorageBlockCount = stream.readInt<unsigned int>();
- ASSERT(state->mShaderStorageBlocks.empty());
- for (unsigned int shaderStorageBlockIndex = 0;
- shaderStorageBlockIndex < shaderStorageBlockCount; ++shaderStorageBlockIndex)
- {
- InterfaceBlock shaderStorageBlock;
- LoadInterfaceBlock(&stream, &shaderStorageBlock);
- state->mShaderStorageBlocks.push_back(shaderStorageBlock);
- }
-
- unsigned int atomicCounterBufferCount = stream.readInt<unsigned int>();
- ASSERT(state->mAtomicCounterBuffers.empty());
- for (unsigned int bufferIndex = 0; bufferIndex < atomicCounterBufferCount; ++bufferIndex)
- {
- AtomicCounterBuffer atomicCounterBuffer;
- LoadShaderVariableBuffer(&stream, &atomicCounterBuffer);
-
- state->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->getWorkarounds().disableProgramCachingForTransformFeedback)
- {
- infoLog << "Current driver does not support transform feedback in binary programs.";
- return false;
- }
-
- ASSERT(state->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>();
-
- state->mLinkedTransformFeedbackVaryings.emplace_back(varying, arrayIndex);
- }
-
- stream.readInt(&state->mTransformFeedbackBufferMode);
-
- unsigned int outputCount = stream.readInt<unsigned int>();
- ASSERT(state->mOutputVariables.empty());
- for (unsigned int outputIndex = 0; outputIndex < outputCount; ++outputIndex)
- {
- sh::OutputVariable output;
- LoadShaderVar(&stream, &output);
- output.location = stream.readInt<int>();
- state->mOutputVariables.push_back(output);
- }
-
- unsigned int outputVarCount = stream.readInt<unsigned int>();
- ASSERT(state->mOutputLocations.empty());
- for (unsigned int outputIndex = 0; outputIndex < outputVarCount; ++outputIndex)
- {
- VariableLocation locationData;
- stream.readInt(&locationData.arrayIndex);
- stream.readInt(&locationData.index);
- stream.readBool(&locationData.ignored);
- state->mOutputLocations.push_back(locationData);
- }
-
- unsigned int outputTypeCount = stream.readInt<unsigned int>();
- for (unsigned int outputIndex = 0; outputIndex < outputTypeCount; ++outputIndex)
- {
- state->mOutputVariableTypes.push_back(stream.readInt<GLenum>());
- }
- static_assert(IMPLEMENTATION_MAX_DRAW_BUFFERS < 8 * sizeof(uint32_t),
- "All bits of DrawBufferMask can be contained in an uint32_t");
- state->mActiveOutputVariables = stream.readInt<uint32_t>();
-
- unsigned int samplerRangeLow = stream.readInt<unsigned int>();
- unsigned int samplerRangeHigh = stream.readInt<unsigned int>();
- state->mSamplerUniformRange = RangeUI(samplerRangeLow, samplerRangeHigh);
- unsigned int samplerCount = stream.readInt<unsigned int>();
- for (unsigned int samplerIndex = 0; samplerIndex < samplerCount; ++samplerIndex)
- {
- GLenum textureType = stream.readInt<GLenum>();
- size_t bindingCount = stream.readInt<size_t>();
- bool unreferenced = stream.readBool();
- state->mSamplerBindings.emplace_back(
- SamplerBinding(textureType, bindingCount, unreferenced));
- }
-
- unsigned int imageRangeLow = stream.readInt<unsigned int>();
- unsigned int imageRangeHigh = stream.readInt<unsigned int>();
- state->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>();
- }
- state->mImageBindings.emplace_back(imageBinding);
- }
-
- unsigned int atomicCounterRangeLow = stream.readInt<unsigned int>();
- unsigned int atomicCounterRangeHigh = stream.readInt<unsigned int>();
- state->mAtomicCounterUniformRange = RangeUI(atomicCounterRangeLow, atomicCounterRangeHigh);
-
- static_assert(SHADER_TYPE_MAX <= sizeof(unsigned long) * 8, "Too many shader types");
- state->mLinkedShaderStages = stream.readInt<unsigned long>();
-
- return program->getImplementation()->load(context, infoLog, &stream);
-}
-
-// static
-void MemoryProgramCache::Serialize(const Context *context,
- const gl::Program *program,
- angle::MemoryBuffer *binaryOut)
-{
- 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 &state = program->getState();
-
- const auto &computeLocalSize = state.getComputeShaderLocalSize();
-
- stream.writeInt(computeLocalSize[0]);
- stream.writeInt(computeLocalSize[1]);
- stream.writeInt(computeLocalSize[2]);
-
- stream.writeInt(state.mNumViews);
-
- stream.writeInt(state.getActiveAttribLocationsMask().to_ulong());
-
- stream.writeInt(state.getAttributes().size());
- for (const sh::Attribute &attrib : state.getAttributes())
- {
- WriteShaderVar(&stream, attrib);
- stream.writeInt(attrib.location);
- }
-
- stream.writeInt(state.getUniforms().size());
- for (const LinkedUniform &uniform : state.getUniforms())
- {
- WriteShaderVar(&stream, uniform);
-
- // FIXME: referenced
-
- stream.writeInt(uniform.bufferIndex);
- stream.writeInt(uniform.blockInfo.offset);
- stream.writeInt(uniform.blockInfo.arrayStride);
- stream.writeInt(uniform.blockInfo.matrixStride);
- stream.writeInt(uniform.blockInfo.isRowMajorMatrix);
- }
-
- stream.writeInt(state.getUniformLocations().size());
- for (const auto &variable : state.getUniformLocations())
- {
- stream.writeInt(variable.arrayIndex);
- stream.writeIntOrNegOne(variable.index);
- stream.writeInt(variable.ignored);
- }
-
- stream.writeInt(state.getUniformBlocks().size());
- for (const InterfaceBlock &uniformBlock : state.getUniformBlocks())
- {
- WriteInterfaceBlock(&stream, uniformBlock);
- }
-
- stream.writeInt(state.getBufferVariables().size());
- for (const BufferVariable &bufferVariable : state.getBufferVariables())
- {
- WriteBufferVariable(&stream, bufferVariable);
- }
-
- stream.writeInt(state.getShaderStorageBlocks().size());
- for (const InterfaceBlock &shaderStorageBlock : state.getShaderStorageBlocks())
- {
- WriteInterfaceBlock(&stream, shaderStorageBlock);
- }
-
- stream.writeInt(state.mAtomicCounterBuffers.size());
- for (const auto &atomicCounterBuffer : state.mAtomicCounterBuffers)
- {
- WriteShaderVariableBuffer(&stream, atomicCounterBuffer);
- }
-
- // Warn the app layer if saving a binary with unsupported transform feedback.
- if (!state.getLinkedTransformFeedbackVaryings().empty() &&
- context->getWorkarounds().disableProgramCachingForTransformFeedback)
- {
- WARN() << "Saving program binary with transform feedback, which is not supported on this "
- "driver.";
- }
-
- stream.writeInt(state.getLinkedTransformFeedbackVaryings().size());
- for (const auto &var : state.getLinkedTransformFeedbackVaryings())
- {
- stream.writeIntVector(var.arraySizes);
- stream.writeInt(var.type);
- stream.writeString(var.name);
-
- stream.writeIntOrNegOne(var.arrayIndex);
- }
-
- stream.writeInt(state.getTransformFeedbackBufferMode());
-
- stream.writeInt(state.getOutputVariables().size());
- for (const sh::OutputVariable &output : state.getOutputVariables())
- {
- WriteShaderVar(&stream, output);
- stream.writeInt(output.location);
- }
-
- stream.writeInt(state.getOutputLocations().size());
- for (const auto &outputVar : state.getOutputLocations())
- {
- stream.writeInt(outputVar.arrayIndex);
- stream.writeIntOrNegOne(outputVar.index);
- stream.writeInt(outputVar.ignored);
- }
-
- stream.writeInt(state.mOutputVariableTypes.size());
- for (const auto &outputVariableType : state.mOutputVariableTypes)
- {
- stream.writeInt(outputVariableType);
- }
-
- static_assert(IMPLEMENTATION_MAX_DRAW_BUFFERS < 8 * sizeof(uint32_t),
- "All bits of DrawBufferMask can be contained in an uint32_t");
- stream.writeInt(static_cast<uint32_t>(state.mActiveOutputVariables.to_ulong()));
-
- stream.writeInt(state.getSamplerUniformRange().low());
- stream.writeInt(state.getSamplerUniformRange().high());
-
- stream.writeInt(state.getSamplerBindings().size());
- for (const auto &samplerBinding : state.getSamplerBindings())
- {
- stream.writeInt(samplerBinding.textureType);
- stream.writeInt(samplerBinding.boundTextureUnits.size());
- stream.writeInt(samplerBinding.unreferenced);
- }
-
- stream.writeInt(state.getImageUniformRange().low());
- stream.writeInt(state.getImageUniformRange().high());
-
- stream.writeInt(state.getImageBindings().size());
- for (const auto &imageBinding : state.getImageBindings())
- {
- stream.writeInt(imageBinding.boundImageUnits.size());
- for (size_t i = 0; i < imageBinding.boundImageUnits.size(); ++i)
- {
- stream.writeInt(imageBinding.boundImageUnits[i]);
- }
- }
-
- stream.writeInt(state.getAtomicCounterUniformRange().low());
- stream.writeInt(state.getAtomicCounterUniformRange().high());
-
- stream.writeInt(state.getLinkedShaderStages().to_ulong());
-
- program->getImplementation()->save(context, &stream);
-
- ASSERT(binaryOut);
- binaryOut->resize(stream.length());
- memcpy(binaryOut->data(), stream.data(), stream.length());
-}
-
-// static
-void MemoryProgramCache::ComputeHash(const Context *context,
- const Program *program,
- ProgramHash *hashOut)
-{
- const Shader *vertexShader = program->getAttachedVertexShader();
- const Shader *fragmentShader = program->getAttachedFragmentShader();
- const Shader *computeShader = program->getAttachedComputeShader();
-
- // Compute the program hash. Start with the shader hashes and resource strings.
- HashStream hashStream;
- hashStream << vertexShader << fragmentShader << computeShader;
-
- // 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();
-
- // 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());
-}
-
-LinkResult MemoryProgramCache::getProgram(const Context *context,
- const Program *program,
- ProgramState *state,
- ProgramHash *hashOut)
-{
- ComputeHash(context, program, hashOut);
- const angle::MemoryBuffer *binaryProgram = nullptr;
- LinkResult result(false);
- if (get(*hashOut, &binaryProgram))
- {
- InfoLog infoLog;
- ANGLE_TRY_RESULT(Deserialize(context, program, state, binaryProgram->data(),
- binaryProgram->size(), infoLog),
- result);
- ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.ProgramCache.LoadBinarySuccess", result.getResult());
- if (!result.getResult())
- {
- // Cache load failed, evict.
- if (mIssuedWarnings++ < kWarningLimit)
- {
- WARN() << "Failed to load binary from cache: " << infoLog.str();
-
- if (mIssuedWarnings == kWarningLimit)
- {
- WARN() << "Reaching warning limit for cache load failures, silencing "
- "subsequent warnings.";
- }
- }
- remove(*hashOut);
- }
- }
- return result;
-}
-
-bool MemoryProgramCache::get(const ProgramHash &programHash, const angle::MemoryBuffer **programOut)
-{
- const CacheEntry *entry = nullptr;
- if (!mProgramBinaryCache.get(programHash, &entry))
- {
- ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.ProgramCache.CacheResult", kCacheMiss,
- kCacheResultMax);
- return false;
- }
-
- if (entry->second == CacheSource::PutProgram)
- {
- ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.ProgramCache.CacheResult", kCacheHitMemory,
- kCacheResultMax);
- }
- else
- {
- ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.ProgramCache.CacheResult", kCacheHitDisk,
- kCacheResultMax);
- }
-
- *programOut = &entry->first;
- return true;
-}
-
-bool MemoryProgramCache::getAt(size_t index,
- ProgramHash *hashOut,
- const angle::MemoryBuffer **programOut)
-{
- const CacheEntry *entry = nullptr;
- if (!mProgramBinaryCache.getAt(index, hashOut, &entry))
- {
- return false;
- }
-
- *programOut = &entry->first;
- return true;
-}
-
-void MemoryProgramCache::remove(const ProgramHash &programHash)
-{
- bool result = mProgramBinaryCache.eraseByKey(programHash);
- ASSERT(result);
-}
-
-void MemoryProgramCache::putProgram(const ProgramHash &programHash,
- const Context *context,
- const Program *program)
-{
- CacheEntry newEntry;
- Serialize(context, program, &newEntry.first);
- newEntry.second = CacheSource::PutProgram;
-
- ANGLE_HISTOGRAM_COUNTS("GPU.ANGLE.ProgramCache.ProgramBinarySizeBytes",
- static_cast<int>(newEntry.first.size()));
-
- const CacheEntry *result =
- mProgramBinaryCache.put(programHash, std::move(newEntry), newEntry.first.size());
- if (!result)
- {
- ERR() << "Failed to store binary program in memory cache, program is too large.";
- }
- else
- {
- auto *platform = ANGLEPlatformCurrent();
- platform->cacheProgram(platform, programHash, result->first.size(), result->first.data());
- }
-}
-
-void MemoryProgramCache::updateProgram(const Context *context, const Program *program)
-{
- gl::ProgramHash programHash;
- ComputeHash(context, program, &programHash);
- putProgram(programHash, context, program);
-}
-
-void MemoryProgramCache::putBinary(const ProgramHash &programHash,
- const uint8_t *binary,
- size_t length)
-{
- // Copy the binary.
- CacheEntry newEntry;
- newEntry.first.resize(length);
- memcpy(newEntry.first.data(), binary, length);
- newEntry.second = CacheSource::PutBinary;
-
- // Store the binary.
- const CacheEntry *result = mProgramBinaryCache.put(programHash, std::move(newEntry), length);
- if (!result)
- {
- ERR() << "Failed to store binary program in memory cache, program is too large.";
- }
-}
-
-void MemoryProgramCache::clear()
-{
- mProgramBinaryCache.clear();
- mIssuedWarnings = 0;
-}
-
-void MemoryProgramCache::resize(size_t maxCacheSizeBytes)
-{
- mProgramBinaryCache.resize(maxCacheSizeBytes);
-}
-
-size_t MemoryProgramCache::entryCount() const
-{
- return mProgramBinaryCache.entryCount();
-}
-
-size_t MemoryProgramCache::trim(size_t limit)
-{
- return mProgramBinaryCache.shrinkToSize(limit);
-}
-
-size_t MemoryProgramCache::size() const
-{
- return mProgramBinaryCache.size();
-}
-
-size_t MemoryProgramCache::maxSize() const
-{
- return mProgramBinaryCache.maxSize();
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/MemoryProgramCache.h b/src/3rdparty/angle/src/libANGLE/MemoryProgramCache.h
deleted file mode 100644
index 044bd48ecc..0000000000
--- a/src/3rdparty/angle/src/libANGLE/MemoryProgramCache.h
+++ /dev/null
@@ -1,130 +0,0 @@
-//
-// 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.
-
-#ifndef LIBANGLE_MEMORY_PROGRAM_CACHE_H_
-#define LIBANGLE_MEMORY_PROGRAM_CACHE_H_
-
-#include <array>
-
-#include "common/MemoryBuffer.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/SizedMRUCache.h"
-
-namespace gl
-{
-// 160-bit SHA-1 hash key.
-constexpr size_t kProgramHashLength = 20;
-using ProgramHash = std::array<uint8_t, kProgramHashLength>;
-} // namespace gl
-
-namespace std
-{
-template <>
-struct hash<gl::ProgramHash>
-{
- // Simple routine to hash four ints.
- size_t operator()(const gl::ProgramHash &programHash) const
- {
- unsigned int hash = 0;
- for (uint32_t num : programHash)
- {
- hash *= 37;
- hash += num;
- }
- return hash;
- }
-};
-} // namespace std
-
-namespace gl
-{
-class Context;
-class InfoLog;
-class Program;
-class ProgramState;
-
-class MemoryProgramCache final : angle::NonCopyable
-{
- public:
- MemoryProgramCache(size_t maxCacheSizeBytes);
- ~MemoryProgramCache();
-
- // Writes a program's binary to the output memory buffer.
- static void Serialize(const Context *context,
- const Program *program,
- angle::MemoryBuffer *binaryOut);
-
- // Loads program state according to the specified binary blob.
- static LinkResult Deserialize(const Context *context,
- const Program *program,
- ProgramState *state,
- const uint8_t *binary,
- size_t length,
- InfoLog &infoLog);
-
- static void ComputeHash(const Context *context, const Program *program, ProgramHash *hashOut);
-
- // Check if the cache contains a binary matching the specified program.
- bool get(const ProgramHash &programHash, const angle::MemoryBuffer **programOut);
-
- // For querying the contents of the cache.
- bool getAt(size_t index, ProgramHash *hashOut, const angle::MemoryBuffer **programOut);
-
- // Evict a program from the binary cache.
- void remove(const ProgramHash &programHash);
-
- // Helper method that serializes a program.
- void putProgram(const ProgramHash &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.
- void putBinary(const ProgramHash &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.
- LinkResult getProgram(const Context *context,
- const Program *program,
- ProgramState *state,
- ProgramHash *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:
- enum class CacheSource
- {
- PutProgram,
- PutBinary,
- };
-
- using CacheEntry = std::pair<angle::MemoryBuffer, CacheSource>;
- angle::SizedMRUCache<ProgramHash, CacheEntry> mProgramBinaryCache;
- unsigned int mIssuedWarnings;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_MEMORY_PROGRAM_CACHE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/PackedGLEnums.h b/src/3rdparty/angle/src/libANGLE/PackedGLEnums.h
deleted file mode 100644
index 70e32910fc..0000000000
--- a/src/3rdparty/angle/src/libANGLE/PackedGLEnums.h
+++ /dev/null
@@ -1,111 +0,0 @@
-// 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 LIBANGLE_PACKEDGLENUMS_H_
-#define LIBANGLE_PACKEDGLENUMS_H_
-
-#include "libANGLE/PackedGLEnums_autogen.h"
-
-#include <array>
-#include <cstddef>
-
-namespace angle
-{
-
-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}; }
-};
-
-template <typename E, typename T>
-class PackedEnumMap
-{
- private:
- using UnderlyingType = typename std::underlying_type<E>::type;
- static constexpr size_t kSize = static_cast<UnderlyingType>(E::EnumCount);
- using Storage = std::array<T, kSize>;
-
- Storage mData;
-
- public:
- // 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) { mData.fill(u); }
- void swap(PackedEnumMap<E, T> &a) noexcept { mData.swap(a.mData); }
-
- // iterators:
- iterator begin() noexcept { return mData.begin(); }
- const_iterator begin() const noexcept { return mData.begin(); }
- iterator end() noexcept { return mData.end(); }
- const_iterator end() const noexcept { return mData.end(); }
-
- reverse_iterator rbegin() noexcept { return mData.rbegin(); }
- const_reverse_iterator rbegin() const noexcept { return mData.rbegin(); }
- reverse_iterator rend() noexcept { return mData.rend(); }
- const_reverse_iterator rend() const noexcept { return mData.rend(); }
-
- // capacity:
- constexpr size_type size() const noexcept { return mData.size(); }
- constexpr size_type max_size() const noexcept { return mData.max_size(); }
- constexpr bool empty() const noexcept { return mData.empty(); }
-
- // element access:
- reference operator[](E n) { return mData[static_cast<UnderlyingType>(n)]; }
- const_reference operator[](E n) const { return mData[static_cast<UnderlyingType>(n)]; }
- const_reference at(E n) const { return mData.at(static_cast<UnderlyingType>(n)); }
- reference at(E n) { return mData.at(static_cast<UnderlyingType>(n)); }
-
- reference front() { return mData.front(); }
- const_reference front() const { return mData.front(); }
- reference back() { return mData.back(); }
- const_reference back() const { return mData.back(); }
-
- T *data() noexcept { return mData.data(); }
- const T *data() const noexcept { return mData.data(); }
-};
-
-} // namespace angle
-
-#endif // LIBANGLE_PACKEDGLENUMS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/PackedGLEnums_autogen.cpp b/src/3rdparty/angle/src/libANGLE/PackedGLEnums_autogen.cpp
deleted file mode 100644
index 4959a8ff14..0000000000
--- a/src/3rdparty/angle/src/libANGLE/PackedGLEnums_autogen.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by gen_packed_gl_enums.py using data from packed_gl_enums.json.
-//
-// 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.cpp:
-// Implements ANGLE-specific enums classes for GLEnum and functions operating
-// on them.
-
-#include "libANGLE/PackedGLEnums_autogen.h"
-#include "common/debug.h"
-
-namespace gl
-{
-
-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 GL_NONE;
- }
-}
-
-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 GL_NONE;
- }
-}
-
-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 GL_NONE;
- }
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/PackedGLEnums_autogen.h b/src/3rdparty/angle/src/libANGLE/PackedGLEnums_autogen.h
deleted file mode 100644
index f3f349ab68..0000000000
--- a/src/3rdparty/angle/src/libANGLE/PackedGLEnums_autogen.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by gen_packed_gl_enums.py using data from packed_gl_enums.json.
-//
-// 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 LIBANGLE_PACKEDGLENUMS_AUTOGEN_H_
-#define LIBANGLE_PACKEDGLENUMS_AUTOGEN_H_
-
-#include <angle_gl.h>
-
-#include <cstdint>
-
-namespace gl
-{
-
-template <typename Enum>
-Enum FromGLenum(GLenum from);
-
-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);
-
-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);
-
-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);
-
-} // namespace gl
-
-#endif // LIBANGLE_PACKEDGLENUMS_AUTOGEN_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Path.cpp b/src/3rdparty/angle/src/libANGLE/Path.cpp
deleted file mode 100644
index 8f2ce9ef92..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Path.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// 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/mathutil.h"
-#include "common/debug.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;
-}
-
-Error 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 NoError();
-}
-
-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);
-}
-
-} // gl
diff --git a/src/3rdparty/angle/src/libANGLE/Path.h b/src/3rdparty/angle/src/libANGLE/Path.h
deleted file mode 100644
index b103c84607..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Path.h
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// 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();
-
- Error 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/src/3rdparty/angle/src/libANGLE/Platform.cpp b/src/3rdparty/angle/src/libANGLE/Platform.cpp
deleted file mode 100644
index 702091624f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Platform.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// 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::PlatformMethods()
-{
-}
-
-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/src/3rdparty/angle/src/libANGLE/Program.cpp b/src/3rdparty/angle/src/libANGLE/Program.cpp
deleted file mode 100644
index 795d326041..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Program.cpp
+++ /dev/null
@@ -1,3066 +0,0 @@
-//
-// 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 "common/bitset_utils.h"
-#include "common/debug.h"
-#include "common/platform.h"
-#include "common/string_utils.h"
-#include "common/utilities.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/features.h"
-#include "libANGLE/histogram_macros.h"
-#include "libANGLE/queryconversions.h"
-#include "libANGLE/renderer/GLImplFactory.h"
-#include "libANGLE/renderer/ProgramImpl.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];
-
- if (angle::BeginsWith(variable.name, name))
- {
- 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 *length)
-{
- ASSERT(bufSize > 0);
- strncpy(buffer, string.c_str(), bufSize);
- buffer[bufSize - 1] = '\0';
-
- if (length)
- {
- *length = static_cast<GLsizei>(strlen(buffer));
- }
-}
-
-bool IncludeSameArrayElement(const std::set<std::string> &nameSet, const std::string &name)
-{
- std::vector<unsigned int> subscripts;
- std::string baseName = ParseResourceName(name, &subscripts);
- for (auto 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;
-}
-
-bool validateInterfaceBlocksCount(GLuint maxInterfaceBlocks,
- const std::vector<sh::InterfaceBlock> &interfaceBlocks,
- const std::string &errorMessage,
- InfoLog &infoLog)
-{
- GLuint blockCount = 0;
- for (const sh::InterfaceBlock &block : interfaceBlocks)
- {
- if (block.staticUse || block.layout != sh::BLOCKLAYOUT_PACKED)
- {
- blockCount += (block.arraySize ? block.arraySize : 1);
- if (blockCount > maxInterfaceBlocks)
- {
- infoLog << errorMessage << maxInterfaceBlocks << ")";
- return false;
- }
- }
- }
- 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 gl::Context *context,
- const ProgramState &state,
- UniformBlockLinker *blockLinker)
-{
- if (state.getAttachedVertexShader())
- {
- blockLinker->addShaderBlocks(GL_VERTEX_SHADER,
- &state.getAttachedVertexShader()->getUniformBlocks(context));
- }
-
- if (state.getAttachedFragmentShader())
- {
- blockLinker->addShaderBlocks(GL_FRAGMENT_SHADER,
- &state.getAttachedFragmentShader()->getUniformBlocks(context));
- }
-
- if (state.getAttachedComputeShader())
- {
- blockLinker->addShaderBlocks(GL_COMPUTE_SHADER,
- &state.getAttachedComputeShader()->getUniformBlocks(context));
- }
-}
-
-void InitShaderStorageBlockLinker(const gl::Context *context,
- const ProgramState &state,
- ShaderStorageBlockLinker *blockLinker)
-{
- if (state.getAttachedVertexShader())
- {
- blockLinker->addShaderBlocks(
- GL_VERTEX_SHADER, &state.getAttachedVertexShader()->getShaderStorageBlocks(context));
- }
-
- if (state.getAttachedFragmentShader())
- {
- blockLinker->addShaderBlocks(
- GL_FRAGMENT_SHADER,
- &state.getAttachedFragmentShader()->getShaderStorageBlocks(context));
- }
-
- if (state.getAttachedComputeShader())
- {
- blockLinker->addShaderBlocks(
- GL_COMPUTE_SHADER, &state.getAttachedComputeShader()->getShaderStorageBlocks(context));
- }
-}
-
-} // anonymous namespace
-
-const char *const g_fakepath = "C:\\fakepath";
-
-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()
-{
-}
-
-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);
-}
-
-SamplerBinding::SamplerBinding(GLenum textureTypeIn, size_t elementCount, bool unreferenced)
- : textureType(textureTypeIn), boundTextureUnits(elementCount, 0), unreferenced(unreferenced)
-{
-}
-
-SamplerBinding::SamplerBinding(const SamplerBinding &other) = default;
-
-SamplerBinding::~SamplerBinding() = default;
-
-Program::Bindings::Bindings()
-{
-}
-
-Program::Bindings::~Bindings()
-{
-}
-
-void Program::Bindings::bindLocation(GLuint index, const std::string &name)
-{
- mBindings[name] = index;
-}
-
-int Program::Bindings::getBinding(const std::string &name) const
-{
- auto iter = mBindings.find(name);
- return (iter != mBindings.end()) ? iter->second : -1;
-}
-
-Program::Bindings::const_iterator Program::Bindings::begin() const
-{
- return mBindings.begin();
-}
-
-Program::Bindings::const_iterator Program::Bindings::end() const
-{
- return mBindings.end();
-}
-
-ImageBinding::ImageBinding(size_t count) : boundImageUnits(count, 0)
-{
-}
-ImageBinding::ImageBinding(GLuint imageUnit, size_t count)
-{
- 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::ProgramState()
- : mLabel(),
- mAttachedFragmentShader(nullptr),
- mAttachedVertexShader(nullptr),
- mAttachedComputeShader(nullptr),
- mAttachedGeometryShader(nullptr),
- mTransformFeedbackBufferMode(GL_INTERLEAVED_ATTRIBS),
- mMaxActiveAttribLocation(0),
- mSamplerUniformRange(0, 0),
- mImageUniformRange(0, 0),
- mAtomicCounterUniformRange(0, 0),
- mBinaryRetrieveableHint(false),
- mNumViews(-1)
-{
- mComputeShaderLocalSize.fill(1);
-}
-
-ProgramState::~ProgramState()
-{
- ASSERT(!mAttachedVertexShader && !mAttachedFragmentShader && !mAttachedComputeShader &&
- !mAttachedGeometryShader);
-}
-
-const std::string &ProgramState::getLabel()
-{
- return mLabel;
-}
-
-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::getAttributeLocation(const std::string &name) const
-{
- for (const sh::Attribute &attribute : mAttributes)
- {
- if (attribute.name == name)
- {
- return attribute.location;
- }
- }
-
- return static_cast<GLuint>(-1);
-}
-
-Program::Program(rx::GLImplFactory *factory, ShaderProgramManager *manager, GLuint handle)
- : mProgram(factory->createProgram(mState)),
- mValidated(false),
- mLinked(false),
- mDeleteStatus(false),
- mRefCount(0),
- mResourceManager(manager),
- mHandle(handle)
-{
- ASSERT(mProgram);
-
- unlink();
-}
-
-Program::~Program()
-{
- ASSERT(!mProgram);
-}
-
-void Program::onDestroy(const Context *context)
-{
- if (mState.mAttachedVertexShader != nullptr)
- {
- mState.mAttachedVertexShader->release(context);
- mState.mAttachedVertexShader = nullptr;
- }
-
- if (mState.mAttachedFragmentShader != nullptr)
- {
- mState.mAttachedFragmentShader->release(context);
- mState.mAttachedFragmentShader = nullptr;
- }
-
- if (mState.mAttachedComputeShader != nullptr)
- {
- mState.mAttachedComputeShader->release(context);
- mState.mAttachedComputeShader = nullptr;
- }
-
- if (mState.mAttachedGeometryShader != nullptr)
- {
- mState.mAttachedGeometryShader->release(context);
- mState.mAttachedGeometryShader = nullptr;
- }
-
- mProgram->destroy(context);
-
- ASSERT(!mState.mAttachedVertexShader && !mState.mAttachedFragmentShader &&
- !mState.mAttachedComputeShader && !mState.mAttachedGeometryShader);
- SafeDelete(mProgram);
-
- delete this;
-}
-
-void Program::setLabel(const std::string &label)
-{
- mState.mLabel = label;
-}
-
-const std::string &Program::getLabel() const
-{
- return mState.mLabel;
-}
-
-void Program::attachShader(Shader *shader)
-{
- switch (shader->getType())
- {
- case GL_VERTEX_SHADER:
- {
- ASSERT(!mState.mAttachedVertexShader);
- mState.mAttachedVertexShader = shader;
- mState.mAttachedVertexShader->addRef();
- break;
- }
- case GL_FRAGMENT_SHADER:
- {
- ASSERT(!mState.mAttachedFragmentShader);
- mState.mAttachedFragmentShader = shader;
- mState.mAttachedFragmentShader->addRef();
- break;
- }
- case GL_COMPUTE_SHADER:
- {
- ASSERT(!mState.mAttachedComputeShader);
- mState.mAttachedComputeShader = shader;
- mState.mAttachedComputeShader->addRef();
- break;
- }
- case GL_GEOMETRY_SHADER_EXT:
- {
- ASSERT(!mState.mAttachedGeometryShader);
- mState.mAttachedGeometryShader = shader;
- mState.mAttachedGeometryShader->addRef();
- break;
- }
- default:
- UNREACHABLE();
- }
-}
-
-void Program::detachShader(const Context *context, Shader *shader)
-{
- switch (shader->getType())
- {
- case GL_VERTEX_SHADER:
- {
- ASSERT(mState.mAttachedVertexShader == shader);
- shader->release(context);
- mState.mAttachedVertexShader = nullptr;
- break;
- }
- case GL_FRAGMENT_SHADER:
- {
- ASSERT(mState.mAttachedFragmentShader == shader);
- shader->release(context);
- mState.mAttachedFragmentShader = nullptr;
- break;
- }
- case GL_COMPUTE_SHADER:
- {
- ASSERT(mState.mAttachedComputeShader == shader);
- shader->release(context);
- mState.mAttachedComputeShader = nullptr;
- break;
- }
- case GL_GEOMETRY_SHADER_EXT:
- {
- ASSERT(mState.mAttachedGeometryShader == shader);
- shader->release(context);
- mState.mAttachedGeometryShader = nullptr;
- break;
- }
- default:
- UNREACHABLE();
- }
-}
-
-int Program::getAttachedShadersCount() const
-{
- return (mState.mAttachedVertexShader ? 1 : 0) + (mState.mAttachedFragmentShader ? 1 : 0) +
- (mState.mAttachedComputeShader ? 1 : 0) + (mState.mAttachedGeometryShader ? 1 : 0);
-}
-
-void Program::bindAttributeLocation(GLuint index, const char *name)
-{
- mAttributeBindings.bindLocation(index, name);
-}
-
-void Program::bindUniformLocation(GLuint index, const char *name)
-{
- mUniformLocationBindings.bindLocation(index, name);
-}
-
-void Program::bindFragmentInputLocation(GLint index, const char *name)
-{
- mFragmentInputBindings.bindLocation(index, name);
-}
-
-BindingInfo Program::getFragmentInputBindingInfo(const Context *context, GLint index) const
-{
- BindingInfo ret;
- ret.type = GL_NONE;
- ret.valid = false;
-
- Shader *fragmentShader = mState.getAttachedFragmentShader();
- ASSERT(fragmentShader);
-
- // Find the actual fragment shader varying we're interested in
- const std::vector<sh::Varying> &inputs = fragmentShader->getInputVaryings(context);
-
- for (const auto &binding : mFragmentInputBindings)
- {
- if (binding.second != 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(const Context *context,
- GLint index,
- GLenum genMode,
- GLint components,
- const GLfloat *coeffs)
-{
- // If the location is -1 then the command is silently ignored
- if (index == -1)
- return;
-
- const auto &binding = getFragmentInputBindingInfo(context, 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.
-Error Program::link(const gl::Context *context)
-{
- const auto &data = context->getContextState();
-
- auto *platform = ANGLEPlatformCurrent();
- double startTime = platform->currentTime(platform);
-
- unlink();
-
- ProgramHash programHash;
- auto *cache = context->getMemoryProgramCache();
- if (cache)
- {
- ANGLE_TRY_RESULT(cache->getProgram(context, this, &mState, &programHash), mLinked);
- ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.ProgramCache.LoadBinarySuccess", mLinked);
- }
-
- if (mLinked)
- {
- double delta = platform->currentTime(platform) - startTime;
- int us = static_cast<int>(delta * 1000000.0);
- ANGLE_HISTOGRAM_COUNTS("GPU.ANGLE.ProgramCache.ProgramCacheHitTimeUS", us);
- return NoError();
- }
-
- // Cache load failed, fall through to normal linking.
- unlink();
- mInfoLog.reset();
-
- const Caps &caps = data.getCaps();
-
- Shader *vertexShader = mState.mAttachedVertexShader;
- Shader *fragmentShader = mState.mAttachedFragmentShader;
- Shader *computeShader = mState.mAttachedComputeShader;
-
- bool isComputeShaderAttached = (computeShader != nullptr);
- bool nonComputeShadersAttached = (vertexShader != nullptr || fragmentShader != 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 && nonComputeShadersAttached == true)
- {
- mInfoLog << "Both a compute and non-compute shaders are attached to the same program.";
- return NoError();
- }
-
- if (computeShader)
- {
- if (!computeShader->isCompiled(context))
- {
- mInfoLog << "Attached compute shader is not compiled.";
- return NoError();
- }
- ASSERT(computeShader->getType() == GL_COMPUTE_SHADER);
-
- mState.mComputeShaderLocalSize = computeShader->getWorkGroupSize(context);
-
- // 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())
- {
- mInfoLog << "Work group size is not specified.";
- return NoError();
- }
-
- if (!linkUniforms(context, mInfoLog, mUniformLocationBindings))
- {
- return NoError();
- }
-
- if (!linkInterfaceBlocks(context, mInfoLog))
- {
- return NoError();
- }
-
- ProgramLinkedResources resources = {
- {0, PackMode::ANGLE_RELAXED},
- {&mState.mUniformBlocks, &mState.mUniforms},
- {&mState.mShaderStorageBlocks, &mState.mBufferVariables}};
-
- InitUniformBlockLinker(context, mState, &resources.uniformBlockLinker);
- InitShaderStorageBlockLinker(context, mState, &resources.shaderStorageBlockLinker);
-
- ANGLE_TRY_RESULT(mProgram->link(context, resources, mInfoLog), mLinked);
- if (!mLinked)
- {
- return NoError();
- }
- }
- else
- {
- if (!fragmentShader || !fragmentShader->isCompiled(context))
- {
- return NoError();
- }
- ASSERT(fragmentShader->getType() == GL_FRAGMENT_SHADER);
-
- if (!vertexShader || !vertexShader->isCompiled(context))
- {
- return NoError();
- }
- ASSERT(vertexShader->getType() == GL_VERTEX_SHADER);
-
- if (fragmentShader->getShaderVersion(context) != vertexShader->getShaderVersion(context))
- {
- mInfoLog << "Fragment shader version does not match vertex shader version.";
- return NoError();
- }
-
- if (!linkAttributes(context, mInfoLog))
- {
- return NoError();
- }
-
- if (!linkVaryings(context, mInfoLog))
- {
- return NoError();
- }
-
- if (!linkUniforms(context, mInfoLog, mUniformLocationBindings))
- {
- return NoError();
- }
-
- if (!linkInterfaceBlocks(context, mInfoLog))
- {
- return NoError();
- }
-
- if (!linkValidateGlobalNames(context, mInfoLog))
- {
- return NoError();
- }
-
- const auto &mergedVaryings = getMergedVaryings(context);
-
- mState.mNumViews = vertexShader->getNumViews(context);
-
- linkOutputVariables(context);
-
- // Map the varyings to the register file
- // In WebGL, we use a slightly different handling for packing variables.
- auto packMode = data.getExtensions().webglCompatibility ? PackMode::WEBGL_STRICT
- : PackMode::ANGLE_RELAXED;
-
- ProgramLinkedResources resources = {
- {data.getCaps().maxVaryingVectors, packMode},
- {&mState.mUniformBlocks, &mState.mUniforms},
- {&mState.mShaderStorageBlocks, &mState.mBufferVariables}};
-
- InitUniformBlockLinker(context, mState, &resources.uniformBlockLinker);
- InitShaderStorageBlockLinker(context, mState, &resources.shaderStorageBlockLinker);
-
- if (!linkValidateTransformFeedback(context, mInfoLog, mergedVaryings, caps))
- {
- return NoError();
- }
-
- if (!resources.varyingPacking.collectAndPackUserVaryings(
- mInfoLog, mergedVaryings, mState.getTransformFeedbackVaryingNames()))
- {
- return NoError();
- }
-
- ANGLE_TRY_RESULT(mProgram->link(context, resources, mInfoLog), mLinked);
- if (!mLinked)
- {
- return NoError();
- }
-
- gatherTransformFeedbackVaryings(mergedVaryings);
- }
-
- gatherAtomicCounterBuffers();
- initInterfaceBlockBindings();
-
- setUniformValuesFromBindingQualifiers();
-
- ASSERT(mLinked);
- updateLinkedShaderStages();
-
- // Mark implementation-specific unreferenced uniforms as ignored.
- mProgram->markUnusedUniformLocations(&mState.mUniformLocations, &mState.mSamplerBindings);
-
- // Save to the program cache.
- if (cache && (mState.mLinkedTransformFeedbackVaryings.empty() ||
- !context->getWorkarounds().disableProgramCachingForTransformFeedback))
- {
- cache->putProgram(programHash, context, this);
- }
-
- double delta = platform->currentTime(platform) - startTime;
- int us = static_cast<int>(delta * 1000000.0);
- ANGLE_HISTOGRAM_COUNTS("GPU.ANGLE.ProgramCache.ProgramCacheMissTimeUS", us);
-
- return NoError();
-}
-
-void Program::updateLinkedShaderStages()
-{
- if (mState.mAttachedVertexShader)
- {
- mState.mLinkedShaderStages.set(SHADER_VERTEX);
- }
-
- if (mState.mAttachedFragmentShader)
- {
- mState.mLinkedShaderStages.set(SHADER_FRAGMENT);
- }
-
- if (mState.mAttachedComputeShader)
- {
- mState.mLinkedShaderStages.set(SHADER_COMPUTE);
- }
-}
-
-// Returns the program object to an unlinked state, before re-linking, or at destruction
-void Program::unlink()
-{
- mState.mAttributes.clear();
- 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.mOutputVariableTypes.clear();
- mState.mActiveOutputVariables.reset();
- mState.mComputeShaderLocalSize.fill(1);
- mState.mSamplerBindings.clear();
- mState.mImageBindings.clear();
- mState.mNumViews = -1;
- mState.mLinkedShaderStages.reset();
-
- mValidated = false;
-
- mLinked = false;
-}
-
-bool Program::isLinked() const
-{
- return mLinked;
-}
-
-Error Program::loadBinary(const Context *context,
- GLenum binaryFormat,
- const void *binary,
- GLsizei length)
-{
- unlink();
-
-#if ANGLE_PROGRAM_BINARY_LOAD != ANGLE_ENABLED
- return NoError();
-#else
- ASSERT(binaryFormat == GL_PROGRAM_BINARY_ANGLE);
- if (binaryFormat != GL_PROGRAM_BINARY_ANGLE)
- {
- mInfoLog << "Invalid program binary format.";
- return NoError();
- }
-
- const uint8_t *bytes = reinterpret_cast<const uint8_t *>(binary);
- ANGLE_TRY_RESULT(
- MemoryProgramCache::Deserialize(context, this, &mState, bytes, length, mInfoLog), mLinked);
-
- // Currently we require the full shader text to compute the program hash.
- // TODO(jmadill): Store the binary in the internal program cache.
-
- return NoError();
-#endif // #if ANGLE_PROGRAM_BINARY_LOAD == ANGLE_ENABLED
-}
-
-Error Program::saveBinary(const Context *context,
- GLenum *binaryFormat,
- void *binary,
- GLsizei bufSize,
- GLsizei *length) const
-{
- if (binaryFormat)
- {
- *binaryFormat = GL_PROGRAM_BINARY_ANGLE;
- }
-
- angle::MemoryBuffer memoryBuf;
- MemoryProgramCache::Serialize(context, this, &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.
- return InternalError();
- }
-
- if (binary)
- {
- char *ptr = reinterpret_cast<char*>(binary);
-
- memcpy(ptr, streamState, streamLength);
- ptr += streamLength;
-
- ASSERT(ptr - streamLength == binary);
- }
-
- if (length)
- {
- *length = streamLength;
- }
-
- return NoError();
-}
-
-GLint Program::getBinaryLength(const Context *context) const
-{
- GLint length;
- Error error = saveBinary(context, nullptr, nullptr, std::numeric_limits<GLint>::max(), &length);
- if (error.isError())
- {
- return 0;
- }
-
- return length;
-}
-
-void Program::setBinaryRetrievableHint(bool retrievable)
-{
- // TODO(jmadill) : replace with dirty bits
- mProgram->setBinaryRetrievableHint(retrievable);
- mState.mBinaryRetrieveableHint = retrievable;
-}
-
-bool Program::getBinaryRetrievableHint() const
-{
- return mState.mBinaryRetrieveableHint;
-}
-
-void Program::setSeparable(bool separable)
-{
- // TODO(yunchao) : replace with dirty bits
- if (mState.mSeparable != separable)
- {
- mProgram->setSeparable(separable);
- mState.mSeparable = separable;
- }
-}
-
-bool Program::isSeparable() const
-{
- return mState.mSeparable;
-}
-
-void Program::release(const Context *context)
-{
- mRefCount--;
-
- if (mRefCount == 0 && mDeleteStatus)
- {
- mResourceManager->deleteProgram(context, mHandle);
- }
-}
-
-void Program::addRef()
-{
- mRefCount++;
-}
-
-unsigned int Program::getRefCount() const
-{
- return mRefCount;
-}
-
-int Program::getInfoLogLength() const
-{
- return static_cast<int>(mInfoLog.getLength());
-}
-
-void Program::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const
-{
- return mInfoLog.getLog(bufSize, length, infoLog);
-}
-
-void Program::getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders) const
-{
- int total = 0;
-
- if (mState.mAttachedComputeShader)
- {
- if (total < maxCount)
- {
- shaders[total] = mState.mAttachedComputeShader->getHandle();
- total++;
- }
- }
-
- if (mState.mAttachedVertexShader)
- {
- if (total < maxCount)
- {
- shaders[total] = mState.mAttachedVertexShader->getHandle();
- total++;
- }
- }
-
- if (mState.mAttachedFragmentShader)
- {
- if (total < maxCount)
- {
- shaders[total] = mState.mAttachedFragmentShader->getHandle();
- total++;
- }
- }
-
- if (mState.mAttachedGeometryShader)
- {
- if (total < maxCount)
- {
- shaders[total] = mState.mAttachedGeometryShader->getHandle();
- total++;
- }
- }
-
- if (count)
- {
- *count = total;
- }
-}
-
-GLuint Program::getAttributeLocation(const std::string &name) const
-{
- return mState.getAttributeLocation(name);
-}
-
-bool Program::isAttribLocationActive(size_t attribLocation) const
-{
- 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
-{
- 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
-{
- if (!mLinked)
- {
- return 0;
- }
-
- return static_cast<GLint>(mState.mAttributes.size());
-}
-
-GLint Program::getActiveAttributeMaxLength() const
-{
- 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);
-}
-
-GLuint Program::getInputResourceIndex(const GLchar *name) const
-{
- return GetResourceIndexFromName(mState.mAttributes, std::string(name));
-}
-
-GLuint Program::getOutputResourceIndex(const GLchar *name) const
-{
- return GetResourceIndexFromName(mState.mOutputVariables, std::string(name));
-}
-
-size_t Program::getOutputResourceCount() const
-{
- return (mLinked ? mState.mOutputVariables.size() : 0);
-}
-
-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
-{
- getResourceName(index, mState.mAttributes, bufSize, length, name);
-}
-
-void Program::getOutputResourceName(GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *name) const
-{
- getResourceName(index, mState.mOutputVariables, bufSize, length, name);
-}
-
-void Program::getUniformResourceName(GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *name) const
-{
- getResourceName(index, mState.mUniforms, bufSize, length, name);
-}
-
-void Program::getBufferVariableResourceName(GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *name) const
-{
- getResourceName(index, mState.mBufferVariables, bufSize, length, name);
-}
-
-const sh::Attribute &Program::getInputResource(GLuint index) const
-{
- ASSERT(index < mState.mAttributes.size());
- return mState.mAttributes[index];
-}
-
-const sh::OutputVariable &Program::getOutputResource(GLuint index) const
-{
- ASSERT(index < mState.mOutputVariables.size());
- return mState.mOutputVariables[index];
-}
-
-GLint Program::getFragDataLocation(const std::string &name) const
-{
- return GetVariableLocation(mState.mOutputVariables, mState.mOutputLocations, name);
-}
-
-void Program::getActiveUniform(GLuint index,
- GLsizei bufsize,
- GLsizei *length,
- GLint *size,
- GLenum *type,
- GLchar *name) const
-{
- 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
-{
- if (mLinked)
- {
- return static_cast<GLint>(mState.mUniforms.size());
- }
- else
- {
- return 0;
- }
-}
-
-size_t Program::getActiveBufferVariableCount() const
-{
- return mLinked ? mState.mBufferVariables.size() : 0;
-}
-
-GLint Program::getActiveUniformMaxLength() const
-{
- 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(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(location >= 0 && static_cast<size_t>(location) < mState.mUniformLocations.size());
- return mState.mUniforms[mState.getUniformIndexFromLocation(location)];
-}
-
-const VariableLocation &Program::getUniformLocation(GLint location) const
-{
- ASSERT(location >= 0 && static_cast<size_t>(location) < mState.mUniformLocations.size());
- return mState.mUniformLocations[location];
-}
-
-const std::vector<VariableLocation> &Program::getUniformLocations() const
-{
- return mState.mUniformLocations;
-}
-
-const LinkedUniform &Program::getUniformByIndex(GLuint index) const
-{
- ASSERT(index < static_cast<size_t>(mState.mUniforms.size()));
- return mState.mUniforms[index];
-}
-
-const BufferVariable &Program::getBufferVariableByIndex(GLuint index) const
-{
- ASSERT(index < static_cast<size_t>(mState.mBufferVariables.size()));
- return mState.mBufferVariables[index];
-}
-
-GLint Program::getUniformLocation(const std::string &name) const
-{
- return GetVariableLocation(mState.mUniforms, mState.mUniformLocations, name);
-}
-
-GLuint Program::getUniformIndex(const std::string &name) const
-{
- return mState.getUniformIndexFromName(name);
-}
-
-void Program::setUniform1fv(GLint location, GLsizei count, const GLfloat *v)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- const VariableLocation &locationInfo = mState.mUniformLocations[location];
- GLsizei clampedCount = clampUniformCount(locationInfo, count, 4, v);
- mProgram->setUniform4fv(location, clampedCount, v);
-}
-
-Program::SetUniformResult Program::setUniform1iv(GLint location, GLsizei count, const GLint *v)
-{
- const VariableLocation &locationInfo = mState.mUniformLocations[location];
- GLsizei clampedCount = clampUniformCount(locationInfo, count, 1, v);
-
- mProgram->setUniform1iv(location, clampedCount, v);
-
- if (mState.isSamplerUniformIndex(locationInfo.index))
- {
- updateSamplerUniform(locationInfo, clampedCount, v);
- return SetUniformResult::SamplerChanged;
- }
-
- return SetUniformResult::NoSamplerChange;
-}
-
-void Program::setUniform2iv(GLint location, GLsizei count, const GLint *v)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- 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)
-{
- GLsizei clampedCount = clampMatrixUniformCount<4, 3>(location, count, transpose, v);
- mProgram->setUniformMatrix4x3fv(location, clampedCount, transpose, v);
-}
-
-void Program::getUniformfv(const Context *context, GLint location, GLfloat *v) const
-{
- const auto &uniformLocation = mState.getUniformLocations()[location];
- const auto &uniform = mState.getUniforms()[uniformLocation.index];
-
- GLenum nativeType = gl::VariableComponentType(uniform.type);
- if (nativeType == GL_FLOAT)
- {
- mProgram->getUniformfv(context, location, v);
- }
- else
- {
- getUniformInternal(context, v, location, nativeType,
- gl::VariableComponentCount(uniform.type));
- }
-}
-
-void Program::getUniformiv(const Context *context, GLint location, GLint *v) const
-{
- const auto &uniformLocation = mState.getUniformLocations()[location];
- const auto &uniform = mState.getUniforms()[uniformLocation.index];
-
- GLenum nativeType = gl::VariableComponentType(uniform.type);
- if (nativeType == GL_INT || nativeType == GL_BOOL)
- {
- mProgram->getUniformiv(context, location, v);
- }
- else
- {
- getUniformInternal(context, v, location, nativeType,
- gl::VariableComponentCount(uniform.type));
- }
-}
-
-void Program::getUniformuiv(const Context *context, GLint location, GLuint *v) const
-{
- const auto &uniformLocation = mState.getUniformLocations()[location];
- const auto &uniform = mState.getUniforms()[uniformLocation.index];
-
- GLenum nativeType = gl::VariableComponentType(uniform.type);
- if (nativeType == GL_UNSIGNED_INT)
- {
- mProgram->getUniformuiv(context, location, v);
- }
- else
- {
- getUniformInternal(context, v, location, nativeType,
- gl::VariableComponentCount(uniform.type));
- }
-}
-
-void Program::flagForDeletion()
-{
- mDeleteStatus = true;
-}
-
-bool Program::isFlaggedForDeletion() const
-{
- return mDeleteStatus;
-}
-
-void Program::validate(const Caps &caps)
-{
- mInfoLog.reset();
-
- if (mLinked)
- {
- mValidated = ConvertToBool(mProgram->validate(caps, &mInfoLog));
- }
- else
- {
- mInfoLog << "Program has not been successfully linked.";
- }
-}
-
-bool Program::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();
- }
-
- if (mTextureUnitTypesCache.empty())
- {
- mTextureUnitTypesCache.resize(caps.maxCombinedTextureImageUnits, GL_NONE);
- }
- else
- {
- std::fill(mTextureUnitTypesCache.begin(), mTextureUnitTypesCache.end(), GL_NONE);
- }
-
- // 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 (const auto &samplerBinding : mState.mSamplerBindings)
- {
- if (samplerBinding.unreferenced)
- continue;
-
- GLenum textureType = samplerBinding.textureType;
-
- for (GLuint textureUnit : samplerBinding.boundTextureUnits)
- {
- if (textureUnit >= caps.maxCombinedTextureImageUnits)
- {
- if (infoLog)
- {
- (*infoLog) << "Sampler uniform (" << textureUnit
- << ") exceeds GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS ("
- << caps.maxCombinedTextureImageUnits << ")";
- }
-
- mCachedValidateSamplersResult = false;
- return false;
- }
-
- if (mTextureUnitTypesCache[textureUnit] != GL_NONE)
- {
- if (textureType != mTextureUnitTypesCache[textureUnit])
- {
- if (infoLog)
- {
- (*infoLog) << "Samplers of conflicting types refer to the same texture "
- "image unit ("
- << textureUnit << ").";
- }
-
- mCachedValidateSamplersResult = false;
- return false;
- }
- }
- else
- {
- mTextureUnitTypesCache[textureUnit] = textureType;
- }
- }
- }
-
- mCachedValidateSamplersResult = true;
- return true;
-}
-
-bool Program::isValidated() const
-{
- return mValidated;
-}
-
-GLuint Program::getActiveUniformBlockCount() const
-{
- return static_cast<GLuint>(mState.mUniformBlocks.size());
-}
-
-GLuint Program::getActiveAtomicCounterBufferCount() const
-{
- return static_cast<GLuint>(mState.mAtomicCounterBuffers.size());
-}
-
-GLuint Program::getActiveShaderStorageBlockCount() const
-{
- return static_cast<GLuint>(mState.mShaderStorageBlocks.size());
-}
-
-void Program::getActiveUniformBlockName(const GLuint blockIndex,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *blockName) const
-{
- GetInterfaceBlockName(blockIndex, mState.mUniformBlocks, bufSize, length, blockName);
-}
-
-void Program::getActiveShaderStorageBlockName(const GLuint blockIndex,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *blockName) const
-{
-
- GetInterfaceBlockName(blockIndex, mState.mShaderStorageBlocks, bufSize, length, blockName);
-}
-
-GLint Program::getActiveUniformBlockMaxLength() const
-{
- int maxLength = 0;
-
- if (mLinked)
- {
- unsigned int numUniformBlocks = static_cast<unsigned int>(mState.mUniformBlocks.size());
- for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < numUniformBlocks; uniformBlockIndex++)
- {
- const InterfaceBlock &uniformBlock = mState.mUniformBlocks[uniformBlockIndex];
- if (!uniformBlock.name.empty())
- {
- int length = static_cast<int>(uniformBlock.nameWithArrayIndex().length());
- maxLength = std::max(length + 1, maxLength);
- }
- }
- }
-
- return maxLength;
-}
-
-GLuint Program::getUniformBlockIndex(const std::string &name) const
-{
- return GetInterfaceBlockIndex(mState.mUniformBlocks, name);
-}
-
-GLuint Program::getShaderStorageBlockIndex(const std::string &name) const
-{
- return GetInterfaceBlockIndex(mState.mShaderStorageBlocks, name);
-}
-
-const InterfaceBlock &Program::getUniformBlockByIndex(GLuint index) const
-{
- ASSERT(index < static_cast<GLuint>(mState.mUniformBlocks.size()));
- return mState.mUniformBlocks[index];
-}
-
-const InterfaceBlock &Program::getShaderStorageBlockByIndex(GLuint index) const
-{
- ASSERT(index < static_cast<GLuint>(mState.mShaderStorageBlocks.size()));
- return mState.mShaderStorageBlocks[index];
-}
-
-void Program::bindUniformBlock(GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- mState.mUniformBlocks[uniformBlockIndex].binding = uniformBlockBinding;
- mState.mActiveUniformBlockBindings.set(uniformBlockIndex, uniformBlockBinding != 0);
- mProgram->setUniformBlockBinding(uniformBlockIndex, uniformBlockBinding);
-}
-
-GLuint Program::getUniformBlockBinding(GLuint uniformBlockIndex) const
-{
- return mState.getUniformBlockBinding(uniformBlockIndex);
-}
-
-GLuint Program::getShaderStorageBlockBinding(GLuint shaderStorageBlockIndex) const
-{
- return mState.getShaderStorageBlockBinding(shaderStorageBlockIndex);
-}
-
-void Program::setTransformFeedbackVaryings(GLsizei count, const GLchar *const *varyings, GLenum bufferMode)
-{
- 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
-{
- 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
-{
- if (mLinked)
- {
- return static_cast<GLsizei>(mState.mLinkedTransformFeedbackVaryings.size());
- }
- else
- {
- return 0;
- }
-}
-
-GLsizei Program::getTransformFeedbackVaryingMaxLength() const
-{
- 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
-{
- return mState.mTransformFeedbackBufferMode;
-}
-
-bool Program::linkVaryings(const Context *context, InfoLog &infoLog) const
-{
- Shader *vertexShader = mState.mAttachedVertexShader;
- Shader *fragmentShader = mState.mAttachedFragmentShader;
-
- ASSERT(vertexShader->getShaderVersion(context) == fragmentShader->getShaderVersion(context));
-
- const std::vector<sh::Varying> &vertexVaryings = vertexShader->getOutputVaryings(context);
- const std::vector<sh::Varying> &fragmentVaryings = fragmentShader->getInputVaryings(context);
-
- std::map<GLuint, std::string> staticFragmentInputLocations;
-
- for (const sh::Varying &output : fragmentVaryings)
- {
- bool matched = false;
-
- // Built-in varyings obey special rules
- if (output.isBuiltIn())
- {
- continue;
- }
-
- for (const sh::Varying &input : vertexVaryings)
- {
- if (output.name == input.name)
- {
- ASSERT(!input.isBuiltIn());
- if (!linkValidateVaryings(infoLog, output.name, input, output,
- vertexShader->getShaderVersion(context)))
- {
- return false;
- }
-
- matched = true;
- break;
- }
- }
-
- // We permit unmatched, unreferenced varyings
- if (!matched && output.staticUse)
- {
- infoLog << "Fragment varying " << output.name << " does not match any vertex varying";
- return false;
- }
-
- // Check for aliased path rendering input bindings (if any).
- // If more than one binding refer statically to the same
- // location the link must fail.
-
- if (!output.staticUse)
- continue;
-
- const auto inputBinding = mFragmentInputBindings.getBinding(output.name);
- if (inputBinding == -1)
- continue;
-
- const auto it = staticFragmentInputLocations.find(inputBinding);
- if (it == std::end(staticFragmentInputLocations))
- {
- staticFragmentInputLocations.insert(std::make_pair(inputBinding, output.name));
- }
- else
- {
- infoLog << "Binding for fragment input " << output.name << " conflicts with "
- << it->second;
- return false;
- }
- }
-
- if (!linkValidateBuiltInVaryings(context, infoLog))
- {
- return false;
- }
-
- // TODO(jmadill): verify no unmatched vertex varyings?
-
- return true;
-}
-
-bool Program::linkUniforms(const Context *context,
- InfoLog &infoLog,
- const Bindings &uniformLocationBindings)
-{
- UniformLinker linker(mState);
- if (!linker.link(context, infoLog, uniformLocationBindings))
- {
- return false;
- }
-
- linker.getResults(&mState.mUniforms, &mState.mUniformLocations);
-
- linkSamplerAndImageBindings();
-
- if (!linkAtomicCounterBuffers())
- {
- return false;
- }
-
- return true;
-}
-
-void Program::linkSamplerAndImageBindings()
-{
- 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);
-
- // 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()));
- }
- }
-
- 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];
- GLenum textureType = SamplerTypeToTextureType(samplerUniform.type);
- mState.mSamplerBindings.emplace_back(
- SamplerBinding(textureType, samplerUniform.getBasicTypeElementCount(), false));
- }
-}
-
-bool Program::linkAtomicCounterBuffers()
-{
- for (unsigned int index : mState.mAtomicCounterUniformRange)
- {
- auto &uniform = mState.mUniforms[index];
- 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|Combined]AtomicCounterBuffers.
-
- return true;
-}
-
-bool Program::linkValidateInterfaceBlockFields(InfoLog &infoLog,
- const std::string &uniformName,
- const sh::InterfaceBlockField &vertexUniform,
- const sh::InterfaceBlockField &fragmentUniform,
- bool webglCompatibility)
-{
- // If webgl, validate precision of UBO fields, otherwise don't. See Khronos bug 10287.
- if (!linkValidateVariablesBase(infoLog, uniformName, vertexUniform, fragmentUniform,
- webglCompatibility))
- {
- return false;
- }
-
- if (vertexUniform.isRowMajorLayout != fragmentUniform.isRowMajorLayout)
- {
- infoLog << "Matrix packings for " << uniformName << " differ between vertex and fragment shaders";
- return false;
- }
-
- return true;
-}
-
-// Assigns locations to all attributes from the bindings and program locations.
-bool Program::linkAttributes(const Context *context, InfoLog &infoLog)
-{
- const ContextState &data = context->getContextState();
- auto *vertexShader = mState.getAttachedVertexShader();
-
- unsigned int usedLocations = 0;
- mState.mAttributes = vertexShader->getActiveAttributes(context);
- GLuint maxAttribs = data.getCaps().maxVertexAttributes;
-
- // TODO(jmadill): handle aliasing robustly
- if (mState.mAttributes.size() > maxAttribs)
- {
- infoLog << "Too many vertex attributes.";
- return false;
- }
-
- std::vector<sh::Attribute *> usedAttribMap(maxAttribs, nullptr);
-
- // Link attributes that have a binding location
- 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.name);
- 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 << "Active 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 3.00, attribute aliasing produces a link error
- // In GLSL 1.00, attribute aliasing is allowed, but ANGLE currently has a bug
- if (linkedAttribute)
- {
- // TODO(jmadill): fix aliasing on ES2
- // if (mProgram->getShaderVersion() >= 300)
- {
- infoLog << "Attribute '" << attribute.name << "' aliases attribute '"
- << linkedAttribute->name << "' at location " << regLocation;
- return false;
- }
- }
- else
- {
- usedAttribMap[regLocation] = &attribute;
- }
-
- usedLocations |= 1 << regLocation;
- }
- }
- }
-
- // Link 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 active attributes (" << attribute.name << ")";
- return false;
- }
-
- attribute.location = availableIndex;
- }
- }
-
- for (const sh::Attribute &attribute : mState.mAttributes)
- {
- 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);
- }
- }
-
- return true;
-}
-
-bool Program::validateVertexAndFragmentInterfaceBlocks(
- const std::vector<sh::InterfaceBlock> &vertexInterfaceBlocks,
- const std::vector<sh::InterfaceBlock> &fragmentInterfaceBlocks,
- InfoLog &infoLog,
- bool webglCompatibility) const
-{
- // Check that interface blocks defined in the vertex and fragment shaders are identical
- typedef std::map<std::string, const sh::InterfaceBlock *> InterfaceBlockMap;
- InterfaceBlockMap linkedInterfaceBlocks;
-
- for (const sh::InterfaceBlock &vertexInterfaceBlock : vertexInterfaceBlocks)
- {
- linkedInterfaceBlocks[vertexInterfaceBlock.name] = &vertexInterfaceBlock;
- }
-
- for (const sh::InterfaceBlock &fragmentInterfaceBlock : fragmentInterfaceBlocks)
- {
- auto entry = linkedInterfaceBlocks.find(fragmentInterfaceBlock.name);
- if (entry != linkedInterfaceBlocks.end())
- {
- const sh::InterfaceBlock &vertexInterfaceBlock = *entry->second;
- if (!areMatchingInterfaceBlocks(infoLog, vertexInterfaceBlock, fragmentInterfaceBlock,
- webglCompatibility))
- {
- return false;
- }
- }
- // TODO(jiajia.qin@intel.com): Add
- // MAX_COMBINED_UNIFORM_BLOCKS/MAX_COMBINED_SHADER_STORAGE_BLOCKS validation.
- }
- return true;
-}
-
-bool Program::linkInterfaceBlocks(const Context *context, InfoLog &infoLog)
-{
- const auto &caps = context->getCaps();
-
- if (mState.mAttachedComputeShader)
- {
- Shader &computeShader = *mState.mAttachedComputeShader;
- const auto &computeUniformBlocks = computeShader.getUniformBlocks(context);
-
- if (!validateInterfaceBlocksCount(
- caps.maxComputeUniformBlocks, computeUniformBlocks,
- "Compute shader uniform block count exceeds GL_MAX_COMPUTE_UNIFORM_BLOCKS (",
- infoLog))
- {
- return false;
- }
-
- const auto &computeShaderStorageBlocks = computeShader.getShaderStorageBlocks(context);
- if (!validateInterfaceBlocksCount(caps.maxComputeShaderStorageBlocks,
- computeShaderStorageBlocks,
- "Compute shader shader storage block count exceeds "
- "GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS (",
- infoLog))
- {
- return false;
- }
- return true;
- }
-
- Shader &vertexShader = *mState.mAttachedVertexShader;
- Shader &fragmentShader = *mState.mAttachedFragmentShader;
-
- const auto &vertexUniformBlocks = vertexShader.getUniformBlocks(context);
- const auto &fragmentUniformBlocks = fragmentShader.getUniformBlocks(context);
-
- if (!validateInterfaceBlocksCount(
- caps.maxVertexUniformBlocks, vertexUniformBlocks,
- "Vertex shader uniform block count exceeds GL_MAX_VERTEX_UNIFORM_BLOCKS (", infoLog))
- {
- return false;
- }
- if (!validateInterfaceBlocksCount(
- caps.maxFragmentUniformBlocks, fragmentUniformBlocks,
- "Fragment shader uniform block count exceeds GL_MAX_FRAGMENT_UNIFORM_BLOCKS (",
- infoLog))
- {
-
- return false;
- }
-
- bool webglCompatibility = context->getExtensions().webglCompatibility;
- if (!validateVertexAndFragmentInterfaceBlocks(vertexUniformBlocks, fragmentUniformBlocks,
- infoLog, webglCompatibility))
- {
- return false;
- }
-
- if (context->getClientVersion() >= Version(3, 1))
- {
- const auto &vertexShaderStorageBlocks = vertexShader.getShaderStorageBlocks(context);
- const auto &fragmentShaderStorageBlocks = fragmentShader.getShaderStorageBlocks(context);
-
- if (!validateInterfaceBlocksCount(caps.maxVertexShaderStorageBlocks,
- vertexShaderStorageBlocks,
- "Vertex shader shader storage block count exceeds "
- "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS (",
- infoLog))
- {
- return false;
- }
- if (!validateInterfaceBlocksCount(caps.maxFragmentShaderStorageBlocks,
- fragmentShaderStorageBlocks,
- "Fragment shader shader storage block count exceeds "
- "GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS (",
- infoLog))
- {
-
- return false;
- }
-
- if (!validateVertexAndFragmentInterfaceBlocks(vertexShaderStorageBlocks,
- fragmentShaderStorageBlocks, infoLog,
- webglCompatibility))
- {
- return false;
- }
- }
- return true;
-}
-
-bool Program::areMatchingInterfaceBlocks(InfoLog &infoLog,
- const sh::InterfaceBlock &vertexInterfaceBlock,
- const sh::InterfaceBlock &fragmentInterfaceBlock,
- bool webglCompatibility) const
-{
- const char* blockName = vertexInterfaceBlock.name.c_str();
- // validate blocks for the same member types
- if (vertexInterfaceBlock.fields.size() != fragmentInterfaceBlock.fields.size())
- {
- infoLog << "Types for interface block '" << blockName
- << "' differ between vertex and fragment shaders";
- return false;
- }
- if (vertexInterfaceBlock.arraySize != fragmentInterfaceBlock.arraySize)
- {
- infoLog << "Array sizes differ for interface block '" << blockName
- << "' between vertex and fragment shaders";
- return false;
- }
- if (vertexInterfaceBlock.layout != fragmentInterfaceBlock.layout ||
- vertexInterfaceBlock.isRowMajorLayout != fragmentInterfaceBlock.isRowMajorLayout ||
- vertexInterfaceBlock.binding != fragmentInterfaceBlock.binding)
- {
- infoLog << "Layout qualifiers differ for interface block '" << blockName
- << "' between vertex and fragment shaders";
- return false;
- }
- const unsigned int numBlockMembers =
- static_cast<unsigned int>(vertexInterfaceBlock.fields.size());
- for (unsigned int blockMemberIndex = 0; blockMemberIndex < numBlockMembers; blockMemberIndex++)
- {
- const sh::InterfaceBlockField &vertexMember = vertexInterfaceBlock.fields[blockMemberIndex];
- const sh::InterfaceBlockField &fragmentMember = fragmentInterfaceBlock.fields[blockMemberIndex];
- if (vertexMember.name != fragmentMember.name)
- {
- infoLog << "Name mismatch for field " << blockMemberIndex
- << " of interface block '" << blockName
- << "': (in vertex: '" << vertexMember.name
- << "', in fragment: '" << fragmentMember.name << "')";
- return false;
- }
- std::string memberName = "interface block '" + vertexInterfaceBlock.name + "' member '" + vertexMember.name + "'";
- if (!linkValidateInterfaceBlockFields(infoLog, memberName, vertexMember, fragmentMember,
- webglCompatibility))
- {
- return false;
- }
- }
- return true;
-}
-
-bool Program::linkValidateVariablesBase(InfoLog &infoLog, const std::string &variableName, const sh::ShaderVariable &vertexVariable,
- const sh::ShaderVariable &fragmentVariable, bool validatePrecision)
-{
- if (vertexVariable.type != fragmentVariable.type)
- {
- infoLog << "Types for " << variableName << " differ between vertex and fragment shaders";
- return false;
- }
- if (vertexVariable.arraySizes != fragmentVariable.arraySizes)
- {
- infoLog << "Array sizes for " << variableName << " differ between vertex and fragment shaders";
- return false;
- }
- if (validatePrecision && vertexVariable.precision != fragmentVariable.precision)
- {
- infoLog << "Precisions for " << variableName << " differ between vertex and fragment shaders";
- return false;
- }
- if (vertexVariable.structName != fragmentVariable.structName)
- {
- infoLog << "Structure names for " << variableName
- << " differ between vertex and fragment shaders";
- return false;
- }
-
- if (vertexVariable.fields.size() != fragmentVariable.fields.size())
- {
- infoLog << "Structure lengths for " << variableName << " differ between vertex and fragment shaders";
- return false;
- }
- const unsigned int numMembers = static_cast<unsigned int>(vertexVariable.fields.size());
- for (unsigned int memberIndex = 0; memberIndex < numMembers; memberIndex++)
- {
- const sh::ShaderVariable &vertexMember = vertexVariable.fields[memberIndex];
- const sh::ShaderVariable &fragmentMember = fragmentVariable.fields[memberIndex];
-
- if (vertexMember.name != fragmentMember.name)
- {
- infoLog << "Name mismatch for field '" << memberIndex
- << "' of " << variableName
- << ": (in vertex: '" << vertexMember.name
- << "', in fragment: '" << fragmentMember.name << "')";
- return false;
- }
-
- const std::string memberName = variableName.substr(0, variableName.length() - 1) + "." +
- vertexMember.name + "'";
-
- if (!linkValidateVariablesBase(infoLog, vertexMember.name, vertexMember, fragmentMember, validatePrecision))
- {
- return false;
- }
- }
-
- return true;
-}
-
-bool Program::linkValidateVaryings(InfoLog &infoLog,
- const std::string &varyingName,
- const sh::Varying &vertexVarying,
- const sh::Varying &fragmentVarying,
- int shaderVersion)
-{
- if (!linkValidateVariablesBase(infoLog, varyingName, vertexVarying, fragmentVarying, false))
- {
- return false;
- }
-
- if (!sh::InterpolationTypesMatch(vertexVarying.interpolation, fragmentVarying.interpolation))
- {
- infoLog << "Interpolation types for " << varyingName
- << " differ between vertex and fragment shaders.";
- return false;
- }
-
- if (shaderVersion == 100 && vertexVarying.isInvariant != fragmentVarying.isInvariant)
- {
- infoLog << "Invariance for " << varyingName
- << " differs between vertex and fragment shaders.";
- return false;
- }
-
- return true;
-}
-
-bool Program::linkValidateBuiltInVaryings(const Context *context, InfoLog &infoLog) const
-{
- Shader *vertexShader = mState.mAttachedVertexShader;
- Shader *fragmentShader = mState.mAttachedFragmentShader;
- const auto &vertexVaryings = vertexShader->getOutputVaryings(context);
- const auto &fragmentVaryings = fragmentShader->getInputVaryings(context);
- int shaderVersion = vertexShader->getShaderVersion(context);
-
- 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 gl::Context *context,
- InfoLog &infoLog,
- const Program::MergedVaryings &varyings,
- const Caps &caps) const
-{
- size_t totalComponents = 0;
-
- std::set<std::string> uniqueNames;
-
- for (const std::string &tfVaryingName : mState.mTransformFeedbackVaryingNames)
- {
- bool found = false;
- std::vector<unsigned int> subscripts;
- std::string baseName = ParseResourceName(tfVaryingName, &subscripts);
-
- for (const auto &ref : varyings)
- {
- const sh::Varying *varying = ref.second.get();
-
- if (baseName == varying->name)
- {
- if (uniqueNames.count(tfVaryingName) > 0)
- {
- infoLog << "Two transform feedback varyings specify the same output variable ("
- << tfVaryingName << ").";
- return false;
- }
- if (context->getClientVersion() >= Version(3, 1))
- {
- if (IncludeSameArrayElement(uniqueNames, tfVaryingName))
- {
- infoLog
- << "Two transform feedback varyings include the same array element ("
- << tfVaryingName << ").";
- return false;
- }
- }
- else if (varying->isArray())
- {
- infoLog << "Capture of arrays is undefined and not supported.";
- return false;
- }
-
- uniqueNames.insert(tfVaryingName);
-
- // TODO(jmadill): Investigate implementation limits on D3D11
-
- // GLSL ES 3.10 section 4.3.6: A vertex output can't be an array of arrays.
- ASSERT(!varying->isArrayOfArrays());
- size_t elementCount =
- ((varying->isArray() && subscripts.empty()) ? varying->getOutermostArraySize()
- : 1);
- size_t componentCount = VariableComponentCount(varying->type) * elementCount;
- if (mState.mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS &&
- componentCount > caps.maxTransformFeedbackSeparateComponents)
- {
- infoLog << "Transform feedback varying's " << varying->name << " components ("
- << componentCount << ") exceed the maximum separate components ("
- << caps.maxTransformFeedbackSeparateComponents << ").";
- return false;
- }
-
- totalComponents += componentCount;
- found = true;
- break;
- }
- }
- if (context->getClientVersion() < Version(3, 1) &&
- tfVaryingName.find('[') != std::string::npos)
- {
- infoLog << "Capture of array elements is undefined and not supported.";
- return false;
- }
- if (!found)
- {
- infoLog << "Transform feedback varying " << tfVaryingName
- << " does not exist in the vertex shader.";
- return false;
- }
- }
-
- 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(const Context *context, InfoLog &infoLog) const
-{
- const std::vector<sh::Uniform> &vertexUniforms =
- mState.mAttachedVertexShader->getUniforms(context);
- const std::vector<sh::Uniform> &fragmentUniforms =
- mState.mAttachedFragmentShader->getUniforms(context);
- const std::vector<sh::Attribute> &attributes =
- mState.mAttachedVertexShader->getActiveAttributes(context);
- for (const auto &attrib : attributes)
- {
- for (const auto &uniform : vertexUniforms)
- {
- if (uniform.name == attrib.name)
- {
- infoLog << "Name conflicts between a uniform and an attribute: " << attrib.name;
- return false;
- }
- }
- for (const auto &uniform : fragmentUniforms)
- {
- if (uniform.name == attrib.name)
- {
- infoLog << "Name conflicts between a uniform and an attribute: " << attrib.name;
- return false;
- }
- }
- }
- return true;
-}
-
-void Program::gatherTransformFeedbackVaryings(const Program::MergedVaryings &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;
- }
- }
- }
-}
-
-Program::MergedVaryings Program::getMergedVaryings(const Context *context) const
-{
- MergedVaryings merged;
-
- for (const sh::Varying &varying : mState.mAttachedVertexShader->getOutputVaryings(context))
- {
- merged[varying.name].vertex = &varying;
- }
-
- for (const sh::Varying &varying : mState.mAttachedFragmentShader->getInputVaryings(context))
- {
- merged[varying.name].fragment = &varying;
- }
-
- return merged;
-}
-
-
-void Program::linkOutputVariables(const Context *context)
-{
- Shader *fragmentShader = mState.mAttachedFragmentShader;
- ASSERT(fragmentShader != nullptr);
-
- ASSERT(mState.mOutputVariableTypes.empty());
- ASSERT(mState.mActiveOutputVariables.none());
-
- // Gather output variable types
- for (const auto &outputVariable : fragmentShader->getActiveOutputVariables(context))
- {
- 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);
- }
- }
-
- // Skip this step for GLES2 shaders.
- if (fragmentShader->getShaderVersion(context) == 100)
- return;
-
- mState.mOutputVariables = fragmentShader->getActiveOutputVariables(context);
- // TODO(jmadill): any caps validation here?
-
- for (unsigned int outputVariableIndex = 0; outputVariableIndex < mState.mOutputVariables.size();
- outputVariableIndex++)
- {
- const sh::OutputVariable &outputVariable = mState.mOutputVariables[outputVariableIndex];
-
- 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.
- mState.mOutputVariables[outputVariableIndex].name += "[0]";
- mState.mOutputVariables[outputVariableIndex].mappedName += "[0]";
- }
-
- // Don't store outputs for gl_FragDepth, gl_FragColor, etc.
- if (outputVariable.isBuiltIn())
- continue;
-
- // Since multiple output locations must be specified, use 0 for non-specified locations.
- 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.mOutputLocations.size())
- {
- mState.mOutputLocations.resize(location + 1);
- }
- ASSERT(!mState.mOutputLocations.at(location).used());
- if (outputVariable.isArray())
- {
- mState.mOutputLocations[location] =
- VariableLocation(elementIndex, outputVariableIndex);
- }
- else
- {
- VariableLocation locationInfo;
- locationInfo.index = outputVariableIndex;
- mState.mOutputLocations[location] = locationInfo;
- }
- }
- }
-}
-
-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);
- }
- setUniform1iv(location, static_cast<GLsizei>(boundTextureUnits.size()),
- boundTextureUnits.data());
- }
- }
-}
-
-void Program::gatherAtomicCounterBuffers()
-{
- 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;
- }
-
- // TODO(jie.a.chen@intel.com): Get the actual BUFFER_DATA_SIZE from backend for each buffer.
-}
-
-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(const VariableLocation &locationInfo,
- GLsizei clampedCount,
- const GLint *v)
-{
- ASSERT(mState.isSamplerUniformIndex(locationInfo.index));
- GLuint samplerIndex = mState.getSamplerIndexFromUniformIndex(locationInfo.index);
- std::vector<GLuint> *boundTextureUnits =
- &mState.mSamplerBindings[samplerIndex].boundTextureUnits;
-
- std::copy(v, v + clampedCount, boundTextureUnits->begin() + locationInfo.arrayIndex);
-
- // Invalidate the validation cache.
- mCachedValidateSamplersResult.reset();
-}
-
-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;
- }
-}
-
-bool Program::samplesFromTexture(const gl::State &state, GLuint textureID) const
-{
- // Must be called after samplers are validated.
- ASSERT(mCachedValidateSamplersResult.valid() && mCachedValidateSamplersResult.value());
-
- for (const auto &binding : mState.mSamplerBindings)
- {
- GLenum textureType = binding.textureType;
- for (const auto &unit : binding.boundTextureUnits)
- {
- GLenum programTextureID = state.getSamplerTextureId(unit, textureType);
- if (programTextureID == textureID)
- {
- // TODO(jmadill): Check for appropriate overlap.
- return true;
- }
- }
- }
-
- return false;
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Program.h b/src/3rdparty/angle/src/libANGLE/Program.h
deleted file mode 100644
index c242d84671..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Program.h
+++ /dev/null
@@ -1,735 +0,0 @@
-//
-// 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/angleutils.h"
-#include "common/mathutil.h"
-#include "common/Optional.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 gl
-{
-struct Caps;
-class Context;
-class ContextState;
-class Shader;
-class ShaderProgramManager;
-class State;
-class InfoLog;
-class Buffer;
-class Framebuffer;
-
-extern const char * const g_fakepath;
-
-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() : ""; }
-
- private:
- void ensureInitialized()
- {
- if (!mLazyStream)
- {
- mLazyStream.reset(new std::stringstream());
- }
- }
-
- std::unique_ptr<std::stringstream> mLazyStream;
-};
-
-// 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; }
-
- // "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(GLenum textureTypeIn, size_t elementCount, bool unreferenced);
- SamplerBinding(const SamplerBinding &other);
- ~SamplerBinding();
-
- // Necessary for retrieving active textures from the GL state.
- GLenum textureType;
-
- // 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());
- }
- 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);
- ImageBinding(const ImageBinding &other);
- ~ImageBinding();
-
- std::vector<GLuint> boundImageUnits;
-};
-
-using ShaderStagesMask = angle::BitSet<SHADER_TYPE_MAX>;
-
-class ProgramState final : angle::NonCopyable
-{
- public:
- ProgramState();
- ~ProgramState();
-
- const std::string &getLabel();
-
- Shader *getAttachedVertexShader() const { return mAttachedVertexShader; }
- Shader *getAttachedFragmentShader() const { return mAttachedFragmentShader; }
- Shader *getAttachedComputeShader() const { return mAttachedComputeShader; }
- Shader *getAttachedGeometryShader() const { return mAttachedGeometryShader; }
- 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;
- }
- 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<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 std::vector<TransformFeedbackVarying> &getLinkedTransformFeedbackVaryings() const
- {
- return mLinkedTransformFeedbackVaryings;
- }
- const std::vector<AtomicCounterBuffer> &getAtomicCounterBuffers() const
- {
- return mAtomicCounterBuffers;
- }
-
- 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 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 ShaderStagesMask &getLinkedShaderStages() const { return mLinkedShaderStages; }
-
- private:
- friend class MemoryProgramCache;
- friend class Program;
-
- std::string mLabel;
-
- sh::WorkGroupSize mComputeShaderLocalSize;
-
- Shader *mAttachedFragmentShader;
- Shader *mAttachedVertexShader;
- Shader *mAttachedComputeShader;
- Shader *mAttachedGeometryShader;
-
- 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;
-
- // 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<gl::SamplerBinding> mSamplerBindings;
-
- // An array of the images that are used by the program
- std::vector<gl::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;
- DrawBufferMask mActiveOutputVariables;
-
- // Fragment output variable base types: FLOAT, INT, or UINT. Ordered by location.
- std::vector<GLenum> mOutputVariableTypes;
-
- bool mBinaryRetrieveableHint;
- bool mSeparable;
- ShaderStagesMask mLinkedShaderStages;
-
- // ANGLE_multiview.
- int mNumViews;
-};
-
-class Program final : angle::NonCopyable, public LabeledObject
-{
- public:
- Program(rx::GLImplFactory *factory, ShaderProgramManager *manager, GLuint handle);
- void onDestroy(const Context *context);
-
- GLuint id() const { return mHandle; }
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- rx::ProgramImpl *getImplementation() const { return mProgram; }
-
- void attachShader(Shader *shader);
- void detachShader(const Context *context, Shader *shader);
- int getAttachedShadersCount() const;
-
- const Shader *getAttachedVertexShader() const { return mState.mAttachedVertexShader; }
- const Shader *getAttachedFragmentShader() const { return mState.mAttachedFragmentShader; }
- const Shader *getAttachedComputeShader() const { return mState.mAttachedComputeShader; }
- const Shader *getAttachedGeometryShader() const { return mState.mAttachedGeometryShader; }
-
- void bindAttributeLocation(GLuint index, const char *name);
- void bindUniformLocation(GLuint index, const char *name);
-
- // CHROMIUM_path_rendering
- BindingInfo getFragmentInputBindingInfo(const Context *context, GLint index) const;
- void bindFragmentInputLocation(GLint index, const char *name);
- void pathFragmentInputGen(const Context *context,
- GLint index,
- GLenum genMode,
- GLint components,
- const GLfloat *coeffs);
-
- Error link(const gl::Context *context);
- bool isLinked() const;
-
- bool hasLinkedVertexShader() const { return mState.mLinkedShaderStages[SHADER_VERTEX]; }
- bool hasLinkedFragmentShader() const { return mState.mLinkedShaderStages[SHADER_FRAGMENT]; }
- bool hasLinkedComputeShader() const { return mState.mLinkedShaderStages[SHADER_COMPUTE]; }
-
- Error loadBinary(const Context *context,
- GLenum binaryFormat,
- const void *binary,
- GLsizei length);
- Error saveBinary(const Context *context,
- GLenum *binaryFormat,
- void *binary,
- GLsizei bufSize,
- GLsizei *length) const;
- GLint getBinaryLength(const 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 { return mState.mAttributes; }
-
- GLint getFragDataLocation(const std::string &name) const;
- size_t getOutputResourceCount() const;
- const std::vector<GLenum> &getOutputVariableTypes() const
- {
- return mState.mOutputVariableTypes;
- }
- DrawBufferMask getActiveOutputVariables() const { return mState.mActiveOutputVariables; }
-
- 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;
- const LinkedUniform &getUniformByIndex(GLuint index) const;
-
- 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);
- SetUniformResult setUniform1iv(GLint location, GLsizei count, const GLint *v);
- void setUniform2iv(GLint location, GLsizei count, const GLint *v);
- void setUniform3iv(GLint location, GLsizei count, const GLint *v);
- void setUniform4iv(GLint location, GLsizei count, const GLint *v);
- void setUniform1uiv(GLint location, GLsizei count, const GLuint *v);
- void setUniform2uiv(GLint location, GLsizei count, const GLuint *v);
- void setUniform3uiv(GLint location, GLsizei count, const GLuint *v);
- void setUniform4uiv(GLint location, GLsizei count, const GLuint *v);
- void setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- void getUniformfv(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;
- GLuint getActiveUniformBlockCount() const;
- GLuint getActiveAtomicCounterBufferCount() const;
- GLuint getActiveShaderStorageBlockCount() const;
- GLint getActiveUniformBlockMaxLength() 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;
-
- static bool linkValidateInterfaceBlockFields(InfoLog &infoLog,
- const std::string &uniformName,
- const sh::InterfaceBlockField &vertexUniform,
- const sh::InterfaceBlockField &fragmentUniform,
- bool webglCompatibility);
-
- void addRef();
- void release(const Context *context);
- unsigned int getRefCount() const;
- void flagForDeletion();
- bool isFlaggedForDeletion() const;
-
- void validate(const Caps &caps);
- bool validateSamplers(InfoLog *infoLog, const Caps &caps);
- bool isValidated() const;
- bool samplesFromTexture(const gl::State &state, GLuint textureID) const;
-
- const AttributesMask &getActiveAttribLocationsMask() const
- {
- return mState.mActiveAttribLocationsMask;
- }
-
- const std::vector<SamplerBinding> &getSamplerBindings() const
- {
- return mState.mSamplerBindings;
- }
-
- const std::vector<ImageBinding> &getImageBindings() const { return mState.mImageBindings; }
- const sh::WorkGroupSize &getComputeShaderLocalSize() const
- {
- return mState.mComputeShaderLocalSize;
- }
-
- const ProgramState &getState() const { return mState; }
-
- static bool linkValidateVariablesBase(InfoLog &infoLog,
- const std::string &variableName,
- const sh::ShaderVariable &vertexVariable,
- const sh::ShaderVariable &fragmentVariable,
- bool validatePrecision);
-
- 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;
-
- class Bindings final : angle::NonCopyable
- {
- public:
- Bindings();
- ~Bindings();
- void bindLocation(GLuint index, const std::string &name);
- int getBinding(const std::string &name) const;
-
- typedef std::unordered_map<std::string, GLuint>::const_iterator const_iterator;
- const_iterator begin() const;
- const_iterator end() const;
-
- private:
- std::unordered_map<std::string, GLuint> mBindings;
- };
-
- const Bindings &getAttributeBindings() const { return mAttributeBindings; }
- const Bindings &getUniformLocationBindings() const { return mUniformLocationBindings; }
- const Bindings &getFragmentInputBindings() const { return mFragmentInputBindings; }
-
- int getNumViews() const { return mState.getNumViews(); }
- bool usesMultiview() const { return mState.usesMultiview(); }
-
- struct VaryingRef
- {
- const sh::Varying *get() const { return vertex ? vertex : fragment; }
-
- const sh::Varying *vertex = nullptr;
- const sh::Varying *fragment = nullptr;
- };
- using MergedVaryings = std::map<std::string, VaryingRef>;
-
- private:
- ~Program() override;
-
- void unlink();
-
- bool linkAttributes(const Context *context, InfoLog &infoLog);
- bool validateVertexAndFragmentInterfaceBlocks(
- const std::vector<sh::InterfaceBlock> &vertexInterfaceBlocks,
- const std::vector<sh::InterfaceBlock> &fragmentInterfaceBlocks,
- InfoLog &infoLog,
- bool webglCompatibility) const;
- bool linkInterfaceBlocks(const Context *context, InfoLog &infoLog);
- bool linkVaryings(const Context *context, InfoLog &infoLog) const;
-
- bool linkUniforms(const Context *context,
- InfoLog &infoLog,
- const Bindings &uniformLocationBindings);
- void linkSamplerAndImageBindings();
- bool linkAtomicCounterBuffers();
-
- void updateLinkedShaderStages();
-
- bool areMatchingInterfaceBlocks(InfoLog &infoLog,
- const sh::InterfaceBlock &vertexInterfaceBlock,
- const sh::InterfaceBlock &fragmentInterfaceBlock,
- bool webglCompatibility) const;
-
- static bool linkValidateVaryings(InfoLog &infoLog,
- const std::string &varyingName,
- const sh::Varying &vertexVarying,
- const sh::Varying &fragmentVarying,
- int shaderVersion);
- bool linkValidateBuiltInVaryings(const Context *context, InfoLog &infoLog) const;
- bool linkValidateTransformFeedback(const gl::Context *context,
- InfoLog &infoLog,
- const MergedVaryings &linkedVaryings,
- const Caps &caps) const;
- bool linkValidateGlobalNames(const Context *context, InfoLog &infoLog) const;
-
- void gatherTransformFeedbackVaryings(const MergedVaryings &varyings);
-
- MergedVaryings getMergedVaryings(const Context *context) const;
- void linkOutputVariables(const Context *context);
-
- void setUniformValuesFromBindingQualifiers();
-
- void gatherAtomicCounterBuffers();
- 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(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;
-
- ProgramState mState;
- rx::ProgramImpl *mProgram;
-
- bool mValidated;
-
- Bindings 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.
- Bindings mUniformLocationBindings;
-
- // CHROMIUM_path_rendering
- Bindings mFragmentInputBindings;
-
- bool mLinked;
- 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;
- std::vector<GLenum> mTextureUnitTypesCache;
-};
-} // namespace gl
-
-#endif // LIBANGLE_PROGRAM_H_
diff --git a/src/3rdparty/angle/src/libANGLE/ProgramLinkedResources.cpp b/src/3rdparty/angle/src/libANGLE/ProgramLinkedResources.cpp
deleted file mode 100644
index a33f751525..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ProgramLinkedResources.cpp
+++ /dev/null
@@ -1,1040 +0,0 @@
-//
-// 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.
-//
-
-// UniformLinker.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;
-}
-
-int GetUniformLocationBinding(const Program::Bindings &uniformLocationBindings,
- const sh::Uniform &uniform)
-{
- int binding = uniformLocationBindings.getBinding(uniform.name);
- if (uniform.isArray() && binding == -1)
- {
- // Bindings for array uniforms can be set either with or without [0] in the end.
- ASSERT(angle::EndsWith(uniform.name, "[0]"));
- std::string nameWithoutIndex = uniform.name.substr(0u, uniform.name.length() - 3u);
- return uniformLocationBindings.getBinding(nameWithoutIndex);
- }
- return binding;
-}
-
-} // anonymous namespace
-
-UniformLinker::UniformLinker(const ProgramState &state) : mState(state)
-{
-}
-
-UniformLinker::~UniformLinker() = default;
-
-void UniformLinker::getResults(std::vector<LinkedUniform> *uniforms,
- std::vector<VariableLocation> *uniformLocations)
-{
- uniforms->swap(mUniforms);
- uniformLocations->swap(mUniformLocations);
-}
-
-bool UniformLinker::link(const Context *context,
- InfoLog &infoLog,
- const Program::Bindings &uniformLocationBindings)
-{
- if (mState.getAttachedVertexShader() && mState.getAttachedFragmentShader())
- {
- ASSERT(mState.getAttachedComputeShader() == nullptr);
- if (!validateVertexAndFragmentUniforms(context, 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(context, infoLog))
- {
- return false;
- }
-
- if (!checkMaxCombinedAtomicCounters(context->getCaps(), infoLog))
- {
- return false;
- }
-
- if (!indexUniforms(infoLog, uniformLocationBindings))
- {
- return false;
- }
-
- return true;
-}
-
-bool UniformLinker::validateVertexAndFragmentUniforms(const Context *context,
- InfoLog &infoLog) const
-{
- // Check that uniforms defined in the vertex and fragment shaders are identical
- std::map<std::string, sh::Uniform> linkedUniforms;
- const std::vector<sh::Uniform> &vertexUniforms =
- mState.getAttachedVertexShader()->getUniforms(context);
- const std::vector<sh::Uniform> &fragmentUniforms =
- mState.getAttachedFragmentShader()->getUniforms(context);
-
- for (const sh::Uniform &vertexUniform : vertexUniforms)
- {
- linkedUniforms[vertexUniform.name] = vertexUniform;
- }
-
- for (const sh::Uniform &fragmentUniform : fragmentUniforms)
- {
- auto entry = linkedUniforms.find(fragmentUniform.name);
- if (entry != linkedUniforms.end())
- {
- const sh::Uniform &linkedUniform = entry->second;
- const std::string &uniformName = "uniform '" + linkedUniform.name + "'";
- if (!linkValidateUniforms(infoLog, uniformName, linkedUniform, fragmentUniform))
- {
- return false;
- }
- }
- }
- return true;
-}
-
-// GLSL ES Spec 3.00.3, section 4.3.5.
-bool UniformLinker::linkValidateUniforms(InfoLog &infoLog,
- const std::string &uniformName,
- const sh::Uniform &vertexUniform,
- const sh::Uniform &fragmentUniform)
-{
-#if ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION == ANGLE_ENABLED
- const bool validatePrecision = true;
-#else
- const bool validatePrecision = false;
-#endif
-
- if (!Program::linkValidateVariablesBase(infoLog, uniformName, vertexUniform, fragmentUniform,
- validatePrecision))
- {
- return false;
- }
-
- // GLSL ES Spec 3.10.4, section 4.4.5.
- if (vertexUniform.binding != -1 && fragmentUniform.binding != -1 &&
- vertexUniform.binding != fragmentUniform.binding)
- {
- infoLog << "Binding layout qualifiers for " << uniformName
- << " differ between vertex and fragment shaders.";
- return false;
- }
-
- // GLSL ES Spec 3.10.4, section 9.2.1.
- if (vertexUniform.location != -1 && fragmentUniform.location != -1 &&
- vertexUniform.location != fragmentUniform.location)
- {
- infoLog << "Location layout qualifiers for " << uniformName
- << " differ between vertex and fragment shaders.";
- return false;
- }
- if (vertexUniform.offset != fragmentUniform.offset)
- {
- infoLog << "Offset layout qualifiers for " << uniformName
- << " differ between vertex and fragment shaders.";
- return false;
- }
-
- return true;
-}
-
-bool UniformLinker::indexUniforms(InfoLog &infoLog,
- const Program::Bindings &uniformLocationBindings)
-{
- // All the locations where another uniform can't be located.
- std::set<GLuint> reservedLocations;
- // 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,
- &reservedLocations, &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() || IsAtomicCounterType(uniform.type))
- {
- continue;
- }
-
- int preSetLocation = GetUniformLocationBinding(uniformLocationBindings, 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 Program::Bindings &uniformLocationBindings,
- std::set<GLuint> *reservedLocations,
- std::set<GLuint> *ignoredLocations,
- int *maxUniformLocation)
-{
- for (const LinkedUniform &uniform : mUniforms)
- {
- if (uniform.isBuiltIn())
- {
- continue;
- }
-
- int apiBoundLocation = GetUniformLocationBinding(uniformLocationBindings, 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.staticUse)
- {
- 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);
- }
- }
-
- // 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;
- 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->staticUse)
- {
- ++uniformIter;
- }
- else
- {
- uniformIter = mUniforms.erase(uniformIter);
- }
- }
-}
-
-bool UniformLinker::flattenUniformsAndCheckCapsForShader(
- const Context *context,
- Shader *shader,
- GLuint maxUniformComponents,
- GLuint maxTextureImageUnits,
- GLuint maxImageUnits,
- GLuint maxAtomicCounters,
- const std::string &componentsErrorMessage,
- const std::string &samplerErrorMessage,
- const std::string &imageErrorMessage,
- const std::string &atomicCounterErrorMessage,
- std::vector<LinkedUniform> &samplerUniforms,
- std::vector<LinkedUniform> &imageUniforms,
- std::vector<LinkedUniform> &atomicCounterUniforms,
- InfoLog &infoLog)
-{
- ShaderUniformCount shaderUniformCount;
- for (const sh::Uniform &uniform : shader->getUniforms(context))
- {
- shaderUniformCount += flattenUniform(uniform, &samplerUniforms, &imageUniforms,
- &atomicCounterUniforms, shader->getType());
- }
-
- if (shaderUniformCount.vectorCount > maxUniformComponents)
- {
- infoLog << componentsErrorMessage << maxUniformComponents << ").";
- return false;
- }
-
- if (shaderUniformCount.samplerCount > maxTextureImageUnits)
- {
- infoLog << samplerErrorMessage << maxTextureImageUnits << ").";
- return false;
- }
-
- if (shaderUniformCount.imageCount > maxImageUnits)
- {
- infoLog << imageErrorMessage << maxImageUnits << ").";
- return false;
- }
-
- if (shaderUniformCount.atomicCounterCount > maxAtomicCounters)
- {
- infoLog << atomicCounterErrorMessage << maxAtomicCounters << ").";
- return false;
- }
-
- return true;
-}
-
-bool UniformLinker::flattenUniformsAndCheckCaps(const Context *context, InfoLog &infoLog)
-{
- std::vector<LinkedUniform> samplerUniforms;
- std::vector<LinkedUniform> imageUniforms;
- std::vector<LinkedUniform> atomicCounterUniforms;
-
- const Caps &caps = context->getCaps();
-
- if (mState.getAttachedComputeShader())
- {
- Shader *computeShader = mState.getAttachedComputeShader();
-
- // TODO (mradev): check whether we need finer-grained component counting
- if (!flattenUniformsAndCheckCapsForShader(
- context, computeShader, caps.maxComputeUniformComponents / 4,
- caps.maxComputeTextureImageUnits, caps.maxComputeImageUniforms,
- caps.maxComputeAtomicCounters,
- "Compute shader active uniforms exceed MAX_COMPUTE_UNIFORM_COMPONENTS (",
- "Compute shader sampler count exceeds MAX_COMPUTE_TEXTURE_IMAGE_UNITS (",
- "Compute shader image count exceeds MAX_COMPUTE_IMAGE_UNIFORMS (",
- "Compute shader atomic counter count exceeds MAX_COMPUTE_ATOMIC_COUNTERS (",
- samplerUniforms, imageUniforms, atomicCounterUniforms, infoLog))
- {
- return false;
- }
- }
- else
- {
- Shader *vertexShader = mState.getAttachedVertexShader();
-
- if (!flattenUniformsAndCheckCapsForShader(
- context, vertexShader, caps.maxVertexUniformVectors,
- caps.maxVertexTextureImageUnits, caps.maxVertexImageUniforms,
- caps.maxVertexAtomicCounters,
- "Vertex shader active uniforms exceed MAX_VERTEX_UNIFORM_VECTORS (",
- "Vertex shader sampler count exceeds MAX_VERTEX_TEXTURE_IMAGE_UNITS (",
- "Vertex shader image count exceeds MAX_VERTEX_IMAGE_UNIFORMS (",
- "Vertex shader atomic counter count exceeds MAX_VERTEX_ATOMIC_COUNTERS (",
- samplerUniforms, imageUniforms, atomicCounterUniforms, infoLog))
- {
- return false;
- }
-
- Shader *fragmentShader = mState.getAttachedFragmentShader();
-
- if (!flattenUniformsAndCheckCapsForShader(
- context, fragmentShader, caps.maxFragmentUniformVectors, caps.maxTextureImageUnits,
- caps.maxFragmentImageUniforms, caps.maxFragmentAtomicCounters,
- "Fragment shader active uniforms exceed MAX_FRAGMENT_UNIFORM_VECTORS (",
- "Fragment shader sampler count exceeds MAX_TEXTURE_IMAGE_UNITS (",
- "Fragment shader image count exceeds MAX_FRAGMENT_IMAGE_UNIFORMS (",
- "Fragment shader atomic counter count exceeds MAX_FRAGMENT_ATOMIC_COUNTERS (",
- samplerUniforms, imageUniforms, atomicCounterUniforms, 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());
- return true;
-}
-
-UniformLinker::ShaderUniformCount UniformLinker::flattenUniform(
- const sh::Uniform &uniform,
- std::vector<LinkedUniform> *samplerUniforms,
- std::vector<LinkedUniform> *imageUniforms,
- std::vector<LinkedUniform> *atomicCounterUniforms,
- GLenum shaderType)
-{
- int location = uniform.location;
- ShaderUniformCount shaderUniformCount =
- flattenUniformImpl(uniform, uniform.name, uniform.mappedName, samplerUniforms,
- imageUniforms, atomicCounterUniforms, shaderType, uniform.staticUse,
- uniform.binding, uniform.offset, &location);
- if (uniform.staticUse)
- {
- return shaderUniformCount;
- }
- return ShaderUniformCount();
-}
-
-UniformLinker::ShaderUniformCount UniformLinker::flattenArrayOfStructsUniform(
- const sh::ShaderVariable &uniform,
- unsigned int arrayNestingIndex,
- const std::string &namePrefix,
- const std::string &mappedNamePrefix,
- std::vector<LinkedUniform> *samplerUniforms,
- std::vector<LinkedUniform> *imageUniforms,
- std::vector<LinkedUniform> *atomicCounterUniforms,
- GLenum shaderType,
- bool markStaticUse,
- int binding,
- int offset,
- int *location)
-{
- // Nested arrays are processed starting from outermost (arrayNestingIndex 0u) and ending at the
- // innermost.
- ShaderUniformCount shaderUniformCount;
- const unsigned int currentArraySize = uniform.getNestedArraySize(arrayNestingIndex);
- for (unsigned int arrayElement = 0u; arrayElement < currentArraySize; ++arrayElement)
- {
- const std::string elementName = namePrefix + ArrayString(arrayElement);
- const std::string elementMappedName = mappedNamePrefix + ArrayString(arrayElement);
- if (arrayNestingIndex + 1u < uniform.arraySizes.size())
- {
- shaderUniformCount += flattenArrayOfStructsUniform(
- uniform, arrayNestingIndex + 1u, elementName, elementMappedName, samplerUniforms,
- imageUniforms, atomicCounterUniforms, shaderType, markStaticUse, binding, offset,
- location);
- }
- else
- {
- shaderUniformCount += flattenStructUniform(
- uniform.fields, elementName, elementMappedName, samplerUniforms, imageUniforms,
- atomicCounterUniforms, shaderType, markStaticUse, binding, offset, location);
- }
- }
- return shaderUniformCount;
-}
-
-UniformLinker::ShaderUniformCount UniformLinker::flattenStructUniform(
- const std::vector<sh::ShaderVariable> &fields,
- const std::string &namePrefix,
- const std::string &mappedNamePrefix,
- std::vector<LinkedUniform> *samplerUniforms,
- std::vector<LinkedUniform> *imageUniforms,
- std::vector<LinkedUniform> *atomicCounterUniforms,
- GLenum shaderType,
- bool markStaticUse,
- int binding,
- int offset,
- int *location)
-{
- ShaderUniformCount shaderUniformCount;
- for (const sh::ShaderVariable &field : fields)
- {
- const std::string &fieldName = namePrefix + "." + field.name;
- const std::string &fieldMappedName = mappedNamePrefix + "." + field.mappedName;
-
- shaderUniformCount +=
- flattenUniformImpl(field, fieldName, fieldMappedName, samplerUniforms, imageUniforms,
- atomicCounterUniforms, shaderType, markStaticUse, -1, -1, location);
- }
- return shaderUniformCount;
-}
-
-UniformLinker::ShaderUniformCount UniformLinker::flattenArrayUniform(
- const sh::ShaderVariable &uniform,
- const std::string &namePrefix,
- const std::string &mappedNamePrefix,
- std::vector<LinkedUniform> *samplerUniforms,
- std::vector<LinkedUniform> *imageUniforms,
- std::vector<LinkedUniform> *atomicCounterUniforms,
- GLenum shaderType,
- bool markStaticUse,
- int binding,
- int offset,
- int *location)
-{
- ShaderUniformCount shaderUniformCount;
-
- ASSERT(uniform.isArray());
- for (unsigned int arrayElement = 0u; arrayElement < uniform.getOutermostArraySize();
- ++arrayElement)
- {
- sh::ShaderVariable uniformElement = uniform;
- uniformElement.indexIntoArray(arrayElement);
- const std::string elementName = namePrefix + ArrayString(arrayElement);
- const std::string elementMappedName = mappedNamePrefix + ArrayString(arrayElement);
-
- shaderUniformCount += flattenUniformImpl(
- uniformElement, elementName, elementMappedName, samplerUniforms, imageUniforms,
- atomicCounterUniforms, shaderType, markStaticUse, binding, offset, location);
- }
- return shaderUniformCount;
-}
-
-UniformLinker::ShaderUniformCount UniformLinker::flattenUniformImpl(
- const sh::ShaderVariable &uniform,
- const std::string &fullName,
- const std::string &fullMappedName,
- std::vector<LinkedUniform> *samplerUniforms,
- std::vector<LinkedUniform> *imageUniforms,
- std::vector<LinkedUniform> *atomicCounterUniforms,
- GLenum shaderType,
- bool markStaticUse,
- int binding,
- int offset,
- int *location)
-{
- ASSERT(location);
- ShaderUniformCount shaderUniformCount;
-
- if (uniform.isStruct())
- {
- if (uniform.isArray())
- {
- shaderUniformCount += flattenArrayOfStructsUniform(
- uniform, 0u, fullName, fullMappedName, samplerUniforms, imageUniforms,
- atomicCounterUniforms, shaderType, markStaticUse, binding, offset, location);
- }
- else
- {
- shaderUniformCount += flattenStructUniform(
- uniform.fields, fullName, fullMappedName, samplerUniforms, imageUniforms,
- atomicCounterUniforms, shaderType, markStaticUse, binding, offset, location);
- }
- return shaderUniformCount;
- }
- if (uniform.isArrayOfArrays())
- {
- // GLES 3.1 November 2016 section 7.3.1 page 77:
- // "For an active variable declared as an array of an aggregate data type (structures or
- // arrays), a separate entry will be generated for each active array element"
- return flattenArrayUniform(uniform, fullName, fullMappedName, samplerUniforms,
- imageUniforms, atomicCounterUniforms, shaderType, markStaticUse,
- binding, offset, location);
- }
-
- // Not a struct
- bool isSampler = IsSamplerType(uniform.type);
- bool isImage = IsImageType(uniform.type);
- bool isAtomicCounter = IsAtomicCounterType(uniform.type);
- std::vector<gl::LinkedUniform> *uniformList = &mUniforms;
- if (isSampler)
- {
- uniformList = samplerUniforms;
- }
- else if (isImage)
- {
- uniformList = imageUniforms;
- }
- else if (isAtomicCounter)
- {
- uniformList = atomicCounterUniforms;
- }
-
- std::string fullNameWithArrayIndex(fullName);
- std::string fullMappedNameWithArrayIndex(fullMappedName);
-
- if (uniform.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 (binding != -1)
- {
- existingUniform->binding = binding;
- }
- if (offset != -1)
- {
- existingUniform->offset = offset;
- }
- if (*location != -1)
- {
- existingUniform->location = *location;
- }
- if (markStaticUse)
- {
- existingUniform->staticUse = true;
- existingUniform->setStaticUse(shaderType, true);
- }
- }
- else
- {
- ASSERT(uniform.arraySizes.size() <= 1u);
- LinkedUniform linkedUniform(uniform.type, uniform.precision, fullNameWithArrayIndex,
- uniform.arraySizes, binding, offset, *location, -1,
- sh::BlockMemberInfo::getDefaultBlockInfo());
- linkedUniform.mappedName = fullMappedNameWithArrayIndex;
- linkedUniform.staticUse = markStaticUse;
- linkedUniform.flattenedOffsetInParentArrays = uniform.flattenedOffsetInParentArrays;
- if (markStaticUse)
- {
- linkedUniform.setStaticUse(shaderType, true);
- }
-
- uniformList->push_back(linkedUniform);
- }
-
- // Struct and array of arrays uniforms get flattened so we can use getBasicTypeElementCount().
- unsigned int elementCount = uniform.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.
- shaderUniformCount.vectorCount =
- (IsOpaqueType(uniform.type) ? 0 : (VariableRegisterCount(uniform.type) * elementCount));
- shaderUniformCount.samplerCount = (isSampler ? elementCount : 0);
- shaderUniformCount.imageCount = (isImage ? elementCount : 0);
- shaderUniformCount.atomicCounterCount = (isAtomicCounter ? elementCount : 0);
-
- if (*location != -1)
- {
- *location += elementCount;
- }
-
- return shaderUniformCount;
-}
-
-bool UniformLinker::checkMaxCombinedAtomicCounters(const Caps &caps, InfoLog &infoLog)
-{
- unsigned int atomicCounterCount = 0;
- for (const auto &uniform : mUniforms)
- {
- if (IsAtomicCounterType(uniform.type) && uniform.staticUse)
- {
- 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)
- : mBlocksOut(blocksOut)
-{
-}
-
-InterfaceBlockLinker::~InterfaceBlockLinker()
-{
-}
-
-void InterfaceBlockLinker::addShaderBlocks(GLenum shader,
- const std::vector<sh::InterfaceBlock> *blocks)
-{
- mShaderBlocks.push_back(std::make_pair(shader, blocks));
-}
-
-void InterfaceBlockLinker::linkBlocks(const GetBlockSize &getBlockSize,
- const GetBlockMemberInfo &getMemberInfo) const
-{
- ASSERT(mBlocksOut->empty());
-
- std::set<std::string> visitedList;
-
- for (const auto &shaderBlocks : mShaderBlocks)
- {
- const GLenum shaderType = shaderBlocks.first;
-
- for (const auto &block : *shaderBlocks.second)
- {
- // Only 'packed' blocks are allowed to be considered inactive.
- if (!block.staticUse && block.layout == sh::BLOCKLAYOUT_PACKED)
- continue;
-
- if (visitedList.count(block.name) > 0)
- {
- if (block.staticUse)
- {
- for (InterfaceBlock &priorBlock : *mBlocksOut)
- {
- if (block.name == priorBlock.name)
- {
- priorBlock.setStaticUse(shaderType, true);
- // TODO(jiajia.qin@intel.com): update the block members static use.
- }
- }
- }
- }
- else
- {
- defineInterfaceBlock(getBlockSize, getMemberInfo, block, shaderType);
- visitedList.insert(block.name);
- }
- }
- }
-}
-
-template <typename VarT>
-void InterfaceBlockLinker::defineArrayOfStructsBlockMembers(const GetBlockMemberInfo &getMemberInfo,
- const VarT &field,
- unsigned int arrayNestingIndex,
- const std::string &prefix,
- const std::string &mappedPrefix,
- int blockIndex,
- bool singleEntryForTopLevelArray,
- int topLevelArraySize) const
-{
- // Nested arrays are processed starting from outermost (arrayNestingIndex 0u) and ending at the
- // innermost.
- unsigned int entryGenerationArraySize = field.getNestedArraySize(arrayNestingIndex);
- if (singleEntryForTopLevelArray)
- {
- entryGenerationArraySize = 1;
- }
- for (unsigned int arrayElement = 0u; arrayElement < entryGenerationArraySize; ++arrayElement)
- {
- const std::string elementName = prefix + ArrayString(arrayElement);
- const std::string elementMappedName = mappedPrefix + ArrayString(arrayElement);
- if (arrayNestingIndex + 1u < field.arraySizes.size())
- {
- defineArrayOfStructsBlockMembers(getMemberInfo, field, arrayNestingIndex + 1u,
- elementName, elementMappedName, blockIndex, false,
- topLevelArraySize);
- }
- else
- {
- defineBlockMembers(getMemberInfo, field.fields, elementName, elementMappedName,
- blockIndex, false, topLevelArraySize);
- }
- }
-}
-
-template <typename VarT>
-void InterfaceBlockLinker::defineBlockMembers(const GetBlockMemberInfo &getMemberInfo,
- const std::vector<VarT> &fields,
- const std::string &prefix,
- const std::string &mappedPrefix,
- int blockIndex,
- bool singleEntryForTopLevelArray,
- int topLevelArraySize) const
-{
- for (const VarT &field : fields)
- {
- std::string fullName = (prefix.empty() ? field.name : prefix + "." + field.name);
- std::string fullMappedName =
- (mappedPrefix.empty() ? field.mappedName : mappedPrefix + "." + field.mappedName);
-
- defineBlockMember(getMemberInfo, field, fullName, fullMappedName, blockIndex,
- singleEntryForTopLevelArray, topLevelArraySize);
- }
-}
-
-template <typename VarT>
-void InterfaceBlockLinker::defineBlockMember(const GetBlockMemberInfo &getMemberInfo,
- const VarT &field,
- const std::string &fullName,
- const std::string &fullMappedName,
- int blockIndex,
- bool singleEntryForTopLevelArray,
- int topLevelArraySize) const
-{
- int nextArraySize = topLevelArraySize;
- if (((field.isArray() && field.isStruct()) || field.isArrayOfArrays()) &&
- singleEntryForTopLevelArray)
- {
- // In OpenGL ES 3.10 spec, session 7.3.1.1 '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.'
- nextArraySize = field.getOutermostArraySize();
- }
-
- if (field.isStruct())
- {
- if (field.isArray())
- {
- defineArrayOfStructsBlockMembers(getMemberInfo, field, 0u, fullName, fullMappedName,
- blockIndex, singleEntryForTopLevelArray,
- nextArraySize);
- }
- else
- {
- ASSERT(nextArraySize == topLevelArraySize);
- defineBlockMembers(getMemberInfo, field.fields, fullName, fullMappedName, blockIndex,
- false, nextArraySize);
- }
- return;
- }
- if (field.isArrayOfArrays())
- {
- unsigned int entryGenerationArraySize = field.getOutermostArraySize();
- if (singleEntryForTopLevelArray)
- {
- entryGenerationArraySize = 1u;
- }
- for (unsigned int arrayElement = 0u; arrayElement < entryGenerationArraySize;
- ++arrayElement)
- {
- VarT fieldElement = field;
- fieldElement.indexIntoArray(arrayElement);
- const std::string elementName = fullName + ArrayString(arrayElement);
- const std::string elementMappedName = fullMappedName + ArrayString(arrayElement);
-
- defineBlockMember(getMemberInfo, fieldElement, elementName, elementMappedName,
- blockIndex, false, nextArraySize);
- }
- return;
- }
-
- // If getBlockMemberInfo returns false, the variable is optimized out.
- sh::BlockMemberInfo memberInfo;
- if (!getMemberInfo(fullName, fullMappedName, &memberInfo))
- {
- return;
- }
-
- std::string fullNameWithArrayIndex = fullName;
- std::string fullMappedNameWithArrayIndex = fullMappedName;
-
- if (field.isArray())
- {
- fullNameWithArrayIndex += "[0]";
- fullMappedNameWithArrayIndex += "[0]";
- }
-
- ASSERT(nextArraySize == topLevelArraySize);
- defineBlockMemberImpl(field, fullNameWithArrayIndex, fullMappedNameWithArrayIndex, blockIndex,
- memberInfo, nextArraySize);
-}
-
-void InterfaceBlockLinker::defineInterfaceBlock(const GetBlockSize &getBlockSize,
- const GetBlockMemberInfo &getMemberInfo,
- const sh::InterfaceBlock &interfaceBlock,
- GLenum 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();
- defineBlockMembers(getMemberInfo, interfaceBlock.fields, interfaceBlock.fieldPrefix(),
- interfaceBlock.fieldMappedPrefix(), blockIndex,
- interfaceBlock.blockType == sh::BlockType::BLOCK_BUFFER, 1);
- size_t lastBlockMemberIndex = getCurrentBlockMemberIndex();
-
- for (size_t blockMemberIndex = firstBlockMemberIndex; blockMemberIndex < lastBlockMemberIndex;
- ++blockMemberIndex)
- {
- blockIndexes.push_back(static_cast<unsigned int>(blockMemberIndex));
- }
-
- // 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);
- 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;
- }
-
- InterfaceBlock block(interfaceBlock.name, interfaceBlock.mappedName,
- interfaceBlock.isArray(), arrayElement, blockBinding + arrayElement);
- block.memberIndexes = blockIndexes;
- block.setStaticUse(shaderType, interfaceBlock.staticUse);
-
- // 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)
- : InterfaceBlockLinker(blocksOut), mUniformsOut(uniformsOut)
-{
-}
-
-UniformBlockLinker::~UniformBlockLinker()
-{
-}
-
-void UniformBlockLinker::defineBlockMemberImpl(const sh::ShaderVariable &field,
- const std::string &fullName,
- const std::string &fullMappedName,
- int blockIndex,
- const sh::BlockMemberInfo &memberInfo,
- int /*topLevelArraySize*/) const
-{
- LinkedUniform newUniform(field.type, field.precision, fullName, field.arraySizes, -1, -1, -1,
- blockIndex, memberInfo);
- newUniform.mappedName = fullMappedName;
- // TODO(jiajia.qin@intel.com): update the block memeber static use.
-
- // Since block uniforms have no location, we don't need to store them in the uniform locations
- // list.
- mUniformsOut->push_back(newUniform);
-}
-
-size_t UniformBlockLinker::getCurrentBlockMemberIndex() const
-{
- return mUniformsOut->size();
-}
-
-// ShaderStorageBlockLinker implementation.
-ShaderStorageBlockLinker::ShaderStorageBlockLinker(std::vector<InterfaceBlock> *blocksOut,
- std::vector<BufferVariable> *bufferVariablesOut)
- : InterfaceBlockLinker(blocksOut), mBufferVariablesOut(bufferVariablesOut)
-{
-}
-
-ShaderStorageBlockLinker::~ShaderStorageBlockLinker()
-{
-}
-
-void ShaderStorageBlockLinker::defineBlockMemberImpl(const sh::ShaderVariable &field,
- const std::string &fullName,
- const std::string &fullMappedName,
- int blockIndex,
- const sh::BlockMemberInfo &memberInfo,
- int topLevelArraySize) const
-{
- BufferVariable newBufferVariable(field.type, field.precision, fullName, field.arraySizes,
- blockIndex, memberInfo);
- newBufferVariable.mappedName = fullMappedName;
- // TODO(jiajia.qin@intel.com): update the block memeber static use.
-
- newBufferVariable.topLevelArraySize = topLevelArraySize;
-
- mBufferVariablesOut->push_back(newBufferVariable);
-}
-
-size_t ShaderStorageBlockLinker::getCurrentBlockMemberIndex() const
-{
- return mBufferVariablesOut->size();
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/ProgramLinkedResources.h b/src/3rdparty/angle/src/libANGLE/ProgramLinkedResources.h
deleted file mode 100644
index 1bf91b7f3b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ProgramLinkedResources.h
+++ /dev/null
@@ -1,274 +0,0 @@
-//
-// 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.
-//
-
-// UniformLinker.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 "libANGLE/Program.h"
-#include "libANGLE/Uniform.h"
-#include "libANGLE/VaryingPacking.h"
-
-#include <functional>
-
-namespace gl
-{
-
-class UniformLinker
-{
- public:
- UniformLinker(const ProgramState &state);
- ~UniformLinker();
-
- bool link(const Context *context,
- InfoLog &infoLog,
- const Program::Bindings &uniformLocationBindings);
-
- void getResults(std::vector<LinkedUniform> *uniforms,
- std::vector<VariableLocation> *uniformLocations);
-
- private:
- struct ShaderUniformCount
- {
- ShaderUniformCount() : vectorCount(0), samplerCount(0), imageCount(0), atomicCounterCount(0)
- {
- }
- ShaderUniformCount(const ShaderUniformCount &other) = default;
- ShaderUniformCount &operator=(const ShaderUniformCount &other) = default;
-
- ShaderUniformCount &operator+=(const ShaderUniformCount &other)
- {
- vectorCount += other.vectorCount;
- samplerCount += other.samplerCount;
- imageCount += other.imageCount;
- atomicCounterCount += other.atomicCounterCount;
- return *this;
- }
-
- unsigned int vectorCount;
- unsigned int samplerCount;
- unsigned int imageCount;
- unsigned int atomicCounterCount;
- };
-
- bool validateVertexAndFragmentUniforms(const Context *context, InfoLog &infoLog) const;
-
- static bool linkValidateUniforms(InfoLog &infoLog,
- const std::string &uniformName,
- const sh::Uniform &vertexUniform,
- const sh::Uniform &fragmentUniform);
-
- bool flattenUniformsAndCheckCapsForShader(const Context *context,
- Shader *shader,
- GLuint maxUniformComponents,
- GLuint maxTextureImageUnits,
- GLuint maxImageUnits,
- GLuint maxAtomicCounters,
- const std::string &componentsErrorMessage,
- const std::string &samplerErrorMessage,
- const std::string &imageErrorMessage,
- const std::string &atomicCounterErrorMessage,
- std::vector<LinkedUniform> &samplerUniforms,
- std::vector<LinkedUniform> &imageUniforms,
- std::vector<LinkedUniform> &atomicCounterUniforms,
- InfoLog &infoLog);
-
- bool flattenUniformsAndCheckCaps(const Context *context, InfoLog &infoLog);
- bool checkMaxCombinedAtomicCounters(const Caps &caps, InfoLog &infoLog);
-
- ShaderUniformCount flattenUniform(const sh::Uniform &uniform,
- std::vector<LinkedUniform> *samplerUniforms,
- std::vector<LinkedUniform> *imageUniforms,
- std::vector<LinkedUniform> *atomicCounterUniforms,
- GLenum shaderType);
-
- ShaderUniformCount flattenArrayOfStructsUniform(
- const sh::ShaderVariable &uniform,
- unsigned int arrayNestingIndex,
- const std::string &namePrefix,
- const std::string &mappedNamePrefix,
- std::vector<LinkedUniform> *samplerUniforms,
- std::vector<LinkedUniform> *imageUniforms,
- std::vector<LinkedUniform> *atomicCounterUniforms,
- GLenum shaderType,
- bool markStaticUse,
- int binding,
- int offset,
- int *location);
-
- ShaderUniformCount flattenStructUniform(const std::vector<sh::ShaderVariable> &fields,
- const std::string &namePrefix,
- const std::string &mappedNamePrefix,
- std::vector<LinkedUniform> *samplerUniforms,
- std::vector<LinkedUniform> *imageUniforms,
- std::vector<LinkedUniform> *atomicCounterUniforms,
- GLenum shaderType,
- bool markStaticUse,
- int binding,
- int offset,
- int *location);
-
- ShaderUniformCount flattenArrayUniform(const sh::ShaderVariable &uniform,
- const std::string &fullName,
- const std::string &fullMappedName,
- std::vector<LinkedUniform> *samplerUniforms,
- std::vector<LinkedUniform> *imageUniforms,
- std::vector<LinkedUniform> *atomicCounterUniforms,
- GLenum shaderType,
- bool markStaticUse,
- int binding,
- int offset,
- int *location);
-
- // markStaticUse is given as a separate parameter because it is tracked here at struct
- // granularity.
- ShaderUniformCount flattenUniformImpl(const sh::ShaderVariable &uniform,
- const std::string &fullName,
- const std::string &fullMappedName,
- std::vector<LinkedUniform> *samplerUniforms,
- std::vector<LinkedUniform> *imageUniforms,
- std::vector<LinkedUniform> *atomicCounterUniforms,
- GLenum shaderType,
- bool markStaticUse,
- int binding,
- int offset,
- int *location);
-
- bool indexUniforms(InfoLog &infoLog, const Program::Bindings &uniformLocationBindings);
- bool gatherUniformLocationsAndCheckConflicts(InfoLog &infoLog,
- const Program::Bindings &uniformLocationBindings,
- std::set<GLuint> *reservedLocations,
- std::set<GLuint> *ignoredLocations,
- int *maxUniformLocation);
- void pruneUnusedUniforms();
-
- const ProgramState &mState;
- std::vector<LinkedUniform> mUniforms;
- std::vector<VariableLocation> mUniformLocations;
-};
-
-// 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();
-
- using GetBlockSize = std::function<
- bool(const std::string &blockName, const std::string &blockMappedName, size_t *sizeOut)>;
- using GetBlockMemberInfo = std::function<
- bool(const std::string &name, const std::string &mappedName, sh::BlockMemberInfo *infoOut)>;
-
- // 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(GLenum shader, const std::vector<sh::InterfaceBlock> *blocks);
-
- // This is called once during a link operation, after all shader blocks are added.
- void linkBlocks(const GetBlockSize &getBlockSize,
- const GetBlockMemberInfo &getMemberInfo) const;
-
- protected:
- InterfaceBlockLinker(std::vector<InterfaceBlock> *blocksOut);
- void defineInterfaceBlock(const GetBlockSize &getBlockSize,
- const GetBlockMemberInfo &getMemberInfo,
- const sh::InterfaceBlock &interfaceBlock,
- GLenum shaderType) const;
-
- template <typename VarT>
- void defineBlockMembers(const GetBlockMemberInfo &getMemberInfo,
- const std::vector<VarT> &fields,
- const std::string &prefix,
- const std::string &mappedPrefix,
- int blockIndex,
- bool singleEntryForTopLevelArray,
- int topLevelArraySize) const;
- template <typename VarT>
- void defineBlockMember(const GetBlockMemberInfo &getMemberInfo,
- const VarT &field,
- const std::string &fullName,
- const std::string &fullMappedName,
- int blockIndex,
- bool singleEntryForTopLevelArray,
- int topLevelArraySize) const;
-
- virtual void defineBlockMemberImpl(const sh::ShaderVariable &field,
- const std::string &fullName,
- const std::string &fullMappedName,
- int blockIndex,
- const sh::BlockMemberInfo &memberInfo,
- int topLevelArraySize) const = 0;
- virtual size_t getCurrentBlockMemberIndex() const = 0;
-
- using ShaderBlocks = std::pair<GLenum, const std::vector<sh::InterfaceBlock> *>;
- std::vector<ShaderBlocks> mShaderBlocks;
-
- std::vector<InterfaceBlock> *mBlocksOut;
-
- private:
- template <typename VarT>
- void defineArrayOfStructsBlockMembers(const GetBlockMemberInfo &getMemberInfo,
- const VarT &field,
- unsigned int arrayNestingIndex,
- const std::string &prefix,
- const std::string &mappedPrefix,
- int blockIndex,
- bool singleEntryForTopLevelArray,
- int topLevelArraySize) const;
-};
-
-class UniformBlockLinker final : public InterfaceBlockLinker
-{
- public:
- UniformBlockLinker(std::vector<InterfaceBlock> *blocksOut,
- std::vector<LinkedUniform> *uniformsOut);
- ~UniformBlockLinker() override;
-
- private:
- void defineBlockMemberImpl(const sh::ShaderVariable &field,
- const std::string &fullName,
- const std::string &fullMappedName,
- int blockIndex,
- const sh::BlockMemberInfo &memberInfo,
- int topLevelArraySize) const override;
- size_t getCurrentBlockMemberIndex() const override;
- std::vector<LinkedUniform> *mUniformsOut;
-};
-
-class ShaderStorageBlockLinker final : public InterfaceBlockLinker
-{
- public:
- ShaderStorageBlockLinker(std::vector<InterfaceBlock> *blocksOut,
- std::vector<BufferVariable> *bufferVariablesOut);
- ~ShaderStorageBlockLinker() override;
-
- private:
- void defineBlockMemberImpl(const sh::ShaderVariable &field,
- const std::string &fullName,
- const std::string &fullMappedName,
- int blockIndex,
- const sh::BlockMemberInfo &memberInfo,
- int topLevelArraySize) const override;
- size_t getCurrentBlockMemberIndex() const override;
- std::vector<BufferVariable> *mBufferVariablesOut;
-};
-
-// 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 ProgramLinkedResources
-{
- VaryingPacking varyingPacking;
- UniformBlockLinker uniformBlockLinker;
- ShaderStorageBlockLinker shaderStorageBlockLinker;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_UNIFORMLINKER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/ProgramPipeline.cpp b/src/3rdparty/angle/src/libANGLE/ProgramPipeline.cpp
deleted file mode 100644
index 0445512090..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ProgramPipeline.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// 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();
-}
-
-Error ProgramPipeline::onDestroy(const Context *context)
-{
- return NoError();
-}
-
-void ProgramPipeline::setLabel(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/src/3rdparty/angle/src/libANGLE/ProgramPipeline.h b/src/3rdparty/angle/src/libANGLE/ProgramPipeline.h
deleted file mode 100644
index 2aac87c7b8..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ProgramPipeline.h
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// 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 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;
-
- Error onDestroy(const Context *context) override;
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- rx::ProgramPipelineImpl *getImplementation() const;
-
- private:
- std::unique_ptr<rx::ProgramPipelineImpl> mProgramPipeline;
-
- ProgramPipelineState mState;
-};
-}
-
-#endif // LIBANGLE_PROGRAMPIPELINE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Query.cpp b/src/3rdparty/angle/src/libANGLE/Query.cpp
deleted file mode 100644
index cd1fb5f4bc..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Query.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Query.cpp: Implements the gl::Query class
-
-#include "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::setLabel(const std::string &label)
-{
- mLabel = label;
-}
-
-const std::string &Query::getLabel() const
-{
- return mLabel;
-}
-
-Error Query::begin()
-{
- return mQuery->begin();
-}
-
-Error Query::end()
-{
- return mQuery->end();
-}
-
-Error Query::queryCounter()
-{
- return mQuery->queryCounter();
-}
-
-Error Query::getResult(GLint *params)
-{
- return mQuery->getResult(params);
-}
-
-Error Query::getResult(GLuint *params)
-{
- return mQuery->getResult(params);
-}
-
-Error Query::getResult(GLint64 *params)
-{
- return mQuery->getResult(params);
-}
-
-Error Query::getResult(GLuint64 *params)
-{
- return mQuery->getResult(params);
-}
-
-Error Query::isResultAvailable(bool *available)
-{
- return mQuery->isResultAvailable(available);
-}
-
-GLenum Query::getType() const
-{
- return mQuery->getType();
-}
-
-rx::QueryImpl *Query::getImplementation()
-{
- return mQuery;
-}
-
-const rx::QueryImpl *Query::getImplementation() const
-{
- return mQuery;
-}
-}
diff --git a/src/3rdparty/angle/src/libANGLE/Query.h b/src/3rdparty/angle/src/libANGLE/Query.h
deleted file mode 100644
index c307eaaf08..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Query.h
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Query.h: Defines the gl::Query class
-
-#ifndef LIBANGLE_QUERY_H_
-#define LIBANGLE_QUERY_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);
- void destroy(const gl::Context *context) {}
- ~Query() override;
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- Error begin();
- Error end();
- Error queryCounter();
- Error getResult(GLint *params);
- Error getResult(GLuint *params);
- Error getResult(GLint64 *params);
- Error getResult(GLuint64 *params);
- Error isResultAvailable(bool *available);
-
- GLenum getType() const;
-
- rx::QueryImpl *getImplementation();
- const rx::QueryImpl *getImplementation() const;
-
- private:
- rx::QueryImpl *mQuery;
-
- std::string mLabel;
-};
-
-}
-
-#endif // LIBANGLE_QUERY_H_
diff --git a/src/3rdparty/angle/src/libANGLE/RefCountObject.h b/src/3rdparty/angle/src/libANGLE/RefCountObject.h
deleted file mode 100644
index cb41cc27f4..0000000000
--- a/src/3rdparty/angle/src/libANGLE/RefCountObject.h
+++ /dev/null
@@ -1,187 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// RefCountObject.h: Defines the gl::RefCountObject base class that provides
-// lifecycle support for GL objects using the traditional BindObject scheme, but
-// that need to be reference counted for correct cross-context deletion.
-// (Concretely, textures, buffers and renderbuffers.)
-
-#ifndef LIBANGLE_REFCOUNTOBJECT_H_
-#define LIBANGLE_REFCOUNTOBJECT_H_
-
-#include "angle_gl.h"
-#include "common/debug.h"
-#include "libANGLE/Error.h"
-
-#include <cstddef>
-
-namespace gl
-{
-class Context;
-
-class RefCountObjectNoID : angle::NonCopyable
-{
- public:
- RefCountObjectNoID() : mRefCount(0) {}
- virtual Error onDestroy(const Context *context);
-
- void addRef() const { ++mRefCount; }
-
- void release() const
- {
- ASSERT(mRefCount > 0);
-
- if (--mRefCount == 0)
- {
- delete this;
- }
- }
-
- size_t getRefCount() const { return mRefCount; }
-
- protected:
- virtual ~RefCountObjectNoID();
-
- // A specialized release method for objects which need a destroy context.
- void release(const gl::Context *context)
- {
- ASSERT(mRefCount > 0);
- if (--mRefCount == 0)
- {
- ANGLE_SWALLOW_ERR(onDestroy(context));
- delete this;
- }
- }
-
- template <class ObjectType>
- friend class BindingPointer;
- mutable std::size_t mRefCount;
-};
-
-inline RefCountObjectNoID::~RefCountObjectNoID()
-{
- ASSERT(mRefCount == 0);
-}
-
-inline Error RefCountObjectNoID::onDestroy(const Context *context)
-{
- return NoError();
-}
-
-template <class ObjectType>
-class BindingPointer;
-
-class RefCountObject : RefCountObjectNoID
-{
- public:
- explicit RefCountObject(GLuint id) : mId(id) {}
-
- GLuint id() const { return mId; }
-
- using RefCountObjectNoID::release;
- using RefCountObjectNoID::addRef;
- using RefCountObjectNoID::getRefCount;
-
- protected:
- ~RefCountObject() override {}
-
- private:
- GLuint mId;
-};
-
-template <class ObjectType>
-class BindingPointer
-{
- public:
- BindingPointer()
- : mObject(nullptr)
- {
- }
-
- BindingPointer(ObjectType *object) : mObject(object) { mObject->addRef(); }
-
- BindingPointer(const BindingPointer<ObjectType> &other) : mObject(other.mObject)
- {
- mObject->addRef();
- }
-
- BindingPointer &operator=(BindingPointer<ObjectType> &&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);
- }
-
- virtual void set(const Context *context, ObjectType *newObject)
- {
- // addRef first in case newObject == mObject and this is the last reference to it.
- if (newObject != nullptr) reinterpret_cast<const RefCountObjectNoID*>(newObject)->addRef();
- if (mObject != nullptr)
- reinterpret_cast<RefCountObjectNoID *>(mObject)->release(context);
- mObject = newObject;
- }
-
- ObjectType *get() const { return mObject; }
- ObjectType *operator->() const { return mObject; }
-
- GLuint id() const { return (mObject != nullptr) ? mObject->id() : 0; }
-
- bool operator==(const BindingPointer<ObjectType> &other) const
- {
- return mObject == other.mObject;
- }
-
- bool operator!=(const BindingPointer<ObjectType> &other) const { return !(*this == other); }
-
- private:
- ObjectType *mObject;
-};
-
-template <class ObjectType>
-class OffsetBindingPointer : public BindingPointer<ObjectType>
-{
- public:
- OffsetBindingPointer() : mOffset(0), mSize(0) { }
-
- void set(const Context *context, ObjectType *newObject) override
- {
- BindingPointer<ObjectType>::set(context, newObject);
- mOffset = 0;
- mSize = 0;
- }
-
- void set(const Context *context, ObjectType *newObject, GLintptr offset, GLsizeiptr size)
- {
- BindingPointer<ObjectType>::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);
- }
-
- private:
- GLintptr mOffset;
- GLsizeiptr mSize;
-};
-} // namespace gl
-
-#endif // LIBANGLE_REFCOUNTOBJECT_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Renderbuffer.cpp b/src/3rdparty/angle/src/libANGLE/Renderbuffer.cpp
deleted file mode 100644
index 8310f1abda..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Renderbuffer.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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/FramebufferAttachment.h"
-#include "libANGLE/Image.h"
-#include "libANGLE/Texture.h"
-#include "libANGLE/formatutils.h"
-#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
-
-namespace gl
-{
-Renderbuffer::Renderbuffer(rx::RenderbufferImpl *impl, GLuint id)
- : egl::ImageSibling(id),
- mRenderbuffer(impl),
- mLabel(),
- mWidth(0),
- mHeight(0),
- mFormat(GL_RGBA4),
- mSamples(0),
- mInitState(InitState::MayNeedInit)
-{
-}
-
-Error Renderbuffer::onDestroy(const Context *context)
-{
- ANGLE_TRY(orphanImages(context));
-
- if (mRenderbuffer)
- {
- ANGLE_TRY(mRenderbuffer->onDestroy(context));
- }
-
- return NoError();
-}
-
-Renderbuffer::~Renderbuffer()
-{
- SafeDelete(mRenderbuffer);
-}
-
-void Renderbuffer::setLabel(const std::string &label)
-{
- mLabel = label;
-}
-
-const std::string &Renderbuffer::getLabel() const
-{
- return mLabel;
-}
-
-Error Renderbuffer::setStorage(const Context *context,
- GLenum internalformat,
- size_t width,
- size_t height)
-{
- ANGLE_TRY(orphanImages(context));
-
- ANGLE_TRY(mRenderbuffer->setStorage(context, internalformat, width, height));
-
- mWidth = static_cast<GLsizei>(width);
- mHeight = static_cast<GLsizei>(height);
- mFormat = Format(internalformat);
- mSamples = 0;
-
- mInitState = InitState::MayNeedInit;
- mDirtyChannel.signal(mInitState);
-
- return NoError();
-}
-
-Error Renderbuffer::setStorageMultisample(const Context *context,
- size_t samples,
- GLenum internalformat,
- size_t width,
- size_t height)
-{
- ANGLE_TRY(orphanImages(context));
-
- ANGLE_TRY(
- mRenderbuffer->setStorageMultisample(context, samples, internalformat, width, height));
-
- mWidth = static_cast<GLsizei>(width);
- mHeight = static_cast<GLsizei>(height);
- mFormat = Format(internalformat);
- mSamples = static_cast<GLsizei>(samples);
-
- mInitState = InitState::MayNeedInit;
- mDirtyChannel.signal(mInitState);
-
- return NoError();
-}
-
-Error Renderbuffer::setStorageEGLImageTarget(const Context *context, egl::Image *image)
-{
- ANGLE_TRY(orphanImages(context));
-
- ANGLE_TRY(mRenderbuffer->setStorageEGLImageTarget(context, image));
-
- setTargetImage(context, image);
-
- mWidth = static_cast<GLsizei>(image->getWidth());
- mHeight = static_cast<GLsizei>(image->getHeight());
- mFormat = Format(image->getFormat());
- mSamples = 0;
-
- mInitState = image->sourceInitState();
- mDirtyChannel.signal(mInitState);
-
- return NoError();
-}
-
-rx::RenderbufferImpl *Renderbuffer::getImplementation() const
-{
- ASSERT(mRenderbuffer);
- return mRenderbuffer;
-}
-
-GLsizei Renderbuffer::getWidth() const
-{
- return mWidth;
-}
-
-GLsizei Renderbuffer::getHeight() const
-{
- return mHeight;
-}
-
-const Format &Renderbuffer::getFormat() const
-{
- return mFormat;
-}
-
-GLsizei Renderbuffer::getSamples() const
-{
- return mSamples;
-}
-
-GLuint Renderbuffer::getRedSize() const
-{
- return mFormat.info->redBits;
-}
-
-GLuint Renderbuffer::getGreenSize() const
-{
- return mFormat.info->greenBits;
-}
-
-GLuint Renderbuffer::getBlueSize() const
-{
- return mFormat.info->blueBits;
-}
-
-GLuint Renderbuffer::getAlphaSize() const
-{
- return mFormat.info->alphaBits;
-}
-
-GLuint Renderbuffer::getDepthSize() const
-{
- return mFormat.info->depthBits;
-}
-
-GLuint Renderbuffer::getStencilSize() const
-{
- return mFormat.info->stencilBits;
-}
-
-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(mWidth, mHeight, 1);
-}
-
-const Format &Renderbuffer::getAttachmentFormat(GLenum /*binding*/,
- const ImageIndex & /*imageIndex*/) const
-{
- return getFormat();
-}
-GLsizei Renderbuffer::getAttachmentSamples(const ImageIndex & /*imageIndex*/) const
-{
- return getSamples();
-}
-
-InitState Renderbuffer::initState(const gl::ImageIndex & /*imageIndex*/) const
-{
- if (isEGLImageTarget())
- {
- return sourceEGLImageInitState();
- }
-
- return mInitState;
-}
-
-void Renderbuffer::setInitState(const gl::ImageIndex & /*imageIndex*/, InitState initState)
-{
- if (isEGLImageTarget())
- {
- setSourceEGLImageInitState(initState);
- }
- else
- {
- mInitState = initState;
- }
-}
-
-rx::FramebufferAttachmentObjectImpl *Renderbuffer::getAttachmentImpl() const
-{
- return mRenderbuffer;
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Renderbuffer.h b/src/3rdparty/angle/src/libANGLE/Renderbuffer.h
deleted file mode 100644
index def18e6ff7..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Renderbuffer.h
+++ /dev/null
@@ -1,93 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Renderbuffer.h: Defines the 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 gl
-{
-// A GL renderbuffer object is usually used as a depth or stencil buffer attachment
-// for a framebuffer object. The renderbuffer itself is a distinct GL object, see
-// FramebufferAttachment and Framebuffer for how they are applied to an FBO via an
-// attachment point.
-
-class Renderbuffer final : public egl::ImageSibling,
- public LabeledObject
-{
- public:
- Renderbuffer(rx::RenderbufferImpl *impl, GLuint id);
- ~Renderbuffer() override;
-
- Error onDestroy(const Context *context) override;
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- Error setStorage(const Context *context, GLenum internalformat, size_t width, size_t height);
- Error setStorageMultisample(const Context *context,
- size_t samples,
- GLenum internalformat,
- size_t width,
- size_t height);
- Error 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;
-
- // FramebufferAttachmentObject Impl
- Extents getAttachmentSize(const ImageIndex &imageIndex) const override;
- const Format &getAttachmentFormat(GLenum binding, const ImageIndex &imageIndex) const override;
- GLsizei getAttachmentSamples(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;
-
- rx::RenderbufferImpl *mRenderbuffer;
-
- std::string mLabel;
-
- GLsizei mWidth;
- GLsizei mHeight;
- Format mFormat;
- GLsizei mSamples;
-
- // For robust resource init.
- InitState mInitState;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_RENDERBUFFER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/ResourceManager.cpp b/src/3rdparty/angle/src/libANGLE/ResourceManager.cpp
deleted file mode 100644
index 79eb7e5f42..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ResourceManager.cpp
+++ /dev/null
@@ -1,483 +0,0 @@
-//
-// 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/Fence.h"
-#include "libANGLE/Path.h"
-#include "libANGLE/Program.h"
-#include "libANGLE/ProgramPipeline.h"
-#include "libANGLE/Renderbuffer.h"
-#include "libANGLE/Sampler.h"
-#include "libANGLE/Shader.h"
-#include "libANGLE/Texture.h"
-#include "libANGLE/renderer/GLImplFactory.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,
- GLenum type)
-{
- ASSERT(type == GL_VERTEX_SHADER || type == GL_FRAGMENT_SHADER || type == GL_COMPUTE_SHADER ||
- type == GL_GEOMETRY_SHADER_EXT);
- 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);
-}
-
-Program *ShaderProgramManager::getProgram(GLuint handle) const
-{
- return mPrograms.query(handle);
-}
-
-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, GLenum target)
-{
- Texture *texture = new Texture(factory, handle, target);
- texture->addRef();
- return texture;
-}
-
-// static
-void TextureManager::DeleteObject(const Context *context, Texture *texture)
-{
- texture->release(context);
-}
-
-GLuint TextureManager::createTexture()
-{
- return AllocateEmptyObject(&mHandleAllocator, &mObjectMap);
-}
-
-Texture *TextureManager::getTexture(GLuint handle) const
-{
- ASSERT(mObjectMap.query(0) == nullptr);
- return mObjectMap.query(handle);
-}
-
-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->signalDirty(InitState::MayNeedInit);
- }
- }
-}
-
-// RenderbufferManager Implementation.
-
-// static
-Renderbuffer *RenderbufferManager::AllocateNewObject(rx::GLImplFactory *factory, GLuint handle)
-{
- Renderbuffer *renderbuffer = new Renderbuffer(factory->createRenderbuffer(), 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()
-{
-}
-
-ErrorOrResult<GLuint> PathManager::createPaths(rx::GLImplFactory *factory, GLsizei range)
-{
- // Allocate client side handles.
- const GLuint client = mHandleAllocator.allocateRange(static_cast<GLuint>(range));
- if (client == HandleRangeAllocator::kInvalidHandle)
- return OutOfMemory() << "Failed to allocate path handle range.";
-
- const auto &paths = factory->createPaths(range);
- if (paths.empty())
- {
- mHandleAllocator.releaseRange(client, range);
- return OutOfMemory() << "Failed to allocate path objects.";
- }
-
- 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));
- }
- return client;
-}
-
-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)
-{
- // Default framebuffer are owned by their respective Surface
- if (framebuffer->id() != 0)
- {
- 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);
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/ResourceManager.h b/src/3rdparty/angle/src/libANGLE/ResourceManager.h
deleted file mode 100644
index 2dfeff5234..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ResourceManager.h
+++ /dev/null
@@ -1,289 +0,0 @@
-//
-// 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 Path;
-class Program;
-class ProgramPipeline;
-class Renderbuffer;
-class Sampler;
-class Shader;
-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);
- 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>
- ResourceType *checkObjectAllocation(rx::GLImplFactory *factory, GLuint handle, ArgTypes... args)
- {
- ResourceType *value = mObjectMap.query(handle);
- if (value)
- {
- return value;
- }
-
- if (handle == 0)
- {
- return nullptr;
- }
-
- ResourceType *object = ImplT::AllocateNewObject(factory, handle, args...);
-
- if (!mObjectMap.contains(handle))
- {
- this->mHandleAllocator.reserve(handle);
- }
- mObjectMap.assign(handle, object);
-
- return object;
- }
-
- void reset(const Context *context) override;
-
- ResourceMap<ResourceType> mObjectMap;
-};
-
-class BufferManager : public TypedResourceManager<Buffer, HandleAllocator, BufferManager>
-{
- public:
- GLuint createBuffer();
- Buffer *getBuffer(GLuint handle) const;
-
- 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,
- GLenum 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);
- Program *getProgram(GLuint handle) const;
-
- 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();
- Texture *getTexture(GLuint handle) const;
-
- void signalAllTexturesDirty() const;
-
- Texture *checkTextureAllocation(rx::GLImplFactory *factory, GLuint handle, GLenum target)
- {
- return checkObjectAllocation(factory, handle, target);
- }
-
- static Texture *AllocateNewObject(rx::GLImplFactory *factory, GLuint handle, GLenum target);
- static void DeleteObject(const Context *context, Texture *texture);
-
- 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();
-
- ErrorOrResult<GLuint> createPaths(rx::GLImplFactory *factory, GLsizei range);
- 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 {}
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_RESOURCEMANAGER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/ResourceMap.h b/src/3rdparty/angle/src/libANGLE/ResourceMap.h
deleted file mode 100644
index b00da68612..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ResourceMap.h
+++ /dev/null
@@ -1,305 +0,0 @@
-//
-// 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();
-
- ResourceType *query(GLuint handle) const;
-
- // 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;
-
- std::vector<ResourceType *> mFlatResources;
-
- // A map of GL objects indexed by object ID.
- HashMap mHashedResources;
-};
-
-template <typename ResourceType>
-ResourceMap<ResourceType>::ResourceMap()
- : mFlatResources(kInitialFlatResourcesSize, InvalidPointer()), mHashedResources()
-{
-}
-
-template <typename ResourceType>
-ResourceMap<ResourceType>::~ResourceMap()
-{
- ASSERT(empty());
-}
-
-template <typename ResourceType>
-ResourceType *ResourceMap<ResourceType>::query(GLuint handle) const
-{
- if (handle < mFlatResources.size())
- {
- auto value = mFlatResources[handle];
- return (value == InvalidPointer() ? nullptr : value);
- }
- auto it = mHashedResources.find(handle);
- return (it == mHashedResources.end() ? nullptr : it->second);
-}
-
-template <typename ResourceType>
-bool ResourceMap<ResourceType>::contains(GLuint handle) const
-{
- if (handle < mFlatResources.size())
- {
- return (mFlatResources[handle] != InvalidPointer());
- }
- return (mHashedResources.find(handle) != mHashedResources.end());
-}
-
-template <typename ResourceType>
-bool ResourceMap<ResourceType>::erase(GLuint handle, ResourceType **resourceOut)
-{
- if (handle < mFlatResources.size())
- {
- 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 >= mFlatResources.size())
- {
- // Use power-of-two.
- size_t newSize = mFlatResources.size();
- while (newSize <= handle)
- {
- newSize *= 2;
- }
- mFlatResources.resize(newSize, nullptr);
- }
- ASSERT(mFlatResources.size() > 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>(mFlatResources.size()), mHashedResources.end());
-}
-
-template <typename ResourceType>
-typename ResourceMap<ResourceType>::Iterator ResourceMap<ResourceType>::find(GLuint handle) const
-{
- if (handle < mFlatResources.size())
- {
- 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()
-{
- mFlatResources.assign(kInitialFlatResourcesSize, InvalidPointer());
- mHashedResources.clear();
-}
-
-template <typename ResourceType>
-GLuint ResourceMap<ResourceType>::nextNonNullResource(size_t flatIndex) const
-{
- for (size_t index = flatIndex; index < mFlatResources.size(); index++)
- {
- if (mFlatResources[index] != nullptr && mFlatResources[index] != InvalidPointer())
- {
- return static_cast<GLuint>(index);
- }
- }
- return static_cast<GLuint>(mFlatResources.size());
-}
-
-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.mFlatResources.size()))
- {
- 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.mFlatResources.size()))
- {
- 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/src/3rdparty/angle/src/libANGLE/Sampler.cpp b/src/3rdparty/angle/src/libANGLE/Sampler.cpp
deleted file mode 100644
index 0f05b697a2..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Sampler.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-//
-// 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);
-}
-
-Error Sampler::onDestroy(const Context *context)
-{
- return NoError();
-}
-
-void Sampler::setLabel(const std::string &label)
-{
- mLabel = label;
-}
-
-const std::string &Sampler::getLabel() const
-{
- return mLabel;
-}
-
-void Sampler::setMinFilter(GLenum minFilter)
-{
- mState.minFilter = minFilter;
-}
-
-GLenum Sampler::getMinFilter() const
-{
- return mState.minFilter;
-}
-
-void Sampler::setMagFilter(GLenum magFilter)
-{
- mState.magFilter = magFilter;
-}
-
-GLenum Sampler::getMagFilter() const
-{
- return mState.magFilter;
-}
-
-void Sampler::setWrapS(GLenum wrapS)
-{
- mState.wrapS = wrapS;
-}
-
-GLenum Sampler::getWrapS() const
-{
- return mState.wrapS;
-}
-
-void Sampler::setWrapT(GLenum wrapT)
-{
- mState.wrapT = wrapT;
-}
-
-GLenum Sampler::getWrapT() const
-{
- return mState.wrapT;
-}
-
-void Sampler::setWrapR(GLenum wrapR)
-{
- mState.wrapR = wrapR;
-}
-
-GLenum Sampler::getWrapR() const
-{
- return mState.wrapR;
-}
-
-void Sampler::setMaxAnisotropy(float maxAnisotropy)
-{
- mState.maxAnisotropy = maxAnisotropy;
-}
-
-float Sampler::getMaxAnisotropy() const
-{
- return mState.maxAnisotropy;
-}
-
-void Sampler::setMinLod(GLfloat minLod)
-{
- mState.minLod = minLod;
-}
-
-GLfloat Sampler::getMinLod() const
-{
- return mState.minLod;
-}
-
-void Sampler::setMaxLod(GLfloat maxLod)
-{
- mState.maxLod = maxLod;
-}
-
-GLfloat Sampler::getMaxLod() const
-{
- return mState.maxLod;
-}
-
-void Sampler::setCompareMode(GLenum compareMode)
-{
- mState.compareMode = compareMode;
-}
-
-GLenum Sampler::getCompareMode() const
-{
- return mState.compareMode;
-}
-
-void Sampler::setCompareFunc(GLenum compareFunc)
-{
- mState.compareFunc = compareFunc;
-}
-
-GLenum Sampler::getCompareFunc() const
-{
- return mState.compareFunc;
-}
-
-void Sampler::setSRGBDecode(GLenum sRGBDecode)
-{
- mState.sRGBDecode = sRGBDecode;
-}
-
-GLenum Sampler::getSRGBDecode() const
-{
- return mState.sRGBDecode;
-}
-
-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/src/3rdparty/angle/src/libANGLE/Sampler.h b/src/3rdparty/angle/src/libANGLE/Sampler.h
deleted file mode 100644
index cd34273b44..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Sampler.h
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// 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/angletypes.h"
-#include "libANGLE/Debug.h"
-#include "libANGLE/RefCountObject.h"
-
-namespace rx
-{
-class GLImplFactory;
-class SamplerImpl;
-}
-
-namespace gl
-{
-
-class Sampler final : public RefCountObject, public LabeledObject
-{
- public:
- Sampler(rx::GLImplFactory *factory, GLuint id);
- ~Sampler() override;
-
- Error onDestroy(const Context *context) override;
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- void setMinFilter(GLenum minFilter);
- GLenum getMinFilter() const;
-
- void setMagFilter(GLenum magFilter);
- GLenum getMagFilter() const;
-
- void setWrapS(GLenum wrapS);
- GLenum getWrapS() const;
-
- void setWrapT(GLenum wrapT);
- GLenum getWrapT() const;
-
- void setWrapR(GLenum wrapR);
- GLenum getWrapR() const;
-
- void setMaxAnisotropy(float maxAnisotropy);
- float getMaxAnisotropy() const;
-
- void setMinLod(GLfloat minLod);
- GLfloat getMinLod() const;
-
- void setMaxLod(GLfloat maxLod);
- GLfloat getMaxLod() const;
-
- void setCompareMode(GLenum compareMode);
- GLenum getCompareMode() const;
-
- void setCompareFunc(GLenum compareFunc);
- GLenum getCompareFunc() const;
-
- void setSRGBDecode(GLenum sRGBDecode);
- GLenum getSRGBDecode() 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/src/3rdparty/angle/src/libANGLE/Shader.cpp b/src/3rdparty/angle/src/libANGLE/Shader.cpp
deleted file mode 100644
index 94c4f3c705..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Shader.cpp
+++ /dev/null
@@ -1,561 +0,0 @@
-//
-// 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 <sstream>
-
-#include "common/utilities.h"
-#include "GLSLANG/ShaderLang.h"
-#include "libANGLE/Caps.h"
-#include "libANGLE/Compiler.h"
-#include "libANGLE/Constants.h"
-#include "libANGLE/renderer/GLImplFactory.h"
-#include "libANGLE/renderer/ShaderImpl.h"
-#include "libANGLE/ResourceManager.h"
-#include "libANGLE/Context.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.staticUse)
- {
- 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);
-}
-
-ShaderState::ShaderState(GLenum shaderType)
- : mLabel(),
- mShaderType(shaderType),
- mShaderVersion(100),
- mNumViews(-1),
- mGeometryShaderInputPrimitiveType(GL_INVALID_VALUE),
- mGeometryShaderOutputPrimitiveType(GL_INVALID_VALUE),
- mGeometryShaderInvocations(1),
- mGeometryShaderMaxVertices(-1),
- mCompileStatus(CompileStatus::NOT_COMPILED)
-{
- mLocalSize.fill(-1);
-}
-
-ShaderState::~ShaderState()
-{
-}
-
-Shader::Shader(ShaderProgramManager *manager,
- rx::GLImplFactory *implFactory,
- const gl::Limitations &rendererLimitations,
- GLenum type,
- GLuint handle)
- : mState(type),
- mImplementation(implFactory->createShader(mState)),
- mRendererLimitations(rendererLimitations),
- mHandle(handle),
- mType(type),
- mRefCount(0),
- mDeleteStatus(false),
- mResourceManager(manager)
-{
- ASSERT(mImplementation);
-}
-
-void Shader::onDestroy(const gl::Context *context)
-{
- mBoundCompiler.set(context, nullptr);
- mImplementation.reset(nullptr);
- delete this;
-}
-
-Shader::~Shader()
-{
- ASSERT(!mImplementation);
-}
-
-void Shader::setLabel(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(const Context *context)
-{
- resolveCompile(context);
- if (mInfoLog.empty())
- {
- return 0;
- }
-
- return (static_cast<int>(mInfoLog.length()) + 1);
-}
-
-void Shader::getInfoLog(const Context *context, GLsizei bufSize, GLsizei *length, char *infoLog)
-{
- resolveCompile(context);
-
- 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(const Context *context)
-{
- resolveCompile(context);
-
- if (mState.mTranslatedSource.empty())
- {
- return 0;
- }
-
- return (static_cast<int>(mState.mTranslatedSource.length()) + 1);
-}
-
-int Shader::getTranslatedSourceWithDebugInfoLength(const Context *context)
-{
- resolveCompile(context);
-
- 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(const Context *context,
- GLsizei bufSize,
- GLsizei *length,
- char *buffer)
-{
- GetSourceImpl(getTranslatedSource(context), bufSize, length, buffer);
-}
-
-const std::string &Shader::getTranslatedSource(const Context *context)
-{
- resolveCompile(context);
- return mState.mTranslatedSource;
-}
-
-void Shader::getTranslatedSourceWithDebugInfo(const Context *context,
- GLsizei bufSize,
- GLsizei *length,
- char *buffer)
-{
- resolveCompile(context);
- const std::string &debugInfo = mImplementation->getDebugInfo();
- GetSourceImpl(debugInfo, bufSize, length, buffer);
-}
-
-void Shader::compile(const Context *context)
-{
- 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 = GL_INVALID_VALUE;
- mState.mGeometryShaderOutputPrimitiveType = GL_INVALID_VALUE;
- mState.mGeometryShaderInvocations = 1;
- mState.mGeometryShaderMaxVertices = -1;
-
- mState.mCompileStatus = CompileStatus::COMPILE_REQUESTED;
- mBoundCompiler.set(context, context->getCompiler());
-
- // Cache the compile source and options for compilation. Must be done now, since the source
- // can change before the link call or another call that resolves the compile.
-
- std::stringstream sourceStream;
-
- mLastCompileOptions =
- mImplementation->prepareSourceAndReturnOptions(&sourceStream, &mLastCompiledSourcePath);
- mLastCompileOptions |= (SH_OBJECT_CODE | SH_VARIABLES);
- mLastCompiledSource = sourceStream.str();
-
- // Add default options to WebGL shaders to prevent unexpected behavior during compilation.
- if (context->getExtensions().webglCompatibility)
- {
- mLastCompileOptions |= SH_INIT_GL_POSITION;
- mLastCompileOptions |= SH_LIMIT_CALL_STACK_DEPTH;
- mLastCompileOptions |= SH_LIMIT_EXPRESSION_COMPLEXITY;
- mLastCompileOptions |= SH_ENFORCE_PACKING_RESTRICTIONS;
- }
-
- // 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)
- {
- mLastCompileOptions |= SH_VALIDATE_LOOP_INDEXING;
- }
-}
-
-void Shader::resolveCompile(const Context *context)
-{
- if (!mState.compilePending())
- {
- return;
- }
-
- ASSERT(mBoundCompiler.get());
- ShHandle compilerHandle = mBoundCompiler->getCompilerHandle(mState.mShaderType);
-
- std::vector<const char *> srcStrings;
-
- if (!mLastCompiledSourcePath.empty())
- {
- srcStrings.push_back(mLastCompiledSourcePath.c_str());
- }
-
- srcStrings.push_back(mLastCompiledSource.c_str());
-
- if (!sh::Compile(compilerHandle, &srcStrings[0], srcStrings.size(), mLastCompileOptions))
- {
- 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 GL_COMPUTE_SHADER:
- {
- mState.mLocalSize = sh::GetComputeShaderLocalGroupSize(compilerHandle);
- break;
- }
- case GL_VERTEX_SHADER:
- {
- {
- mState.mOutputVaryings = GetShaderVariables(sh::GetOutputVaryings(compilerHandle));
- mState.mActiveAttributes =
- GetActiveShaderVariables(sh::GetAttributes(compilerHandle));
- mState.mNumViews = sh::GetVertexShaderNumViews(compilerHandle);
- }
- break;
- }
- case GL_FRAGMENT_SHADER:
- {
- 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 GL_GEOMETRY_SHADER_EXT:
- {
- mState.mInputVaryings = GetShaderVariables(sh::GetInputVaryings(compilerHandle));
- mState.mOutputVaryings = GetShaderVariables(sh::GetOutputVaryings(compilerHandle));
-
- mState.mGeometryShaderInputPrimitiveType =
- sh::GetGeometryShaderInputPrimitiveType(compilerHandle);
- mState.mGeometryShaderOutputPrimitiveType =
- sh::GetGeometryShaderOutputPrimitiveType(compilerHandle);
- mState.mGeometryShaderInvocations = sh::GetGeometryShaderInvocations(compilerHandle);
- mState.mGeometryShaderMaxVertices = sh::GetGeometryShaderMaxVertices(compilerHandle);
- break;
- }
- default:
- UNREACHABLE();
- }
-
- ASSERT(!mState.mTranslatedSource.empty());
-
- bool success = mImplementation->postTranslateCompile(mBoundCompiler.get(), &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(const Context *context)
-{
- resolveCompile(context);
- return mState.mCompileStatus == CompileStatus::COMPILED;
-}
-
-int Shader::getShaderVersion(const Context *context)
-{
- resolveCompile(context);
- return mState.mShaderVersion;
-}
-
-const std::vector<sh::Varying> &Shader::getInputVaryings(const Context *context)
-{
- resolveCompile(context);
- return mState.getInputVaryings();
-}
-
-const std::vector<sh::Varying> &Shader::getOutputVaryings(const Context *context)
-{
- resolveCompile(context);
- return mState.getOutputVaryings();
-}
-
-const std::vector<sh::Uniform> &Shader::getUniforms(const Context *context)
-{
- resolveCompile(context);
- return mState.getUniforms();
-}
-
-const std::vector<sh::InterfaceBlock> &Shader::getUniformBlocks(const Context *context)
-{
- resolveCompile(context);
- return mState.getUniformBlocks();
-}
-
-const std::vector<sh::InterfaceBlock> &Shader::getShaderStorageBlocks(const Context *context)
-{
- resolveCompile(context);
- return mState.getShaderStorageBlocks();
-}
-
-const std::vector<sh::Attribute> &Shader::getActiveAttributes(const Context *context)
-{
- resolveCompile(context);
- return mState.getActiveAttributes();
-}
-
-const std::vector<sh::OutputVariable> &Shader::getActiveOutputVariables(const Context *context)
-{
- resolveCompile(context);
- return mState.getActiveOutputVariables();
-}
-
-std::string Shader::getTransformFeedbackVaryingMappedName(const std::string &tfVaryingName,
- const Context *context)
-{
- // TODO(jiawei.shao@intel.com): support transform feedback on geometry shader.
- ASSERT(mState.getShaderType() == GL_VERTEX_SHADER);
- const auto &varyings = getOutputVaryings(context);
- 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;
- }
- }
- }
- UNREACHABLE();
- return std::string();
-}
-
-const sh::WorkGroupSize &Shader::getWorkGroupSize(const Context *context)
-{
- resolveCompile(context);
- return mState.mLocalSize;
-}
-
-int Shader::getNumViews(const Context *context)
-{
- resolveCompile(context);
- return mState.mNumViews;
-}
-
-const std::string &Shader::getCompilerResourcesString() const
-{
- ASSERT(mBoundCompiler.get());
- return mBoundCompiler->getBuiltinResourcesString(mState.mShaderType);
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Shader.h b/src/3rdparty/angle/src/libANGLE/Shader.h
deleted file mode 100644
index 4b6be4696d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Shader.h
+++ /dev/null
@@ -1,212 +0,0 @@
-//
-// 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 "angle_gl.h"
-#include <GLSLANG/ShaderLang.h>
-
-#include "common/Optional.h"
-#include "common/angleutils.h"
-#include "libANGLE/Debug.h"
-#include "libANGLE/angletypes.h"
-
-namespace rx
-{
-class GLImplFactory;
-class ShaderImpl;
-class ShaderSh;
-}
-
-namespace gl
-{
-class Compiler;
-class ContextState;
-struct Limitations;
-class ShaderProgramManager;
-class Context;
-
-// 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(GLenum shaderType);
- ~ShaderState();
-
- const std::string &getLabel() const { return mLabel; }
-
- const std::string &getSource() const { return mSource; }
- const std::string &getTranslatedSource() const { return mTranslatedSource; }
-
- GLenum 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::OutputVariable> &getActiveOutputVariables() const
- {
- return mActiveOutputVariables;
- }
-
- bool compilePending() const { return mCompileStatus == CompileStatus::COMPILE_REQUESTED; }
-
- private:
- friend class Shader;
-
- std::string mLabel;
-
- GLenum 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> mActiveAttributes;
- std::vector<sh::OutputVariable> mActiveOutputVariables;
-
- // ANGLE_multiview.
- int mNumViews;
-
- // Geometry Shader.
- GLenum mGeometryShaderInputPrimitiveType;
- GLenum mGeometryShaderOutputPrimitiveType;
- int mGeometryShaderInvocations;
- int mGeometryShaderMaxVertices;
-
- // 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,
- GLenum type,
- GLuint handle);
-
- void onDestroy(const Context *context);
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- GLenum 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(const Context *context);
- void getInfoLog(const Context *context, 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(const Context *context);
- int getTranslatedSourceWithDebugInfoLength(const Context *context);
- const std::string &getTranslatedSource(const Context *context);
- void getTranslatedSource(const Context *context,
- GLsizei bufSize,
- GLsizei *length,
- char *buffer);
- void getTranslatedSourceWithDebugInfo(const Context *context,
- GLsizei bufSize,
- GLsizei *length,
- char *buffer);
-
- void compile(const Context *context);
- bool isCompiled(const Context *context);
-
- void addRef();
- void release(const Context *context);
- unsigned int getRefCount() const;
- bool isFlaggedForDeletion() const;
- void flagForDeletion();
-
- int getShaderVersion(const Context *context);
-
- const std::vector<sh::Varying> &getInputVaryings(const Context *context);
- const std::vector<sh::Varying> &getOutputVaryings(const Context *context);
- const std::vector<sh::Uniform> &getUniforms(const Context *context);
- const std::vector<sh::InterfaceBlock> &getUniformBlocks(const Context *context);
- const std::vector<sh::InterfaceBlock> &getShaderStorageBlocks(const Context *context);
- const std::vector<sh::Attribute> &getActiveAttributes(const Context *context);
- const std::vector<sh::OutputVariable> &getActiveOutputVariables(const Context *context);
-
- // 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 Context *context);
-
- const sh::WorkGroupSize &getWorkGroupSize(const Context *context);
-
- int getNumViews(const Context *context);
-
- const std::string &getCompilerResourcesString() const;
-
- private:
- ~Shader() override;
- static void GetSourceImpl(const std::string &source,
- GLsizei bufSize,
- GLsizei *length,
- char *buffer);
-
- void resolveCompile(const Context *context);
-
- ShaderState mState;
- std::string mLastCompiledSource;
- std::string mLastCompiledSourcePath;
- ShCompileOptions mLastCompileOptions;
- std::unique_ptr<rx::ShaderImpl> mImplementation;
- const gl::Limitations &mRendererLimitations;
- const GLuint mHandle;
- const GLenum 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;
-
- ShaderProgramManager *mResourceManager;
-};
-
-bool CompareShaderVar(const sh::ShaderVariable &x, const sh::ShaderVariable &y);
-} // namespace gl
-
-#endif // LIBANGLE_SHADER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/SizedMRUCache.h b/src/3rdparty/angle/src/libANGLE/SizedMRUCache.h
deleted file mode 100644
index 6a608a697e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/SizedMRUCache.h
+++ /dev/null
@@ -1,174 +0,0 @@
-//
-// 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>
-#include "common/third_party/smhasher/src/PMurHash.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, 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);
- }
-}
-
-// Computes a hash of struct "key". Any structs passed to this function must be multiples of
-// 4 bytes, since the PMurhHas32 method can only operate increments of 4-byte words.
-template <typename T>
-std::size_t ComputeGenericHash(const T &key)
-{
- static const unsigned int seed = 0xABCDEF98;
-
- // We can't support "odd" alignments.
- static_assert(sizeof(key) % 4 == 0, "ComputeGenericHash requires aligned types");
- return PMurHash32(seed, &key, sizeof(T));
-}
-
-} // namespace angle
-#endif // LIBANGLE_SIZED_MRU_CACHE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/State.cpp b/src/3rdparty/angle/src/libANGLE/State.cpp
deleted file mode 100644
index f87e963710..0000000000
--- a/src/3rdparty/angle/src/libANGLE/State.cpp
+++ /dev/null
@@ -1,2433 +0,0 @@
-//
-// 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 <limits>
-#include <string.h>
-
-#include "common/bitset_utils.h"
-#include "common/mathutil.h"
-#include "common/matrix_utils.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/renderer/ContextImpl.h"
-
-namespace
-{
-
-GLenum ActiveQueryType(const GLenum type)
-{
- return (type == GL_ANY_SAMPLES_PASSED_CONSERVATIVE) ? GL_ANY_SAMPLES_PASSED : type;
-}
-
-} // anonymous namepace
-
-namespace gl
-{
-
-State::State()
- : 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(true),
- mClientArraysEnabled(true),
- mNearZ(0),
- mFarZ(0),
- mReadFramebuffer(nullptr),
- mDrawFramebuffer(nullptr),
- mProgram(nullptr),
- mVertexArray(nullptr),
- mActiveSampler(0),
- mPrimitiveRestart(false),
- mMultiSampling(false),
- mSampleAlphaToOne(false),
- mFramebufferSRGB(true),
- mRobustResourceInit(false),
- mProgramBinaryCacheEnabled(false)
-{
-}
-
-State::~State()
-{
-}
-
-void State::initialize(const Context *context,
- bool debug,
- bool bindGeneratesResource,
- bool clientArraysEnabled,
- bool robustResourceInit,
- bool programBinaryCacheEnabled)
-{
- 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;
-
- mBindGeneratesResource = bindGeneratesResource;
- mClientArraysEnabled = clientArraysEnabled;
-
- 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);
-
- mUniformBuffers.resize(caps.maxUniformBufferBindings);
-
- mSamplerTextures[GL_TEXTURE_2D].resize(caps.maxCombinedTextureImageUnits);
- mSamplerTextures[GL_TEXTURE_CUBE_MAP].resize(caps.maxCombinedTextureImageUnits);
- if (clientVersion >= Version(3, 0))
- {
- // TODO: These could also be enabled via extension
- mSamplerTextures[GL_TEXTURE_2D_ARRAY].resize(caps.maxCombinedTextureImageUnits);
- mSamplerTextures[GL_TEXTURE_3D].resize(caps.maxCombinedTextureImageUnits);
- }
- if (clientVersion >= Version(3, 1))
- {
- mSamplerTextures[GL_TEXTURE_2D_MULTISAMPLE].resize(caps.maxCombinedTextureImageUnits);
-
- mAtomicCounterBuffers.resize(caps.maxAtomicCounterBufferBindings);
- mShaderStorageBuffers.resize(caps.maxShaderStorageBufferBindings);
- mImageUnits.resize(caps.maxImageUnits);
- }
- if (nativeExtensions.textureRectangle)
- {
- mSamplerTextures[GL_TEXTURE_RECTANGLE_ANGLE].resize(caps.maxCombinedTextureImageUnits);
- }
- if (nativeExtensions.eglImageExternal || nativeExtensions.eglStreamConsumerExternal)
- {
- mSamplerTextures[GL_TEXTURE_EXTERNAL_OES].resize(caps.maxCombinedTextureImageUnits);
- }
- mCompleteTextureCache.resize(caps.maxCombinedTextureImageUnits, nullptr);
- mCompleteTextureBindings.reserve(caps.maxCombinedTextureImageUnits);
- mCachedTexturesInitState = InitState::MayNeedInit;
- for (uint32_t textureIndex = 0; textureIndex < caps.maxCombinedTextureImageUnits;
- ++textureIndex)
- {
- mCompleteTextureBindings.emplace_back(OnAttachmentDirtyBinding(this, textureIndex));
- }
-
- mSamplers.resize(caps.maxCombinedTextureImageUnits);
-
- mActiveQueries[GL_ANY_SAMPLES_PASSED].set(context, nullptr);
- mActiveQueries[GL_ANY_SAMPLES_PASSED_CONSERVATIVE].set(context, nullptr);
- mActiveQueries[GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN].set(context, nullptr);
- mActiveQueries[GL_TIME_ELAPSED_EXT].set(context, nullptr);
- mActiveQueries[GL_COMMANDS_COMPLETED_CHROMIUM].set(context, nullptr);
-
- mProgram = nullptr;
-
- mReadFramebuffer = nullptr;
- mDrawFramebuffer = nullptr;
-
- mPrimitiveRestart = false;
-
- mDebug.setOutputEnabled(debug);
- 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();
-
- mRobustResourceInit = robustResourceInit;
- mProgramBinaryCacheEnabled = programBinaryCacheEnabled;
-}
-
-void State::reset(const Context *context)
-{
- for (auto &bindingVec : mSamplerTextures)
- {
- TextureBindingVector &textureVector = bindingVec.second;
- for (size_t textureIdx = 0; textureIdx < textureVector.size(); textureIdx++)
- {
- textureVector[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>())
- {
- mBoundBuffers[type].set(context, nullptr);
- }
-
- if (mProgram)
- {
- mProgram->release(context);
- }
- mProgram = nullptr;
-
- mProgramPipeline.set(context, nullptr);
-
- mTransformFeedback.set(context, nullptr);
-
- for (State::ActiveQueryMap::iterator i = mActiveQueries.begin(); i != mActiveQueries.end(); i++)
- {
- i->second.set(context, nullptr);
- }
-
- for (auto &buf : mUniformBuffers)
- {
- buf.set(context, nullptr);
- }
-
- for (auto &buf : mAtomicCounterBuffers)
- {
- buf.set(context, nullptr);
- }
-
- for (auto &buf : mShaderStorageBuffers)
- {
- buf.set(context, nullptr);
- }
-
- angle::Matrix<GLfloat>::setToIdentity(mPathMatrixProj);
- angle::Matrix<GLfloat>::setToIdentity(mPathMatrixMV);
- mPathStencilFunc = GL_ALWAYS;
- mPathStencilRef = 0;
- mPathStencilMask = std::numeric_limits<GLuint>::max();
-
- // TODO(jmadill): Is this necessary?
- setAllDirtyBits();
-}
-
-const RasterizerState &State::getRasterizerState() const
-{
- return mRasterizer;
-}
-
-const BlendState &State::getBlendState() const
-{
- return mBlend;
-}
-
-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);
-}
-
-bool State::isRasterizerDiscardEnabled() const
-{
- return mRasterizer.rasterizerDiscard;
-}
-
-void State::setRasterizerDiscard(bool enabled)
-{
- mRasterizer.rasterizerDiscard = enabled;
- mDirtyBits.set(DIRTY_BIT_RASTERIZER_DISCARD_ENABLED);
-}
-
-bool State::isCullFaceEnabled() const
-{
- return mRasterizer.cullFace;
-}
-
-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);
-}
-
-bool State::isDepthTestEnabled() const
-{
- return mDepthStencil.depthTest;
-}
-
-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)
-{
- mNearZ = zNear;
- mFarZ = zFar;
- mDirtyBits.set(DIRTY_BIT_DEPTH_RANGE);
-}
-
-float State::getNearPlane() const
-{
- return mNearZ;
-}
-
-float State::getFarPlane() const
-{
- return mFarZ;
-}
-
-bool State::isBlendEnabled() const
-{
- return mBlend.blend;
-}
-
-void State::setBlend(bool enabled)
-{
- mBlend.blend = enabled;
- 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);
-}
-
-const ColorF &State::getBlendColor() const
-{
- return mBlendColor;
-}
-
-bool State::isStencilTestEnabled() const
-{
- return mDepthStencil.stencilTest;
-}
-
-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 = (stencilRef > 0) ? stencilRef : 0;
- mDepthStencil.stencilMask = stencilMask;
- mDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_FRONT);
-}
-
-void State::setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask)
-{
- mDepthStencil.stencilBackFunc = stencilBackFunc;
- mStencilBackRef = (stencilBackRef > 0) ? stencilBackRef : 0;
- 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);
-}
-
-GLint State::getStencilRef() const
-{
- return mStencilRef;
-}
-
-GLint State::getStencilBackRef() const
-{
- return mStencilBackRef;
-}
-
-bool State::isPolygonOffsetFillEnabled() const
-{
- return mRasterizer.polygonOffsetFill;
-}
-
-void State::setPolygonOffsetFill(bool enabled)
-{
- mRasterizer.polygonOffsetFill = enabled;
- 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);
-}
-
-bool State::isSampleAlphaToCoverageEnabled() const
-{
- return mBlend.sampleAlphaToCoverage;
-}
-
-void State::setSampleAlphaToCoverage(bool enabled)
-{
- mBlend.sampleAlphaToCoverage = enabled;
- mDirtyBits.set(DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED);
-}
-
-bool State::isSampleCoverageEnabled() const
-{
- return mSampleCoverage;
-}
-
-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);
-}
-
-GLclampf State::getSampleCoverageValue() const
-{
- return mSampleCoverageValue;
-}
-
-bool State::getSampleCoverageInvert() const
-{
- return mSampleCoverageInvert;
-}
-
-bool State::isSampleMaskEnabled() const
-{
- return mSampleMask;
-}
-
-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);
-}
-
-GLbitfield State::getSampleMaskWord(GLuint maskNumber) const
-{
- ASSERT(maskNumber < mMaxSampleMaskWords);
- return mSampleMaskValues[maskNumber];
-}
-
-GLuint State::getMaxSampleMaskWords() const
-{
- return mMaxSampleMaskWords;
-}
-
-void State::setSampleAlphaToOne(bool enabled)
-{
- mSampleAlphaToOne = enabled;
- mDirtyBits.set(DIRTY_BIT_SAMPLE_ALPHA_TO_ONE);
-}
-
-bool State::isSampleAlphaToOneEnabled() const
-{
- return mSampleAlphaToOne;
-}
-
-void State::setMultisampling(bool enabled)
-{
- mMultiSampling = enabled;
- mDirtyBits.set(DIRTY_BIT_MULTISAMPLING);
-}
-
-bool State::isMultisamplingEnabled() const
-{
- return mMultiSampling;
-}
-
-bool State::isScissorTestEnabled() const
-{
- return mScissorTest;
-}
-
-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);
-}
-
-const Rectangle &State::getScissor() const
-{
- return mScissor;
-}
-
-bool State::isDitherEnabled() const
-{
- return mBlend.dither;
-}
-
-void State::setDither(bool enabled)
-{
- mBlend.dither = enabled;
- mDirtyBits.set(DIRTY_BIT_DITHER_ENABLED);
-}
-
-bool State::isPrimitiveRestartEnabled() const
-{
- return mPrimitiveRestart;
-}
-
-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;
- 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;
-
- default:
- UNREACHABLE();
- return false;
- }
-}
-
-void State::setLineWidth(GLfloat width)
-{
- mLineWidth = width;
- mDirtyBits.set(DIRTY_BIT_LINE_WIDTH);
-}
-
-float State::getLineWidth() const
-{
- return mLineWidth;
-}
-
-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.
-}
-
-bool State::isBindGeneratesResourceEnabled() const
-{
- return mBindGeneratesResource;
-}
-
-bool State::areClientArraysEnabled() const
-{
- return mClientArraysEnabled;
-}
-
-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);
-}
-
-const Rectangle &State::getViewport() const
-{
- return mViewport;
-}
-
-void State::setActiveSampler(unsigned int active)
-{
- mActiveSampler = active;
-}
-
-unsigned int State::getActiveSampler() const
-{
- return static_cast<unsigned int>(mActiveSampler);
-}
-
-void State::setSamplerTexture(const Context *context, GLenum type, Texture *texture)
-{
- mSamplerTextures[type][mActiveSampler].set(context, texture);
- mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS);
- mDirtyObjects.set(DIRTY_OBJECT_PROGRAM_TEXTURES);
-}
-
-Texture *State::getTargetTexture(GLenum target) const
-{
- return getSamplerTexture(static_cast<unsigned int>(mActiveSampler), target);
-}
-
-Texture *State::getSamplerTexture(unsigned int sampler, GLenum type) const
-{
- const auto it = mSamplerTextures.find(type);
- ASSERT(it != mSamplerTextures.end());
- ASSERT(sampler < it->second.size());
- return it->second[sampler].get();
-}
-
-GLuint State::getSamplerTextureId(unsigned int sampler, GLenum type) const
-{
- const auto it = mSamplerTextures.find(type);
- ASSERT(it != mSamplerTextures.end());
- ASSERT(sampler < it->second.size());
- return it->second[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 (auto &bindingVec : mSamplerTextures)
- {
- GLenum textureType = bindingVec.first;
- TextureBindingVector &textureVector = bindingVec.second;
- for (BindingPointer<Texture> &binding : textureVector)
- {
- if (binding.id() == texture)
- {
- auto it = zeroTextures.find(textureType);
- ASSERT(it != zeroTextures.end());
- // Zero textures are the "default" textures instead of NULL
- binding.set(context, it->second.get());
- mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS);
- }
- }
- }
-
- 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))
- {
- mDirtyObjects.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER);
- }
-}
-
-void State::initializeZeroTextures(const Context *context, const TextureMap &zeroTextures)
-{
- for (const auto &zeroTexture : zeroTextures)
- {
- auto &samplerTextureArray = mSamplerTextures[zeroTexture.first];
-
- for (size_t textureUnit = 0; textureUnit < samplerTextureArray.size(); ++textureUnit)
- {
- samplerTextureArray[textureUnit].set(context, zeroTexture.second.get());
- }
- }
-}
-
-void State::setSamplerBinding(const Context *context, GLuint textureUnit, Sampler *sampler)
-{
- mSamplers[textureUnit].set(context, sampler);
- mDirtyBits.set(DIRTY_BIT_SAMPLER_BINDINGS);
- mDirtyObjects.set(DIRTY_OBJECT_PROGRAM_TEXTURES);
-}
-
-GLuint State::getSamplerId(GLuint textureUnit) const
-{
- ASSERT(textureUnit < mSamplers.size());
- return mSamplers[textureUnit].id();
-}
-
-Sampler *State::getSampler(GLuint textureUnit) const
-{
- return mSamplers[textureUnit].get();
-}
-
-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 (BindingPointer<Sampler> &samplerBinding : mSamplers)
- {
- if (samplerBinding.id() == sampler)
- {
- samplerBinding.set(context, nullptr);
- mDirtyBits.set(DIRTY_BIT_SAMPLER_BINDINGS);
- }
- }
-}
-
-void State::setRenderbufferBinding(const Context *context, Renderbuffer *renderbuffer)
-{
- mRenderbuffer.set(context, renderbuffer);
- mDirtyBits.set(DIRTY_BIT_RENDERBUFFER_BINDING);
-}
-
-GLuint State::getRenderbufferId() const
-{
- return mRenderbuffer.id();
-}
-
-Renderbuffer *State::getCurrentRenderbuffer() const
-{
- return mRenderbuffer.get();
-}
-
-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))
- {
- mDirtyObjects.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER);
- }
- }
-
-}
-
-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 && mDrawFramebuffer->hasAnyDirtyBit())
- {
- mDirtyObjects.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER);
- }
-}
-
-Framebuffer *State::getTargetFramebuffer(GLenum target) const
-{
- switch (target)
- {
- case GL_READ_FRAMEBUFFER_ANGLE:
- return mReadFramebuffer;
- case GL_DRAW_FRAMEBUFFER_ANGLE:
- case GL_FRAMEBUFFER:
- return mDrawFramebuffer;
- default:
- UNREACHABLE();
- return nullptr;
- }
-}
-
-Framebuffer *State::getReadFramebuffer() const
-{
- return mReadFramebuffer;
-}
-
-Framebuffer *State::getDrawFramebuffer() const
-{
- return mDrawFramebuffer;
-}
-
-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(VertexArray *vertexArray)
-{
- mVertexArray = vertexArray;
- mDirtyBits.set(DIRTY_BIT_VERTEX_ARRAY_BINDING);
-
- if (mVertexArray && mVertexArray->hasAnyDirtyBit())
- {
- mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
- }
-}
-
-GLuint State::getVertexArrayId() const
-{
- ASSERT(mVertexArray != nullptr);
- return mVertexArray->id();
-}
-
-VertexArray *State::getVertexArray() const
-{
- ASSERT(mVertexArray != nullptr);
- return mVertexArray;
-}
-
-bool State::removeVertexArrayBinding(GLuint vertexArray)
-{
- if (mVertexArray->id() == vertexArray)
- {
- mVertexArray = nullptr;
- mDirtyBits.set(DIRTY_BIT_VERTEX_ARRAY_BINDING);
- mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
- return true;
- }
-
- return false;
-}
-
-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::setVertexAttribBinding(const Context *context, GLuint attribIndex, GLuint bindingIndex)
-{
- getVertexArray()->setVertexAttribBinding(context, attribIndex, bindingIndex);
- mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
-}
-
-void State::setVertexAttribFormat(GLuint attribIndex,
- GLint size,
- GLenum 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);
-}
-
-void State::setProgram(const Context *context, Program *newProgram)
-{
- if (mProgram != newProgram)
- {
- if (mProgram)
- {
- mProgram->release(context);
- }
-
- mProgram = newProgram;
-
- if (mProgram)
- {
- newProgram->addRef();
- mDirtyObjects.set(DIRTY_OBJECT_PROGRAM_TEXTURES);
- }
- mDirtyBits.set(DIRTY_BIT_PROGRAM_EXECUTABLE);
- mDirtyBits.set(DIRTY_BIT_PROGRAM_BINDING);
- }
-}
-
-Program *State::getProgram() const
-{
- return mProgram;
-}
-
-void State::setTransformFeedbackBinding(const Context *context,
- TransformFeedback *transformFeedback)
-{
- mTransformFeedback.set(context, transformFeedback);
-}
-
-TransformFeedback *State::getCurrentTransformFeedback() const
-{
- return mTransformFeedback.get();
-}
-
-bool State::isTransformFeedbackActiveUnpaused() const
-{
- TransformFeedback *curTransformFeedback = getCurrentTransformFeedback();
- return curTransformFeedback && curTransformFeedback->isActive() && !curTransformFeedback->isPaused();
-}
-
-bool State::removeTransformFeedbackBinding(const Context *context, GLuint transformFeedback)
-{
- if (mTransformFeedback.id() == transformFeedback)
- {
- 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(const GLenum type) const
-{
- for (auto &iter : mActiveQueries)
- {
- const Query *query = iter.second.get();
- if (query != nullptr && ActiveQueryType(query->getType()) == ActiveQueryType(type))
- {
- return true;
- }
- }
-
- return false;
-}
-
-bool State::isQueryActive(Query *query) const
-{
- for (auto &iter : mActiveQueries)
- {
- if (iter.second.get() == query)
- {
- return true;
- }
- }
-
- return false;
-}
-
-void State::setActiveQuery(const Context *context, GLenum target, Query *query)
-{
- mActiveQueries[target].set(context, query);
-}
-
-GLuint State::getActiveQueryId(GLenum target) const
-{
- const Query *query = getActiveQuery(target);
- return (query ? query->id() : 0u);
-}
-
-Query *State::getActiveQuery(GLenum target) const
-{
- const auto it = mActiveQueries.find(target);
-
- // All query types should already exist in the activeQueries map
- ASSERT(it != mActiveQueries.end());
-
- return it->second.get();
-}
-
-void State::setBufferBinding(const Context *context, BufferBinding target, Buffer *buffer)
-{
- switch (target)
- {
- case BufferBinding::PixelPack:
- mBoundBuffers[target].set(context, buffer);
- mDirtyBits.set(DIRTY_BIT_PACK_BUFFER_BINDING);
- break;
- case BufferBinding::PixelUnpack:
- mBoundBuffers[target].set(context, buffer);
- mDirtyBits.set(DIRTY_BIT_UNPACK_BUFFER_BINDING);
- break;
- case BufferBinding::DrawIndirect:
- mBoundBuffers[target].set(context, buffer);
- mDirtyBits.set(DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING);
- break;
- case BufferBinding::TransformFeedback:
- if (mTransformFeedback.get() != nullptr)
- {
- mTransformFeedback->bindGenericBuffer(context, buffer);
- }
- break;
- case BufferBinding::ElementArray:
- getVertexArray()->setElementArrayBuffer(context, buffer);
- mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
- break;
- default:
- mBoundBuffers[target].set(context, buffer);
- break;
- }
-}
-void State::setIndexedBufferBinding(const Context *context,
- BufferBinding target,
- GLuint index,
- Buffer *buffer,
- GLintptr offset,
- GLsizeiptr size)
-{
- setBufferBinding(context, target, buffer);
-
- switch (target)
- {
- case BufferBinding::TransformFeedback:
- mTransformFeedback->bindIndexedBuffer(context, index, buffer, offset, size);
- break;
- case BufferBinding::Uniform:
- mUniformBuffers[index].set(context, buffer, offset, size);
- break;
- case BufferBinding::AtomicCounter:
- mAtomicCounterBuffers[index].set(context, buffer, offset, size);
- break;
- case BufferBinding::ShaderStorage:
- mShaderStorageBuffers[index].set(context, buffer, offset, size);
- break;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-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];
-}
-
-Buffer *State::getTargetBuffer(BufferBinding target) const
-{
- switch (target)
- {
- case BufferBinding::ElementArray:
- return getVertexArray()->getElementArrayBuffer().get();
- case BufferBinding::TransformFeedback:
- return mTransformFeedback->getGenericBuffer().get();
- default:
- return mBoundBuffers[target].get();
- }
-}
-
-void State::detachBuffer(const Context *context, GLuint bufferName)
-{
- for (auto &buffer : mBoundBuffers)
- {
- if (buffer.id() == bufferName)
- {
- buffer.set(context, nullptr);
- }
- }
-
- TransformFeedback *curTransformFeedback = getCurrentTransformFeedback();
- if (curTransformFeedback)
- {
- curTransformFeedback->detachBuffer(context, bufferName);
- }
-
- getVertexArray()->detachBuffer(context, bufferName);
-}
-
-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);
-}
-
-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);
-}
-
-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);
-}
-
-void State::setVertexAttribPointer(const Context *context,
- unsigned int attribNum,
- Buffer *boundBuffer,
- GLint size,
- GLenum type,
- bool normalized,
- bool pureInteger,
- GLsizei stride,
- const void *pointer)
-{
- getVertexArray()->setVertexAttribPointer(context, attribNum, boundBuffer, size, type,
- normalized, pureInteger, stride, pointer);
- mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
-}
-
-void State::setVertexAttribDivisor(const Context *context, GLuint index, GLuint divisor)
-{
- getVertexArray()->setVertexAttribDivisor(context, index, divisor);
- mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
-}
-
-const VertexAttribCurrentValueData &State::getVertexAttribCurrentValue(size_t attribNum) const
-{
- ASSERT(attribNum < mVertexAttribCurrentValues.size());
- return mVertexAttribCurrentValues[attribNum];
-}
-
-const std::vector<VertexAttribCurrentValueData> &State::getVertexAttribCurrentValues() const
-{
- return mVertexAttribCurrentValues;
-}
-
-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);
-}
-
-GLint State::getPackAlignment() const
-{
- return mPack.alignment;
-}
-
-void State::setPackReverseRowOrder(bool reverseRowOrder)
-{
- mPack.reverseRowOrder = reverseRowOrder;
- mDirtyBits.set(DIRTY_BIT_PACK_STATE);
-}
-
-bool State::getPackReverseRowOrder() const
-{
- return mPack.reverseRowOrder;
-}
-
-void State::setPackRowLength(GLint rowLength)
-{
- mPack.rowLength = rowLength;
- mDirtyBits.set(DIRTY_BIT_PACK_STATE);
-}
-
-GLint State::getPackRowLength() const
-{
- return mPack.rowLength;
-}
-
-void State::setPackSkipRows(GLint skipRows)
-{
- mPack.skipRows = skipRows;
- mDirtyBits.set(DIRTY_BIT_PACK_STATE);
-}
-
-GLint State::getPackSkipRows() const
-{
- return mPack.skipRows;
-}
-
-void State::setPackSkipPixels(GLint skipPixels)
-{
- mPack.skipPixels = skipPixels;
- mDirtyBits.set(DIRTY_BIT_PACK_STATE);
-}
-
-GLint State::getPackSkipPixels() const
-{
- return mPack.skipPixels;
-}
-
-const PixelPackState &State::getPackState() const
-{
- return mPack;
-}
-
-PixelPackState &State::getPackState()
-{
- return mPack;
-}
-
-void State::setUnpackAlignment(GLint alignment)
-{
- mUnpack.alignment = alignment;
- mDirtyBits.set(DIRTY_BIT_UNPACK_STATE);
-}
-
-GLint State::getUnpackAlignment() const
-{
- return mUnpack.alignment;
-}
-
-void State::setUnpackRowLength(GLint rowLength)
-{
- mUnpack.rowLength = rowLength;
- mDirtyBits.set(DIRTY_BIT_UNPACK_STATE);
-}
-
-GLint State::getUnpackRowLength() const
-{
- return mUnpack.rowLength;
-}
-
-void State::setUnpackImageHeight(GLint imageHeight)
-{
- mUnpack.imageHeight = imageHeight;
- mDirtyBits.set(DIRTY_BIT_UNPACK_STATE);
-}
-
-GLint State::getUnpackImageHeight() const
-{
- return mUnpack.imageHeight;
-}
-
-void State::setUnpackSkipImages(GLint skipImages)
-{
- mUnpack.skipImages = skipImages;
- mDirtyBits.set(DIRTY_BIT_UNPACK_STATE);
-}
-
-GLint State::getUnpackSkipImages() const
-{
- return mUnpack.skipImages;
-}
-
-void State::setUnpackSkipRows(GLint skipRows)
-{
- mUnpack.skipRows = skipRows;
- mDirtyBits.set(DIRTY_BIT_UNPACK_STATE);
-}
-
-GLint State::getUnpackSkipRows() const
-{
- return mUnpack.skipRows;
-}
-
-void State::setUnpackSkipPixels(GLint skipPixels)
-{
- mUnpack.skipPixels = skipPixels;
- mDirtyBits.set(DIRTY_BIT_UNPACK_STATE);
-}
-
-GLint State::getUnpackSkipPixels() const
-{
- return mUnpack.skipPixels;
-}
-
-const PixelUnpackState &State::getUnpackState() const
-{
- return mUnpack;
-}
-
-PixelUnpackState &State::getUnpackState()
-{
- return mUnpack;
-}
-
-const Debug &State::getDebug() const
-{
- return mDebug;
-}
-
-Debug &State::getDebug()
-{
- return mDebug;
-}
-
-void State::setCoverageModulation(GLenum components)
-{
- mCoverageModulation = components;
- mDirtyBits.set(DIRTY_BIT_COVERAGE_MODULATION);
-}
-
-GLenum State::getCoverageModulation() const
-{
- return mCoverageModulation;
-}
-
-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_MATRIX_MV);
- }
- else if (matrixMode == GL_PATH_PROJECTION_CHROMIUM)
- {
- memcpy(mPathMatrixProj, matrix, 16 * sizeof(GLfloat));
- mDirtyBits.set(DIRTY_BIT_PATH_RENDERING_MATRIX_PROJ);
- }
- 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_STENCIL_STATE);
-}
-
-GLenum State::getPathStencilFunc() const
-{
- return mPathStencilFunc;
-}
-
-GLint State::getPathStencilRef() const
-{
- return mPathStencilRef;
-}
-
-GLuint State::getPathStencilMask() const
-{
- return mPathStencilMask;
-}
-
-void State::setFramebufferSRGB(bool sRGB)
-{
- mFramebufferSRGB = sRGB;
- mDirtyBits.set(DIRTY_BIT_FRAMEBUFFER_SRGB);
-}
-
-bool State::getFramebufferSRGB() const
-{
- return mFramebufferSRGB;
-}
-
-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;
-
- 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);
- case GL_COVERAGE_MODULATION_CHROMIUM:
- params[0] = static_cast<GLfloat>(mCoverageModulation);
- break;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-void State::getIntegerv(const Context *context, GLenum pname, GLint *params)
-{
- if (pname >= GL_DRAW_BUFFER0_EXT && pname <= GL_DRAW_BUFFER15_EXT)
- {
- unsigned int colorAttachment = (pname - GL_DRAW_BUFFER0_EXT);
- ASSERT(colorAttachment < mMaxDrawBuffers);
- Framebuffer *framebuffer = mDrawFramebuffer;
- *params = framebuffer->getDrawBufferState(colorAttachment);
- return;
- }
-
- // Please note: DEPTH_CLEAR_VALUE is not included in our internal getIntegerv implementation
- // because it is stored as a float, despite the fact that the GL ES 2.0 spec names
- // GetIntegerv as its native query function. As it would require conversion in any
- // case, this should make no difference to the calling application. You may find it in
- // State::getFloatv.
- switch (pname)
- {
- case GL_ARRAY_BUFFER_BINDING:
- *params = mBoundBuffers[BufferBinding::Array].id();
- break;
- case GL_DRAW_INDIRECT_BUFFER_BINDING:
- *params = mBoundBuffers[BufferBinding::DrawIndirect].id();
- break;
- case GL_ELEMENT_ARRAY_BUFFER_BINDING:
- *params = getVertexArray()->getElementArrayBuffer().id();
- break;
- //case GL_FRAMEBUFFER_BINDING: // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
- case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE: *params = mDrawFramebuffer->id(); break;
- case GL_READ_FRAMEBUFFER_BINDING_ANGLE: *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(context, 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(context, 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(context, mDepthStencil.stencilWritemask);
- break;
- case GL_STENCIL_BACK_WRITEMASK:
- *params = CastMaskValue(context, mDepthStencil.stencilBackWritemask);
- break;
- case GL_STENCIL_CLEAR_VALUE: *params = mStencilClearValue; break;
- case GL_IMPLEMENTATION_COLOR_READ_TYPE:
- *params = mReadFramebuffer->getImplementationColorReadType(context);
- break;
- case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
- *params = mReadFramebuffer->getImplementationColorReadFormat(context);
- break;
- case GL_SAMPLE_BUFFERS:
- case GL_SAMPLES:
- {
- Framebuffer *framebuffer = mDrawFramebuffer;
- if (framebuffer->checkStatus(context) == GL_FRAMEBUFFER_COMPLETE)
- {
- switch (pname)
- {
- case GL_SAMPLE_BUFFERS:
- if (framebuffer->getSamples(context) != 0)
- {
- *params = 1;
- }
- else
- {
- *params = 0;
- }
- break;
- case GL_SAMPLES:
- *params = framebuffer->getSamples(context);
- 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->getFirstColorbuffer();
-
- 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->getDepthbuffer();
-
- if (depthbuffer)
- {
- *params = depthbuffer->getDepthSize();
- }
- else
- {
- *params = 0;
- }
- }
- break;
- case GL_STENCIL_BITS:
- {
- const Framebuffer *framebuffer = getDrawFramebuffer();
- const FramebufferAttachment *stencilbuffer = framebuffer->getStencilbuffer();
-
- if (stencilbuffer)
- {
- *params = stencilbuffer->getStencilSize();
- }
- else
- {
- *params = 0;
- }
- }
- break;
- case GL_TEXTURE_BINDING_2D:
- ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
- *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), GL_TEXTURE_2D);
- break;
- case GL_TEXTURE_BINDING_RECTANGLE_ANGLE:
- ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
- *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
- GL_TEXTURE_RECTANGLE_ANGLE);
- break;
- case GL_TEXTURE_BINDING_CUBE_MAP:
- ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
- *params =
- getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), GL_TEXTURE_CUBE_MAP);
- break;
- case GL_TEXTURE_BINDING_3D:
- ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
- *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), GL_TEXTURE_3D);
- break;
- case GL_TEXTURE_BINDING_2D_ARRAY:
- ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
- *params =
- getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), GL_TEXTURE_2D_ARRAY);
- break;
- case GL_TEXTURE_BINDING_2D_MULTISAMPLE:
- ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
- *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
- GL_TEXTURE_2D_MULTISAMPLE);
- break;
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
- *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
- GL_TEXTURE_EXTERNAL_OES);
- 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:
- ASSERT(mTransformFeedback.get() != nullptr);
- *params = mTransformFeedback->getGenericBuffer().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);
- 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;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-void State::getPointerv(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;
- 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;
- 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)
-{
- UNREACHABLE();
-}
-
-bool State::hasMappedBuffer(BufferBinding target) const
-{
- if (target == BufferBinding::Array)
- {
- const VertexArray *vao = getVertexArray();
- const auto &vertexAttribs = vao->getVertexAttributes();
- const auto &vertexBindings = vao->getVertexBindings();
- size_t maxEnabledAttrib = vao->getMaxEnabledAttribute();
- for (size_t attribIndex = 0; attribIndex < maxEnabledAttrib; attribIndex++)
- {
- const VertexAttribute &vertexAttrib = vertexAttribs[attribIndex];
- auto *boundBuffer = vertexBindings[vertexAttrib.bindingIndex].getBuffer().get();
- if (vertexAttrib.enabled && boundBuffer && boundBuffer->isMapped())
- {
- return true;
- }
- }
-
- return false;
- }
- else
- {
- Buffer *buffer = getTargetBuffer(target);
- return (buffer && buffer->isMapped());
- }
-}
-
-void State::syncDirtyObjects(const Context *context)
-{
- if (!mDirtyObjects.any())
- return;
-
- syncDirtyObjects(context, mDirtyObjects);
-}
-
-void State::syncDirtyObjects(const Context *context, const DirtyObjects &bitset)
-{
- for (auto dirtyObject : bitset)
- {
- switch (dirtyObject)
- {
- case DIRTY_OBJECT_READ_FRAMEBUFFER:
- ASSERT(mReadFramebuffer);
- mReadFramebuffer->syncState(context);
- break;
- case DIRTY_OBJECT_DRAW_FRAMEBUFFER:
- ASSERT(mDrawFramebuffer);
- mDrawFramebuffer->syncState(context);
- break;
- case DIRTY_OBJECT_VERTEX_ARRAY:
- ASSERT(mVertexArray);
- mVertexArray->syncState(context);
- break;
- case DIRTY_OBJECT_PROGRAM_TEXTURES:
- syncProgramTextures(context);
- break;
-
- default:
- UNREACHABLE();
- break;
- }
- }
-
- mDirtyObjects &= ~bitset;
-}
-
-void State::syncProgramTextures(const Context *context)
-{
- // TODO(jmadill): Fine-grained updates.
- if (!mProgram)
- {
- return;
- }
-
- ASSERT(mDirtyObjects[DIRTY_OBJECT_PROGRAM_TEXTURES]);
- mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS);
-
- ActiveTextureMask newActiveTextures;
-
- // Initialize to the 'Initialized' state and set to 'MayNeedInit' if any texture is not
- // initialized.
- mCachedTexturesInitState = InitState::Initialized;
-
- for (const SamplerBinding &samplerBinding : mProgram->getSamplerBindings())
- {
- if (samplerBinding.unreferenced)
- continue;
-
- GLenum textureType = samplerBinding.textureType;
- for (GLuint textureUnitIndex : samplerBinding.boundTextureUnits)
- {
- Texture *texture = getSamplerTexture(textureUnitIndex, textureType);
- Sampler *sampler = getSampler(textureUnitIndex);
- ASSERT(static_cast<size_t>(textureUnitIndex) < mCompleteTextureCache.size());
- ASSERT(static_cast<size_t>(textureUnitIndex) < newActiveTextures.size());
-
- ASSERT(texture);
-
- // Mark the texture binding bit as dirty if the texture completeness changes.
- // TODO(jmadill): Use specific dirty bit for completeness change.
- if (texture->isSamplerComplete(context, sampler) &&
- !mDrawFramebuffer->hasTextureAttachment(texture))
- {
- texture->syncState();
- mCompleteTextureCache[textureUnitIndex] = texture;
- }
- else
- {
- mCompleteTextureCache[textureUnitIndex] = nullptr;
- }
-
- // Bind the texture unconditionally, to recieve completeness change notifications.
- mCompleteTextureBindings[textureUnitIndex].bind(texture->getDirtyChannel());
- mActiveTexturesMask.set(textureUnitIndex);
- newActiveTextures.set(textureUnitIndex);
-
- if (sampler != nullptr)
- {
- sampler->syncState(context);
- }
-
- if (texture->initState() == InitState::MayNeedInit)
- {
- mCachedTexturesInitState = InitState::MayNeedInit;
- }
- }
- }
-
- // Unset now missing textures.
- ActiveTextureMask negativeMask = mActiveTexturesMask & ~newActiveTextures;
- if (negativeMask.any())
- {
- for (auto textureIndex : negativeMask)
- {
- mCompleteTextureBindings[textureIndex].reset();
- mCompleteTextureCache[textureIndex] = nullptr;
- mActiveTexturesMask.reset(textureIndex);
- }
- }
-}
-
-void 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:
- case GL_SAMPLER:
- case GL_PROGRAM:
- localSet.set(DIRTY_OBJECT_PROGRAM_TEXTURES);
- break;
- }
-
- 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:
- mDirtyObjects.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER);
- break;
- case GL_FRAMEBUFFER:
- mDirtyObjects.set(DIRTY_OBJECT_READ_FRAMEBUFFER);
- mDirtyObjects.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER);
- break;
- case GL_VERTEX_ARRAY:
- mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
- break;
- case GL_TEXTURE:
- case GL_SAMPLER:
- case GL_PROGRAM:
- mDirtyObjects.set(DIRTY_OBJECT_PROGRAM_TEXTURES);
- mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS);
- break;
- }
-}
-
-void State::onProgramExecutableChange(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."
- if (program->isLinked() && mProgram == program)
- {
- mDirtyBits.set(DIRTY_BIT_PROGRAM_EXECUTABLE);
- mDirtyObjects.set(DIRTY_OBJECT_PROGRAM_TEXTURES);
- }
-}
-
-void State::setImageUnit(const Context *context,
- GLuint 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;
-}
-
-const ImageUnit &State::getImageUnit(GLuint unit) const
-{
- return mImageUnits[unit];
-}
-
-// Handle a dirty texture event.
-void State::signal(size_t textureIndex, InitState initState)
-{
- // Conservatively assume all textures are dirty.
- // TODO(jmadill): More fine-grained update.
- mDirtyObjects.set(DIRTY_OBJECT_PROGRAM_TEXTURES);
-
- if (initState == InitState::MayNeedInit)
- {
- mCachedTexturesInitState = InitState::MayNeedInit;
- }
-}
-
-Error State::clearUnclearedActiveTextures(const Context *context)
-{
- ASSERT(mRobustResourceInit);
-
- if (mCachedTexturesInitState == InitState::Initialized)
- {
- return NoError();
- }
-
- for (auto textureIndex : mActiveTexturesMask)
- {
- Texture *texture = mCompleteTextureCache[textureIndex];
- if (texture)
- {
- ANGLE_TRY(texture->ensureInitialized(context));
- }
- }
-
- mCachedTexturesInitState = InitState::Initialized;
-
- return NoError();
-}
-
-AttributesMask State::getAndResetDirtyCurrentValues() const
-{
- AttributesMask retVal = mDirtyCurrentValues;
- mDirtyCurrentValues.reset();
- return retVal;
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/State.h b/src/3rdparty/angle/src/libANGLE/State.h
deleted file mode 100644
index 52e1d78382..0000000000
--- a/src/3rdparty/angle/src/libANGLE/State.h
+++ /dev/null
@@ -1,602 +0,0 @@
-//
-// 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/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/VertexAttribute.h"
-#include "libANGLE/angletypes.h"
-
-namespace gl
-{
-class Query;
-class VertexArray;
-class Context;
-struct Caps;
-
-class State : public OnAttachmentDirtyReceiver, angle::NonCopyable
-{
- public:
- State();
- ~State() override;
-
- void initialize(const Context *context,
- bool debug,
- bool bindGeneratesResource,
- bool clientArraysEnabled,
- bool robustResourceInit,
- bool programBinaryCacheEnabled);
- void reset(const Context *context);
-
- // State chunk getters
- const RasterizerState &getRasterizerState() const;
- const BlendState &getBlendState() const;
- 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;
- void setRasterizerDiscard(bool enabled);
-
- // Primitive restart
- bool isPrimitiveRestartEnabled() const;
- void setPrimitiveRestart(bool enabled);
-
- // Face culling state manipulation
- bool isCullFaceEnabled() const;
- void setCullFace(bool enabled);
- void setCullMode(CullFaceMode mode);
- void setFrontFace(GLenum front);
-
- // Depth test state manipulation
- bool isDepthTestEnabled() const;
- void setDepthTest(bool enabled);
- void setDepthFunc(GLenum depthFunc);
- void setDepthRange(float zNear, float zFar);
- float getNearPlane() const;
- float getFarPlane() const;
-
- // Blend state manipulation
- bool isBlendEnabled() const;
- void setBlend(bool enabled);
- void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha);
- void setBlendColor(float red, float green, float blue, float alpha);
- void setBlendEquation(GLenum rgbEquation, GLenum alphaEquation);
- const ColorF &getBlendColor() const;
-
- // Stencil state maniupulation
- bool isStencilTestEnabled() const;
- void setStencilTest(bool enabled);
- void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask);
- void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask);
- void setStencilWritemask(GLuint stencilWritemask);
- void setStencilBackWritemask(GLuint stencilBackWritemask);
- void setStencilOperations(GLenum stencilFail,
- GLenum stencilPassDepthFail,
- GLenum stencilPassDepthPass);
- void setStencilBackOperations(GLenum stencilBackFail,
- GLenum stencilBackPassDepthFail,
- GLenum stencilBackPassDepthPass);
- GLint getStencilRef() const;
- GLint getStencilBackRef() const;
-
- // Depth bias/polygon offset state manipulation
- bool isPolygonOffsetFillEnabled() const;
- void setPolygonOffsetFill(bool enabled);
- void setPolygonOffsetParams(GLfloat factor, GLfloat units);
-
- // Multisample coverage state manipulation
- bool isSampleAlphaToCoverageEnabled() const;
- void setSampleAlphaToCoverage(bool enabled);
- bool isSampleCoverageEnabled() const;
- void setSampleCoverage(bool enabled);
- void setSampleCoverageParams(GLclampf value, bool invert);
- GLfloat getSampleCoverageValue() const;
- bool getSampleCoverageInvert() const;
-
- // Multisample mask state manipulation.
- bool isSampleMaskEnabled() const;
- void setSampleMaskEnabled(bool enabled);
- void setSampleMaskParams(GLuint maskNumber, GLbitfield mask);
- GLbitfield getSampleMaskWord(GLuint maskNumber) const;
- GLuint getMaxSampleMaskWords() const;
-
- // Multisampling/alpha to one manipulation.
- void setSampleAlphaToOne(bool enabled);
- bool isSampleAlphaToOneEnabled() const;
- void setMultisampling(bool enabled);
- bool isMultisamplingEnabled() const;
-
- // Scissor test state toggle & query
- bool isScissorTestEnabled() const;
- void setScissorTest(bool enabled);
- void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height);
- const Rectangle &getScissor() const;
-
- // Dither state toggle & query
- bool isDitherEnabled() const;
- 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;
-
- // Hint setters
- void setGenerateMipmapHint(GLenum hint);
- void setFragmentShaderDerivativeHint(GLenum hint);
-
- // GL_CHROMIUM_bind_generates_resource
- bool isBindGeneratesResourceEnabled() const;
-
- // GL_ANGLE_client_arrays
- bool areClientArraysEnabled() const;
-
- // Viewport state setter/getter
- void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
- const Rectangle &getViewport() const;
-
- // Texture binding & active texture unit manipulation
- void setActiveSampler(unsigned int active);
- unsigned int getActiveSampler() const;
- void setSamplerTexture(const Context *context, GLenum type, Texture *texture);
- Texture *getTargetTexture(GLenum target) const;
- Texture *getSamplerTexture(unsigned int sampler, GLenum type) const;
- GLuint getSamplerTextureId(unsigned int sampler, GLenum type) const;
- void detachTexture(const Context *context, const TextureMap &zeroTextures, GLuint texture);
- void initializeZeroTextures(const Context *context, const TextureMap &zeroTextures);
-
- // Sampler object binding manipulation
- void setSamplerBinding(const Context *context, GLuint textureUnit, Sampler *sampler);
- GLuint getSamplerId(GLuint textureUnit) const;
- Sampler *getSampler(GLuint textureUnit) const;
- void detachSampler(const Context *context, GLuint sampler);
-
- // Renderbuffer binding manipulation
- void setRenderbufferBinding(const Context *context, Renderbuffer *renderbuffer);
- GLuint getRenderbufferId() const;
- Renderbuffer *getCurrentRenderbuffer() const;
- 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;
- Framebuffer *getDrawFramebuffer() const;
- bool removeReadFramebufferBinding(GLuint framebuffer);
- bool removeDrawFramebufferBinding(GLuint framebuffer);
-
- // Vertex array object binding manipulation
- void setVertexArrayBinding(VertexArray *vertexArray);
- GLuint getVertexArrayId() const;
- VertexArray *getVertexArray() const;
- bool removeVertexArrayBinding(GLuint vertexArray);
-
- // Program binding manipulation
- void setProgram(const Context *context, Program *newProgram);
- Program *getProgram() const;
-
- // Transform feedback object (not buffer) binding manipulation
- void setTransformFeedbackBinding(const Context *context, TransformFeedback *transformFeedback);
- TransformFeedback *getCurrentTransformFeedback() const;
- bool isTransformFeedbackActiveUnpaused() const;
- bool removeTransformFeedbackBinding(const Context *context, GLuint transformFeedback);
-
- // Query binding manipulation
- bool isQueryActive(const GLenum type) const;
- bool isQueryActive(Query *query) const;
- void setActiveQuery(const Context *context, GLenum target, Query *query);
- GLuint getActiveQueryId(GLenum target) const;
- Query *getActiveQuery(GLenum target) const;
-
- // Program Pipeline binding manipulation
- void setProgramPipelineBinding(const Context *context, ProgramPipeline *pipeline);
- void detachProgramPipeline(const Context *context, GLuint pipeline);
-
- //// Typed buffer binding point manipulation ////
- void setBufferBinding(const Context *context, BufferBinding target, Buffer *buffer);
- Buffer *getTargetBuffer(BufferBinding target) const;
- void 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
- void detachBuffer(const Context *context, GLuint bufferName);
-
- // Vertex attrib manipulation
- void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
- void setElementArrayBuffer(const Context *context, Buffer *buffer);
- void setVertexAttribf(GLuint index, const GLfloat values[4]);
- void setVertexAttribu(GLuint index, const GLuint values[4]);
- void setVertexAttribi(GLuint index, const GLint values[4]);
- void setVertexAttribPointer(const Context *context,
- unsigned int attribNum,
- Buffer *boundBuffer,
- GLint size,
- GLenum type,
- bool normalized,
- bool pureInteger,
- GLsizei stride,
- const void *pointer);
- void setVertexAttribDivisor(const Context *context, GLuint index, GLuint divisor);
- const VertexAttribCurrentValueData &getVertexAttribCurrentValue(size_t attribNum) const;
- const std::vector<VertexAttribCurrentValueData> &getVertexAttribCurrentValues() const;
- 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,
- GLenum type,
- bool normalized,
- bool pureInteger,
- GLuint relativeOffset);
- void setVertexAttribBinding(const Context *context, GLuint attribIndex, GLuint bindingIndex);
- void setVertexBindingDivisor(GLuint bindingIndex, GLuint divisor);
-
- // Pixel pack state manipulation
- void setPackAlignment(GLint alignment);
- GLint getPackAlignment() const;
- void setPackReverseRowOrder(bool reverseRowOrder);
- bool getPackReverseRowOrder() const;
- void setPackRowLength(GLint rowLength);
- GLint getPackRowLength() const;
- void setPackSkipRows(GLint skipRows);
- GLint getPackSkipRows() const;
- void setPackSkipPixels(GLint skipPixels);
- GLint getPackSkipPixels() const;
- const PixelPackState &getPackState() const;
- PixelPackState &getPackState();
-
- // Pixel unpack state manipulation
- void setUnpackAlignment(GLint alignment);
- GLint getUnpackAlignment() const;
- void setUnpackRowLength(GLint rowLength);
- GLint getUnpackRowLength() const;
- void setUnpackImageHeight(GLint imageHeight);
- GLint getUnpackImageHeight() const;
- void setUnpackSkipImages(GLint skipImages);
- GLint getUnpackSkipImages() const;
- void setUnpackSkipRows(GLint skipRows);
- GLint getUnpackSkipRows() const;
- void setUnpackSkipPixels(GLint skipPixels);
- GLint getUnpackSkipPixels() const;
- const PixelUnpackState &getUnpackState() const;
- PixelUnpackState &getUnpackState();
-
- // Debug state
- const Debug &getDebug() const;
- Debug &getDebug();
-
- // CHROMIUM_framebuffer_mixed_samples coverage modulation
- void setCoverageModulation(GLenum components);
- GLenum getCoverageModulation() const;
-
- // 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;
- GLint getPathStencilRef() const;
- GLuint getPathStencilMask() const;
-
- // GL_EXT_sRGB_write_control
- void setFramebufferSRGB(bool sRGB);
- bool getFramebufferSRGB() const;
-
- // State query functions
- void getBooleanv(GLenum pname, GLboolean *params);
- void getFloatv(GLenum pname, GLfloat *params);
- void getIntegerv(const Context *context, GLenum pname, GLint *params);
- void getPointerv(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 hasMappedBuffer(BufferBinding target) const;
- bool isRobustResourceInitEnabled() const { return mRobustResourceInit; }
-
- // Sets the dirty bit for the program executable.
- void onProgramExecutableChange(Program *program);
-
- enum DirtyBitType
- {
- 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_READ_FRAMEBUFFER_BINDING,
- DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING,
- DIRTY_BIT_RENDERBUFFER_BINDING,
- DIRTY_BIT_VERTEX_ARRAY_BINDING,
- DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING,
- 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_MULTISAMPLING,
- DIRTY_BIT_SAMPLE_ALPHA_TO_ONE,
- DIRTY_BIT_COVERAGE_MODULATION, // CHROMIUM_framebuffer_mixed_samples
- DIRTY_BIT_PATH_RENDERING_MATRIX_MV, // CHROMIUM_path_rendering path model view matrix
- DIRTY_BIT_PATH_RENDERING_MATRIX_PROJ, // CHROMIUM_path_rendering path projection matrix
- DIRTY_BIT_PATH_RENDERING_STENCIL_STATE,
- DIRTY_BIT_FRAMEBUFFER_SRGB, // GL_EXT_sRGB_write_control
- DIRTY_BIT_CURRENT_VALUES,
- 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_READ_FRAMEBUFFER,
- DIRTY_OBJECT_DRAW_FRAMEBUFFER,
- DIRTY_OBJECT_VERTEX_ARRAY,
- // Use a very coarse bit for any program or texture change.
- // TODO(jmadill): Fine-grained dirty bits for each texture/sampler.
- DIRTY_OBJECT_PROGRAM_TEXTURES,
- DIRTY_OBJECT_UNKNOWN,
- DIRTY_OBJECT_MAX = DIRTY_OBJECT_UNKNOWN,
- };
-
- typedef angle::BitSet<DIRTY_BIT_MAX> DirtyBits;
- const DirtyBits &getDirtyBits() const { return mDirtyBits; }
- void clearDirtyBits() { mDirtyBits.reset(); }
- void clearDirtyBits(const DirtyBits &bitset) { mDirtyBits &= ~bitset; }
- void setAllDirtyBits() { mDirtyBits.set(); }
-
- typedef angle::BitSet<DIRTY_OBJECT_MAX> DirtyObjects;
- void clearDirtyObjects() { mDirtyObjects.reset(); }
- void setAllDirtyObjects() { mDirtyObjects.set(); }
- void syncDirtyObjects(const Context *context);
- void syncDirtyObjects(const Context *context, const DirtyObjects &bitset);
- void syncDirtyObject(const Context *context, GLenum target);
- void setObjectDirty(GLenum target);
-
- // This actually clears the current value dirty bits.
- // TODO(jmadill): Pass mutable dirty bits into Impl.
- AttributesMask getAndResetDirtyCurrentValues() const;
-
- void setImageUnit(const Context *context,
- GLuint unit,
- Texture *texture,
- GLint level,
- GLboolean layered,
- GLint layer,
- GLenum access,
- GLenum format);
-
- const ImageUnit &getImageUnit(GLuint unit) const;
- const std::vector<Texture *> &getCompleteTextureCache() const { return mCompleteTextureCache; }
-
- // Handle a dirty texture event.
- void signal(size_t textureIndex, InitState initState) override;
-
- Error clearUnclearedActiveTextures(const Context *context);
-
- private:
- void syncProgramTextures(const Context *context);
-
- // 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;
-
- bool mBindGeneratesResource;
- bool mClientArraysEnabled;
-
- Rectangle mViewport;
- float mNearZ;
- float mFarZ;
-
- Framebuffer *mReadFramebuffer;
- Framebuffer *mDrawFramebuffer;
- BindingPointer<Renderbuffer> mRenderbuffer;
- Program *mProgram;
- BindingPointer<ProgramPipeline> mProgramPipeline;
-
- typedef std::vector<VertexAttribCurrentValueData> VertexAttribVector;
- VertexAttribVector mVertexAttribCurrentValues; // From glVertexAttrib
- VertexArray *mVertexArray;
-
- // Texture and sampler bindings
- size_t mActiveSampler; // Active texture unit selector - GL_TEXTURE0
-
- typedef std::vector<BindingPointer<Texture>> TextureBindingVector;
- typedef std::map<GLenum, TextureBindingVector> TextureBindingMap;
- 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 OnAttachmentDirtyReceiver,
- // and keeps an array of bindings to the Texture class. When the Textures are marked dirty,
- // they send messages to the State class (and any Framebuffers they're attached to) via the
- // State::signal method (see above). Internally 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
- // signal_utils.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.
- std::vector<Texture *> mCompleteTextureCache;
- std::vector<OnAttachmentDirtyBinding> mCompleteTextureBindings;
- InitState mCachedTexturesInitState;
- using ActiveTextureMask = angle::BitSet<IMPLEMENTATION_MAX_ACTIVE_TEXTURES>;
- ActiveTextureMask mActiveTexturesMask;
-
- typedef std::vector<BindingPointer<Sampler>> SamplerBindingVector;
- SamplerBindingVector mSamplers;
-
- typedef std::vector<ImageUnit> ImageUnitVector;
- ImageUnitVector mImageUnits;
-
- typedef std::map<GLenum, BindingPointer<Query>> ActiveQueryMap;
- ActiveQueryMap mActiveQueries;
-
- // Stores the currently bound buffer for each binding point. It has entries for the element
- // array buffer and the transform feedback buffer but these should not be used. Instead these
- // bind points are respectively owned by current the vertex array object and the current
- // transform feedback 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;
-
- BindingPointer<Buffer> mPixelUnpackBuffer;
- PixelUnpackState mUnpack;
- BindingPointer<Buffer> mPixelPackBuffer;
- 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
- bool mRobustResourceInit;
-
- // GL_ANGLE_program_cache_control
- bool mProgramBinaryCacheEnabled;
-
- DirtyBits mDirtyBits;
- DirtyObjects mDirtyObjects;
- mutable AttributesMask mDirtyCurrentValues;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_STATE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Stream.cpp b/src/3rdparty/angle/src/libANGLE/Stream.cpp
deleted file mode 100644
index 68279976b7..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Stream.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-//
-// 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 <platform/Platform.h>
-#include <EGL/eglext.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)
- : 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::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->getGLState();
- EGLenum bufferType = attributes.getAsInt(EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
- if (bufferType == EGL_RGB_BUFFER)
- {
- mPlanes[0].texture = glState.getTargetTexture(GL_TEXTURE_EXTERNAL_OES);
- 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_TEXTURE_EXTERNAL_OES);
- 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::createProducerD3D11TextureNV12(const AttributeMap &attributes)
-{
- ASSERT(mState == EGL_STREAM_STATE_CONNECTING_KHR);
- ASSERT(mConsumerType == ConsumerType::GLTextureYUV);
- ASSERT(mProducerType == ProducerType::NoProducer);
- ASSERT(mPlaneCount == 2);
-
- mProducerImplementation = mDisplay->getImplementation()->createStreamProducerD3DTextureNV12(
- mConsumerType, attributes);
- mProducerType = ProducerType::D3D11TextureNV12;
- 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::D3D11TextureNV12);
-
- 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(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::D3D11TextureNV12);
-
- // Release the images
- for (int i = 0; i < mPlaneCount; i++)
- {
- if (mPlanes[i].texture != nullptr)
- {
- ANGLE_TRY(mPlanes[i].texture->releaseImageFromStream(context));
- }
- }
-
- return NoError();
-}
-
-bool Stream::isConsumerBoundToContext(const gl::Context *context) const
-{
- ASSERT(context != nullptr);
- return (context == mContext);
-}
-
-Error Stream::validateD3D11NV12Texture(void *texture) const
-{
- ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
- mConsumerType == ConsumerType::GLTextureYUV);
- ASSERT(mProducerType == ProducerType::D3D11TextureNV12);
- ASSERT(mProducerImplementation != nullptr);
-
- return mProducerImplementation->validateD3DNV12Texture(texture);
-}
-
-Error Stream::postD3D11NV12Texture(void *texture, const AttributeMap &attributes)
-{
- ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
- mConsumerType == ConsumerType::GLTextureYUV);
- ASSERT(mProducerType == ProducerType::D3D11TextureNV12);
-
- mProducerImplementation->postD3DNV12Texture(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/src/3rdparty/angle/src/libANGLE/Stream.h b/src/3rdparty/angle/src/libANGLE/Stream.h
deleted file mode 100644
index b674c44008..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Stream.h
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-// 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"
-
-namespace rx
-{
-class StreamProducerImpl;
-}
-
-namespace gl
-{
-class Context;
-class Texture;
-}
-
-namespace egl
-{
-class Display;
-class Error;
-class Thread;
-
-class Stream final : angle::NonCopyable
-{
- public:
- Stream(Display *display, const AttributeMap &attribs);
- ~Stream();
-
- enum class ConsumerType
- {
- NoConsumer,
- GLTextureRGB,
- GLTextureYUV,
- };
-
- enum class ProducerType
- {
- NoProducer,
- D3D11TextureNV12,
- };
-
- // 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 createProducerD3D11TextureNV12(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 validateD3D11NV12Texture(void *texture) const;
- Error postD3D11NV12Texture(void *texture, const AttributeMap &attributes);
-
- private:
- // 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/src/3rdparty/angle/src/libANGLE/Surface.cpp b/src/3rdparty/angle/src/libANGLE/Surface.cpp
deleted file mode 100644
index 746da03778..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Surface.cpp
+++ /dev/null
@@ -1,484 +0,0 @@
-//
-// 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 <iostream>
-
-#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"
-
-namespace egl
-{
-
-SurfaceState::SurfaceState(const egl::Config *configIn, const AttributeMap &attributesIn)
- : defaultFramebuffer(nullptr), config(configIn), attributes(attributesIn)
-{
-}
-
-Surface::Surface(EGLint surfaceType, const egl::Config *config, const AttributeMap &attributes)
- : FramebufferAttachmentObject(),
- mState(config, attributes),
- mImplementation(nullptr),
- mCurrentCount(0),
- mDestroyed(false),
- mType(surfaceType),
- 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(EGL_NO_TEXTURE),
- 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(),
- mBackFormat(config->renderTargetFormat),
- mDSFormat(config->depthStencilFormat)
-{
- 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);
-
- 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 = static_cast<EGLenum>(attributes.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE));
- 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 (mState.defaultFramebuffer)
- {
- mState.defaultFramebuffer->destroyDefault(display);
- }
- if (mImplementation)
- {
- mImplementation->destroy(display);
- }
-
- if (mTexture.get())
- {
- if (mImplementation)
- {
- ANGLE_TRY(mImplementation->releaseTexImage(EGL_BACK_BUFFER));
- }
- auto glErr = mTexture->releaseTexImageFromSurface(display->getProxyContext());
- if (glErr.isError())
- {
- return Error(EGL_BAD_SURFACE);
- }
- mTexture.set(nullptr, nullptr);
- }
-
- if (mState.defaultFramebuffer)
- {
- mState.defaultFramebuffer->onDestroy(display->getProxyContext());
- }
- SafeDelete(mState.defaultFramebuffer);
- SafeDelete(mImplementation);
-
- delete this;
- return NoError();
-}
-
-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();
-
- // Must happen after implementation initialize for OSX.
- mState.defaultFramebuffer = createDefaultFramebuffer(display);
- ASSERT(mState.defaultFramebuffer != nullptr);
-
- return NoError();
-}
-
-Error Surface::setIsCurrent(const gl::Context *context, bool isCurrent)
-{
- if (isCurrent)
- {
- mCurrentCount++;
- return NoError();
- }
-
- ASSERT(mCurrentCount > 0);
- mCurrentCount--;
- if (mCurrentCount == 0 && mDestroyed)
- {
- ASSERT(context);
- return destroyImpl(context->getCurrentDisplay());
- }
- return NoError();
-}
-
-Error Surface::onDestroy(const Display *display)
-{
- mDestroyed = true;
- if (mCurrentCount == 0)
- {
- return destroyImpl(display);
- }
- return NoError();
-}
-
-EGLint Surface::getType() const
-{
- return mType;
-}
-
-Error Surface::swap(const gl::Context *context)
-{
- return mImplementation->swap(context);
-}
-
-Error Surface::swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects)
-{
- return mImplementation->swapWithDamage(context, rects, n_rects);
-}
-
-Error Surface::postSubBuffer(const gl::Context *context,
- EGLint x,
- EGLint y,
- EGLint width,
- EGLint height)
-{
- return mImplementation->postSubBuffer(context, x, y, width, height);
-}
-
-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;
-}
-
-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;
-}
-
-EGLenum 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(const gl::Context *context, gl::Texture *texture, EGLint buffer)
-{
- ASSERT(!mTexture.get());
- ANGLE_TRY(mImplementation->bindTexImage(texture, buffer));
-
- auto glErr = texture->bindTexImageFromSurface(context, this);
- if (glErr.isError())
- {
- return Error(EGL_BAD_SURFACE);
- }
- mTexture.set(context, texture);
-
- return NoError();
-}
-
-Error Surface::releaseTexImage(const gl::Context *context, EGLint buffer)
-{
- ASSERT(context);
-
- ANGLE_TRY(mImplementation->releaseTexImage(buffer));
-
- ASSERT(mTexture.get());
- auto glErr = mTexture->releaseTexImageFromSurface(context);
- if (glErr.isError())
- {
- return Error(EGL_BAD_SURFACE);
- }
- mTexture.set(context, nullptr);
-
- return NoError();
-}
-
-Error Surface::getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc)
-{
- return mImplementation->getSyncValues(ust, msc, sbc);
-}
-
-void Surface::releaseTexImageFromTexture(const gl::Context *context)
-{
- ASSERT(mTexture.get());
- mTexture.set(context, nullptr);
-}
-
-gl::Extents Surface::getAttachmentSize(const gl::ImageIndex & /*target*/) const
-{
- return gl::Extents(getWidth(), getHeight(), 1);
-}
-
-const gl::Format &Surface::getAttachmentFormat(GLenum binding, const gl::ImageIndex &target) const
-{
- return (binding == GL_BACK ? mBackFormat : mDSFormat);
-}
-
-GLsizei Surface::getAttachmentSamples(const gl::ImageIndex &target) const
-{
- return getConfig()->samples;
-}
-
-GLuint Surface::getId() const
-{
- UNREACHABLE();
- return 0;
-}
-
-gl::Framebuffer *Surface::createDefaultFramebuffer(const Display *display)
-{
- return new gl::Framebuffer(display, this);
-}
-
-gl::InitState Surface::initState(const gl::ImageIndex & /*imageIndex*/) const
-{
- // TODO(jmadill): Lazy surface init.
- return gl::InitState::Initialized;
-}
-
-void Surface::setInitState(const gl::ImageIndex & /*imageIndex*/, gl::InitState /*initState*/)
-{
- // No-op.
-}
-
-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)
-{
- 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/src/3rdparty/angle/src/libANGLE/Surface.h b/src/3rdparty/angle/src/libANGLE/Surface.h
deleted file mode 100644
index b3188ff909..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Surface.h
+++ /dev/null
@@ -1,238 +0,0 @@
-//
-// 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/angleutils.h"
-#include "libANGLE/AttributeMap.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 Framebuffer;
-class Texture;
-}
-
-namespace rx
-{
-class EGLImplFactory;
-}
-
-namespace egl
-{
-class Display;
-struct Config;
-
-struct SurfaceState final : private angle::NonCopyable
-{
- SurfaceState(const egl::Config *configIn, const AttributeMap &attributesIn);
-
- gl::Framebuffer *defaultFramebuffer;
- const egl::Config *config;
- AttributeMap attributes;
-};
-
-class Surface : public gl::FramebufferAttachmentObject
-{
- public:
- rx::SurfaceImpl *getImplementation() const { return mImplementation; }
-
- EGLint getType() const;
-
- Error initialize(const Display *display);
- 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 querySurfacePointerANGLE(EGLint attribute, void **value);
- Error bindTexImage(const 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 setIsCurrent(const gl::Context *context, bool isCurrent);
- Error onDestroy(const Display *display);
-
- void setMipmapLevel(EGLint level);
- void setMultisampleResolve(EGLenum resolve);
- void setSwapBehavior(EGLenum behavior);
-
- const Config *getConfig() const;
-
- // width and height can change with client window resizing
- EGLint getWidth() const;
- EGLint getHeight() const;
- EGLint getPixelAspectRatio() const;
- EGLenum getRenderBuffer() const;
- EGLenum getSwapBehavior() const;
- EGLenum getTextureFormat() const;
- EGLenum getTextureTarget() const;
- 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.get(); }
- gl::Framebuffer *getDefaultFramebuffer() { return mState.defaultFramebuffer; }
-
- EGLint isFixedSize() const;
-
- // FramebufferAttachmentObject implementation
- gl::Extents getAttachmentSize(const gl::ImageIndex &imageIndex) const override;
- const gl::Format &getAttachmentFormat(GLenum binding,
- const gl::ImageIndex &imageIndex) const override;
- GLsizei getAttachmentSamples(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; }
-
- protected:
- Surface(EGLint surfaceType, const egl::Config *config, const AttributeMap &attributes);
- ~Surface() override;
- rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override;
-
- gl::Framebuffer *createDefaultFramebuffer(const Display *display);
-
- // ANGLE-only method, used internally
- friend class gl::Texture;
- void releaseTexImageFromTexture(const gl::Context *context);
-
- SurfaceState mState;
- rx::SurfaceImpl *mImplementation;
- int mCurrentCount;
- bool mDestroyed;
-
- EGLint mType;
-
- 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;
-
- EGLenum mTextureFormat;
- EGLenum mTextureTarget;
-
- EGLint mPixelAspectRatio; // Display aspect ratio
- EGLenum mRenderBuffer; // Render buffer
- EGLenum mSwapBehavior; // Buffer swap behavior
-
- EGLint mOrientation;
-
- gl::BindingPointer<gl::Texture> mTexture;
-
- gl::Format mBackFormat;
- gl::Format mDSFormat;
-
- private:
- Error destroyImpl(const Display *display);
-};
-
-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/src/3rdparty/angle/src/libANGLE/Texture.cpp b/src/3rdparty/angle/src/libANGLE/Texture.cpp
deleted file mode 100644
index da92e65916..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Texture.cpp
+++ /dev/null
@@ -1,1484 +0,0 @@
-//
-// 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/ContextState.h"
-#include "libANGLE/Image.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.magFilter == GL_NEAREST &&
- (samplerState.minFilter == GL_NEAREST ||
- samplerState.minFilter == GL_NEAREST_MIPMAP_NEAREST));
-}
-
-size_t GetImageDescIndex(GLenum target, size_t level)
-{
- return IsCubeMapTextureTarget(target) ? ((level * 6) + CubeMapTextureTargetToLayerIndex(target))
- : level;
-}
-
-ImageIndex GetImageIndexFromDescIndex(GLenum target, size_t descIndex)
-{
- if (target == GL_TEXTURE_CUBE_MAP)
- {
- size_t faceIndex = descIndex % 6;
- size_t mipIndex = descIndex / 6;
- return ImageIndex::MakeCube(LayerIndexToCubeMapTextureTarget(faceIndex),
- static_cast<GLint>(mipIndex));
- }
-
- return ImageIndex::MakeGeneric(target, static_cast<GLint>(descIndex));
-}
-
-InitState DetermineInitState(const Context *context, const uint8_t *pixels)
-{
- // Can happen in tests.
- if (!context || !context->isRobustResourceInitEnabled())
- return InitState::Initialized;
-
- const auto &glState = context->getGLState();
- return (pixels == nullptr && glState.getTargetBuffer(gl::BufferBinding::PixelUnpack) == nullptr)
- ? InitState::MayNeedInit
- : InitState::Initialized;
-}
-
-} // namespace
-
-bool IsMipmapFiltered(const SamplerState &samplerState)
-{
- switch (samplerState.minFilter)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- return false;
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- return true;
- default:
- UNREACHABLE();
- return false;
- }
-}
-
-SwizzleState::SwizzleState()
- : swizzleRed(GL_INVALID_INDEX),
- swizzleGreen(GL_INVALID_INDEX),
- swizzleBlue(GL_INVALID_INDEX),
- swizzleAlpha(GL_INVALID_INDEX)
-{
-}
-
-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(GLenum target)
- : mTarget(target),
- mSwizzleState(GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA),
- mSamplerState(SamplerState::CreateDefaultForTarget(target)),
- mBaseLevel(0),
- mMaxLevel(1000),
- mDepthStencilTextureMode(GL_DEPTH_COMPONENT),
- mImmutableFormat(false),
- mImmutableLevels(0),
- mUsage(GL_NONE),
- mImageDescs((IMPLEMENTATION_MAX_TEXTURE_LEVELS + 1) *
- (target == GL_TEXTURE_CUBE_MAP ? 6 : 1)),
- mInitState(InitState::MayNeedInit)
-{
-}
-
-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 (mTarget == GL_TEXTURE_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(mTarget == GL_TEXTURE_CUBE_MAP);
-
- const ImageDesc &baseImageDesc =
- getImageDesc(FirstCubeMapTextureTarget, getEffectiveBaseLevel());
- if (baseImageDesc.size.width == 0 || baseImageDesc.size.width != baseImageDesc.size.height)
- {
- return false;
- }
-
- for (GLenum face = FirstCubeMapTextureTarget + 1; face <= LastCubeMapTextureTarget; 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;
-}
-
-bool TextureState::computeSamplerCompleteness(const SamplerState &samplerState,
- const ContextState &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 (mTarget == GL_TEXTURE_CUBE_MAP && 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 (mTarget != GL_TEXTURE_2D_MULTISAMPLE &&
- !baseImageDesc.format.info->filterSupport(data.getClientVersion(), data.getExtensions()) &&
- !IsPointSampled(samplerState))
- {
- return false;
- }
- bool npotSupport = data.getExtensions().textureNPOT || data.getClientMajorVersion() >= 3;
- if (!npotSupport)
- {
- if ((samplerState.wrapS != GL_CLAMP_TO_EDGE && !isPow2(baseImageDesc.size.width)) ||
- (samplerState.wrapT != GL_CLAMP_TO_EDGE && !isPow2(baseImageDesc.size.height)))
- {
- return false;
- }
- }
-
- if (mTarget != GL_TEXTURE_2D_MULTISAMPLE && IsMipmapFiltered(samplerState))
- {
- if (!npotSupport)
- {
- if (!isPow2(baseImageDesc.size.width) || !isPow2(baseImageDesc.size.height))
- {
- return false;
- }
- }
-
- if (!computeMipmapCompleteness())
- {
- return false;
- }
- }
- else
- {
- if (mTarget == GL_TEXTURE_CUBE_MAP && !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 (mTarget == GL_TEXTURE_EXTERNAL_OES)
- {
- if (samplerState.wrapS != GL_CLAMP_TO_EDGE || samplerState.wrapT != GL_CLAMP_TO_EDGE)
- {
- return false;
- }
-
- if (samplerState.minFilter != GL_LINEAR && samplerState.minFilter != 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 (mTarget != GL_TEXTURE_2D_MULTISAMPLE && 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.compareMode == GL_NONE && baseImageDesc.format.info->sized)
- {
- if ((samplerState.minFilter != GL_NEAREST &&
- samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST) ||
- samplerState.magFilter != GL_NEAREST)
- {
- return false;
- }
- }
- }
-
- return true;
-}
-
-bool TextureState::computeMipmapCompleteness() const
-{
- const GLuint maxLevel = getMipmapMaxLevel();
-
- for (GLuint level = getEffectiveBaseLevel(); level <= maxLevel; level++)
- {
- if (mTarget == GL_TEXTURE_CUBE_MAP)
- {
- for (GLenum face = FirstCubeMapTextureTarget; face <= LastCubeMapTextureTarget; face++)
- {
- if (!computeLevelCompleteness(face, level))
- {
- return false;
- }
- }
- }
- else
- {
- if (!computeLevelCompleteness(mTarget, level))
- {
- return false;
- }
- }
- }
-
- return true;
-}
-
-bool TextureState::computeLevelCompleteness(GLenum 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 (mTarget == GL_TEXTURE_3D)
- {
- if (levelImageDesc.size.depth != std::max(1, baseImageDesc.size.depth >> relativeLevel))
- {
- return false;
- }
- }
- else if (mTarget == GL_TEXTURE_2D_ARRAY)
- {
- if (levelImageDesc.size.depth != baseImageDesc.size.depth)
- {
- return false;
- }
- }
-
- return true;
-}
-
-GLenum TextureState::getBaseImageTarget() const
-{
- return mTarget == GL_TEXTURE_CUBE_MAP ? FirstCubeMapTextureTarget : mTarget;
-}
-
-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)
-{
-}
-
-const ImageDesc &TextureState::getImageDesc(GLenum target, size_t level) const
-{
- size_t descIndex = GetImageDescIndex(target, level);
- ASSERT(descIndex < mImageDescs.size());
- return mImageDescs[descIndex];
-}
-
-void TextureState::setImageDesc(GLenum 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;
- }
-}
-
-const ImageDesc &TextureState::getImageDesc(const ImageIndex &imageIndex) const
-{
- return getImageDesc(imageIndex.type, imageIndex.mipIndex);
-}
-
-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),
- (mTarget == GL_TEXTURE_2D_ARRAY)
- ? baseSize.depth
- : std::max<int>(baseSize.depth >> relativeLevel, 1));
- ImageDesc levelInfo(levelSize, format, initState);
-
- if (mTarget == GL_TEXTURE_CUBE_MAP)
- {
- for (GLenum face = FirstCubeMapTextureTarget; face <= LastCubeMapTextureTarget; face++)
- {
- setImageDesc(face, level, levelInfo);
- }
- }
- else
- {
- setImageDesc(mTarget, level, levelInfo);
- }
- }
-}
-
-void TextureState::setImageDescChainMultisample(Extents baseSize,
- const Format &format,
- GLsizei samples,
- bool fixedSampleLocations,
- InitState initState)
-{
- ASSERT(mTarget == GL_TEXTURE_2D_MULTISAMPLE);
- ImageDesc levelInfo(baseSize, format, samples, fixedSampleLocations, initState);
- setImageDesc(mTarget, 0, levelInfo);
-}
-
-void TextureState::clearImageDesc(GLenum 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, GLenum target)
- : egl::ImageSibling(id),
- mState(target),
- mTexture(factory->createTexture(mState)),
- mLabel(),
- mBoundSurface(nullptr),
- mBoundStream(nullptr)
-{
-}
-
-Error Texture::onDestroy(const Context *context)
-{
- if (mBoundSurface)
- {
- ANGLE_TRY(mBoundSurface->releaseTexImage(context, EGL_BACK_BUFFER));
- mBoundSurface = nullptr;
- }
- if (mBoundStream)
- {
- mBoundStream->releaseTextures();
- mBoundStream = nullptr;
- }
-
- ANGLE_TRY(orphanImages(context));
-
- if (mTexture)
- {
- ANGLE_TRY(mTexture->onDestroy(context));
- }
- return NoError();
-}
-
-Texture::~Texture()
-{
- SafeDelete(mTexture);
-}
-
-void Texture::setLabel(const std::string &label)
-{
- mLabel = label;
- mDirtyBits.set(DIRTY_BIT_LABEL);
-}
-
-const std::string &Texture::getLabel() const
-{
- return mLabel;
-}
-
-GLenum Texture::getTarget() const
-{
- return mState.mTarget;
-}
-
-void Texture::setSwizzleRed(GLenum swizzleRed)
-{
- mState.mSwizzleState.swizzleRed = swizzleRed;
- mDirtyBits.set(DIRTY_BIT_SWIZZLE_RED);
-}
-
-GLenum Texture::getSwizzleRed() const
-{
- return mState.mSwizzleState.swizzleRed;
-}
-
-void Texture::setSwizzleGreen(GLenum swizzleGreen)
-{
- mState.mSwizzleState.swizzleGreen = swizzleGreen;
- mDirtyBits.set(DIRTY_BIT_SWIZZLE_GREEN);
-}
-
-GLenum Texture::getSwizzleGreen() const
-{
- return mState.mSwizzleState.swizzleGreen;
-}
-
-void Texture::setSwizzleBlue(GLenum swizzleBlue)
-{
- mState.mSwizzleState.swizzleBlue = swizzleBlue;
- mDirtyBits.set(DIRTY_BIT_SWIZZLE_BLUE);
-}
-
-GLenum Texture::getSwizzleBlue() const
-{
- return mState.mSwizzleState.swizzleBlue;
-}
-
-void Texture::setSwizzleAlpha(GLenum swizzleAlpha)
-{
- mState.mSwizzleState.swizzleAlpha = swizzleAlpha;
- mDirtyBits.set(DIRTY_BIT_SWIZZLE_ALPHA);
-}
-
-GLenum Texture::getSwizzleAlpha() const
-{
- return mState.mSwizzleState.swizzleAlpha;
-}
-
-void Texture::setMinFilter(GLenum minFilter)
-{
- mState.mSamplerState.minFilter = minFilter;
- mDirtyBits.set(DIRTY_BIT_MIN_FILTER);
-}
-
-GLenum Texture::getMinFilter() const
-{
- return mState.mSamplerState.minFilter;
-}
-
-void Texture::setMagFilter(GLenum magFilter)
-{
- mState.mSamplerState.magFilter = magFilter;
- mDirtyBits.set(DIRTY_BIT_MAG_FILTER);
-}
-
-GLenum Texture::getMagFilter() const
-{
- return mState.mSamplerState.magFilter;
-}
-
-void Texture::setWrapS(GLenum wrapS)
-{
- mState.mSamplerState.wrapS = wrapS;
- mDirtyBits.set(DIRTY_BIT_WRAP_S);
-}
-
-GLenum Texture::getWrapS() const
-{
- return mState.mSamplerState.wrapS;
-}
-
-void Texture::setWrapT(GLenum wrapT)
-{
- mState.mSamplerState.wrapT = wrapT;
- mDirtyBits.set(DIRTY_BIT_WRAP_T);
-}
-
-GLenum Texture::getWrapT() const
-{
- return mState.mSamplerState.wrapT;
-}
-
-void Texture::setWrapR(GLenum wrapR)
-{
- mState.mSamplerState.wrapR = wrapR;
- mDirtyBits.set(DIRTY_BIT_WRAP_R);
-}
-
-GLenum Texture::getWrapR() const
-{
- return mState.mSamplerState.wrapR;
-}
-
-void Texture::setMaxAnisotropy(float maxAnisotropy)
-{
- mState.mSamplerState.maxAnisotropy = maxAnisotropy;
- mDirtyBits.set(DIRTY_BIT_MAX_ANISOTROPY);
-}
-
-float Texture::getMaxAnisotropy() const
-{
- return mState.mSamplerState.maxAnisotropy;
-}
-
-void Texture::setMinLod(GLfloat minLod)
-{
- mState.mSamplerState.minLod = minLod;
- mDirtyBits.set(DIRTY_BIT_MIN_LOD);
-}
-
-GLfloat Texture::getMinLod() const
-{
- return mState.mSamplerState.minLod;
-}
-
-void Texture::setMaxLod(GLfloat maxLod)
-{
- mState.mSamplerState.maxLod = maxLod;
- mDirtyBits.set(DIRTY_BIT_MAX_LOD);
-}
-
-GLfloat Texture::getMaxLod() const
-{
- return mState.mSamplerState.maxLod;
-}
-
-void Texture::setCompareMode(GLenum compareMode)
-{
- mState.mSamplerState.compareMode = compareMode;
- mDirtyBits.set(DIRTY_BIT_COMPARE_MODE);
-}
-
-GLenum Texture::getCompareMode() const
-{
- return mState.mSamplerState.compareMode;
-}
-
-void Texture::setCompareFunc(GLenum compareFunc)
-{
- mState.mSamplerState.compareFunc = compareFunc;
- mDirtyBits.set(DIRTY_BIT_COMPARE_FUNC);
-}
-
-GLenum Texture::getCompareFunc() const
-{
- return mState.mSamplerState.compareFunc;
-}
-
-void Texture::setSRGBDecode(GLenum sRGBDecode)
-{
- mState.mSamplerState.sRGBDecode = sRGBDecode;
- mDirtyBits.set(DIRTY_BIT_SRGB_DECODE);
-}
-
-GLenum Texture::getSRGBDecode() const
-{
- return mState.mSamplerState.sRGBDecode;
-}
-
-const SamplerState &Texture::getSamplerState() const
-{
- return mState.mSamplerState;
-}
-
-Error Texture::setBaseLevel(const Context *context, GLuint baseLevel)
-{
- if (mState.setBaseLevel(baseLevel))
- {
- ANGLE_TRY(mTexture->setBaseLevel(context, mState.getEffectiveBaseLevel()));
- mDirtyBits.set(DIRTY_BIT_BASE_LEVEL);
- invalidateCompletenessCache();
- }
-
- return NoError();
-}
-
-GLuint Texture::getBaseLevel() const
-{
- return mState.mBaseLevel;
-}
-
-void Texture::setMaxLevel(GLuint maxLevel)
-{
- if (mState.setMaxLevel(maxLevel))
- {
- mDirtyBits.set(DIRTY_BIT_MAX_LEVEL);
- invalidateCompletenessCache();
- }
-}
-
-GLuint Texture::getMaxLevel() const
-{
- return mState.mMaxLevel;
-}
-
-void Texture::setDepthStencilTextureMode(GLenum mode)
-{
- if (mode != mState.mDepthStencilTextureMode)
- {
- // Changing the mode from the default state (GL_DEPTH_COMPONENT) is not implemented yet
- UNIMPLEMENTED();
- }
-
- // TODO(geofflang): add dirty bits
- mState.mDepthStencilTextureMode = 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(GLenum usage)
-{
- mState.mUsage = usage;
- mDirtyBits.set(DIRTY_BIT_USAGE);
-}
-
-GLenum Texture::getUsage() const
-{
- return mState.mUsage;
-}
-
-const TextureState &Texture::getTextureState() const
-{
- return mState;
-}
-
-size_t Texture::getWidth(GLenum target, size_t level) const
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
- return mState.getImageDesc(target, level).size.width;
-}
-
-size_t Texture::getHeight(GLenum target, size_t level) const
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
- return mState.getImageDesc(target, level).size.height;
-}
-
-size_t Texture::getDepth(GLenum target, size_t level) const
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
- return mState.getImageDesc(target, level).size.depth;
-}
-
-const Format &Texture::getFormat(GLenum target, size_t level) const
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
- return mState.getImageDesc(target, level).format;
-}
-
-GLsizei Texture::getSamples(GLenum target, size_t level) const
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
- return mState.getImageDesc(target, level).samples;
-}
-
-bool Texture::getFixedSampleLocations(GLenum target, size_t level) const
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
- 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;
-}
-
-void Texture::signalDirty(InitState initState) const
-{
- mDirtyChannel.signal(initState);
- invalidateCompletenessCache();
-}
-
-Error Texture::setImage(const Context *context,
- const PixelUnpackState &unpackState,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const Extents &size,
- GLenum format,
- GLenum type,
- const uint8_t *pixels)
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
-
- // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
- ANGLE_TRY(releaseTexImageInternal(context));
- ANGLE_TRY(orphanImages(context));
-
- ANGLE_TRY(mTexture->setImage(context, target, level, internalFormat, size, format, type,
- unpackState, pixels));
-
- InitState initState = DetermineInitState(context, pixels);
- mState.setImageDesc(target, level, ImageDesc(size, Format(internalFormat, type), initState));
- signalDirty(initState);
-
- return NoError();
-}
-
-Error Texture::setSubImage(const Context *context,
- const PixelUnpackState &unpackState,
- GLenum target,
- size_t level,
- const Box &area,
- GLenum format,
- GLenum type,
- const uint8_t *pixels)
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
-
- ANGLE_TRY(ensureSubImageInitialized(context, target, level, area));
-
- return mTexture->setSubImage(context, target, level, area, format, type, unpackState, pixels);
-}
-
-Error Texture::setCompressedImage(const Context *context,
- const PixelUnpackState &unpackState,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const Extents &size,
- size_t imageSize,
- const uint8_t *pixels)
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
-
- // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
- ANGLE_TRY(releaseTexImageInternal(context));
- ANGLE_TRY(orphanImages(context));
-
- ANGLE_TRY(mTexture->setCompressedImage(context, target, level, internalFormat, size,
- unpackState, imageSize, pixels));
-
- InitState initState = DetermineInitState(context, pixels);
- mState.setImageDesc(target, level, ImageDesc(size, Format(internalFormat), initState));
- signalDirty(initState);
-
- return NoError();
-}
-
-Error Texture::setCompressedSubImage(const Context *context,
- const PixelUnpackState &unpackState,
- GLenum target,
- size_t level,
- const Box &area,
- GLenum format,
- size_t imageSize,
- const uint8_t *pixels)
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
-
- ANGLE_TRY(ensureSubImageInitialized(context, target, level, area));
-
- return mTexture->setCompressedSubImage(context, target, level, area, format, unpackState,
- imageSize, pixels);
-}
-
-Error Texture::copyImage(const Context *context,
- GLenum target,
- size_t level,
- const Rectangle &sourceArea,
- GLenum internalFormat,
- Framebuffer *source)
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
-
- // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
- ANGLE_TRY(releaseTexImageInternal(context));
- ANGLE_TRY(orphanImages(context));
-
- // Ensure source FBO is initialized.
- ANGLE_TRY(source->ensureReadAttachmentInitialized(context, GL_COLOR_BUFFER_BIT));
-
- // 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));
-
- ANGLE_TRY(mTexture->copyImage(context, target, level, 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));
-
- // We need to initialize this texture only if the source attachment is not initialized.
- signalDirty(InitState::Initialized);
-
- return NoError();
-}
-
-Error Texture::copySubImage(const Context *context,
- GLenum target,
- size_t level,
- const Offset &destOffset,
- const Rectangle &sourceArea,
- Framebuffer *source)
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
-
- // Ensure source FBO is initialized.
- ANGLE_TRY(source->ensureReadAttachmentInitialized(context, GL_COLOR_BUFFER_BIT));
-
- Box destBox(destOffset.x, destOffset.y, destOffset.y, sourceArea.width, sourceArea.height, 1);
- ANGLE_TRY(ensureSubImageInitialized(context, target, level, destBox));
-
- return mTexture->copySubImage(context, target, level, destOffset, sourceArea, source);
-}
-
-Error Texture::copyTexture(const Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- GLenum type,
- size_t sourceLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- Texture *source)
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
-
- // 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));
-
- ANGLE_TRY(mTexture->copyTexture(context, target, level, internalFormat, type, sourceLevel,
- unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha,
- source));
-
- const auto &sourceDesc = source->mState.getImageDesc(source->getTarget(), 0);
- const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat, type);
- mState.setImageDesc(
- target, level,
- ImageDesc(sourceDesc.size, Format(internalFormatInfo), InitState::Initialized));
-
- signalDirty(InitState::Initialized);
-
- return NoError();
-}
-
-Error Texture::copySubTexture(const Context *context,
- GLenum target,
- size_t level,
- const Offset &destOffset,
- size_t sourceLevel,
- const Rectangle &sourceArea,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- Texture *source)
-{
- ASSERT(target == mState.mTarget ||
- (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
-
- // Ensure source is initialized.
- ANGLE_TRY(source->ensureInitialized(context));
-
- Box destBox(destOffset.x, destOffset.y, destOffset.y, sourceArea.width, sourceArea.height, 1);
- ANGLE_TRY(ensureSubImageInitialized(context, target, level, destBox));
-
- return mTexture->copySubTexture(context, target, level, destOffset, sourceLevel, sourceArea,
- unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha,
- source);
-}
-
-Error Texture::copyCompressedTexture(const 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->getTarget() != GL_TEXTURE_CUBE_MAP && getTarget() != GL_TEXTURE_CUBE_MAP);
- const auto &sourceDesc = source->mState.getImageDesc(source->getTarget(), 0);
- mState.setImageDesc(getTarget(), 0, sourceDesc);
-
- return NoError();
-}
-
-Error Texture::setStorage(const Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalFormat,
- const Extents &size)
-{
- ASSERT(target == mState.mTarget);
-
- // 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, target, 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);
-
- signalDirty(InitState::MayNeedInit);
-
- return NoError();
-}
-
-Error Texture::setStorageMultisample(const Context *context,
- GLenum target,
- GLsizei samples,
- GLint internalFormat,
- const Extents &size,
- bool fixedSampleLocations)
-{
- ASSERT(target == mState.mTarget);
-
- // 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, target, samples, internalFormat, size,
- fixedSampleLocations));
-
- mState.mImmutableFormat = true;
- mState.mImmutableLevels = static_cast<GLuint>(1);
- mState.clearImageDescs();
- mState.setImageDescChainMultisample(size, Format(internalFormat), samples, fixedSampleLocations,
- InitState::MayNeedInit);
-
- signalDirty(InitState::MayNeedInit);
-
- return NoError();
-}
-
-Error Texture::generateMipmap(const 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)
- {
- syncState();
- const ImageDesc &baseImageInfo =
- mState.getImageDesc(mState.getBaseImageTarget(), baseLevel);
-
- // Clear the base image immediately if necessary.
- if (context->isRobustResourceInitEnabled() &&
- baseImageInfo.initState == InitState::MayNeedInit)
- {
- ANGLE_TRY(initializeContents(
- context, GetImageIndexFromDescIndex(mState.getBaseImageTarget(), baseLevel)));
- }
-
- ANGLE_TRY(mTexture->generateMipmap(context));
-
- mState.setImageDescChain(baseLevel, maxLevel, baseImageInfo.size, baseImageInfo.format,
- InitState::Initialized);
- }
-
- signalDirty(InitState::Initialized);
-
- return NoError();
-}
-
-Error Texture::bindTexImageFromSurface(const 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.mTarget == GL_TEXTURE_2D || mState.mTarget == GL_TEXTURE_RECTANGLE_ANGLE);
- Extents size(surface->getWidth(), surface->getHeight(), 1);
- ImageDesc desc(size, Format(surface->getConfig()->renderTargetFormat), InitState::Initialized);
- mState.setImageDesc(mState.mTarget, 0, desc);
- signalDirty(InitState::Initialized);
- return NoError();
-}
-
-Error Texture::releaseTexImageFromSurface(const Context *context)
-{
- ASSERT(mBoundSurface);
- mBoundSurface = nullptr;
- ANGLE_TRY(mTexture->releaseTexImage(context));
-
- // Erase the image info for level 0
- ASSERT(mState.mTarget == GL_TEXTURE_2D || mState.mTarget == GL_TEXTURE_RECTANGLE_ANGLE);
- mState.clearImageDesc(mState.mTarget, 0);
- signalDirty(InitState::Initialized);
- return NoError();
-}
-
-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.mTarget == GL_TEXTURE_EXTERNAL_OES);
-}
-
-void Texture::releaseStream()
-{
- ASSERT(mBoundStream);
- mBoundStream = nullptr;
-}
-
-Error Texture::acquireImageFromStream(const Context *context,
- const egl::Stream::GLTextureDescription &desc)
-{
- ASSERT(mBoundStream != nullptr);
- ANGLE_TRY(mTexture->setImageExternal(context, mState.mTarget, mBoundStream, desc));
-
- Extents size(desc.width, desc.height, 1);
- mState.setImageDesc(mState.mTarget, 0,
- ImageDesc(size, Format(desc.internalFormat), InitState::Initialized));
- signalDirty(InitState::Initialized);
- return NoError();
-}
-
-Error Texture::releaseImageFromStream(const Context *context)
-{
- ASSERT(mBoundStream != nullptr);
- ANGLE_TRY(mTexture->setImageExternal(context, mState.mTarget, nullptr,
- egl::Stream::GLTextureDescription()));
-
- // Set to incomplete
- mState.clearImageDesc(mState.mTarget, 0);
- signalDirty(InitState::Initialized);
- return NoError();
-}
-
-Error Texture::releaseTexImageInternal(const Context *context)
-{
- if (mBoundSurface)
- {
- // Notify the surface
- mBoundSurface->releaseTexImageFromTexture(context);
-
- // Then, call the same method as from the surface
- ANGLE_TRY(releaseTexImageFromSurface(context));
- }
- return NoError();
-}
-
-Error Texture::setEGLImageTarget(const Context *context, GLenum target, egl::Image *imageTarget)
-{
- ASSERT(target == mState.mTarget);
- ASSERT(target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES);
-
- // 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, target, 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(target, 0, ImageDesc(size, imageTarget->getFormat(), initState));
- signalDirty(initState);
-
- return NoError();
-}
-
-Extents Texture::getAttachmentSize(const ImageIndex &imageIndex) const
-{
- return mState.getImageDesc(imageIndex).size;
-}
-
-const Format &Texture::getAttachmentFormat(GLenum /*binding*/, const ImageIndex &imageIndex) const
-{
- return mState.getImageDesc(imageIndex).format;
-}
-
-GLsizei Texture::getAttachmentSamples(const ImageIndex &imageIndex) const
-{
- return getSamples(imageIndex.type, 0);
-}
-
-void Texture::onAttach(const Context *context)
-{
- addRef();
-}
-
-void Texture::onDetach(const Context *context)
-{
- release(context);
-}
-
-GLuint Texture::getId() const
-{
- return id();
-}
-
-void Texture::syncState()
-{
- mTexture->syncState(mDirtyBits);
- mDirtyBits.reset();
-}
-
-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->getContextState();
-
- if (contextState.getContextID() != mCompletenessCache.context ||
- mCompletenessCache.samplerState != samplerState)
- {
- mCompletenessCache.context = context->getContextState().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;
-}
-
-Error Texture::ensureInitialized(const Context *context)
-{
- if (!context->isRobustResourceInitEnabled() || mState.mInitState == InitState::Initialized)
- {
- return NoError();
- }
-
- bool anyDirty = false;
-
- for (size_t descIndex = 0; descIndex < mState.mImageDescs.size(); ++descIndex)
- {
- auto &imageDesc = mState.mImageDescs[descIndex];
- if (imageDesc.initState == InitState::MayNeedInit)
- {
- ASSERT(mState.mInitState == InitState::MayNeedInit);
- const auto &imageIndex = GetImageIndexFromDescIndex(mState.mTarget, descIndex);
- ANGLE_TRY(initializeContents(context, imageIndex));
- imageDesc.initState = InitState::Initialized;
- anyDirty = true;
- }
- }
- if (anyDirty)
- {
- signalDirty(InitState::Initialized);
- }
- mState.mInitState = InitState::Initialized;
-
- return NoError();
-}
-
-InitState Texture::initState(const ImageIndex &imageIndex) const
-{
- return mState.getImageDesc(imageIndex).initState;
-}
-
-InitState Texture::initState() const
-{
- return mState.mInitState;
-}
-
-void Texture::setInitState(const ImageIndex &imageIndex, InitState initState)
-{
- ImageDesc newDesc = mState.getImageDesc(imageIndex);
- newDesc.initState = initState;
- mState.setImageDesc(imageIndex.type, imageIndex.mipIndex, newDesc);
-}
-
-Error Texture::ensureSubImageInitialized(const Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area)
-{
- if (!context->isRobustResourceInitEnabled() || mState.mInitState == InitState::Initialized)
- {
- return NoError();
- }
-
- // Pre-initialize the texture contents if necessary.
- // TODO(jmadill): Check if area overlaps the entire texture.
- const auto &imageIndex = GetImageIndexFromDescIndex(target, level);
- 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 NoError();
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Texture.h b/src/3rdparty/angle/src/libANGLE/Texture.h
deleted file mode 100644
index 7525da2b2f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Texture.h
+++ /dev/null
@@ -1,471 +0,0 @@
-//
-// 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 <vector>
-#include <map>
-
-#include "angle_gl.h"
-#include "common/Optional.h"
-#include "common/debug.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/Stream.h"
-#include "libANGLE/angletypes.h"
-#include "libANGLE/formatutils.h"
-
-namespace egl
-{
-class Surface;
-class Stream;
-}
-
-namespace rx
-{
-class GLImplFactory;
-class TextureImpl;
-class TextureGL;
-}
-
-namespace gl
-{
-class ContextState;
-class Framebuffer;
-class Sampler;
-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;
-
- 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.
-struct TextureState final : private angle::NonCopyable
-{
- TextureState(GLenum target);
- ~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;
-
- const ImageDesc &getImageDesc(GLenum target, size_t level) const;
- const ImageDesc &getImageDesc(const ImageIndex &imageIndex) const;
-
- GLenum getTarget() const { return mTarget; }
- const SwizzleState &getSwizzleState() const { return mSwizzleState; }
- const SamplerState &getSamplerState() const { return mSamplerState; }
- GLenum getUsage() const { return mUsage; }
-
- 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 ContextState &data) const;
- bool computeMipmapCompleteness() const;
- bool computeLevelCompleteness(GLenum target, size_t level) const;
-
- GLenum getBaseImageTarget() const;
-
- void setImageDesc(GLenum 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(GLenum target, size_t level);
- void clearImageDescs();
-
- const GLenum mTarget;
-
- 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;
- InitState mInitState;
-};
-
-bool operator==(const TextureState &a, const TextureState &b);
-bool operator!=(const TextureState &a, const TextureState &b);
-
-class Texture final : public egl::ImageSibling,
- public LabeledObject
-{
- public:
- Texture(rx::GLImplFactory *factory, GLuint id, GLenum target);
- ~Texture() override;
-
- Error onDestroy(const Context *context) override;
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- GLenum getTarget() const;
-
- void setSwizzleRed(GLenum swizzleRed);
- GLenum getSwizzleRed() const;
-
- void setSwizzleGreen(GLenum swizzleGreen);
- GLenum getSwizzleGreen() const;
-
- void setSwizzleBlue(GLenum swizzleBlue);
- GLenum getSwizzleBlue() const;
-
- void setSwizzleAlpha(GLenum swizzleAlpha);
- GLenum getSwizzleAlpha() const;
-
- void setMinFilter(GLenum minFilter);
- GLenum getMinFilter() const;
-
- void setMagFilter(GLenum magFilter);
- GLenum getMagFilter() const;
-
- void setWrapS(GLenum wrapS);
- GLenum getWrapS() const;
-
- void setWrapT(GLenum wrapT);
- GLenum getWrapT() const;
-
- void setWrapR(GLenum wrapR);
- GLenum getWrapR() const;
-
- void setMaxAnisotropy(float maxAnisotropy);
- float getMaxAnisotropy() const;
-
- void setMinLod(GLfloat minLod);
- GLfloat getMinLod() const;
-
- void setMaxLod(GLfloat maxLod);
- GLfloat getMaxLod() const;
-
- void setCompareMode(GLenum compareMode);
- GLenum getCompareMode() const;
-
- void setCompareFunc(GLenum compareFunc);
- GLenum getCompareFunc() const;
-
- void setSRGBDecode(GLenum sRGBDecode);
- GLenum getSRGBDecode() const;
-
- const SamplerState &getSamplerState() const;
-
- gl::Error setBaseLevel(const Context *context, GLuint baseLevel);
- GLuint getBaseLevel() const;
-
- void setMaxLevel(GLuint maxLevel);
- GLuint getMaxLevel() const;
-
- void setDepthStencilTextureMode(GLenum mode);
- GLenum getDepthStencilTextureMode() const;
-
- bool getImmutableFormat() const;
-
- GLuint getImmutableLevels() const;
-
- void setUsage(GLenum usage);
- GLenum getUsage() const;
-
- const TextureState &getTextureState() const;
-
- size_t getWidth(GLenum target, size_t level) const;
- size_t getHeight(GLenum target, size_t level) const;
- size_t getDepth(GLenum target, size_t level) const;
- GLsizei getSamples(GLenum target, size_t level) const;
- bool getFixedSampleLocations(GLenum target, size_t level) const;
- const Format &getFormat(GLenum 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;
-
- Error setImage(const Context *context,
- const PixelUnpackState &unpackState,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const Extents &size,
- GLenum format,
- GLenum type,
- const uint8_t *pixels);
- Error setSubImage(const Context *context,
- const PixelUnpackState &unpackState,
- GLenum target,
- size_t level,
- const Box &area,
- GLenum format,
- GLenum type,
- const uint8_t *pixels);
-
- Error setCompressedImage(const Context *context,
- const PixelUnpackState &unpackState,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const Extents &size,
- size_t imageSize,
- const uint8_t *pixels);
- Error setCompressedSubImage(const Context *context,
- const PixelUnpackState &unpackState,
- GLenum target,
- size_t level,
- const Box &area,
- GLenum format,
- size_t imageSize,
- const uint8_t *pixels);
-
- Error copyImage(const Context *context,
- GLenum target,
- size_t level,
- const Rectangle &sourceArea,
- GLenum internalFormat,
- Framebuffer *source);
- Error copySubImage(const Context *context,
- GLenum target,
- size_t level,
- const Offset &destOffset,
- const Rectangle &sourceArea,
- Framebuffer *source);
-
- Error copyTexture(const Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- GLenum type,
- size_t sourceLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- Texture *source);
- Error copySubTexture(const Context *context,
- GLenum target,
- size_t level,
- const Offset &destOffset,
- size_t sourceLevel,
- const Rectangle &sourceArea,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- Texture *source);
- Error copyCompressedTexture(const Context *context, const Texture *source);
-
- Error setStorage(const Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalFormat,
- const Extents &size);
-
- Error setStorageMultisample(const Context *context,
- GLenum target,
- GLsizei samples,
- GLint internalformat,
- const Extents &size,
- bool fixedSampleLocations);
-
- Error setEGLImageTarget(const Context *context, GLenum target, egl::Image *imageTarget);
-
- Error generateMipmap(const Context *context);
-
- egl::Surface *getBoundSurface() const;
- egl::Stream *getBoundStream() const;
-
- void signalDirty(InitState initState) const;
-
- bool isSamplerComplete(const Context *context, const Sampler *optionalSampler);
-
- rx::TextureImpl *getImplementation() const { return mTexture; }
-
- // FramebufferAttachmentObject implementation
- Extents getAttachmentSize(const ImageIndex &imageIndex) const override;
- const Format &getAttachmentFormat(GLenum binding, const ImageIndex &imageIndex) const override;
- GLsizei getAttachmentSamples(const ImageIndex &imageIndex) const override;
-
- void onAttach(const Context *context) override;
- void onDetach(const Context *context) override;
- GLuint getId() const override;
-
- // Needed for robust resource init.
- Error ensureInitialized(const Context *context);
- InitState initState(const ImageIndex &imageIndex) const override;
- InitState initState() const;
- 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,
-
- // 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,
-
- // Misc
- DIRTY_BIT_LABEL,
- DIRTY_BIT_USAGE,
-
- DIRTY_BIT_COUNT,
- };
- using DirtyBits = angle::BitSet<DIRTY_BIT_COUNT>;
-
- void syncState();
- bool hasAnyDirtyBit() const { return mDirtyBits.any(); }
-
- private:
- rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override;
-
- // ANGLE-only method, used internally
- friend class egl::Surface;
- Error bindTexImageFromSurface(const Context *context, egl::Surface *surface);
- Error releaseTexImageFromSurface(const Context *context);
-
- // ANGLE-only methods, used internally
- friend class egl::Stream;
- void bindStream(egl::Stream *stream);
- void releaseStream();
- Error acquireImageFromStream(const Context *context,
- const egl::Stream::GLTextureDescription &desc);
- Error releaseImageFromStream(const Context *context);
-
- void invalidateCompletenessCache() const;
- Error releaseTexImageInternal(const Context *context);
-
- Error ensureSubImageInitialized(const Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area);
-
- TextureState mState;
- DirtyBits mDirtyBits;
- rx::TextureImpl *mTexture;
-
- 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/src/3rdparty/angle/src/libANGLE/Thread.cpp b/src/3rdparty/angle/src/libANGLE/Thread.cpp
deleted file mode 100644
index d346db1fa2..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Thread.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// 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/Error.h"
-
-namespace egl
-{
-Thread::Thread()
- : mError(EGL_SUCCESS),
- mAPI(EGL_OPENGL_ES_API),
- mContext(static_cast<gl::Context *>(EGL_NO_CONTEXT))
-{
-}
-
-void Thread::setError(const Error &error)
-{
- mError = error.getCode();
-}
-
-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::OutOfMemory() << "Context has been lost.");
- return nullptr;
- }
-
- return mContext;
-}
-
-Display *Thread::getCurrentDisplay() const
-{
- if (mContext)
- {
- return mContext->getCurrentDisplay();
- }
- return nullptr;
-}
-
-} // namespace egl
diff --git a/src/3rdparty/angle/src/libANGLE/Thread.h b/src/3rdparty/angle/src/libANGLE/Thread.h
deleted file mode 100644
index 6406dad9e0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Thread.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// 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>
-
-namespace gl
-{
-class Context;
-} // namespace gl
-
-namespace egl
-{
-class Error;
-class Display;
-class Surface;
-
-class Thread
-{
- public:
- Thread();
-
- void setError(const Error &error);
- 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 *getCurrentDisplay() const;
-
- private:
- EGLint mError;
- EGLenum mAPI;
- gl::Context *mContext;
-};
-
-} // namespace egl
-
-#endif // LIBANGLE_THREAD_H_
diff --git a/src/3rdparty/angle/src/libANGLE/TransformFeedback.cpp b/src/3rdparty/angle/src/libANGLE/TransformFeedback.cpp
deleted file mode 100644
index 99235debd4..0000000000
--- a/src/3rdparty/angle/src/libANGLE/TransformFeedback.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-//
-// 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 "libANGLE/Buffer.h"
-#include "libANGLE/Caps.h"
-#include "libANGLE/ContextState.h"
-#include "libANGLE/Program.h"
-#include "libANGLE/renderer/GLImplFactory.h"
-#include "libANGLE/renderer/TransformFeedbackImpl.h"
-
-namespace gl
-{
-
-TransformFeedbackState::TransformFeedbackState(size_t maxIndexedBuffers)
- : mLabel(),
- mActive(false),
- mPrimitiveMode(GL_NONE),
- mPaused(false),
- mProgram(nullptr),
- mGenericBuffer(),
- mIndexedBuffers(maxIndexedBuffers)
-{
-}
-
-TransformFeedbackState::~TransformFeedbackState()
-{
-}
-
-const BindingPointer<Buffer> &TransformFeedbackState::getGenericBuffer() const
-{
- return mGenericBuffer;
-}
-
-const OffsetBindingPointer<Buffer> &TransformFeedbackState::getIndexedBuffer(size_t idx) const
-{
- return mIndexedBuffers[idx];
-}
-
-const std::vector<OffsetBindingPointer<Buffer>> &TransformFeedbackState::getIndexedBuffers() const
-{
- return mIndexedBuffers;
-}
-
-TransformFeedback::TransformFeedback(rx::GLImplFactory *implFactory, GLuint id, const Caps &caps)
- : RefCountObject(id),
- mState(caps.maxTransformFeedbackSeparateAttributes),
- mImplementation(implFactory->createTransformFeedback(mState))
-{
- ASSERT(mImplementation != nullptr);
-}
-
-Error TransformFeedback::onDestroy(const Context *context)
-{
- if (mState.mProgram)
- {
- mState.mProgram->release(context);
- mState.mProgram = nullptr;
- }
-
- ASSERT(!mState.mProgram);
- mState.mGenericBuffer.set(context, nullptr);
- for (size_t i = 0; i < mState.mIndexedBuffers.size(); i++)
- {
- mState.mIndexedBuffers[i].set(context, nullptr);
- }
-
- return NoError();
-}
-
-TransformFeedback::~TransformFeedback()
-{
- SafeDelete(mImplementation);
-}
-
-void TransformFeedback::setLabel(const std::string &label)
-{
- mState.mLabel = label;
-}
-
-const std::string &TransformFeedback::getLabel() const
-{
- return mState.mLabel;
-}
-
-void TransformFeedback::begin(const Context *context, GLenum primitiveMode, Program *program)
-{
- mState.mActive = true;
- mState.mPrimitiveMode = primitiveMode;
- mState.mPaused = false;
- mImplementation->begin(primitiveMode);
- bindProgram(context, program);
-}
-
-void TransformFeedback::end(const Context *context)
-{
- mState.mActive = false;
- mState.mPrimitiveMode = GL_NONE;
- mState.mPaused = false;
- mImplementation->end();
- if (mState.mProgram)
- {
- mState.mProgram->release(context);
- mState.mProgram = nullptr;
- }
-}
-
-void TransformFeedback::pause()
-{
- mState.mPaused = true;
- mImplementation->pause();
-}
-
-void TransformFeedback::resume()
-{
- mState.mPaused = false;
- mImplementation->resume();
-}
-
-bool TransformFeedback::isActive() const
-{
- return mState.mActive;
-}
-
-bool TransformFeedback::isPaused() const
-{
- return mState.mPaused;
-}
-
-GLenum TransformFeedback::getPrimitiveMode() const
-{
- return mState.mPrimitiveMode;
-}
-
-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;
-}
-
-void TransformFeedback::bindGenericBuffer(const Context *context, Buffer *buffer)
-{
- mState.mGenericBuffer.set(context, buffer);
- mImplementation->bindGenericBuffer(mState.mGenericBuffer);
-}
-
-void TransformFeedback::detachBuffer(const Context *context, GLuint bufferName)
-{
- for (size_t index = 0; index < mState.mIndexedBuffers.size(); index++)
- {
- if (mState.mIndexedBuffers[index].id() == bufferName)
- {
- mState.mIndexedBuffers[index].set(context, nullptr);
- mImplementation->bindIndexedBuffer(index, mState.mIndexedBuffers[index]);
- }
- }
-
- if (mState.mGenericBuffer.id() == bufferName)
- {
- mState.mGenericBuffer.set(context, nullptr);
- mImplementation->bindGenericBuffer(mState.mGenericBuffer);
- }
-}
-
-const BindingPointer<Buffer> &TransformFeedback::getGenericBuffer() const
-{
- return mState.mGenericBuffer;
-}
-
-void TransformFeedback::bindIndexedBuffer(const Context *context,
- size_t index,
- Buffer *buffer,
- size_t offset,
- size_t size)
-{
- ASSERT(index < mState.mIndexedBuffers.size());
- mState.mIndexedBuffers[index].set(context, buffer, offset, size);
- mImplementation->bindIndexedBuffer(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();
-}
-
-rx::TransformFeedbackImpl *TransformFeedback::getImplementation()
-{
- return mImplementation;
-}
-
-const rx::TransformFeedbackImpl *TransformFeedback::getImplementation() const
-{
- return mImplementation;
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/TransformFeedback.h b/src/3rdparty/angle/src/libANGLE/TransformFeedback.h
deleted file mode 100644
index 2b35d43f9a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/TransformFeedback.h
+++ /dev/null
@@ -1,101 +0,0 @@
-//
-// 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/angleutils.h"
-#include "libANGLE/Debug.h"
-
-#include "angle_gl.h"
-
-namespace rx
-{
-class GLImplFactory;
-class TransformFeedbackImpl;
-}
-
-namespace gl
-{
-class Buffer;
-struct Caps;
-class Context;
-class Program;
-
-class TransformFeedbackState final : angle::NonCopyable
-{
- public:
- TransformFeedbackState(size_t maxIndexedBuffers);
- ~TransformFeedbackState();
-
- const BindingPointer<Buffer> &getGenericBuffer() const;
- const OffsetBindingPointer<Buffer> &getIndexedBuffer(size_t idx) const;
- const std::vector<OffsetBindingPointer<Buffer>> &getIndexedBuffers() const;
-
- private:
- friend class TransformFeedback;
-
- std::string mLabel;
-
- bool mActive;
- GLenum mPrimitiveMode;
- bool mPaused;
-
- Program *mProgram;
-
- BindingPointer<Buffer> mGenericBuffer;
- std::vector<OffsetBindingPointer<Buffer>> mIndexedBuffers;
-};
-
-class TransformFeedback final : public RefCountObject, public LabeledObject
-{
- public:
- TransformFeedback(rx::GLImplFactory *implFactory, GLuint id, const Caps &caps);
- ~TransformFeedback() override;
- Error onDestroy(const Context *context) override;
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- void begin(const Context *context, GLenum primitiveMode, Program *program);
- void end(const Context *context);
- void pause();
- void resume();
-
- bool isActive() const;
- bool isPaused() const;
- GLenum getPrimitiveMode() const;
-
- bool hasBoundProgram(GLuint program) const;
-
- void bindGenericBuffer(const Context *context, Buffer *buffer);
- const BindingPointer<Buffer> &getGenericBuffer() const;
-
- void 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;
-
- void detachBuffer(const Context *context, GLuint bufferName);
-
- rx::TransformFeedbackImpl *getImplementation();
- const rx::TransformFeedbackImpl *getImplementation() const;
-
- private:
- void bindProgram(const Context *context, Program *program);
-
- TransformFeedbackState mState;
- rx::TransformFeedbackImpl* mImplementation;
-};
-
-}
-
-#endif // LIBANGLE_TRANSFORM_FEEDBACK_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Uniform.cpp b/src/3rdparty/angle/src/libANGLE/Uniform.cpp
deleted file mode 100644
index dee8eee915..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Uniform.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-//
-// 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
-{
-
-StaticallyUsed::StaticallyUsed()
- : vertexStaticUse(false), fragmentStaticUse(false), computeStaticUse(false)
-{
-}
-
-StaticallyUsed::~StaticallyUsed()
-{
-}
-
-StaticallyUsed::StaticallyUsed(const StaticallyUsed &rhs) = default;
-StaticallyUsed &StaticallyUsed::operator=(const StaticallyUsed &rhs) = default;
-
-void StaticallyUsed::setStaticUse(GLenum shaderType, bool used)
-{
- switch (shaderType)
- {
- case GL_VERTEX_SHADER:
- vertexStaticUse = used;
- break;
-
- case GL_FRAGMENT_SHADER:
- fragmentStaticUse = used;
- break;
-
- case GL_COMPUTE_SHADER:
- computeStaticUse = used;
- break;
-
- default:
- UNREACHABLE();
- }
-}
-
-void StaticallyUsed::unionReferencesWith(const StaticallyUsed &other)
-{
- vertexStaticUse |= other.vertexStaticUse;
- fragmentStaticUse |= other.fragmentStaticUse;
- computeStaticUse |= other.computeStaticUse;
-}
-
-LinkedUniform::LinkedUniform()
- : typeInfo(nullptr), bufferIndex(-1), blockInfo(sh::BlockMemberInfo::getDefaultBlockInfo())
-{
-}
-
-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::BlockMemberInfo::getDefaultBlockInfo())
-{
- ASSERT(!isArrayOfArrays());
- ASSERT(!isArray() || !isStruct());
-}
-
-LinkedUniform::LinkedUniform(const LinkedUniform &uniform)
- : sh::Uniform(uniform),
- StaticallyUsed(uniform),
- typeInfo(uniform.typeInfo),
- bufferIndex(uniform.bufferIndex),
- blockInfo(uniform.blockInfo)
-{
-}
-
-LinkedUniform &LinkedUniform::operator=(const LinkedUniform &uniform)
-{
- sh::Uniform::operator=(uniform);
- StaticallyUsed::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::BlockMemberInfo::getDefaultBlockInfo()), 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();
-}
-}
diff --git a/src/3rdparty/angle/src/libANGLE/Uniform.h b/src/3rdparty/angle/src/libANGLE/Uniform.h
deleted file mode 100644
index 14c39387a6..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Uniform.h
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-// 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/debug.h"
-#include "common/MemoryBuffer.h"
-#include "compiler/translator/blocklayout.h"
-#include "libANGLE/angletypes.h"
-
-namespace gl
-{
-struct UniformTypeInfo;
-
-struct StaticallyUsed
-{
- StaticallyUsed();
- StaticallyUsed(const StaticallyUsed &rhs);
- virtual ~StaticallyUsed();
-
- StaticallyUsed &operator=(const StaticallyUsed &rhs);
-
- void setStaticUse(GLenum shaderType, bool used);
- void unionReferencesWith(const StaticallyUsed &other);
-
- bool vertexStaticUse;
- bool fragmentStaticUse;
- bool computeStaticUse;
-};
-
-// Helper struct representing a single shader uniform
-struct LinkedUniform : public sh::Uniform, public StaticallyUsed
-{
- 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 StaticallyUsed
-{
- 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 StaticallyUsed
-{
- 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;
-};
-
-}
-
-#endif // LIBANGLE_UNIFORM_H_
diff --git a/src/3rdparty/angle/src/libANGLE/VaryingPacking.cpp b/src/3rdparty/angle/src/libANGLE/VaryingPacking.cpp
deleted file mode 100644
index 6fc707b549..0000000000
--- a/src/3rdparty/angle/src/libANGLE/VaryingPacking.cpp
+++ /dev/null
@@ -1,408 +0,0 @@
-//
-// 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 auto &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);
-
- // "Variables of type mat2 occupies 2 complete rows."
- // For non-WebGL contexts, we allow mat2 to occupy only two columns per row.
- 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 Program::MergedVaryings &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.
- if (((input && output) || (output && output->isBuiltIn())) && output->staticUse)
- {
- // 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 (output->isStruct())
- {
- ASSERT(!output->isArray());
- for (const auto &field : output->fields)
- {
- ASSERT(!field.isStruct() && !field.isArray());
- mPackedVaryings.push_back(PackedVarying(field, interpolation, output->name));
- uniqueFullNames.insert(mPackedVaryings.back().nameWithArrayIndex());
- }
- }
- else
- {
- mPackedVaryings.push_back(PackedVarying(*output, interpolation));
- uniqueFullNames.insert(mPackedVaryings.back().nameWithArrayIndex());
- }
- continue;
- }
-
- // Keep Transform FB varyings in the merged list always.
- if (!input)
- {
- continue;
- }
-
- 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;
- }
- // Array as a whole and array element conflict has already been checked in
- // linkValidateTransformFeedback.
- if (baseName == input->name)
- {
- // Transform feedback for varying structs is underspecified.
- // See Khronos bug 9856.
- // TODO(jmadill): Figure out how to be spec-compliant here.
- if (!input->isStruct() && tfVarying.compare(0, 3, "gl_") != 0)
- {
- mPackedVaryings.push_back(PackedVarying(*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;
- }
- }
- }
- }
-
- std::sort(mPackedVaryings.begin(), mPackedVaryings.end(), ComparePackedVarying);
-
- return packUserVaryings(infoLog, mPackedVaryings, tfVaryings);
-}
-
-// See comment on packVarying.
-bool VaryingPacking::packUserVaryings(gl::InfoLog &infoLog,
- const std::vector<PackedVarying> &packedVaryings,
- const std::vector<std::string> &transformFeedbackVaryings)
-{
-
- // "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.nameWithArrayIndex();
- return false;
- }
- }
-
- // Sort the packed register list
- std::sort(mRegisterList.begin(), mRegisterList.end());
-
- // Assign semantic indices
- for (unsigned int semanticIndex = 0;
- semanticIndex < static_cast<unsigned int>(mRegisterList.size()); ++semanticIndex)
- {
- mRegisterList[semanticIndex].semanticIndex = semanticIndex;
- }
-
- return true;
-}
-
-unsigned int VaryingPacking::getRegisterCount() const
-{
- unsigned int count = 0;
-
- for (const Register &reg : mRegisterMap)
- {
- if (reg.data[0] || reg.data[1] || reg.data[2] || reg.data[3])
- {
- ++count;
- }
- }
-
- return count;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/VaryingPacking.h b/src/3rdparty/angle/src/libANGLE/VaryingPacking.h
deleted file mode 100644
index 14b25f929e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/VaryingPacking.h
+++ /dev/null
@@ -1,184 +0,0 @@
-//
-// 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 "libANGLE/Program.h"
-
-namespace gl
-{
-class InfoLog;
-
-struct PackedVarying
-{
- PackedVarying(const sh::ShaderVariable &varyingIn, sh::InterpolationType interpolationIn)
- : PackedVarying(varyingIn, interpolationIn, "")
- {
- }
- PackedVarying(const sh::ShaderVariable &varyingIn,
- sh::InterpolationType interpolationIn,
- const std::string &parentStructNameIn)
- : varying(&varyingIn),
- vertexOnly(false),
- interpolation(interpolationIn),
- parentStructName(parentStructNameIn),
- arrayIndex(GL_INVALID_INDEX)
- {
- }
-
- bool isStructField() const { return !parentStructName.empty(); }
-
- bool isArrayElement() const { return arrayIndex != GL_INVALID_INDEX; }
-
- std::string nameWithArrayIndex() const
- {
- std::stringstream fullNameStr;
- 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;
-};
-
-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;
- }
-
- bool isStructField() const { return !structFieldName.empty(); }
-
- // 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;
-
- // Assigned after packing
- unsigned int semanticIndex;
-
- // Struct member this varying corresponds to.
- std::string structFieldName;
-};
-
-// 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,
-};
-
-class VaryingPacking final : angle::NonCopyable
-{
- public:
- VaryingPacking(GLuint maxVaryingVectors, PackMode packMode);
- ~VaryingPacking();
-
- bool packUserVaryings(gl::InfoLog &infoLog,
- const std::vector<PackedVarying> &packedVaryings,
- const std::vector<std::string> &tfVaryings);
-
- bool collectAndPackUserVaryings(gl::InfoLog &infoLog,
- const Program::MergedVaryings &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());
- }
- unsigned int getRegisterCount() const;
- size_t getRegisterMapSize() const { return mRegisterMap.size(); }
-
- 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;
-
- PackMode mPackMode;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_VARYINGPACKING_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Version.h b/src/3rdparty/angle/src/libANGLE/Version.h
deleted file mode 100644
index 7bd41846c8..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Version.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// 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);
-}
-
-#include "Version.inl"
-
-#endif // LIBANGLE_VERSION_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Version.inl b/src/3rdparty/angle/src/libANGLE/Version.inl
deleted file mode 100644
index c98054829e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Version.inl
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// 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.inl: 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/src/3rdparty/angle/src/libANGLE/VertexArray.cpp b/src/3rdparty/angle/src/libANGLE/VertexArray.cpp
deleted file mode 100644
index a8c2fce155..0000000000
--- a/src/3rdparty/angle/src/libANGLE/VertexArray.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-//
-// 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 "libANGLE/Buffer.h"
-#include "libANGLE/Context.h"
-#include "libANGLE/renderer/GLImplFactory.h"
-#include "libANGLE/renderer/VertexArrayImpl.h"
-
-namespace gl
-{
-
-VertexArrayState::VertexArrayState(size_t maxAttribs, size_t maxAttribBindings)
- : mLabel(), mVertexBindings(maxAttribBindings), mMaxEnabledAttribute(0)
-{
- ASSERT(maxAttribs <= maxAttribBindings);
-
- for (size_t i = 0; i < maxAttribs; i++)
- {
- mVertexAttributes.emplace_back(static_cast<GLuint>(i));
- }
-}
-
-VertexArrayState::~VertexArrayState()
-{
-}
-
-VertexArray::VertexArray(rx::GLImplFactory *factory,
- GLuint id,
- size_t maxAttribs,
- size_t maxAttribBindings)
- : mId(id),
- mState(maxAttribs, maxAttribBindings),
- mVertexArray(factory->createVertexArray(mState))
-{
-}
-
-void VertexArray::onDestroy(const Context *context)
-{
- for (auto &binding : mState.mVertexBindings)
- {
- binding.setBuffer(context, nullptr);
- }
- mState.mElementArrayBuffer.set(context, nullptr);
- mVertexArray->destroy(context);
- SafeDelete(mVertexArray);
- delete this;
-}
-
-VertexArray::~VertexArray()
-{
- ASSERT(!mVertexArray);
-}
-
-GLuint VertexArray::id() const
-{
- return mId;
-}
-
-void VertexArray::setLabel(const std::string &label)
-{
- mState.mLabel = label;
-}
-
-const std::string &VertexArray::getLabel() const
-{
- return mState.mLabel;
-}
-
-void VertexArray::detachBuffer(const Context *context, GLuint bufferName)
-{
- for (auto &binding : mState.mVertexBindings)
- {
- if (binding.getBuffer().id() == bufferName)
- {
- binding.setBuffer(context, nullptr);
- }
- }
-
- if (mState.mElementArrayBuffer.id() == bufferName)
- {
- mState.mElementArrayBuffer.set(context, nullptr);
- }
-}
-
-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_ENABLED) % gl::MAX_VERTEX_ATTRIBS;
-}
-
-void VertexArray::bindVertexBufferImpl(const Context *context,
- size_t bindingIndex,
- Buffer *boundBuffer,
- GLintptr offset,
- GLsizei stride)
-{
- ASSERT(bindingIndex < getMaxBindings());
-
- VertexBinding *binding = &mState.mVertexBindings[bindingIndex];
-
- binding->setBuffer(context, boundBuffer);
- binding->setOffset(offset);
- binding->setStride(stride);
-}
-
-void VertexArray::bindVertexBuffer(const Context *context,
- size_t bindingIndex,
- Buffer *boundBuffer,
- GLintptr offset,
- GLsizei stride)
-{
- bindVertexBufferImpl(context, bindingIndex, boundBuffer, offset, stride);
-
- mDirtyBits.set(DIRTY_BIT_BINDING_0_BUFFER + bindingIndex);
-}
-
-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.mVertexAttributes[attribIndex].bindingIndex = bindingIndex;
-
- mDirtyBits.set(DIRTY_BIT_ATTRIB_0_BINDING + attribIndex);
- }
-}
-
-void VertexArray::setVertexBindingDivisor(size_t bindingIndex, GLuint divisor)
-{
- ASSERT(bindingIndex < getMaxBindings());
-
- mState.mVertexBindings[bindingIndex].setDivisor(divisor);
-
- mDirtyBits.set(DIRTY_BIT_BINDING_0_DIVISOR + bindingIndex);
-}
-
-void VertexArray::setVertexAttribFormatImpl(size_t attribIndex,
- GLint size,
- GLenum type,
- bool normalized,
- bool pureInteger,
- GLuint relativeOffset)
-{
- ASSERT(attribIndex < getMaxAttribs());
-
- VertexAttribute *attrib = &mState.mVertexAttributes[attribIndex];
-
- attrib->size = size;
- attrib->type = type;
- attrib->normalized = normalized;
- attrib->pureInteger = pureInteger;
- attrib->relativeOffset = relativeOffset;
-}
-
-void VertexArray::setVertexAttribFormat(size_t attribIndex,
- GLint size,
- GLenum type,
- bool normalized,
- bool pureInteger,
- GLuint relativeOffset)
-{
- setVertexAttribFormatImpl(attribIndex, size, type, normalized, pureInteger, relativeOffset);
-
- mDirtyBits.set(DIRTY_BIT_ATTRIB_0_FORMAT + attribIndex);
-}
-
-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());
-
- mState.mVertexAttributes[attribIndex].enabled = enabledState;
-
- mDirtyBits.set(DIRTY_BIT_ATTRIB_0_ENABLED + attribIndex);
-
- // Update state cache
- if (enabledState)
- {
- mState.mMaxEnabledAttribute = std::max(attribIndex + 1, mState.mMaxEnabledAttribute);
- }
- else if (mState.mMaxEnabledAttribute == attribIndex + 1)
- {
- while (mState.mMaxEnabledAttribute > 0 &&
- !mState.mVertexAttributes[mState.mMaxEnabledAttribute - 1].enabled)
- {
- --mState.mMaxEnabledAttribute;
- }
- }
-}
-
-void VertexArray::setVertexAttribPointer(const Context *context,
- size_t attribIndex,
- gl::Buffer *boundBuffer,
- GLint size,
- GLenum type,
- bool normalized,
- bool pureInteger,
- GLsizei stride,
- const void *pointer)
-{
- ASSERT(attribIndex < getMaxAttribs());
-
- GLintptr offset = boundBuffer ? reinterpret_cast<GLintptr>(pointer) : 0;
-
- setVertexAttribFormatImpl(attribIndex, size, type, normalized, pureInteger, 0);
- setVertexAttribBinding(context, attribIndex, static_cast<GLuint>(attribIndex));
-
- VertexAttribute &attrib = mState.mVertexAttributes[attribIndex];
-
- GLsizei effectiveStride =
- stride != 0 ? stride : static_cast<GLsizei>(ComputeVertexAttributeTypeSize(attrib));
- attrib.pointer = pointer;
- attrib.vertexAttribArrayStride = stride;
-
- bindVertexBufferImpl(context, attribIndex, boundBuffer, offset, effectiveStride);
-
- mDirtyBits.set(DIRTY_BIT_ATTRIB_0_POINTER + attribIndex);
-}
-
-void VertexArray::setElementArrayBuffer(const Context *context, Buffer *buffer)
-{
- mState.mElementArrayBuffer.set(context, buffer);
- mDirtyBits.set(DIRTY_BIT_ELEMENT_ARRAY_BUFFER);
-}
-
-void VertexArray::syncState(const Context *context)
-{
- if (mDirtyBits.any())
- {
- mVertexArray->syncState(context, mDirtyBits);
- mDirtyBits.reset();
- }
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/VertexArray.h b/src/3rdparty/angle/src/libANGLE/VertexArray.h
deleted file mode 100644
index f82ec789f0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/VertexArray.h
+++ /dev/null
@@ -1,205 +0,0 @@
-//
-// 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 "libANGLE/RefCountObject.h"
-#include "libANGLE/Constants.h"
-#include "libANGLE/Debug.h"
-#include "libANGLE/State.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(size_t maxAttribs, size_t maxBindings);
- ~VertexArrayState();
-
- const std::string &getLabel() const { return mLabel; }
-
- const BindingPointer<Buffer> &getElementArrayBuffer() const { return mElementArrayBuffer; }
- size_t getMaxAttribs() const { return mVertexAttributes.size(); }
- size_t getMaxBindings() const { return mVertexBindings.size(); }
- size_t getMaxEnabledAttribute() const { return mMaxEnabledAttribute; }
- 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;
- }
-
- private:
- friend class VertexArray;
- std::string mLabel;
- std::vector<VertexAttribute> mVertexAttributes;
- BindingPointer<Buffer> mElementArrayBuffer;
- std::vector<VertexBinding> mVertexBindings;
- size_t mMaxEnabledAttribute;
-};
-
-class VertexArray final : public LabeledObject
-{
- public:
- VertexArray(rx::GLImplFactory *factory, GLuint id, size_t maxAttribs, size_t maxAttribBindings);
-
- void onDestroy(const Context *context);
-
- GLuint id() const;
-
- void setLabel(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);
- }
-
- void 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,
- GLenum type,
- bool normalized,
- bool pureInteger,
- GLsizei stride,
- const void *pointer);
- void setVertexAttribFormat(size_t attribIndex,
- GLint size,
- GLenum 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);
- void setVertexAttribFormatImpl(size_t attribIndex,
- GLint size,
- GLenum type,
- bool normalized,
- bool pureInteger,
- GLuint relativeOffset);
- void bindVertexBufferImpl(const Context *context,
- size_t bindingIndex,
- Buffer *boundBuffer,
- GLintptr offset,
- GLsizei stride);
-
- void setElementArrayBuffer(const Context *context, Buffer *buffer);
-
- const BindingPointer<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; }
-
- size_t getMaxEnabledAttribute() const { return mState.getMaxEnabledAttribute(); }
-
- enum DirtyBitType
- {
- DIRTY_BIT_ELEMENT_ARRAY_BUFFER,
-
- // Reserve bits for enabled flags
- DIRTY_BIT_ATTRIB_0_ENABLED,
- DIRTY_BIT_ATTRIB_MAX_ENABLED = DIRTY_BIT_ATTRIB_0_ENABLED + gl::MAX_VERTEX_ATTRIBS,
-
- // Reserve bits for attrib pointers
- DIRTY_BIT_ATTRIB_0_POINTER = DIRTY_BIT_ATTRIB_MAX_ENABLED,
- DIRTY_BIT_ATTRIB_MAX_POINTER = DIRTY_BIT_ATTRIB_0_POINTER + gl::MAX_VERTEX_ATTRIBS,
-
- // Reserve bits for changes to VertexAttribFormat
- DIRTY_BIT_ATTRIB_0_FORMAT = DIRTY_BIT_ATTRIB_MAX_POINTER,
- DIRTY_BIT_ATTRIB_MAX_FORMAT = DIRTY_BIT_ATTRIB_0_FORMAT + gl::MAX_VERTEX_ATTRIBS,
-
- // Reserve bits for changes to VertexAttribBinding
- DIRTY_BIT_ATTRIB_0_BINDING = DIRTY_BIT_ATTRIB_MAX_FORMAT,
- DIRTY_BIT_ATTRIB_MAX_BINDING = DIRTY_BIT_ATTRIB_0_BINDING + gl::MAX_VERTEX_ATTRIBS,
-
- // Reserve bits for changes to BindVertexBuffer
- DIRTY_BIT_BINDING_0_BUFFER = DIRTY_BIT_ATTRIB_MAX_BINDING,
- DIRTY_BIT_BINDING_MAX_BUFFER = DIRTY_BIT_BINDING_0_BUFFER + gl::MAX_VERTEX_ATTRIB_BINDINGS,
-
- // Reserve bits for binding divisors
- DIRTY_BIT_BINDING_0_DIVISOR = DIRTY_BIT_BINDING_MAX_BUFFER,
- DIRTY_BIT_BINDING_MAX_DIVISOR =
- DIRTY_BIT_BINDING_0_DIVISOR + gl::MAX_VERTEX_ATTRIB_BINDINGS,
-
- DIRTY_BIT_UNKNOWN = DIRTY_BIT_BINDING_MAX_DIVISOR,
- DIRTY_BIT_MAX = DIRTY_BIT_UNKNOWN,
- };
-
- using DirtyBits = angle::BitSet<DIRTY_BIT_MAX>;
-
- static size_t GetVertexIndexFromDirtyBit(size_t dirtyBit);
-
- void syncState(const Context *context);
- bool hasAnyDirtyBit() const { return mDirtyBits.any(); }
-
- private:
- ~VertexArray() override;
-
- GLuint mId;
-
- VertexArrayState mState;
- DirtyBits mDirtyBits;
-
- rx::VertexArrayImpl *mVertexArray;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_VERTEXARRAY_H_
diff --git a/src/3rdparty/angle/src/libANGLE/VertexAttribute.cpp b/src/3rdparty/angle/src/libANGLE/VertexAttribute.cpp
deleted file mode 100644
index 20f7452fa5..0000000000
--- a/src/3rdparty/angle/src/libANGLE/VertexAttribute.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-//
-// 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() : mStride(16u), mDivisor(0), mOffset(0)
-{
-}
-
-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;
- std::swap(binding.mBuffer, mBuffer);
- }
- return *this;
-}
-
-VertexAttribute::VertexAttribute(GLuint bindingIndex)
- : enabled(false),
- type(GL_FLOAT),
- size(4u),
- normalized(false),
- pureInteger(false),
- pointer(nullptr),
- relativeOffset(0),
- vertexAttribArrayStride(0),
- bindingIndex(bindingIndex)
-{
-}
-
-VertexAttribute::VertexAttribute(VertexAttribute &&attrib)
- : enabled(attrib.enabled),
- type(attrib.type),
- size(attrib.size),
- normalized(attrib.normalized),
- pureInteger(attrib.pureInteger),
- pointer(attrib.pointer),
- relativeOffset(attrib.relativeOffset),
- vertexAttribArrayStride(attrib.vertexAttribArrayStride),
- bindingIndex(attrib.bindingIndex)
-{
-}
-
-VertexAttribute &VertexAttribute::operator=(VertexAttribute &&attrib)
-{
- if (this != &attrib)
- {
- enabled = attrib.enabled;
- type = attrib.type;
- size = attrib.size;
- normalized = attrib.normalized;
- pureInteger = attrib.pureInteger;
- pointer = attrib.pointer;
- relativeOffset = attrib.relativeOffset;
- vertexAttribArrayStride = attrib.vertexAttribArrayStride;
- bindingIndex = attrib.bindingIndex;
- }
- return *this;
-}
-
-size_t ComputeVertexAttributeTypeSize(const VertexAttribute& attrib)
-{
- GLuint size = attrib.size;
- switch (attrib.type)
- {
- case GL_BYTE: return size * sizeof(GLbyte);
- case GL_UNSIGNED_BYTE: return size * sizeof(GLubyte);
- case GL_SHORT: return size * sizeof(GLshort);
- case GL_UNSIGNED_SHORT: return size * sizeof(GLushort);
- case GL_INT: return size * sizeof(GLint);
- case GL_UNSIGNED_INT: return size * sizeof(GLuint);
- case GL_INT_2_10_10_10_REV: return 4;
- case GL_UNSIGNED_INT_2_10_10_10_REV: return 4;
- case GL_FIXED: return size * sizeof(GLfixed);
- case GL_HALF_FLOAT: return size * sizeof(GLhalf);
- case GL_FLOAT: return size * sizeof(GLfloat);
- default: UNREACHABLE(); return size * sizeof(GLfloat);
- }
-}
-
-size_t ComputeVertexAttributeStride(const VertexAttribute &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;
-}
-
-GLenum GetVertexAttributeBaseType(const VertexAttribute &attrib)
-{
- if (attrib.pureInteger)
- {
- switch (attrib.type)
- {
- case GL_BYTE:
- case GL_SHORT:
- case GL_INT:
- return GL_INT;
-
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT:
- return GL_UNSIGNED_INT;
-
- default:
- UNREACHABLE();
- return GL_NONE;
- }
- }
- else
- {
- return GL_FLOAT;
- }
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/VertexAttribute.h b/src/3rdparty/angle/src/libANGLE/VertexAttribute.h
deleted file mode 100644
index c531bece7c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/VertexAttribute.h
+++ /dev/null
@@ -1,107 +0,0 @@
-//
-// 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"
-
-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();
- 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; }
- void setBuffer(const gl::Context *context, Buffer *bufferIn) { mBuffer.set(context, bufferIn); }
-
- private:
- GLuint mStride;
- GLuint mDivisor;
- GLintptr mOffset;
-
- BindingPointer<Buffer> mBuffer;
-};
-
-//
-// Implementation of Generic Vertex Attributes for ES3.1
-//
-struct VertexAttribute final : private angle::NonCopyable
-{
- explicit VertexAttribute(GLuint bindingIndex);
- explicit VertexAttribute(VertexAttribute &&attrib);
- VertexAttribute &operator=(VertexAttribute &&attrib);
-
- bool enabled; // For glEnable/DisableVertexAttribArray
- GLenum type;
- GLuint size;
- bool normalized;
- bool pureInteger;
-
- const void *pointer;
- GLuint relativeOffset;
-
- GLuint vertexAttribArrayStride; // ONLY for queries of VERTEX_ATTRIB_ARRAY_STRIDE
- GLuint bindingIndex;
-};
-
-size_t ComputeVertexAttributeTypeSize(const VertexAttribute &attrib);
-
-// 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);
-
-GLenum GetVertexAttributeBaseType(const VertexAttribute &attrib);
-
-struct VertexAttribCurrentValueData
-{
- union {
- GLfloat FloatValues[4];
- GLint IntValues[4];
- GLuint UnsignedIntValues[4];
- };
- GLenum 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.inl"
-
-#endif // LIBANGLE_VERTEXATTRIBUTE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/VertexAttribute.inl b/src/3rdparty/angle/src/libANGLE/VertexAttribute.inl
deleted file mode 100644
index 1c1843e46f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/VertexAttribute.inl
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// 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.inl: Inline vertex attribute methods
-//
-
-namespace gl
-{
-
-inline VertexAttribCurrentValueData::VertexAttribCurrentValueData()
- : Type(GL_FLOAT)
-{
- FloatValues[0] = 0.0f;
- FloatValues[1] = 0.0f;
- FloatValues[2] = 0.0f;
- FloatValues[3] = 1.0f;
-}
-
-inline void VertexAttribCurrentValueData::setFloatValues(const GLfloat floatValues[4])
-{
- for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
- {
- FloatValues[valueIndex] = floatValues[valueIndex];
- }
- Type = GL_FLOAT;
-}
-
-inline void VertexAttribCurrentValueData::setIntValues(const GLint intValues[4])
-{
- for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
- {
- IntValues[valueIndex] = intValues[valueIndex];
- }
- Type = GL_INT;
-}
-
-inline void VertexAttribCurrentValueData::setUnsignedIntValues(const GLuint unsignedIntValues[4])
-{
- for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
- {
- UnsignedIntValues[valueIndex] = unsignedIntValues[valueIndex];
- }
- Type = GL_UNSIGNED_INT;
-}
-
-inline bool operator==(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b)
-{
- return (a.Type == b.Type && memcmp(a.FloatValues, b.FloatValues, sizeof(float) * 4) == 0);
-}
-
-inline bool operator!=(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b)
-{
- return !(a == b);
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Workarounds.h b/src/3rdparty/angle/src/libANGLE/Workarounds.h
deleted file mode 100644
index 898031d78d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Workarounds.h
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// 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.
-//
-
-// Workarounds.h: Workarounds for driver bugs and other behaviors seen
-// on all platforms.
-
-#ifndef LIBANGLE_WORKAROUNDS_H_
-#define LIBANGLE_WORKAROUNDS_H_
-
-namespace gl
-{
-
-struct Workarounds
-{
- // 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.
- bool loseContextOnOutOfMemory = false;
-
- // Program binaries don't contain transform feedback varyings on Qualcomm GPUs.
- // Work around this by disabling the program cache for programs with transform feedback.
- bool disableProgramCachingForTransformFeedback = false;
-};
-} // namespace gl
-
-#endif // LIBANGLE_WORKAROUNDS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/WorkerThread.cpp b/src/3rdparty/angle/src/libANGLE/WorkerThread.cpp
deleted file mode 100644
index b5d789ef93..0000000000
--- a/src/3rdparty/angle/src/libANGLE/WorkerThread.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-//
-// 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"
-
-namespace angle
-{
-
-namespace priv
-{
-// SingleThreadedWorkerPool implementation.
-SingleThreadedWorkerPool::SingleThreadedWorkerPool(size_t maxThreads)
- : WorkerThreadPoolBase(maxThreads)
-{
-}
-
-SingleThreadedWorkerPool::~SingleThreadedWorkerPool()
-{
-}
-
-SingleThreadedWaitableEvent SingleThreadedWorkerPool::postWorkerTaskImpl(Closure *task)
-{
- (*task)();
- return SingleThreadedWaitableEvent(EventResetPolicy::Automatic, EventInitialState::Signaled);
-}
-
-// SingleThreadedWaitableEvent implementation.
-SingleThreadedWaitableEvent::SingleThreadedWaitableEvent()
- : SingleThreadedWaitableEvent(EventResetPolicy::Automatic, EventInitialState::NonSignaled)
-{
-}
-
-SingleThreadedWaitableEvent::SingleThreadedWaitableEvent(EventResetPolicy resetPolicy,
- EventInitialState initialState)
- : WaitableEventBase(resetPolicy, initialState)
-{
-}
-
-SingleThreadedWaitableEvent::~SingleThreadedWaitableEvent()
-{
-}
-
-SingleThreadedWaitableEvent::SingleThreadedWaitableEvent(SingleThreadedWaitableEvent &&other)
- : WaitableEventBase(std::move(other))
-{
-}
-
-SingleThreadedWaitableEvent &SingleThreadedWaitableEvent::operator=(
- SingleThreadedWaitableEvent &&other)
-{
- return copyBase(std::move(other));
-}
-
-void SingleThreadedWaitableEvent::resetImpl()
-{
- mSignaled = false;
-}
-
-void SingleThreadedWaitableEvent::waitImpl()
-{
-}
-
-void SingleThreadedWaitableEvent::signalImpl()
-{
- mSignaled = true;
-}
-
-#if (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
-// AsyncWorkerPool implementation.
-AsyncWorkerPool::AsyncWorkerPool(size_t maxThreads) : WorkerThreadPoolBase(maxThreads)
-{
-}
-
-AsyncWorkerPool::~AsyncWorkerPool()
-{
-}
-
-AsyncWaitableEvent AsyncWorkerPool::postWorkerTaskImpl(Closure *task)
-{
- auto future = std::async(std::launch::async, [task] { (*task)(); });
-
- AsyncWaitableEvent waitable(EventResetPolicy::Automatic, EventInitialState::NonSignaled);
-
- waitable.setFuture(std::move(future));
-
- return waitable;
-}
-
-// AsyncWaitableEvent implementation.
-AsyncWaitableEvent::AsyncWaitableEvent()
- : AsyncWaitableEvent(EventResetPolicy::Automatic, EventInitialState::NonSignaled)
-{
-}
-
-AsyncWaitableEvent::AsyncWaitableEvent(EventResetPolicy resetPolicy, EventInitialState initialState)
- : WaitableEventBase(resetPolicy, initialState)
-{
-}
-
-AsyncWaitableEvent::~AsyncWaitableEvent()
-{
-}
-
-AsyncWaitableEvent::AsyncWaitableEvent(AsyncWaitableEvent &&other)
- : WaitableEventBase(std::move(other)), mFuture(std::move(other.mFuture))
-{
-}
-
-AsyncWaitableEvent &AsyncWaitableEvent::operator=(AsyncWaitableEvent &&other)
-{
- std::swap(mFuture, other.mFuture);
- return copyBase(std::move(other));
-}
-
-void AsyncWaitableEvent::setFuture(std::future<void> &&future)
-{
- mFuture = std::move(future);
-}
-
-void AsyncWaitableEvent::resetImpl()
-{
- mSignaled = false;
- mFuture = std::future<void>();
-}
-
-void AsyncWaitableEvent::waitImpl()
-{
- if (mSignaled || !mFuture.valid())
- {
- return;
- }
-
- mFuture.wait();
- signal();
-}
-
-void AsyncWaitableEvent::signalImpl()
-{
- mSignaled = true;
-
- if (mResetPolicy == EventResetPolicy::Automatic)
- {
- reset();
- }
-}
-#endif // (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
-
-} // namespace priv
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/libANGLE/WorkerThread.h b/src/3rdparty/angle/src/libANGLE/WorkerThread.h
deleted file mode 100644
index f6b81dce21..0000000000
--- a/src/3rdparty/angle/src/libANGLE/WorkerThread.h
+++ /dev/null
@@ -1,284 +0,0 @@
-//
-// 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 <vector>
-
-#include "common/debug.h"
-#include "libANGLE/features.h"
-
-#if (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
-#include <future>
-#endif // (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
-
-namespace angle
-{
-// Indicates whether a WaitableEvent should automatically reset the event state after a single
-// waiting thread has been released or remain signaled until reset() is manually invoked.
-enum class EventResetPolicy
-{
- Manual,
- Automatic
-};
-
-// Specify the initial state on creation.
-enum class EventInitialState
-{
- NonSignaled,
- Signaled
-};
-
-// A callback function with no return value and no arguments.
-class Closure
-{
- public:
- virtual ~Closure() = default;
- virtual void operator()() = 0;
-};
-
-namespace priv
-{
-// An event that we can wait on, useful for joining worker threads.
-template <typename Impl>
-class WaitableEventBase : angle::NonCopyable
-{
- public:
- WaitableEventBase(EventResetPolicy resetPolicy, EventInitialState initialState);
-
- WaitableEventBase(WaitableEventBase &&other);
-
- // Puts the event in the un-signaled state.
- void reset();
-
- // Waits indefinitely for the event to be signaled.
- void wait();
-
- // Puts the event in the signaled state, causing any thread blocked on Wait to be woken up.
- // The event state is reset to non-signaled after a waiting thread has been released.
- void signal();
-
- protected:
- Impl &copyBase(Impl &&other);
-
- template <size_t Count>
- static size_t WaitManyBase(std::array<Impl, Count> *waitables);
-
- EventResetPolicy mResetPolicy;
- bool mSignaled;
-};
-
-template <typename Impl>
-WaitableEventBase<Impl>::WaitableEventBase(EventResetPolicy resetPolicy,
- EventInitialState initialState)
- : mResetPolicy(resetPolicy), mSignaled(initialState == EventInitialState::Signaled)
-{
-}
-
-template <typename Impl>
-WaitableEventBase<Impl>::WaitableEventBase(WaitableEventBase &&other)
- : mResetPolicy(other.mResetPolicy), mSignaled(other.mSignaled)
-{
-}
-
-template <typename Impl>
-void WaitableEventBase<Impl>::reset()
-{
- static_cast<Impl *>(this)->resetImpl();
-}
-
-template <typename Impl>
-void WaitableEventBase<Impl>::wait()
-{
- static_cast<Impl *>(this)->waitImpl();
-}
-
-template <typename Impl>
-void WaitableEventBase<Impl>::signal()
-{
- static_cast<Impl *>(this)->signalImpl();
-}
-
-template <typename Impl>
-template <size_t Count>
-// static
-size_t WaitableEventBase<Impl>::WaitManyBase(std::array<Impl, Count> *waitables)
-{
- ASSERT(Count > 0);
-
- for (size_t index = 0; index < Count; ++index)
- {
- (*waitables)[index].wait();
- }
-
- return 0;
-}
-
-template <typename Impl>
-Impl &WaitableEventBase<Impl>::copyBase(Impl &&other)
-{
- std::swap(mSignaled, other.mSignaled);
- std::swap(mResetPolicy, other.mResetPolicy);
- return *static_cast<Impl *>(this);
-}
-
-class SingleThreadedWaitableEvent : public WaitableEventBase<SingleThreadedWaitableEvent>
-{
- public:
- SingleThreadedWaitableEvent();
- SingleThreadedWaitableEvent(EventResetPolicy resetPolicy, EventInitialState initialState);
- ~SingleThreadedWaitableEvent();
-
- SingleThreadedWaitableEvent(SingleThreadedWaitableEvent &&other);
- SingleThreadedWaitableEvent &operator=(SingleThreadedWaitableEvent &&other);
-
- void resetImpl();
- void waitImpl();
- void signalImpl();
-
- // Wait, synchronously, on multiple events.
- // returns the index of a WaitableEvent which has been signaled.
- template <size_t Count>
- static size_t WaitMany(std::array<SingleThreadedWaitableEvent, Count> *waitables);
-};
-
-template <size_t Count>
-// static
-size_t SingleThreadedWaitableEvent::WaitMany(
- std::array<SingleThreadedWaitableEvent, Count> *waitables)
-{
- return WaitableEventBase<SingleThreadedWaitableEvent>::WaitManyBase(waitables);
-}
-
-#if (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
-class AsyncWaitableEvent : public WaitableEventBase<AsyncWaitableEvent>
-{
- public:
- AsyncWaitableEvent();
- AsyncWaitableEvent(EventResetPolicy resetPolicy, EventInitialState initialState);
- ~AsyncWaitableEvent();
-
- AsyncWaitableEvent(AsyncWaitableEvent &&other);
- AsyncWaitableEvent &operator=(AsyncWaitableEvent &&other);
-
- void resetImpl();
- void waitImpl();
- void signalImpl();
-
- // Wait, synchronously, on multiple events.
- // returns the index of a WaitableEvent which has been signaled.
- template <size_t Count>
- static size_t WaitMany(std::array<AsyncWaitableEvent, Count> *waitables);
-
- private:
- friend class AsyncWorkerPool;
- void setFuture(std::future<void> &&future);
-
- std::future<void> mFuture;
-};
-
-template <size_t Count>
-// static
-size_t AsyncWaitableEvent::WaitMany(std::array<AsyncWaitableEvent, Count> *waitables)
-{
- return WaitableEventBase<AsyncWaitableEvent>::WaitManyBase(waitables);
-}
-#endif // (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
-
-// The traits class allows the the thread pool to return the "Typed" waitable event from postTask.
-// Otherwise postTask would always think it returns the current active type, so the unit tests
-// could not run on multiple worker types in the same compilation.
-template <typename Impl>
-struct WorkerThreadPoolTraits;
-
-class SingleThreadedWorkerPool;
-template <>
-struct WorkerThreadPoolTraits<SingleThreadedWorkerPool>
-{
- using WaitableEventType = SingleThreadedWaitableEvent;
-};
-
-#if (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
-class AsyncWorkerPool;
-template <>
-struct WorkerThreadPoolTraits<AsyncWorkerPool>
-{
- using WaitableEventType = AsyncWaitableEvent;
-};
-#endif // (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
-
-// Request WorkerThreads from the WorkerThreadPool. Each pool can keep worker threads around so
-// we avoid the costly spin up and spin down time.
-template <typename Impl>
-class WorkerThreadPoolBase : angle::NonCopyable
-{
- public:
- WorkerThreadPoolBase(size_t maxThreads);
- ~WorkerThreadPoolBase();
-
- using WaitableEventType = typename WorkerThreadPoolTraits<Impl>::WaitableEventType;
-
- // Returns an event to wait on for the task to finish.
- // If the pool fails to create the task, returns null.
- WaitableEventType postWorkerTask(Closure *task);
-};
-
-template <typename Impl>
-WorkerThreadPoolBase<Impl>::WorkerThreadPoolBase(size_t maxThreads)
-{
-}
-
-template <typename Impl>
-WorkerThreadPoolBase<Impl>::~WorkerThreadPoolBase()
-{
-}
-
-template <typename Impl>
-typename WorkerThreadPoolBase<Impl>::WaitableEventType WorkerThreadPoolBase<Impl>::postWorkerTask(
- Closure *task)
-{
- return static_cast<Impl *>(this)->postWorkerTaskImpl(task);
-}
-
-class SingleThreadedWorkerPool : public WorkerThreadPoolBase<SingleThreadedWorkerPool>
-{
- public:
- SingleThreadedWorkerPool(size_t maxThreads);
- ~SingleThreadedWorkerPool();
-
- SingleThreadedWaitableEvent postWorkerTaskImpl(Closure *task);
-};
-
-#if (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
-class AsyncWorkerPool : public WorkerThreadPoolBase<AsyncWorkerPool>
-{
- public:
- AsyncWorkerPool(size_t maxThreads);
- ~AsyncWorkerPool();
-
- AsyncWaitableEvent postWorkerTaskImpl(Closure *task);
-};
-#endif // (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
-
-} // namespace priv
-
-#if (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
-using WaitableEvent = priv::AsyncWaitableEvent;
-using WorkerThreadPool = priv::AsyncWorkerPool;
-#else
-using WaitableEvent = priv::SingleThreadedWaitableEvent;
-using WorkerThreadPool = priv::SingleThreadedWorkerPool;
-#endif // (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
-
-} // namespace angle
-
-#endif // LIBANGLE_WORKER_THREAD_H_
diff --git a/src/3rdparty/angle/src/libANGLE/angletypes.cpp b/src/3rdparty/angle/src/libANGLE/angletypes.cpp
deleted file mode 100644
index 702d391e46..0000000000
--- a/src/3rdparty/angle/src/libANGLE/angletypes.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-//
-// 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/VertexAttribute.h"
-#include "libANGLE/State.h"
-#include "libANGLE/VertexArray.h"
-
-namespace gl
-{
-
-PrimitiveType GetPrimitiveType(GLenum drawMode)
-{
- switch (drawMode)
- {
- case GL_POINTS:
- return PRIMITIVE_POINTS;
- case GL_LINES:
- return PRIMITIVE_LINES;
- case GL_LINE_STRIP:
- return PRIMITIVE_LINE_STRIP;
- case GL_LINE_LOOP:
- return PRIMITIVE_LINE_LOOP;
- case GL_TRIANGLES:
- return PRIMITIVE_TRIANGLES;
- case GL_TRIANGLE_STRIP:
- return PRIMITIVE_TRIANGLE_STRIP;
- case GL_TRIANGLE_FAN:
- return PRIMITIVE_TRIANGLE_FAN;
- default:
- UNREACHABLE();
- return PRIMITIVE_TYPE_MAX;
- }
-}
-
-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 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));
-
- minFilter = GL_NEAREST_MIPMAP_LINEAR;
- magFilter = GL_LINEAR;
- wrapS = GL_REPEAT;
- wrapT = GL_REPEAT;
- wrapR = GL_REPEAT;
- maxAnisotropy = 1.0f;
- minLod = -1000.0f;
- maxLod = 1000.0f;
- compareMode = GL_NONE;
- compareFunc = GL_LEQUAL;
- sRGBDecode = GL_DECODE_EXT;
-}
-
-SamplerState::SamplerState(const SamplerState &other) = default;
-
-// static
-SamplerState SamplerState::CreateDefaultForTarget(GLenum target)
-{
- 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 (target == GL_TEXTURE_EXTERNAL_OES || target == GL_TEXTURE_RECTANGLE_ANGLE)
- {
- state.minFilter = GL_LINEAR;
- state.wrapS = GL_CLAMP_TO_EDGE;
- state.wrapT = GL_CLAMP_TO_EDGE;
- }
-
- return state;
-}
-
-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;
- }
-}
-
-bool ClipRectangle(const Rectangle &source, const Rectangle &clip, Rectangle *intersection)
-{
- int minSourceX, maxSourceX, minSourceY, maxSourceY;
- MinMax(source.x, source.x + source.width, &minSourceX, &maxSourceX);
- MinMax(source.y, source.y + source.height, &minSourceY, &maxSourceY);
-
- int minClipX, maxClipX, minClipY, maxClipY;
- MinMax(clip.x, clip.x + clip.width, &minClipX, &maxClipX);
- MinMax(clip.y, clip.y + clip.height, &minClipY, &maxClipY);
-
- if (minSourceX >= maxClipX || maxSourceX <= minClipX || minSourceY >= maxClipY || maxSourceY <= minClipY)
- {
- if (intersection)
- {
- intersection->x = minSourceX;
- intersection->y = maxSourceY;
- intersection->width = maxSourceX - minSourceX;
- intersection->height = maxSourceY - minSourceY;
- }
-
- return false;
- }
- else
- {
- if (intersection)
- {
- intersection->x = std::max(minSourceX, minClipX);
- intersection->y = std::max(minSourceY, minClipY);
- intersection->width = std::min(maxSourceX, maxClipX) - std::max(minSourceX, minClipX);
- intersection->height = std::min(maxSourceY, maxClipY) - std::max(minSourceY, minClipY);
- }
-
- return true;
- }
-}
-
-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);
-}
-
-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);
-}
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/angletypes.h b/src/3rdparty/angle/src/libANGLE/angletypes.h
deleted file mode 100644
index 4f364b090a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/angletypes.h
+++ /dev/null
@@ -1,487 +0,0 @@
-//
-// 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/bitset_utils.h"
-#include "libANGLE/Constants.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/PackedGLEnums.h"
-#include "libANGLE/RefCountObject.h"
-
-#include <stdint.h>
-
-#include <bitset>
-#include <map>
-#include <unordered_map>
-
-namespace gl
-{
-class Buffer;
-class Texture;
-
-enum PrimitiveType
-{
- PRIMITIVE_POINTS,
- PRIMITIVE_LINES,
- PRIMITIVE_LINE_STRIP,
- PRIMITIVE_LINE_LOOP,
- PRIMITIVE_TRIANGLES,
- PRIMITIVE_TRIANGLE_STRIP,
- PRIMITIVE_TRIANGLE_FAN,
- PRIMITIVE_TYPE_MAX,
-};
-
-PrimitiveType GetPrimitiveType(GLenum drawMode);
-
-enum SamplerType
-{
- SAMPLER_PIXEL,
- SAMPLER_VERTEX,
- SAMPLER_COMPUTE
-};
-
-enum ShaderType
-{
- SHADER_VERTEX,
- SHADER_FRAGMENT,
- SHADER_GEOMETRY,
- SHADER_COMPUTE,
- SHADER_TYPE_MAX
-};
-
-struct Rectangle
-{
- Rectangle() : x(0), y(0), width(0), height(0) {}
- Rectangle(int x_in, int y_in, int width_in, int height_in)
- : x(x_in), y(y_in), width(width_in), height(height_in)
- {
- }
-
- int x0() const { return x; }
- int y0() const { return y; }
- int x1() const { return x + width; }
- int y1() const { return y + height; }
-
- 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
-{
- int x;
- int y;
- int z;
-
- Offset() : x(0), y(0), z(0) { }
- Offset(int x_in, int y_in, int z_in) : x(x_in), y(y_in), z(z_in) { }
-};
-
-bool operator==(const Offset &a, const Offset &b);
-bool operator!=(const Offset &a, const Offset &b);
-
-struct Extents
-{
- int width;
- int height;
- int depth;
-
- Extents() : width(0), height(0), depth(0) { }
- Extents(int width_, int height_, int depth_) : width(width_), height(height_), depth(depth_) { }
-
- Extents(const Extents &other) = default;
- Extents &operator=(const Extents &other) = default;
-
- bool empty() const { return (width * height * depth) == 0; }
-};
-
-bool operator==(const Extents &lhs, const Extents &rhs);
-bool operator!=(const Extents &lhs, const Extents &rhs);
-
-struct Box
-{
- int x;
- int y;
- int z;
- int width;
- int height;
- int depth;
-
- Box() : x(0), y(0), z(0), width(0), height(0), depth(0) { }
- Box(int x_in, int y_in, int z_in, int width_in, int height_in, int depth_in) : x(x_in), y(y_in), z(z_in), width(width_in), height(height_in), depth(depth_in) { }
- Box(const Offset &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;
-};
-
-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 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);
-
-// State from Table 6.10 (state per sampler object)
-struct SamplerState final
-{
- // This will zero-initialize the struct, including padding.
- SamplerState();
- SamplerState(const SamplerState &other);
-
- static SamplerState CreateDefaultForTarget(GLenum target);
-
- GLenum minFilter;
- GLenum magFilter;
-
- GLenum wrapS;
- GLenum wrapT;
- GLenum wrapR;
-
- // From EXT_texture_filter_anisotropic
- float maxAnisotropy;
-
- GLfloat minLod;
- GLfloat maxLod;
-
- GLenum compareMode;
- GLenum compareFunc;
-
- GLenum sRGBDecode;
-};
-
-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;
-};
-
-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
-using DrawBufferMask = angle::BitSet<IMPLEMENTATION_MAX_DRAW_BUFFERS>;
-
-using ContextID = uintptr_t;
-
-constexpr size_t CUBE_FACE_COUNT = 6;
-
-using TextureMap = std::map<GLenum, BindingPointer<Texture>>;
-
-template <typename T>
-using AttachmentArray = std::array<T, IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS>;
-
-template <typename T>
-using DrawBuffersArray = std::array<T, IMPLEMENTATION_MAX_DRAW_BUFFERS>;
-
-} // 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.inl"
-
-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)
- {
- ANGLE_SWALLOW_ERR(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 ContextState;
-
-} // namespace gl
-
-#endif // LIBANGLE_ANGLETYPES_H_
diff --git a/src/3rdparty/angle/src/libANGLE/angletypes.inl b/src/3rdparty/angle/src/libANGLE/angletypes.inl
deleted file mode 100644
index 3fbe0747d2..0000000000
--- a/src/3rdparty/angle/src/libANGLE/angletypes.inl
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// 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.inl : 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/src/3rdparty/angle/src/libANGLE/entry_points_enum_autogen.h b/src/3rdparty/angle/src/libANGLE/entry_points_enum_autogen.h
deleted file mode 100644
index 14b5e3c1b0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/entry_points_enum_autogen.h
+++ /dev/null
@@ -1,336 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by generate_entry_points.py using data from gl.xml.
-//
-// 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.
-//
-// entry_points_enum_autogen.h:
-// Defines the GLES entry points enumeration.
-
-#ifndef LIBGLESV2_ENTRYPOINTSENUM_AUTOGEN_H_
-#define LIBGLESV2_ENTRYPOINTSENUM_AUTOGEN_H_
-
-namespace gl
-{
-enum class EntryPoint
-{
- Invalid,
- ActiveTexture,
- AttachShader,
- BindAttribLocation,
- BindBuffer,
- BindFramebuffer,
- BindRenderbuffer,
- BindTexture,
- BlendColor,
- BlendEquation,
- BlendEquationSeparate,
- BlendFunc,
- BlendFuncSeparate,
- BufferData,
- BufferSubData,
- CheckFramebufferStatus,
- Clear,
- ClearColor,
- ClearDepthf,
- ClearStencil,
- ColorMask,
- CompileShader,
- CompressedTexImage2D,
- CompressedTexSubImage2D,
- CopyTexImage2D,
- CopyTexSubImage2D,
- CreateProgram,
- CreateShader,
- CullFace,
- DeleteBuffers,
- DeleteFramebuffers,
- DeleteProgram,
- DeleteRenderbuffers,
- DeleteShader,
- DeleteTextures,
- DepthFunc,
- DepthMask,
- DepthRangef,
- DetachShader,
- Disable,
- DisableVertexAttribArray,
- DrawArrays,
- DrawElements,
- Enable,
- EnableVertexAttribArray,
- Finish,
- Flush,
- FramebufferRenderbuffer,
- FramebufferTexture2D,
- FrontFace,
- GenBuffers,
- GenerateMipmap,
- GenFramebuffers,
- GenRenderbuffers,
- GenTextures,
- GetActiveAttrib,
- GetActiveUniform,
- GetAttachedShaders,
- GetAttribLocation,
- GetBooleanv,
- GetBufferParameteriv,
- GetError,
- GetFloatv,
- GetFramebufferAttachmentParameteriv,
- GetIntegerv,
- GetProgramiv,
- GetProgramInfoLog,
- GetRenderbufferParameteriv,
- GetShaderiv,
- GetShaderInfoLog,
- GetShaderPrecisionFormat,
- GetShaderSource,
- GetString,
- GetTexParameterfv,
- GetTexParameteriv,
- GetUniformfv,
- GetUniformiv,
- GetUniformLocation,
- GetVertexAttribfv,
- GetVertexAttribiv,
- GetVertexAttribPointerv,
- Hint,
- IsBuffer,
- IsEnabled,
- IsFramebuffer,
- IsProgram,
- IsRenderbuffer,
- IsShader,
- IsTexture,
- LineWidth,
- LinkProgram,
- PixelStorei,
- PolygonOffset,
- ReadPixels,
- ReleaseShaderCompiler,
- RenderbufferStorage,
- SampleCoverage,
- Scissor,
- ShaderBinary,
- ShaderSource,
- StencilFunc,
- StencilFuncSeparate,
- StencilMask,
- StencilMaskSeparate,
- StencilOp,
- StencilOpSeparate,
- TexImage2D,
- TexParameterf,
- TexParameterfv,
- TexParameteri,
- TexParameteriv,
- TexSubImage2D,
- Uniform1f,
- Uniform1fv,
- Uniform1i,
- Uniform1iv,
- Uniform2f,
- Uniform2fv,
- Uniform2i,
- Uniform2iv,
- Uniform3f,
- Uniform3fv,
- Uniform3i,
- Uniform3iv,
- Uniform4f,
- Uniform4fv,
- Uniform4i,
- Uniform4iv,
- UniformMatrix2fv,
- UniformMatrix3fv,
- UniformMatrix4fv,
- UseProgram,
- ValidateProgram,
- VertexAttrib1f,
- VertexAttrib1fv,
- VertexAttrib2f,
- VertexAttrib2fv,
- VertexAttrib3f,
- VertexAttrib3fv,
- VertexAttrib4f,
- VertexAttrib4fv,
- VertexAttribPointer,
- Viewport,
- ReadBuffer,
- DrawRangeElements,
- TexImage3D,
- TexSubImage3D,
- CopyTexSubImage3D,
- CompressedTexImage3D,
- CompressedTexSubImage3D,
- GenQueries,
- DeleteQueries,
- IsQuery,
- BeginQuery,
- EndQuery,
- GetQueryiv,
- GetQueryObjectuiv,
- UnmapBuffer,
- GetBufferPointerv,
- DrawBuffers,
- UniformMatrix2x3fv,
- UniformMatrix3x2fv,
- UniformMatrix2x4fv,
- UniformMatrix4x2fv,
- UniformMatrix3x4fv,
- UniformMatrix4x3fv,
- BlitFramebuffer,
- RenderbufferStorageMultisample,
- FramebufferTextureLayer,
- MapBufferRange,
- FlushMappedBufferRange,
- BindVertexArray,
- DeleteVertexArrays,
- GenVertexArrays,
- IsVertexArray,
- GetIntegeri_v,
- BeginTransformFeedback,
- EndTransformFeedback,
- BindBufferRange,
- BindBufferBase,
- TransformFeedbackVaryings,
- GetTransformFeedbackVarying,
- VertexAttribIPointer,
- GetVertexAttribIiv,
- GetVertexAttribIuiv,
- VertexAttribI4i,
- VertexAttribI4ui,
- VertexAttribI4iv,
- VertexAttribI4uiv,
- GetUniformuiv,
- GetFragDataLocation,
- Uniform1ui,
- Uniform2ui,
- Uniform3ui,
- Uniform4ui,
- Uniform1uiv,
- Uniform2uiv,
- Uniform3uiv,
- Uniform4uiv,
- ClearBufferiv,
- ClearBufferuiv,
- ClearBufferfv,
- ClearBufferfi,
- GetStringi,
- CopyBufferSubData,
- GetUniformIndices,
- GetActiveUniformsiv,
- GetUniformBlockIndex,
- GetActiveUniformBlockiv,
- GetActiveUniformBlockName,
- UniformBlockBinding,
- DrawArraysInstanced,
- DrawElementsInstanced,
- FenceSync,
- IsSync,
- DeleteSync,
- ClientWaitSync,
- WaitSync,
- GetInteger64v,
- GetSynciv,
- GetInteger64i_v,
- GetBufferParameteri64v,
- GenSamplers,
- DeleteSamplers,
- IsSampler,
- BindSampler,
- SamplerParameteri,
- SamplerParameteriv,
- SamplerParameterf,
- SamplerParameterfv,
- GetSamplerParameteriv,
- GetSamplerParameterfv,
- VertexAttribDivisor,
- BindTransformFeedback,
- DeleteTransformFeedbacks,
- GenTransformFeedbacks,
- IsTransformFeedback,
- PauseTransformFeedback,
- ResumeTransformFeedback,
- GetProgramBinary,
- ProgramBinary,
- ProgramParameteri,
- InvalidateFramebuffer,
- InvalidateSubFramebuffer,
- TexStorage2D,
- TexStorage3D,
- GetInternalformativ,
- DispatchCompute,
- DispatchComputeIndirect,
- DrawArraysIndirect,
- DrawElementsIndirect,
- FramebufferParameteri,
- GetFramebufferParameteriv,
- GetProgramInterfaceiv,
- GetProgramResourceIndex,
- GetProgramResourceName,
- GetProgramResourceiv,
- GetProgramResourceLocation,
- UseProgramStages,
- ActiveShaderProgram,
- CreateShaderProgramv,
- BindProgramPipeline,
- DeleteProgramPipelines,
- GenProgramPipelines,
- IsProgramPipeline,
- GetProgramPipelineiv,
- ProgramUniform1i,
- ProgramUniform2i,
- ProgramUniform3i,
- ProgramUniform4i,
- ProgramUniform1ui,
- ProgramUniform2ui,
- ProgramUniform3ui,
- ProgramUniform4ui,
- ProgramUniform1f,
- ProgramUniform2f,
- ProgramUniform3f,
- ProgramUniform4f,
- ProgramUniform1iv,
- ProgramUniform2iv,
- ProgramUniform3iv,
- ProgramUniform4iv,
- ProgramUniform1uiv,
- ProgramUniform2uiv,
- ProgramUniform3uiv,
- ProgramUniform4uiv,
- ProgramUniform1fv,
- ProgramUniform2fv,
- ProgramUniform3fv,
- ProgramUniform4fv,
- ProgramUniformMatrix2fv,
- ProgramUniformMatrix3fv,
- ProgramUniformMatrix4fv,
- ProgramUniformMatrix2x3fv,
- ProgramUniformMatrix3x2fv,
- ProgramUniformMatrix2x4fv,
- ProgramUniformMatrix4x2fv,
- ProgramUniformMatrix3x4fv,
- ProgramUniformMatrix4x3fv,
- ValidateProgramPipeline,
- GetProgramPipelineInfoLog,
- BindImageTexture,
- GetBooleani_v,
- MemoryBarrier,
- MemoryBarrierByRegion,
- TexStorage2DMultisample,
- GetMultisamplefv,
- SampleMaski,
- GetTexLevelParameteriv,
- GetTexLevelParameterfv,
- BindVertexBuffer,
- VertexAttribFormat,
- VertexAttribIFormat,
- VertexAttribBinding,
- VertexBindingDivisor,
- DrawElementsInstancedANGLE
-};
-} // namespace gl
-#endif // LIBGLESV2_ENTRY_POINTS_ENUM_AUTOGEN_H_
diff --git a/src/3rdparty/angle/src/libANGLE/es3_copy_conversion_formats.json b/src/3rdparty/angle/src/libANGLE/es3_copy_conversion_formats.json
deleted file mode 100644
index 39b71fd93a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/es3_copy_conversion_formats.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "From ES 3.0.1 spec, table 3.15":
- [
- [ "GL_ALPHA", "GL_RGBA" ],
- [ "GL_LUMINANCE", "GL_RED" ],
- [ "GL_LUMINANCE", "GL_RG" ],
- [ "GL_LUMINANCE", "GL_RGB" ],
- [ "GL_LUMINANCE", "GL_RGBA" ],
- [ "GL_LUMINANCE_ALPHA", "GL_RGBA" ],
- [ "GL_RED", "GL_RED" ],
- [ "GL_RED", "GL_RG" ],
- [ "GL_RED", "GL_RGB" ],
- [ "GL_RED", "GL_RGBA" ],
- [ "GL_RG", "GL_RG" ],
- [ "GL_RG", "GL_RGB" ],
- [ "GL_RG", "GL_RGBA" ],
- [ "GL_RGB", "GL_RGB" ],
- [ "GL_RGB", "GL_RGBA" ],
- [ "GL_RGBA", "GL_RGBA" ]
- ],
-
- "Necessary for ANGLE back-buffers":
- [
- [ "GL_ALPHA", "GL_BGRA_EXT" ],
- [ "GL_LUMINANCE", "GL_BGRA_EXT" ],
- [ "GL_LUMINANCE_ALPHA", "GL_BGRA_EXT" ],
- [ "GL_RED", "GL_BGRA_EXT" ],
- [ "GL_RG", "GL_BGRA_EXT" ],
- [ "GL_RGB", "GL_BGRA_EXT" ],
- [ "GL_RGBA", "GL_BGRA_EXT" ],
- [ "GL_BGRA_EXT", "GL_BGRA_EXT" ],
-
- [ "GL_RED_INTEGER", "GL_RED_INTEGER" ],
- [ "GL_RED_INTEGER", "GL_RG_INTEGER" ],
- [ "GL_RED_INTEGER", "GL_RGB_INTEGER" ],
- [ "GL_RED_INTEGER", "GL_RGBA_INTEGER" ],
- [ "GL_RG_INTEGER", "GL_RG_INTEGER" ],
- [ "GL_RG_INTEGER", "GL_RGB_INTEGER" ],
- [ "GL_RG_INTEGER", "GL_RGBA_INTEGER" ],
- [ "GL_RGB_INTEGER", "GL_RGB_INTEGER" ],
- [ "GL_RGB_INTEGER", "GL_RGBA_INTEGER" ],
- [ "GL_RGBA_INTEGER", "GL_RGBA_INTEGER" ]
- ]
-}
diff --git a/src/3rdparty/angle/src/libANGLE/es3_copy_conversion_table_autogen.cpp b/src/3rdparty/angle/src/libANGLE/es3_copy_conversion_table_autogen.cpp
deleted file mode 100644
index 149f79f458..0000000000
--- a/src/3rdparty/angle/src/libANGLE/es3_copy_conversion_table_autogen.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by gen_copy_conversion_table.py using data from es3_copy_conversion_formats.json.
-//
-// 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.
-//
-// 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/src/3rdparty/angle/src/libANGLE/es3_format_type_combinations.json b/src/3rdparty/angle/src/libANGLE/es3_format_type_combinations.json
deleted file mode 100644
index fb12242e75..0000000000
--- a/src/3rdparty/angle/src/libANGLE/es3_format_type_combinations.json
+++ /dev/null
@@ -1,171 +0,0 @@
-{
- "Format combinations from ES 3.0.1 spec, table 3.2":
- [
- [ "GL_RGBA8", "GL_RGBA", "GL_UNSIGNED_BYTE" ],
- [ "GL_RGB5_A1", "GL_RGBA", "GL_UNSIGNED_BYTE" ],
- [ "GL_RGBA4", "GL_RGBA", "GL_UNSIGNED_BYTE" ],
- [ "GL_SRGB8_ALPHA8", "GL_RGBA", "GL_UNSIGNED_BYTE" ],
- [ "GL_RGBA8_SNORM", "GL_RGBA", "GL_BYTE" ],
- [ "GL_RGBA4", "GL_RGBA", "GL_UNSIGNED_SHORT_4_4_4_4" ],
- [ "GL_RGB10_A2", "GL_RGBA", "GL_UNSIGNED_INT_2_10_10_10_REV" ],
- [ "GL_RGB5_A1", "GL_RGBA", "GL_UNSIGNED_INT_2_10_10_10_REV" ],
- [ "GL_RGB5_A1", "GL_RGBA", "GL_UNSIGNED_SHORT_5_5_5_1" ],
- [ "GL_RGBA16F", "GL_RGBA", "GL_HALF_FLOAT" ],
- [ "GL_RGBA16F", "GL_RGBA", "GL_HALF_FLOAT_OES" ],
- [ "GL_RGBA32F", "GL_RGBA", "GL_FLOAT" ],
- [ "GL_RGBA16F", "GL_RGBA", "GL_FLOAT" ],
- [ "GL_RGBA8UI", "GL_RGBA_INTEGER", "GL_UNSIGNED_BYTE" ],
- [ "GL_RGBA8I", "GL_RGBA_INTEGER", "GL_BYTE" ],
- [ "GL_RGBA16UI", "GL_RGBA_INTEGER", "GL_UNSIGNED_SHORT" ],
- [ "GL_RGBA16I", "GL_RGBA_INTEGER", "GL_SHORT" ],
- [ "GL_RGBA32UI", "GL_RGBA_INTEGER", "GL_UNSIGNED_INT" ],
- [ "GL_RGBA32I", "GL_RGBA_INTEGER", "GL_INT" ],
- [ "GL_RGB10_A2UI", "GL_RGBA_INTEGER", "GL_UNSIGNED_INT_2_10_10_10_REV" ],
- [ "GL_RGB8", "GL_RGB", "GL_UNSIGNED_BYTE" ],
- [ "GL_RGB565", "GL_RGB", "GL_UNSIGNED_BYTE" ],
- [ "GL_SRGB8", "GL_RGB", "GL_UNSIGNED_BYTE" ],
- [ "GL_RGB8_SNORM", "GL_RGB", "GL_BYTE" ],
- [ "GL_RGB565", "GL_RGB", "GL_UNSIGNED_SHORT_5_6_5" ],
- [ "GL_R11F_G11F_B10F", "GL_RGB", "GL_UNSIGNED_INT_10F_11F_11F_REV" ],
- [ "GL_RGB9_E5", "GL_RGB", "GL_UNSIGNED_INT_5_9_9_9_REV" ],
- [ "GL_RGB16F", "GL_RGB", "GL_HALF_FLOAT" ],
- [ "GL_RGB16F", "GL_RGB", "GL_HALF_FLOAT_OES" ],
- [ "GL_R11F_G11F_B10F", "GL_RGB", "GL_HALF_FLOAT" ],
- [ "GL_R11F_G11F_B10F", "GL_RGB", "GL_HALF_FLOAT_OES" ],
- [ "GL_RGB9_E5", "GL_RGB", "GL_HALF_FLOAT" ],
- [ "GL_RGB9_E5", "GL_RGB", "GL_HALF_FLOAT_OES" ],
- [ "GL_RGB32F", "GL_RGB", "GL_FLOAT" ],
- [ "GL_RGB16F", "GL_RGB", "GL_FLOAT" ],
- [ "GL_R11F_G11F_B10F", "GL_RGB", "GL_FLOAT" ],
- [ "GL_RGB9_E5", "GL_RGB", "GL_FLOAT" ],
- [ "GL_RGB8UI", "GL_RGB_INTEGER", "GL_UNSIGNED_BYTE" ],
- [ "GL_RGB8I", "GL_RGB_INTEGER", "GL_BYTE" ],
- [ "GL_RGB16UI", "GL_RGB_INTEGER", "GL_UNSIGNED_SHORT" ],
- [ "GL_RGB16I", "GL_RGB_INTEGER", "GL_SHORT" ],
- [ "GL_RGB32UI", "GL_RGB_INTEGER", "GL_UNSIGNED_INT" ],
- [ "GL_RGB32I", "GL_RGB_INTEGER", "GL_INT" ],
- [ "GL_RG8", "GL_RG", "GL_UNSIGNED_BYTE" ],
- [ "GL_RG8_SNORM", "GL_RG", "GL_BYTE" ],
- [ "GL_RG16F", "GL_RG", "GL_HALF_FLOAT" ],
- [ "GL_RG16F", "GL_RG", "GL_HALF_FLOAT_OES" ],
- [ "GL_RG32F", "GL_RG", "GL_FLOAT" ],
- [ "GL_RG16F", "GL_RG", "GL_FLOAT" ],
- [ "GL_RG8UI", "GL_RG_INTEGER", "GL_UNSIGNED_BYTE" ],
- [ "GL_RG8I", "GL_RG_INTEGER", "GL_BYTE" ],
- [ "GL_RG16UI", "GL_RG_INTEGER", "GL_UNSIGNED_SHORT" ],
- [ "GL_RG16I", "GL_RG_INTEGER", "GL_SHORT" ],
- [ "GL_RG32UI", "GL_RG_INTEGER", "GL_UNSIGNED_INT" ],
- [ "GL_RG32I", "GL_RG_INTEGER", "GL_INT" ],
- [ "GL_R8", "GL_RED", "GL_UNSIGNED_BYTE" ],
- [ "GL_R8_SNORM", "GL_RED", "GL_BYTE" ],
- [ "GL_R16F", "GL_RED", "GL_HALF_FLOAT" ],
- [ "GL_R16F", "GL_RED", "GL_HALF_FLOAT_OES" ],
- [ "GL_R32F", "GL_RED", "GL_FLOAT" ],
- [ "GL_R16F", "GL_RED", "GL_FLOAT" ],
- [ "GL_R8UI", "GL_RED_INTEGER", "GL_UNSIGNED_BYTE" ],
- [ "GL_R8I", "GL_RED_INTEGER", "GL_BYTE" ],
- [ "GL_R16UI", "GL_RED_INTEGER", "GL_UNSIGNED_SHORT" ],
- [ "GL_R16I", "GL_RED_INTEGER", "GL_SHORT" ],
- [ "GL_R32UI", "GL_RED_INTEGER", "GL_UNSIGNED_INT" ],
- [ "GL_R32I", "GL_RED_INTEGER", "GL_INT" ]
- ],
- "Unsized formats":
- [
- [ "GL_RGBA", "GL_RGBA", "GL_UNSIGNED_BYTE" ],
- [ "GL_RGBA", "GL_RGBA", "GL_UNSIGNED_SHORT_4_4_4_4" ],
- [ "GL_RGBA", "GL_RGBA", "GL_UNSIGNED_SHORT_5_5_5_1" ],
- [ "GL_RGB", "GL_RGB", "GL_UNSIGNED_BYTE" ],
- [ "GL_RGB", "GL_RGB", "GL_UNSIGNED_SHORT_5_6_5" ],
- [ "GL_LUMINANCE_ALPHA", "GL_LUMINANCE_ALPHA", "GL_UNSIGNED_BYTE" ],
- [ "GL_LUMINANCE", "GL_LUMINANCE", "GL_UNSIGNED_BYTE" ],
- [ "GL_ALPHA", "GL_ALPHA", "GL_UNSIGNED_BYTE" ],
- [ "GL_SRGB_ALPHA_EXT", "GL_SRGB_ALPHA_EXT", "GL_UNSIGNED_BYTE" ],
- [ "GL_SRGB_EXT", "GL_SRGB_EXT", "GL_UNSIGNED_BYTE" ],
- [ "GL_RG", "GL_RG", "GL_UNSIGNED_BYTE" ],
- [ "GL_RG", "GL_RG", "GL_FLOAT" ],
- [ "GL_RG", "GL_RG", "GL_HALF_FLOAT" ],
- [ "GL_RG", "GL_RG", "GL_HALF_FLOAT_OES" ],
- [ "GL_RED", "GL_RED", "GL_UNSIGNED_BYTE" ],
- [ "GL_RED", "GL_RED", "GL_FLOAT" ],
- [ "GL_RED", "GL_RED", "GL_HALF_FLOAT" ],
- [ "GL_RED", "GL_RED", "GL_HALF_FLOAT_OES" ],
- [ "GL_DEPTH_STENCIL", "GL_DEPTH_STENCIL", "GL_UNSIGNED_INT_24_8" ]
- ],
- "Depth stencil formats":
- [
- [ "GL_DEPTH_COMPONENT16", "GL_DEPTH_COMPONENT", "GL_UNSIGNED_SHORT" ],
- [ "GL_DEPTH_COMPONENT24", "GL_DEPTH_COMPONENT", "GL_UNSIGNED_INT" ],
- [ "GL_DEPTH_COMPONENT16", "GL_DEPTH_COMPONENT", "GL_UNSIGNED_INT" ],
- [ "GL_DEPTH_COMPONENT32F", "GL_DEPTH_COMPONENT", "GL_FLOAT" ],
- [ "GL_DEPTH24_STENCIL8", "GL_DEPTH_STENCIL", "GL_UNSIGNED_INT_24_8" ],
- [ "GL_DEPTH32F_STENCIL8", "GL_DEPTH_STENCIL", "GL_FLOAT_32_UNSIGNED_INT_24_8_REV" ]
- ],
- "From GL_EXT_sRGB":
- [
- [ "GL_SRGB8_ALPHA8_EXT", "GL_SRGB_ALPHA_EXT", "GL_UNSIGNED_BYTE" ],
- [ "GL_SRGB8", "GL_SRGB_EXT", "GL_UNSIGNED_BYTE" ]
- ],
- "From GL_OES_texture_float":
- [
- [ "GL_RGBA", "GL_RGBA", "GL_FLOAT" ],
- [ "GL_RGB", "GL_RGB", "GL_FLOAT" ],
- [ "GL_LUMINANCE_ALPHA", "GL_LUMINANCE_ALPHA", "GL_FLOAT" ],
- [ "GL_LUMINANCE", "GL_LUMINANCE", "GL_FLOAT" ],
- [ "GL_ALPHA", "GL_ALPHA", "GL_FLOAT" ]
- ],
- "From GL_OES_texture_half_float":
- [
- [ "GL_RGBA", "GL_RGBA", "GL_HALF_FLOAT_OES" ],
- [ "GL_RGB", "GL_RGB", "GL_HALF_FLOAT_OES" ],
- [ "GL_LUMINANCE_ALPHA", "GL_LUMINANCE_ALPHA", "GL_HALF_FLOAT" ],
- [ "GL_LUMINANCE_ALPHA", "GL_LUMINANCE_ALPHA", "GL_HALF_FLOAT_OES" ],
- [ "GL_LUMINANCE", "GL_LUMINANCE", "GL_HALF_FLOAT" ],
- [ "GL_LUMINANCE", "GL_LUMINANCE", "GL_HALF_FLOAT_OES" ],
- [ "GL_ALPHA", "GL_ALPHA", "GL_HALF_FLOAT" ],
- [ "GL_ALPHA", "GL_ALPHA", "GL_HALF_FLOAT_OES" ]
- ],
- "From GL_EXT_texture_format_BGRA8888":
- [
- [ "GL_BGRA_EXT", "GL_BGRA_EXT", "GL_UNSIGNED_BYTE" ]
- ],
- "From GL_EXT_texture_storage":
- [
- [ "GL_ALPHA8_EXT", "GL_ALPHA", "GL_UNSIGNED_BYTE" ],
- [ "GL_LUMINANCE8_EXT", "GL_LUMINANCE", "GL_UNSIGNED_BYTE" ],
- [ "GL_LUMINANCE8_ALPHA8_EXT", "GL_LUMINANCE_ALPHA", "GL_UNSIGNED_BYTE" ],
- [ "GL_ALPHA32F_EXT", "GL_ALPHA", "GL_FLOAT" ],
- [ "GL_LUMINANCE32F_EXT", "GL_LUMINANCE", "GL_FLOAT" ],
- [ "GL_LUMINANCE_ALPHA32F_EXT", "GL_LUMINANCE_ALPHA", "GL_FLOAT" ],
- [ "GL_ALPHA16F_EXT", "GL_ALPHA", "GL_HALF_FLOAT" ],
- [ "GL_ALPHA16F_EXT", "GL_ALPHA", "GL_HALF_FLOAT_OES" ],
- [ "GL_LUMINANCE16F_EXT", "GL_LUMINANCE", "GL_HALF_FLOAT" ],
- [ "GL_LUMINANCE16F_EXT", "GL_LUMINANCE", "GL_HALF_FLOAT_OES" ],
- [ "GL_LUMINANCE_ALPHA16F_EXT", "GL_LUMINANCE_ALPHA", "GL_HALF_FLOAT" ],
- [ "GL_LUMINANCE_ALPHA16F_EXT", "GL_LUMINANCE_ALPHA", "GL_HALF_FLOAT_OES" ]
- ],
- "From GL_EXT_texture_storage and GL_EXT_texture_format_BGRA8888":
- [
- [ "GL_BGRA8_EXT", "GL_BGRA_EXT", "GL_UNSIGNED_BYTE" ],
- [ "GL_BGRA4_ANGLEX", "GL_BGRA_EXT", "GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT" ],
- [ "GL_BGRA4_ANGLEX", "GL_BGRA_EXT", "GL_UNSIGNED_BYTE" ],
- [ "GL_BGR5_A1_ANGLEX", "GL_BGRA_EXT", "GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT" ],
- [ "GL_BGR5_A1_ANGLEX", "GL_BGRA_EXT", "GL_UNSIGNED_BYTE" ]
- ],
- "From GL_ANGLE_depth_texture and OES_depth_texture":
- [
- [ "GL_DEPTH_COMPONENT32_OES", "GL_DEPTH_COMPONENT", "GL_UNSIGNED_INT_24_8" ],
- [ "GL_DEPTH_COMPONENT", "GL_DEPTH_COMPONENT", "GL_UNSIGNED_SHORT" ],
- [ "GL_DEPTH_COMPONENT", "GL_DEPTH_COMPONENT", "GL_UNSIGNED_INT" ]
- ],
- "From GL_EXT_texture_norm16":
- [
- [ "GL_R16_EXT", "GL_RED", "GL_UNSIGNED_SHORT" ],
- [ "GL_RG16_EXT", "GL_RG", "GL_UNSIGNED_SHORT" ],
- [ "GL_RGB16_EXT", "GL_RGB", "GL_UNSIGNED_SHORT" ],
- [ "GL_RGBA16_EXT", "GL_RGBA", "GL_UNSIGNED_SHORT" ],
- [ "GL_R16_SNORM_EXT", "GL_RED", "GL_SHORT" ],
- [ "GL_RG16_SNORM_EXT", "GL_RG", "GL_SHORT" ],
- [ "GL_RGB16_SNORM_EXT", "GL_RGB", "GL_SHORT" ],
- [ "GL_RGBA16_SNORM_EXT", "GL_RGBA", "GL_SHORT" ]
- ]
-}
diff --git a/src/3rdparty/angle/src/libANGLE/features.h b/src/3rdparty/angle/src/libANGLE/features.h
deleted file mode 100644
index 48a194ff0b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/features.h
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// 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.
-// TODO(jmadill): Enable on Linux once STL chrono headers are updated.
-#if !defined(ANGLE_STD_ASYNC_WORKERS)
-#if defined(ANGLE_PLATFORM_WINDOWS)
-#define ANGLE_STD_ASYNC_WORKERS ANGLE_ENABLED
-#else
-#define ANGLE_STD_ASYNC_WORKERS ANGLE_DISABLED
-#endif // defined(ANGLE_PLATFORM_WINDOWS)
-#endif // !defined(ANGLE_STD_ASYNC_WORKERS)
-
-#endif // LIBANGLE_FEATURES_H_
diff --git a/src/3rdparty/angle/src/libANGLE/format_map_autogen.cpp b/src/3rdparty/angle/src/libANGLE/format_map_autogen.cpp
deleted file mode 100644
index a7f3ebafc8..0000000000
--- a/src/3rdparty/angle/src/libANGLE/format_map_autogen.cpp
+++ /dev/null
@@ -1,1570 +0,0 @@
-// 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 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.
-//
-// 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_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_S3TC_DXT1_EXT:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- return GL_COMPRESSED_RGB_S3TC_DXT1_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/src/3rdparty/angle/src/libANGLE/format_map_data.json b/src/3rdparty/angle/src/libANGLE/format_map_data.json
deleted file mode 100644
index a4f1c98b4d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/format_map_data.json
+++ /dev/null
@@ -1,142 +0,0 @@
-{
- "GL_RGBA": {
- "GL_UNSIGNED_BYTE": "GL_RGBA8",
- "GL_UNSIGNED_SHORT": "GL_RGBA16_EXT",
- "GL_BYTE": "GL_RGBA8_SNORM",
- "GL_SHORT": "GL_RGBA16_SNORM_EXT",
- "GL_UNSIGNED_SHORT_4_4_4_4": "GL_RGBA4",
- "GL_UNSIGNED_SHORT_5_5_5_1": "GL_RGB5_A1",
- "GL_UNSIGNED_INT_2_10_10_10_REV": "GL_RGB10_A2",
- "GL_FLOAT": "GL_RGBA32F",
- "GL_HALF_FLOAT": "GL_RGBA16F",
- "GL_HALF_FLOAT_OES": "GL_RGBA16F"
- },
- "GL_RGBA_INTEGER": {
- "GL_UNSIGNED_BYTE": "GL_RGBA8UI",
- "GL_BYTE": "GL_RGBA8I",
- "GL_UNSIGNED_SHORT": "GL_RGBA16UI",
- "GL_SHORT": "GL_RGBA16I",
- "GL_UNSIGNED_INT": "GL_RGBA32UI",
- "GL_INT": "GL_RGBA32I",
- "GL_UNSIGNED_INT_2_10_10_10_REV": "GL_RGB10_A2UI"
- },
- "GL_RGB": {
- "GL_UNSIGNED_BYTE": "GL_RGB8",
- "GL_UNSIGNED_SHORT": "GL_RGB16_EXT",
- "GL_BYTE": "GL_RGB8_SNORM",
- "GL_SHORT": "GL_RGB16_SNORM_EXT",
- "GL_UNSIGNED_SHORT_5_6_5": "GL_RGB565",
- "GL_UNSIGNED_INT_10F_11F_11F_REV": "GL_R11F_G11F_B10F",
- "GL_UNSIGNED_INT_5_9_9_9_REV": "GL_RGB9_E5",
- "GL_FLOAT": "GL_RGB32F",
- "GL_HALF_FLOAT": "GL_RGB16F",
- "GL_HALF_FLOAT_OES": "GL_RGB16F"
- },
- "GL_RGB_INTEGER": {
- "GL_UNSIGNED_BYTE": "GL_RGB8UI",
- "GL_BYTE": "GL_RGB8I", "GL_UNSIGNED_SHORT": "GL_RGB16UI",
- "GL_SHORT": "GL_RGB16I",
- "GL_UNSIGNED_INT": "GL_RGB32UI",
- "GL_INT": "GL_RGB32I"
- },
- "GL_RG": {
- "GL_UNSIGNED_BYTE": "GL_RG8",
- "GL_UNSIGNED_SHORT": "GL_RG16_EXT",
- "GL_BYTE": "GL_RG8_SNORM",
- "GL_SHORT": "GL_RG16_SNORM_EXT",
- "GL_FLOAT": "GL_RG32F",
- "GL_HALF_FLOAT": "GL_RG16F",
- "GL_HALF_FLOAT_OES": "GL_RG16F"
- },
- "GL_RG_INTEGER": {
- "GL_UNSIGNED_BYTE": "GL_RG8UI",
- "GL_BYTE": "GL_RG8I",
- "GL_UNSIGNED_SHORT": "GL_RG16UI",
- "GL_SHORT": "GL_RG16I",
- "GL_UNSIGNED_INT": "GL_RG32UI",
- "GL_INT": "GL_RG32I"
- },
- "GL_RED": {
- "GL_UNSIGNED_BYTE": "GL_R8",
- "GL_UNSIGNED_SHORT": "GL_R16_EXT",
- "GL_BYTE": "GL_R8_SNORM",
- "GL_SHORT": "GL_R16_SNORM_EXT",
- "GL_FLOAT": "GL_R32F",
- "GL_HALF_FLOAT": "GL_R16F",
- "GL_HALF_FLOAT_OES": "GL_R16F"
- },
- "GL_RED_INTEGER": {
- "GL_UNSIGNED_BYTE": "GL_R8UI",
- "GL_BYTE": "GL_R8I",
- "GL_UNSIGNED_SHORT": "GL_R16UI",
- "GL_SHORT": "GL_R16I",
- "GL_UNSIGNED_INT": "GL_R32UI",
- "GL_INT": "GL_R32I"
- },
- "GL_LUMINANCE_ALPHA": {
- "GL_UNSIGNED_BYTE": "GL_LUMINANCE8_ALPHA8_EXT",
- "GL_FLOAT": "GL_LUMINANCE_ALPHA32F_EXT",
- "GL_HALF_FLOAT": "GL_LUMINANCE_ALPHA16F_EXT",
- "GL_HALF_FLOAT_OES": "GL_LUMINANCE_ALPHA16F_EXT"
- },
- "GL_LUMINANCE": {
- "GL_UNSIGNED_BYTE": "GL_LUMINANCE8_EXT",
- "GL_FLOAT": "GL_LUMINANCE32F_EXT",
- "GL_HALF_FLOAT": "GL_LUMINANCE16F_EXT",
- "GL_HALF_FLOAT_OES": "GL_LUMINANCE16F_EXT"
- },
- "GL_ALPHA": {
- "GL_UNSIGNED_BYTE": "GL_ALPHA8_EXT",
- "GL_FLOAT": "GL_ALPHA32F_EXT",
- "GL_HALF_FLOAT": "GL_ALPHA16F_EXT",
- "GL_HALF_FLOAT_OES": "GL_ALPHA16F_EXT"
- },
- "GL_BGRA_EXT": {
- "GL_UNSIGNED_BYTE": "GL_BGRA8_EXT",
- "GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT": "GL_BGRA4_ANGLEX",
- "GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT": "GL_BGR5_A1_ANGLEX",
- "GL_UNSIGNED_SHORT_5_6_5": "GL_BGR565_ANGLEX"
- },
- "GL_SRGB_EXT": {
- "GL_UNSIGNED_BYTE": "GL_SRGB8"
- },
- "GL_SRGB_ALPHA_EXT": {
- "GL_UNSIGNED_BYTE": "GL_SRGB8_ALPHA8"
- },
- "GL_COMPRESSED_RGB_S3TC_DXT1_EXT": {
- "GL_UNSIGNED_BYTE": "GL_COMPRESSED_RGB_S3TC_DXT1_EXT"
- },
- "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT": {
- "GL_UNSIGNED_BYTE": "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT"
- },
- "GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE": {
- "GL_UNSIGNED_BYTE": "GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE"
- },
- "GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE": {
- "GL_UNSIGNED_BYTE": "GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE"
- },
- "GL_COMPRESSED_SRGB_S3TC_DXT1_EXT": {
- "GL_UNSIGNED_BYTE": "GL_COMPRESSED_SRGB_S3TC_DXT1_EXT"
- },
- "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT": {
- "GL_UNSIGNED_BYTE": "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT"
- },
- "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT": {
- "GL_UNSIGNED_BYTE": "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT"
- },
- "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT": {
- "GL_UNSIGNED_BYTE": "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT"
- },
- "GL_DEPTH_COMPONENT": {
- "GL_UNSIGNED_SHORT": "GL_DEPTH_COMPONENT16",
- "GL_UNSIGNED_INT": "GL_DEPTH_COMPONENT32_OES",
- "GL_FLOAT": "GL_DEPTH_COMPONENT32F"
- },
- "GL_STENCIL": {
- "GL_UNSIGNED_BYTE": "GL_STENCIL_INDEX8"
- },
- "GL_DEPTH_STENCIL": {
- "GL_UNSIGNED_INT_24_8": "GL_DEPTH24_STENCIL8",
- "GL_FLOAT_32_UNSIGNED_INT_24_8_REV": "GL_DEPTH32F_STENCIL8"
- }
-}
diff --git a/src/3rdparty/angle/src/libANGLE/formatutils.cpp b/src/3rdparty/angle/src/libANGLE/formatutils.cpp
deleted file mode 100644
index 67bb2efdea..0000000000
--- a/src/3rdparty/angle/src/libANGLE/formatutils.cpp
+++ /dev/null
@@ -1,2133 +0,0 @@
-//
-// 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>>;
-
-} // 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;
-}
-
-Type::Type()
- : bytes(0),
- bytesShift(0),
- specialInterpretation(false)
-{
-}
-
-static Type GenTypeInfo(GLuint bytes, bool specialInterpretation)
-{
- Type info;
- info.bytes = bytes;
- GLuint i = 0;
- while ((1u << i) < bytes)
- {
- ++i;
- }
- info.bytesShift = i;
- ASSERT((1u << info.bytesShift) == bytes);
- info.specialInterpretation = specialInterpretation;
- return info;
-}
-
-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;
-}
-
-// Special function for half float formats with three or four channels.
-static bool HalfFloatSupport(const Version &clientVersion, const Extensions &extensions)
-{
- return clientVersion >= Version(3, 0) || extensions.textureHalfFloat;
-}
-
-static bool HalfFloatRGBRenderableSupport(const Version &clientVersion,
- const Extensions &extensions)
-{
- return HalfFloatSupport(clientVersion, extensions) && extensions.colorBufferHalfFloat;
-}
-
-static bool HalfFloatRGBARenderableSupport(const Version &clientVersion,
- const Extensions &extensions)
-{
- return HalfFloatSupport(clientVersion, extensions) &&
- (extensions.colorBufferHalfFloat || extensions.colorBufferFloat);
-}
-
-// Special function for half float formats with one or two channels.
-
-// R16F, RG16F
-static bool HalfFloatRGSupport(const Version &clientVersion, const Extensions &extensions)
-{
- return clientVersion >= Version(3, 0) || (extensions.textureHalfFloat && extensions.textureRG);
-}
-
-// R16F, RG16F
-static bool HalfFloatRGRenderableSupport(const Version &clientVersion, const Extensions &extensions)
-{
- // It's unclear if EXT_color_buffer_half_float gives renderability to non-OES half float
- // textures
- return HalfFloatRGSupport(clientVersion, extensions) &&
- (extensions.colorBufferHalfFloat || extensions.colorBufferFloat);
-}
-
-// RED + HALF_FLOAT_OES, RG + HALF_FLOAT_OES
-static bool UnsizedHalfFloatOESRGSupport(const Version &, const Extensions &extensions)
-{
- return extensions.textureHalfFloat && extensions.textureRG;
-}
-
-// RED + HALF_FLOAT_OES, RG + HALF_FLOAT_OES
-static bool UnsizedHalfFloatOESRGRenderableSupport(const Version &clientVersion,
- const Extensions &extensions)
-{
- return UnsizedHalfFloatOESRGSupport(clientVersion, extensions) &&
- extensions.colorBufferHalfFloat;
-}
-
-// RGB + HALF_FLOAT_OES, RGBA + HALF_FLOAT_OES
-static bool UnsizedHalfFloatOESSupport(const Version &clientVersion, const Extensions &extensions)
-{
- return extensions.textureHalfFloat;
-}
-
-// RGB + HALF_FLOAT_OES, RGBA + HALF_FLOAT_OES
-static bool UnsizedHalfFloatOESRenderableSupport(const Version &clientVersion,
- const Extensions &extensions)
-{
- return UnsizedHalfFloatOESSupport(clientVersion, extensions) && extensions.colorBufferHalfFloat;
-}
-
-// Special function for float formats with three or four channels.
-
-// RGB32F, RGBA32F
-static bool FloatSupport(const Version &clientVersion, const Extensions &extensions)
-{
- return clientVersion >= Version(3, 0) || extensions.textureFloat;
-}
-
-// RGB32F
-static bool FloatRGBRenderableSupport(const Version &clientVersion, const Extensions &extensions)
-{
- return FloatSupport(clientVersion, extensions) && extensions.colorBufferFloatRGB;
-}
-
-// RGBA32F
-static bool FloatRGBARenderableSupport(const Version &clientVersion, const Extensions &extensions)
-{
- return FloatSupport(clientVersion, extensions) &&
- (extensions.colorBufferFloat || extensions.colorBufferFloatRGBA);
-}
-
-// RGB + FLOAT, RGBA + FLOAT
-static bool UnsizedFloatSupport(const Version &clientVersion, const Extensions &extensions)
-{
- return extensions.textureFloat;
-}
-
-// RGB + FLOAT
-static bool UnsizedFloatRGBRenderableSupport(const Version &clientVersion,
- const Extensions &extensions)
-{
- return UnsizedFloatSupport(clientVersion, extensions) && extensions.colorBufferFloatRGB;
-}
-
-// RGBA + FLOAT
-static bool UnsizedFloatRGBARenderableSupport(const Version &clientVersion,
- const Extensions &extensions)
-{
- return UnsizedFloatSupport(clientVersion, extensions) &&
- (extensions.colorBufferFloatRGBA || extensions.colorBufferFloat);
-}
-
-// Special function for float formats with one or two channels.
-
-// R32F, RG32F
-static bool FloatRGSupport(const Version &clientVersion, const Extensions &extensions)
-{
- return clientVersion >= Version(3, 0) || (extensions.textureFloat && extensions.textureRG);
-}
-
-// R32F, RG32F
-static bool FloatRGRenderableSupport(const Version &clientVersion, const Extensions &extensions)
-{
- return FloatRGSupport(clientVersion, extensions) && extensions.colorBufferFloat;
-}
-
-// RED + FLOAT, RG + FLOAT
-static bool UnsizedFloatRGSupport(const Version &clientVersion, const Extensions &extensions)
-{
- return extensions.textureFloat && extensions.textureRG;
-}
-
-// RED + FLOAT, RG + FLOAT
-static bool UnsizedFloatRGRenderableSupport(const Version &clientVersion,
- const Extensions &extensions)
-{
- return FloatRGSupport(clientVersion, extensions) && extensions.colorBufferFloat;
-}
-
-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),
- format(GL_NONE),
- type(GL_NONE),
- componentType(GL_NONE),
- colorEncoding(GL_NONE),
- textureSupport(NeverSupported),
- renderSupport(NeverSupported),
- filterSupport(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();
- return false;
- }
-}
-
-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 FmtHexShort(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 renderSupport,
- InternalFormat::SupportCheckFunction filterSupport)
-{
- 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.renderSupport = renderSupport;
- formatInfo.filterSupport = filterSupport;
-
- 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 renderSupport,
- InternalFormat::SupportCheckFunction filterSupport)
-{
- 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.renderSupport = renderSupport;
- formatInfo.filterSupport = filterSupport;
-
- 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 renderSupport,
- InternalFormat::SupportCheckFunction filterSupport)
-{
- 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.renderSupport = renderSupport;
- formatInfo.filterSupport = filterSupport;
-
- InsertFormatInfo(map, formatInfo);
-}
-
-void AddCompressedFormat(InternalFormatInfoMap *map,
- GLenum internalFormat,
- GLuint compressedBlockWidth,
- GLuint compressedBlockHeight,
- GLuint compressedBlockSize,
- GLuint componentCount,
- GLenum format,
- GLenum type,
- bool srgb,
- InternalFormat::SupportCheckFunction textureSupport,
- InternalFormat::SupportCheckFunction renderSupport,
- InternalFormat::SupportCheckFunction filterSupport)
-{
- InternalFormat formatInfo;
- formatInfo.internalFormat = internalFormat;
- formatInfo.sized = true;
- formatInfo.sizedInternalFormat = internalFormat;
- formatInfo.compressedBlockWidth = compressedBlockWidth;
- formatInfo.compressedBlockHeight = compressedBlockHeight;
- formatInfo.pixelBytes = compressedBlockSize / 8;
- formatInfo.componentCount = componentCount;
- formatInfo.format = format;
- formatInfo.type = type;
- formatInfo.componentType = GL_UNSIGNED_NORMALIZED;
- formatInfo.colorEncoding = (srgb ? GL_SRGB : GL_LINEAR);
- formatInfo.compressed = true;
- formatInfo.textureSupport = textureSupport;
- formatInfo.renderSupport = renderSupport;
- formatInfo.filterSupport = filterSupport;
-
- InsertFormatInfo(map, formatInfo);
-}
-
-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 | Renderable | Filterable |
- AddRGBAFormat(&map, GL_R8, true, 8, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::textureRG>, RequireESOrExt<3, 0, &Extensions::textureRG>, AlwaysSupported);
- AddRGBAFormat(&map, GL_R8_SNORM, true, 8, 0, 0, 0, 0, GL_RED, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- AddRGBAFormat(&map, GL_RG8, true, 8, 8, 0, 0, 0, GL_RG, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::textureRG>, RequireESOrExt<3, 0, &Extensions::textureRG>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RG8_SNORM, true, 8, 8, 0, 0, 0, GL_RG, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGB8, true, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGB8_SNORM, true, 8, 8, 8, 0, 0, GL_RGB, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGB565, true, 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGBA4, true, 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGB5_A1, true, 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGBA8, true, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGBA8_SNORM, true, 8, 8, 8, 8, 0, GL_RGBA, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- 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>, RequireES<3, 0>, AlwaysSupported);
- 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>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_SRGB8, true, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireESOrExt<3, 0, &Extensions::sRGB>, NeverSupported, AlwaysSupported);
- AddRGBAFormat(&map, GL_SRGB8_ALPHA8, true, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireESOrExt<3, 0, &Extensions::sRGB>, RequireESOrExt<3, 0, &Extensions::sRGB>, AlwaysSupported);
- 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>, NeverSupported, AlwaysSupported);
- AddRGBAFormat(&map, GL_R8I, true, 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_R8UI, true, 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_R16I, true, 16, 0, 0, 0, 0, GL_RED_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_R16UI, true, 16, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_R32I, true, 32, 0, 0, 0, 0, GL_RED_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_R32UI, true, 32, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_RG8I, true, 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_RG8UI, true, 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_RG16I, true, 16, 16, 0, 0, 0, GL_RG_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_RG16UI, true, 16, 16, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_RG32I, true, 32, 32, 0, 0, 0, GL_RG_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- 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>, RequireExt<&Extensions::colorBufferFloat>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RG32UI, true, 32, 32, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_RGB8I, true, 8, 8, 8, 0, 0, GL_RGB_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RGB16I, true, 16, 16, 16, 0, 0, GL_RGB_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RGB32I, true, 32, 32, 32, 0, 0, GL_RGB_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RGBA8I, true, 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_RGBA8UI, true, 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_RGBA16I, true, 16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_RGBA16UI, true, 16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_RGBA32I, true, 32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
- AddRGBAFormat(&map, GL_RGBA32UI, true, 32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
-
- AddRGBAFormat(&map, GL_BGRA8_EXT, true, 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureFormatBGRA8888>, RequireExt<&Extensions::textureFormatBGRA8888>, AlwaysSupported);
- 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>, RequireExt<&Extensions::textureFormatBGRA8888>, AlwaysSupported);
- 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>, RequireExt<&Extensions::textureFormatBGRA8888>, AlwaysSupported);
-
- // Special format which is not really supported, so always false for all supports.
- 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);
-
- // Floating point renderability and filtering is provided by OES_texture_float and OES_texture_half_float
- // | Internal format |sized| D |S | Format | Type | Comp | SRGB | Texture supported | Renderable | Filterable |
- // | | | | | | | type | | | | |
- AddRGBAFormat(&map, GL_R16F, true, 16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT, GL_FLOAT, false, HalfFloatRGSupport, HalfFloatRGRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
- AddRGBAFormat(&map, GL_RG16F, true, 16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT, GL_FLOAT, false, HalfFloatRGSupport, HalfFloatRGRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
- AddRGBAFormat(&map, GL_RGB16F, true, 16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT, GL_FLOAT, false, HalfFloatSupport, HalfFloatRGBRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
- AddRGBAFormat(&map, GL_RGBA16F, true, 16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT, GL_FLOAT, false, HalfFloatSupport, HalfFloatRGBARenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
- AddRGBAFormat(&map, GL_R32F, true, 32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, FloatRGSupport, FloatRGRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
- AddRGBAFormat(&map, GL_RG32F, true, 32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, FloatRGSupport, FloatRGRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
- AddRGBAFormat(&map, GL_RGB32F, true, 32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, FloatSupport, FloatRGBRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
- AddRGBAFormat(&map, GL_RGBA32F, true, 32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, FloatSupport, FloatRGBARenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
-
- // Depth stencil formats
- // | Internal format |sized| D |S | X | Format | Type | Component type | Supported | Renderable | Filterable |
- AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT16, true, 16, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, RequireES<2, 0>, RequireESOrExt<3, 0, &Extensions::depthTextures>);
- AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT24, true, 24, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireES<3, 0>, RequireES<3, 0>, RequireESOrExt<3, 0, &Extensions::depthTextures>);
- AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT32F, true, 32, 0, 0, GL_DEPTH_COMPONENT, GL_FLOAT, GL_FLOAT, RequireES<3, 0>, RequireES<3, 0>, RequireESOrExt<3, 0, &Extensions::depthTextures>);
- AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT32_OES, true, 32, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireExtOrExt<&Extensions::depthTextures, &Extensions::depth32>, RequireExtOrExt<&Extensions::depthTextures, &Extensions::depth32>, AlwaysSupported );
- AddDepthStencilFormat(&map, GL_DEPTH24_STENCIL8, true, 24, 8, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_UNSIGNED_NORMALIZED, RequireESOrExt<3, 0, &Extensions::depthTextures>, RequireESOrExtOrExt<3, 0, &Extensions::depthTextures, &Extensions::packedDepthStencil>, AlwaysSupported );
- 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>, RequireES<3, 0>, AlwaysSupported );
- // STENCIL_INDEX8 is special-cased, see around the bottom of the list.
-
- // Luminance alpha formats
- // | Internal format |sized| L | A | Format | Type | Component type | Supported | Renderable | Filterable |
- AddLUMAFormat(&map, GL_ALPHA8_EXT, true, 0, 8, GL_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt<&Extensions::textureStorage>, NeverSupported, AlwaysSupported);
- AddLUMAFormat(&map, GL_LUMINANCE8_EXT, true, 8, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt<&Extensions::textureStorage>, NeverSupported, AlwaysSupported);
- AddLUMAFormat(&map, GL_LUMINANCE8_ALPHA8_EXT, true, 8, 8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt<&Extensions::textureStorage>, NeverSupported, AlwaysSupported);
- AddLUMAFormat(&map, GL_ALPHA16F_EXT, true, 0, 16, GL_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, NeverSupported, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
- AddLUMAFormat(&map, GL_LUMINANCE16F_EXT, true, 16, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, NeverSupported, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
- AddLUMAFormat(&map, GL_LUMINANCE_ALPHA16F_EXT, true, 16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, NeverSupported, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
- AddLUMAFormat(&map, GL_ALPHA32F_EXT, true, 0, 32, GL_ALPHA, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear>);
- AddLUMAFormat(&map, GL_LUMINANCE32F_EXT, true, 32, 0, GL_LUMINANCE, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear>);
- AddLUMAFormat(&map, GL_LUMINANCE_ALPHA32F_EXT, true, 32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear>);
-
- // Compressed formats, From ES 3.0.1 spec, table 3.16
- // | Internal format |W |H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable |
- AddCompressedFormat(&map, GL_COMPRESSED_R11_EAC, 4, 4, 64, 1, GL_RED, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SIGNED_R11_EAC, 4, 4, 64, 1, GL_RED, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RG11_EAC, 4, 4, 128, 2, GL_RG, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SIGNED_RG11_EAC, 4, 4, 128, 2, GL_RG, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGB8_ETC2, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ETC2, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, true, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, true, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA8_ETC2_EAC, 4, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 4, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireES<3, 0>, NeverSupported, AlwaysSupported);
-
- // From GL_EXT_texture_compression_dxt1
- // | Internal format |W |H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable |
- AddCompressedFormat(&map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, false, RequireExt<&Extensions::textureCompressionDXT1>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 4, 4, 64, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExt<&Extensions::textureCompressionDXT1>, NeverSupported, AlwaysSupported);
-
- // From GL_ANGLE_texture_compression_dxt3
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, 4, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExt<&Extensions::textureCompressionDXT3>, NeverSupported, AlwaysSupported);
-
- // From GL_ANGLE_texture_compression_dxt5
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, 4, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExt<&Extensions::textureCompressionDXT5>, NeverSupported, AlwaysSupported);
-
- // From GL_OES_compressed_ETC1_RGB8_texture
- AddCompressedFormat(&map, GL_ETC1_RGB8_OES, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, false, RequireExt<&Extensions::compressedETC1RGB8Texture>, NeverSupported, AlwaysSupported);
-
- // From GL_EXT_texture_compression_s3tc_srgb
- // | Internal format |W |H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable |
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, true, RequireExt<&Extensions::textureCompressionS3TCsRGB>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 4, 4, 64, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExt<&Extensions::textureCompressionS3TCsRGB>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 4, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExt<&Extensions::textureCompressionS3TCsRGB>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 4, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExt<&Extensions::textureCompressionS3TCsRGB>, NeverSupported, AlwaysSupported);
-
- // From KHR_texture_compression_astc_hdr
- // | Internal format | W | H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable |
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, 4, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_5x4_KHR, 5, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_5x5_KHR, 5, 5, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_6x5_KHR, 6, 5, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_6x6_KHR, 6, 6, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_8x5_KHR, 8, 5, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_8x6_KHR, 8, 6, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_8x8_KHR, 8, 8, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_10x5_KHR, 10, 5, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_10x6_KHR, 10, 6, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_10x8_KHR, 10, 8, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_10x10_KHR, 10, 10, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_12x10_KHR, 12, 10, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_12x12_KHR, 12, 12, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
-
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, 4, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, 5, 4, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, 5, 5, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, 6, 5, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, 6, 6, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, 8, 5, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, 8, 6, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, 8, 8, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, 10, 5, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, 10, 6, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, 10, 8, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, 10, 10, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, 12, 10, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, 12, 12, 128, 4, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExtOrExt<&Extensions::textureCompressionASTCHDR, &Extensions::textureCompressionASTCLDR>, NeverSupported, AlwaysSupported);
-
- // For STENCIL_INDEX8 we chose a normalized component type for the following reasons:
- // - Multisampled buffer are disallowed for non-normalized integer component types and we want to support it for STENCIL_INDEX8
- // - All other stencil formats (all depth-stencil) are either float or normalized
- // - It affects only validation of internalformat in RenderbufferStorageMultisample.
- // | Internal format |sized|D |S |X | Format | Type | Component type | Supported | Renderable | Filterable |
- AddDepthStencilFormat(&map, GL_STENCIL_INDEX8, true, 0, 8, 0, GL_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, RequireES<2, 0>, NeverSupported);
-
- // From GL_ANGLE_lossy_etc_decode
- // | Internal format |W |H |BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable |
- AddCompressedFormat(&map, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, false, RequireExt<&Extensions::lossyETCDecode>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, false, RequireExt<&Extensions::lossyETCDecode>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE, 4, 4, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, true, RequireExt<&Extensions::lossyETCDecode>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE, 4, 4, 64, 3, GL_RGBA, GL_UNSIGNED_BYTE, false, RequireExt<&Extensions::lossyETCDecode>, NeverSupported, AlwaysSupported);
- AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE, 4, 4, 64, 3, GL_RGBA, GL_UNSIGNED_BYTE, true, RequireExt<&Extensions::lossyETCDecode>, NeverSupported, AlwaysSupported);
-
- // From GL_EXT_texture_norm16
- // | Internal format |sized| R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Renderable | Filterable |
- AddRGBAFormat(&map, GL_R16_EXT, true, 16, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, RequireExt<&Extensions::textureNorm16>, AlwaysSupported);
- AddRGBAFormat(&map, GL_R16_SNORM_EXT, true, 16, 0, 0, 0, 0, GL_RED, GL_SHORT, GL_SIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, NeverSupported, AlwaysSupported);
- AddRGBAFormat(&map, GL_RG16_EXT, true, 16, 16, 0, 0, 0, GL_RG, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, RequireExt<&Extensions::textureNorm16>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RG16_SNORM_EXT, true, 16, 16, 0, 0, 0, GL_RG, GL_SHORT, GL_SIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, NeverSupported, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGB16_EXT, true, 16, 16, 16, 0, 0, GL_RGB, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, NeverSupported, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGB16_SNORM_EXT, true, 16, 16, 16, 0, 0, GL_RGB, GL_SHORT, GL_SIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, NeverSupported, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGBA16_EXT, true, 16, 16, 16, 16, 0, GL_RGBA, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, RequireExt<&Extensions::textureNorm16>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGBA16_SNORM_EXT, true, 16, 16, 16, 16, 0, GL_RGBA, GL_SHORT, GL_SIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, NeverSupported, AlwaysSupported);
-
- // Unsized formats
- // | Internal format |sized | R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Renderable | Filterable |
- AddRGBAFormat(&map, GL_RED, false, 8, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureRG>, AlwaysSupported, AlwaysSupported);
- AddRGBAFormat(&map, GL_RED, false, 8, 0, 0, 0, 0, GL_RED, GL_BYTE, GL_SIGNED_NORMALIZED, false, 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, AlwaysSupported);
- AddRGBAFormat(&map, GL_RG, false, 8, 8, 0, 0, 0, GL_RG, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported );
- AddRGBAFormat(&map, GL_RGB, false, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, AlwaysSupported, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGB, false, 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGB, false, 8, 8, 8, 0, 0, GL_RGB, GL_BYTE, GL_SIGNED_NORMALIZED, false, 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, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGBA, false, 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGBA, false, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGBA, false, 10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
- AddRGBAFormat(&map, GL_RGBA, false, 8, 8, 8, 8, 0, GL_RGBA, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported );
- AddRGBAFormat(&map, GL_SRGB, false, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireExt<&Extensions::sRGB>, NeverSupported, AlwaysSupported);
- AddRGBAFormat(&map, GL_SRGB_ALPHA_EXT, false, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireExt<&Extensions::sRGB>, RequireExt<&Extensions::sRGB>, AlwaysSupported);
-
- AddRGBAFormat(&map, GL_BGRA_EXT, false, 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureFormatBGRA8888>, RequireExt<&Extensions::textureFormatBGRA8888>, AlwaysSupported);
-
- // Unsized integer formats
- // |Internal format |sized | R | G | B | A |S | Format | Type | Component type | SRGB | Texture | Renderable | Filterable |
- AddRGBAFormat(&map, GL_RED_INTEGER, false, 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RED_INTEGER, false, 16, 0, 0, 0, 0, GL_RED_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RED_INTEGER, false, 32, 0, 0, 0, 0, GL_RED_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RG_INTEGER, false, 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RG_INTEGER, false, 16, 16, 0, 0, 0, GL_RG_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RG_INTEGER, false, 32, 32, 0, 0, 0, GL_RG_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RGB_INTEGER, false, 8, 8, 8, 0, 0, GL_RGB_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RGB_INTEGER, false, 16, 16, 16, 0, 0, GL_RGB_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RGB_INTEGER, false, 32, 32, 32, 0, 0, GL_RGB_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RGBA_INTEGER, false, 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RGBA_INTEGER, false, 16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, 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);
- AddRGBAFormat(&map, GL_RGBA_INTEGER, false, 32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, 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);
- 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);
-
- // Unsized floating point formats
- // |Internal format |sized | R | G | B | A |S | Format | Type | Comp | SRGB | Texture supported | Renderable | Filterable |
- AddRGBAFormat(&map, GL_RED, false, 16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported );
- AddRGBAFormat(&map, GL_RG, false, 16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported );
- AddRGBAFormat(&map, GL_RGB, false, 16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported );
- AddRGBAFormat(&map, GL_RGBA, false, 16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported );
- AddRGBAFormat(&map, GL_RED, false, 16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT_OES, GL_FLOAT, false, UnsizedHalfFloatOESRGSupport, UnsizedHalfFloatOESRGRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
- AddRGBAFormat(&map, GL_RG, false, 16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT_OES, GL_FLOAT, false, UnsizedHalfFloatOESRGSupport, UnsizedHalfFloatOESRGRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
- AddRGBAFormat(&map, GL_RGB, false, 16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT_OES, GL_FLOAT, false, UnsizedHalfFloatOESSupport, UnsizedHalfFloatOESRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
- AddRGBAFormat(&map, GL_RGBA, false, 16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT_OES, GL_FLOAT, false, UnsizedHalfFloatOESSupport, UnsizedHalfFloatOESRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
- AddRGBAFormat(&map, GL_RED, false, 32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, UnsizedFloatRGSupport, UnsizedFloatRGRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
- AddRGBAFormat(&map, GL_RG, false, 32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, UnsizedFloatRGSupport, UnsizedFloatRGRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
- AddRGBAFormat(&map, GL_RGB, false, 32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, UnsizedFloatSupport, UnsizedFloatRGBRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
- 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 );
- 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 );
- AddRGBAFormat(&map, GL_RGBA, false, 32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, UnsizedFloatSupport, UnsizedFloatRGBARenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
-
- // Unsized luminance alpha formats
- // | Internal format |sized | L | A | Format | Type | Component type | Supported | Renderable | Filterable |
- AddLUMAFormat(&map, GL_ALPHA, false, 0, 8, GL_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, NeverSupported, AlwaysSupported );
- AddLUMAFormat(&map, GL_LUMINANCE, false, 8, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, NeverSupported, AlwaysSupported );
- AddLUMAFormat(&map, GL_LUMINANCE_ALPHA, false, 8, 8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, NeverSupported, AlwaysSupported );
- AddLUMAFormat(&map, GL_ALPHA, false, 0, 16, GL_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExt<&Extensions::textureHalfFloat>, NeverSupported, RequireExt<&Extensions::textureHalfFloatLinear>);
- AddLUMAFormat(&map, GL_LUMINANCE, false, 16, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExt<&Extensions::textureHalfFloat>, NeverSupported, RequireExt<&Extensions::textureHalfFloatLinear>);
- AddLUMAFormat(&map, GL_LUMINANCE_ALPHA ,false, 16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExt<&Extensions::textureHalfFloat>, NeverSupported, RequireExt<&Extensions::textureHalfFloatLinear>);
- AddLUMAFormat(&map, GL_ALPHA, false, 0, 32, GL_ALPHA, GL_FLOAT, GL_FLOAT, RequireExt<&Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear> );
- AddLUMAFormat(&map, GL_LUMINANCE, false, 32, 0, GL_LUMINANCE, GL_FLOAT, GL_FLOAT, RequireExt<&Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear> );
- AddLUMAFormat(&map, GL_LUMINANCE_ALPHA, false, 32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_FLOAT, RequireExt<&Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear> );
-
- // Unsized depth stencil formats
- // | Internal format |sized | D |S | X | Format | Type | Component type | Supported | Renderable | Filterable |
- AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT, false, 16, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
- AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT, false, 24, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
- AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT, false, 32, 0, 0, GL_DEPTH_COMPONENT, GL_FLOAT, GL_FLOAT, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
- 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>, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>, AlwaysSupported);
- 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>, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>, AlwaysSupported);
- AddDepthStencilFormat(&map, GL_STENCIL, false, 0, 8, 0, GL_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, RequireES<2, 0>, NeverSupported);
- // 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;
-}
-
-const Type &GetTypeInfo(GLenum type)
-{
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_BYTE:
- {
- static const Type info = GenTypeInfo(1, false);
- return info;
- }
- case GL_UNSIGNED_SHORT:
- case GL_SHORT:
- case GL_HALF_FLOAT:
- case GL_HALF_FLOAT_OES:
- {
- static const Type info = GenTypeInfo(2, false);
- return info;
- }
- case GL_UNSIGNED_INT:
- case GL_INT:
- case GL_FLOAT:
- {
- static const Type info = GenTypeInfo(4, false);
- return info;
- }
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
- {
- static const Type info = GenTypeInfo(2, true);
- return info;
- }
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- case GL_UNSIGNED_INT_24_8:
- case GL_UNSIGNED_INT_10F_11F_11F_REV:
- case GL_UNSIGNED_INT_5_9_9_9_REV:
- {
- ASSERT(GL_UNSIGNED_INT_24_8_OES == GL_UNSIGNED_INT_24_8);
- static const Type info = GenTypeInfo(4, true);
- return info;
- }
- case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
- {
- static const Type info = GenTypeInfo(8, true);
- return info;
- }
- default:
- {
- static const Type defaultInfo;
- return defaultInfo;
- }
- }
-}
-
-const InternalFormat &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;
-}
-
-ErrorOrResult<GLuint> InternalFormat::computeRowPitch(GLenum formatType,
- GLsizei width,
- GLint alignment,
- GLint rowLength) const
-{
- // Compressed images do not use pack/unpack parameters.
- if (compressed)
- {
- ASSERT(rowLength == 0);
- return computeCompressedImageSize(Extents(width, 1, 1));
- }
-
- 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);
- ANGLE_TRY_CHECKED_MATH(aligned);
- return aligned.ValueOrDie();
-}
-
-ErrorOrResult<GLuint> InternalFormat::computeDepthPitch(GLsizei height,
- GLint imageHeight,
- GLuint rowPitch) const
-{
- GLuint rows =
- (imageHeight > 0 ? static_cast<GLuint>(imageHeight) : static_cast<GLuint>(height));
- CheckedNumeric<GLuint> checkedRowPitch(rowPitch);
-
- auto depthPitch = checkedRowPitch * rows;
- ANGLE_TRY_CHECKED_MATH(depthPitch);
- return depthPitch.ValueOrDie();
-}
-
-ErrorOrResult<GLuint> InternalFormat::computeDepthPitch(GLenum formatType,
- GLsizei width,
- GLsizei height,
- GLint alignment,
- GLint rowLength,
- GLint imageHeight) const
-{
- GLuint rowPitch = 0;
- ANGLE_TRY_RESULT(computeRowPitch(formatType, width, alignment, rowLength), rowPitch);
- return computeDepthPitch(height, imageHeight, rowPitch);
-}
-
-ErrorOrResult<GLuint> InternalFormat::computeCompressedImageSize(const Extents &size) 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;
- ANGLE_TRY_CHECKED_MATH(bytes);
- return bytes.ValueOrDie();
-}
-
-ErrorOrResult<GLuint> InternalFormat::computeSkipBytes(GLuint rowPitch,
- GLuint depthPitch,
- const PixelStoreStateBase &state,
- bool is3D) 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(pixelBytes);
- auto checkedSkipImagesBytes = checkedSkipImages * checkedDepthPitch;
- if (!is3D)
- {
- checkedSkipImagesBytes = 0;
- }
- auto skipBytes = checkedSkipImagesBytes + checkedSkipRows * checkedRowPitch +
- checkedSkipPixels * checkedPixelBytes;
- ANGLE_TRY_CHECKED_MATH(skipBytes);
- return skipBytes.ValueOrDie();
-}
-
-ErrorOrResult<GLuint> InternalFormat::computePackUnpackEndByte(
- GLenum formatType,
- const Extents &size,
- const PixelStoreStateBase &state,
- bool is3D) const
-{
- GLuint rowPitch = 0;
- ANGLE_TRY_RESULT(computeRowPitch(formatType, size.width, state.alignment, state.rowLength),
- rowPitch);
-
- GLuint depthPitch = 0;
- if (is3D)
- {
- ANGLE_TRY_RESULT(computeDepthPitch(size.height, state.imageHeight, rowPitch), depthPitch);
- }
-
- CheckedNumeric<GLuint> checkedCopyBytes = 0;
- if (compressed)
- {
- ANGLE_TRY_RESULT(computeCompressedImageSize(size), checkedCopyBytes);
- }
- 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;
- }
- }
-
- CheckedNumeric<GLuint> checkedSkipBytes = 0;
- ANGLE_TRY_RESULT(computeSkipBytes(rowPitch, depthPitch, state, is3D), checkedSkipBytes);
-
- CheckedNumeric<GLuint> endByte = checkedCopyBytes + checkedSkipBytes;
-
- ANGLE_TRY_CHECKED_MATH(endByte);
- return endByte.ValueOrDie();
-}
-
-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();
- return ATTRIBUTE_FLOAT;
- }
-}
-
-VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint components, bool pureInteger)
-{
- switch (type)
- {
- case GL_BYTE:
- switch (components)
- {
- case 1:
- if (pureInteger)
- return VERTEX_FORMAT_SBYTE1_INT;
- if (normalized)
- return VERTEX_FORMAT_SBYTE1_NORM;
- return VERTEX_FORMAT_SBYTE1;
- case 2:
- if (pureInteger)
- return VERTEX_FORMAT_SBYTE2_INT;
- if (normalized)
- return VERTEX_FORMAT_SBYTE2_NORM;
- return VERTEX_FORMAT_SBYTE2;
- case 3:
- if (pureInteger)
- return VERTEX_FORMAT_SBYTE3_INT;
- if (normalized)
- return VERTEX_FORMAT_SBYTE3_NORM;
- return VERTEX_FORMAT_SBYTE3;
- case 4:
- if (pureInteger)
- return VERTEX_FORMAT_SBYTE4_INT;
- if (normalized)
- return VERTEX_FORMAT_SBYTE4_NORM;
- return VERTEX_FORMAT_SBYTE4;
- default:
- UNREACHABLE();
- break;
- }
- case GL_UNSIGNED_BYTE:
- switch (components)
- {
- case 1:
- if (pureInteger)
- return VERTEX_FORMAT_UBYTE1_INT;
- if (normalized)
- return VERTEX_FORMAT_UBYTE1_NORM;
- return VERTEX_FORMAT_UBYTE1;
- case 2:
- if (pureInteger)
- return VERTEX_FORMAT_UBYTE2_INT;
- if (normalized)
- return VERTEX_FORMAT_UBYTE2_NORM;
- return VERTEX_FORMAT_UBYTE2;
- case 3:
- if (pureInteger)
- return VERTEX_FORMAT_UBYTE3_INT;
- if (normalized)
- return VERTEX_FORMAT_UBYTE3_NORM;
- return VERTEX_FORMAT_UBYTE3;
- case 4:
- if (pureInteger)
- return VERTEX_FORMAT_UBYTE4_INT;
- if (normalized)
- return VERTEX_FORMAT_UBYTE4_NORM;
- return VERTEX_FORMAT_UBYTE4;
- default:
- UNREACHABLE();
- break;
- }
- case GL_SHORT:
- switch (components)
- {
- case 1:
- if (pureInteger)
- return VERTEX_FORMAT_SSHORT1_INT;
- if (normalized)
- return VERTEX_FORMAT_SSHORT1_NORM;
- return VERTEX_FORMAT_SSHORT1;
- case 2:
- if (pureInteger)
- return VERTEX_FORMAT_SSHORT2_INT;
- if (normalized)
- return VERTEX_FORMAT_SSHORT2_NORM;
- return VERTEX_FORMAT_SSHORT2;
- case 3:
- if (pureInteger)
- return VERTEX_FORMAT_SSHORT3_INT;
- if (normalized)
- return VERTEX_FORMAT_SSHORT3_NORM;
- return VERTEX_FORMAT_SSHORT3;
- case 4:
- if (pureInteger)
- return VERTEX_FORMAT_SSHORT4_INT;
- if (normalized)
- return VERTEX_FORMAT_SSHORT4_NORM;
- return VERTEX_FORMAT_SSHORT4;
- default:
- UNREACHABLE();
- break;
- }
- case GL_UNSIGNED_SHORT:
- switch (components)
- {
- case 1:
- if (pureInteger)
- return VERTEX_FORMAT_USHORT1_INT;
- if (normalized)
- return VERTEX_FORMAT_USHORT1_NORM;
- return VERTEX_FORMAT_USHORT1;
- case 2:
- if (pureInteger)
- return VERTEX_FORMAT_USHORT2_INT;
- if (normalized)
- return VERTEX_FORMAT_USHORT2_NORM;
- return VERTEX_FORMAT_USHORT2;
- case 3:
- if (pureInteger)
- return VERTEX_FORMAT_USHORT3_INT;
- if (normalized)
- return VERTEX_FORMAT_USHORT3_NORM;
- return VERTEX_FORMAT_USHORT3;
- case 4:
- if (pureInteger)
- return VERTEX_FORMAT_USHORT4_INT;
- if (normalized)
- return VERTEX_FORMAT_USHORT4_NORM;
- return VERTEX_FORMAT_USHORT4;
- default:
- UNREACHABLE();
- break;
- }
- case GL_INT:
- switch (components)
- {
- case 1:
- if (pureInteger)
- return VERTEX_FORMAT_SINT1_INT;
- if (normalized)
- return VERTEX_FORMAT_SINT1_NORM;
- return VERTEX_FORMAT_SINT1;
- case 2:
- if (pureInteger)
- return VERTEX_FORMAT_SINT2_INT;
- if (normalized)
- return VERTEX_FORMAT_SINT2_NORM;
- return VERTEX_FORMAT_SINT2;
- case 3:
- if (pureInteger)
- return VERTEX_FORMAT_SINT3_INT;
- if (normalized)
- return VERTEX_FORMAT_SINT3_NORM;
- return VERTEX_FORMAT_SINT3;
- case 4:
- if (pureInteger)
- return VERTEX_FORMAT_SINT4_INT;
- if (normalized)
- return VERTEX_FORMAT_SINT4_NORM;
- return VERTEX_FORMAT_SINT4;
- default:
- UNREACHABLE();
- break;
- }
- case GL_UNSIGNED_INT:
- switch (components)
- {
- case 1:
- if (pureInteger)
- return VERTEX_FORMAT_UINT1_INT;
- if (normalized)
- return VERTEX_FORMAT_UINT1_NORM;
- return VERTEX_FORMAT_UINT1;
- case 2:
- if (pureInteger)
- return VERTEX_FORMAT_UINT2_INT;
- if (normalized)
- return VERTEX_FORMAT_UINT2_NORM;
- return VERTEX_FORMAT_UINT2;
- case 3:
- if (pureInteger)
- return VERTEX_FORMAT_UINT3_INT;
- if (normalized)
- return VERTEX_FORMAT_UINT3_NORM;
- return VERTEX_FORMAT_UINT3;
- case 4:
- if (pureInteger)
- return VERTEX_FORMAT_UINT4_INT;
- if (normalized)
- return VERTEX_FORMAT_UINT4_NORM;
- return VERTEX_FORMAT_UINT4;
- default:
- UNREACHABLE();
- break;
- }
- case GL_FLOAT:
- switch (components)
- {
- case 1:
- return VERTEX_FORMAT_FLOAT1;
- case 2:
- return VERTEX_FORMAT_FLOAT2;
- case 3:
- return VERTEX_FORMAT_FLOAT3;
- case 4:
- return VERTEX_FORMAT_FLOAT4;
- default:
- UNREACHABLE();
- break;
- }
- case GL_HALF_FLOAT:
- switch (components)
- {
- case 1:
- return VERTEX_FORMAT_HALF1;
- case 2:
- return VERTEX_FORMAT_HALF2;
- case 3:
- return VERTEX_FORMAT_HALF3;
- case 4:
- return VERTEX_FORMAT_HALF4;
- default:
- UNREACHABLE();
- break;
- }
- case GL_FIXED:
- switch (components)
- {
- case 1:
- return VERTEX_FORMAT_FIXED1;
- case 2:
- return VERTEX_FORMAT_FIXED2;
- case 3:
- return VERTEX_FORMAT_FIXED3;
- case 4:
- return VERTEX_FORMAT_FIXED4;
- default:
- UNREACHABLE();
- break;
- }
- case GL_INT_2_10_10_10_REV:
- if (pureInteger)
- return VERTEX_FORMAT_SINT210_INT;
- if (normalized)
- return VERTEX_FORMAT_SINT210_NORM;
- return VERTEX_FORMAT_SINT210;
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- if (pureInteger)
- return VERTEX_FORMAT_UINT210_INT;
- if (normalized)
- return VERTEX_FORMAT_UINT210_NORM;
- return VERTEX_FORMAT_UINT210;
- default:
- UNREACHABLE();
- break;
- }
- return VERTEX_FORMAT_UBYTE1;
-}
-
-VertexFormatType GetVertexFormatType(const VertexAttribute &attrib)
-{
- return GetVertexFormatType(attrib.type, attrib.normalized, attrib.size, attrib.pureInteger);
-}
-
-VertexFormatType GetVertexFormatType(const VertexAttribute &attrib, GLenum currentValueType)
-{
- if (!attrib.enabled)
- {
- return GetVertexFormatType(currentValueType, GL_FALSE, 4, (currentValueType != GL_FLOAT));
- }
- return GetVertexFormatType(attrib);
-}
-
-const VertexFormat &GetVertexFormatFromType(VertexFormatType vertexFormatType)
-{
- switch (vertexFormatType)
- {
- case VERTEX_FORMAT_SBYTE1:
- {
- static const VertexFormat format(GL_BYTE, GL_FALSE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_SBYTE1_NORM:
- {
- static const VertexFormat format(GL_BYTE, GL_TRUE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_SBYTE2:
- {
- static const VertexFormat format(GL_BYTE, GL_FALSE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_SBYTE2_NORM:
- {
- static const VertexFormat format(GL_BYTE, GL_TRUE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_SBYTE3:
- {
- static const VertexFormat format(GL_BYTE, GL_FALSE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_SBYTE3_NORM:
- {
- static const VertexFormat format(GL_BYTE, GL_TRUE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_SBYTE4:
- {
- static const VertexFormat format(GL_BYTE, GL_FALSE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_SBYTE4_NORM:
- {
- static const VertexFormat format(GL_BYTE, GL_TRUE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_UBYTE1:
- {
- static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_UBYTE1_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_BYTE, GL_TRUE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_UBYTE2:
- {
- static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_UBYTE2_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_BYTE, GL_TRUE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_UBYTE3:
- {
- static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_UBYTE3_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_BYTE, GL_TRUE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_UBYTE4:
- {
- static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_UBYTE4_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_BYTE, GL_TRUE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_SSHORT1:
- {
- static const VertexFormat format(GL_SHORT, GL_FALSE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_SSHORT1_NORM:
- {
- static const VertexFormat format(GL_SHORT, GL_TRUE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_SSHORT2:
- {
- static const VertexFormat format(GL_SHORT, GL_FALSE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_SSHORT2_NORM:
- {
- static const VertexFormat format(GL_SHORT, GL_TRUE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_SSHORT3:
- {
- static const VertexFormat format(GL_SHORT, GL_FALSE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_SSHORT3_NORM:
- {
- static const VertexFormat format(GL_SHORT, GL_TRUE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_SSHORT4:
- {
- static const VertexFormat format(GL_SHORT, GL_FALSE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_SSHORT4_NORM:
- {
- static const VertexFormat format(GL_SHORT, GL_TRUE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_USHORT1:
- {
- static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_USHORT1_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_SHORT, GL_TRUE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_USHORT2:
- {
- static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_USHORT2_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_SHORT, GL_TRUE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_USHORT3:
- {
- static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_USHORT3_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_SHORT, GL_TRUE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_USHORT4:
- {
- static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_USHORT4_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_SHORT, GL_TRUE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_SINT1:
- {
- static const VertexFormat format(GL_INT, GL_FALSE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_SINT1_NORM:
- {
- static const VertexFormat format(GL_INT, GL_TRUE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_SINT2:
- {
- static const VertexFormat format(GL_INT, GL_FALSE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_SINT2_NORM:
- {
- static const VertexFormat format(GL_INT, GL_TRUE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_SINT3:
- {
- static const VertexFormat format(GL_INT, GL_FALSE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_SINT3_NORM:
- {
- static const VertexFormat format(GL_INT, GL_TRUE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_SINT4:
- {
- static const VertexFormat format(GL_INT, GL_FALSE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_SINT4_NORM:
- {
- static const VertexFormat format(GL_INT, GL_TRUE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_UINT1:
- {
- static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_UINT1_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_INT, GL_TRUE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_UINT2:
- {
- static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_UINT2_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_INT, GL_TRUE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_UINT3:
- {
- static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_UINT3_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_INT, GL_TRUE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_UINT4:
- {
- static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_UINT4_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_INT, GL_TRUE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_SBYTE1_INT:
- {
- static const VertexFormat format(GL_BYTE, GL_FALSE, 1, true);
- return format;
- }
- case VERTEX_FORMAT_SBYTE2_INT:
- {
- static const VertexFormat format(GL_BYTE, GL_FALSE, 2, true);
- return format;
- }
- case VERTEX_FORMAT_SBYTE3_INT:
- {
- static const VertexFormat format(GL_BYTE, GL_FALSE, 3, true);
- return format;
- }
- case VERTEX_FORMAT_SBYTE4_INT:
- {
- static const VertexFormat format(GL_BYTE, GL_FALSE, 4, true);
- return format;
- }
- case VERTEX_FORMAT_UBYTE1_INT:
- {
- static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 1, true);
- return format;
- }
- case VERTEX_FORMAT_UBYTE2_INT:
- {
- static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 2, true);
- return format;
- }
- case VERTEX_FORMAT_UBYTE3_INT:
- {
- static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 3, true);
- return format;
- }
- case VERTEX_FORMAT_UBYTE4_INT:
- {
- static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 4, true);
- return format;
- }
- case VERTEX_FORMAT_SSHORT1_INT:
- {
- static const VertexFormat format(GL_SHORT, GL_FALSE, 1, true);
- return format;
- }
- case VERTEX_FORMAT_SSHORT2_INT:
- {
- static const VertexFormat format(GL_SHORT, GL_FALSE, 2, true);
- return format;
- }
- case VERTEX_FORMAT_SSHORT3_INT:
- {
- static const VertexFormat format(GL_SHORT, GL_FALSE, 3, true);
- return format;
- }
- case VERTEX_FORMAT_SSHORT4_INT:
- {
- static const VertexFormat format(GL_SHORT, GL_FALSE, 4, true);
- return format;
- }
- case VERTEX_FORMAT_USHORT1_INT:
- {
- static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 1, true);
- return format;
- }
- case VERTEX_FORMAT_USHORT2_INT:
- {
- static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 2, true);
- return format;
- }
- case VERTEX_FORMAT_USHORT3_INT:
- {
- static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 3, true);
- return format;
- }
- case VERTEX_FORMAT_USHORT4_INT:
- {
- static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 4, true);
- return format;
- }
- case VERTEX_FORMAT_SINT1_INT:
- {
- static const VertexFormat format(GL_INT, GL_FALSE, 1, true);
- return format;
- }
- case VERTEX_FORMAT_SINT2_INT:
- {
- static const VertexFormat format(GL_INT, GL_FALSE, 2, true);
- return format;
- }
- case VERTEX_FORMAT_SINT3_INT:
- {
- static const VertexFormat format(GL_INT, GL_FALSE, 3, true);
- return format;
- }
- case VERTEX_FORMAT_SINT4_INT:
- {
- static const VertexFormat format(GL_INT, GL_FALSE, 4, true);
- return format;
- }
- case VERTEX_FORMAT_UINT1_INT:
- {
- static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 1, true);
- return format;
- }
- case VERTEX_FORMAT_UINT2_INT:
- {
- static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 2, true);
- return format;
- }
- case VERTEX_FORMAT_UINT3_INT:
- {
- static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 3, true);
- return format;
- }
- case VERTEX_FORMAT_UINT4_INT:
- {
- static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 4, true);
- return format;
- }
- case VERTEX_FORMAT_FIXED1:
- {
- static const VertexFormat format(GL_FIXED, GL_FALSE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_FIXED2:
- {
- static const VertexFormat format(GL_FIXED, GL_FALSE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_FIXED3:
- {
- static const VertexFormat format(GL_FIXED, GL_FALSE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_FIXED4:
- {
- static const VertexFormat format(GL_FIXED, GL_FALSE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_HALF1:
- {
- static const VertexFormat format(GL_HALF_FLOAT, GL_FALSE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_HALF2:
- {
- static const VertexFormat format(GL_HALF_FLOAT, GL_FALSE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_HALF3:
- {
- static const VertexFormat format(GL_HALF_FLOAT, GL_FALSE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_HALF4:
- {
- static const VertexFormat format(GL_HALF_FLOAT, GL_FALSE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_FLOAT1:
- {
- static const VertexFormat format(GL_FLOAT, GL_FALSE, 1, false);
- return format;
- }
- case VERTEX_FORMAT_FLOAT2:
- {
- static const VertexFormat format(GL_FLOAT, GL_FALSE, 2, false);
- return format;
- }
- case VERTEX_FORMAT_FLOAT3:
- {
- static const VertexFormat format(GL_FLOAT, GL_FALSE, 3, false);
- return format;
- }
- case VERTEX_FORMAT_FLOAT4:
- {
- static const VertexFormat format(GL_FLOAT, GL_FALSE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_SINT210:
- {
- static const VertexFormat format(GL_INT_2_10_10_10_REV, GL_FALSE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_UINT210:
- {
- static const VertexFormat format(GL_UNSIGNED_INT_2_10_10_10_REV, GL_FALSE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_SINT210_NORM:
- {
- static const VertexFormat format(GL_INT_2_10_10_10_REV, GL_TRUE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_UINT210_NORM:
- {
- static const VertexFormat format(GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE, 4, false);
- return format;
- }
- case VERTEX_FORMAT_SINT210_INT:
- {
- static const VertexFormat format(GL_INT_2_10_10_10_REV, GL_FALSE, 4, true);
- return format;
- }
- case VERTEX_FORMAT_UINT210_INT:
- {
- 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 GetVertexFormatTypeSize(VertexFormatType vertexFormatType)
-{
- switch (vertexFormatType)
- {
- case VERTEX_FORMAT_SBYTE1:
- case VERTEX_FORMAT_SBYTE1_NORM:
- case VERTEX_FORMAT_UBYTE1:
- case VERTEX_FORMAT_UBYTE1_NORM:
- case VERTEX_FORMAT_SBYTE1_INT:
- case VERTEX_FORMAT_UBYTE1_INT:
- return 1;
-
- case VERTEX_FORMAT_SBYTE2:
- case VERTEX_FORMAT_SBYTE2_NORM:
- case VERTEX_FORMAT_UBYTE2:
- case VERTEX_FORMAT_UBYTE2_NORM:
- case VERTEX_FORMAT_SBYTE2_INT:
- case VERTEX_FORMAT_UBYTE2_INT:
- case VERTEX_FORMAT_SSHORT1:
- case VERTEX_FORMAT_SSHORT1_NORM:
- case VERTEX_FORMAT_USHORT1:
- case VERTEX_FORMAT_USHORT1_NORM:
- case VERTEX_FORMAT_SSHORT1_INT:
- case VERTEX_FORMAT_USHORT1_INT:
- case VERTEX_FORMAT_HALF1:
- return 2;
-
- case VERTEX_FORMAT_SBYTE3:
- case VERTEX_FORMAT_SBYTE3_NORM:
- case VERTEX_FORMAT_UBYTE3:
- case VERTEX_FORMAT_UBYTE3_NORM:
- case VERTEX_FORMAT_SBYTE3_INT:
- case VERTEX_FORMAT_UBYTE3_INT:
- return 3;
-
- case VERTEX_FORMAT_SBYTE4:
- case VERTEX_FORMAT_SBYTE4_NORM:
- case VERTEX_FORMAT_UBYTE4:
- case VERTEX_FORMAT_UBYTE4_NORM:
- case VERTEX_FORMAT_SBYTE4_INT:
- case VERTEX_FORMAT_UBYTE4_INT:
- case VERTEX_FORMAT_SSHORT2:
- case VERTEX_FORMAT_SSHORT2_NORM:
- case VERTEX_FORMAT_USHORT2:
- case VERTEX_FORMAT_USHORT2_NORM:
- case VERTEX_FORMAT_SSHORT2_INT:
- case VERTEX_FORMAT_USHORT2_INT:
- case VERTEX_FORMAT_SINT1:
- case VERTEX_FORMAT_SINT1_NORM:
- case VERTEX_FORMAT_UINT1:
- case VERTEX_FORMAT_UINT1_NORM:
- case VERTEX_FORMAT_SINT1_INT:
- case VERTEX_FORMAT_UINT1_INT:
- case VERTEX_FORMAT_HALF2:
- case VERTEX_FORMAT_FIXED1:
- case VERTEX_FORMAT_FLOAT1:
- case VERTEX_FORMAT_SINT210:
- case VERTEX_FORMAT_UINT210:
- case VERTEX_FORMAT_SINT210_NORM:
- case VERTEX_FORMAT_UINT210_NORM:
- case VERTEX_FORMAT_SINT210_INT:
- case VERTEX_FORMAT_UINT210_INT:
- return 4;
-
- case VERTEX_FORMAT_SSHORT3:
- case VERTEX_FORMAT_SSHORT3_NORM:
- case VERTEX_FORMAT_USHORT3:
- case VERTEX_FORMAT_USHORT3_NORM:
- case VERTEX_FORMAT_SSHORT3_INT:
- case VERTEX_FORMAT_USHORT3_INT:
- case VERTEX_FORMAT_HALF3:
- return 6;
-
- case VERTEX_FORMAT_SSHORT4:
- case VERTEX_FORMAT_SSHORT4_NORM:
- case VERTEX_FORMAT_USHORT4:
- case VERTEX_FORMAT_USHORT4_NORM:
- case VERTEX_FORMAT_SSHORT4_INT:
- case VERTEX_FORMAT_USHORT4_INT:
- case VERTEX_FORMAT_SINT2:
- case VERTEX_FORMAT_SINT2_NORM:
- case VERTEX_FORMAT_UINT2:
- case VERTEX_FORMAT_UINT2_NORM:
- case VERTEX_FORMAT_SINT2_INT:
- case VERTEX_FORMAT_UINT2_INT:
- case VERTEX_FORMAT_HALF4:
- case VERTEX_FORMAT_FIXED2:
- case VERTEX_FORMAT_FLOAT2:
- return 8;
-
- case VERTEX_FORMAT_SINT3:
- case VERTEX_FORMAT_SINT3_NORM:
- case VERTEX_FORMAT_UINT3:
- case VERTEX_FORMAT_UINT3_NORM:
- case VERTEX_FORMAT_SINT3_INT:
- case VERTEX_FORMAT_UINT3_INT:
- case VERTEX_FORMAT_FIXED3:
- case VERTEX_FORMAT_FLOAT3:
- return 12;
-
- case VERTEX_FORMAT_SINT4:
- case VERTEX_FORMAT_SINT4_NORM:
- case VERTEX_FORMAT_UINT4:
- case VERTEX_FORMAT_UINT4_NORM:
- case VERTEX_FORMAT_SINT4_INT:
- case VERTEX_FORMAT_UINT4_INT:
- case VERTEX_FORMAT_FIXED4:
- case VERTEX_FORMAT_FLOAT4:
- return 16;
-
- case VERTEX_FORMAT_INVALID:
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-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);
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/formatutils.h b/src/3rdparty/angle/src/libANGLE/formatutils.h
deleted file mode 100644
index dbfe590846..0000000000
--- a/src/3rdparty/angle/src/libANGLE/formatutils.h
+++ /dev/null
@@ -1,329 +0,0 @@
-//
-// 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 <cstddef>
-#include <ostream>
-#include <stdint.h>
-
-#include "angle_gl.h"
-#include "libANGLE/Caps.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/Version.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();
-
- GLuint bytes;
- GLuint bytesShift; // Bit shift by this value to effectively divide/multiply by "bytes" in a more optimal way
- bool specialInterpretation;
-};
-const Type &GetTypeInfo(GLenum 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;
-
- ErrorOrResult<GLuint> computeRowPitch(GLenum formatType,
- GLsizei width,
- GLint alignment,
- GLint rowLength) const;
- ErrorOrResult<GLuint> computeDepthPitch(GLsizei height,
- GLint imageHeight,
- GLuint rowPitch) const;
- ErrorOrResult<GLuint> computeDepthPitch(GLenum formatType,
- GLsizei width,
- GLsizei height,
- GLint alignment,
- GLint rowLength,
- GLint imageHeight) const;
-
- ErrorOrResult<GLuint> computeCompressedImageSize(const Extents &size) const;
-
- ErrorOrResult<GLuint> computeSkipBytes(GLuint rowPitch,
- GLuint depthPitch,
- const PixelStoreStateBase &state,
- bool is3D) const;
-
- ErrorOrResult<GLuint> computePackUnpackEndByte(GLenum formatType,
- const Extents &size,
- const PixelStoreStateBase &state,
- bool is3D) 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 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;
-
- GLenum format;
- GLenum type;
-
- GLenum componentType;
- GLenum colorEncoding;
-
- typedef bool (*SupportCheckFunction)(const Version &, const Extensions &);
- SupportCheckFunction textureSupport;
- SupportCheckFunction renderSupport;
- SupportCheckFunction filterSupport;
-};
-
-// 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);
-
-enum VertexFormatType
-{
- VERTEX_FORMAT_INVALID,
- VERTEX_FORMAT_SBYTE1,
- VERTEX_FORMAT_SBYTE1_NORM,
- VERTEX_FORMAT_SBYTE2,
- VERTEX_FORMAT_SBYTE2_NORM,
- VERTEX_FORMAT_SBYTE3,
- VERTEX_FORMAT_SBYTE3_NORM,
- VERTEX_FORMAT_SBYTE4,
- VERTEX_FORMAT_SBYTE4_NORM,
- VERTEX_FORMAT_UBYTE1,
- VERTEX_FORMAT_UBYTE1_NORM,
- VERTEX_FORMAT_UBYTE2,
- VERTEX_FORMAT_UBYTE2_NORM,
- VERTEX_FORMAT_UBYTE3,
- VERTEX_FORMAT_UBYTE3_NORM,
- VERTEX_FORMAT_UBYTE4,
- VERTEX_FORMAT_UBYTE4_NORM,
- VERTEX_FORMAT_SSHORT1,
- VERTEX_FORMAT_SSHORT1_NORM,
- VERTEX_FORMAT_SSHORT2,
- VERTEX_FORMAT_SSHORT2_NORM,
- VERTEX_FORMAT_SSHORT3,
- VERTEX_FORMAT_SSHORT3_NORM,
- VERTEX_FORMAT_SSHORT4,
- VERTEX_FORMAT_SSHORT4_NORM,
- VERTEX_FORMAT_USHORT1,
- VERTEX_FORMAT_USHORT1_NORM,
- VERTEX_FORMAT_USHORT2,
- VERTEX_FORMAT_USHORT2_NORM,
- VERTEX_FORMAT_USHORT3,
- VERTEX_FORMAT_USHORT3_NORM,
- VERTEX_FORMAT_USHORT4,
- VERTEX_FORMAT_USHORT4_NORM,
- VERTEX_FORMAT_SINT1,
- VERTEX_FORMAT_SINT1_NORM,
- VERTEX_FORMAT_SINT2,
- VERTEX_FORMAT_SINT2_NORM,
- VERTEX_FORMAT_SINT3,
- VERTEX_FORMAT_SINT3_NORM,
- VERTEX_FORMAT_SINT4,
- VERTEX_FORMAT_SINT4_NORM,
- VERTEX_FORMAT_UINT1,
- VERTEX_FORMAT_UINT1_NORM,
- VERTEX_FORMAT_UINT2,
- VERTEX_FORMAT_UINT2_NORM,
- VERTEX_FORMAT_UINT3,
- VERTEX_FORMAT_UINT3_NORM,
- VERTEX_FORMAT_UINT4,
- VERTEX_FORMAT_UINT4_NORM,
- VERTEX_FORMAT_SBYTE1_INT,
- VERTEX_FORMAT_SBYTE2_INT,
- VERTEX_FORMAT_SBYTE3_INT,
- VERTEX_FORMAT_SBYTE4_INT,
- VERTEX_FORMAT_UBYTE1_INT,
- VERTEX_FORMAT_UBYTE2_INT,
- VERTEX_FORMAT_UBYTE3_INT,
- VERTEX_FORMAT_UBYTE4_INT,
- VERTEX_FORMAT_SSHORT1_INT,
- VERTEX_FORMAT_SSHORT2_INT,
- VERTEX_FORMAT_SSHORT3_INT,
- VERTEX_FORMAT_SSHORT4_INT,
- VERTEX_FORMAT_USHORT1_INT,
- VERTEX_FORMAT_USHORT2_INT,
- VERTEX_FORMAT_USHORT3_INT,
- VERTEX_FORMAT_USHORT4_INT,
- VERTEX_FORMAT_SINT1_INT,
- VERTEX_FORMAT_SINT2_INT,
- VERTEX_FORMAT_SINT3_INT,
- VERTEX_FORMAT_SINT4_INT,
- VERTEX_FORMAT_UINT1_INT,
- VERTEX_FORMAT_UINT2_INT,
- VERTEX_FORMAT_UINT3_INT,
- VERTEX_FORMAT_UINT4_INT,
- VERTEX_FORMAT_FIXED1,
- VERTEX_FORMAT_FIXED2,
- VERTEX_FORMAT_FIXED3,
- VERTEX_FORMAT_FIXED4,
- VERTEX_FORMAT_HALF1,
- VERTEX_FORMAT_HALF2,
- VERTEX_FORMAT_HALF3,
- VERTEX_FORMAT_HALF4,
- VERTEX_FORMAT_FLOAT1,
- VERTEX_FORMAT_FLOAT2,
- VERTEX_FORMAT_FLOAT3,
- VERTEX_FORMAT_FLOAT4,
- VERTEX_FORMAT_SINT210,
- VERTEX_FORMAT_UINT210,
- VERTEX_FORMAT_SINT210_NORM,
- VERTEX_FORMAT_UINT210_NORM,
- VERTEX_FORMAT_SINT210_INT,
- VERTEX_FORMAT_UINT210_INT,
-};
-
-typedef std::vector<VertexFormatType> InputLayout;
-
-struct VertexFormat : private angle::NonCopyable
-{
- VertexFormat(GLenum typeIn, GLboolean normalizedIn, GLuint componentsIn, bool pureIntegerIn);
-
- GLenum type;
- GLboolean normalized;
- GLuint components;
- bool pureInteger;
-};
-
-VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint components, bool pureInteger);
-VertexFormatType GetVertexFormatType(const VertexAttribute &attrib);
-VertexFormatType GetVertexFormatType(const VertexAttribute &attrib, GLenum currentValueType);
-const VertexFormat &GetVertexFormatFromType(VertexFormatType vertexFormatType);
-size_t GetVertexFormatTypeSize(VertexFormatType vertexFormatType);
-
-// 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);
-
-} // namespace gl
-
-#endif // LIBANGLE_FORMATUTILS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/histogram_macros.h b/src/3rdparty/angle/src/libANGLE/histogram_macros.h
deleted file mode 100644
index fb428b46d2..0000000000
--- a/src/3rdparty/angle/src/libANGLE/histogram_macros.h
+++ /dev/null
@@ -1,112 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/packed_gl_enums.json b/src/3rdparty/angle/src/libANGLE/packed_gl_enums.json
deleted file mode 100644
index 7e77de2f36..0000000000
--- a/src/3rdparty/angle/src/libANGLE/packed_gl_enums.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "BufferBinding":
- {
- "Array": "GL_ARRAY_BUFFER",
- "AtomicCounter": "GL_ATOMIC_COUNTER_BUFFER",
- "CopyRead": "GL_COPY_READ_BUFFER",
- "CopyWrite": "GL_COPY_WRITE_BUFFER",
- "DispatchIndirect": "GL_DISPATCH_INDIRECT_BUFFER",
- "DrawIndirect": "GL_DRAW_INDIRECT_BUFFER",
- "ElementArray": "GL_ELEMENT_ARRAY_BUFFER",
- "PixelPack": "GL_PIXEL_PACK_BUFFER",
- "PixelUnpack": "GL_PIXEL_UNPACK_BUFFER",
- "ShaderStorage": "GL_SHADER_STORAGE_BUFFER",
- "TransformFeedback": "GL_TRANSFORM_FEEDBACK_BUFFER",
- "Uniform": "GL_UNIFORM_BUFFER"
- },
- "BufferUsage":
- {
- "DynamicCopy": "GL_DYNAMIC_COPY",
- "DynamicDraw": "GL_DYNAMIC_DRAW",
- "DynamicRead": "GL_DYNAMIC_READ",
- "StaticCopy": "GL_STATIC_COPY",
- "StaticDraw": "GL_STATIC_DRAW",
- "StaticRead": "GL_STATIC_READ",
- "StreamCopy": "GL_STREAM_COPY",
- "StreamDraw": "GL_STREAM_DRAW",
- "StreamRead": "GL_STREAM_READ"
- },
- "CullFaceMode":
- {
- "Back": "GL_BACK",
- "Front": "GL_FRONT",
- "FrontAndBack": "GL_FRONT_AND_BACK"
- }
-}
diff --git a/src/3rdparty/angle/src/libANGLE/params.cpp b/src/3rdparty/angle/src/libANGLE/params.cpp
deleted file mode 100644
index a89d87e0a9..0000000000
--- a/src/3rdparty/angle/src/libANGLE/params.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// 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.
-//
-// params:
-// Parameter wrapper structs for OpenGL ES. These helpers cache re-used values
-// in entry point routines.
-
-#include "libANGLE/params.h"
-
-#include "common/utilities.h"
-#include "libANGLE/Context.h"
-#include "libANGLE/VertexArray.h"
-
-namespace gl
-{
-
-// static
-constexpr ParamTypeInfo ParamsBase::TypeInfo;
-constexpr ParamTypeInfo HasIndexRange::TypeInfo;
-
-HasIndexRange::HasIndexRange()
- : ParamsBase(nullptr), mContext(nullptr), mCount(0), mType(GL_NONE), mIndices(nullptr)
-{
-}
-
-HasIndexRange::HasIndexRange(Context *context, GLsizei count, GLenum type, const void *indices)
- : ParamsBase(context), mContext(context), mCount(count), mType(type), mIndices(indices)
-{
-}
-
-const Optional<IndexRange> &HasIndexRange::getIndexRange() const
-{
- if (mIndexRange.valid() || !mContext)
- {
- return mIndexRange;
- }
-
- const State &state = mContext->getGLState();
-
- const gl::VertexArray *vao = state.getVertexArray();
- gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get();
-
- if (elementArrayBuffer)
- {
- uintptr_t offset = reinterpret_cast<uintptr_t>(mIndices);
- IndexRange indexRange;
- Error error =
- elementArrayBuffer->getIndexRange(mContext, mType, static_cast<size_t>(offset), mCount,
- state.isPrimitiveRestartEnabled(), &indexRange);
- if (error.isError())
- {
- mContext->handleError(error);
- return mIndexRange;
- }
-
- mIndexRange = indexRange;
- }
- else
- {
- mIndexRange = ComputeIndexRange(mType, mIndices, mCount, state.isPrimitiveRestartEnabled());
- }
-
- return mIndexRange;
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/params.h b/src/3rdparty/angle/src/libANGLE/params.h
deleted file mode 100644
index 27dba640ff..0000000000
--- a/src/3rdparty/angle/src/libANGLE/params.h
+++ /dev/null
@@ -1,228 +0,0 @@
-//
-// 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.
-//
-// params:
-// Parameter wrapper structs for OpenGL ES. These helpers cache re-used values
-// in entry point routines.
-
-#ifndef LIBANGLE_PARAMS_H_
-#define LIBANGLE_PARAMS_H_
-
-#include "angle_gl.h"
-#include "common/Optional.h"
-#include "common/angleutils.h"
-#include "common/mathutil.h"
-#include "libANGLE/entry_points_enum_autogen.h"
-
-namespace gl
-{
-class Context;
-
-template <EntryPoint EP>
-struct EntryPointParam;
-
-template <EntryPoint EP>
-using EntryPointParamType = typename EntryPointParam<EP>::Type;
-
-class ParamTypeInfo
-{
- public:
- constexpr ParamTypeInfo(const char *selfClass, const ParamTypeInfo *parentType)
- : mSelfClass(selfClass), mParentTypeInfo(parentType)
- {
- }
-
- constexpr bool hasDynamicType(const ParamTypeInfo &typeInfo) const
- {
- return mSelfClass == typeInfo.mSelfClass ||
- (mParentTypeInfo && mParentTypeInfo->hasDynamicType(typeInfo));
- }
-
- constexpr bool isValid() const { return mSelfClass != nullptr; }
-
- private:
- const char *mSelfClass;
- const ParamTypeInfo *mParentTypeInfo;
-};
-
-#define ANGLE_PARAM_TYPE_INFO(NAME, BASENAME) \
- static constexpr ParamTypeInfo TypeInfo = {#NAME, &BASENAME::TypeInfo}
-
-class ParamsBase : angle::NonCopyable
-{
- public:
- ParamsBase(Context *context, ...){};
-
- template <EntryPoint EP, typename... ArgsT>
- static void Factory(EntryPointParamType<EP> *objBuffer, ArgsT... args);
-
- static constexpr ParamTypeInfo TypeInfo = {nullptr, nullptr};
-};
-
-// static
-template <EntryPoint EP, typename... ArgsT>
-ANGLE_INLINE void ParamsBase::Factory(EntryPointParamType<EP> *objBuffer, ArgsT... args)
-{
- new (objBuffer) EntryPointParamType<EP>(args...);
-}
-
-class HasIndexRange : public ParamsBase
-{
- public:
- // Dummy placeholder that can't generate an index range.
- HasIndexRange();
- HasIndexRange(Context *context, GLsizei count, GLenum type, const void *indices);
-
- template <EntryPoint EP, typename... ArgsT>
- static void Factory(HasIndexRange *objBuffer, ArgsT... args);
-
- const Optional<IndexRange> &getIndexRange() const;
-
- ANGLE_PARAM_TYPE_INFO(HasIndexRange, ParamsBase);
-
- private:
- Context *mContext;
- GLsizei mCount;
- GLenum mType;
- const GLvoid *mIndices;
- mutable Optional<IndexRange> mIndexRange;
-};
-
-// Entry point funcs essentially re-map different entry point parameter arrays into
-// the format the parameter type class expects. For example, for HasIndexRange, for the
-// various indexed draw calls, they drop parameters that aren't useful and re-arrange
-// the rest.
-#define ANGLE_ENTRY_POINT_FUNC(NAME, CLASS, ...) \
- \
-template<> struct EntryPointParam<EntryPoint::NAME> \
- { \
- using Type = CLASS; \
- }; \
- \
-template<> inline void CLASS::Factory<EntryPoint::NAME>(__VA_ARGS__)
-
-ANGLE_ENTRY_POINT_FUNC(DrawElements,
- HasIndexRange,
- HasIndexRange *objBuffer,
- Context *context,
- GLenum /*mode*/,
- GLsizei count,
- GLenum type,
- const void *indices)
-{
- return ParamsBase::Factory<EntryPoint::DrawElements>(objBuffer, context, count, type, indices);
-}
-
-ANGLE_ENTRY_POINT_FUNC(DrawElementsInstanced,
- HasIndexRange,
- HasIndexRange *objBuffer,
- Context *context,
- GLenum /*mode*/,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei /*instanceCount*/)
-{
- return ParamsBase::Factory<EntryPoint::DrawElementsInstanced>(objBuffer, context, count, type,
- indices);
-}
-
-ANGLE_ENTRY_POINT_FUNC(DrawElementsInstancedANGLE,
- HasIndexRange,
- HasIndexRange *objBuffer,
- Context *context,
- GLenum /*mode*/,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei /*instanceCount*/)
-{
- return ParamsBase::Factory<EntryPoint::DrawElementsInstancedANGLE>(objBuffer, context, count,
- type, indices);
-}
-
-ANGLE_ENTRY_POINT_FUNC(DrawRangeElements,
- HasIndexRange,
- HasIndexRange *objBuffer,
- Context *context,
- GLenum /*mode*/,
- GLuint /*start*/,
- GLuint /*end*/,
- GLsizei count,
- GLenum type,
- const void *indices)
-{
- return ParamsBase::Factory<EntryPoint::DrawRangeElements>(objBuffer, context, count, type,
- indices);
-}
-
-#undef ANGLE_ENTRY_POINT_FUNC
-
-template <EntryPoint EP>
-struct EntryPointParam
-{
- using Type = ParamsBase;
-};
-
-// 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;
-};
-
-template <EntryPoint EP, typename ReturnType>
-constexpr ANGLE_INLINE ReturnType GetDefaultReturnValue()
-{
- return DefaultReturnValue<EP, ReturnType>::kValue;
-}
-
-} // namespace gl
-
-#endif // LIBANGLE_PARAMS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/queryconversions.cpp b/src/3rdparty/angle/src/libANGLE/queryconversions.cpp
deleted file mode 100644
index 78d219365e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/queryconversions.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-//
-// 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 "libANGLE/Context.h"
-#include "common/utilities.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
- if (pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR)
- {
- return clampCast<QueryT>(ExpandFloatToInteger(static_cast<GLfloat>(value)));
- }
- else
- {
- 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
-
-// ES 3.10 Section 2.2.2
-// When querying bitmasks(such as SAMPLE_MASK_VALUE or STENCIL_WRITEMASK) with GetIntegerv, the
-// mask value is treated as a signed integer, so that mask values with the high bit set will not be
-// clamped when returned as signed integers.
-GLint CastMaskValue(const Context *context, GLuint value)
-{
- return (context->getClientVersion() >= Version(3, 1) ? static_cast<GLint>(value)
- : 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 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, GLfloat>(GLenum pname, GLfloat value);
-template GLint CastFromStateValue<GLint, 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 GLfloat CastQueryValueTo<GLfloat, GLint>(GLenum pname, GLint value);
-template GLfloat CastQueryValueTo<GLfloat, GLfloat>(GLenum pname, GLfloat value);
-template GLuint CastQueryValueTo<GLuint, GLint>(GLenum pname, GLint 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 *);
-}
diff --git a/src/3rdparty/angle/src/libANGLE/queryconversions.h b/src/3rdparty/angle/src/libANGLE/queryconversions.h
deleted file mode 100644
index 805f36cf02..0000000000
--- a/src/3rdparty/angle/src/libANGLE/queryconversions.h
+++ /dev/null
@@ -1,117 +0,0 @@
-//
-// 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(const Context *context, 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 ParamType>
-GLenum 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);
-}
-
-#endif // LIBANGLE_QUERY_CONVERSIONS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/queryutils.cpp b/src/3rdparty/angle/src/libANGLE/queryutils.cpp
deleted file mode 100644
index 16a989c688..0000000000
--- a/src/3rdparty/angle/src/libANGLE/queryutils.cpp
+++ /dev/null
@@ -1,1916 +0,0 @@
-//
-// 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/Fence.h"
-#include "libANGLE/Framebuffer.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 <typename ParamType>
-void QueryTexLevelParameterBase(const Texture *texture,
- GLenum 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;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-template <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->getSamplerState().minLod);
- break;
- case GL_TEXTURE_MAX_LOD:
- *params = CastFromStateValue<ParamType>(pname, texture->getSamplerState().maxLod);
- 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;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-template <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(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_WRAP_T:
- texture->setWrapT(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_WRAP_R:
- texture->setWrapR(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_MIN_FILTER:
- texture->setMinFilter(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_MAG_FILTER:
- texture->setMagFilter(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_USAGE_ANGLE:
- texture->setUsage(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- texture->setMaxAnisotropy(CastQueryValueTo<GLfloat>(pname, params[0]));
- break;
- case GL_TEXTURE_COMPARE_MODE:
- texture->setCompareMode(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_COMPARE_FUNC:
- texture->setCompareFunc(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_SWIZZLE_R:
- texture->setSwizzleRed(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_SWIZZLE_G:
- texture->setSwizzleGreen(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_SWIZZLE_B:
- texture->setSwizzleBlue(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_SWIZZLE_A:
- texture->setSwizzleAlpha(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_BASE_LEVEL:
- {
- context->handleError(texture->setBaseLevel(
- context, clampCast<GLuint>(CastQueryValueTo<GLint>(pname, params[0]))));
- break;
- }
- case GL_TEXTURE_MAX_LEVEL:
- texture->setMaxLevel(clampCast<GLuint>(CastQueryValueTo<GLint>(pname, params[0])));
- break;
- case GL_TEXTURE_MIN_LOD:
- texture->setMinLod(CastQueryValueTo<GLfloat>(pname, params[0]));
- break;
- case GL_TEXTURE_MAX_LOD:
- texture->setMaxLod(CastQueryValueTo<GLfloat>(pname, params[0]));
- break;
- case GL_DEPTH_STENCIL_TEXTURE_MODE:
- texture->setDepthStencilTextureMode(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_SRGB_DECODE_EXT:
- texture->setSRGBDecode(ConvertToGLenum(pname, params[0]));
- break;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-template <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;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-template <typename ParamType>
-void SetSamplerParameterBase(Sampler *sampler, GLenum pname, const ParamType *params)
-{
- switch (pname)
- {
- case GL_TEXTURE_WRAP_S:
- sampler->setWrapS(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_WRAP_T:
- sampler->setWrapT(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_WRAP_R:
- sampler->setWrapR(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_MIN_FILTER:
- sampler->setMinFilter(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_MAG_FILTER:
- sampler->setMagFilter(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- sampler->setMaxAnisotropy(CastQueryValueTo<GLfloat>(pname, params[0]));
- break;
- case GL_TEXTURE_COMPARE_MODE:
- sampler->setCompareMode(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_COMPARE_FUNC:
- sampler->setCompareFunc(ConvertToGLenum(pname, params[0]));
- break;
- case GL_TEXTURE_MIN_LOD:
- sampler->setMinLod(CastQueryValueTo<GLfloat>(pname, params[0]));
- break;
- case GL_TEXTURE_MAX_LOD:
- sampler->setMaxLod(CastQueryValueTo<GLfloat>(pname, params[0]));
- break;
- case GL_TEXTURE_SRGB_DECODE_EXT:
- sampler->setSRGBDecode(ConvertToGLenum(pname, params[0]));
- break;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-// 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.size);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *params = CastFromGLintStateValue<ParamType>(pname, attrib.vertexAttribArrayStride);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *params = CastFromGLintStateValue<ParamType>(pname, attrib.type);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *params = CastFromStateValue<ParamType>(pname, static_cast<GLint>(attrib.normalized));
- break;
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *params = CastFromGLintStateValue<ParamType>(pname, binding.getBuffer().id());
- break;
- case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
- *params = CastFromGLintStateValue<ParamType>(pname, binding.getDivisor());
- break;
- case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
- *params = CastFromGLintStateValue<ParamType>(pname, attrib.pureInteger);
- 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;
- 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:
- 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_REFERENCED_BY_VERTEX_SHADER:
- return 0;
-
- case GL_REFERENCED_BY_FRAGMENT_SHADER:
- return 1;
-
- case GL_REFERENCED_BY_COMPUTE_SHADER:
- return 0;
-
- 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());
-
- // TODO(jie.a.chen@intel.com): more interfaces.
- case GL_TRANSFORM_FEEDBACK_VARYING:
- UNIMPLEMENTED();
- return 0;
-
- 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:
- maxNameLength =
- FindMaxSize(program->getState().getUniformBlocks(), &InterfaceBlock::name);
- break;
-
- case GL_BUFFER_VARIABLE:
- maxNameLength =
- FindMaxSize(program->getState().getBufferVariables(), &BufferVariable::name);
- break;
-
- case GL_SHADER_STORAGE_BLOCK:
- maxNameLength =
- FindMaxSize(program->getState().getShaderStorageBlocks(), &InterfaceBlock::name);
- break;
-
- // TODO(jie.a.chen@intel.com): more interfaces.
- case GL_TRANSFORM_FEEDBACK_VARYING:
- UNIMPLEMENTED();
- return 0;
-
- 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.vertexStaticUse);
- break;
- case GL_REFERENCED_BY_FRAGMENT_SHADER:
- params[(*outputPosition)++] = static_cast<GLint>(buffer.fragmentStaticUse);
- break;
- case GL_REFERENCED_BY_COMPUTE_SHADER:
- params[(*outputPosition)++] = static_cast<GLint>(buffer.computeStaticUse);
- 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);
-}
-
-} // anonymous namespace
-
-void QueryFramebufferAttachmentParameteriv(const Framebuffer *framebuffer,
- GLenum attachment,
- GLenum pname,
- GLint *params)
-{
- ASSERT(framebuffer);
-
- const FramebufferAttachment *attachmentObject = framebuffer->getAttachment(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:
- *params = attachmentObject->cubeMapFace();
- 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_ANGLE:
- *params = attachmentObject->getNumViews();
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_MULTIVIEW_LAYOUT_ANGLE:
- *params = static_cast<GLint>(attachmentObject->getMultiviewLayout());
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_ANGLE:
- *params = attachmentObject->getBaseViewIndex();
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_VIEWPORT_OFFSETS_ANGLE:
- {
- const std::vector<Offset> &offsets = attachmentObject->getMultiviewViewportOffsets();
- for (size_t i = 0u; i < offsets.size(); ++i)
- {
- params[i * 2u] = offsets[i].x;
- params[i * 2u + 1u] = offsets[i].y;
- }
- }
- 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(const Context *context, const Program *program, GLenum pname, GLint *params)
-{
- ASSERT(program != nullptr);
-
- switch (pname)
- {
- case GL_DELETE_STATUS:
- *params = program->isFlaggedForDeletion();
- return;
- case GL_LINK_STATUS:
- *params = program->isLinked();
- 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 = program->getBinaryLength(context);
- return;
- case GL_ACTIVE_UNIFORM_BLOCKS:
- *params = program->getActiveUniformBlockCount();
- return;
- case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
- *params = program->getActiveUniformBlockMaxLength();
- break;
- case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
- *params = program->getTransformFeedbackBufferMode();
- break;
- case GL_TRANSFORM_FEEDBACK_VARYINGS:
- *params = 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;
- 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;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-void QueryShaderiv(const Context *context, Shader *shader, GLenum pname, GLint *params)
-{
- ASSERT(shader != nullptr);
-
- switch (pname)
- {
- case GL_SHADER_TYPE:
- *params = shader->getType();
- return;
- case GL_DELETE_STATUS:
- *params = shader->isFlaggedForDeletion();
- return;
- case GL_COMPILE_STATUS:
- *params = shader->isCompiled(context) ? GL_TRUE : GL_FALSE;
- return;
- case GL_INFO_LOG_LENGTH:
- *params = shader->getInfoLogLength(context);
- return;
- case GL_SHADER_SOURCE_LENGTH:
- *params = shader->getSourceLength();
- return;
- case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE:
- *params = shader->getTranslatedSourceWithDebugInfoLength(context);
- return;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-void QueryTexLevelParameterfv(const Texture *texture,
- GLenum target,
- GLint level,
- GLenum pname,
- GLfloat *params)
-{
- QueryTexLevelParameterBase(texture, target, level, pname, params);
-}
-
-void QueryTexLevelParameteriv(const Texture *texture,
- GLenum target,
- GLint level,
- GLenum pname,
- GLint *params)
-{
- QueryTexLevelParameterBase(texture, target, level, pname, params);
-}
-
-void QueryTexParameterfv(const Texture *texture, GLenum pname, GLfloat *params)
-{
- QueryTexParameterBase(texture, pname, params);
-}
-
-void QueryTexParameteriv(const Texture *texture, GLenum pname, GLint *params)
-{
- QueryTexParameterBase(texture, pname, params);
-}
-
-void QuerySamplerParameterfv(const Sampler *sampler, GLenum pname, GLfloat *params)
-{
- QuerySamplerParameterBase(sampler, pname, params);
-}
-
-void QuerySamplerParameteriv(const Sampler *sampler, GLenum pname, GLint *params)
-{
- QuerySamplerParameterBase(sampler, pname, params);
-}
-
-void QueryVertexAttribfv(const VertexAttribute &attrib,
- const VertexBinding &binding,
- const VertexAttribCurrentValueData &currentValueData,
- GLenum pname,
- GLfloat *params)
-{
- QueryVertexAttribBase(attrib, binding, currentValueData.FloatValues, pname, params);
-}
-
-void QueryVertexAttribiv(const VertexAttribute &attrib,
- const VertexBinding &binding,
- const VertexAttribCurrentValueData &currentValueData,
- GLenum pname,
- GLint *params)
-{
- QueryVertexAttribBase(attrib, binding, currentValueData.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.IntValues, pname, params);
-}
-
-void QueryVertexAttribIuiv(const VertexAttribute &attrib,
- const VertexBinding &binding,
- const VertexAttribCurrentValueData &currentValueData,
- GLenum pname,
- GLuint *params)
-{
- QueryVertexAttribBase(attrib, binding, currentValueData.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;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-Error QuerySynciv(const Sync *sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- ASSERT(sync);
-
- // All queries return one value, exit early if the buffer can't fit anything.
- if (bufSize < 1)
- {
- if (length != nullptr)
- {
- *length = 0;
- }
- return NoError();
- }
-
- 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:
- ANGLE_TRY(sync->getStatus(values));
- break;
-
- default:
- UNREACHABLE();
- break;
- }
-
- if (length != nullptr)
- {
- *length = 1;
- }
-
- return NoError();
-}
-
-void SetTexParameterf(Context *context, Texture *texture, GLenum pname, GLfloat param)
-{
- SetTexParameterBase(context, texture, pname, &param);
-}
-
-void SetTexParameterfv(Context *context, Texture *texture, GLenum pname, const GLfloat *params)
-{
- SetTexParameterBase(context, texture, pname, params);
-}
-
-void SetTexParameteri(Context *context, Texture *texture, GLenum pname, GLint param)
-{
- SetTexParameterBase(context, texture, pname, &param);
-}
-
-void SetTexParameteriv(Context *context, Texture *texture, GLenum pname, const GLint *params)
-{
- SetTexParameterBase(context, texture, pname, params);
-}
-
-void SetSamplerParameterf(Sampler *sampler, GLenum pname, GLfloat param)
-{
- SetSamplerParameterBase(sampler, pname, &param);
-}
-
-void SetSamplerParameterfv(Sampler *sampler, GLenum pname, const GLfloat *params)
-{
- SetSamplerParameterBase(sampler, pname, params);
-}
-
-void SetSamplerParameteri(Sampler *sampler, GLenum pname, GLint param)
-{
- SetSamplerParameterBase(sampler, pname, &param);
-}
-
-void SetSamplerParameteriv(Sampler *sampler, GLenum pname, const GLint *params)
-{
- SetSamplerParameterBase(sampler, pname, params);
-}
-
-void SetFramebufferParameteri(Framebuffer *framebuffer, GLenum pname, GLint param)
-{
- ASSERT(framebuffer);
-
- switch (pname)
- {
- case GL_FRAMEBUFFER_DEFAULT_WIDTH:
- framebuffer->setDefaultWidth(param);
- break;
- case GL_FRAMEBUFFER_DEFAULT_HEIGHT:
- framebuffer->setDefaultHeight(param);
- break;
- case GL_FRAMEBUFFER_DEFAULT_SAMPLES:
- framebuffer->setDefaultSamples(param);
- break;
- case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
- framebuffer->setDefaultFixedSampleLocations(ConvertToBool(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.vertexStaticUse;
-
- case GL_REFERENCED_BY_FRAGMENT_SHADER:
- return uniform.fragmentStaticUse;
-
- case GL_REFERENCED_BY_COMPUTE_SHADER:
- return uniform.computeStaticUse;
-
- 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.vertexStaticUse;
-
- case GL_REFERENCED_BY_FRAGMENT_SHADER:
- return bufferVariable.fragmentStaticUse;
-
- case GL_REFERENCED_BY_COMPUTE_SHADER:
- return bufferVariable.computeStaticUse;
-
- 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);
-
- // TODO(jie.a.chen@intel.com): more interfaces.
- case GL_TRANSFORM_FEEDBACK_VARYING:
- UNIMPLEMENTED();
- return GL_INVALID_INDEX;
-
- 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;
-
- // TODO(jie.a.chen@intel.com): more interfaces.
- case GL_TRANSFORM_FEEDBACK_VARYING:
- UNIMPLEMENTED();
- 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;
- // TODO(jie.a.chen@intel.com): more interfaces.
- case GL_TRANSFORM_FEEDBACK_VARYING:
- UNIMPLEMENTED();
- params[i] = GL_INVALID_VALUE;
- 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();
- }
-}
-
-} // 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;
- 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 = 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;
- 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;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-} // namespace egl
diff --git a/src/3rdparty/angle/src/libANGLE/queryutils.h b/src/3rdparty/angle/src/libANGLE/queryutils.h
deleted file mode 100644
index 990cbc169e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/queryutils.h
+++ /dev/null
@@ -1,162 +0,0 @@
-//
-// 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/angleutils.h"
-
-#include <EGL/egl.h>
-
-namespace gl
-{
-class Buffer;
-class Context;
-class Error;
-class Sync;
-class Framebuffer;
-class Program;
-class Renderbuffer;
-class Sampler;
-class Shader;
-class Texture;
-struct TextureCaps;
-struct UniformBlock;
-struct VertexAttribute;
-class VertexBinding;
-struct VertexAttribCurrentValueData;
-
-void QueryFramebufferAttachmentParameteriv(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(const 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,
- GLenum target,
- GLint level,
- GLenum pname,
- GLfloat *params);
-void QueryTexLevelParameteriv(const Texture *texture,
- GLenum 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 QuerySamplerParameterfv(const Sampler *sampler, GLenum pname, GLfloat *params);
-void QuerySamplerParameteriv(const Sampler *sampler, GLenum pname, GLint *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);
-
-Error QuerySynciv(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 SetSamplerParameterf(Sampler *sampler, GLenum pname, GLfloat param);
-void SetSamplerParameterfv(Sampler *sampler, GLenum pname, const GLfloat *params);
-void SetSamplerParameteri(Sampler *sampler, GLenum pname, GLint param);
-void SetSamplerParameteriv(Sampler *sampler, GLenum pname, const GLint *params);
-
-void SetFramebufferParameteri(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);
-
-} // namespace gl
-
-namespace egl
-{
-struct Config;
-class Surface;
-
-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);
-
-} // namespace egl
-
-#endif // LIBANGLE_QUERYUTILS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/BufferImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/BufferImpl.h
deleted file mode 100644
index f76fcdc8d7..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/BufferImpl.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// 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/angleutils.h"
-#include "common/mathutil.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/PackedGLEnums.h"
-
-#include <stdint.h>
-
-namespace gl
-{
-class BufferState;
-class Context;
-}
-
-namespace rx
-{
-class BufferImpl : angle::NonCopyable
-{
- public:
- BufferImpl(const gl::BufferState &state) : mState(state) {}
- virtual ~BufferImpl() {}
- virtual void destroy(const gl::Context *context) {}
-
- virtual gl::Error setData(const gl::Context *context,
- gl::BufferBinding target,
- const void *data,
- size_t size,
- gl::BufferUsage usage) = 0;
- virtual gl::Error setSubData(const gl::Context *context,
- gl::BufferBinding target,
- const void *data,
- size_t size,
- size_t offset) = 0;
- virtual gl::Error copySubData(const gl::Context *context,
- BufferImpl *source,
- GLintptr sourceOffset,
- GLintptr destOffset,
- GLsizeiptr size) = 0;
- virtual gl::Error map(const gl::Context *context, GLenum access, void **mapPtr) = 0;
- virtual gl::Error mapRange(const gl::Context *context,
- size_t offset,
- size_t length,
- GLbitfield access,
- void **mapPtr) = 0;
- virtual gl::Error unmap(const gl::Context *context, GLboolean *result) = 0;
-
- virtual gl::Error getIndexRange(const gl::Context *context,
- GLenum type,
- size_t offset,
- size_t count,
- bool primitiveRestartEnabled,
- gl::IndexRange *outRange) = 0;
-
- protected:
- const gl::BufferState &mState;
-};
-}
-
-#endif // LIBANGLE_RENDERER_BUFFERIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/BufferImpl_mock.h b/src/3rdparty/angle/src/libANGLE/renderer/BufferImpl_mock.h
deleted file mode 100644
index 5a4e21003c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/BufferImpl_mock.h
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// Copyright 2015 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// BufferImpl_mock.h: Defines a mock of the BufferImpl class.
-
-#ifndef LIBANGLE_RENDERER_BUFFERIMPLMOCK_H_
-#define LIBANGLE_RENDERER_BUFFERIMPLMOCK_H_
-
-#include "gmock/gmock.h"
-
-#include "libANGLE/Buffer.h"
-#include "libANGLE/renderer/BufferImpl.h"
-
-namespace rx
-{
-class MockBufferImpl : public BufferImpl
-{
- public:
- MockBufferImpl() : BufferImpl(mMockState) {}
- ~MockBufferImpl() { destructor(); }
-
- MOCK_METHOD5(
- setData,
- gl::Error(const gl::Context *, gl::BufferBinding, const void *, size_t, gl::BufferUsage));
- MOCK_METHOD5(setSubData,
- gl::Error(const gl::Context *, gl::BufferBinding, const void *, size_t, size_t));
- MOCK_METHOD5(
- copySubData,
- gl::Error(const gl::Context *contextImpl, BufferImpl *, GLintptr, GLintptr, GLsizeiptr));
- MOCK_METHOD3(map, gl::Error(const gl::Context *contextImpl, GLenum, void **));
- MOCK_METHOD5(mapRange,
- gl::Error(const gl::Context *contextImpl, size_t, size_t, GLbitfield, void **));
- MOCK_METHOD2(unmap, gl::Error(const gl::Context *contextImpl, GLboolean *result));
-
- MOCK_METHOD6(getIndexRange,
- gl::Error(const gl::Context *, GLenum, size_t, size_t, bool, gl::IndexRange *));
-
- MOCK_METHOD0(destructor, void());
-
- protected:
- gl::BufferState mMockState;
-};
-}
-
-#endif // LIBANGLE_RENDERER_BUFFERIMPLMOCK_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/CompilerImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/CompilerImpl.h
deleted file mode 100644
index 82f1ffe0d3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/CompilerImpl.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// 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 "common/angleutils.h"
-#include "GLSLANG/ShaderLang.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() {}
-
- virtual gl::Error release() = 0;
-
- // TODO(jmadill): Expose translator built-in resources init method.
- virtual ShShaderOutput getTranslatorOutputType() const = 0;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_COMPILERIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/ContextImpl.cpp b/src/3rdparty/angle/src/libANGLE/renderer/ContextImpl.cpp
deleted file mode 100644
index 8d3df291d3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/ContextImpl.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-//
-// 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"
-
-namespace rx
-{
-
-ContextImpl::ContextImpl(const gl::ContextState &state)
- : mState(state), mMemoryProgramCache(nullptr)
-{
-}
-
-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::setMemoryProgramCache(gl::MemoryProgramCache *memoryProgramCache)
-{
- mMemoryProgramCache = memoryProgramCache;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/ContextImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/ContextImpl.h
deleted file mode 100644
index 7ba4b5ad2d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/ContextImpl.h
+++ /dev/null
@@ -1,186 +0,0 @@
-//
-// 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/ContextState.h"
-#include "libANGLE/renderer/GLImplFactory.h"
-
-namespace gl
-{
-class MemoryProgramCache;
-class Path;
-struct Workarounds;
-}
-
-namespace rx
-{
-class ContextImpl : public GLImplFactory
-{
- public:
- ContextImpl(const gl::ContextState &state);
- ~ContextImpl() override;
-
- virtual void onDestroy(const gl::Context *context) {}
-
- virtual gl::Error initialize() = 0;
-
- // Flush and finish.
- virtual gl::Error flush(const gl::Context *context) = 0;
- virtual gl::Error finish(const gl::Context *context) = 0;
-
- // Drawing methods.
- virtual gl::Error drawArrays(const gl::Context *context,
- GLenum mode,
- GLint first,
- GLsizei count) = 0;
- virtual gl::Error drawArraysInstanced(const gl::Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei instanceCount) = 0;
-
- virtual gl::Error drawElements(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices) = 0;
- virtual gl::Error drawElementsInstanced(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances) = 0;
- virtual gl::Error drawRangeElements(const gl::Context *context,
- GLenum mode,
- GLuint start,
- GLuint end,
- GLsizei count,
- GLenum type,
- const void *indices) = 0;
-
- virtual gl::Error drawArraysIndirect(const gl::Context *context,
- GLenum mode,
- const void *indirect) = 0;
- virtual gl::Error drawElementsIndirect(const gl::Context *context,
- GLenum mode,
- GLenum 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 GLenum 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, GLsizei length, const char *message) = 0;
- virtual void popDebugGroup() = 0;
-
- // State sync with dirty bits.
- virtual void syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits) = 0;
-
- // Disjoint timer queries
- virtual GLint getGPUDisjoint() = 0;
- virtual GLint64 getTimestamp() = 0;
-
- // Context switching
- virtual void onMakeCurrent(const gl::Context *context) = 0;
-
- // Native capabilities, unmodified by gl::Context.
- virtual const 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 void applyNativeWorkarounds(gl::Workarounds *workarounds) const {}
-
- virtual gl::Error dispatchCompute(const gl::Context *context,
- GLuint numGroupsX,
- GLuint numGroupsY,
- GLuint numGroupsZ) = 0;
-
- const gl::ContextState &getContextState() { return mState; }
- int getClientMajorVersion() const { return mState.getClientMajorVersion(); }
- int getClientMinorVersion() const { return mState.getClientMinorVersion(); }
- const gl::State &getGLState() const { return mState.getState(); }
- 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);
-
- protected:
- const gl::ContextState &mState;
- gl::MemoryProgramCache *mMemoryProgramCache;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_CONTEXTIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/DeviceImpl.cpp b/src/3rdparty/angle/src/libANGLE/renderer/DeviceImpl.cpp
deleted file mode 100644
index 6a166236d0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/DeviceImpl.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// 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()
-{
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/DeviceImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/DeviceImpl.h
deleted file mode 100644
index 550bc1e2d9..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/DeviceImpl.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// 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/Error.h"
-#include "libANGLE/Caps.h"
-
-namespace egl
-{
-class Device;
-}
-
-namespace rx
-{
-class DeviceImpl : angle::NonCopyable
-{
- public:
- DeviceImpl();
- virtual ~DeviceImpl();
-
- virtual egl::Error getDevice(void **outValue) = 0;
- virtual EGLint getType() = 0;
- virtual void generateExtensions(egl::DeviceExtensions *outExtensions) const = 0;
- virtual bool deviceExternallySourced() = 0;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_DEVICEIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/DisplayImpl.cpp b/src/3rdparty/angle/src/libANGLE/renderer/DisplayImpl.cpp
deleted file mode 100644
index 5cc9da96dc..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/DisplayImpl.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// 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)
-{
-}
-
-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.";
-}
-
-const egl::Caps &DisplayImpl::getCaps() const
-{
- if (!mCapsInitialized)
- {
- generateCaps(&mCaps);
- mCapsInitialized = true;
- }
-
- return mCaps;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/DisplayImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/DisplayImpl.h
deleted file mode 100644
index b1c49d9bc8..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/DisplayImpl.h
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// 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/renderer/EGLImplFactory.h"
-#include "libANGLE/Stream.h"
-#include "libANGLE/Version.h"
-
-#include <set>
-#include <vector>
-
-namespace egl
-{
-class AttributeMap;
-class Display;
-struct DisplayState;
-struct Config;
-class Surface;
-class ImageSibling;
-class Thread;
-}
-
-namespace gl
-{
-class Context;
-}
-
-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 std::string getVendorString() const = 0;
-
- virtual egl::Error getDevice(DeviceImpl **device) = 0;
-
- virtual egl::Error waitClient(const gl::Context *context) const = 0;
- virtual egl::Error waitNative(const gl::Context *context, EGLint engine) const = 0;
- virtual gl::Version getMaxSupportedESVersion() const = 0;
- const egl::Caps &getCaps() const;
-
- const egl::DisplayExtensions &getExtensions() const;
-
- 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;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_DISPLAYIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/EGLImplFactory.h b/src/3rdparty/angle/src/libANGLE/renderer/EGLImplFactory.h
deleted file mode 100644
index 0433364cd3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/EGLImplFactory.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// 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 gl
-{
-class Context;
-class ContextState;
-}
-
-namespace rx
-{
-class ContextImpl;
-class ImageImpl;
-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,
- EGLenum target,
- const egl::AttributeMap &attribs) = 0;
-
- virtual ContextImpl *createContext(const gl::ContextState &state) = 0;
-
- virtual StreamProducerImpl *createStreamProducerD3DTextureNV12(
- egl::Stream::ConsumerType consumerType,
- const egl::AttributeMap &attribs) = 0;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_EGLIMPLFACTORY_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/FenceNVImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/FenceNVImpl.h
deleted file mode 100644
index a534914970..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/FenceNVImpl.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// 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 rx
-{
-
-class FenceNVImpl : angle::NonCopyable
-{
- public:
- FenceNVImpl() { };
- virtual ~FenceNVImpl() { };
-
- virtual gl::Error set(GLenum condition) = 0;
- virtual gl::Error test(GLboolean *outFinished) = 0;
- virtual gl::Error finish() = 0;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_FENCENVIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/Format.h b/src/3rdparty/angle/src/libANGLE/renderer/Format.h
deleted file mode 100644
index 66bdace3e9..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/Format.h
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// 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/renderer_utils.h"
-
-namespace angle
-{
-
-struct Format final : private angle::NonCopyable
-{
- enum class ID;
-
- constexpr Format(ID id,
- GLenum glFormat,
- GLenum fboFormat,
- rx::MipGenerationFunction mipGen,
- const rx::FastCopyFunctionMap &fastCopyFunctions,
- rx::ColorReadFunction colorRead,
- rx::ColorWriteFunction colorWrite,
- GLenum componentType,
- GLuint redBits,
- GLuint greenBits,
- GLuint blueBits,
- GLuint alphaBits,
- GLuint depthBits,
- GLuint stencilBits);
-
- static const Format &Get(ID id);
- static ID InternalFormatToID(GLenum internalFormat);
-
- ID 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::ColorReadFunction colorReadFunction;
- rx::ColorWriteFunction colorWriteFunction;
-
- // 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 depthBits;
- GLuint stencilBits;
-};
-
-constexpr Format::Format(ID id,
- GLenum glFormat,
- GLenum fboFormat,
- rx::MipGenerationFunction mipGen,
- const rx::FastCopyFunctionMap &fastCopyFunctions,
- rx::ColorReadFunction colorRead,
- rx::ColorWriteFunction colorWrite,
- GLenum componentType,
- GLuint redBits,
- GLuint greenBits,
- GLuint blueBits,
- GLuint alphaBits,
- GLuint depthBits,
- GLuint stencilBits)
- : id(id),
- glInternalFormat(glFormat),
- fboImplementationInternalFormat(fboFormat),
- mipGenerationFunction(mipGen),
- colorReadFunction(colorRead),
- colorWriteFunction(colorWrite),
- fastCopyFunctions(fastCopyFunctions),
- componentType(componentType),
- redBits(redBits),
- greenBits(greenBits),
- blueBits(blueBits),
- alphaBits(alphaBits),
- depthBits(depthBits),
- stencilBits(stencilBits)
-{
-}
-
-} // namespace angle
-
-#include "libANGLE/renderer/Format_ID_autogen.inl"
-
-#endif // LIBANGLE_RENDERER_FORMAT_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/Format_ID_autogen.inl b/src/3rdparty/angle/src/libANGLE/renderer/Format_ID_autogen.inl
deleted file mode 100644
index b2cbfb0410..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/Format_ID_autogen.inl
+++ /dev/null
@@ -1,147 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by gen_angle_format_table.py using data from angle_format_data.json
-//
-// 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.
-//
-// ANGLE format enumeration.
-
-namespace angle
-{
-
-enum class Format::ID
-{
- NONE,
- A16_FLOAT,
- 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_4x4_SRGB_BLOCK,
- ASTC_4x4_UNORM_BLOCK,
- ASTC_5x4_SRGB_BLOCK,
- ASTC_5x4_UNORM_BLOCK,
- ASTC_5x5_SRGB_BLOCK,
- ASTC_5x5_UNORM_BLOCK,
- ASTC_6x5_SRGB_BLOCK,
- ASTC_6x5_UNORM_BLOCK,
- ASTC_6x6_SRGB_BLOCK,
- ASTC_6x6_UNORM_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_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,
- D16_UNORM,
- D24_UNORM,
- D24_UNORM_S8_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_UINT,
- R10G10B10A2_UNORM,
- R11G11B10_FLOAT,
- R16G16B16A16_FLOAT,
- R16G16B16A16_SINT,
- R16G16B16A16_SNORM,
- R16G16B16A16_UINT,
- R16G16B16A16_UNORM,
- R16G16B16_FLOAT,
- R16G16B16_SINT,
- R16G16B16_SNORM,
- R16G16B16_UINT,
- R16G16B16_UNORM,
- R16G16_FLOAT,
- R16G16_SINT,
- R16G16_SNORM,
- R16G16_UINT,
- R16G16_UNORM,
- R16_FLOAT,
- R16_SINT,
- R16_SNORM,
- R16_UINT,
- R16_UNORM,
- R32G32B32A32_FLOAT,
- R32G32B32A32_SINT,
- R32G32B32A32_UINT,
- R32G32B32_FLOAT,
- R32G32B32_SINT,
- R32G32B32_UINT,
- R32G32_FLOAT,
- R32G32_SINT,
- R32G32_UINT,
- R32_FLOAT,
- R32_SINT,
- R32_UINT,
- R4G4B4A4_UNORM,
- R5G5B5A1_UNORM,
- R5G6B5_UNORM,
- R8G8B8A8_SINT,
- R8G8B8A8_SNORM,
- R8G8B8A8_UINT,
- R8G8B8A8_UNORM,
- R8G8B8A8_UNORM_SRGB,
- R8G8B8_SINT,
- R8G8B8_SNORM,
- R8G8B8_UINT,
- R8G8B8_UNORM,
- R8G8B8_UNORM_SRGB,
- R8G8_SINT,
- R8G8_SNORM,
- R8G8_UINT,
- R8G8_UNORM,
- R8_SINT,
- R8_SNORM,
- R8_UINT,
- R8_UNORM,
- R9G9B9E5_SHAREDEXP,
- S8_UINT
-};
-
-constexpr uint32_t kNumANGLEFormats = 128;
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/Format_table_autogen.cpp b/src/3rdparty/angle/src/libANGLE/renderer/Format_table_autogen.cpp
deleted file mode 100644
index ecb3ad231a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/Format_table_autogen.cpp
+++ /dev/null
@@ -1,434 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by gen_angle_format_table.py using data from angle_format_data.json
-//
-// 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.
-//
-// 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 = {GL_RGBA, GL_UNSIGNED_BYTE,
- CopyBGRA8ToRGBA8};
-static constexpr rx::FastCopyFunctionMap BGRACopyFunctions = {&BGRAEntry, 1};
-static constexpr rx::FastCopyFunctionMap NoCopyFunctions;
-
-constexpr Format g_formatInfoTable[] = {
- // clang-format off
- { Format::ID::NONE, GL_NONE, GL_NONE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_NONE, 0, 0, 0, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::D16_UNORM, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT16, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 16, 0 },
- { Format::ID::D24_UNORM, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT24, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 24, 0 },
- { Format::ID::D24_UNORM_S8_UINT, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 24, 8 },
- { Format::ID::D32_FLOAT, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT32F, nullptr, NoCopyFunctions, nullptr, nullptr, GL_FLOAT, 0, 0, 0, 0, 32, 0 },
- { Format::ID::D32_FLOAT_S8X24_UINT, GL_DEPTH32F_STENCIL8, GL_DEPTH32F_STENCIL8, nullptr, NoCopyFunctions, nullptr, nullptr, GL_FLOAT, 0, 0, 0, 0, 32, 8 },
- { Format::ID::D32_UNORM, GL_DEPTH_COMPONENT32_OES, GL_DEPTH_COMPONENT32_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 32, 0 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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, 0, 0 },
- { Format::ID::L16_FLOAT, GL_LUMINANCE16F_EXT, GL_LUMINANCE16F_EXT, GenerateMip<L16F>, NoCopyFunctions, ReadColor<L16F, GLfloat>, WriteColor<L16F, GLfloat>, GL_FLOAT, 0, 0, 0, 0, 0, 0 },
- { Format::ID::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, 0, 0 },
- { Format::ID::L32_FLOAT, GL_LUMINANCE32F_EXT, GL_LUMINANCE32F_EXT, GenerateMip<L32F>, NoCopyFunctions, ReadColor<L32F, GLfloat>, WriteColor<L32F, GLfloat>, GL_FLOAT, 0, 0, 0, 0, 0, 0 },
- { Format::ID::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, 0, 0 },
- { Format::ID::L8_UNORM, GL_LUMINANCE8_EXT, GL_LUMINANCE8_EXT, GenerateMip<L8>, NoCopyFunctions, ReadColor<L8, GLfloat>, WriteColor<L8, GLfloat>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::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 },
- { Format::ID::R16G16B16A16_FLOAT, GL_RGBA16F, GL_RGBA16F, GenerateMip<R16G16B16A16F>, NoCopyFunctions, ReadColor<R16G16B16A16F, GLfloat>, WriteColor<R16G16B16A16F, GLfloat>, GL_FLOAT, 16, 16, 16, 16, 0, 0 },
- { Format::ID::R16G16B16A16_SINT, GL_RGBA16I, GL_RGBA16I, GenerateMip<R16G16B16A16S>, NoCopyFunctions, ReadColor<R16G16B16A16S, GLint>, WriteColor<R16G16B16A16S, GLint>, GL_INT, 16, 16, 16, 16, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R16G16B16A16_UINT, GL_RGBA16UI, GL_RGBA16UI, GenerateMip<R16G16B16A16>, NoCopyFunctions, ReadColor<R16G16B16A16, GLuint>, WriteColor<R16G16B16A16, GLuint>, GL_UNSIGNED_INT, 16, 16, 16, 16, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R16G16B16_FLOAT, GL_RGB16F, GL_RGB16F, GenerateMip<R16G16B16F>, NoCopyFunctions, ReadColor<R16G16B16F, GLfloat>, WriteColor<R16G16B16F, GLfloat>, GL_FLOAT, 16, 16, 16, 0, 0, 0 },
- { Format::ID::R16G16B16_SINT, GL_RGB16I, GL_RGB16I, GenerateMip<R16G16B16S>, NoCopyFunctions, ReadColor<R16G16B16S, GLint>, WriteColor<R16G16B16S, GLint>, GL_INT, 16, 16, 16, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R16G16B16_UINT, GL_RGB16UI, GL_RGB16UI, GenerateMip<R16G16B16>, NoCopyFunctions, ReadColor<R16G16B16, GLuint>, WriteColor<R16G16B16, GLuint>, GL_UNSIGNED_INT, 16, 16, 16, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R16G16_FLOAT, GL_RG16F, GL_RG16F, GenerateMip<R16G16F>, NoCopyFunctions, ReadColor<R16G16F, GLfloat>, WriteColor<R16G16F, GLfloat>, GL_FLOAT, 16, 16, 0, 0, 0, 0 },
- { Format::ID::R16G16_SINT, GL_RG16I, GL_RG16I, GenerateMip<R16G16S>, NoCopyFunctions, ReadColor<R16G16S, GLint>, WriteColor<R16G16S, GLint>, GL_INT, 16, 16, 0, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R16G16_UINT, GL_RG16UI, GL_RG16UI, GenerateMip<R16G16>, NoCopyFunctions, ReadColor<R16G16, GLuint>, WriteColor<R16G16, GLuint>, GL_UNSIGNED_INT, 16, 16, 0, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R16_FLOAT, GL_R16F, GL_R16F, GenerateMip<R16F>, NoCopyFunctions, ReadColor<R16F, GLfloat>, WriteColor<R16F, GLfloat>, GL_FLOAT, 16, 0, 0, 0, 0, 0 },
- { Format::ID::R16_SINT, GL_R16I, GL_R16I, GenerateMip<R16S>, NoCopyFunctions, ReadColor<R16S, GLint>, WriteColor<R16S, GLint>, GL_INT, 16, 0, 0, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R16_UINT, GL_R16UI, GL_R16UI, GenerateMip<R16>, NoCopyFunctions, ReadColor<R16, GLuint>, WriteColor<R16, GLuint>, GL_UNSIGNED_INT, 16, 0, 0, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R32G32B32A32_FLOAT, GL_RGBA32F, GL_RGBA32F, GenerateMip<R32G32B32A32F>, NoCopyFunctions, ReadColor<R32G32B32A32F, GLfloat>, WriteColor<R32G32B32A32F, GLfloat>, GL_FLOAT, 32, 32, 32, 32, 0, 0 },
- { Format::ID::R32G32B32A32_SINT, GL_RGBA32I, GL_RGBA32I, GenerateMip<R32G32B32A32S>, NoCopyFunctions, ReadColor<R32G32B32A32S, GLint>, WriteColor<R32G32B32A32S, GLint>, GL_INT, 32, 32, 32, 32, 0, 0 },
- { Format::ID::R32G32B32A32_UINT, GL_RGBA32UI, GL_RGBA32UI, GenerateMip<R32G32B32A32>, NoCopyFunctions, ReadColor<R32G32B32A32, GLuint>, WriteColor<R32G32B32A32, GLuint>, GL_UNSIGNED_INT, 32, 32, 32, 32, 0, 0 },
- { Format::ID::R32G32B32_FLOAT, GL_RGB32F, GL_RGB32F, GenerateMip<R32G32B32F>, NoCopyFunctions, ReadColor<R32G32B32F, GLfloat>, WriteColor<R32G32B32F, GLfloat>, GL_FLOAT, 32, 32, 32, 0, 0, 0 },
- { Format::ID::R32G32B32_SINT, GL_RGB32I, GL_RGB32I, GenerateMip<R32G32B32S>, NoCopyFunctions, ReadColor<R32G32B32S, GLint>, WriteColor<R32G32B32S, GLint>, GL_INT, 32, 32, 32, 0, 0, 0 },
- { Format::ID::R32G32B32_UINT, GL_RGB32UI, GL_RGB32UI, GenerateMip<R32G32B32>, NoCopyFunctions, ReadColor<R32G32B32, GLuint>, WriteColor<R32G32B32, GLuint>, GL_UNSIGNED_INT, 32, 32, 32, 0, 0, 0 },
- { Format::ID::R32G32_FLOAT, GL_RG32F, GL_RG32F, GenerateMip<R32G32F>, NoCopyFunctions, ReadColor<R32G32F, GLfloat>, WriteColor<R32G32F, GLfloat>, GL_FLOAT, 32, 32, 0, 0, 0, 0 },
- { Format::ID::R32G32_SINT, GL_RG32I, GL_RG32I, GenerateMip<R32G32S>, NoCopyFunctions, ReadColor<R32G32S, GLint>, WriteColor<R32G32S, GLint>, GL_INT, 32, 32, 0, 0, 0, 0 },
- { Format::ID::R32G32_UINT, GL_RG32UI, GL_RG32UI, GenerateMip<R32G32>, NoCopyFunctions, ReadColor<R32G32, GLuint>, WriteColor<R32G32, GLuint>, GL_UNSIGNED_INT, 32, 32, 0, 0, 0, 0 },
- { Format::ID::R32_FLOAT, GL_R32F, GL_R32F, GenerateMip<R32F>, NoCopyFunctions, ReadColor<R32F, GLfloat>, WriteColor<R32F, GLfloat>, GL_FLOAT, 32, 0, 0, 0, 0, 0 },
- { Format::ID::R32_SINT, GL_R32I, GL_R32I, GenerateMip<R32S>, NoCopyFunctions, ReadColor<R32S, GLint>, WriteColor<R32S, GLint>, GL_INT, 32, 0, 0, 0, 0, 0 },
- { Format::ID::R32_UINT, GL_R32UI, GL_R32UI, GenerateMip<R32>, NoCopyFunctions, ReadColor<R32, GLuint>, WriteColor<R32, GLuint>, GL_UNSIGNED_INT, 32, 0, 0, 0, 0, 0 },
- { Format::ID::R4G4B4A4_UNORM, GL_RGBA4, GL_RGBA4, GenerateMip<R4G4B4A4>, NoCopyFunctions, ReadColor<R4G4B4A4, GLfloat>, WriteColor<R4G4B4A4, GLfloat>, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R5G6B5_UNORM, GL_RGB565, GL_RGB565, GenerateMip<R5G6B5>, NoCopyFunctions, ReadColor<R5G6B5, GLfloat>, WriteColor<R5G6B5, GLfloat>, GL_UNSIGNED_NORMALIZED, 5, 6, 5, 0, 0, 0 },
- { Format::ID::R8G8B8A8_SINT, GL_RGBA8I, GL_RGBA8I, GenerateMip<R8G8B8A8S>, NoCopyFunctions, ReadColor<R8G8B8A8S, GLint>, WriteColor<R8G8B8A8S, GLint>, GL_INT, 8, 8, 8, 8, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R8G8B8A8_UINT, GL_RGBA8UI, GL_RGBA8UI, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLuint>, WriteColor<R8G8B8A8, GLuint>, GL_UNSIGNED_INT, 8, 8, 8, 8, 0, 0 },
- { Format::ID::R8G8B8A8_UNORM, GL_RGBA8, GL_RGBA8, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLfloat>, WriteColor<R8G8B8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R8G8B8_SINT, GL_RGB8I, GL_RGB8I, GenerateMip<R8G8B8S>, NoCopyFunctions, ReadColor<R8G8B8S, GLint>, WriteColor<R8G8B8S, GLint>, GL_INT, 8, 8, 8, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R8G8B8_UINT, GL_RGB8UI, GL_RGB8UI, GenerateMip<R8G8B8>, NoCopyFunctions, ReadColor<R8G8B8, GLuint>, WriteColor<R8G8B8, GLuint>, GL_UNSIGNED_INT, 8, 8, 8, 0, 0, 0 },
- { Format::ID::R8G8B8_UNORM, GL_RGB8, GL_RGB8, GenerateMip<R8G8B8>, NoCopyFunctions, ReadColor<R8G8B8, GLfloat>, WriteColor<R8G8B8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R8G8_SINT, GL_RG8I, GL_RG8I, GenerateMip<R8G8S>, NoCopyFunctions, ReadColor<R8G8S, GLint>, WriteColor<R8G8S, GLint>, GL_INT, 8, 8, 0, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R8G8_UINT, GL_RG8UI, GL_RG8UI, GenerateMip<R8G8>, NoCopyFunctions, ReadColor<R8G8, GLuint>, WriteColor<R8G8, GLuint>, GL_UNSIGNED_INT, 8, 8, 0, 0, 0, 0 },
- { Format::ID::R8G8_UNORM, GL_RG8, GL_RG8, GenerateMip<R8G8>, NoCopyFunctions, ReadColor<R8G8, GLfloat>, WriteColor<R8G8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 0, 0, 0, 0 },
- { Format::ID::R8_SINT, GL_R8I, GL_R8I, GenerateMip<R8S>, NoCopyFunctions, ReadColor<R8S, GLint>, WriteColor<R8S, GLint>, GL_INT, 8, 0, 0, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::R8_UINT, GL_R8UI, GL_R8UI, GenerateMip<R8>, NoCopyFunctions, ReadColor<R8, GLuint>, WriteColor<R8, GLuint>, GL_UNSIGNED_INT, 8, 0, 0, 0, 0, 0 },
- { Format::ID::R8_UNORM, GL_R8, GL_R8, GenerateMip<R8>, NoCopyFunctions, ReadColor<R8, GLfloat>, WriteColor<R8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 0, 0, 0, 0, 0 },
- { Format::ID::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 },
- { Format::ID::S8_UINT, GL_STENCIL_INDEX8, GL_STENCIL_INDEX8, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_INT, 0, 0, 0, 0, 0, 8 },
- // clang-format on
-};
-
-// static
-Format::ID Format::InternalFormatToID(GLenum internalFormat)
-{
- switch (internalFormat)
- {
- case GL_RGBA16_EXT:
- return Format::ID::R16G16B16A16_UNORM;
- case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
- return Format::ID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK;
- case GL_RG8I:
- return Format::ID::R8G8_SINT;
- case GL_R16F:
- return Format::ID::R16_FLOAT;
- case GL_RGBA8I:
- return Format::ID::R8G8B8A8_SINT;
- case GL_RG8UI:
- return Format::ID::R8G8_UINT;
- case GL_RGBA8_SNORM:
- return Format::ID::R8G8B8A8_SNORM;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
- return Format::ID::ASTC_12x10_SRGB_BLOCK;
- case GL_RG8_SNORM:
- return Format::ID::R8G8_SNORM;
- case GL_BGR565_ANGLEX:
- return Format::ID::B5G6R5_UNORM;
- case GL_DEPTH_COMPONENT24:
- return Format::ID::D24_UNORM;
- case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- return Format::ID::ETC2_R8G8B8A1_UNORM_BLOCK;
- case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
- return Format::ID::ASTC_10x10_UNORM_BLOCK;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
- return Format::ID::ASTC_8x6_SRGB_BLOCK;
- case GL_RGB32UI:
- return Format::ID::R32G32B32_UINT;
- case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
- return Format::ID::ASTC_6x5_UNORM_BLOCK;
- case GL_ALPHA32F_EXT:
- return Format::ID::A32_FLOAT;
- case GL_R16UI:
- return Format::ID::R16_UINT;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
- return Format::ID::ASTC_5x4_SRGB_BLOCK;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
- return Format::ID::ASTC_5x5_SRGB_BLOCK;
- case GL_COMPRESSED_R11_EAC:
- return Format::ID::EAC_R11_UNORM_BLOCK;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
- return Format::ID::ASTC_10x10_SRGB_BLOCK;
- case GL_RGBA32UI:
- return Format::ID::R32G32B32A32_UINT;
- case GL_R8_SNORM:
- return Format::ID::R8_SNORM;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- return Format::ID::BC1_RGBA_UNORM_SRGB_BLOCK;
- case GL_LUMINANCE32F_EXT:
- return Format::ID::L32_FLOAT;
- case GL_RG16_EXT:
- return Format::ID::R16G16_UNORM;
- case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- return Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK;
- case GL_SRGB8:
- return Format::ID::R8G8B8_UNORM_SRGB;
- case GL_LUMINANCE8_ALPHA8_EXT:
- return Format::ID::L8A8_UNORM;
- case GL_BGRX8_ANGLEX:
- return Format::ID::B8G8R8X8_UNORM;
- case GL_RGB16_SNORM_EXT:
- return Format::ID::R16G16B16_SNORM;
- case GL_RGBA8UI:
- return Format::ID::R8G8B8A8_UINT;
- case GL_BGRA4_ANGLEX:
- return Format::ID::B4G4R4A4_UNORM;
- case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
- return Format::ID::ETC2_R8G8B8A8_SRGB_BLOCK;
- case GL_LUMINANCE8_EXT:
- return Format::ID::L8_UNORM;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- return Format::ID::BC3_RGBA_UNORM_BLOCK;
- case GL_R16I:
- return Format::ID::R16_SINT;
- case GL_RGB5_A1:
- return Format::ID::R5G5B5A1_UNORM;
- case GL_RGB16UI:
- return Format::ID::R16G16B16_UINT;
- case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
- return Format::ID::ASTC_4x4_UNORM_BLOCK;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- return Format::ID::BC2_RGBA_UNORM_SRGB_BLOCK;
- case GL_R16_SNORM_EXT:
- return Format::ID::R16_SNORM;
- case GL_COMPRESSED_RGB8_ETC2:
- return Format::ID::ETC2_R8G8B8_UNORM_BLOCK;
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- return Format::ID::BC1_RGB_UNORM_SRGB_BLOCK;
- case GL_RGBA32F:
- return Format::ID::R32G32B32A32_FLOAT;
- case GL_RGBA32I:
- return Format::ID::R32G32B32A32_SINT;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- return Format::ID::BC3_RGBA_UNORM_SRGB_BLOCK;
- case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
- return Format::ID::ASTC_8x5_UNORM_BLOCK;
- case GL_RG8:
- return Format::ID::R8G8_UNORM;
- case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
- return Format::ID::ASTC_8x8_UNORM_BLOCK;
- case GL_RGB10_A2:
- return Format::ID::R10G10B10A2_UNORM;
- case GL_COMPRESSED_SIGNED_RG11_EAC:
- return Format::ID::EAC_R11G11_SNORM_BLOCK;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
- return Format::ID::ASTC_6x6_SRGB_BLOCK;
- case GL_DEPTH_COMPONENT16:
- return Format::ID::D16_UNORM;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
- return Format::ID::ASTC_10x5_SRGB_BLOCK;
- case GL_RGB32I:
- return Format::ID::R32G32B32_SINT;
- case GL_R8:
- return Format::ID::R8_UNORM;
- case GL_RGB32F:
- return Format::ID::R32G32B32_FLOAT;
- case GL_R16_EXT:
- return Format::ID::R16_UNORM;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
- return Format::ID::ASTC_8x8_SRGB_BLOCK;
- case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
- return Format::ID::ASTC_10x5_UNORM_BLOCK;
- case GL_R11F_G11F_B10F:
- return Format::ID::R11G11B10_FLOAT;
- case GL_RGB8:
- return Format::ID::R8G8B8_UNORM;
- case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
- return Format::ID::ASTC_5x5_UNORM_BLOCK;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
- return Format::ID::ASTC_8x5_SRGB_BLOCK;
- case GL_RGBA16I:
- return Format::ID::R16G16B16A16_SINT;
- case GL_R8I:
- return Format::ID::R8_SINT;
- case GL_RGB8_SNORM:
- return Format::ID::R8G8B8_SNORM;
- case GL_RG32F:
- return Format::ID::R32G32_FLOAT;
- case GL_DEPTH_COMPONENT32F:
- return Format::ID::D32_FLOAT;
- case GL_RG32I:
- return Format::ID::R32G32_SINT;
- case GL_ALPHA8_EXT:
- return Format::ID::A8_UNORM;
- case GL_RGB16_EXT:
- return Format::ID::R16G16B16_UNORM;
- case GL_BGRA8_EXT:
- return Format::ID::B8G8R8A8_UNORM;
- case GL_RG32UI:
- return Format::ID::R32G32_UINT;
- case GL_RGBA16UI:
- return Format::ID::R16G16B16A16_UINT;
- case GL_COMPRESSED_RGBA8_ETC2_EAC:
- return Format::ID::ETC2_R8G8B8A8_UNORM_BLOCK;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return Format::ID::BC1_RGBA_UNORM_BLOCK;
- case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
- return Format::ID::ASTC_10x6_UNORM_BLOCK;
- case GL_COMPRESSED_SRGB8_ETC2:
- return Format::ID::ETC2_R8G8B8_SRGB_BLOCK;
- case GL_BGRA8_SRGB_ANGLEX:
- return Format::ID::B8G8R8A8_UNORM_SRGB;
- case GL_DEPTH32F_STENCIL8:
- return Format::ID::D32_FLOAT_S8X24_UINT;
- case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
- return Format::ID::ASTC_6x6_UNORM_BLOCK;
- case GL_R32UI:
- return Format::ID::R32_UINT;
- case GL_BGR5_A1_ANGLEX:
- return Format::ID::B5G5R5A1_UNORM;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
- return Format::ID::ASTC_12x12_SRGB_BLOCK;
- case GL_COMPRESSED_RG11_EAC:
- return Format::ID::EAC_R11G11_UNORM_BLOCK;
- case GL_SRGB8_ALPHA8:
- return Format::ID::R8G8B8A8_UNORM_SRGB;
- case GL_LUMINANCE_ALPHA16F_EXT:
- return Format::ID::L16A16_FLOAT;
- case GL_RGBA:
- return Format::ID::R8G8B8A8_UNORM;
- case GL_ETC1_RGB8_OES:
- return Format::ID::ETC1_R8G8B8_UNORM_BLOCK;
- case GL_DEPTH24_STENCIL8:
- return Format::ID::D24_UNORM_S8_UINT;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
- return Format::ID::ASTC_4x4_SRGB_BLOCK;
- case GL_RGB16I:
- return Format::ID::R16G16B16_SINT;
- case GL_R8UI:
- return Format::ID::R8_UINT;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
- return Format::ID::ASTC_10x6_SRGB_BLOCK;
- case GL_RGBA16F:
- return Format::ID::R16G16B16A16_FLOAT;
- case GL_COMPRESSED_SIGNED_R11_EAC:
- return Format::ID::EAC_R11_SNORM_BLOCK;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return Format::ID::BC1_RGB_UNORM_BLOCK;
- case GL_RGB8I:
- return Format::ID::R8G8B8_SINT;
- case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
- return Format::ID::ASTC_8x6_UNORM_BLOCK;
- case GL_STENCIL_INDEX8:
- return Format::ID::S8_UINT;
- case GL_LUMINANCE_ALPHA32F_EXT:
- return Format::ID::L32A32_FLOAT;
- case GL_ALPHA16F_EXT:
- return Format::ID::A16_FLOAT;
- case GL_RGB8UI:
- return Format::ID::R8G8B8_UINT;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
- return Format::ID::ASTC_10x8_SRGB_BLOCK;
- case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
- return Format::ID::ASTC_12x10_UNORM_BLOCK;
- case GL_RGB9_E5:
- return Format::ID::R9G9B9E5_SHAREDEXP;
- case GL_RGBA16_SNORM_EXT:
- return Format::ID::R16G16B16A16_SNORM;
- case GL_R32I:
- return Format::ID::R32_SINT;
- case GL_DEPTH_COMPONENT32_OES:
- return Format::ID::D32_UNORM;
- case GL_R32F:
- return Format::ID::R32_FLOAT;
- case GL_NONE:
- return Format::ID::NONE;
- case GL_RG16F:
- return Format::ID::R16G16_FLOAT;
- case GL_RGB:
- return Format::ID::R8G8B8_UNORM;
- case GL_RGB565:
- return Format::ID::R5G6B5_UNORM;
- case GL_LUMINANCE16F_EXT:
- return Format::ID::L16_FLOAT;
- case GL_RG16UI:
- return Format::ID::R16G16_UINT;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- return Format::ID::BC2_RGBA_UNORM_BLOCK;
- case GL_RG16I:
- return Format::ID::R16G16_SINT;
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
- return Format::ID::ASTC_6x5_SRGB_BLOCK;
- case GL_RG16_SNORM_EXT:
- return Format::ID::R16G16_SNORM;
- case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
- return Format::ID::ASTC_12x12_UNORM_BLOCK;
- case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
- return Format::ID::ASTC_5x4_UNORM_BLOCK;
- case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
- return Format::ID::ASTC_10x8_UNORM_BLOCK;
- case GL_RGBA4:
- return Format::ID::R4G4B4A4_UNORM;
- case GL_RGBA8:
- return Format::ID::R8G8B8A8_UNORM;
- case GL_RGB16F:
- return Format::ID::R16G16B16_FLOAT;
- case GL_RGB10_A2UI:
- return Format::ID::R10G10B10A2_UINT;
- default:
- return Format::ID::NONE;
- }
-}
-
-// static
-const Format &Format::Get(ID id)
-{
- return g_formatInfoTable[static_cast<size_t>(id)];
-}
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h
deleted file mode 100644
index 056ddc833a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h
+++ /dev/null
@@ -1,54 +0,0 @@
-//
-// 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/FramebufferAttachment.h"
-
-namespace rx
-{
-
-class FramebufferAttachmentObjectImpl : angle::NonCopyable
-{
- public:
- FramebufferAttachmentObjectImpl() {}
- virtual ~FramebufferAttachmentObjectImpl() {}
-
- virtual gl::Error getAttachmentRenderTarget(const gl::Context *context,
- GLenum binding,
- const gl::ImageIndex &imageIndex,
- FramebufferAttachmentRenderTarget **rtOut);
-
- virtual gl::Error initializeContents(const gl::Context *context,
- const gl::ImageIndex &imageIndex);
-};
-
-inline gl::Error FramebufferAttachmentObjectImpl::getAttachmentRenderTarget(
- const gl::Context *context,
- GLenum binding,
- const gl::ImageIndex &imageIndex,
- FramebufferAttachmentRenderTarget **rtOut)
-{
- UNIMPLEMENTED();
- return gl::OutOfMemory() << "getAttachmentRenderTarget not supported.";
-}
-
-inline gl::Error FramebufferAttachmentObjectImpl::initializeContents(
- const gl::Context *context,
- const gl::ImageIndex &imageIndex)
-{
- UNIMPLEMENTED();
- return gl::OutOfMemory() << "initialize not supported.";
-}
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_FRAMEBUFFER_ATTACHMENT_OBJECT_IMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/FramebufferImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/FramebufferImpl.h
deleted file mode 100644
index ebb166ca80..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/FramebufferImpl.h
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// 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 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 void destroyDefault(const egl::Display *display) {}
-
- virtual gl::Error discard(const gl::Context *context,
- size_t count,
- const GLenum *attachments) = 0;
- virtual gl::Error invalidate(const gl::Context *context,
- size_t count,
- const GLenum *attachments) = 0;
- virtual gl::Error invalidateSub(const gl::Context *context,
- size_t count,
- const GLenum *attachments,
- const gl::Rectangle &area) = 0;
-
- virtual gl::Error clear(const gl::Context *context, GLbitfield mask) = 0;
- virtual gl::Error clearBufferfv(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLfloat *values) = 0;
- virtual gl::Error clearBufferuiv(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLuint *values) = 0;
- virtual gl::Error clearBufferiv(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLint *values) = 0;
- virtual gl::Error 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 gl::Error readPixels(const gl::Context *context,
- const gl::Rectangle &area,
- GLenum format,
- GLenum type,
- void *pixels) = 0;
-
- virtual gl::Error 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 void syncState(const gl::Context *context,
- const gl::Framebuffer::DirtyBits &dirtyBits) = 0;
-
- virtual gl::Error getSamplePosition(size_t index, GLfloat *xy) const = 0;
-
- const gl::FramebufferState &getState() const { return mState; }
-
- protected:
- const gl::FramebufferState &mState;
-};
-}
-
-#endif // LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/FramebufferImpl_mock.h b/src/3rdparty/angle/src/libANGLE/renderer/FramebufferImpl_mock.h
deleted file mode 100644
index c2d069676e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/FramebufferImpl_mock.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// 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.
-//
-// FramebufferImpl_mock.h:
-// Defines a mock of the FramebufferImpl class.
-//
-
-#ifndef LIBANGLE_RENDERER_FRAMEBUFFERIMPLMOCK_H_
-#define LIBANGLE_RENDERER_FRAMEBUFFERIMPLMOCK_H_
-
-#include "gmock/gmock.h"
-
-#include "libANGLE/renderer/FramebufferImpl.h"
-
-namespace rx
-{
-
-class MockFramebufferImpl : public rx::FramebufferImpl
-{
- public:
- MockFramebufferImpl() : rx::FramebufferImpl(gl::FramebufferState()) {}
- virtual ~MockFramebufferImpl() { destructor(); }
-
- MOCK_METHOD3(discard, gl::Error(const gl::Context *, size_t, const GLenum *));
- MOCK_METHOD3(invalidate, gl::Error(const gl::Context *, size_t, const GLenum *));
- MOCK_METHOD4(invalidateSub,
- gl::Error(const gl::Context *, size_t, const GLenum *, const gl::Rectangle &));
-
- MOCK_METHOD2(clear, gl::Error(const gl::Context *, GLbitfield));
- MOCK_METHOD4(clearBufferfv, gl::Error(const gl::Context *, GLenum, GLint, const GLfloat *));
- MOCK_METHOD4(clearBufferuiv, gl::Error(const gl::Context *, GLenum, GLint, const GLuint *));
- MOCK_METHOD4(clearBufferiv, gl::Error(const gl::Context *, GLenum, GLint, const GLint *));
- MOCK_METHOD5(clearBufferfi, gl::Error(const gl::Context *, GLenum, GLint, GLfloat, GLint));
-
- MOCK_CONST_METHOD1(getImplementationColorReadFormat, GLenum(const gl::Context *));
- MOCK_CONST_METHOD1(getImplementationColorReadType, GLenum(const gl::Context *));
- MOCK_METHOD5(readPixels,
- gl::Error(const gl::Context *, const gl::Rectangle &, GLenum, GLenum, void *));
-
- MOCK_CONST_METHOD2(getSamplePosition, gl::Error(size_t, GLfloat *));
-
- MOCK_METHOD5(blit,
- gl::Error(const gl::Context *,
- const gl::Rectangle &,
- const gl::Rectangle &,
- GLbitfield,
- GLenum));
-
- MOCK_CONST_METHOD1(checkStatus, bool(const gl::Context *));
-
- MOCK_METHOD2(syncState, void(const gl::Context *, const gl::Framebuffer::DirtyBits &));
-
- MOCK_METHOD0(destructor, void());
-};
-
-inline ::testing::NiceMock<MockFramebufferImpl> *MakeFramebufferMock()
-{
- ::testing::NiceMock<MockFramebufferImpl> *framebufferImpl =
- new ::testing::NiceMock<MockFramebufferImpl>();
- // TODO(jmadill): add ON_CALLS for other returning methods
- ON_CALL(*framebufferImpl, checkStatus(testing::_)).WillByDefault(::testing::Return(true));
-
- // We must mock the destructor since NiceMock doesn't work for destructors.
- EXPECT_CALL(*framebufferImpl, destructor()).Times(1).RetiresOnSaturation();
-
- return framebufferImpl;
-}
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_FRAMEBUFFERIMPLMOCK_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/GLImplFactory.h b/src/3rdparty/angle/src/libANGLE/renderer/GLImplFactory.h
deleted file mode 100644
index b9a135f596..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/GLImplFactory.h
+++ /dev/null
@@ -1,93 +0,0 @@
-//
-// 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/Shader.h"
-#include "libANGLE/TransformFeedback.h"
-#include "libANGLE/VertexArray.h"
-
-namespace gl
-{
-class ContextState;
-}
-
-namespace rx
-{
-class BufferImpl;
-class CompilerImpl;
-class ContextImpl;
-class FenceNVImpl;
-class SyncImpl;
-class FramebufferImpl;
-class PathImpl;
-class ProgramImpl;
-class ProgramPipelineImpl;
-class QueryImpl;
-class RenderbufferImpl;
-class SamplerImpl;
-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() = 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(GLenum 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;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_GLIMPLFACTORY_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/ImageImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/ImageImpl.h
deleted file mode 100644
index 79694eaebf..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/ImageImpl.h
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// 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"
-
-namespace gl
-{
-class Context;
-} // namespace gl
-
-namespace egl
-{
-class ImageSibling;
-struct ImageState;
-} // namespace egl
-
-namespace rx
-{
-class ImageImpl : angle::NonCopyable
-{
- public:
- ImageImpl(const egl::ImageState &state) : mState(state) {}
- virtual ~ImageImpl() {}
- virtual egl::Error initialize() = 0;
-
- virtual gl::Error orphan(const gl::Context *context, egl::ImageSibling *sibling) = 0;
-
- protected:
- const egl::ImageState &mState;
-};
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_IMAGEIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/ImageImpl_mock.h b/src/3rdparty/angle/src/libANGLE/renderer/ImageImpl_mock.h
deleted file mode 100644
index 30c0cc2594..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/ImageImpl_mock.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// 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_mock.h: Defines a mock of the ImageImpl class.
-
-#ifndef LIBANGLE_RENDERER_IMAGEIMPLMOCK_H_
-#define LIBANGLE_RENDERER_IMAGEIMPLMOCK_H_
-
-#include "gmock/gmock.h"
-
-#include "libANGLE/renderer/ImageImpl.h"
-
-namespace rx
-{
-class MockImageImpl : public ImageImpl
-{
- public:
- MockImageImpl(const egl::ImageState &state,
- EGLenum /*target*/,
- const egl::AttributeMap & /*attribs*/)
- : ImageImpl(state)
- {
- }
- virtual ~MockImageImpl() { destructor(); }
- MOCK_METHOD0(initialize, egl::Error(void));
- MOCK_METHOD2(orphan, gl::Error(const gl::Context *, egl::ImageSibling *));
- MOCK_METHOD0(destructor, void());
-};
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_IMAGEIMPLMOCK_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/PathImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/PathImpl.h
deleted file mode 100644
index 3607f69a2b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/PathImpl.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// 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 gl::Error 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/src/3rdparty/angle/src/libANGLE/renderer/ProgramImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/ProgramImpl.h
deleted file mode 100644
index 2371b2759c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/ProgramImpl.h
+++ /dev/null
@@ -1,107 +0,0 @@
-//
-// 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 sh
-{
-struct BlockMemberInfo;
-}
-
-namespace rx
-{
-class ProgramImpl : angle::NonCopyable
-{
- public:
- ProgramImpl(const gl::ProgramState &state) : mState(state) {}
- virtual ~ProgramImpl() {}
- virtual void destroy(const gl::Context *context) {}
-
- virtual gl::LinkResult load(const gl::Context *context,
- gl::InfoLog &infoLog,
- gl::BinaryInputStream *stream) = 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 gl::LinkResult 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;
-
- // TODO: synchronize in syncState when dirty bits exist.
- virtual void setUniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformBlockBinding) = 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)
- {
- }
-
- protected:
- const gl::ProgramState &mState;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_PROGRAMIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/ProgramImpl_mock.h b/src/3rdparty/angle/src/libANGLE/renderer/ProgramImpl_mock.h
deleted file mode 100644
index 4717ab8843..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/ProgramImpl_mock.h
+++ /dev/null
@@ -1,84 +0,0 @@
-//
-// 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.
-//
-// ProgramImpl_mock.h:
-// Defines a mock of the ProgramImpl class.
-//
-
-#ifndef LIBANGLE_RENDERER_PROGRAMIMPLMOCK_H_
-#define LIBANGLE_RENDERER_PROGRAMIMPLMOCK_H_
-
-#include "gmock/gmock.h"
-
-#include "libANGLE/ProgramLinkedResources.h"
-#include "libANGLE/renderer/ProgramImpl.h"
-
-namespace rx
-{
-
-class MockProgramImpl : public rx::ProgramImpl
-{
- public:
- MockProgramImpl() : ProgramImpl(gl::ProgramState()) {}
- virtual ~MockProgramImpl() { destructor(); }
-
- MOCK_METHOD3(load, gl::LinkResult(const gl::Context *, gl::InfoLog &, gl::BinaryInputStream *));
- MOCK_METHOD2(save, void(const gl::Context *, gl::BinaryOutputStream *));
- MOCK_METHOD1(setBinaryRetrievableHint, void(bool));
- MOCK_METHOD1(setSeparable, void(bool));
-
- MOCK_METHOD3(link,
- gl::LinkResult(const gl::Context *,
- const gl::ProgramLinkedResources &,
- gl::InfoLog &));
- MOCK_METHOD2(validate, GLboolean(const gl::Caps &, gl::InfoLog *));
-
- MOCK_METHOD3(setUniform1fv, void(GLint, GLsizei, const GLfloat *));
- MOCK_METHOD3(setUniform2fv, void(GLint, GLsizei, const GLfloat *));
- MOCK_METHOD3(setUniform3fv, void(GLint, GLsizei, const GLfloat *));
- MOCK_METHOD3(setUniform4fv, void(GLint, GLsizei, const GLfloat *));
- MOCK_METHOD3(setUniform1iv, void(GLint, GLsizei, const GLint *));
- MOCK_METHOD3(setUniform2iv, void(GLint, GLsizei, const GLint *));
- MOCK_METHOD3(setUniform3iv, void(GLint, GLsizei, const GLint *));
- MOCK_METHOD3(setUniform4iv, void(GLint, GLsizei, const GLint *));
- MOCK_METHOD3(setUniform1uiv, void(GLint, GLsizei, const GLuint *));
- MOCK_METHOD3(setUniform2uiv, void(GLint, GLsizei, const GLuint *));
- MOCK_METHOD3(setUniform3uiv, void(GLint, GLsizei, const GLuint *));
- MOCK_METHOD3(setUniform4uiv, void(GLint, GLsizei, const GLuint *));
-
- MOCK_METHOD4(setUniformMatrix2fv, void(GLint, GLsizei, GLboolean, const GLfloat *));
- MOCK_METHOD4(setUniformMatrix3fv, void(GLint, GLsizei, GLboolean, const GLfloat *));
- MOCK_METHOD4(setUniformMatrix4fv, void(GLint, GLsizei, GLboolean, const GLfloat *));
- MOCK_METHOD4(setUniformMatrix2x3fv, void(GLint, GLsizei, GLboolean, const GLfloat *));
- MOCK_METHOD4(setUniformMatrix3x2fv, void(GLint, GLsizei, GLboolean, const GLfloat *));
- MOCK_METHOD4(setUniformMatrix2x4fv, void(GLint, GLsizei, GLboolean, const GLfloat *));
- MOCK_METHOD4(setUniformMatrix4x2fv, void(GLint, GLsizei, GLboolean, const GLfloat *));
- MOCK_METHOD4(setUniformMatrix3x4fv, void(GLint, GLsizei, GLboolean, const GLfloat *));
- MOCK_METHOD4(setUniformMatrix4x3fv, void(GLint, GLsizei, GLboolean, const GLfloat *));
-
- MOCK_CONST_METHOD3(getUniformfv, void(const gl::Context *, GLint, GLfloat *));
- MOCK_CONST_METHOD3(getUniformiv, void(const gl::Context *, GLint, GLint *));
- MOCK_CONST_METHOD3(getUniformuiv, void(const gl::Context *, GLint, GLuint *));
-
- MOCK_METHOD2(setUniformBlockBinding, void(GLuint, GLuint));
- MOCK_METHOD4(setPathFragmentInputGen,
- void(const std::string &, GLenum, GLint, const GLfloat *));
-
- MOCK_METHOD0(destructor, void());
-};
-
-inline ::testing::NiceMock<MockProgramImpl> *MakeProgramMock()
-{
- ::testing::NiceMock<MockProgramImpl> *programImpl = new ::testing::NiceMock<MockProgramImpl>();
- // TODO(jmadill): add ON_CALLS for returning methods
- // We must mock the destructor since NiceMock doesn't work for destructors.
- EXPECT_CALL(*programImpl, destructor()).Times(1).RetiresOnSaturation();
-
- return programImpl;
-}
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_PROGRAMIMPLMOCK_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/ProgramPipelineImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/ProgramPipelineImpl.h
deleted file mode 100644
index 242e9260f1..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/ProgramPipelineImpl.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/QueryImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/QueryImpl.h
deleted file mode 100644
index d738eb4ffc..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/QueryImpl.h
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// 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 "libANGLE/Error.h"
-
-#include "common/angleutils.h"
-
-#include <GLES2/gl2.h>
-
-namespace rx
-{
-
-class QueryImpl : angle::NonCopyable
-{
- public:
- explicit QueryImpl(GLenum type) { mType = type; }
- virtual ~QueryImpl() { }
-
- virtual gl::Error begin() = 0;
- virtual gl::Error end() = 0;
- virtual gl::Error queryCounter() = 0;
- virtual gl::Error getResult(GLint *params) = 0;
- virtual gl::Error getResult(GLuint *params) = 0;
- virtual gl::Error getResult(GLint64 *params) = 0;
- virtual gl::Error getResult(GLuint64 *params) = 0;
- virtual gl::Error isResultAvailable(bool *available) = 0;
-
- GLenum getType() const { return mType; }
-
- private:
- GLenum mType;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_QUERYIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/RenderbufferImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/RenderbufferImpl.h
deleted file mode 100644
index a70ab1d0f0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/RenderbufferImpl.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// 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 egl
-{
-class Image;
-}
-
-namespace rx
-{
-
-class RenderbufferImpl : public FramebufferAttachmentObjectImpl
-{
- public:
- RenderbufferImpl() {}
- ~RenderbufferImpl() override {}
- virtual gl::Error onDestroy(const gl::Context *context);
-
- virtual gl::Error setStorage(const gl::Context *context,
- GLenum internalformat,
- size_t width,
- size_t height) = 0;
- virtual gl::Error setStorageMultisample(const gl::Context *context,
- size_t samples,
- GLenum internalformat,
- size_t width,
- size_t height) = 0;
- virtual gl::Error setStorageEGLImageTarget(const gl::Context *context, egl::Image *image) = 0;
-};
-
-inline gl::Error RenderbufferImpl::onDestroy(const gl::Context *context)
-{
- return gl::NoError();
-}
-}
-
-#endif // LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/RenderbufferImpl_mock.h b/src/3rdparty/angle/src/libANGLE/renderer/RenderbufferImpl_mock.h
deleted file mode 100644
index 408b9a5fe9..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/RenderbufferImpl_mock.h
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// 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.
-//
-
-// RenderbufferImpl_mock.h: Defines a mock of the RenderbufferImpl class.
-
-#ifndef LIBANGLE_RENDERER_RENDERBUFFERIMPLMOCK_H_
-#define LIBANGLE_RENDERER_RENDERBUFFERIMPLMOCK_H_
-
-#include "gmock/gmock.h"
-
-#include "libANGLE/Image.h"
-#include "libANGLE/renderer/RenderbufferImpl.h"
-
-namespace rx
-{
-
-class MockRenderbufferImpl : public RenderbufferImpl
-{
- public:
- virtual ~MockRenderbufferImpl() { destructor(); }
- MOCK_METHOD4(setStorage, gl::Error(const gl::Context *, GLenum, size_t, size_t));
- MOCK_METHOD5(setStorageMultisample,
- gl::Error(const gl::Context *, size_t, GLenum, size_t, size_t));
- MOCK_METHOD2(setStorageEGLImageTarget, gl::Error(const gl::Context *, egl::Image *));
-
- MOCK_METHOD4(getAttachmentRenderTarget,
- gl::Error(const gl::Context *,
- GLenum,
- const gl::ImageIndex &,
- FramebufferAttachmentRenderTarget **));
-
- MOCK_METHOD0(destructor, void());
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_RENDERBUFFERIMPLMOCK_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/SamplerImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/SamplerImpl.h
deleted file mode 100644
index 66e1079b64..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/SamplerImpl.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// 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;
-struct 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/src/3rdparty/angle/src/libANGLE/renderer/ShaderImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/ShaderImpl.h
deleted file mode 100644
index 77e02d0237..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/ShaderImpl.h
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// 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 "common/angleutils.h"
-#include "libANGLE/Shader.h"
-
-namespace rx
-{
-
-class ShaderImpl : angle::NonCopyable
-{
- public:
- ShaderImpl(const gl::ShaderState &data) : mData(data) {}
- virtual ~ShaderImpl() { }
-
- // Returns additional sh::Compile options.
- virtual ShCompileOptions prepareSourceAndReturnOptions(std::stringstream *sourceStream,
- std::string *sourcePath) = 0;
- // Returns success for compiling on the driver. Returns success.
- virtual bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) = 0;
-
- virtual std::string getDebugInfo() const = 0;
-
- const gl::ShaderState &getData() const { return mData; }
-
- protected:
- const gl::ShaderState &mData;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_SHADERIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/StreamProducerImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/StreamProducerImpl.h
deleted file mode 100644
index 1915bf75d3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/StreamProducerImpl.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// 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 validateD3DNV12Texture(void *pointer) 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 postD3DNV12Texture(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/src/3rdparty/angle/src/libANGLE/renderer/SurfaceImpl.cpp b/src/3rdparty/angle/src/libANGLE/renderer/SurfaceImpl.cpp
deleted file mode 100644
index cd2fa3dde6..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/SurfaceImpl.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// 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::swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects)
-{
- UNREACHABLE();
- return egl::EglBadSurface() << "swapWithDamage implementation missing.";
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/SurfaceImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/SurfaceImpl.h
deleted file mode 100644
index eaa27de281..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/SurfaceImpl.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// 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 gl
-{
-class FramebufferState;
-}
-
-namespace egl
-{
-class Display;
-struct Config;
-struct SurfaceState;
-class Thread;
-}
-
-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::FramebufferState &state) = 0;
- 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 querySurfacePointerANGLE(EGLint attribute, void **value) = 0;
- virtual egl::Error bindTexImage(gl::Texture *texture, EGLint buffer) = 0;
- virtual egl::Error releaseTexImage(EGLint buffer) = 0;
- virtual egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) = 0;
- virtual void setSwapInterval(EGLint interval) = 0;
-
- // width and height can change with client window resizing
- virtual EGLint getWidth() const = 0;
- virtual EGLint getHeight() const = 0;
-
- virtual EGLint isPostSubBufferSupported() const = 0;
- virtual EGLint getSwapBehavior() const = 0;
-
- protected:
- const egl::SurfaceState &mState;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_SURFACEIMPL_H_
-
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/SyncImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/SyncImpl.h
deleted file mode 100644
index 22c92c3729..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/SyncImpl.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// 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 rx
-{
-
-class SyncImpl : angle::NonCopyable
-{
- public:
- SyncImpl(){};
- virtual ~SyncImpl(){};
-
- virtual gl::Error set(GLenum condition, GLbitfield flags) = 0;
- virtual gl::Error clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult) = 0;
- virtual gl::Error serverWait(GLbitfield flags, GLuint64 timeout) = 0;
- virtual gl::Error getStatus(GLint *outResult) = 0;
-};
-}
-
-#endif // LIBANGLE_RENDERER_FENCESYNCIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/TextureImpl.cpp b/src/3rdparty/angle/src/libANGLE/renderer/TextureImpl.cpp
deleted file mode 100644
index 830d30e6d1..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/TextureImpl.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// 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()
-{
-}
-
-gl::Error TextureImpl::onDestroy(const gl::Context *context)
-{
- return gl::NoError();
-}
-
-gl::Error TextureImpl::copyTexture(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- GLenum type,
- size_t sourceLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const gl::Texture *source)
-{
- UNREACHABLE();
- return gl::InternalError() << "CHROMIUM_copy_texture exposed but not implemented.";
-}
-
-gl::Error TextureImpl::copySubTexture(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- size_t sourceLevel,
- const gl::Rectangle &sourceArea,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const gl::Texture *source)
-{
- UNREACHABLE();
- return gl::InternalError() << "CHROMIUM_copy_texture exposed but not implemented.";
-}
-
-gl::Error TextureImpl::copyCompressedTexture(const gl::Context *context, const gl::Texture *source)
-{
- UNREACHABLE();
- return gl::InternalError() << "CHROMIUM_copy_compressed_texture exposed but not implemented.";
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/TextureImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/TextureImpl.h
deleted file mode 100644
index 3b4f28f5f7..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/TextureImpl.h
+++ /dev/null
@@ -1,159 +0,0 @@
-//
-// 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 gl
-{
-struct Box;
-struct Extents;
-struct Offset;
-struct Rectangle;
-class Framebuffer;
-struct PixelUnpackState;
-struct TextureState;
-}
-
-namespace rx
-{
-class ContextImpl;
-
-class TextureImpl : public FramebufferAttachmentObjectImpl
-{
- public:
- TextureImpl(const gl::TextureState &state);
- ~TextureImpl() override;
-
- virtual gl::Error onDestroy(const gl::Context *context);
-
- virtual gl::Error setImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) = 0;
- virtual gl::Error setSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) = 0;
-
- virtual gl::Error setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) = 0;
- virtual gl::Error setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) = 0;
-
- virtual gl::Error copyImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Rectangle &sourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source) = 0;
- virtual gl::Error copySubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source) = 0;
-
- virtual gl::Error copyTexture(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- GLenum type,
- size_t sourceLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const gl::Texture *source);
- virtual gl::Error copySubTexture(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- size_t sourceLevel,
- const gl::Rectangle &sourceArea,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const gl::Texture *source);
-
- virtual gl::Error copyCompressedTexture(const gl::Context *context, const gl::Texture *source);
-
- virtual gl::Error setStorage(const gl::Context *context,
- GLenum target,
- size_t levels,
- GLenum internalFormat,
- const gl::Extents &size) = 0;
-
- virtual gl::Error setStorageMultisample(const gl::Context *context,
- GLenum target,
- GLsizei samples,
- GLint internalformat,
- const gl::Extents &size,
- bool fixedSampleLocations) = 0;
-
- virtual gl::Error setEGLImageTarget(const gl::Context *context,
- GLenum target,
- egl::Image *image) = 0;
-
- virtual gl::Error setImageExternal(const gl::Context *context,
- GLenum target,
- egl::Stream *stream,
- const egl::Stream::GLTextureDescription &desc) = 0;
-
- virtual gl::Error generateMipmap(const gl::Context *context) = 0;
-
- virtual gl::Error setBaseLevel(const gl::Context *context, GLuint baseLevel) = 0;
-
- virtual gl::Error bindTexImage(const gl::Context *context, egl::Surface *surface) = 0;
- virtual gl::Error releaseTexImage(const gl::Context *context) = 0;
-
- virtual void syncState(const gl::Texture::DirtyBits &dirtyBits) = 0;
-
- protected:
- const gl::TextureState &mState;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_TEXTUREIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/TextureImpl_mock.h b/src/3rdparty/angle/src/libANGLE/renderer/TextureImpl_mock.h
deleted file mode 100644
index e7fa441781..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/TextureImpl_mock.h
+++ /dev/null
@@ -1,131 +0,0 @@
-//
-// 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.
-//
-
-// TextureImpl_mock.h: Defines a mock of the TextureImpl class.
-
-#ifndef LIBANGLE_RENDERER_TEXTUREIMPLMOCK_H_
-#define LIBANGLE_RENDERER_TEXTUREIMPLMOCK_H_
-
-#include "gmock/gmock.h"
-
-#include "libANGLE/renderer/TextureImpl.h"
-
-namespace rx
-{
-
-class MockTextureImpl : public TextureImpl
-{
- public:
- MockTextureImpl() : TextureImpl(mMockState), mMockState(GL_TEXTURE_2D) {}
- virtual ~MockTextureImpl() { destructor(); }
- MOCK_METHOD9(setImage,
- gl::Error(const gl::Context *,
- GLenum,
- size_t,
- GLenum,
- const gl::Extents &,
- GLenum,
- GLenum,
- const gl::PixelUnpackState &,
- const uint8_t *));
- MOCK_METHOD8(setSubImage,
- gl::Error(const gl::Context *,
- GLenum,
- size_t,
- const gl::Box &,
- GLenum,
- GLenum,
- const gl::PixelUnpackState &,
- const uint8_t *));
- MOCK_METHOD8(setCompressedImage,
- gl::Error(const gl::Context *,
- GLenum,
- size_t,
- GLenum,
- const gl::Extents &,
- const gl::PixelUnpackState &,
- size_t,
- const uint8_t *));
- MOCK_METHOD8(setCompressedSubImage,
- gl::Error(const gl::Context *,
- GLenum,
- size_t,
- const gl::Box &,
- GLenum,
- const gl::PixelUnpackState &,
- size_t,
- const uint8_t *));
- MOCK_METHOD6(copyImage,
- gl::Error(const gl::Context *,
- GLenum,
- size_t,
- const gl::Rectangle &,
- GLenum,
- const gl::Framebuffer *));
- MOCK_METHOD6(copySubImage,
- gl::Error(const gl::Context *,
- GLenum,
- size_t,
- const gl::Offset &,
- const gl::Rectangle &,
- const gl::Framebuffer *));
- MOCK_METHOD10(copyTexture,
- gl::Error(const gl::Context *,
- GLenum,
- size_t,
- GLenum,
- GLenum,
- size_t,
- bool,
- bool,
- bool,
- const gl::Texture *));
- MOCK_METHOD10(copySubTexture,
- gl::Error(const gl::Context *,
- GLenum,
- size_t,
- const gl::Offset &,
- size_t,
- const gl::Rectangle &,
- bool,
- bool,
- bool,
- const gl::Texture *));
- MOCK_METHOD2(copyCompressedTexture, gl::Error(const gl::Context *, const gl::Texture *source));
- MOCK_METHOD5(setStorage,
- gl::Error(const gl::Context *, GLenum, size_t, GLenum, const gl::Extents &));
- MOCK_METHOD4(setImageExternal,
- gl::Error(const gl::Context *,
- GLenum,
- egl::Stream *,
- const egl::Stream::GLTextureDescription &));
- MOCK_METHOD3(setEGLImageTarget, gl::Error(const gl::Context *, GLenum, egl::Image *));
- MOCK_METHOD1(generateMipmap, gl::Error(const gl::Context *));
- MOCK_METHOD2(bindTexImage, gl::Error(const gl::Context *, egl::Surface *));
- MOCK_METHOD1(releaseTexImage, gl::Error(const gl::Context *));
-
- MOCK_METHOD4(getAttachmentRenderTarget,
- gl::Error(const gl::Context *,
- GLenum,
- const gl::ImageIndex &,
- FramebufferAttachmentRenderTarget **));
-
- MOCK_METHOD6(setStorageMultisample,
- gl::Error(const gl::Context *, GLenum, GLsizei, GLint, const gl::Extents &, bool));
-
- MOCK_METHOD2(setBaseLevel, gl::Error(const gl::Context *, GLuint));
-
- MOCK_METHOD1(syncState, void(const gl::Texture::DirtyBits &));
-
- MOCK_METHOD0(destructor, void());
-
- protected:
- gl::TextureState mMockState;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_TEXTUREIMPLMOCK_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/TransformFeedbackImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/TransformFeedbackImpl.h
deleted file mode 100644
index ad371e9b36..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/TransformFeedbackImpl.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// 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 void begin(GLenum primitiveMode) = 0;
- virtual void end() = 0;
- virtual void pause() = 0;
- virtual void resume() = 0;
-
- virtual void bindGenericBuffer(const gl::BindingPointer<gl::Buffer> &binding) = 0;
- virtual void bindIndexedBuffer(size_t index,
- const gl::OffsetBindingPointer<gl::Buffer> &binding) = 0;
-
- protected:
- const gl::TransformFeedbackState &mState;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/TransformFeedbackImpl_mock.h b/src/3rdparty/angle/src/libANGLE/renderer/TransformFeedbackImpl_mock.h
deleted file mode 100644
index 2de3ad79a9..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/TransformFeedbackImpl_mock.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// TransformFeedbackImpl_mock.h: Defines a mock of the TransformFeedbackImpl class.
-
-#ifndef LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPLMOCK_H_
-#define LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPLMOCK_H_
-
-#include "gmock/gmock.h"
-
-#include "libANGLE/renderer/TransformFeedbackImpl.h"
-
-namespace rx
-{
-
-class MockTransformFeedbackImpl : public TransformFeedbackImpl
-{
- public:
- MockTransformFeedbackImpl(const gl::TransformFeedbackState &state)
- : TransformFeedbackImpl(state)
- {
- }
- ~MockTransformFeedbackImpl() { destructor(); }
-
- MOCK_METHOD1(begin, void(GLenum primitiveMode));
- MOCK_METHOD0(end, void());
- MOCK_METHOD0(pause, void());
- MOCK_METHOD0(resume, void());
-
- MOCK_METHOD1(bindGenericBuffer, void(const gl::BindingPointer<gl::Buffer> &));
- MOCK_METHOD2(bindIndexedBuffer, void(size_t, const gl::OffsetBindingPointer<gl::Buffer> &));
-
- MOCK_METHOD0(destructor, void());
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPLMOCK_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/VertexArrayImpl.h b/src/3rdparty/angle/src/libANGLE/renderer/VertexArrayImpl.h
deleted file mode 100644
index e48cc53d6c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/VertexArrayImpl.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// 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"
-
-namespace rx
-{
-class ContextImpl;
-
-class VertexArrayImpl : angle::NonCopyable
-{
- public:
- VertexArrayImpl(const gl::VertexArrayState &state) : mState(state) {}
- virtual void syncState(const gl::Context *context, const gl::VertexArray::DirtyBits &dirtyBits)
- {
- }
-
- virtual void destroy(const gl::Context *context) {}
- virtual ~VertexArrayImpl() {}
-
- protected:
- const gl::VertexArrayState &mState;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/angle_format_data.json b/src/3rdparty/angle/src/libANGLE/renderer/angle_format_data.json
deleted file mode 100644
index 5b3a226e2e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/angle_format_data.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "B5G6R5_UNORM": {
- "fboImplementationInternalFormat": "GL_RGB565"
- },
- "B5G5R5A1_UNORM": {
- "fboImplementationInternalFormat": "GL_RGB5_A1",
- "channelStruct": "A1R5G5B5"
- },
- "B8G8R8X8_UNORM": {
- "glInternalFormat": "GL_BGRA8_EXT",
- "channelStruct": "B8G8R8X8"
- },
- "R9G9B9E5_SHAREDEXP": {
- "componentType": "float",
- "channelStruct": "R9G9B9E5"
- },
- "B4G4R4A4_UNORM": {
- "fboImplementationInternalFormat": "GL_RGBA4",
- "channelStruct": "A4R4G4B4"
- },
- "R8G8B8A8_UNORM_SRGB": {
- "channelStruct": "R8G8B8A8SRGB"
- }
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/angle_format_map.json b/src/3rdparty/angle/src/libANGLE/renderer/angle_format_map.json
deleted file mode 100644
index 5a4e487cbd..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/angle_format_map.json
+++ /dev/null
@@ -1,132 +0,0 @@
-[
- [ "GL_ALPHA16F_EXT", "A16_FLOAT" ],
- [ "GL_ALPHA32F_EXT", "A32_FLOAT" ],
- [ "GL_ALPHA8_EXT", "A8_UNORM" ],
- [ "GL_BGR565_ANGLEX", "B5G6R5_UNORM" ],
- [ "GL_BGR5_A1_ANGLEX", "B5G5R5A1_UNORM" ],
- [ "GL_BGRA4_ANGLEX", "B4G4R4A4_UNORM" ],
- [ "GL_BGRA8_EXT", "B8G8R8A8_UNORM" ],
- [ "GL_BGRA8_SRGB_ANGLEX", "B8G8R8A8_UNORM_SRGB"],
- [ "GL_BGRX8_ANGLEX", "B8G8R8X8_UNORM" ],
- [ "GL_COMPRESSED_R11_EAC", "EAC_R11_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RG11_EAC", "EAC_R11G11_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGB8_ETC2", "ETC2_R8G8B8_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", "ETC2_R8G8B8A1_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA8_ETC2_EAC", "ETC2_R8G8B8A8_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT", "BC1_RGBA_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE", "BC2_RGBA_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE", "BC3_RGBA_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_4x4_KHR", "ASTC_4x4_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_5x4_KHR", "ASTC_5x4_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_5x5_KHR", "ASTC_5x5_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_6x5_KHR", "ASTC_6x5_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_6x6_KHR", "ASTC_6x6_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_8x5_KHR", "ASTC_8x5_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_8x6_KHR", "ASTC_8x6_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_8x8_KHR", "ASTC_8x8_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_10x5_KHR", "ASTC_10x5_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_10x6_KHR", "ASTC_10x6_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_10x8_KHR", "ASTC_10x8_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_10x10_KHR", "ASTC_10x10_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_12x10_KHR", "ASTC_12x10_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGBA_ASTC_12x12_KHR", "ASTC_12x12_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_RGB_S3TC_DXT1_EXT", "BC1_RGB_UNORM_BLOCK" ],
- [ "GL_COMPRESSED_SIGNED_R11_EAC", "EAC_R11_SNORM_BLOCK" ],
- [ "GL_COMPRESSED_SIGNED_RG11_EAC", "EAC_R11G11_SNORM_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR", "ASTC_4x4_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR", "ASTC_5x4_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR", "ASTC_5x5_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR", "ASTC_6x5_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR", "ASTC_6x6_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR", "ASTC_8x5_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR", "ASTC_8x6_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR", "ASTC_8x8_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR", "ASTC_10x5_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR", "ASTC_10x6_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR", "ASTC_10x8_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR", "ASTC_10x10_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR", "ASTC_12x10_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR", "ASTC_12x12_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", "ETC2_R8G8B8A8_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_ETC2", "ETC2_R8G8B8_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", "ETC2_R8G8B8A1_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", "BC1_RGBA_UNORM_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", "BC2_RGBA_UNORM_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", "BC3_RGBA_UNORM_SRGB_BLOCK" ],
- [ "GL_COMPRESSED_SRGB_S3TC_DXT1_EXT", "BC1_RGB_UNORM_SRGB_BLOCK" ],
- [ "GL_DEPTH24_STENCIL8", "D24_UNORM_S8_UINT" ],
- [ "GL_DEPTH32F_STENCIL8", "D32_FLOAT_S8X24_UINT" ],
- [ "GL_DEPTH_COMPONENT16", "D16_UNORM" ],
- [ "GL_DEPTH_COMPONENT24", "D24_UNORM" ],
- [ "GL_DEPTH_COMPONENT32F", "D32_FLOAT" ],
- [ "GL_DEPTH_COMPONENT32_OES", "D32_UNORM" ],
- [ "GL_ETC1_RGB8_OES", "ETC1_R8G8B8_UNORM_BLOCK" ],
- [ "GL_ETC1_RGB8_LOSSY_DECODE_ANGLE", "ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK" ],
- [ "GL_LUMINANCE16F_EXT", "L16_FLOAT" ],
- [ "GL_LUMINANCE32F_EXT", "L32_FLOAT" ],
- [ "GL_LUMINANCE8_ALPHA8_EXT", "L8A8_UNORM" ],
- [ "GL_LUMINANCE8_EXT", "L8_UNORM" ],
- [ "GL_LUMINANCE_ALPHA16F_EXT", "L16A16_FLOAT" ],
- [ "GL_LUMINANCE_ALPHA32F_EXT", "L32A32_FLOAT" ],
- [ "GL_NONE", "NONE" ],
- [ "GL_R11F_G11F_B10F", "R11G11B10_FLOAT" ],
- [ "GL_R16F", "R16_FLOAT" ],
- [ "GL_R16I", "R16_SINT" ],
- [ "GL_R16UI", "R16_UINT" ],
- [ "GL_R32F", "R32_FLOAT" ],
- [ "GL_R32I", "R32_SINT" ],
- [ "GL_R32UI", "R32_UINT" ],
- [ "GL_R8", "R8_UNORM" ],
- [ "GL_R8I", "R8_SINT" ],
- [ "GL_R8UI", "R8_UINT" ],
- [ "GL_R8_SNORM", "R8_SNORM" ],
- [ "GL_RG16F", "R16G16_FLOAT" ],
- [ "GL_RG16I", "R16G16_SINT" ],
- [ "GL_RG16UI", "R16G16_UINT" ],
- [ "GL_RG32F", "R32G32_FLOAT" ],
- [ "GL_RG32I", "R32G32_SINT" ],
- [ "GL_RG32UI", "R32G32_UINT" ],
- [ "GL_RG8", "R8G8_UNORM" ],
- [ "GL_RG8I", "R8G8_SINT" ],
- [ "GL_RG8UI", "R8G8_UINT" ],
- [ "GL_RG8_SNORM", "R8G8_SNORM" ],
- [ "GL_RGB", "R8G8B8_UNORM" ],
- [ "GL_RGB10_A2", "R10G10B10A2_UNORM" ],
- [ "GL_RGB10_A2UI", "R10G10B10A2_UINT" ],
- [ "GL_RGB16F", "R16G16B16_FLOAT" ],
- [ "GL_RGB16I", "R16G16B16_SINT" ],
- [ "GL_RGB16UI", "R16G16B16_UINT" ],
- [ "GL_RGB32F", "R32G32B32_FLOAT" ],
- [ "GL_RGB32I", "R32G32B32_SINT" ],
- [ "GL_RGB32UI", "R32G32B32_UINT" ],
- [ "GL_RGB565", "R5G6B5_UNORM" ],
- [ "GL_RGB5_A1", "R5G5B5A1_UNORM" ],
- [ "GL_RGB8", "R8G8B8_UNORM" ],
- [ "GL_RGB8I", "R8G8B8_SINT" ],
- [ "GL_RGB8UI", "R8G8B8_UINT" ],
- [ "GL_RGB8_SNORM", "R8G8B8_SNORM" ],
- [ "GL_RGB9_E5", "R9G9B9E5_SHAREDEXP" ],
- [ "GL_RGBA", "R8G8B8A8_UNORM" ],
- [ "GL_RGBA16F", "R16G16B16A16_FLOAT" ],
- [ "GL_RGBA16I", "R16G16B16A16_SINT" ],
- [ "GL_RGBA16UI", "R16G16B16A16_UINT" ],
- [ "GL_RGBA32F", "R32G32B32A32_FLOAT" ],
- [ "GL_RGBA32I", "R32G32B32A32_SINT" ],
- [ "GL_RGBA32UI", "R32G32B32A32_UINT" ],
- [ "GL_RGBA4", "R4G4B4A4_UNORM" ],
- [ "GL_RGBA8", "R8G8B8A8_UNORM" ],
- [ "GL_RGBA8I", "R8G8B8A8_SINT" ],
- [ "GL_RGBA8UI", "R8G8B8A8_UINT" ],
- [ "GL_RGBA8_SNORM", "R8G8B8A8_SNORM" ],
- [ "GL_SRGB8", "R8G8B8_UNORM_SRGB" ],
- [ "GL_SRGB8_ALPHA8", "R8G8B8A8_UNORM_SRGB" ],
- [ "GL_STENCIL_INDEX8", "S8_UINT" ],
- [ "GL_R16_EXT", "R16_UNORM" ],
- [ "GL_RG16_EXT", "R16G16_UNORM" ],
- [ "GL_RGB16_EXT", "R16G16B16_UNORM" ],
- [ "GL_RGBA16_EXT", "R16G16B16A16_UNORM" ],
- [ "GL_R16_SNORM_EXT", "R16_SNORM" ],
- [ "GL_RG16_SNORM_EXT", "R16G16_SNORM" ],
- [ "GL_RGB16_SNORM_EXT", "R16G16B16_SNORM" ],
- [ "GL_RGBA16_SNORM_EXT", "R16G16B16A16_SNORM" ]
-]
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/BufferD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/BufferD3D.cpp
deleted file mode 100644
index 7769ab2b75..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/BufferD3D.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-//
-// 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/VertexBuffer.h"
-#include "libANGLE/renderer/d3d/RendererD3D.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:
- mUsage = D3DBufferUsage::STATIC;
- initializeStaticData(context);
- break;
-
- case gl::BufferUsage::DynamicCopy:
- case gl::BufferUsage::DynamicDraw:
- case gl::BufferUsage::DynamicRead:
- case gl::BufferUsage::StreamCopy:
- case gl::BufferUsage::StreamDraw:
- case gl::BufferUsage::StreamRead:
- 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, int dataSize)
-{
- if (mUsage == D3DBufferUsage::DYNAMIC)
- {
- mUnmodifiedDataUse += dataSize;
-
- if (mUnmodifiedDataUse > 3 * getSize())
- {
- updateD3DBufferUsage(context, gl::BufferUsage::StaticDraw);
- }
- }
-}
-
-gl::Error BufferD3D::getIndexRange(const gl::Context *context,
- GLenum 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 gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/BufferD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/BufferD3D.h
deleted file mode 100644
index 60153748e6..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/BufferD3D.h
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// 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 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 gl::Error markTransformFeedbackUsage(const gl::Context *context) = 0;
- virtual gl::Error 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, int dataSize);
-
- gl::Error getIndexRange(const gl::Context *context,
- GLenum 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;
- unsigned int mUnmodifiedDataUse;
- D3DBufferUsage mUsage;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_BUFFERD3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/CompilerD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/CompilerD3D.cpp
deleted file mode 100644
index 8ceeec3c39..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/CompilerD3D.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// 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)
-{
-}
-
-gl::Error CompilerD3D::release()
-{
- return gl::NoError();
-}
-
-ShShaderOutput CompilerD3D::getTranslatorOutputType() const
-{
- return mTranslatorOutputType;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/CompilerD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/CompilerD3D.h
deleted file mode 100644
index bcfe810d04..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/CompilerD3D.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// 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 {}
-
- gl::Error release() override;
- ShShaderOutput getTranslatorOutputType() const override;
-
- private:
- ShShaderOutput mTranslatorOutputType;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_COMPILERD3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/DeviceD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/DeviceD3D.cpp
deleted file mode 100644
index 5a06b15279..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/DeviceD3D.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// 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()
- : mDevice(0), mDeviceType(0), mDeviceExternallySourced(false), mIsInitialized(false)
-{
-}
-
-DeviceD3D::~DeviceD3D()
-{
-#if defined(ANGLE_ENABLE_D3D11)
- if (mDeviceType == EGL_D3D11_DEVICE_ANGLE)
- {
- // DeviceD3D holds a ref to an externally-sourced D3D11 device. We must release it.
- ID3D11Device *device = reinterpret_cast<ID3D11Device *>(mDevice);
- device->Release();
- }
-#endif
-}
-
-egl::Error DeviceD3D::getDevice(void **outValue)
-{
- if (!mIsInitialized)
- {
- *outValue = nullptr;
- return egl::EglBadDevice();
- }
-
- *outValue = mDevice;
- return egl::NoError();
-}
-
-egl::Error DeviceD3D::initialize(void *device,
- EGLint deviceType,
- EGLBoolean deviceExternallySourced)
-{
- ASSERT(!mIsInitialized);
- if (mIsInitialized)
- {
- return egl::EglBadDevice();
- }
-
-#if defined(ANGLE_ENABLE_D3D11)
- if (deviceType == EGL_D3D11_DEVICE_ANGLE)
- {
- // Validate the device
- IUnknown *iunknown = reinterpret_cast<IUnknown *>(device);
-
- 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.
- }
- else
-#endif
- {
- ASSERT(deviceExternallySourced == EGL_FALSE);
- }
-
- mDevice = device;
- mDeviceType = deviceType;
- mDeviceExternallySourced = !!deviceExternallySourced;
- mIsInitialized = true;
-
- return egl::NoError();
-}
-
-EGLint DeviceD3D::getType()
-{
- return mDeviceType;
-}
-
-void DeviceD3D::generateExtensions(egl::DeviceExtensions *outExtensions) const
-{
- outExtensions->deviceD3D = true;
-}
-
-bool DeviceD3D::deviceExternallySourced()
-{
- return mDeviceExternallySourced;
-}
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/DeviceD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/DeviceD3D.h
deleted file mode 100644
index 15eaf9210a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/DeviceD3D.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// 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();
- ~DeviceD3D() override;
-
- egl::Error initialize(void *device, EGLint deviceType, EGLBoolean external);
- egl::Error getDevice(void **outValue) override;
- EGLint getType() override;
- void generateExtensions(egl::DeviceExtensions *outExtensions) const override;
- bool deviceExternallySourced() override;
-
- private:
- void *mDevice;
- EGLint mDeviceType;
- bool mDeviceExternallySourced;
- bool mIsInitialized;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_DEVICED3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/DisplayD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/DisplayD3D.cpp
deleted file mode 100644
index 0edda9c584..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/DisplayD3D.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-//
-// 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,
- EGLenum target,
- const egl::AttributeMap &attribs)
-{
- return new EGLImageD3D(state, target, attribs, mRenderer);
-}
-
-egl::Error DisplayD3D::getDevice(DeviceImpl **device)
-{
- return mRenderer->getEGLDevice(device);
-}
-
-ContextImpl *DisplayD3D::createContext(const gl::ContextState &state)
-{
- ASSERT(mRenderer != nullptr);
- return mRenderer->createContext(state);
-}
-
-StreamProducerImpl *DisplayD3D::createStreamProducerD3DTextureNV12(
- egl::Stream::ConsumerType consumerType,
- const egl::AttributeMap &attribs)
-{
- ASSERT(mRenderer != nullptr);
- return mRenderer->createStreamProducerD3DTextureNV12(consumerType, 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)
- {
- if (surface->getBoundTexture())
- {
- ANGLE_TRY(surface->releaseTexImage(display->getProxyContext(), EGL_BACK_BUFFER));
- }
- 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);
-
- default:
- return DisplayImpl::validateClientBuffer(configuration, buftype, 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) const
-{
- for (egl::Surface *surface : mState.surfaceSet)
- {
- SurfaceD3D *surfaceD3D = GetImplAs<SurfaceD3D>(surface);
- ANGLE_TRY(surfaceD3D->checkForOutOfDateSwapChain(context));
- }
-
- return egl::NoError();
-}
-
-egl::Error DisplayD3D::waitNative(const gl::Context *context, EGLint engine) const
-{
- egl::Surface *drawSurface = context->getCurrentDrawSurface();
- egl::Surface *readSurface = context->getCurrentReadSurface();
-
- if (drawSurface != nullptr)
- {
- SurfaceD3D *drawSurfaceD3D = GetImplAs<SurfaceD3D>(drawSurface);
- ANGLE_TRY(drawSurfaceD3D->checkForOutOfDateSwapChain(context));
- }
-
- if (readSurface != nullptr)
- {
- SurfaceD3D *readSurfaceD3D = GetImplAs<SurfaceD3D>(readSurface);
- ANGLE_TRY(readSurfaceD3D->checkForOutOfDateSwapChain(context));
- }
-
- return egl::NoError();
-}
-
-gl::Version DisplayD3D::getMaxSupportedESVersion() const
-{
- return mRenderer->getMaxSupportedESVersion();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/DisplayD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/DisplayD3D.h
deleted file mode 100644
index 7090522312..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/DisplayD3D.h
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// 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/renderer/DisplayImpl.h"
-#include "libANGLE/Device.h"
-
-namespace rx
-{
-class RendererD3D;
-
-class DisplayD3D : public DisplayImpl
-{
- 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,
- EGLenum target,
- const egl::AttributeMap &attribs) override;
-
- ContextImpl *createContext(const gl::ContextState &state) override;
-
- StreamProducerImpl *createStreamProducerD3DTextureNV12(
- egl::Stream::ConsumerType consumerType,
- 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 getDevice(DeviceImpl **device) override;
-
- std::string getVendorString() const override;
-
- egl::Error waitClient(const gl::Context *context) const override;
- egl::Error waitNative(const gl::Context *context, EGLint engine) const override;
- gl::Version getMaxSupportedESVersion() const override;
-
- private:
- void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
- void generateCaps(egl::Caps *outCaps) const override;
-
- egl::Display *mDisplay;
-
- rx::RendererD3D *mRenderer;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_DISPLAYD3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/DynamicHLSL.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
deleted file mode 100644
index b4143a3f5f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
+++ /dev/null
@@ -1,1427 +0,0 @@
-//
-// 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
-{
-
-// 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;
-};
-
-std::ostream &operator<<(std::ostream &o, const DecorateVariable &dv)
-{
- if (dv.getName().compare(0, 3, "gl_") != 0)
- {
- o << "_";
- }
- o << dv.getName();
- return o;
-}
-
-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)
-{
- for (size_t variableIndex = 0; variableIndex < outputVariables.size(); ++variableIndex)
- {
- if (outputVariables[variableIndex].outputIndex == location)
- {
- return &outputVariables[variableIndex];
- }
- }
-
- 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 *PIXEL_OUTPUT_STUB_STRING = "@@ PIXEL OUTPUT @@";
-} // 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->getWorkarounds().useInstancedPointSpriteEmulation;
-
- // Instanced PointSprite emulation requires additional entries in the
- // VS_INPUT structure to support the vertices that make up the quad vertices.
- // These values must be in sync with the cooresponding values added during inputlayout creation
- // in InputLayoutCache::applyVertexBuffers().
- //
- // The additional entries must appear first in the VS_INPUT layout because
- // Windows Phone 8 era devices require per vertex data to physically come
- // before per instance data in the shader.
- if (useInstancedPointSpriteEmulation)
- {
- 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);
- VertexFormatType vertexFormatType =
- inputIndex < inputLayout.size() ? inputLayout[inputIndex] : VERTEX_FORMAT_INVALID;
-
- // HLSL code for input structure
- if (IsMatrixType(shaderAttribute.type))
- {
- // Matrix types are always transposed
- structStream << " "
- << HLSLMatrixTypeString(TransposeMatrixType(shaderAttribute.type));
- }
- else
- {
- GLenum componentType = mRenderer->getVertexComponentType(vertexFormatType);
-
- 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(vertexFormatType) & VERTEX_CONVERT_GPU) != 0)
- {
- GenerateAttributeConversionHLSL(vertexFormatType, shaderAttribute, initStream);
- }
- else
- {
- initStream << "input." << DecorateVariable(shaderAttribute.name);
- }
-
- 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);
-
- 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);
-
- const PixelShaderOutputVariable *outputVariable =
- outputLayout.empty() ? &defaultOutput
- : FindOutputAtLocation(outputVariables, location);
-
- // OpenGL ES 3.0 spec $4.2.1
- // If [...] not all user-defined output variables are written, the values of fragment
- // colors
- // corresponding to unwritten variables are similarly undefined.
- if (outputVariable)
- {
- 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;
-}
-
-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";
- }
-
- 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";
- }
-
- std::string varyingSemantic =
- GetVaryingSemantic(mRenderer->getMajorShaderModel(), programUsesPointSize);
-
- for (const PackedVaryingRegister &registerInfo : varyingPacking.getRegisterList())
- {
- 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);
- unsigned int semanticIndex = registerInfo.semanticIndex;
- hlslStream << " v" << semanticIndex << " : " << varyingSemantic << semanticIndex << ";\n";
- }
-
- hlslStream << "};\n";
-}
-
-void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context,
- const gl::ProgramState &programData,
- const ProgramD3DMetadata &programMetadata,
- const VaryingPacking &varyingPacking,
- const BuiltinVaryingsD3D &builtinsD3D,
- std::string *pixelHLSL,
- std::string *vertexHLSL) const
-{
- ASSERT(pixelHLSL->empty() && vertexHLSL->empty());
-
- const auto &data = context->getContextState();
- gl::Shader *vertexShaderGL = programData.getAttachedVertexShader();
- gl::Shader *fragmentShaderGL = programData.getAttachedFragmentShader();
- 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->getWorkarounds().useInstancedPointSpriteEmulation;
-
- // Validation done in the compiler
- ASSERT(!fragmentShader->usesFragColor() || !fragmentShader->usesFragData());
-
- std::ostringstream vertexStream;
- vertexStream << vertexShaderGL->getTranslatedSource(context);
-
- // 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>(data.getCaps().minAliasedPointSize) << ".0f;\n"
- << "static float maxPointSize = "
- << static_cast<int>(data.getCaps().maxAliasedPointSize) << ".0f;\n";
- }
-
- // Add stub string to be replaced when shader is dynamically defined by its layout
- vertexStream << "\n" << std::string(VERTEX_ATTRIBUTE_STUB_STRING) << "\n";
-
- const auto &vertexBuiltins = builtinsD3D[gl::SHADER_VERTEX];
-
- // Write the HLSL input/output declarations
- vertexStream << "struct VS_OUTPUT\n";
- generateVaryingLinkHLSL(varyingPacking, vertexBuiltins, builtinsD3D.usesPointSize(),
- vertexStream);
- vertexStream << "\n"
- << "VS_OUTPUT main(VS_INPUT input)\n"
- << "{\n"
- << " initAttributes(input);\n";
-
- vertexStream << "\n"
- << " gl_main();\n"
- << "\n"
- << " VS_OUTPUT output;\n";
-
- if (vertexBuiltins.glPosition.enabled)
- {
- vertexStream << " output.gl_Position = gl_Position;\n";
- }
-
- if (vertexBuiltins.glViewIDOVR.enabled)
- {
- vertexStream << " output.gl_ViewID_OVR = _ViewID_OVR;\n";
- }
- if (programMetadata.hasANGLEMultiviewEnabled() && programMetadata.canSelectViewInVertexShader())
- {
- ASSERT(vertexBuiltins.glViewportIndex.enabled && vertexBuiltins.glLayer.enabled);
- vertexStream << " 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() == "")
- {
- vertexStream << " 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.
- vertexStream << " output.dx_Position.y = dx_ViewScale.y * gl_Position.y;\n";
- }
- else
- {
- vertexStream << " output.dx_Position.y = - gl_Position.y;\n";
- }
-
- vertexStream << " output.dx_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
- << " output.dx_Position.w = gl_Position.w;\n";
- }
- else
- {
- vertexStream << " 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() != ""))
- {
- vertexStream << " output.dx_Position.y = dx_ViewScale.y * (gl_Position.y * "
- "dx_ViewAdjust.w + dx_ViewAdjust.y * gl_Position.w);\n";
- }
- else
- {
- vertexStream << " output.dx_Position.y = -(gl_Position.y * dx_ViewAdjust.w + "
- "dx_ViewAdjust.y * gl_Position.w);\n";
- }
-
- vertexStream << " 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)
- {
- vertexStream << " output.gl_PointSize = gl_PointSize;\n";
- }
-
- if (vertexBuiltins.glFragCoord.enabled)
- {
- vertexStream << " output.gl_FragCoord = gl_Position;\n";
- }
-
- for (const PackedVaryingRegister &registerInfo : varyingPacking.getRegisterList())
- {
- const auto &packedVarying = *registerInfo.packedVarying;
- const auto &varying = *packedVarying.varying;
- ASSERT(!varying.isStruct());
-
- vertexStream << " output.v" << registerInfo.semanticIndex << " = ";
-
- if (packedVarying.isStructField())
- {
- vertexStream << DecorateVariable(packedVarying.parentStructName) << ".";
- }
-
- vertexStream << DecorateVariable(varying.name);
-
- if (varying.isArray())
- {
- WriteArrayString(vertexStream, registerInfo.varyingArrayIndex);
- }
-
- if (VariableRowCount(varying.type) > 1)
- {
- WriteArrayString(vertexStream, registerInfo.varyingRowIndex);
- }
-
- vertexStream << ";\n";
- }
-
- // Instanced PointSprite emulation requires additional entries to calculate
- // the final output vertex positions of the quad that represents each sprite.
- if (useInstancedPointSpriteEmulation)
- {
- vertexStream << "\n"
- << " gl_PointSize = clamp(gl_PointSize, minPointSize, maxPointSize);\n";
-
- vertexStream << " 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
- vertexStream << " output.dx_Position.y += (-dx_ViewScale.y * "
- "input.spriteVertexPos.y * gl_PointSize / (dx_ViewCoords.y*2)) * "
- "output.dx_Position.w;";
- }
- else
- {
- vertexStream << " output.dx_Position.y += (input.spriteVertexPos.y * gl_PointSize / "
- "(dx_ViewCoords.y*2)) * output.dx_Position.w;";
- }
-
- vertexStream
- << " output.dx_Position.z += input.spriteVertexPos.z * output.dx_Position.w;\n";
-
- if (programMetadata.usesPointCoord())
- {
- vertexStream << "\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);
- vertexStream << "\n"
- << " output.gl_PointCoord = float2(0.5, 0.5);\n";
- }
-
- vertexStream << "\n"
- << " return output;\n"
- << "}\n";
-
- const auto &pixelBuiltins = builtinsD3D[gl::SHADER_FRAGMENT];
-
- std::ostringstream pixelStream;
- pixelStream << fragmentShaderGL->getTranslatedSource(context);
- pixelStream << "struct PS_INPUT\n";
- generateVaryingLinkHLSL(varyingPacking, pixelBuiltins, builtinsD3D.usesPointSize(),
- pixelStream);
- pixelStream << "\n";
-
- pixelStream << std::string(PIXEL_OUTPUT_STUB_STRING) << "\n";
-
- if (fragmentShader->usesFrontFacing())
- {
- if (shaderModel >= 4)
- {
- pixelStream << "PS_OUTPUT main(PS_INPUT input, bool isFrontFace : SV_IsFrontFace)\n"
- << "{\n";
- }
- else
- {
- pixelStream << "PS_OUTPUT main(PS_INPUT input, float vFace : VFACE)\n"
- << "{\n";
- }
- }
- else
- {
- pixelStream << "PS_OUTPUT main(PS_INPUT input)\n"
- << "{\n";
- }
-
- if (fragmentShader->usesViewID())
- {
- ASSERT(pixelBuiltins.glViewIDOVR.enabled);
- pixelStream << " _ViewID_OVR = input.gl_ViewID_OVR;\n";
- }
-
- if (pixelBuiltins.glFragCoord.enabled)
- {
- pixelStream << " 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() == "")
- {
- pixelStream << " gl_FragCoord.x = input.dx_Position.x;\n"
- << " gl_FragCoord.y = input.dx_Position.y;\n";
- }
- else if (shaderModel == 3)
- {
- pixelStream << " 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()
- pixelStream << " 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:
- pixelStream
- << " 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";
- }
- }
-
- pixelStream << " 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)
- {
- pixelStream << " gl_PointCoord.x = input.gl_PointCoord.x;\n"
- << " gl_PointCoord.y = 1.0 - input.gl_PointCoord.y;\n";
- }
-
- if (fragmentShader->usesFrontFacing())
- {
- if (shaderModel <= 3)
- {
- pixelStream << " gl_FrontFacing = (vFace * dx_DepthFront.z >= 0.0);\n";
- }
- else
- {
- pixelStream << " gl_FrontFacing = isFrontFace;\n";
- }
- }
-
- for (const PackedVaryingRegister &registerInfo : varyingPacking.getRegisterList())
- {
- 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 staticUse flag is set according to usage in the fragment shader.
- if (packedVarying.vertexOnly || !varying.staticUse)
- continue;
-
- pixelStream << " ";
-
- if (packedVarying.isStructField())
- {
- pixelStream << DecorateVariable(packedVarying.parentStructName) << ".";
- }
-
- pixelStream << DecorateVariable(varying.name);
-
- if (varying.isArray())
- {
- WriteArrayString(pixelStream, registerInfo.varyingArrayIndex);
- }
-
- GLenum transposedType = TransposeMatrixType(varying.type);
- if (VariableRowCount(transposedType) > 1)
- {
- WriteArrayString(pixelStream, registerInfo.varyingRowIndex);
- }
-
- pixelStream << " = input.v" << registerInfo.semanticIndex;
-
- switch (VariableColumnCount(transposedType))
- {
- case 1:
- pixelStream << ".x";
- break;
- case 2:
- pixelStream << ".xy";
- break;
- case 3:
- pixelStream << ".xyz";
- break;
- case 4:
- break;
- default:
- UNREACHABLE();
- }
- pixelStream << ";\n";
- }
-
- pixelStream << "\n"
- << " gl_main();\n"
- << "\n"
- << " return generateOutput();\n"
- << "}\n";
-
- *vertexHLSL = vertexStream.str();
- *pixelHLSL = pixelStream.str();
-}
-
-std::string DynamicHLSL::generateComputeShaderLinkHLSL(const gl::Context *context,
- const gl::ProgramState &programData) const
-{
- gl::Shader *computeShaderGL = programData.getAttachedComputeShader();
- std::stringstream computeStream;
- std::string translatedSource = computeShaderGL->getTranslatedSource(context);
- computeStream << translatedSource;
-
- bool usesWorkGroupID = translatedSource.find("GL_USES_WORK_GROUP_ID") != std::string::npos;
- bool usesLocalInvocationID =
- translatedSource.find("GL_USES_LOCAL_INVOCATION_ID") != std::string::npos;
- bool usesGlobalInvocationID =
- translatedSource.find("GL_USES_GLOBAL_INVOCATION_ID") != std::string::npos;
- bool usesLocalInvocationIndex =
- translatedSource.find("GL_USES_LOCAL_INVOCATION_INDEX") != std::string::npos;
-
- computeStream << "\nstruct CS_INPUT\n{\n";
- if (usesWorkGroupID)
- {
- computeStream << " uint3 dx_WorkGroupID : "
- << "SV_GroupID;\n";
- }
-
- if (usesLocalInvocationID)
- {
- computeStream << " uint3 dx_LocalInvocationID : "
- << "SV_GroupThreadID;\n";
- }
-
- if (usesGlobalInvocationID)
- {
- computeStream << " uint3 dx_GlobalInvocationID : "
- << "SV_DispatchThreadID;\n";
- }
-
- if (usesLocalInvocationIndex)
- {
- computeStream << " uint dx_LocalInvocationIndex : "
- << "SV_GroupIndex;\n";
- }
-
- computeStream << "};\n\n";
-
- const sh::WorkGroupSize &localSize = computeShaderGL->getWorkGroupSize(context);
- computeStream << "[numthreads(" << localSize[0] << ", " << localSize[1] << ", " << localSize[2]
- << ")]\n";
-
- computeStream << "void main(CS_INPUT input)\n"
- << "{\n";
-
- if (usesWorkGroupID)
- {
- computeStream << " gl_WorkGroupID = input.dx_WorkGroupID;\n";
- }
- if (usesLocalInvocationID)
- {
- computeStream << " gl_LocalInvocationID = input.dx_LocalInvocationID;\n";
- }
- if (usesGlobalInvocationID)
- {
- computeStream << " gl_GlobalInvocationID = input.dx_GlobalInvocationID;\n";
- }
- if (usesLocalInvocationIndex)
- {
- computeStream << " gl_LocalInvocationIndex = input.dx_LocalInvocationIndex;\n";
- }
-
- computeStream << "\n"
- << " gl_main();\n"
- << "}\n";
-
- return computeStream.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::SHADER_VERTEX];
-
- preambleStream << "struct GS_INPUT\n";
- generateVaryingLinkHLSL(varyingPacking, vertexBuiltins, builtinsD3D.usesPointSize(),
- preambleStream);
- preambleStream << "\n"
- << "struct GS_OUTPUT\n";
- generateVaryingLinkHLSL(varyingPacking, builtinsD3D[gl::SHADER_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::SHADER_GEOMETRY].glViewportIndex.enabled &&
- builtinsD3D[gl::SHADER_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";
- }
- }
-
- for (const PackedVaryingRegister &varyingRegister : varyingPacking.getRegisterList())
- {
- preambleStream << " output.v" << varyingRegister.semanticIndex << " = ";
- if (varyingRegister.packedVarying->interpolation == sh::INTERPOLATION_FLAT)
- {
- preambleStream << "flat";
- }
- preambleStream << "input.v" << varyingRegister.semanticIndex << "; \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::SHADER_GEOMETRY].glViewportIndex.enabled &&
- builtinsD3D[gl::SHADER_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::Context *context,
- gl::PrimitiveType 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 == PRIMITIVE_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 PRIMITIVE_POINTS:
- inputPT = "point";
- inputSize = 1;
-
- if (pointSprites)
- {
- outputPT = "Triangle";
- maxVertexOutput = 4;
- }
- else
- {
- outputPT = "Point";
- maxVertexOutput = 1;
- }
-
- break;
-
- case PRIMITIVE_LINES:
- case PRIMITIVE_LINE_STRIP:
- case PRIMITIVE_LINE_LOOP:
- inputPT = "line";
- outputPT = "Line";
- inputSize = 2;
- maxVertexOutput = 2;
- break;
-
- case PRIMITIVE_TRIANGLES:
- case PRIMITIVE_TRIANGLE_STRIP:
- case PRIMITIVE_TRIANGLE_FAN:
- 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>(context->getCaps().minAliasedPointSize)
- << ".0f;\n"
- "static float maxPointSize = "
- << static_cast<int>(context->getCaps().maxAliasedPointSize) << ".0f;\n"
- << "\n";
- }
-
- shaderStream << preambleString << "\n"
- << "[maxvertexcount(" << maxVertexOutput << ")]\n"
- << "void main(" << inputPT << " GS_INPUT input[" << inputSize << "], ";
-
- if (primitiveType == PRIMITIVE_TRIANGLE_STRIP)
- {
- shaderStream << "uint primitiveID : SV_PrimitiveID, ";
- }
-
- shaderStream << " inout " << outputPT << "Stream<GS_OUTPUT> outStream)\n"
- << "{\n"
- << " GS_OUTPUT output = (GS_OUTPUT)0;\n";
-
- if (primitiveType == PRIMITIVE_TRIANGLE_STRIP)
- {
- 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(gl::VertexFormatType vertexFormatType,
- 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::GetVertexFormatFromType(vertexFormatType);
-
- // 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::ContextState &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.outputIndex = renderTargetIndex;
-
- 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.staticUse);
-
- PixelShaderOutputVariable outputKeyVariable;
- outputKeyVariable.type = outputVariable.type;
- outputKeyVariable.name = variableName + elementString;
- outputKeyVariable.source =
- variableName +
- (outputVariable.isArray() ? ArrayString(outputLocation.arrayIndex) : "");
- outputKeyVariable.outputIndex = outputLocationIndex;
-
- 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::SHADER_VERTEX, metadata, packing);
- updateBuiltins(gl::SHADER_FRAGMENT, metadata, packing);
- if (metadata.getRendererMajorShaderModel() >= 4)
- {
- updateBuiltins(gl::SHADER_GEOMETRY, metadata, packing);
- }
-}
-
-BuiltinVaryingsD3D::~BuiltinVaryingsD3D() = default;
-
-void BuiltinVaryingsD3D::updateBuiltins(gl::ShaderType shaderType,
- const ProgramD3DMetadata &metadata,
- const VaryingPacking &packing)
-{
- const std::string &userSemantic = GetVaryingSemantic(metadata.getRendererMajorShaderModel(),
- metadata.usesSystemValuePointSize());
-
- unsigned int reservedSemanticIndex = packing.getMaxSemanticIndex();
-
- BuiltinInfo *builtins = &mBuiltinInfo[shaderType];
-
- if (metadata.getRendererMajorShaderModel() >= 4)
- {
- builtins->dxPosition.enableSystem("SV_Position");
- }
- else if (shaderType == gl::SHADER_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::SHADER_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 (shaderType == gl::SHADER_VERTEX && metadata.hasANGLEMultiviewEnabled())
- {
- builtins->glViewIDOVR.enable(userSemantic, reservedSemanticIndex++);
- if (metadata.canSelectViewInVertexShader())
- {
- builtins->glViewportIndex.enableSystem("SV_ViewportArrayIndex");
- builtins->glLayer.enableSystem("SV_RenderTargetArrayIndex");
- }
- }
-
- if (shaderType == gl::SHADER_FRAGMENT && metadata.hasANGLEMultiviewEnabled())
- {
- builtins->glViewIDOVR.enable(userSemantic, reservedSemanticIndex++);
- }
-
- if (shaderType == gl::SHADER_GEOMETRY && metadata.hasANGLEMultiviewEnabled())
- {
- // Although it is possible to retrieve gl_ViewID_OVR from the value of
- // SV_ViewportArrayIndex or SV_RenderTargetArrayIndex based on the multi-view state in the
- // driver constant buffer, it is easier and cleaner to pass it as a varying.
- builtins->glViewIDOVR.enable(userSemantic, reservedSemanticIndex++);
-
- // 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::SHADER_FRAGMENT || metadata.getRendererMajorShaderModel() >= 4))
- {
- builtins->glPointSize.enableSystem("PSIZE");
- }
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/DynamicHLSL.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/DynamicHLSL.h
deleted file mode 100644
index fe8d9cb0a3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/DynamicHLSL.h
+++ /dev/null
@@ -1,175 +0,0 @@
-//
-// 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/RendererD3D.h"
-
-namespace sh
-{
-struct Attribute;
-struct ShaderVariable;
-}
-
-namespace gl
-{
-class InfoLog;
-struct VariableLocation;
-class VaryingPacking;
-struct VertexAttribute;
-}
-
-namespace rx
-{
-class ProgramD3DMetadata;
-class ShaderD3D;
-
-struct PixelShaderOutputVariable
-{
- PixelShaderOutputVariable() {}
- PixelShaderOutputVariable(GLenum typeIn,
- const std::string &nameIn,
- const std::string &sourceIn,
- size_t outputIndexIn)
- : type(typeIn), name(nameIn), source(sourceIn), outputIndex(outputIndexIn)
- {
- }
-
- GLenum type = GL_NONE;
- std::string name;
- std::string source;
- 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::SHADER_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);
-
- std::array<BuiltinInfo, gl::SHADER_TYPE_MAX> 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;
- void generateShaderLinkHLSL(const gl::Context *context,
- const gl::ProgramState &programData,
- const ProgramD3DMetadata &programMetadata,
- const gl::VaryingPacking &varyingPacking,
- const BuiltinVaryingsD3D &builtinsD3D,
- std::string *pixelHLSL,
- std::string *vertexHLSL) const;
- std::string generateComputeShaderLinkHLSL(const gl::Context *context,
- const gl::ProgramState &programData) const;
-
- std::string generateGeometryShaderPreamble(const gl::VaryingPacking &varyingPacking,
- const BuiltinVaryingsD3D &builtinsD3D,
- const bool hasANGLEMultiviewEnabled,
- const bool selectViewInVS) const;
-
- std::string generateGeometryShaderHLSL(const gl::Context *context,
- gl::PrimitiveType 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::ContextState &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(gl::VertexFormatType vertexFormatType,
- const sh::ShaderVariable &shaderAttrib,
- std::ostringstream &outStream);
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_DYNAMICHLSL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/EGLImageD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/EGLImageD3D.cpp
deleted file mode 100644
index fcc2456bd6..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/EGLImageD3D.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// 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/Texture.h"
-#include "libANGLE/renderer/d3d/RenderbufferD3D.h"
-#include "libANGLE/renderer/d3d/RendererD3D.h"
-#include "libANGLE/renderer/d3d/RenderTargetD3D.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()
-{
- return egl::NoError();
-}
-
-gl::Error EGLImageD3D::orphan(const gl::Context *context, egl::ImageSibling *sibling)
-{
- if (sibling == mState.source.get())
- {
- ANGLE_TRY(copyToLocalRendertarget(context));
- }
-
- return gl::NoError();
-}
-
-gl::Error EGLImageD3D::getRenderTarget(const gl::Context *context, RenderTargetD3D **outRT) const
-{
- if (mState.source.get())
- {
- ASSERT(!mRenderTarget);
- FramebufferAttachmentRenderTarget *rt = nullptr;
- ANGLE_TRY(
- mState.source->getAttachmentRenderTarget(context, GL_NONE, mState.imageIndex, &rt));
- *outRT = static_cast<RenderTargetD3D *>(rt);
- return gl::NoError();
- }
- else
- {
- ASSERT(mRenderTarget);
- *outRT = mRenderTarget;
- return gl::NoError();
- }
-}
-
-gl::Error EGLImageD3D::copyToLocalRendertarget(const gl::Context *context)
-{
- ASSERT(mState.source.get() != nullptr);
- ASSERT(mRenderTarget == nullptr);
-
- RenderTargetD3D *curRenderTarget = nullptr;
- ANGLE_TRY(getRenderTarget(context, &curRenderTarget));
-
- // This only currently applies do D3D11, where it invalidates FBOs with this Image attached.
- curRenderTarget->signalDirty(context);
-
- return mRenderer->createRenderTargetCopy(curRenderTarget, &mRenderTarget);
-}
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/EGLImageD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/EGLImageD3D.h
deleted file mode 100644
index 1ee7984426..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/EGLImageD3D.h
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// 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() override;
-
- gl::Error orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
-
- gl::Error getRenderTarget(const gl::Context *context, RenderTargetD3D **outRT) const;
-
- private:
- gl::Error copyToLocalRendertarget(const gl::Context *context);
-
- RendererD3D *mRenderer;
- RenderTargetD3D *mRenderTarget;
-};
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_EGLIMAGED3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/FramebufferD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
deleted file mode 100644
index 3d73b2c840..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-//
-// 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/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->getDepthbuffer() != nullptr)
- {
- clearParams.clearDepth = true;
- }
- }
-
- if (mask & GL_STENCIL_BUFFER_BIT)
- {
- if (framebufferObject->getStencilbuffer() != nullptr &&
- framebufferObject->getStencilbuffer()->getStencilSize() > 0)
- {
- clearParams.clearStencil = true;
- }
- }
-
- return clearParams;
-}
-}
-
-ClearParameters::ClearParameters() = default;
-
-ClearParameters::ClearParameters(const ClearParameters &other) = default;
-
-FramebufferD3D::FramebufferD3D(const gl::FramebufferState &data, RendererD3D *renderer)
- : FramebufferImpl(data), mRenderer(renderer)
-{
-}
-
-FramebufferD3D::~FramebufferD3D()
-{
-}
-
-gl::Error FramebufferD3D::clear(const gl::Context *context, GLbitfield mask)
-{
- ClearParameters clearParams = GetClearParameters(context->getGLState(), mask);
- return clearImpl(context, clearParams);
-}
-
-gl::Error 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->getGLState(), 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);
-}
-
-gl::Error 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->getGLState(), 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);
-}
-
-gl::Error 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->getGLState(), 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);
-}
-
-gl::Error 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->getGLState(), 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;
- gl::Error error = readAttachment->getRenderTarget(context, &attachmentRenderTarget);
- if (error.isError())
- {
- 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;
- gl::Error error = readAttachment->getRenderTarget(context, &attachmentRenderTarget);
- if (error.isError())
- {
- return GL_NONE;
- }
-
- GLenum implementationFormat = getRenderTargetImplementationFormat(attachmentRenderTarget);
- const gl::InternalFormat &implementationFormatInfo =
- gl::GetSizedInternalFormatInfo(implementationFormat);
-
- return implementationFormatInfo.getReadPixelsType(context->getClientVersion());
-}
-
-gl::Error FramebufferD3D::readPixels(const gl::Context *context,
- const gl::Rectangle &origArea,
- 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 area;
- if (!ClipRectangle(origArea, fbRect, &area))
- {
- // nothing to read
- return gl::NoError();
- }
-
- const gl::PixelPackState &packState = context->getGLState().getPackState();
-
- const gl::InternalFormat &sizedFormatInfo = gl::GetInternalFormatInfo(format, type);
-
- GLuint outputPitch = 0;
- ANGLE_TRY_RESULT(sizedFormatInfo.computeRowPitch(type, origArea.width, packState.alignment,
- packState.rowLength),
- outputPitch);
- GLuint outputSkipBytes = 0;
- ANGLE_TRY_RESULT(sizedFormatInfo.computeSkipBytes(outputPitch, 0, packState, false),
- outputSkipBytes);
- outputSkipBytes +=
- (area.x - origArea.x) * sizedFormatInfo.pixelBytes + (area.y - origArea.y) * outputPitch;
-
- return readPixelsImpl(context, area, format, type, outputPitch, packState,
- reinterpret_cast<uint8_t *>(pixels) + outputSkipBytes);
-}
-
-gl::Error FramebufferD3D::blit(const gl::Context *context,
- const gl::Rectangle &sourceArea,
- const gl::Rectangle &destArea,
- GLbitfield mask,
- GLenum filter)
-{
- const auto &glState = context->getGLState();
- 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 gl::NoError();
-}
-
-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.getDepthAttachment() != nullptr && mState.getStencilAttachment() != nullptr &&
- mState.getDepthStencilAttachment() == nullptr)
- {
- 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;
-}
-
-void FramebufferD3D::syncState(const gl::Context *context,
- const gl::Framebuffer::DirtyBits &dirtyBits)
-{
- if (!mColorAttachmentsForRender.valid())
- {
- return;
- }
-
- 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();
- }
- }
-}
-
-const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(const gl::Context *context)
-{
- gl::DrawBufferMask activeProgramOutputs =
- context->getContextState().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 &workarounds = mRenderer->getWorkarounds();
-
- 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 (!workarounds.mrtPerfWorkaround)
- {
- 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->getWorkarounds().addDummyTextureNoRenderTarget &&
- colorAttachmentsForRender.empty())
- {
- static_assert(static_cast<size_t>(activeProgramOutputs.size()) <= 32,
- "Size of active program outputs should less or equal than 32.");
- GLenum i = static_cast<GLenum>(
- gl::ScanForward(static_cast<uint32_t>(activeProgramOutputs.bits())));
-
- gl::Texture *dummyTex = nullptr;
- // TODO(Jamie): Handle error if dummy texture can't be created.
- ANGLE_SWALLOW_ERR(mRenderer->getIncompleteTexture(context, GL_TEXTURE_2D, &dummyTex));
- if (dummyTex)
- {
- gl::ImageIndex index = gl::ImageIndex::Make2D(0);
- gl::FramebufferAttachment *dummyAttach = new gl::FramebufferAttachment(
- context, GL_TEXTURE, GL_COLOR_ATTACHMENT0_EXT + i, index, dummyTex);
- colorAttachmentsForRender.push_back(dummyAttach);
- }
- }
-
- mColorAttachmentsForRender = std::move(colorAttachmentsForRender);
- mCurrentActiveProgramOutputs = activeProgramOutputs;
-
- return mColorAttachmentsForRender.value();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/FramebufferD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/FramebufferD3D.h
deleted file mode 100644
index a7312fdef4..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/FramebufferD3D.h
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-// 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 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;
-
- gl::Error clear(const gl::Context *context, GLbitfield mask) override;
- gl::Error clearBufferfv(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLfloat *values) override;
- gl::Error clearBufferuiv(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLuint *values) override;
- gl::Error clearBufferiv(const gl::Context *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLint *values) override;
- gl::Error 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;
- gl::Error readPixels(const gl::Context *context,
- const gl::Rectangle &area,
- GLenum format,
- GLenum type,
- void *pixels) override;
-
- gl::Error 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;
-
- void syncState(const gl::Context *context,
- const gl::Framebuffer::DirtyBits &dirtyBits) override;
-
- const gl::AttachmentList &getColorAttachmentsForRender(const gl::Context *context);
-
- private:
- virtual gl::Error clearImpl(const gl::Context *context, const ClearParameters &clearParams) = 0;
-
- virtual gl::Error 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 gl::Error 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;
-};
-}
-
-#endif // LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
deleted file mode 100644
index 5d47308d67..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
+++ /dev/null
@@ -1,354 +0,0 @@
-//
-// 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/Program.h"
-#include "libANGLE/features.h"
-#include "libANGLE/histogram_macros.h"
-#include "third_party/trace_event/trace_event.h"
-
-#ifndef QT_D3DCOMPILER_DLL
-#define QT_D3DCOMPILER_DLL D3DCOMPILER_DLL
-#endif
-
-#if ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
-namespace
-{
-#ifdef CREATE_COMPILER_FLAG_INFO
- #undef CREATE_COMPILER_FLAG_INFO
-#endif
-
-#define CREATE_COMPILER_FLAG_INFO(flag) { flag, #flag }
-
-struct CompilerFlagInfo
-{
- UINT mFlag;
- const char *mName;
-};
-
-CompilerFlagInfo CompilerFlagInfos[] =
-{
- // NOTE: The data below is copied from d3dcompiler.h
- // If something changes there it should be changed here as well
- CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_DEBUG), // (1 << 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;
- }
-}
-} // anonymous namespace
-#endif // ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
-
-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();
-}
-
-gl::Error HLSLCompiler::ensureInitialized()
-{
- if (mInitialized)
- {
- return gl::NoError();
- }
-
- 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
-
- // Load the compiler DLL specified by the environment, or default to QT_D3DCOMPILER_DLL
- const wchar_t *defaultCompiler = _wgetenv(L"QT_D3DCOMPILER_DLL");
- if (!defaultCompiler)
- defaultCompiler = QT_D3DCOMPILER_DLL;
-
- const wchar_t *compilerDlls[] = {
- defaultCompiler,
- L"d3dcompiler_47.dll",
- L"d3dcompiler_46.dll",
- L"d3dcompiler_43.dll",
- 0
- };
-
- // Load the first available known compiler DLL
- for (int i = 0; compilerDlls[i]; ++i)
- {
- mD3DCompilerModule = LoadLibrary(compilerDlls[i]);
- if (mD3DCompilerModule)
- break;
- }
-
- if (!mD3DCompilerModule)
- {
- // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with.
- mD3DCompilerModule = LoadLibrary(D3DCOMPILER_DLL);
- }
-
- if (!mD3DCompilerModule)
- {
- ERR() << "D3D compiler module not found.";
- return gl::OutOfMemory() << "D3D compiler module not found.";
- }
-
- 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
-
- if (mD3DCompileFunc == nullptr)
- {
- return gl::OutOfMemory() << "Error finding D3DCompile entry point.";
- }
-
- mInitialized = true;
- return gl::NoError();
-}
-
-void HLSLCompiler::release()
-{
- if (mInitialized)
- {
- FreeLibrary(mD3DCompilerModule);
- mD3DCompilerModule = nullptr;
- mD3DCompileFunc = nullptr;
- mD3DDisassembleFunc = nullptr;
- mInitialized = false;
- }
-}
-
-gl::Error HLSLCompiler::compileToBinary(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;
-
- {
- 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 = reinterpret_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 ((message.find("error X3531:") != std::string::npos || // "can't unroll loops marked with loop attribute"
- message.find("error X4014:") != std::string::npos) && // "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.
- macros != nullptr)
- {
- macros = nullptr; // Disable [loop] and [flatten]
-
- // 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(binary, &disassembly));
- (*outDebugInfo) += "\n" + disassembly + "\n// ASSEMBLY END\n";
-#endif // ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
- return gl::NoError();
- }
-
- if (result == E_OUTOFMEMORY)
- {
- *outCompiledBlob = nullptr;
- return gl::OutOfMemory()
- << "HLSL compiler had an unexpected failure, " << gl::FmtHR(result);
- }
-
- 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 gl::NoError();
-}
-
-gl::Error HLSLCompiler::disassembleBinary(ID3DBlob *shaderBinary, std::string *disassemblyOut)
-{
- ANGLE_TRY(ensureInitialized());
-
- // 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(reinterpret_cast<const char*>(disassembly->GetBufferPointer()));
- }
- else
- {
- *disassemblyOut = "";
- }
-
- SafeRelease(disassembly);
-
- return gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.h
deleted file mode 100644
index c8f9eac290..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.h
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// 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 <vector>
-#include <string>
-
-namespace gl
-{
-class InfoLog;
-}
-
-namespace rx
-{
-
-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.
- gl::Error compileToBinary(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);
-
- gl::Error disassembleBinary(ID3DBlob *shaderBinary, std::string *disassemblyOut);
- gl::Error ensureInitialized();
-
- private:
-
- bool mInitialized;
- HMODULE mD3DCompilerModule;
- pD3DCompile mD3DCompileFunc;
- pD3DDisassemble mD3DDisassembleFunc;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_HLSLCOMPILER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ImageD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/ImageD3D.cpp
deleted file mode 100644
index dbbcbbed2a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ImageD3D.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// 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"
-
-#include "libANGLE/Framebuffer.h"
-#include "libANGLE/FramebufferAttachment.h"
-#include "libANGLE/renderer/d3d/FramebufferD3D.h"
-#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
-
-namespace rx
-{
-
-ImageD3D::ImageD3D()
- : mWidth(0),
- mHeight(0),
- mDepth(0),
- mInternalFormat(GL_NONE),
- mRenderable(false),
- mTarget(GL_NONE),
- mDirty(false)
-{
-}
-
-gl::Error ImageD3D::setManagedSurface2D(const gl::Context *context,
- TextureStorage *storage,
- int level)
-{
- return gl::NoError();
-}
-
-gl::Error ImageD3D::setManagedSurfaceCube(const gl::Context *context,
- TextureStorage *storage,
- int face,
- int level)
-{
- return gl::NoError();
-}
-
-gl::Error ImageD3D::setManagedSurface3D(const gl::Context *context,
- TextureStorage *storage,
- int level)
-{
- return gl::NoError();
-}
-
-gl::Error ImageD3D::setManagedSurface2DArray(const gl::Context *context,
- TextureStorage *storage,
- int layer,
- int level)
-{
- return gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ImageD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/ImageD3D.h
deleted file mode 100644
index 1b7235fbaa..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ImageD3D.h
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// 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 "libANGLE/Error.h"
-
-namespace gl
-{
-class Context;
-class Framebuffer;
-struct ImageIndex;
-struct Box;
-struct Extents;
-struct Offset;
-struct Rectangle;
-struct PixelUnpackState;
-}
-
-namespace rx
-{
-class TextureStorage;
-class RendererD3D;
-class RenderTargetD3D;
-
-class ImageD3D : angle::NonCopyable
-{
- public:
- ImageD3D();
- virtual ~ImageD3D() {};
-
- GLsizei getWidth() const { return mWidth; }
- GLsizei getHeight() const { return mHeight; }
- GLsizei getDepth() const { return mDepth; }
- GLenum getInternalFormat() const { return mInternalFormat; }
- GLenum getTarget() const { return mTarget; }
- bool isRenderableFormat() const { return mRenderable; }
-
- void markDirty() { mDirty = true; }
- void markClean() { mDirty = false; }
- virtual bool isDirty() const = 0;
-
- virtual bool redefine(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease) = 0;
-
- virtual gl::Error loadData(const gl::Context *context,
- const gl::Box &area,
- const gl::PixelUnpackState &unpack,
- GLenum type,
- const void *input,
- bool applySkipImages) = 0;
- virtual gl::Error loadCompressedData(const gl::Context *context,
- const gl::Box &area,
- const void *input) = 0;
-
- virtual gl::Error setManagedSurface2D(const gl::Context *context,
- TextureStorage *storage,
- int level);
- virtual gl::Error setManagedSurfaceCube(const gl::Context *context,
- TextureStorage *storage,
- int face,
- int level);
- virtual gl::Error setManagedSurface3D(const gl::Context *context,
- TextureStorage *storage,
- int level);
- virtual gl::Error setManagedSurface2DArray(const gl::Context *context,
- TextureStorage *storage,
- int layer,
- int level);
- virtual gl::Error copyToStorage(const gl::Context *context,
- TextureStorage *storage,
- const gl::ImageIndex &index,
- const gl::Box &region) = 0;
-
- virtual gl::Error copyFromTexStorage(const gl::Context *context,
- const gl::ImageIndex &imageIndex,
- TextureStorage *source) = 0;
- virtual gl::Error 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;
- GLenum mTarget;
-
- bool mDirty;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_IMAGED3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexBuffer.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexBuffer.cpp
deleted file mode 100644
index 937512a96a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexBuffer.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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/renderer/d3d/RendererD3D.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;
- }
-}
-
-GLenum IndexBufferInterface::getIndexType() const
-{
- return mIndexBuffer->getIndexType();
-}
-
-unsigned int IndexBufferInterface::getBufferSize() const
-{
- return mIndexBuffer->getBufferSize();
-}
-
-unsigned int IndexBufferInterface::getSerial() const
-{
- return mIndexBuffer->getSerial();
-}
-
-gl::Error IndexBufferInterface::mapBuffer(unsigned int size, void **outMappedMemory, unsigned int *streamOffset)
-{
- // Protect against integer overflow
- if (mWritePosition + size < mWritePosition)
- {
- return gl::OutOfMemory()
- << "Mapping of internal index buffer would cause an integer overflow.";
- }
-
- gl::Error error = mIndexBuffer->mapBuffer(mWritePosition, size, outMappedMemory);
- if (error.isError())
- {
- if (outMappedMemory)
- {
- *outMappedMemory = nullptr;
- }
- return error;
- }
-
- if (streamOffset)
- {
- *streamOffset = mWritePosition;
- }
-
- mWritePosition += size;
- return gl::NoError();
-}
-
-gl::Error IndexBufferInterface::unmapBuffer()
-{
- return mIndexBuffer->unmapBuffer();
-}
-
-IndexBuffer * IndexBufferInterface::getIndexBuffer() const
-{
- return mIndexBuffer;
-}
-
-unsigned int IndexBufferInterface::getWritePosition() const
-{
- return mWritePosition;
-}
-
-void IndexBufferInterface::setWritePosition(unsigned int writePosition)
-{
- mWritePosition = writePosition;
-}
-
-gl::Error IndexBufferInterface::discard()
-{
- return mIndexBuffer->discard();
-}
-
-gl::Error IndexBufferInterface::setBufferSize(unsigned int bufferSize, GLenum indexType)
-{
- if (mIndexBuffer->getBufferSize() == 0)
- {
- return mIndexBuffer->initialize(bufferSize, indexType, mDynamic);
- }
- else
- {
- return mIndexBuffer->setSize(bufferSize, indexType);
- }
-}
-
-StreamingIndexBufferInterface::StreamingIndexBufferInterface(BufferFactoryD3D *factory)
- : IndexBufferInterface(factory, true)
-{
-}
-
-StreamingIndexBufferInterface::~StreamingIndexBufferInterface()
-{
-}
-
-gl::Error StreamingIndexBufferInterface::reserveBufferSpace(unsigned int size, GLenum indexType)
-{
- unsigned int curBufferSize = getBufferSize();
- unsigned int writePos = getWritePosition();
- if (size > curBufferSize)
- {
- ANGLE_TRY(setBufferSize(std::max(size, 2 * curBufferSize), indexType));
- setWritePosition(0);
- }
- else if (writePos + size > curBufferSize || writePos + size < writePos)
- {
- ANGLE_TRY(discard());
- setWritePosition(0);
- }
-
- return gl::NoError();
-}
-
-
-StaticIndexBufferInterface::StaticIndexBufferInterface(BufferFactoryD3D *factory)
- : IndexBufferInterface(factory, false)
-{
-}
-
-StaticIndexBufferInterface::~StaticIndexBufferInterface()
-{
-}
-
-gl::Error StaticIndexBufferInterface::reserveBufferSpace(unsigned int size, GLenum indexType)
-{
- unsigned int curSize = getBufferSize();
- if (curSize == 0)
- {
- return setBufferSize(size, indexType);
- }
- else if (curSize >= size && indexType == getIndexType())
- {
- return gl::NoError();
- }
- else
- {
- UNREACHABLE();
- return gl::InternalError() << "Internal static index buffers can't be resized";
- }
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexBuffer.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexBuffer.h
deleted file mode 100644
index 969cf6ae63..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexBuffer.h
+++ /dev/null
@@ -1,100 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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/angleutils.h"
-#include "libANGLE/Error.h"
-
-namespace rx
-{
-class BufferFactoryD3D;
-
-class IndexBuffer : angle::NonCopyable
-{
- public:
- IndexBuffer();
- virtual ~IndexBuffer();
-
- virtual gl::Error initialize(unsigned int bufferSize, GLenum indexType, bool dynamic) = 0;
-
- virtual gl::Error mapBuffer(unsigned int offset, unsigned int size, void** outMappedMemory) = 0;
- virtual gl::Error unmapBuffer() = 0;
-
- virtual gl::Error discard() = 0;
-
- virtual GLenum getIndexType() const = 0;
- virtual unsigned int getBufferSize() const = 0;
- virtual gl::Error setSize(unsigned int bufferSize, GLenum indexType) = 0;
-
- unsigned int getSerial() const;
-
- protected:
- void updateSerial();
-
- private:
- unsigned int mSerial;
- static unsigned int mNextSerial;
-};
-
-class IndexBufferInterface : angle::NonCopyable
-{
- public:
- IndexBufferInterface(BufferFactoryD3D *factory, bool dynamic);
- virtual ~IndexBufferInterface();
-
- virtual gl::Error reserveBufferSpace(unsigned int size, GLenum indexType) = 0;
-
- GLenum getIndexType() const;
- unsigned int getBufferSize() const;
-
- unsigned int getSerial() const;
-
- gl::Error mapBuffer(unsigned int size, void** outMappedMemory, unsigned int *streamOffset);
- gl::Error unmapBuffer();
-
- IndexBuffer *getIndexBuffer() const;
-
- protected:
- unsigned int getWritePosition() const;
- void setWritePosition(unsigned int writePosition);
-
- gl::Error discard();
-
- gl::Error setBufferSize(unsigned int bufferSize, GLenum indexType);
-
- private:
- IndexBuffer *mIndexBuffer;
-
- unsigned int mWritePosition;
- bool mDynamic;
-};
-
-class StreamingIndexBufferInterface : public IndexBufferInterface
-{
- public:
- explicit StreamingIndexBufferInterface(BufferFactoryD3D *factory);
- ~StreamingIndexBufferInterface() override;
-
- gl::Error reserveBufferSpace(unsigned int size, GLenum indexType) override;
-};
-
-class StaticIndexBufferInterface : public IndexBufferInterface
-{
- public:
- explicit StaticIndexBufferInterface(BufferFactoryD3D *factory);
- ~StaticIndexBufferInterface() override;
-
- gl::Error reserveBufferSpace(unsigned int size, GLenum indexType) override;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_INDEXBUFFER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexDataManager.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexDataManager.cpp
deleted file mode 100644
index e974097b45..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexDataManager.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-//
-// 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/IndexBuffer.h"
-
-namespace rx
-{
-
-namespace
-{
-
-template <typename InputT, typename DestT>
-void ConvertIndexArray(const void *input,
- GLenum sourceType,
- void *output,
- GLenum 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(GLenum sourceType,
- GLenum destinationType,
- const void *input,
- GLsizei count,
- void *output,
- bool usePrimitiveRestartFixedIndex)
-{
- if (sourceType == destinationType)
- {
- const gl::Type &typeInfo = gl::GetTypeInfo(destinationType);
- memcpy(output, input, count * typeInfo.bytes);
- return;
- }
-
- if (sourceType == GL_UNSIGNED_BYTE)
- {
- ASSERT(destinationType == GL_UNSIGNED_SHORT);
- ConvertIndexArray<GLubyte, GLushort>(input, sourceType, output, destinationType, count,
- usePrimitiveRestartFixedIndex);
- }
- else if (sourceType == GL_UNSIGNED_SHORT)
- {
- ASSERT(destinationType == GL_UNSIGNED_INT);
- ConvertIndexArray<GLushort, GLuint>(input, sourceType, output, destinationType, count,
- usePrimitiveRestartFixedIndex);
- }
- else
- UNREACHABLE();
-}
-
-gl::Error StreamInIndexBuffer(IndexBufferInterface *buffer,
- const void *data,
- unsigned int count,
- GLenum srcType,
- GLenum dstType,
- bool usePrimitiveRestartFixedIndex,
- unsigned int *offset)
-{
- const gl::Type &dstTypeInfo = gl::GetTypeInfo(dstType);
-
- if (count > (std::numeric_limits<unsigned int>::max() >> dstTypeInfo.bytesShift))
- {
- return gl::OutOfMemory() << "Reserving " << count << " indices of " << dstTypeInfo.bytes
- << " bytes each exceeds the maximum buffer size.";
- }
-
- unsigned int bufferSizeRequired = count << dstTypeInfo.bytesShift;
- ANGLE_TRY(buffer->reserveBufferSpace(bufferSizeRequired, dstType));
-
- void *output = nullptr;
- ANGLE_TRY(buffer->mapBuffer(bufferSizeRequired, &output, offset));
-
- ConvertIndices(srcType, dstType, data, count, output, usePrimitiveRestartFixedIndex);
-
- ANGLE_TRY(buffer->unmapBuffer());
- return gl::NoError();
-}
-
-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;
- }
-}
-
-} // anonymous namespace
-
-bool IsOffsetAligned(GLenum elementType, unsigned int offset)
-{
- return (offset % ElementTypeSize(elementType) == 0);
-}
-
-// 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.
-gl::Error IndexDataManager::prepareIndexData(const gl::Context *context,
- GLenum srcType,
- GLenum dstType,
- GLsizei count,
- gl::Buffer *glBuffer,
- const void *indices,
- TranslatedIndexData *translated)
-{
- const gl::Type &srcTypeInfo = gl::GetTypeInfo(srcType);
- const gl::Type &dstTypeInfo = gl::GetTypeInfo(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->getGLState().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(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(srcTypeInfo.bytes * 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 >> srcTypeInfo.bytesShift);
- translated->startOffset = offset;
- return gl::NoError();
- }
-
- 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(bufferData + offset, count, srcType, dstType,
- primitiveRestartFixedIndexEnabled, translated));
- buffer->promoteStaticUsage(context, count << srcTypeInfo.bytesShift);
- }
- 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()) >> srcTypeInfo.bytesShift;
- ANGLE_TRY(StreamInIndexBuffer(staticBuffer, bufferData, convertCount, srcType, dstType,
- primitiveRestartFixedIndexEnabled, nullptr));
- }
- ASSERT(offsetAligned && staticBuffer->getIndexType() == dstType);
-
- translated->indexBuffer = staticBuffer->getIndexBuffer();
- translated->serial = staticBuffer->getSerial();
- translated->startIndex = (offset >> srcTypeInfo.bytesShift);
- translated->startOffset = (offset >> srcTypeInfo.bytesShift) << dstTypeInfo.bytesShift;
- }
-
- return gl::NoError();
-}
-
-gl::Error IndexDataManager::streamIndexData(const void *data,
- unsigned int count,
- GLenum srcType,
- GLenum dstType,
- bool usePrimitiveRestartFixedIndex,
- TranslatedIndexData *translated)
-{
- const gl::Type &dstTypeInfo = gl::GetTypeInfo(dstType);
-
- IndexBufferInterface *indexBuffer = nullptr;
- ANGLE_TRY(getStreamingIndexBuffer(dstType, &indexBuffer));
- ASSERT(indexBuffer != nullptr);
-
- unsigned int offset;
- ANGLE_TRY(StreamInIndexBuffer(indexBuffer, data, count, srcType, dstType,
- usePrimitiveRestartFixedIndex, &offset));
-
- translated->indexBuffer = indexBuffer->getIndexBuffer();
- translated->serial = indexBuffer->getSerial();
- translated->startIndex = (offset >> dstTypeInfo.bytesShift);
- translated->startOffset = offset;
-
- return gl::NoError();
-}
-
-gl::Error IndexDataManager::getStreamingIndexBuffer(GLenum destinationIndexType,
- IndexBufferInterface **outBuffer)
-{
- ASSERT(outBuffer);
- ASSERT(destinationIndexType == GL_UNSIGNED_SHORT || destinationIndexType == GL_UNSIGNED_INT);
-
- auto &streamingBuffer =
- (destinationIndexType == GL_UNSIGNED_INT) ? mStreamingBufferInt : mStreamingBufferShort;
-
- if (!streamingBuffer)
- {
- StreamingBuffer newBuffer(new StreamingIndexBufferInterface(mFactory));
- ANGLE_TRY(newBuffer->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, destinationIndexType));
- streamingBuffer = std::move(newBuffer);
- }
-
- *outBuffer = streamingBuffer.get();
- return gl::NoError();
-}
-
-GLenum GetIndexTranslationDestType(GLenum srcType,
- const gl::HasIndexRange &lazyIndexRange,
- bool usePrimitiveRestartWorkaround)
-{
- // Avoid D3D11's primitive restart index value
- // see http://msdn.microsoft.com/en-us/library/windows/desktop/bb205124(v=vs.85).aspx
- if (usePrimitiveRestartWorkaround)
- {
- const gl::IndexRange &indexRange = lazyIndexRange.getIndexRange().value();
- if (indexRange.end == gl::GetPrimitiveRestartIndex(srcType))
- {
- return GL_UNSIGNED_INT;
- }
- }
-
- return (srcType == GL_UNSIGNED_INT) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexDataManager.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexDataManager.h
deleted file mode 100644
index 77f05df92d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexDataManager.h
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// 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;
- GLenum srcIndexType;
- bool srcIndicesChanged;
-};
-
-struct TranslatedIndexData
-{
- unsigned int startIndex;
- unsigned int startOffset; // In bytes
-
- IndexBuffer *indexBuffer;
- BufferD3D *storage;
- GLenum indexType;
- unsigned int serial;
-
- SourceIndexData srcIndexData;
-};
-
-class IndexDataManager : angle::NonCopyable
-{
- public:
- explicit IndexDataManager(BufferFactoryD3D *factory);
- virtual ~IndexDataManager();
-
- void deinitialize();
-
- gl::Error prepareIndexData(const gl::Context *context,
- GLenum srcType,
- GLenum dstType,
- GLsizei count,
- gl::Buffer *glBuffer,
- const void *indices,
- TranslatedIndexData *translated);
-
- private:
- gl::Error streamIndexData(const void *data,
- unsigned int count,
- GLenum srcType,
- GLenum dstType,
- bool usePrimitiveRestartFixedIndex,
- TranslatedIndexData *translated);
- gl::Error getStreamingIndexBuffer(GLenum destinationIndexType,
- IndexBufferInterface **outBuffer);
-
- using StreamingBuffer = std::unique_ptr<StreamingIndexBufferInterface>;
-
- BufferFactoryD3D *const mFactory;
- std::unique_ptr<StreamingIndexBufferInterface> mStreamingBufferShort;
- std::unique_ptr<StreamingIndexBufferInterface> mStreamingBufferInt;
-};
-
-GLenum GetIndexTranslationDestType(GLenum srcType,
- const gl::HasIndexRange &lazyIndexRange,
- bool usePrimitiveRestartWorkaround);
-
-bool IsOffsetAligned(GLenum elementType, unsigned int offset);
-
-} // namespace rx
-
-#endif // LIBANGLE_INDEXDATAMANAGER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/NativeWindowD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/NativeWindowD3D.cpp
deleted file mode 100644
index 113bad647c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/NativeWindowD3D.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/NativeWindowD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/NativeWindowD3D.h
deleted file mode 100644
index 365448488d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/NativeWindowD3D.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/ProgramD3D.cpp
deleted file mode 100644
index afc318d9fa..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ProgramD3D.cpp
+++ /dev/null
@@ -1,2867 +0,0 @@
-//
-// 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/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/DynamicHLSL.h"
-#include "libANGLE/renderer/d3d/FramebufferD3D.h"
-#include "libANGLE/renderer/d3d/RendererD3D.h"
-#include "libANGLE/renderer/d3d/ShaderD3D.h"
-#include "libANGLE/renderer/d3d/ShaderExecutableD3D.h"
-#include "libANGLE/renderer/d3d/VertexDataManager.h"
-
-using namespace angle;
-
-namespace rx
-{
-
-namespace
-{
-
-void GetDefaultInputLayoutFromShader(const gl::Context *context,
- gl::Shader *vertexShader,
- gl::InputLayout *inputLayoutOut)
-{
- inputLayoutOut->clear();
-
- for (const sh::Attribute &shaderAttr : vertexShader->getActiveAttributes(context))
- {
- 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::VertexFormatType defaultType =
- gl::GetVertexFormatType(componentType, GL_FALSE, components, pureInt);
-
- inputLayoutOut->push_back(defaultType);
- }
- }
- }
-}
-
-void GetDefaultOutputLayoutFromShader(
- const std::vector<PixelShaderOutputVariable> &shaderOutputVars,
- std::vector<GLenum> *outputLayoutOut)
-{
- outputLayoutOut->clear();
-
- if (!shaderOutputVars.empty())
- {
- outputLayoutOut->push_back(GL_COLOR_ATTACHMENT0 +
- static_cast<unsigned int>(shaderOutputVars[0].outputIndex));
- }
-}
-
-template <typename T, int cols, int rows>
-bool TransposeExpandMatrix(T *target, const GLfloat *value)
-{
- constexpr int targetWidth = 4;
- constexpr int targetHeight = rows;
- constexpr int srcWidth = rows;
- constexpr int srcHeight = cols;
-
- constexpr int copyWidth = std::min(targetHeight, srcWidth);
- constexpr int copyHeight = std::min(targetWidth, srcHeight);
-
- T staging[targetWidth * targetHeight] = {0};
-
- for (int x = 0; x < copyWidth; x++)
- {
- for (int y = 0; y < copyHeight; y++)
- {
- staging[x * targetWidth + y] = static_cast<T>(value[y * srcWidth + x]);
- }
- }
-
- if (memcmp(target, staging, targetWidth * targetHeight * sizeof(T)) == 0)
- {
- return false;
- }
-
- memcpy(target, staging, targetWidth * targetHeight * sizeof(T));
- return true;
-}
-
-template <typename T, int cols, int rows>
-bool ExpandMatrix(T *target, const GLfloat *value)
-{
- constexpr int targetWidth = 4;
- constexpr int targetHeight = rows;
- constexpr int srcWidth = cols;
- constexpr int srcHeight = rows;
-
- constexpr int copyWidth = std::min(targetWidth, srcWidth);
- constexpr int copyHeight = std::min(targetHeight, srcHeight);
-
- T staging[targetWidth * targetHeight] = {0};
-
- for (int y = 0; y < copyHeight; y++)
- {
- for (int x = 0; x < copyWidth; x++)
- {
- staging[y * targetWidth + x] = static_cast<T>(value[y * srcWidth + x]);
- }
- }
-
- if (memcmp(target, staging, targetWidth * targetHeight * sizeof(T)) == 0)
- {
- return false;
- }
-
- memcpy(target, staging, targetWidth * targetHeight * sizeof(T));
- return true;
-}
-
-gl::PrimitiveType GetGeometryShaderTypeFromDrawMode(GLenum drawMode)
-{
- switch (drawMode)
- {
- // Uses the point sprite geometry shader.
- case GL_POINTS:
- return gl::PRIMITIVE_POINTS;
-
- // All line drawing uses the same geometry shader.
- case GL_LINES:
- case GL_LINE_STRIP:
- case GL_LINE_LOOP:
- return gl::PRIMITIVE_LINES;
-
- // The triangle fan primitive is emulated with strips in D3D11.
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- return gl::PRIMITIVE_TRIANGLES;
-
- // Special case for triangle strips.
- case GL_TRIANGLE_STRIP:
- return gl::PRIMITIVE_TRIANGLE_STRIP;
-
- default:
- UNREACHABLE();
- return gl::PRIMITIVE_TYPE_MAX;
- }
-}
-
-bool FindFlatInterpolationVarying(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;
-}
-
-// Helper method to de-tranpose a matrix uniform for an API query.
-void GetMatrixUniform(GLint columns, GLint rows, GLfloat *dataOut, const GLfloat *source)
-{
- for (GLint col = 0; col < columns; ++col)
- {
- for (GLint row = 0; row < rows; ++row)
- {
- GLfloat *outptr = dataOut + ((col * rows) + row);
- const GLfloat *inptr = source + ((row * 4) + col);
- *outptr = *inptr;
- }
- }
-}
-
-template <typename NonFloatT>
-void GetMatrixUniform(GLint columns, GLint rows, NonFloatT *dataOut, const NonFloatT *source)
-{
- UNREACHABLE();
-}
-
-class UniformBlockInfo final : angle::NonCopyable
-{
- public:
- UniformBlockInfo() {}
-
- void getShaderBlockInfo(const gl::Context *context, gl::Shader *shader);
-
- 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;
-};
-
-void UniformBlockInfo::getShaderBlockInfo(const gl::Context *context, gl::Shader *shader)
-{
- for (const sh::InterfaceBlock &interfaceBlock : shader->getUniformBlocks(context))
- {
- if (!interfaceBlock.staticUse && interfaceBlock.layout == sh::BLOCKLAYOUT_PACKED)
- continue;
-
- if (mBlockSizes.count(interfaceBlock.name) > 0)
- continue;
-
- size_t dataSize = getBlockInfo(interfaceBlock);
- mBlockSizes[interfaceBlock.name] = dataSize;
- }
-}
-
-size_t UniformBlockInfo::getBlockInfo(const sh::InterfaceBlock &interfaceBlock)
-{
- ASSERT(interfaceBlock.staticUse || interfaceBlock.layout != sh::BLOCKLAYOUT_PACKED);
-
- // define member uniforms
- sh::Std140BlockEncoder std140Encoder;
- sh::HLSLBlockEncoder hlslEncoder(sh::HLSLBlockEncoder::ENCODE_PACKED, false);
- sh::BlockLayoutEncoder *encoder = nullptr;
-
- if (interfaceBlock.layout == sh::BLOCKLAYOUT_STD140)
- {
- encoder = &std140Encoder;
- }
- else
- {
- encoder = &hlslEncoder;
- }
-
- sh::GetUniformBlockInfo(interfaceBlock.fields, interfaceBlock.fieldPrefix(), encoder,
- interfaceBlock.isRowMajorLayout, &mBlockLayout);
-
- return encoder->getBlockSize();
-}
-
-bool UniformBlockInfo::getBlockSize(const std::string &name,
- const std::string &mappedName,
- size_t *sizeOut)
-{
- size_t nameLengthWithoutArrayIndex;
- gl::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 UniformBlockInfo::getBlockMemberInfo(const std::string &name,
- const std::string &mappedName,
- sh::BlockMemberInfo *infoOut)
-{
- auto infoIter = mBlockLayout.find(name);
- if (infoIter == mBlockLayout.end())
- {
- *infoOut = sh::BlockMemberInfo::getDefaultBlockInfo();
- return false;
- }
-
- *infoOut = infoIter->second;
- return true;
-};
-
-} // anonymous namespace
-
-// D3DUniform Implementation
-
-D3DUniform::D3DUniform(GLenum type,
- const std::string &nameIn,
- const std::vector<unsigned int> &arraySizesIn,
- bool defaultBlock)
- : typeInfo(gl::GetUniformTypeInfo(type)),
- name(nameIn),
- arraySizes(arraySizesIn),
- vsData(nullptr),
- psData(nullptr),
- csData(nullptr),
- vsRegisterIndex(GL_INVALID_INDEX),
- psRegisterIndex(GL_INVALID_INDEX),
- csRegisterIndex(GL_INVALID_INDEX),
- registerCount(0),
- registerElement(0)
-{
- // We use data storage for default block uniforms to cache values that are sent to D3D during
- // rendering
- // Uniform blocks/buffers are treated separately by the Renderer (ES3 path only)
- if (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::isReferencedByVertexShader() const
-{
- return vsRegisterIndex != GL_INVALID_INDEX;
-}
-
-bool D3DUniform::isReferencedByFragmentShader() const
-{
- return psRegisterIndex != GL_INVALID_INDEX;
-}
-
-bool D3DUniform::isReferencedByComputeShader() const
-{
- return csRegisterIndex != GL_INVALID_INDEX;
-}
-
-const uint8_t *D3DUniform::firstNonNullData() const
-{
- ASSERT(vsData || psData || csData || !mSamplerData.empty());
-
- if (!mSamplerData.empty())
- {
- return reinterpret_cast<const uint8_t *>(mSamplerData.data());
- }
-
- return vsData ? vsData : (psData ? psData : csData);
-}
-
-// 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 ShaderD3D *vertexShader,
- const ShaderD3D *fragmentShader)
- : mRendererMajorShaderModel(renderer->getMajorShaderModel()),
- mShaderModelSuffix(renderer->getShaderModelSuffix()),
- mUsesInstancedPointSpriteEmulation(
- renderer->getWorkarounds().useInstancedPointSpriteEmulation),
- mUsesViewScale(renderer->presentPathFastEnabled()),
- mHasANGLEMultiviewEnabled(vertexShader->hasANGLEMultiviewEnabled()),
- mUsesViewID(fragmentShader->usesViewID()),
- mCanSelectViewInVertexShader(renderer->canSelectViewInVertexShader()),
- mVertexShader(vertexShader),
- mFragmentShader(fragmentShader)
-{
-}
-
-int ProgramD3DMetadata::getRendererMajorShaderModel() const
-{
- return mRendererMajorShaderModel;
-}
-
-bool ProgramD3DMetadata::usesBroadcast(const gl::ContextState &data) const
-{
- return (mFragmentShader->usesFragColor() && mFragmentShader->usesMultipleRenderTargets() &&
- data.getClientMajorVersion() < 3);
-}
-
-bool ProgramD3DMetadata::usesFragDepth() const
-{
- return mFragmentShader->usesFragDepth();
-}
-
-bool ProgramD3DMetadata::usesPointCoord() const
-{
- return mFragmentShader->usesPointCoord();
-}
-
-bool ProgramD3DMetadata::usesFragCoord() const
-{
- return mFragmentShader->usesFragCoord();
-}
-
-bool ProgramD3DMetadata::usesPointSize() const
-{
- return mVertexShader->usesPointSize();
-}
-
-bool ProgramD3DMetadata::usesInsertedPointCoordValue() const
-{
- return (!usesPointSize() || !mUsesInstancedPointSpriteEmulation) && usesPointCoord() &&
- mRendererMajorShaderModel >= 4;
-}
-
-bool ProgramD3DMetadata::usesViewScale() const
-{
- return mUsesViewScale;
-}
-
-bool ProgramD3DMetadata::hasANGLEMultiviewEnabled() const
-{
- return mHasANGLEMultiviewEnabled;
-}
-
-bool ProgramD3DMetadata::usesViewID() const
-{
- return mUsesViewID;
-}
-
-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 mFragmentShader->usesMultipleRenderTargets();
-}
-
-GLint ProgramD3DMetadata::getMajorShaderVersion() const
-{
- return mVertexShader->getData().getShaderVersion();
-}
-
-const ShaderD3D *ProgramD3DMetadata::getFragmentShader() const
-{
- return mFragmentShader;
-}
-
-// 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)
- {
- gl::VertexFormatType vertexFormatType = inputLayout[index];
- if (vertexFormatType == gl::VERTEX_FORMAT_INVALID)
- continue;
-
- VertexConversionType conversionType = renderer->getVertexConversionType(vertexFormatType);
- if ((conversionType & VERTEX_CONVERT_GPU) == 0)
- continue;
-
- GLenum componentType = renderer->getVertexComponentType(vertexFormatType);
- (*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::Sampler::Sampler() : active(false), logicalTextureUnit(0), textureType(GL_TEXTURE_2D)
-{
-}
-
-unsigned int ProgramD3D::mCurrentSerial = 1;
-
-ProgramD3D::ProgramD3D(const gl::ProgramState &state, RendererD3D *renderer)
- : ProgramImpl(state),
- mRenderer(renderer),
- mDynamicHLSL(nullptr),
- mGeometryExecutables(gl::PRIMITIVE_TYPE_MAX),
- mComputeExecutable(nullptr),
- mUsesPointSize(false),
- mUsesFlatInterpolation(false),
- mVertexUniformStorage(nullptr),
- mFragmentUniformStorage(nullptr),
- mComputeUniformStorage(nullptr),
- mUsedVertexSamplerRange(0),
- mUsedPixelSamplerRange(0),
- mUsedComputeSamplerRange(0),
- mDirtySamplerMapping(true),
- mSerial(issueSerial()),
- mVertexUniformsDirty(true),
- mFragmentUniformsDirty(true),
- mComputeUniformsDirty(true)
-{
- 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::usesGeometryShader(GLenum drawMode) const
-{
- if (mHasANGLEMultiviewEnabled && !mRenderer->canSelectViewInVertexShader())
- {
- return true;
- }
- if (drawMode != GL_POINTS)
- {
- return mUsesFlatInterpolation;
- }
- return usesGeometryShaderForPointSpriteEmulation();
-}
-
-bool ProgramD3D::usesInstancedPointSpriteEmulation() const
-{
- return mRenderer->getWorkarounds().useInstancedPointSpriteEmulation;
-}
-
-GLint ProgramD3D::getSamplerMapping(gl::SamplerType type,
- unsigned int samplerIndex,
- const gl::Caps &caps) const
-{
- GLint logicalTextureUnit = -1;
-
- switch (type)
- {
- case gl::SAMPLER_PIXEL:
- ASSERT(samplerIndex < caps.maxTextureImageUnits);
- if (samplerIndex < mSamplersPS.size() && mSamplersPS[samplerIndex].active)
- {
- logicalTextureUnit = mSamplersPS[samplerIndex].logicalTextureUnit;
- }
- break;
- case gl::SAMPLER_VERTEX:
- ASSERT(samplerIndex < caps.maxVertexTextureImageUnits);
- if (samplerIndex < mSamplersVS.size() && mSamplersVS[samplerIndex].active)
- {
- logicalTextureUnit = mSamplersVS[samplerIndex].logicalTextureUnit;
- }
- break;
- case gl::SAMPLER_COMPUTE:
- ASSERT(samplerIndex < caps.maxComputeTextureImageUnits);
- if (samplerIndex < mSamplersCS.size() && mSamplersCS[samplerIndex].active)
- {
- logicalTextureUnit = mSamplersCS[samplerIndex].logicalTextureUnit;
- }
- break;
- default:
- UNREACHABLE();
- }
-
- 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).
-GLenum ProgramD3D::getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const
-{
- switch (type)
- {
- case gl::SAMPLER_PIXEL:
- ASSERT(samplerIndex < mSamplersPS.size());
- ASSERT(mSamplersPS[samplerIndex].active);
- return mSamplersPS[samplerIndex].textureType;
- case gl::SAMPLER_VERTEX:
- ASSERT(samplerIndex < mSamplersVS.size());
- ASSERT(mSamplersVS[samplerIndex].active);
- return mSamplersVS[samplerIndex].textureType;
- case gl::SAMPLER_COMPUTE:
- ASSERT(samplerIndex < mSamplersCS.size());
- ASSERT(mSamplersCS[samplerIndex].active);
- return mSamplersCS[samplerIndex].textureType;
- default:
- UNREACHABLE();
- }
-
- return GL_TEXTURE_2D;
-}
-
-GLuint ProgramD3D::getUsedSamplerRange(gl::SamplerType type) const
-{
- switch (type)
- {
- case gl::SAMPLER_PIXEL:
- return mUsedPixelSamplerRange;
- case gl::SAMPLER_VERTEX:
- return mUsedVertexSamplerRange;
- case gl::SAMPLER_COMPUTE:
- return mUsedComputeSamplerRange;
- default:
- UNREACHABLE();
- return 0u;
- }
-}
-
-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();
-
- if (d3dUniform->isReferencedByFragmentShader())
- {
- unsigned int firstIndex = d3dUniform->psRegisterIndex;
-
- for (int i = 0; i < count; i++)
- {
- unsigned int samplerIndex = firstIndex + i;
-
- if (samplerIndex < mSamplersPS.size())
- {
- ASSERT(mSamplersPS[samplerIndex].active);
- mSamplersPS[samplerIndex].logicalTextureUnit = d3dUniform->mSamplerData[i];
- }
- }
- }
-
- if (d3dUniform->isReferencedByVertexShader())
- {
- unsigned int firstIndex = d3dUniform->vsRegisterIndex;
-
- for (int i = 0; i < count; i++)
- {
- unsigned int samplerIndex = firstIndex + i;
-
- if (samplerIndex < mSamplersVS.size())
- {
- ASSERT(mSamplersVS[samplerIndex].active);
- mSamplersVS[samplerIndex].logicalTextureUnit = d3dUniform->mSamplerData[i];
- }
- }
- }
-
- if (d3dUniform->isReferencedByComputeShader())
- {
- unsigned int firstIndex = d3dUniform->csRegisterIndex;
-
- for (int i = 0; i < count; i++)
- {
- unsigned int samplerIndex = firstIndex + i;
-
- if (samplerIndex < mSamplersCS.size())
- {
- ASSERT(mSamplersCS[samplerIndex].active);
- mSamplersCS[samplerIndex].logicalTextureUnit = d3dUniform->mSamplerData[i];
- }
- }
- }
- }
-
- return SamplerMapping::WasDirty;
-}
-
-gl::LinkResult ProgramD3D::load(const gl::Context *context,
- gl::InfoLog &infoLog,
- gl::BinaryInputStream *stream)
-{
- // 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 false;
- }
-
- int compileFlags = stream->readInt<int>();
- if (compileFlags != ANGLE_COMPILE_OPTIMIZATION_LEVEL)
- {
- infoLog << "Mismatched compilation flags.";
- return false;
- }
-
- for (int &index : mAttribLocationToD3DSemantic)
- {
- stream->readInt(&index);
- }
-
- const unsigned int psSamplerCount = stream->readInt<unsigned int>();
- for (unsigned int i = 0; i < psSamplerCount; ++i)
- {
- Sampler sampler;
- stream->readBool(&sampler.active);
- stream->readInt(&sampler.logicalTextureUnit);
- stream->readInt(&sampler.textureType);
- mSamplersPS.push_back(sampler);
- }
- const unsigned int vsSamplerCount = stream->readInt<unsigned int>();
- for (unsigned int i = 0; i < vsSamplerCount; ++i)
- {
- Sampler sampler;
- stream->readBool(&sampler.active);
- stream->readInt(&sampler.logicalTextureUnit);
- stream->readInt(&sampler.textureType);
- mSamplersVS.push_back(sampler);
- }
-
- const unsigned int csSamplerCount = stream->readInt<unsigned int>();
- for (unsigned int i = 0; i < csSamplerCount; ++i)
- {
- Sampler sampler;
- stream->readBool(&sampler.active);
- stream->readInt(&sampler.logicalTextureUnit);
- stream->readInt(&sampler.textureType);
- mSamplersCS.push_back(sampler);
- }
-
- stream->readInt(&mUsedVertexSamplerRange);
- stream->readInt(&mUsedPixelSamplerRange);
- stream->readInt(&mUsedComputeSamplerRange);
-
- const unsigned int uniformCount = stream->readInt<unsigned int>();
- if (stream->error())
- {
- infoLog << "Invalid program binary.";
- return false;
- }
-
- 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, linkedUniform.name, linkedUniform.arraySizes,
- linkedUniform.isInDefaultBlock());
- stream->readInt(&d3dUniform->psRegisterIndex);
- stream->readInt(&d3dUniform->vsRegisterIndex);
- stream->readInt(&d3dUniform->csRegisterIndex);
- 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 false;
- }
-
- ASSERT(mD3DUniformBlocks.empty());
- for (unsigned int blockIndex = 0; blockIndex < blockCount; ++blockIndex)
- {
- D3DUniformBlock uniformBlock;
- stream->readInt(&uniformBlock.psRegisterIndex);
- stream->readInt(&uniformBlock.vsRegisterIndex);
- stream->readInt(&uniformBlock.csRegisterIndex);
- 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);
- }
-
- stream->readString(&mVertexHLSL);
- stream->readBytes(reinterpret_cast<unsigned char *>(&mVertexWorkarounds),
- sizeof(angle::CompilerWorkaroundsD3D));
- stream->readString(&mPixelHLSL);
- stream->readBytes(reinterpret_cast<unsigned char *>(&mPixelWorkarounds),
- sizeof(angle::CompilerWorkaroundsD3D));
- stream->readBool(&mUsesFragDepth);
- stream->readBool(&mHasANGLEMultiviewEnabled);
- 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].outputIndex);
- }
-
- stream->readString(&mGeometryShaderPreamble);
-
- 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, gl::VERTEX_FORMAT_INVALID);
-
- for (size_t inputIndex = 0; inputIndex < inputLayoutSize; inputIndex++)
- {
- inputLayout[inputIndex] = stream->readInt<gl::VertexFormatType>();
- }
-
- unsigned int vertexShaderSize = stream->readInt<unsigned int>();
- const unsigned char *vertexShaderFunction = binary + stream->offset();
-
- ShaderExecutableD3D *shaderExecutable = nullptr;
-
- ANGLE_TRY(mRenderer->loadExecutable(vertexShaderFunction, vertexShaderSize,
- gl::SHADER_VERTEX, mStreamOutVaryings, separateAttribs,
- &shaderExecutable));
-
- if (!shaderExecutable)
- {
- infoLog << "Could not create vertex shader.";
- return false;
- }
-
- // 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(pixelShaderFunction, pixelShaderSize,
- gl::SHADER_FRAGMENT, mStreamOutVaryings,
- separateAttribs, &shaderExecutable));
-
- if (!shaderExecutable)
- {
- infoLog << "Could not create pixel shader.";
- return false;
- }
-
- // add new binary
- mPixelExecutables.push_back(
- std::unique_ptr<PixelExecutable>(new PixelExecutable(outputs, shaderExecutable)));
-
- stream->skip(pixelShaderSize);
- }
-
- for (unsigned int geometryExeIndex = 0; geometryExeIndex < gl::PRIMITIVE_TYPE_MAX;
- ++geometryExeIndex)
- {
- 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(geometryShaderFunction, geometryShaderSize,
- gl::SHADER_GEOMETRY, mStreamOutVaryings,
- separateAttribs, &geometryExecutable));
-
- if (!geometryExecutable)
- {
- infoLog << "Could not create geometry shader.";
- return false;
- }
-
- mGeometryExecutables[geometryExeIndex].reset(geometryExecutable);
-
- stream->skip(geometryShaderSize);
- }
-
- unsigned int computeShaderSize = stream->readInt<unsigned int>();
- if (computeShaderSize > 0)
- {
- const unsigned char *computeShaderFunction = binary + stream->offset();
-
- ShaderExecutableD3D *computeExecutable = nullptr;
- ANGLE_TRY(mRenderer->loadExecutable(computeShaderFunction, computeShaderSize,
- gl::SHADER_COMPUTE, std::vector<D3DVarying>(), false,
- &computeExecutable));
-
- if (!computeExecutable)
- {
- infoLog << "Could not create compute shader.";
- return false;
- }
-
- mComputeExecutable.reset(computeExecutable);
- }
-
- initializeUniformStorage();
-
- return true;
-}
-
-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);
- }
-
- stream->writeInt(mSamplersPS.size());
- for (unsigned int i = 0; i < mSamplersPS.size(); ++i)
- {
- stream->writeInt(mSamplersPS[i].active);
- stream->writeInt(mSamplersPS[i].logicalTextureUnit);
- stream->writeInt(mSamplersPS[i].textureType);
- }
-
- stream->writeInt(mSamplersVS.size());
- for (unsigned int i = 0; i < mSamplersVS.size(); ++i)
- {
- stream->writeInt(mSamplersVS[i].active);
- stream->writeInt(mSamplersVS[i].logicalTextureUnit);
- stream->writeInt(mSamplersVS[i].textureType);
- }
-
- stream->writeInt(mSamplersCS.size());
- for (unsigned int i = 0; i < mSamplersCS.size(); ++i)
- {
- stream->writeInt(mSamplersCS[i].active);
- stream->writeInt(mSamplersCS[i].logicalTextureUnit);
- stream->writeInt(mSamplersCS[i].textureType);
- }
-
- stream->writeInt(mUsedVertexSamplerRange);
- stream->writeInt(mUsedPixelSamplerRange);
- stream->writeInt(mUsedComputeSamplerRange);
-
- stream->writeInt(mD3DUniforms.size());
- for (const D3DUniform *uniform : mD3DUniforms)
- {
- // Type, name and arraySize are redundant, so aren't stored in the binary.
- stream->writeIntOrNegOne(uniform->psRegisterIndex);
- stream->writeIntOrNegOne(uniform->vsRegisterIndex);
- stream->writeIntOrNegOne(uniform->csRegisterIndex);
- stream->writeInt(uniform->registerCount);
- stream->writeInt(uniform->registerElement);
- }
-
- stream->writeInt(mD3DUniformBlocks.size());
- for (const D3DUniformBlock &uniformBlock : mD3DUniformBlocks)
- {
- stream->writeIntOrNegOne(uniformBlock.psRegisterIndex);
- stream->writeIntOrNegOne(uniformBlock.vsRegisterIndex);
- stream->writeIntOrNegOne(uniformBlock.csRegisterIndex);
- }
-
- 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);
- }
-
- stream->writeString(mVertexHLSL);
- stream->writeBytes(reinterpret_cast<unsigned char *>(&mVertexWorkarounds),
- sizeof(angle::CompilerWorkaroundsD3D));
- stream->writeString(mPixelHLSL);
- stream->writeBytes(reinterpret_cast<unsigned char *>(&mPixelWorkarounds),
- sizeof(angle::CompilerWorkaroundsD3D));
- stream->writeInt(mUsesFragDepth);
- stream->writeInt(mHasANGLEMultiviewEnabled);
- 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.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);
- }
-
- if (mComputeExecutable)
- {
- size_t computeShaderSize = mComputeExecutable->getLength();
- stream->writeInt(computeShaderSize);
- stream->writeBytes(mComputeExecutable->getFunction(), computeShaderSize);
- }
- else
- {
- stream->writeInt(0);
- }
-}
-
-void ProgramD3D::setBinaryRetrievableHint(bool /* retrievable */)
-{
-}
-
-void ProgramD3D::setSeparable(bool /* separable */)
-{
-}
-
-gl::Error ProgramD3D::getPixelExecutableForCachedOutputLayout(ShaderExecutableD3D **outExecutable,
- gl::InfoLog *infoLog)
-{
- if (mCachedPixelExecutableIndex.valid())
- {
- *outExecutable = mPixelExecutables[mCachedPixelExecutableIndex.value()]->shaderExecutable();
- return gl::NoError();
- }
-
- std::string finalPixelHLSL = mDynamicHLSL->generatePixelShaderForOutputSignature(
- mPixelHLSL, mPixelShaderKey, mUsesFragDepth, mPixelShaderOutputLayoutCache);
-
- // Generate new pixel executable
- ShaderExecutableD3D *pixelExecutable = nullptr;
-
- gl::InfoLog tempInfoLog;
- gl::InfoLog *currentInfoLog = infoLog ? infoLog : &tempInfoLog;
-
- ANGLE_TRY(mRenderer->compileToExecutable(
- *currentInfoLog, finalPixelHLSL, gl::SHADER_FRAGMENT, mStreamOutVaryings,
- (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS), mPixelWorkarounds,
- &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 gl::NoError();
-}
-
-gl::Error ProgramD3D::getVertexExecutableForCachedInputLayout(ShaderExecutableD3D **outExectuable,
- gl::InfoLog *infoLog)
-{
- if (mCachedVertexExecutableIndex.valid())
- {
- *outExectuable =
- mVertexExecutables[mCachedVertexExecutableIndex.value()]->shaderExecutable();
- return gl::NoError();
- }
-
- // Generate new dynamic layout with attribute conversions
- std::string finalVertexHLSL = mDynamicHLSL->generateVertexShaderForInputLayout(
- mVertexHLSL, mCachedInputLayout, mState.getAttributes());
-
- // Generate new vertex executable
- ShaderExecutableD3D *vertexExecutable = nullptr;
-
- gl::InfoLog tempInfoLog;
- gl::InfoLog *currentInfoLog = infoLog ? infoLog : &tempInfoLog;
-
- ANGLE_TRY(mRenderer->compileToExecutable(
- *currentInfoLog, finalVertexHLSL, gl::SHADER_VERTEX, mStreamOutVaryings,
- (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS), mVertexWorkarounds,
- &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 gl::NoError();
-}
-
-gl::Error ProgramD3D::getGeometryExecutableForPrimitiveType(const gl::Context *context,
- GLenum 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(drawMode))
- {
- return gl::NoError();
- }
-
- gl::PrimitiveType geometryShaderType = GetGeometryShaderTypeFromDrawMode(drawMode);
-
- if (mGeometryExecutables[geometryShaderType])
- {
- if (outExecutable)
- {
- *outExecutable = mGeometryExecutables[geometryShaderType].get();
- }
- return gl::NoError();
- }
-
- std::string geometryHLSL = mDynamicHLSL->generateGeometryShaderHLSL(
- context, geometryShaderType, mState, mRenderer->presentPathFastEnabled(),
- mHasANGLEMultiviewEnabled, mRenderer->canSelectViewInVertexShader(),
- usesGeometryShaderForPointSpriteEmulation(), mGeometryShaderPreamble);
-
- gl::InfoLog tempInfoLog;
- gl::InfoLog *currentInfoLog = infoLog ? infoLog : &tempInfoLog;
-
- ShaderExecutableD3D *geometryExecutable = nullptr;
- gl::Error error = mRenderer->compileToExecutable(
- *currentInfoLog, geometryHLSL, gl::SHADER_GEOMETRY, mStreamOutVaryings,
- (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS),
- angle::CompilerWorkaroundsD3D(), &geometryExecutable);
-
- if (!infoLog && error.isError())
- {
- 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 error;
-}
-
-class ProgramD3D::GetExecutableTask : public Closure
-{
- public:
- GetExecutableTask(ProgramD3D *program)
- : mProgram(program), mError(gl::NoError()), mInfoLog(), mResult(nullptr)
- {
- }
-
- virtual gl::Error run() = 0;
-
- void operator()() override { mError = run(); }
-
- const gl::Error &getError() const { return mError; }
- const gl::InfoLog &getInfoLog() const { return mInfoLog; }
- ShaderExecutableD3D *getResult() { return mResult; }
-
- protected:
- ProgramD3D *mProgram;
- gl::Error mError;
- gl::InfoLog mInfoLog;
- ShaderExecutableD3D *mResult;
-};
-
-class ProgramD3D::GetVertexExecutableTask : public ProgramD3D::GetExecutableTask
-{
- public:
- GetVertexExecutableTask(ProgramD3D *program, const gl::Context *context)
- : GetExecutableTask(program), mContext(context)
- {
- }
- gl::Error run() override
- {
- mProgram->updateCachedInputLayoutFromShader(mContext);
-
- ANGLE_TRY(mProgram->getVertexExecutableForCachedInputLayout(&mResult, &mInfoLog));
-
- return gl::NoError();
- }
-
- private:
- const gl::Context *mContext;
-};
-
-void ProgramD3D::updateCachedInputLayoutFromShader(const gl::Context *context)
-{
- GetDefaultInputLayoutFromShader(context, mState.getAttachedVertexShader(), &mCachedInputLayout);
- VertexExecutable::getSignature(mRenderer, mCachedInputLayout, &mCachedVertexSignature);
- updateCachedVertexExecutableIndex();
-}
-
-class ProgramD3D::GetPixelExecutableTask : public ProgramD3D::GetExecutableTask
-{
- public:
- GetPixelExecutableTask(ProgramD3D *program) : GetExecutableTask(program) {}
- gl::Error run() override
- {
- mProgram->updateCachedOutputLayoutFromShader();
-
- ANGLE_TRY(mProgram->getPixelExecutableForCachedOutputLayout(&mResult, &mInfoLog));
-
- return gl::NoError();
- }
-};
-
-void ProgramD3D::updateCachedOutputLayoutFromShader()
-{
- GetDefaultOutputLayoutFromShader(mPixelShaderKey, &mPixelShaderOutputLayoutCache);
- updateCachedPixelExecutableIndex();
-}
-
-class ProgramD3D::GetGeometryExecutableTask : public ProgramD3D::GetExecutableTask
-{
- public:
- GetGeometryExecutableTask(ProgramD3D *program, const gl::Context *context)
- : GetExecutableTask(program), mContext(context)
- {
- }
-
- gl::Error run() override
- {
- // Auto-generate the geometry shader here, if we expect to be using point rendering in
- // D3D11.
- if (mProgram->usesGeometryShader(GL_POINTS))
- {
- ANGLE_TRY(mProgram->getGeometryExecutableForPrimitiveType(mContext, GL_POINTS, &mResult,
- &mInfoLog));
- }
-
- return gl::NoError();
- }
-
- private:
- const gl::Context *mContext;
-};
-
-gl::Error ProgramD3D::getComputeExecutable(ShaderExecutableD3D **outExecutable)
-{
- if (outExecutable)
- {
- *outExecutable = mComputeExecutable.get();
- }
-
- return gl::NoError();
-}
-
-gl::LinkResult ProgramD3D::compileProgramExecutables(const gl::Context *context,
- gl::InfoLog &infoLog)
-{
- // Ensure the compiler is initialized to avoid race conditions.
- ANGLE_TRY(mRenderer->ensureHLSLCompilerInitialized());
-
- WorkerThreadPool *workerPool = mRenderer->getWorkerThreadPool();
-
- GetVertexExecutableTask vertexTask(this, context);
- GetPixelExecutableTask pixelTask(this);
- GetGeometryExecutableTask geometryTask(this, context);
-
- std::array<WaitableEvent, 3> waitEvents = {{workerPool->postWorkerTask(&vertexTask),
- workerPool->postWorkerTask(&pixelTask),
- workerPool->postWorkerTask(&geometryTask)}};
-
- WaitableEvent::WaitMany(&waitEvents);
-
- infoLog << vertexTask.getInfoLog().str();
- infoLog << pixelTask.getInfoLog().str();
- infoLog << geometryTask.getInfoLog().str();
-
- ANGLE_TRY(vertexTask.getError());
- ANGLE_TRY(pixelTask.getError());
- ANGLE_TRY(geometryTask.getError());
-
- ShaderExecutableD3D *defaultVertexExecutable = vertexTask.getResult();
- ShaderExecutableD3D *defaultPixelExecutable = pixelTask.getResult();
- ShaderExecutableD3D *pointGS = geometryTask.getResult();
-
- const ShaderD3D *vertexShaderD3D = GetImplAs<ShaderD3D>(mState.getAttachedVertexShader());
-
- if (usesGeometryShader(GL_POINTS) && 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.
- vertexShaderD3D->appendDebugInfo("// GEOMETRY SHADER BEGIN\n\n");
- vertexShaderD3D->appendDebugInfo(pointGS->getDebugInfo());
- vertexShaderD3D->appendDebugInfo("\nGEOMETRY SHADER END\n\n\n");
- }
-
- if (defaultVertexExecutable)
- {
- vertexShaderD3D->appendDebugInfo(defaultVertexExecutable->getDebugInfo());
- }
-
- if (defaultPixelExecutable)
- {
- const ShaderD3D *fragmentShaderD3D =
- GetImplAs<ShaderD3D>(mState.getAttachedFragmentShader());
- fragmentShaderD3D->appendDebugInfo(defaultPixelExecutable->getDebugInfo());
- }
-
- return (defaultVertexExecutable && defaultPixelExecutable &&
- (!usesGeometryShader(GL_POINTS) || pointGS));
-}
-
-gl::LinkResult ProgramD3D::compileComputeExecutable(const gl::Context *context,
- gl::InfoLog &infoLog)
-{
- // Ensure the compiler is initialized to avoid race conditions.
- ANGLE_TRY(mRenderer->ensureHLSLCompilerInitialized());
-
- std::string computeShader = mDynamicHLSL->generateComputeShaderLinkHLSL(context, mState);
-
- ShaderExecutableD3D *computeExecutable = nullptr;
- ANGLE_TRY(mRenderer->compileToExecutable(infoLog, computeShader, gl::SHADER_COMPUTE,
- std::vector<D3DVarying>(), false,
- angle::CompilerWorkaroundsD3D(), &computeExecutable));
-
- if (computeExecutable == nullptr)
- {
- ERR() << "Error compiling dynamic compute executable:" << std::endl
- << infoLog.str() << std::endl;
- }
- else
- {
- const ShaderD3D *computeShaderD3D = GetImplAs<ShaderD3D>(mState.getAttachedComputeShader());
- computeShaderD3D->appendDebugInfo(computeExecutable->getDebugInfo());
- mComputeExecutable.reset(computeExecutable);
- }
-
- return mComputeExecutable.get() != nullptr;
-}
-
-gl::LinkResult ProgramD3D::link(const gl::Context *context,
- const gl::ProgramLinkedResources &resources,
- gl::InfoLog &infoLog)
-{
- const auto &data = context->getContextState();
-
- reset();
-
- gl::Shader *computeShader = mState.getAttachedComputeShader();
- if (computeShader)
- {
- mSamplersCS.resize(data.getCaps().maxComputeTextureImageUnits);
-
- defineUniformsAndAssignRegisters(context);
-
- gl::LinkResult result = compileComputeExecutable(context, infoLog);
- if (result.isError())
- {
- infoLog << result.getError().getMessage();
- return result;
- }
- else if (!result.getResult())
- {
- infoLog << "Failed to create D3D compute shader.";
- return result;
- }
- }
- else
- {
- gl::Shader *vertexShader = mState.getAttachedVertexShader();
- gl::Shader *fragmentShader = mState.getAttachedFragmentShader();
-
- const ShaderD3D *vertexShaderD3D = GetImplAs<ShaderD3D>(vertexShader);
- const ShaderD3D *fragmentShaderD3D = GetImplAs<ShaderD3D>(fragmentShader);
-
- mSamplersVS.resize(data.getCaps().maxVertexTextureImageUnits);
- mSamplersPS.resize(data.getCaps().maxTextureImageUnits);
-
- vertexShaderD3D->generateWorkarounds(&mVertexWorkarounds);
- fragmentShaderD3D->generateWorkarounds(&mPixelWorkarounds);
-
- if (mRenderer->getNativeLimitations().noFrontFacingSupport)
- {
- if (fragmentShaderD3D->usesFrontFacing())
- {
- infoLog << "The current renderer doesn't support gl_FrontFacing";
- return false;
- }
- }
-
- // TODO(jmadill): Implement more sophisticated component packing in D3D9.
- // We can fail here because we use one semantic per GLSL varying. D3D11 can pack varyings
- // intelligently, but D3D9 assumes one semantic per register.
- if (mRenderer->getRendererClass() == RENDERER_D3D9 &&
- resources.varyingPacking.getMaxSemanticIndex() > data.getCaps().maxVaryingVectors)
- {
- infoLog << "Cannot pack these varyings on D3D9.";
- return false;
- }
-
- ProgramD3DMetadata metadata(mRenderer, vertexShaderD3D, fragmentShaderD3D);
- BuiltinVaryingsD3D builtins(metadata, resources.varyingPacking);
-
- mDynamicHLSL->generateShaderLinkHLSL(context, mState, metadata, resources.varyingPacking,
- builtins, &mPixelHLSL, &mVertexHLSL);
-
- mUsesPointSize = vertexShaderD3D->usesPointSize();
- mDynamicHLSL->getPixelShaderOutputKey(data, mState, metadata, &mPixelShaderKey);
- mUsesFragDepth = metadata.usesFragDepth();
- mUsesViewID = metadata.usesViewID();
- mHasANGLEMultiviewEnabled = metadata.hasANGLEMultiviewEnabled();
-
- // Cache if we use flat shading
- mUsesFlatInterpolation =
- (FindFlatInterpolationVarying(fragmentShader->getInputVaryings(context)) ||
- FindFlatInterpolationVarying(vertexShader->getOutputVaryings(context)));
-
- if (mRenderer->getMajorShaderModel() >= 4)
- {
- mGeometryShaderPreamble = mDynamicHLSL->generateGeometryShaderPreamble(
- resources.varyingPacking, builtins, mHasANGLEMultiviewEnabled,
- metadata.canSelectViewInVertexShader());
- }
-
- initAttribLocationsToD3DSemantic(context);
-
- defineUniformsAndAssignRegisters(context);
-
- gatherTransformFeedbackVaryings(resources.varyingPacking, builtins[gl::SHADER_VERTEX]);
-
- gl::LinkResult result = compileProgramExecutables(context, infoLog);
- if (result.isError())
- {
- infoLog << result.getError().getMessage();
- return result;
- }
- else if (!result.getResult())
- {
- infoLog << "Failed to create D3D shaders.";
- return result;
- }
- }
-
- linkResources(context, resources);
-
- return true;
-}
-
-GLboolean ProgramD3D::validate(const gl::Caps & /*caps*/, gl::InfoLog * /*infoLog*/)
-{
- // TODO(jmadill): Do something useful here?
- return GL_TRUE;
-}
-
-void ProgramD3D::initializeUniformBlocks()
-{
- if (mState.getUniformBlocks().empty())
- {
- return;
- }
-
- ASSERT(mD3DUniformBlocks.empty());
-
- // Assign registers and update sizes.
- const ShaderD3D *vertexShaderD3D = SafeGetImplAs<ShaderD3D>(mState.getAttachedVertexShader());
- const ShaderD3D *fragmentShaderD3D =
- SafeGetImplAs<ShaderD3D>(mState.getAttachedFragmentShader());
- const ShaderD3D *computeShaderD3D = SafeGetImplAs<ShaderD3D>(mState.getAttachedComputeShader());
-
- for (const gl::InterfaceBlock &uniformBlock : mState.getUniformBlocks())
- {
- unsigned int uniformBlockElement = uniformBlock.isArray ? uniformBlock.arrayElement : 0;
-
- D3DUniformBlock d3dUniformBlock;
-
- if (uniformBlock.vertexStaticUse)
- {
- ASSERT(vertexShaderD3D != nullptr);
- unsigned int baseRegister = vertexShaderD3D->getUniformBlockRegister(uniformBlock.name);
- d3dUniformBlock.vsRegisterIndex = baseRegister + uniformBlockElement;
- }
-
- if (uniformBlock.fragmentStaticUse)
- {
- ASSERT(fragmentShaderD3D != nullptr);
- unsigned int baseRegister =
- fragmentShaderD3D->getUniformBlockRegister(uniformBlock.name);
- d3dUniformBlock.psRegisterIndex = baseRegister + uniformBlockElement;
- }
-
- if (uniformBlock.computeStaticUse)
- {
- ASSERT(computeShaderD3D != nullptr);
- unsigned int baseRegister =
- computeShaderD3D->getUniformBlockRegister(uniformBlock.name);
- d3dUniformBlock.csRegisterIndex = baseRegister + uniformBlockElement;
- }
-
- mD3DUniformBlocks.push_back(d3dUniformBlock);
- }
-}
-
-void ProgramD3D::initializeUniformStorage()
-{
- // Compute total default block size
- unsigned int vertexRegisters = 0;
- unsigned int fragmentRegisters = 0;
- unsigned int computeRegisters = 0;
- for (const D3DUniform *d3dUniform : mD3DUniforms)
- {
- if (!d3dUniform->isSampler())
- {
- if (d3dUniform->isReferencedByVertexShader())
- {
- vertexRegisters = std::max(vertexRegisters,
- d3dUniform->vsRegisterIndex + d3dUniform->registerCount);
- }
- if (d3dUniform->isReferencedByFragmentShader())
- {
- fragmentRegisters = std::max(
- fragmentRegisters, d3dUniform->psRegisterIndex + d3dUniform->registerCount);
- }
- if (d3dUniform->isReferencedByComputeShader())
- {
- computeRegisters = std::max(
- computeRegisters, d3dUniform->csRegisterIndex + d3dUniform->registerCount);
- }
- }
- }
-
- mVertexUniformStorage =
- std::unique_ptr<UniformStorageD3D>(mRenderer->createUniformStorage(vertexRegisters * 16u));
- mFragmentUniformStorage = std::unique_ptr<UniformStorageD3D>(
- mRenderer->createUniformStorage(fragmentRegisters * 16u));
- mComputeUniformStorage =
- std::unique_ptr<UniformStorageD3D>(mRenderer->createUniformStorage(computeRegisters * 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;
- }
-
- if (d3dUniform->isReferencedByVertexShader())
- {
- d3dUniform->vsData = mVertexUniformStorage->getDataPointer(d3dUniform->vsRegisterIndex,
- d3dUniform->registerElement);
- }
-
- if (d3dUniform->isReferencedByFragmentShader())
- {
- d3dUniform->psData = mFragmentUniformStorage->getDataPointer(
- d3dUniform->psRegisterIndex, d3dUniform->registerElement);
- }
-
- if (d3dUniform->isReferencedByComputeShader())
- {
- d3dUniform->csData = mComputeUniformStorage->getDataPointer(
- d3dUniform->csRegisterIndex, d3dUniform->registerElement);
- }
- }
-}
-
-void ProgramD3D::updateUniformBufferCache(const gl::Caps &caps,
- unsigned int reservedVertex,
- unsigned int reservedFragment)
-{
- if (mState.getUniformBlocks().empty())
- {
- return;
- }
-
- mVertexUBOCache.clear();
- mFragmentUBOCache.clear();
-
- for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < mD3DUniformBlocks.size();
- uniformBlockIndex++)
- {
- const D3DUniformBlock &uniformBlock = mD3DUniformBlocks[uniformBlockIndex];
- GLuint blockBinding = mState.getUniformBlockBinding(uniformBlockIndex);
-
- // Unnecessary to apply an unreferenced standard or shared UBO
- if (!uniformBlock.vertexStaticUse() && !uniformBlock.fragmentStaticUse())
- {
- continue;
- }
-
- if (uniformBlock.vertexStaticUse())
- {
- unsigned int registerIndex = uniformBlock.vsRegisterIndex - reservedVertex;
- ASSERT(registerIndex < caps.maxVertexUniformBlocks);
-
- if (mVertexUBOCache.size() <= registerIndex)
- {
- mVertexUBOCache.resize(registerIndex + 1, -1);
- }
-
- ASSERT(mVertexUBOCache[registerIndex] == -1);
- mVertexUBOCache[registerIndex] = blockBinding;
- }
-
- if (uniformBlock.fragmentStaticUse())
- {
- unsigned int registerIndex = uniformBlock.psRegisterIndex - reservedFragment;
- ASSERT(registerIndex < caps.maxFragmentUniformBlocks);
-
- if (mFragmentUBOCache.size() <= registerIndex)
- {
- mFragmentUBOCache.resize(registerIndex + 1, -1);
- }
-
- ASSERT(mFragmentUBOCache[registerIndex] == -1);
- mFragmentUBOCache[registerIndex] = blockBinding;
- }
- }
-}
-
-const std::vector<GLint> &ProgramD3D::getVertexUniformBufferCache() const
-{
- return mVertexUBOCache;
-}
-
-const std::vector<GLint> &ProgramD3D::getFragmentUniformBufferCache() const
-{
- return mFragmentUBOCache;
-}
-
-void ProgramD3D::dirtyAllUniforms()
-{
- mVertexUniformsDirty = true;
- mFragmentUniformsDirty = true;
- mComputeUniformsDirty = true;
-}
-
-void ProgramD3D::markUniformsClean()
-{
- mVertexUniformsDirty = false;
- mFragmentUniformsDirty = false;
- mComputeUniformsDirty = false;
-}
-
-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, GL_FLOAT_MAT2);
-}
-
-void ProgramD3D::setUniformMatrix3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- setUniformMatrixfvInternal<3, 3>(location, count, transpose, value, GL_FLOAT_MAT3);
-}
-
-void ProgramD3D::setUniformMatrix4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- setUniformMatrixfvInternal<4, 4>(location, count, transpose, value, GL_FLOAT_MAT4);
-}
-
-void ProgramD3D::setUniformMatrix2x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- setUniformMatrixfvInternal<2, 3>(location, count, transpose, value, GL_FLOAT_MAT2x3);
-}
-
-void ProgramD3D::setUniformMatrix3x2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- setUniformMatrixfvInternal<3, 2>(location, count, transpose, value, GL_FLOAT_MAT3x2);
-}
-
-void ProgramD3D::setUniformMatrix2x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- setUniformMatrixfvInternal<2, 4>(location, count, transpose, value, GL_FLOAT_MAT2x4);
-}
-
-void ProgramD3D::setUniformMatrix4x2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- setUniformMatrixfvInternal<4, 2>(location, count, transpose, value, GL_FLOAT_MAT4x2);
-}
-
-void ProgramD3D::setUniformMatrix3x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- setUniformMatrixfvInternal<3, 4>(location, count, transpose, value, GL_FLOAT_MAT3x4);
-}
-
-void ProgramD3D::setUniformMatrix4x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- setUniformMatrixfvInternal<4, 3>(location, count, transpose, value, GL_FLOAT_MAT4x3);
-}
-
-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::setUniformBlockBinding(GLuint /*uniformBlockIndex*/,
- GLuint /*uniformBlockBinding*/)
-{
-}
-
-void ProgramD3D::defineUniformsAndAssignRegisters(const gl::Context *context)
-{
- D3DUniformMap uniformMap;
- gl::Shader *computeShader = mState.getAttachedComputeShader();
- if (computeShader)
- {
- for (const sh::Uniform &computeUniform : computeShader->getUniforms(context))
- {
- if (computeUniform.staticUse)
- {
- defineUniformBase(computeShader, computeUniform, &uniformMap);
- }
- }
- }
- else
- {
- gl::Shader *vertexShader = mState.getAttachedVertexShader();
- for (const sh::Uniform &vertexUniform : vertexShader->getUniforms(context))
- {
- if (vertexUniform.staticUse)
- {
- defineUniformBase(vertexShader, vertexUniform, &uniformMap);
- }
- }
-
- gl::Shader *fragmentShader = mState.getAttachedFragmentShader();
- for (const sh::Uniform &fragmentUniform : fragmentShader->getUniforms(context))
- {
- if (fragmentUniform.staticUse)
- {
- defineUniformBase(fragmentShader, fragmentUniform, &uniformMap);
- }
- }
- }
-
- // 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();
- initializeUniformStorage();
-}
-
-void ProgramD3D::defineUniformBase(const gl::Shader *shader,
- const sh::Uniform &uniform,
- D3DUniformMap *uniformMap)
-{
- // Samplers get their registers assigned in assignAllSamplerRegisters.
- if (uniform.isBuiltIn() || gl::IsSamplerType(uniform.type))
- {
- defineUniform(shader->getType(), uniform, uniform.name, nullptr, uniformMap);
- 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);
-
- defineUniform(shader->getType(), uniform, uniform.name, &encoder, uniformMap);
-}
-
-D3DUniform *ProgramD3D::getD3DUniformByName(const std::string &name)
-{
- for (D3DUniform *d3dUniform : mD3DUniforms)
- {
- if (d3dUniform->name == name)
- {
- return d3dUniform;
- }
- }
-
- return nullptr;
-}
-
-void ProgramD3D::defineStructUniformFields(GLenum shaderType,
- const std::vector<sh::ShaderVariable> &fields,
- const std::string &namePrefix,
- sh::HLSLBlockEncoder *encoder,
- D3DUniformMap *uniformMap)
-{
- if (encoder)
- encoder->enterAggregateType();
-
- for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
- {
- const sh::ShaderVariable &field = fields[fieldIndex];
- const std::string &fieldFullName = (namePrefix + "." + field.name);
-
- // Samplers get their registers assigned in assignAllSamplerRegisters.
- // Also they couldn't use the same encoder as the rest of the struct, since they are
- // extracted out of the struct by the shader translator.
- if (gl::IsSamplerType(field.type))
- {
- defineUniform(shaderType, field, fieldFullName, nullptr, uniformMap);
- }
- else
- {
- defineUniform(shaderType, field, fieldFullName, encoder, uniformMap);
- }
- }
-
- if (encoder)
- encoder->exitAggregateType();
-}
-
-void ProgramD3D::defineArrayOfStructsUniformFields(GLenum shaderType,
- const sh::ShaderVariable &uniform,
- unsigned int arrayNestingIndex,
- const std::string &prefix,
- sh::HLSLBlockEncoder *encoder,
- D3DUniformMap *uniformMap)
-{
- // Nested arrays are processed starting from outermost (arrayNestingIndex 0u) and ending at the
- // innermost.
- const unsigned int currentArraySize = uniform.getNestedArraySize(arrayNestingIndex);
- for (unsigned int arrayElement = 0u; arrayElement < currentArraySize; ++arrayElement)
- {
- const std::string &elementString = prefix + ArrayString(arrayElement);
- if (arrayNestingIndex + 1u < uniform.arraySizes.size())
- {
- defineArrayOfStructsUniformFields(shaderType, uniform, arrayNestingIndex + 1u,
- elementString, encoder, uniformMap);
- }
- else
- {
- defineStructUniformFields(shaderType, uniform.fields, elementString, encoder,
- uniformMap);
- }
- }
-}
-
-void ProgramD3D::defineArrayUniformElements(GLenum shaderType,
- const sh::ShaderVariable &uniform,
- const std::string &fullName,
- sh::HLSLBlockEncoder *encoder,
- D3DUniformMap *uniformMap)
-{
- if (encoder)
- encoder->enterAggregateType();
-
- sh::ShaderVariable uniformElement = uniform;
- uniformElement.arraySizes.pop_back();
- for (unsigned int arrayIndex = 0u; arrayIndex < uniform.getOutermostArraySize(); ++arrayIndex)
- {
- std::string elementFullName = fullName + ArrayString(arrayIndex);
- defineUniform(shaderType, uniformElement, elementFullName, encoder, uniformMap);
- }
-
- if (encoder)
- encoder->exitAggregateType();
-}
-
-void ProgramD3D::defineUniform(GLenum shaderType,
- const sh::ShaderVariable &uniform,
- const std::string &fullName,
- sh::HLSLBlockEncoder *encoder,
- D3DUniformMap *uniformMap)
-{
- if (uniform.isStruct())
- {
- if (uniform.isArray())
- {
- defineArrayOfStructsUniformFields(shaderType, uniform, 0u, fullName, encoder,
- uniformMap);
- }
- else
- {
- defineStructUniformFields(shaderType, uniform.fields, fullName, encoder, uniformMap);
- }
- return;
- }
- if (uniform.isArrayOfArrays())
- {
- defineArrayUniformElements(shaderType, uniform, fullName, encoder, uniformMap);
- return;
- }
-
- // Not a struct. Arrays are treated as aggregate types.
- if (uniform.isArray() && encoder)
- {
- encoder->enterAggregateType();
- }
-
- // Advance the uniform offset, to track registers allocation for structs
- sh::BlockMemberInfo blockInfo =
- encoder ? encoder->encodeType(uniform.type, uniform.arraySizes, false)
- : sh::BlockMemberInfo::getDefaultBlockInfo();
-
- auto uniformMapEntry = uniformMap->find(fullName);
- D3DUniform *d3dUniform = nullptr;
-
- if (uniformMapEntry != uniformMap->end())
- {
- d3dUniform = uniformMapEntry->second;
- }
- else
- {
- d3dUniform = new D3DUniform(uniform.type, fullName, uniform.arraySizes, true);
- (*uniformMap)[fullName] = d3dUniform;
- }
-
- if (encoder)
- {
- d3dUniform->registerElement =
- static_cast<unsigned int>(sh::HLSLBlockEncoder::getBlockRegisterElement(blockInfo));
- unsigned int reg =
- static_cast<unsigned int>(sh::HLSLBlockEncoder::getBlockRegister(blockInfo));
- if (shaderType == GL_FRAGMENT_SHADER)
- {
- d3dUniform->psRegisterIndex = reg;
- }
- else if (shaderType == GL_VERTEX_SHADER)
- {
- d3dUniform->vsRegisterIndex = reg;
- }
- else
- {
- ASSERT(shaderType == GL_COMPUTE_SHADER);
- d3dUniform->csRegisterIndex = reg;
- }
-
- // Arrays are treated as aggregate types
- if (uniform.isArray())
- {
- encoder->exitAggregateType();
- }
- }
-}
-
-// 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;
- }
-
- if (targetUniform->vsData)
- {
- setUniformImpl(locationInfo, count, v, targetUniform->vsData, uniformType);
- mVertexUniformsDirty = true;
- }
-
- if (targetUniform->psData)
- {
- setUniformImpl(locationInfo, count, v, targetUniform->psData, uniformType);
- mFragmentUniformsDirty = true;
- }
-
- if (targetUniform->csData)
- {
- setUniformImpl(locationInfo, count, v, targetUniform->csData, uniformType);
- mComputeUniformsDirty = true;
- }
-}
-
-template <int cols, int rows>
-bool ProgramD3D::setUniformMatrixfvImpl(GLint location,
- GLsizei countIn,
- GLboolean transpose,
- const GLfloat *value,
- uint8_t *targetData,
- GLenum targetUniformType)
-{
- D3DUniform *targetUniform = getD3DUniformFromLocation(location);
-
- unsigned int elementCount = targetUniform->getArraySizeProduct();
- unsigned int arrayElementOffset = mState.getUniformLocations()[location].arrayIndex;
- unsigned int count =
- std::min(elementCount - arrayElementOffset, static_cast<unsigned int>(countIn));
-
- const unsigned int targetMatrixStride = (4 * rows);
- GLfloat *target = reinterpret_cast<GLfloat *>(
- targetData + arrayElementOffset * sizeof(GLfloat) * targetMatrixStride);
-
- bool dirty = false;
-
- for (unsigned int i = 0; i < count; i++)
- {
- // Internally store matrices as transposed versions to accomodate HLSL matrix indexing
- if (transpose == GL_FALSE)
- {
- dirty = TransposeExpandMatrix<GLfloat, cols, rows>(target, value) || dirty;
- }
- else
- {
- dirty = ExpandMatrix<GLfloat, cols, rows>(target, value) || dirty;
- }
- target += targetMatrixStride;
- value += cols * rows;
- }
-
- return dirty;
-}
-
-template <int cols, int rows>
-void ProgramD3D::setUniformMatrixfvInternal(GLint location,
- GLsizei countIn,
- GLboolean transpose,
- const GLfloat *value,
- GLenum targetUniformType)
-{
- D3DUniform *targetUniform = getD3DUniformFromLocation(location);
-
- if (targetUniform->vsData)
- {
- if (setUniformMatrixfvImpl<cols, rows>(location, countIn, transpose, value,
- targetUniform->vsData, targetUniformType))
- {
- mVertexUniformsDirty = true;
- }
- }
-
- if (targetUniform->psData)
- {
- if (setUniformMatrixfvImpl<cols, rows>(location, countIn, transpose, value,
- targetUniform->psData, targetUniformType))
- {
- mFragmentUniformsDirty = true;
- }
- }
-
- if (targetUniform->csData)
- {
- if (setUniformMatrixfvImpl<cols, rows>(location, countIn, transpose, value,
- targetUniform->csData, targetUniformType))
- {
- mComputeUniformsDirty = true;
- }
- }
-}
-
-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].flattenedOffsetInParentArrays *
- d3dUniform->getArraySizeProduct();
-
- const gl::Shader *computeShader = mState.getAttachedComputeShader();
- if (computeShader)
- {
- const ShaderD3D *computeShaderD3D = GetImplAs<ShaderD3D>(mState.getAttachedComputeShader());
- ASSERT(computeShaderD3D->hasUniform(baseName));
- d3dUniform->csRegisterIndex =
- computeShaderD3D->getUniformRegister(baseName) + registerOffset;
- ASSERT(d3dUniform->csRegisterIndex != GL_INVALID_INDEX);
- AssignSamplers(d3dUniform->csRegisterIndex, d3dUniform->typeInfo,
- d3dUniform->getArraySizeProduct(), mSamplersCS, &mUsedComputeSamplerRange);
- }
- else
- {
- const ShaderD3D *vertexShaderD3D = GetImplAs<ShaderD3D>(mState.getAttachedVertexShader());
- const ShaderD3D *fragmentShaderD3D =
- GetImplAs<ShaderD3D>(mState.getAttachedFragmentShader());
- ASSERT(vertexShaderD3D->hasUniform(baseName) || fragmentShaderD3D->hasUniform(baseName));
- if (vertexShaderD3D->hasUniform(baseName))
- {
- d3dUniform->vsRegisterIndex =
- vertexShaderD3D->getUniformRegister(baseName) + registerOffset;
- ASSERT(d3dUniform->vsRegisterIndex != GL_INVALID_INDEX);
- AssignSamplers(d3dUniform->vsRegisterIndex, d3dUniform->typeInfo,
- d3dUniform->getArraySizeProduct(), mSamplersVS,
- &mUsedVertexSamplerRange);
- }
- if (fragmentShaderD3D->hasUniform(baseName))
- {
- d3dUniform->psRegisterIndex =
- fragmentShaderD3D->getUniformRegister(baseName) + registerOffset;
- ASSERT(d3dUniform->psRegisterIndex != GL_INVALID_INDEX);
- AssignSamplers(d3dUniform->psRegisterIndex, d3dUniform->typeInfo,
- d3dUniform->getArraySizeProduct(), mSamplersPS, &mUsedPixelSamplerRange);
- }
- }
-}
-
-// static
-void ProgramD3D::AssignSamplers(unsigned int startSamplerIndex,
- const gl::UniformTypeInfo &typeInfo,
- unsigned int samplerCount,
- std::vector<Sampler> &outSamplers,
- GLuint *outUsedRange)
-{
- unsigned int samplerIndex = startSamplerIndex;
-
- do
- {
- ASSERT(samplerIndex < outSamplers.size());
- Sampler *sampler = &outSamplers[samplerIndex];
- sampler->active = true;
- sampler->textureType = typeInfo.samplerTextureType;
- sampler->logicalTextureUnit = 0;
- *outUsedRange = std::max(samplerIndex + 1, *outUsedRange);
- samplerIndex++;
- } while (samplerIndex < startSamplerIndex + samplerCount);
-}
-
-void ProgramD3D::reset()
-{
- mVertexExecutables.clear();
- mPixelExecutables.clear();
-
- for (auto &geometryExecutable : mGeometryExecutables)
- {
- geometryExecutable.reset(nullptr);
- }
-
- mComputeExecutable.reset(nullptr);
-
- mVertexHLSL.clear();
- mVertexWorkarounds = angle::CompilerWorkaroundsD3D();
-
- mPixelHLSL.clear();
- mPixelWorkarounds = angle::CompilerWorkaroundsD3D();
- mUsesFragDepth = false;
- mHasANGLEMultiviewEnabled = false;
- mUsesViewID = false;
- mPixelShaderKey.clear();
- mUsesPointSize = false;
- mUsesFlatInterpolation = false;
-
- SafeDeleteContainer(mD3DUniforms);
- mD3DUniformBlocks.clear();
-
- mVertexUniformStorage.reset(nullptr);
- mFragmentUniformStorage.reset(nullptr);
- mComputeUniformStorage.reset(nullptr);
-
- mSamplersPS.clear();
- mSamplersVS.clear();
- mSamplersCS.clear();
-
- mUsedVertexSamplerRange = 0;
- mUsedPixelSamplerRange = 0;
- mUsedComputeSamplerRange = 0;
- mDirtySamplerMapping = true;
-
- mAttribLocationToD3DSemantic.fill(-1);
-
- mStreamOutVaryings.clear();
-
- mGeometryShaderPreamble.clear();
-
- dirtyAllUniforms();
-
- mCachedPixelExecutableIndex.reset();
- mCachedVertexExecutableIndex.reset();
-}
-
-unsigned int ProgramD3D::getSerial() const
-{
- return mSerial;
-}
-
-unsigned int ProgramD3D::issueSerial()
-{
- return mCurrentSerial++;
-}
-
-void ProgramD3D::initAttribLocationsToD3DSemantic(const gl::Context *context)
-{
- gl::Shader *vertexShader = mState.getAttachedVertexShader();
- ASSERT(vertexShader != nullptr);
-
- // Init semantic index
- int semanticIndex = 0;
- for (const sh::Attribute &attribute : vertexShader->getActiveAttributes(context))
- {
- 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, gl::VERTEX_FORMAT_INVALID);
- }
- mCachedInputLayout[d3dSemantic] =
- GetVertexFormatType(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();
- mPixelShaderOutputLayoutCache.push_back(binding);
- }
- else
- {
- mPixelShaderOutputLayoutCache.push_back(GL_NONE);
- }
- }
-
- updateCachedPixelExecutableIndex();
-}
-
-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.push_back(D3DVarying(builtins.glPosition.semantic,
- builtins.glPosition.index, 4, outputSlot));
- }
- }
- else if (tfVaryingName == "gl_FragCoord")
- {
- if (builtins.glFragCoord.enabled)
- {
- mStreamOutVaryings.push_back(D3DVarying(builtins.glFragCoord.semantic,
- builtins.glFragCoord.index, 4, outputSlot));
- }
- }
- else if (tfVaryingName == "gl_PointSize")
- {
- if (builtins.glPointSize.enabled)
- {
- mStreamOutVaryings.push_back(D3DVarying("PSIZE", 0, 1, outputSlot));
- }
- }
- else
- {
- std::vector<unsigned int> subscripts;
- std::string baseName = gl::ParseResourceName(tfVaryingName, &subscripts);
- size_t subscript = GL_INVALID_INDEX;
- if (!subscripts.empty())
- {
- subscript = subscripts.back();
- }
- for (const auto &registerInfo : varyingPacking.getRegisterList())
- {
- const auto &varying = *registerInfo.packedVarying->varying;
- GLenum transposedType = gl::TransposeMatrixType(varying.type);
- int componentCount = gl::VariableColumnCount(transposedType);
- ASSERT(!varying.isBuiltIn());
-
- // Transform feedback for varying structs is underspecified.
- // See Khronos bug 9856.
- // TODO(jmadill): Figure out how to be spec-compliant here.
- if (registerInfo.packedVarying->isStructField() || varying.isStruct())
- continue;
-
- // There can be more than one register assigned to a particular varying, and each
- // register needs its own stream out entry.
- if (baseName == registerInfo.packedVarying->varying->name &&
- (subscript == GL_INVALID_INDEX || subscript == registerInfo.varyingArrayIndex))
- {
- mStreamOutVaryings.push_back(D3DVarying(
- varyingSemantic, registerInfo.semanticIndex, 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(GLenum drawMode)
-{
- if (!usesGeometryShader(drawMode))
- {
- // No shader necessary mean we have the required (null) executable.
- return true;
- }
-
- gl::PrimitiveType geometryShaderType = GetGeometryShaderTypeFromDrawMode(drawMode);
- return mGeometryExecutables[geometryShaderType].get() != nullptr;
-}
-
-bool ProgramD3D::hasPixelExecutableForCachedOutputLayout()
-{
- return mCachedPixelExecutableIndex.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(gl::VariableColumnCount(uniform.type), gl::VariableRowCount(uniform.type),
- dataOut, reinterpret_cast<const DestT *>(srcPointer));
- }
- 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::linkResources(const gl::Context *context,
- const gl::ProgramLinkedResources &resources)
-{
- UniformBlockInfo uniformBlockInfo;
-
- if (mState.getAttachedVertexShader())
- {
- uniformBlockInfo.getShaderBlockInfo(context, mState.getAttachedVertexShader());
- }
-
- if (mState.getAttachedFragmentShader())
- {
- uniformBlockInfo.getShaderBlockInfo(context, mState.getAttachedFragmentShader());
- }
-
- if (mState.getAttachedComputeShader())
- {
- uniformBlockInfo.getShaderBlockInfo(context, mState.getAttachedComputeShader());
- }
-
- // Gather interface block info.
- 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);
- };
-
- resources.uniformBlockLinker.linkBlocks(getUniformBlockSize, getUniformBlockMemberInfo);
- initializeUniformBlocks();
-
- // TODO(jiajia.qin@intel.com): Determine correct shader storage block info.
- auto getShaderStorageBlockSize = [](const std::string &name, const std::string &mappedName,
- size_t *sizeOut) {
- *sizeOut = 0;
- return true;
- };
-
- auto getShaderStorageBlockMemberInfo =
- [](const std::string &name, const std::string &mappedName, sh::BlockMemberInfo *infoOut) {
- *infoOut = sh::BlockMemberInfo::getDefaultBlockInfo();
- return true;
- };
-
- resources.shaderStorageBlockLinker.linkBlocks(getShaderStorageBlockSize,
- getShaderStorageBlockMemberInfo);
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ProgramD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/ProgramD3D.h
deleted file mode 100644
index 829757a73e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ProgramD3D.h
+++ /dev/null
@@ -1,523 +0,0 @@
-//
-// 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 "platform/WorkaroundsD3D.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
-
-// 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,
- const std::string &nameIn,
- const std::vector<unsigned int> &arraySizesIn,
- bool defaultBlock);
- ~D3DUniform();
-
- bool isSampler() const;
-
- bool isArray() const { return !arraySizes.empty(); }
- unsigned int getArraySizeProduct() const;
-
- bool isReferencedByVertexShader() const;
- bool isReferencedByFragmentShader() const;
- bool isReferencedByComputeShader() 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.
- uint8_t *vsData;
- uint8_t *psData;
- uint8_t *csData;
-
- // Register information.
- unsigned int vsRegisterIndex;
- unsigned int psRegisterIndex;
- unsigned int csRegisterIndex;
- 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 D3DUniformBlock
-{
- D3DUniformBlock()
- : vsRegisterIndex(GL_INVALID_INDEX),
- psRegisterIndex(GL_INVALID_INDEX),
- csRegisterIndex(GL_INVALID_INDEX)
- {
- }
-
- bool vertexStaticUse() const { return vsRegisterIndex != GL_INVALID_INDEX; }
-
- bool fragmentStaticUse() const { return psRegisterIndex != GL_INVALID_INDEX; }
-
- bool computeStaticUse() const { return csRegisterIndex != GL_INVALID_INDEX; }
-
- unsigned int vsRegisterIndex;
- unsigned int psRegisterIndex;
- unsigned int csRegisterIndex;
-};
-
-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 ShaderD3D *vertexShader,
- const ShaderD3D *fragmentShader);
-
- int getRendererMajorShaderModel() const;
- bool usesBroadcast(const gl::ContextState &data) const;
- bool usesFragDepth() const;
- bool usesPointCoord() const;
- bool usesFragCoord() const;
- bool usesPointSize() const;
- bool usesInsertedPointCoordValue() const;
- bool usesViewScale() const;
- bool hasANGLEMultiviewEnabled() 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 mHasANGLEMultiviewEnabled;
- const bool mUsesViewID;
- const bool mCanSelectViewInVertexShader;
- const ShaderD3D *mVertexShader;
- const ShaderD3D *mFragmentShader;
-};
-
-class ProgramD3D : public ProgramImpl
-{
- public:
- ProgramD3D(const gl::ProgramState &data, RendererD3D *renderer);
- ~ProgramD3D() override;
-
- const std::vector<PixelShaderOutputVariable> &getPixelShaderKey() { return mPixelShaderKey; }
-
- GLint getSamplerMapping(gl::SamplerType type,
- unsigned int samplerIndex,
- const gl::Caps &caps) const;
- GLenum getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const;
- GLuint getUsedSamplerRange(gl::SamplerType type) const;
-
- enum SamplerMapping
- {
- WasDirty,
- WasClean,
- };
-
- SamplerMapping updateSamplerMapping();
-
- bool usesPointSize() const { return mUsesPointSize; }
- bool usesPointSpriteEmulation() const;
- bool usesGeometryShader(GLenum drawMode) const;
- bool usesGeometryShaderForPointSpriteEmulation() const;
- bool usesInstancedPointSpriteEmulation() const;
-
- gl::LinkResult load(const gl::Context *context,
- gl::InfoLog &infoLog,
- gl::BinaryInputStream *stream) override;
- void save(const gl::Context *context, gl::BinaryOutputStream *stream) override;
- void setBinaryRetrievableHint(bool retrievable) override;
- void setSeparable(bool separable) override;
-
- gl::Error getVertexExecutableForCachedInputLayout(ShaderExecutableD3D **outExectuable,
- gl::InfoLog *infoLog);
- gl::Error getGeometryExecutableForPrimitiveType(const gl::Context *context,
- GLenum drawMode,
- ShaderExecutableD3D **outExecutable,
- gl::InfoLog *infoLog);
- gl::Error getPixelExecutableForCachedOutputLayout(ShaderExecutableD3D **outExectuable,
- gl::InfoLog *infoLog);
- gl::Error getComputeExecutable(ShaderExecutableD3D **outExecutable);
- gl::LinkResult 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 initializeUniformStorage();
- void updateUniformBufferCache(const gl::Caps &caps,
- unsigned int reservedVertex,
- unsigned int reservedFragment);
- const std::vector<GLint> &getVertexUniformBufferCache() const;
- const std::vector<GLint> &getFragmentUniformBufferCache() 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;
-
- void setUniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformBlockBinding) override;
-
- UniformStorageD3D &getVertexUniformStorage() const { return *mVertexUniformStorage.get(); }
- UniformStorageD3D &getFragmentUniformStorage() const { return *mFragmentUniformStorage.get(); }
- UniformStorageD3D &getComputeUniformStorage() const { return *mComputeUniformStorage.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);
-
- bool isSamplerMappingDirty() { return mDirtySamplerMapping; }
-
- // Checks if we need to recompile certain shaders.
- bool hasVertexExecutableForCachedInputLayout();
- bool hasGeometryExecutableForPrimitiveType(GLenum drawMode);
- bool hasPixelExecutableForCachedOutputLayout();
-
- bool areVertexUniformsDirty() const { return mVertexUniformsDirty; }
- bool areFragmentUniformsDirty() const { return mFragmentUniformsDirty; }
- bool areComputeUniformsDirty() const { return mComputeUniformsDirty; }
- const std::vector<D3DUniform *> &getD3DUniforms() const { return mD3DUniforms; }
- void markUniformsClean();
-
- private:
- // These forward-declared tasks are used for multi-thread shader compiles.
- class GetExecutableTask;
- class GetVertexExecutableTask;
- class GetPixelExecutableTask;
- class GetGeometryExecutableTask;
-
- 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;
- };
-
- struct Sampler
- {
- Sampler();
-
- bool active;
- GLint logicalTextureUnit;
- GLenum textureType;
- };
-
- typedef std::map<std::string, D3DUniform *> D3DUniformMap;
-
- void defineUniformsAndAssignRegisters(const gl::Context *context);
- void defineUniformBase(const gl::Shader *shader,
- const sh::Uniform &uniform,
- D3DUniformMap *uniformMap);
- void defineStructUniformFields(GLenum shaderType,
- const std::vector<sh::ShaderVariable> &fields,
- const std::string &namePrefix,
- sh::HLSLBlockEncoder *encoder,
- D3DUniformMap *uniformMap);
- void defineArrayOfStructsUniformFields(GLenum shaderType,
- const sh::ShaderVariable &uniform,
- unsigned int arrayNestingIndex,
- const std::string &prefix,
- sh::HLSLBlockEncoder *encoder,
- D3DUniformMap *uniformMap);
- void defineArrayUniformElements(GLenum shaderType,
- const sh::ShaderVariable &uniform,
- const std::string &fullName,
- sh::HLSLBlockEncoder *encoder,
- D3DUniformMap *uniformMap);
- void defineUniform(GLenum shaderType,
- const sh::ShaderVariable &uniform,
- const std::string &fullName,
- sh::HLSLBlockEncoder *encoder,
- 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,
- GLuint *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>
- bool setUniformMatrixfvImpl(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value,
- uint8_t *targetData,
- GLenum targetUniformType);
-
- template <int cols, int rows>
- void setUniformMatrixfvInternal(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value,
- GLenum targetUniformType);
-
- gl::LinkResult compileProgramExecutables(const gl::Context *context, gl::InfoLog &infoLog);
- gl::LinkResult compileComputeExecutable(const gl::Context *context, gl::InfoLog &infoLog);
-
- void gatherTransformFeedbackVaryings(const gl::VaryingPacking &varyings,
- const BuiltinInfo &builtins);
- D3DUniform *getD3DUniformByName(const std::string &name);
- D3DUniform *getD3DUniformFromLocation(GLint location);
- const D3DUniform *getD3DUniformFromLocation(GLint location) const;
-
- void initAttribLocationsToD3DSemantic(const gl::Context *context);
-
- void reset();
- void initializeUniformBlocks();
-
- void updateCachedInputLayoutFromShader(const gl::Context *context);
- void updateCachedOutputLayoutFromShader();
- void updateCachedVertexExecutableIndex();
- void updateCachedPixelExecutableIndex();
-
- void linkResources(const gl::Context *context, const gl::ProgramLinkedResources &resources);
-
- RendererD3D *mRenderer;
- DynamicHLSL *mDynamicHLSL;
-
- std::vector<std::unique_ptr<VertexExecutable>> mVertexExecutables;
- std::vector<std::unique_ptr<PixelExecutable>> mPixelExecutables;
- std::vector<std::unique_ptr<ShaderExecutableD3D>> mGeometryExecutables;
- std::unique_ptr<ShaderExecutableD3D> mComputeExecutable;
-
- std::string mVertexHLSL;
- angle::CompilerWorkaroundsD3D mVertexWorkarounds;
-
- std::string mPixelHLSL;
- angle::CompilerWorkaroundsD3D mPixelWorkarounds;
- bool mUsesFragDepth;
- bool mHasANGLEMultiviewEnabled;
- 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;
-
- std::unique_ptr<UniformStorageD3D> mVertexUniformStorage;
- std::unique_ptr<UniformStorageD3D> mFragmentUniformStorage;
- std::unique_ptr<UniformStorageD3D> mComputeUniformStorage;
-
- std::vector<Sampler> mSamplersPS;
- std::vector<Sampler> mSamplersVS;
- std::vector<Sampler> mSamplersCS;
- GLuint mUsedVertexSamplerRange;
- GLuint mUsedPixelSamplerRange;
- GLuint mUsedComputeSamplerRange;
- bool mDirtySamplerMapping;
-
- // Cache for pixel shader output layout to save reallocations.
- std::vector<GLenum> mPixelShaderOutputLayoutCache;
- Optional<size_t> mCachedPixelExecutableIndex;
-
- AttribIndexArray mAttribLocationToD3DSemantic;
-
- unsigned int mSerial;
-
- std::vector<GLint> mVertexUBOCache;
- std::vector<GLint> mFragmentUBOCache;
- VertexExecutable::Signature mCachedVertexSignature;
- gl::InputLayout mCachedInputLayout;
- Optional<size_t> mCachedVertexExecutableIndex;
-
- std::vector<D3DVarying> mStreamOutVaryings;
- std::vector<D3DUniform *> mD3DUniforms;
- std::vector<D3DUniformBlock> mD3DUniformBlocks;
-
- bool mVertexUniformsDirty;
- bool mFragmentUniformsDirty;
- bool mComputeUniformsDirty;
-
- static unsigned int issueSerial();
- static unsigned int mCurrentSerial;
-
- Serial mCurrentVertexArrayStateSerial;
-};
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_PROGRAMD3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp
deleted file mode 100644
index 84b30aa106..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// 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;
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderTargetD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderTargetD3D.h
deleted file mode 100644
index fde96133b0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderTargetD3D.h
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// 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/angletypes.h"
-#include "libANGLE/FramebufferAttachment.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);
-
- // Only currently applies to D3D11.
- virtual void signalDirty(const gl::Context *context) {}
-
- private:
- const unsigned int mSerial;
- static unsigned int mCurrentSerial;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_RENDERTARGETD3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp
deleted file mode 100644
index d799e0b992..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-//
-// 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/Image.h"
-#include "libANGLE/renderer/d3d/EGLImageD3D.h"
-#include "libANGLE/renderer/d3d/RendererD3D.h"
-#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
-
-namespace rx
-{
-RenderbufferD3D::RenderbufferD3D(RendererD3D *renderer)
- : mRenderer(renderer), mRenderTarget(nullptr), mImage(nullptr)
-{
-}
-
-RenderbufferD3D::~RenderbufferD3D()
-{
- SafeDelete(mRenderTarget);
- mImage = nullptr;
-}
-
-gl::Error RenderbufferD3D::onDestroy(const gl::Context *context)
-{
- deleteRenderTarget(context);
- return gl::NoError();
-}
-
-gl::Error RenderbufferD3D::setStorage(const gl::Context *context,
- GLenum internalformat,
- size_t width,
- size_t height)
-{
- return setStorageMultisample(context, 0, internalformat, width, height);
-}
-
-gl::Error 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);
- if (samples > formatCaps.getMaxSamples())
- {
- return gl::OutOfMemory() << "Renderbuffer format does not support " << samples
- << " samples, " << formatCaps.getMaxSamples()
- << " is the maximum.";
- }
-
- RenderTargetD3D *newRT = nullptr;
- ANGLE_TRY(mRenderer->createRenderTarget(static_cast<int>(width), static_cast<int>(height),
- creationFormat, static_cast<GLsizei>(samples), &newRT));
-
- deleteRenderTarget(context);
- mImage = nullptr;
- mRenderTarget = newRT;
-
- return gl::NoError();
-}
-
-gl::Error RenderbufferD3D::setStorageEGLImageTarget(const gl::Context *context, egl::Image *image)
-{
- mImage = GetImplAs<EGLImageD3D>(image);
- deleteRenderTarget(context);
-
- return gl::NoError();
-}
-
-gl::Error RenderbufferD3D::getRenderTarget(const gl::Context *context,
- RenderTargetD3D **outRenderTarget)
-{
- if (mImage)
- {
- return mImage->getRenderTarget(context, outRenderTarget);
- }
- else
- {
- *outRenderTarget = mRenderTarget;
- return gl::NoError();
- }
-}
-
-gl::Error RenderbufferD3D::getAttachmentRenderTarget(const gl::Context *context,
- GLenum /*binding*/,
- const gl::ImageIndex & /*imageIndex*/,
- FramebufferAttachmentRenderTarget **rtOut)
-{
- return getRenderTarget(context, reinterpret_cast<RenderTargetD3D **>(rtOut));
-}
-
-void RenderbufferD3D::deleteRenderTarget(const gl::Context *context)
-{
- if (mRenderTarget)
- {
- mRenderTarget->signalDirty(context);
- SafeDelete(mRenderTarget);
- }
-}
-
-gl::Error RenderbufferD3D::initializeContents(const gl::Context *context,
- const gl::ImageIndex &imageIndex)
-{
- RenderTargetD3D *renderTarget = nullptr;
- ANGLE_TRY(getRenderTarget(context, &renderTarget));
- return mRenderer->initRenderTarget(renderTarget);
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.h
deleted file mode 100644
index b50eff7db7..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.h
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// 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(RendererD3D *renderer);
- ~RenderbufferD3D() override;
-
- gl::Error onDestroy(const gl::Context *context) override;
-
- gl::Error setStorage(const gl::Context *context,
- GLenum internalformat,
- size_t width,
- size_t height) override;
- gl::Error setStorageMultisample(const gl::Context *context,
- size_t samples,
- GLenum internalformat,
- size_t width,
- size_t height) override;
- gl::Error setStorageEGLImageTarget(const gl::Context *context, egl::Image *image) override;
-
- gl::Error getRenderTarget(const gl::Context *context, RenderTargetD3D **outRenderTarget);
- gl::Error getAttachmentRenderTarget(const gl::Context *context,
- GLenum binding,
- const gl::ImageIndex &imageIndex,
- FramebufferAttachmentRenderTarget **rtOut) override;
-
- gl::Error initializeContents(const gl::Context *context,
- const gl::ImageIndex &imageIndex) override;
-
- private:
- void deleteRenderTarget(const gl::Context *context);
-
- RendererD3D *mRenderer;
- RenderTargetD3D *mRenderTarget;
- EGLImageD3D *mImage;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_RENDERBUFFERD3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.cpp
deleted file mode 100644
index 2167200a91..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-//
-// 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),
- mWorkaroundsInitialized(false),
- mDisjoint(false),
- mDeviceLost(false),
- mWorkerThreadPool(4)
-{
-}
-
-RendererD3D::~RendererD3D()
-{
- cleanup();
-}
-
-void RendererD3D::cleanup()
-{
- mIncompleteTextures.onDestroy(mDisplay->getProxyContext());
-}
-
-bool RendererD3D::skipDraw(const gl::State &glState, GLenum drawMode)
-{
- if (drawMode == GL_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::Error RendererD3D::getIncompleteTexture(const gl::Context *context,
- GLenum type,
- gl::Texture **textureOut)
-{
- return mIncompleteTextures.getIncompleteTexture(context, type, this, textureOut);
-}
-
-GLenum RendererD3D::getResetStatus()
-{
- if (!mDeviceLost)
- {
- if (testDeviceLost())
- {
- mDeviceLost = true;
- notifyDeviceLost();
- return GL_UNKNOWN_CONTEXT_RESET_EXT;
- }
- return GL_NO_ERROR;
- }
-
- if (testDeviceResettable())
- {
- return GL_NO_ERROR;
- }
-
- return GL_UNKNOWN_CONTEXT_RESET_EXT;
-}
-
-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;
-}
-
-angle::WorkerThreadPool *RendererD3D::getWorkerThreadPool()
-{
- return &mWorkerThreadPool;
-}
-
-Serial RendererD3D::generateSerial()
-{
- return mSerialFactory.generate();
-}
-
-bool InstancedPointSpritesActive(ProgramD3D *programD3D, GLenum mode)
-{
- return programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation() &&
- mode == GL_POINTS;
-}
-
-gl::Error RendererD3D::initRenderTarget(RenderTargetD3D *renderTarget)
-{
- return clearRenderTarget(renderTarget, gl::ColorF(0, 0, 0, 0), 1, 0);
-}
-
-gl::Error RendererD3D::initializeMultisampleTextureToBlack(const gl::Context *context,
- gl::Texture *glTexture)
-{
- ASSERT(glTexture->getTarget() == GL_TEXTURE_2D_MULTISAMPLE);
- TextureD3D *textureD3D = GetImplAs<TextureD3D>(glTexture);
- gl::ImageIndex index = gl::ImageIndex::Make2DMultisample();
- RenderTargetD3D *renderTarget = nullptr;
- ANGLE_TRY(textureD3D->getRenderTarget(context, index, &renderTarget));
- return clearRenderTarget(renderTarget, gl::ColorF(0.0f, 0.0f, 0.0f, 1.0f), 1.0f, 0);
-}
-
-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;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h
deleted file mode 100644
index dcc98f2ec6..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h
+++ /dev/null
@@ -1,359 +0,0 @@
-
-// 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/ContextState.h"
-#include "libANGLE/Device.h"
-#include "libANGLE/Version.h"
-#include "libANGLE/WorkerThread.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/WorkaroundsD3D.h"
-
-namespace egl
-{
-class ConfigSet;
-}
-
-namespace gl
-{
-class FramebufferState;
-class InfoLog;
-class Texture;
-struct LinkedVarying;
-}
-
-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
-};
-
-// 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(gl::VertexFormatType vertexFormatType) const = 0;
- virtual GLenum getVertexComponentType(gl::VertexFormatType vertexFormatType) const = 0;
-
- // Warning: you should ensure binding really matches attrib.bindingIndex before using this
- // function.
- virtual gl::ErrorOrResult<unsigned int> getVertexSpaceRequired(
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLsizei count,
- GLsizei instances) const = 0;
-};
-
-using AttribIndexArray = std::array<int, gl::MAX_VERTEX_ATTRIBS>;
-
-class RendererD3D : public BufferFactoryD3D, public MultisampleTextureInitializer
-{
- 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::ContextState &state) = 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,
- GLenum *fboFormat) 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::WorkaroundsD3D &getWorkarounds() const;
-
- // Pixel operations
- virtual gl::Error 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 gl::Error copyImageCube(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum target,
- GLint level) = 0;
- virtual gl::Error 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 gl::Error 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 gl::Error copyTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum destTarget,
- GLint destLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha) = 0;
- virtual gl::Error copyCompressedTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel) = 0;
-
- // RenderTarget creation
- virtual gl::Error createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT) = 0;
- virtual gl::Error createRenderTargetCopy(RenderTargetD3D *source, RenderTargetD3D **outRT) = 0;
-
- // Shader operations
- virtual gl::Error loadExecutable(const uint8_t *function,
- size_t length,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- ShaderExecutableD3D **outExecutable) = 0;
- virtual gl::Error compileToExecutable(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 gl::Error ensureHLSLCompilerInitialized() = 0;
-
- virtual UniformStorageD3D *createUniformStorage(size_t storageSize) = 0;
-
- // Image operations
- virtual ImageD3D *createImage() = 0;
- virtual gl::Error generateMipmap(const gl::Context *context,
- ImageD3D *dest,
- ImageD3D *source) = 0;
- virtual gl::Error generateMipmapUsingD3D(const gl::Context *context,
- TextureStorage *storage,
- const gl::TextureState &textureState) = 0;
- virtual gl::Error copyImage(const gl::Context *context,
- ImageD3D *dest,
- ImageD3D *source,
- const gl::Rectangle &sourceRect,
- 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;
-
- // Buffer-to-texture and Texture-to-buffer copies
- virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const = 0;
- virtual gl::Error 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
- GLenum 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 gl::Error clearRenderTarget(RenderTargetD3D *renderTarget,
- const gl::ColorF &clearColorValue,
- const float clearDepthValue,
- const unsigned int clearStencilValue) = 0;
-
- virtual egl::Error getEGLDevice(DeviceImpl **device) = 0;
-
- bool presentPathFastEnabled() const { return mPresentPathFastEnabled; }
-
- // Stream creation
- virtual StreamProducerImpl *createStreamProducerD3DTextureNV12(
- 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;
-
- gl::Error initRenderTarget(RenderTargetD3D *renderTarget);
-
- angle::WorkerThreadPool *getWorkerThreadPool();
-
- gl::Error getIncompleteTexture(const gl::Context *context,
- GLenum type,
- gl::Texture **textureOut);
-
- Serial generateSerial();
-
- virtual bool canSelectViewInVertexShader() const = 0;
-
- gl::Error initializeMultisampleTextureToBlack(const gl::Context *context,
- gl::Texture *glTexture) override;
-
- 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;
-
- void cleanup();
-
- bool skipDraw(const gl::State &glState, GLenum drawMode);
-
- egl::Display *mDisplay;
-
- bool mPresentPathFastEnabled;
-
- private:
- void ensureCapsInitialized() const;
-
- virtual angle::WorkaroundsD3D generateWorkarounds() const = 0;
-
- mutable bool mCapsInitialized;
- mutable gl::Caps mNativeCaps;
- mutable gl::TextureCapsMap mNativeTextureCaps;
- mutable gl::Extensions mNativeExtensions;
- mutable gl::Limitations mNativeLimitations;
-
- IncompleteTextureSet mIncompleteTextures;
-
- mutable bool mWorkaroundsInitialized;
- mutable angle::WorkaroundsD3D mWorkarounds;
-
- bool mDisjoint;
- bool mDeviceLost;
-
- angle::WorkerThreadPool mWorkerThreadPool;
-
- SerialFactory mSerialFactory;
-};
-
-unsigned int GetBlendSampleMask(const gl::State &glState, int samples);
-bool InstancedPointSpritesActive(ProgramD3D *programD3D, GLenum mode);
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_RENDERERD3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SamplerD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SamplerD3D.h
deleted file mode 100644
index 3f8f5b9d8d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SamplerD3D.h
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-// 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 {}
-};
-}
-
-#endif // LIBANGLE_RENDERER_D3D_SAMPLERD3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderD3D.cpp
deleted file mode 100644
index 2a8f1fb11c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderD3D.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-//
-// 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/Shader.h"
-#include "libANGLE/features.h"
-#include "libANGLE/renderer/d3d/ProgramD3D.h"
-#include "libANGLE/renderer/d3d/RendererD3D.h"
-
-// Definitions local to the translation unit
-namespace
-{
-
-const char *GetShaderTypeString(GLenum type)
-{
- switch (type)
- {
- case GL_VERTEX_SHADER:
- return "VERTEX";
-
- case GL_FRAGMENT_SHADER:
- return "FRAGMENT";
-
- case GL_COMPUTE_SHADER:
- return "COMPUTE";
-
- default:
- UNREACHABLE();
- return "";
- }
-}
-
-} // anonymous namespace
-
-namespace rx
-{
-
-ShaderD3D::ShaderD3D(const gl::ShaderState &data,
- const angle::WorkaroundsD3D &workarounds,
- const gl::Extensions &extensions)
- : ShaderImpl(data), mAdditionalOptions(0)
-{
- uncompile();
-
- if (workarounds.expandIntegerPowExpressions)
- {
- mAdditionalOptions |= SH_EXPAND_SELECT_HLSL_INTEGER_POW_EXPRESSIONS;
- }
-
- if (workarounds.getDimensionsIgnoresBaseLevel)
- {
- mAdditionalOptions |= SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL;
- }
-
- if (workarounds.preAddTexelFetchOffsets)
- {
- mAdditionalOptions |= SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH;
- }
- if (workarounds.rewriteUnaryMinusOperator)
- {
- mAdditionalOptions |= SH_REWRITE_INTEGER_UNARY_MINUS_OPERATOR;
- }
- if (workarounds.emulateIsnanFloat)
- {
- mAdditionalOptions |= SH_EMULATE_ISNAN_FLOAT_FUNCTION;
- }
- if (extensions.multiview)
- {
- mAdditionalOptions |= SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW;
- }
-}
-
-ShaderD3D::~ShaderD3D()
-{
-}
-
-std::string ShaderD3D::getDebugInfo() const
-{
- if (mDebugInfo.empty())
- {
- return "";
- }
-
- return mDebugInfo + std::string("\n// ") + 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;
- mUsesFragCoord = false;
- mUsesFrontFacing = false;
- mUsesPointSize = false;
- mUsesPointCoord = false;
- mUsesDepthRange = false;
- mUsesFragDepth = false;
- mHasANGLEMultiviewEnabled = 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;
-}
-
-ShShaderOutput ShaderD3D::getCompilerOutputType() const
-{
- return mCompilerOutputType;
-}
-
-ShCompileOptions ShaderD3D::prepareSourceAndReturnOptions(std::stringstream *shaderSourceStream,
- 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;
-
- *shaderSourceStream << source;
- return additionalOptions;
-}
-
-bool ShaderD3D::hasUniform(const std::string &name) const
-{
- return mUniformRegisterMap.find(name) != mUniformRegisterMap.end();
-}
-
-const std::map<std::string, unsigned int> &GetUniformRegisterMap(
- const std::map<std::string, unsigned int> *uniformRegisterMap)
-{
- ASSERT(uniformRegisterMap);
- return *uniformRegisterMap;
-}
-
-bool ShaderD3D::postTranslateCompile(gl::Compiler *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;
- 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;
- 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->getCompilerHandle(mData.getShaderType());
-
- mUniformRegisterMap = GetUniformRegisterMap(sh::GetUniformRegisterMap(compilerHandle));
-
- for (const sh::InterfaceBlock &interfaceBlock : mData.getUniformBlocks())
- {
- if (interfaceBlock.staticUse)
- {
- unsigned int index = static_cast<unsigned int>(-1);
- bool blockRegisterResult =
- sh::GetUniformBlockRegister(compilerHandle, interfaceBlock.name, &index);
- ASSERT(blockRegisterResult);
-
- mUniformBlockRegisterMap[interfaceBlock.name] = index;
- }
- }
-
- mDebugInfo +=
- std::string("// ") + 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;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderD3D.h
deleted file mode 100644
index f7b0b20db4..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderD3D.h
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// 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 WorkaroundsD3D;
-}
-
-namespace gl
-{
-struct Extensions;
-}
-
-namespace rx
-{
-class DynamicHLSL;
-class RendererD3D;
-struct D3DUniform;
-
-class ShaderD3D : public ShaderImpl
-{
- public:
- ShaderD3D(const gl::ShaderState &data,
- const angle::WorkaroundsD3D &workarounds,
- const gl::Extensions &extensions);
- ~ShaderD3D() override;
-
- // ShaderImpl implementation
- ShCompileOptions prepareSourceAndReturnOptions(std::stringstream *sourceStream,
- std::string *sourcePath) override;
- bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) 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;
- 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 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 usesViewID() const { return mUsesViewID; }
- bool hasANGLEMultiviewEnabled() const { return mHasANGLEMultiviewEnabled; }
-
- ShShaderOutput getCompilerOutputType() const;
-
- private:
- bool mUsesMultipleRenderTargets;
- bool mUsesFragColor;
- bool mUsesFragData;
- bool mUsesFragCoord;
- bool mUsesFrontFacing;
- bool mUsesPointSize;
- bool mUsesPointCoord;
- bool mUsesDepthRange;
- bool mUsesFragDepth;
- bool mHasANGLEMultiviewEnabled;
- 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;
- ShCompileOptions mAdditionalOptions;
-};
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_SHADERD3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp
deleted file mode 100644
index 83a66bd1a5..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h
deleted file mode 100644
index b8097710e2..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// 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 <vector>
-#include <cstdint>
-
-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/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
deleted file mode 100644
index 7657aef79e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
+++ /dev/null
@@ -1,509 +0,0 @@
-//
-// 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/d3d/RenderTargetD3D.h"
-#include "libANGLE/renderer/d3d/RendererD3D.h"
-#include "libANGLE/renderer/d3d/SwapChainD3D.h"
-
-#include <tchar.h>
-#include <EGL/eglext.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),
- mOrientation(static_cast<EGLint>(attribs.get(EGL_SURFACE_ORIENTATION_ANGLE, 0))),
- mRenderTargetFormat(state.config->renderTargetFormat),
- mDepthStencilFormat(state.config->depthStencilFormat),
- mSwapChain(nullptr),
- mSwapIntervalDirty(true),
- mWindowSubclassed(false),
- 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)
-{
- subclassWindow();
- if (window != nullptr && !mFixedSize)
- {
- mWidth = -1;
- mHeight = -1;
- }
-
- 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();
- ANGLE_SWALLOW_ERR(mRenderer->getD3DTextureInfo(state.config, mD3DTexture, &mWidth,
- &mHeight, &mRenderTargetFormat));
- break;
-
- default:
- break;
- }
-}
-
-SurfaceD3D::~SurfaceD3D()
-{
- unsubclassWindow();
- 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();
- }
- }
-
- ANGLE_TRY(resetSwapChain(display));
- return egl::NoError();
-}
-
-FramebufferImpl *SurfaceD3D::createDefaultFramebuffer(const gl::FramebufferState &data)
-{
- return mRenderer->createDefaultFramebuffer(data);
-}
-
-egl::Error SurfaceD3D::bindTexImage(gl::Texture *, EGLint)
-{
- return egl::NoError();
-}
-
-egl::Error SurfaceD3D::releaseTexImage(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 = mWidth;
- height = mHeight;
- }
-
- 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.
- egl::Error error = resetSwapChain(display->getProxyContext(), width, height);
- if (error.isError())
- {
- SafeDelete(mSwapChain);
- return error;
- }
-
- return egl::NoError();
-}
-
-egl::Error SurfaceD3D::resizeSwapChain(const gl::Context *context,
- int backbufferWidth,
- int backbufferHeight)
-{
- ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
- ASSERT(mSwapChain);
-
- EGLint status =
- mSwapChain->resize(context, 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(const gl::Context *context,
- int backbufferWidth,
- int backbufferHeight)
-{
- ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
- ASSERT(mSwapChain);
-
- EGLint status = mSwapChain->reset(context, 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(const gl::Context *context,
- 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(context, 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(context));
-
- return egl::NoError();
-}
-
-#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
-#define kSurfaceProperty _TEXT("Egl::SurfaceOwner")
-#define kParentWndProc _TEXT("Egl::SurfaceParentWndProc")
-#define kDisplayProperty _TEXT("Egl::Display")
-
-static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
-{
- if (message == WM_SIZE)
- {
- SurfaceD3D* surf = reinterpret_cast<SurfaceD3D*>(GetProp(hwnd, kSurfaceProperty));
- if(surf)
- {
- egl::Display *display = reinterpret_cast<egl::Display *>(GetProp(hwnd, kDisplayProperty));
- surf->checkForOutOfDateSwapChain(display->getProxyContext());
- }
- }
- WNDPROC prevWndFunc = reinterpret_cast<WNDPROC >(GetProp(hwnd, kParentWndProc));
- return CallWindowProc(prevWndFunc, hwnd, message, wparam, lparam);
-}
-#endif
-
-void SurfaceD3D::subclassWindow()
-{
-#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
- HWND window = mNativeWindow->getNativeWindow();
- if (!window)
- {
- return;
- }
-
- DWORD processId;
- DWORD threadId = GetWindowThreadProcessId(window, &processId);
- if (processId != GetCurrentProcessId() || threadId != GetCurrentThreadId())
- {
- return;
- }
-
- SetLastError(0);
- LONG_PTR oldWndProc = SetWindowLongPtr(window, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(SurfaceWindowProc));
- if(oldWndProc == 0 && GetLastError() != ERROR_SUCCESS)
- {
- mWindowSubclassed = false;
- return;
- }
-
- SetProp(window, kSurfaceProperty, reinterpret_cast<HANDLE>(this));
- SetProp(window, kParentWndProc, reinterpret_cast<HANDLE>(oldWndProc));
- SetProp(window, kDisplayProperty, reinterpret_cast<HANDLE>(mDisplay));
- mWindowSubclassed = true;
-#endif
-}
-
-void SurfaceD3D::unsubclassWindow()
-{
- if (!mWindowSubclassed)
- {
- return;
- }
-
-#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
- HWND window = mNativeWindow->getNativeWindow();
- if (!window)
- {
- return;
- }
-
- // un-subclass
- LONG_PTR parentWndFunc = reinterpret_cast<LONG_PTR>(GetProp(window, kParentWndProc));
-
- // Check the windowproc is still SurfaceWindowProc.
- // If this assert fails, then it is likely the application has subclassed the
- // hwnd as well and did not unsubclass before destroying its EGL context. The
- // application should be modified to either subclass before initializing the
- // EGL context, or to unsubclass before destroying the EGL context.
- if(parentWndFunc)
- {
- LONG_PTR prevWndFunc = SetWindowLongPtr(window, GWLP_WNDPROC, parentWndFunc);
- ASSERT(prevWndFunc == reinterpret_cast<LONG_PTR>(SurfaceWindowProc));
- }
-
- RemoveProp(window, kSurfaceProperty);
- RemoveProp(window, kParentWndProc);
- RemoveProp(window, kDisplayProperty);
-#endif
- mWindowSubclassed = false;
-}
-
-
-egl::Error SurfaceD3D::checkForOutOfDateSwapChain(const gl::Context *context)
-{
- 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();
- }
-
- if (mSwapIntervalDirty)
- {
- ANGLE_TRY(resetSwapChain(context, clientWidth, clientHeight));
- }
- else if (sizeDirty)
- {
- ANGLE_TRY(resizeSwapChain(context, clientWidth, clientHeight));
- }
-
- return egl::NoError();
-}
-
-egl::Error SurfaceD3D::swap(const gl::Context *context)
-{
- return swapRect(context, 0, 0, mWidth, mHeight);
-}
-
-egl::Error SurfaceD3D::postSubBuffer(const gl::Context *context,
- EGLint x,
- EGLint y,
- EGLint width,
- EGLint height)
-{
- return swapRect(context, x, y, width, height);
-}
-
-rx::SwapChainD3D *SurfaceD3D::getSwapChain() const
-{
- return mSwapChain;
-}
-
-void SurfaceD3D::setSwapInterval(EGLint interval)
-{
- if (mSwapInterval == interval)
- {
- return;
- }
-
- mSwapInterval = interval;
- mSwapIntervalDirty = true;
-}
-
-EGLint SurfaceD3D::getWidth() const
-{
- return mWidth;
-}
-
-EGLint SurfaceD3D::getHeight() const
-{
- return mHeight;
-}
-
-EGLint SurfaceD3D::isPostSubBufferSupported() const
-{
- // post sub buffer is always possible on D3D surfaces
- return EGL_TRUE;
-}
-
-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 if (attribute == EGL_DEVICE_EXT)
- {
- *value = mSwapChain->getDevice();
- }
- else UNREACHABLE();
-
- return egl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-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 rc
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h
deleted file mode 100644
index 01d2573244..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h
+++ /dev/null
@@ -1,136 +0,0 @@
-//
-// 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 SwapChainD3D;
-class RendererD3D;
-
-class SurfaceD3D : public SurfaceImpl
-{
- public:
- ~SurfaceD3D() override;
- void releaseSwapChain();
-
- egl::Error initialize(const egl::Display *display) override;
- FramebufferImpl *createDefaultFramebuffer(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(gl::Texture *texture, EGLint buffer) override;
- egl::Error releaseTexImage(EGLint buffer) override;
- egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override;
- void setSwapInterval(EGLint interval) 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(const gl::Context *context);
-
- gl::Error getAttachmentRenderTarget(const gl::Context *context,
- GLenum binding,
- const gl::ImageIndex &imageIndex,
- FramebufferAttachmentRenderTarget **rtOut) 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(const gl::Context *context,
- EGLint x,
- EGLint y,
- EGLint width,
- EGLint height);
- egl::Error resetSwapChain(const gl::Context *context,
- int backbufferWidth,
- int backbufferHeight);
- egl::Error resizeSwapChain(const gl::Context *context,
- int backbufferWidth,
- int backbufferHeight);
-
- void subclassWindow();
- void unsubclassWindow();
-
- RendererD3D *mRenderer;
- egl::Display *mDisplay;
-
- bool mFixedSize;
- GLint mOrientation;
-
- GLenum mRenderTargetFormat;
- GLenum mDepthStencilFormat;
-
- SwapChainD3D *mSwapChain;
- bool mSwapIntervalDirty;
- bool mWindowSubclassed; // Indicates whether we successfully subclassed mWindow for WM_RESIZE hooking
-
- NativeWindowD3D *mNativeWindow; // Handler for the Window that the surface is created for.
- EGLint mWidth;
- EGLint mHeight;
-
- EGLint mSwapInterval;
-
- HANDLE mShareHandle;
- IUnknown *mD3DTexture;
-};
-
-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/src/3rdparty/angle/src/libANGLE/renderer/d3d/SwapChainD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SwapChainD3D.cpp
deleted file mode 100644
index de8534c3da..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SwapChainD3D.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/SwapChainD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SwapChainD3D.h
deleted file mode 100644
index 017737b878..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SwapChainD3D.h
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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 <GLES2/gl2.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.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 RenderTargetD3D;
-
-class SwapChainD3D : angle::NonCopyable
-{
- public:
- SwapChainD3D(HANDLE shareHandle,
- IUnknown *d3dTexture,
- GLenum backBufferFormat,
- GLenum depthBufferFormat);
- virtual ~SwapChainD3D();
-
- virtual EGLint resize(const gl::Context *context,
- EGLint backbufferWidth,
- EGLint backbufferSize) = 0;
- virtual EGLint reset(const gl::Context *context,
- EGLint backbufferWidth,
- EGLint backbufferHeight,
- EGLint swapInterval) = 0;
- virtual EGLint swapRect(const gl::Context *context,
- EGLint x,
- EGLint y,
- EGLint width,
- EGLint height) = 0;
- virtual void recreate() = 0;
- virtual void *getDevice() { return nullptr; }
-
- 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp
deleted file mode 100644
index bf44cbb5d2..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp
+++ /dev/null
@@ -1,3974 +0,0 @@
-//
-// 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/EGLImageD3D.h"
-#include "libANGLE/renderer/d3d/ImageD3D.h"
-#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
-#include "libANGLE/renderer/d3d/RendererD3D.h"
-#include "libANGLE/renderer/d3d/SurfaceD3D.h"
-#include "libANGLE/renderer/d3d/TextureStorage.h"
-
-namespace rx
-{
-
-namespace
-{
-
-gl::Error 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 gl::NoError();
-}
-
-bool IsRenderTargetUsage(GLenum usage)
-{
- return (usage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
-}
-
-}
-
-TextureD3D::TextureD3D(const gl::TextureState &state, RendererD3D *renderer)
- : TextureImpl(state),
- mRenderer(renderer),
- mDirtyImages(true),
- mImmutable(false),
- mTexStorage(nullptr),
- mBaseLevel(0)
-{
-}
-
-TextureD3D::~TextureD3D()
-{
- ASSERT(!mTexStorage);
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-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);
-}
-
-gl::Error TextureD3D::setStorage(const gl::Context *context,
- GLenum target,
- size_t levels,
- GLenum internalFormat,
- const gl::Extents &size)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D::setStorageMultisample(const gl::Context *context,
- GLenum target,
- GLsizei samples,
- GLint internalFormat,
- const gl::Extents &size,
- bool fixedSampleLocations)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-bool TextureD3D::shouldUseSetData(const ImageD3D *image) const
-{
- if (!mRenderer->getWorkarounds().setDataFasterThanImageUpload)
- {
- 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);
-}
-
-gl::Error 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->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
- ASSERT(image);
-
- // No-op
- if (image->getWidth() == 0 || image->getHeight() == 0 || image->getDepth() == 0)
- {
- return gl::NoError();
- }
-
- // 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.is3D()));
- }
-
- mDirtyImages = true;
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D::subImage(const gl::Context *context,
- const gl::ImageIndex &index,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- ptrdiff_t layerOffset)
-{
- // CPU readback & copy where direct GPU copy is not supported
- const uint8_t *pixelData = nullptr;
- gl::Buffer *unpackBuffer =
- context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
- 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.is3D()));
- ANGLE_TRY(commitRegion(context, index, area));
- mDirtyImages = true;
- }
-
- return gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
- }
-
- // 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->getGLState().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 gl::NoError();
-}
-
-gl::Error 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->getGLState().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 gl::NoError();
-}
-
-bool TextureD3D::isFastUnpackable(const gl::Buffer *unpackBuffer, GLenum sizedInternalFormat)
-{
- return unpackBuffer != nullptr &&
- mRenderer->supportsFastCopyBufferToTexture(sizedInternalFormat);
-}
-
-gl::Error TextureD3D::fastUnpackPixels(const gl::Context *context,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- const gl::Box &destArea,
- GLenum sizedInternalFormat,
- GLenum type,
- RenderTargetD3D *destRenderTarget)
-{
- if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 ||
- unpack.skipImages != 0)
- {
- // TODO(jmadill): additional unpack parameters
- UNIMPLEMENTED();
- return gl::InternalError() << "Unimplemented pixel store parameters in fastUnpackPixels";
- }
-
- // No-op
- if (destArea.width <= 0 && destArea.height <= 0 && destArea.depth <= 0)
- {
- return gl::NoError();
- }
-
- // 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 gl::NoError();
-}
-
-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));
-}
-
-gl::Error TextureD3D::setImageExternal(const gl::Context *context,
- GLenum target,
- egl::Stream *stream,
- const egl::Stream::GLTextureDescription &desc)
-{
- // Only external images can accept external textures
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error 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->getWorkarounds().zeroMaxLodWorkaround)
- {
- // 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 gl::NoError();
-}
-
-gl::Error 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 (mRenderer->getWorkarounds().setDataFasterThanImageUpload && mTexStorage)
- {
- 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->getWorkarounds().zeroMaxLodWorkaround));
-
- 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 gl::NoError();
-}
-
-bool TextureD3D::isBaseImageZeroSize() const
-{
- ImageD3D *baseImage = getBaseLevelImage();
-
- if (!baseImage || baseImage->getWidth() <= 0)
- {
- return true;
- }
-
- if (!gl::IsCubeMapTextureTarget(baseImage->getTarget()) && baseImage->getHeight() <= 0)
- {
- return true;
- }
-
- if (baseImage->getTarget() == GL_TEXTURE_3D && baseImage->getDepth() <= 0)
- {
- return true;
- }
-
- if (baseImage->getTarget() == GL_TEXTURE_2D_ARRAY && getLayerCount(getBaseLevel()) <= 0)
- {
- return true;
- }
-
- return false;
-}
-
-gl::Error 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)
- {
- UNREACHABLE();
- return gl::InternalError() << "Cannot render to incomplete texture.";
- }
-
- 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();
- }
- }
-
- return gl::NoError();
-}
-
-bool TextureD3D::canCreateRenderTargetForImage(const gl::ImageIndex &index) const
-{
- if (index.type == GL_TEXTURE_2D_MULTISAMPLE)
- return true;
-
- ImageD3D *image = getImage(index);
- ASSERT(image);
- bool levelsComplete = (isImageComplete(index) && isImageComplete(getImageIndex(0, 0)));
- return (image->isRenderableFormat() && levelsComplete);
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error TextureD3D::getAttachmentRenderTarget(const gl::Context *context,
- GLenum /*binding*/,
- const gl::ImageIndex &imageIndex,
- FramebufferAttachmentRenderTarget **rtOut)
-{
- RenderTargetD3D *rtD3D = nullptr;
- gl::Error error = getRenderTarget(context, imageIndex, &rtD3D);
- *rtOut = static_cast<FramebufferAttachmentRenderTarget *>(rtD3D);
- return error;
-}
-
-gl::Error 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 gl::NoError();
-}
-
-void TextureD3D::syncState(const gl::Texture::DirtyBits &dirtyBits)
-{
- // TODO(geofflang): Use dirty bits
-}
-
-gl::Error TextureD3D::releaseTexStorage(const gl::Context *context)
-{
- if (!mTexStorage)
- {
- return gl::NoError();
- }
- auto err = mTexStorage->onDestroy(context);
- SafeDelete(mTexStorage);
- return err;
-}
-
-gl::Error TextureD3D::onDestroy(const gl::Context *context)
-{
- return releaseTexStorage(context);
-}
-
-gl::Error TextureD3D::initializeContents(const gl::Context *context,
- const gl::ImageIndex &imageIndexIn)
-{
- gl::ImageIndex imageIndex = imageIndexIn;
-
- // 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 (imageIndex.type == GL_TEXTURE_3D)
- {
- imageIndex.layerIndex = gl::ImageIndex::ENTIRE_LEVEL;
- }
- else if (imageIndex.type == GL_TEXTURE_2D_ARRAY &&
- imageIndex.layerIndex == gl::ImageIndex::ENTIRE_LEVEL)
- {
- GLsizei layerCount = getLayerCount(imageIndex.mipIndex);
- for (imageIndex.layerIndex = 0; imageIndex.layerIndex < layerCount; ++imageIndex.layerIndex)
- {
- ANGLE_TRY(initializeContents(context, imageIndex));
- }
- return gl::NoError();
- }
-
- // Force image clean.
- ImageD3D *image = getImage(imageIndex);
- if (image)
- {
- image->markClean();
- }
-
- // Fast path: can use a render target clear.
- if (canCreateRenderTargetForImage(imageIndex))
- {
- ANGLE_TRY(ensureRenderTarget(context));
- ASSERT(mTexStorage);
- RenderTargetD3D *renderTarget = nullptr;
- ANGLE_TRY(mTexStorage->getRenderTarget(context, imageIndex, &renderTarget));
- ANGLE_TRY(mRenderer->initRenderTarget(renderTarget));
- return gl::NoError();
- }
-
- // Slow path: non-renderable texture or the texture levels aren't set up.
- const auto &formatInfo = gl::GetSizedInternalFormatInfo(image->getInternalFormat());
-
- size_t imageBytes = 0;
- ANGLE_TRY_RESULT(formatInfo.computeRowPitch(formatInfo.type, image->getWidth(), 1, 0),
- imageBytes);
- imageBytes *= image->getHeight() * image->getDepth();
-
- gl::PixelUnpackState defaultUnpackState;
-
- angle::MemoryBuffer *zeroBuffer = nullptr;
- ANGLE_TRY(context->getZeroFilledBuffer(imageBytes, &zeroBuffer));
- if (shouldUseSetData(image))
- {
- ANGLE_TRY(mTexStorage->setData(context, imageIndex, image, nullptr, formatInfo.type,
- defaultUnpackState, zeroBuffer->data()));
- }
- else
- {
- gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth());
- ANGLE_TRY(image->loadData(context, fullImageArea, defaultUnpackState, 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, imageIndex, fullImageArea));
- image->markClean();
- }
- else
- {
- mDirtyImages = true;
- }
- }
- return gl::NoError();
-}
-
-TextureD3D_2D::TextureD3D_2D(const gl::TextureState &state, RendererD3D *renderer)
- : TextureD3D(state, renderer)
-{
- mEGLImageTarget = false;
- for (auto &image : mImageArray)
- {
- image.reset(renderer->createImage());
- }
-}
-
-gl::Error 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.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
- ASSERT(!index.hasLayer());
- ASSERT(index.type == GL_TEXTURE_2D);
- return mImageArray[index.mipIndex].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;
-}
-
-gl::Error TextureD3D_2D::setImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- GLenum internalFormat,
- const gl::Extents &size,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels)
-{
- ASSERT(target == GL_TEXTURE_2D && size.depth == 1);
-
- const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type);
-
- bool fastUnpacked = false;
- GLint level = static_cast<GLint>(imageLevel);
-
- ANGLE_TRY(redefineImage(context, level, internalFormatInfo.sizedInternalFormat, size, false));
-
- gl::ImageIndex index = gl::ImageIndex::Make2D(level);
-
- // Attempt a fast gpu copy of the pixel data to the surface
- gl::Buffer *unpackBuffer =
- context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
- if (isFastUnpackable(unpackBuffer, internalFormatInfo.sizedInternalFormat) &&
- isLevelComplete(level))
- {
- // 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(level), getHeight(level), 1);
-
- ANGLE_TRY(fastUnpackPixels(context, unpack, pixels, destArea,
- internalFormatInfo.sizedInternalFormat, type, destRenderTarget));
-
- // Ensure we don't overwrite our newly initialized data
- mImageArray[level]->markClean();
-
- fastUnpacked = true;
- }
-
- if (!fastUnpacked)
- {
- ANGLE_TRY(setImageImpl(context, index, type, unpack, pixels, 0));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2D::setSubImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels)
-{
- ASSERT(target == GL_TEXTURE_2D && area.depth == 1 && area.z == 0);
-
- GLint level = static_cast<GLint>(imageLevel);
- gl::ImageIndex index = gl::ImageIndex::Make2D(level);
-
- gl::Buffer *unpackBuffer =
- context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
- if (isFastUnpackable(unpackBuffer, getInternalFormat(level)) && isLevelComplete(level))
- {
- RenderTargetD3D *renderTarget = nullptr;
- ANGLE_TRY(getRenderTarget(context, index, &renderTarget));
- ASSERT(!mImageArray[level]->isDirty());
-
- return fastUnpackPixels(context, unpack, pixels, area, getInternalFormat(level), type,
- renderTarget);
- }
- else
- {
- return TextureD3D::subImage(context, index, area, format, type, unpack, pixels, 0);
- }
-}
-
-gl::Error TextureD3D_2D::setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- GLenum internalFormat,
- const gl::Extents &size,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels)
-{
- ASSERT(target == GL_TEXTURE_2D && size.depth == 1);
- GLint level = static_cast<GLint>(imageLevel);
-
- // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
- ANGLE_TRY(redefineImage(context, level, internalFormat, size, false));
-
- return setCompressedImageImpl(context, gl::ImageIndex::Make2D(level), unpack, pixels, 0);
-}
-
-gl::Error TextureD3D_2D::setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels)
-{
- ASSERT(target == GL_TEXTURE_2D && area.depth == 1 && area.z == 0);
-
- gl::ImageIndex index = gl::ImageIndex::Make2D(static_cast<GLint>(level));
- ANGLE_TRY(TextureD3D::subImageCompressed(context, index, area, format, unpack, pixels, 0));
-
- return commitRegion(context, index, area);
-}
-
-gl::Error TextureD3D_2D::copyImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- const gl::Rectangle &origSourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source)
-{
- ASSERT(target == GL_TEXTURE_2D);
-
- GLint level = static_cast<GLint>(imageLevel);
- const gl::InternalFormat &internalFormatInfo =
- gl::GetInternalFormatInfo(internalFormat, GL_UNSIGNED_BYTE);
- gl::Extents sourceExtents(origSourceArea.width, origSourceArea.height, 1);
- ANGLE_TRY(redefineImage(context, level, internalFormatInfo.sizedInternalFormat, sourceExtents,
- false));
-
- gl::Extents fbSize = source->getReadColorbuffer()->getSize();
-
- // Does the read area extend beyond the framebuffer?
- bool outside = origSourceArea.x < 0 || origSourceArea.y < 0 ||
- origSourceArea.x + origSourceArea.width > fbSize.width ||
- origSourceArea.y + origSourceArea.height > fbSize.height;
-
- // In WebGL mode we need to zero the texture outside the framebuffer.
- // If we have robust resource init, it was already zeroed by redefineImage() above, otherwise
- // zero it explicitly.
- // TODO(fjhenigman): When robust resource is fully implemented look into making it a
- // prerequisite for WebGL and deleting this code.
- if (outside &&
- (context->getExtensions().webglCompatibility || context->isRobustResourceInitEnabled()))
- {
- angle::MemoryBuffer *zero;
- ANGLE_TRY(context->getZeroFilledBuffer(
- origSourceArea.width * origSourceArea.height * internalFormatInfo.pixelBytes, &zero));
- gl::PixelUnpackState unpack;
- unpack.alignment = 1;
- ANGLE_TRY(setImage(context, target, imageLevel, internalFormat, sourceExtents,
- internalFormatInfo.format, internalFormatInfo.type, unpack,
- zero->data()));
- }
-
- gl::Rectangle sourceArea;
- if (!ClipRectangle(origSourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height),
- &sourceArea))
- {
- // Empty source area, nothing to do.
- return gl::NoError();
- }
-
- gl::ImageIndex index = gl::ImageIndex::Make2D(level);
- gl::Offset destOffset(sourceArea.x - origSourceArea.x, sourceArea.y - origSourceArea.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->getWorkarounds().zeroMaxLodWorkaround)
- {
- ANGLE_TRY(mImageArray[level]->copyFromFramebuffer(context, destOffset, sourceArea, source));
- mDirtyImages = true;
- }
- else
- {
- ANGLE_TRY(ensureRenderTarget(context));
-
- if (sourceArea.width != 0 && sourceArea.height != 0 && isValidLevel(level))
- {
- ANGLE_TRY(updateStorageLevel(context, level));
- ANGLE_TRY(mRenderer->copyImage2D(context, source, sourceArea, internalFormat,
- destOffset, mTexStorage, level));
- }
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2D::copySubImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- const gl::Offset &origDestOffset,
- const gl::Rectangle &origSourceArea,
- const gl::Framebuffer *source)
-{
- ASSERT(target == GL_TEXTURE_2D && origDestOffset.z == 0);
-
- gl::Extents fbSize = source->getReadColorbuffer()->getSize();
- gl::Rectangle sourceArea;
- if (!ClipRectangle(origSourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height),
- &sourceArea))
- {
- return gl::NoError();
- }
- const gl::Offset destOffset(origDestOffset.x + sourceArea.x - origSourceArea.x,
- origDestOffset.y + sourceArea.y - origSourceArea.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)
-
- GLint level = static_cast<GLint>(imageLevel);
- gl::ImageIndex index = gl::ImageIndex::Make2D(level);
-
- // If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders,
- // so we should use the non-rendering copy path.
- if (!canCreateRenderTargetForImage(index) || mRenderer->getWorkarounds().zeroMaxLodWorkaround)
- {
- ANGLE_TRY(mImageArray[level]->copyFromFramebuffer(context, destOffset, sourceArea, source));
- mDirtyImages = true;
- }
- else
- {
- ANGLE_TRY(ensureRenderTarget(context));
-
- if (isValidLevel(level))
- {
- ANGLE_TRY(updateStorageLevel(context, level));
- ANGLE_TRY(mRenderer->copyImage2D(context, source, sourceArea,
- gl::GetUnsizedFormat(getBaseLevelInternalFormat()),
- destOffset, mTexStorage, level));
- }
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2D::copyTexture(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- GLenum type,
- size_t sourceLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const gl::Texture *source)
-{
- ASSERT(target == GL_TEXTURE_2D);
-
- GLenum sourceTarget = source->getTarget();
-
- GLint destLevel = static_cast<GLint>(level);
-
- 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, destLevel, internalFormatInfo.sizedInternalFormat, size, false));
-
- gl::Rectangle sourceRect(0, 0, size.width, size.height);
- gl::Offset destOffset(0, 0, 0);
-
- if (!isSRGB(destLevel) && canCreateRenderTargetForImage(gl::ImageIndex::Make2D(destLevel)))
- {
- ANGLE_TRY(ensureRenderTarget(context));
- ASSERT(isValidLevel(destLevel));
- ANGLE_TRY(updateStorageLevel(context, destLevel));
-
- ANGLE_TRY(mRenderer->copyTexture(context, source, static_cast<GLint>(sourceLevel),
- sourceRect, internalFormatInfo.format, destOffset,
- mTexStorage, target, destLevel, 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));
-
- gl::ImageIndex destImageIndex = gl::ImageIndex::Make2D(static_cast<GLint>(destLevel));
- ImageD3D *destImage = nullptr;
- ANGLE_TRY(getImageAndSyncFromStorage(context, destImageIndex, &destImage));
-
- ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceRect, destOffset,
- unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
-
- mDirtyImages = true;
-
- gl::Box destRegion(destOffset, size);
- ANGLE_TRY(commitRegion(context, destImageIndex, destRegion));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2D::copySubTexture(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- size_t sourceLevel,
- const gl::Rectangle &sourceArea,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const gl::Texture *source)
-{
- ASSERT(target == GL_TEXTURE_2D);
-
- GLint destLevel = static_cast<GLint>(level);
-
- if (!isSRGB(destLevel) && canCreateRenderTargetForImage(gl::ImageIndex::Make2D(destLevel)))
- {
- ANGLE_TRY(ensureRenderTarget(context));
- ASSERT(isValidLevel(destLevel));
- ANGLE_TRY(updateStorageLevel(context, destLevel));
-
- ANGLE_TRY(mRenderer->copyTexture(
- context, source, static_cast<GLint>(sourceLevel), sourceArea,
- gl::GetUnsizedFormat(getInternalFormat(destLevel)), destOffset, mTexStorage, target,
- destLevel, 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));
-
- gl::ImageIndex destImageIndex = gl::ImageIndex::Make2D(static_cast<GLint>(destLevel));
- ImageD3D *destImage = nullptr;
- ANGLE_TRY(getImageAndSyncFromStorage(context, destImageIndex, &destImage));
-
- ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceArea, destOffset,
- unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
-
- mDirtyImages = true;
-
- gl::Box destRegion(destOffset.x, destOffset.y, 0, sourceArea.width, sourceArea.height, 1);
- ANGLE_TRY(commitRegion(context, destImageIndex, destRegion));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2D::copyCompressedTexture(const gl::Context *context,
- const gl::Texture *source)
-{
- GLenum sourceTarget = source->getTarget();
- 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 gl::NoError();
-}
-
-gl::Error TextureD3D_2D::setStorage(const gl::Context *context,
- GLenum target,
- size_t levels,
- GLenum internalFormat,
- const gl::Extents &size)
-{
- ASSERT(GL_TEXTURE_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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error TextureD3D_2D::setEGLImageTarget(const gl::Context *context,
- GLenum target,
- 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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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.mipIndex));
-
- 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.mipIndex);
-}
-
-// Constructs a native texture resource from the texture images
-gl::Error 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 gl::NoError();
- }
-
- // do not attempt to create storage for nonexistant data
- if (!isLevelComplete(getBaseLevel()))
- {
- return gl::NoError();
- }
-
- 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 gl::NoError();
-}
-
-gl::Error 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->getWorkarounds().zeroMaxLodWorkaround)
- {
- // 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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error TextureD3D_2D::updateStorage(const gl::Context *context)
-{
- if (!mDirtyImages)
- {
- return gl::NoError();
- }
-
- 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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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_TEXTURE_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 gl::NoError();
-}
-
-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.type == GL_TEXTURE_2D &&
- index.mipIndex >= 0 && index.mipIndex < 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());
- }
- }
-}
-
-gl::Error 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 && layer < 6);
- return mImageArray[layer][level].get();
-}
-
-ImageD3D *TextureD3D_Cube::getImage(const gl::ImageIndex &index) const
-{
- ASSERT(index.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
- ASSERT(index.layerIndex >= 0 && index.layerIndex < 6);
- return mImageArray[index.layerIndex][index.mipIndex].get();
-}
-
-GLsizei TextureD3D_Cube::getLayerCount(int level) const
-{
- ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
- return 6;
-}
-
-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;
-}
-
-gl::Error TextureD3D_Cube::setEGLImageTarget(const gl::Context *context,
- GLenum target,
- egl::Image *image)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_Cube::setImage(const gl::Context *context,
- GLenum target,
- size_t level,
- 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);
- gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast<GLint>(level));
-
- ANGLE_TRY(redefineImage(context, index.layerIndex, static_cast<GLint>(level),
- internalFormatInfo.sizedInternalFormat, size, false));
-
- return setImageImpl(context, index, type, unpack, pixels, 0);
-}
-
-gl::Error TextureD3D_Cube::setSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels)
-{
- ASSERT(area.depth == 1 && area.z == 0);
-
- gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast<GLint>(level));
- return TextureD3D::subImage(context, index, area, format, type, unpack, pixels, 0);
-}
-
-gl::Error TextureD3D_Cube::setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t level,
- 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
- size_t faceIndex = gl::CubeMapTextureTargetToLayerIndex(target);
-
- ANGLE_TRY(redefineImage(context, static_cast<int>(faceIndex), static_cast<GLint>(level),
- internalFormat, size, false));
-
- gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast<GLint>(level));
- return setCompressedImageImpl(context, index, unpack, pixels, 0);
-}
-
-gl::Error TextureD3D_Cube::setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels)
-{
- ASSERT(area.depth == 1 && area.z == 0);
-
- gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast<GLint>(level));
-
- ANGLE_TRY(TextureD3D::subImageCompressed(context, index, area, format, unpack, pixels, 0));
- return commitRegion(context, index, area);
-}
-
-gl::Error TextureD3D_Cube::copyImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- const gl::Rectangle &origSourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source)
-{
- int faceIndex = static_cast<int>(gl::CubeMapTextureTargetToLayerIndex(target));
- const gl::InternalFormat &internalFormatInfo =
- gl::GetInternalFormatInfo(internalFormat, GL_UNSIGNED_BYTE);
-
- GLint level = static_cast<GLint>(imageLevel);
-
- gl::Extents size(origSourceArea.width, origSourceArea.height, 1);
- ANGLE_TRY(redefineImage(context, static_cast<int>(faceIndex), level,
- internalFormatInfo.sizedInternalFormat, size, false));
-
- gl::Extents fbSize = source->getReadColorbuffer()->getSize();
-
- // Does the read area extend beyond the framebuffer?
- bool outside = origSourceArea.x < 0 || origSourceArea.y < 0 ||
- origSourceArea.x + origSourceArea.width > fbSize.width ||
- origSourceArea.y + origSourceArea.height > fbSize.height;
-
- // In WebGL mode we need to zero the texture outside the framebuffer.
- // If we have robust resource init, it was already zeroed by redefineImage() above, otherwise
- // zero it explicitly.
- // TODO(fjhenigman): When robust resource is fully implemented look into making it a
- // prerequisite for WebGL and deleting this code.
- if (outside && context->getExtensions().webglCompatibility &&
- !context->isRobustResourceInitEnabled())
- {
- angle::MemoryBuffer *zero;
- ANGLE_TRY(context->getZeroFilledBuffer(
- origSourceArea.width * origSourceArea.height * internalFormatInfo.pixelBytes, &zero));
- gl::PixelUnpackState unpack;
- unpack.alignment = 1;
- ANGLE_TRY(setImage(context, target, imageLevel, internalFormat, size,
- internalFormatInfo.format, internalFormatInfo.type, unpack,
- zero->data()));
- }
-
- gl::Rectangle sourceArea;
- if (!ClipRectangle(origSourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height),
- &sourceArea))
- {
- // Empty source area, nothing to do.
- return gl::NoError();
- }
-
- gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
- gl::Offset destOffset(sourceArea.x - origSourceArea.x, sourceArea.y - origSourceArea.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->getWorkarounds().zeroMaxLodWorkaround)
- {
- ANGLE_TRY(mImageArray[faceIndex][level]->copyFromFramebuffer(context, destOffset,
- sourceArea, source));
- mDirtyImages = true;
- }
- else
- {
- ANGLE_TRY(ensureRenderTarget(context));
-
- ASSERT(size.width == size.height);
-
- if (size.width > 0 && isValidFaceLevel(faceIndex, level))
- {
- ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, level));
- ANGLE_TRY(mRenderer->copyImageCube(context, source, sourceArea, internalFormat,
- destOffset, mTexStorage, target, level));
- }
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_Cube::copySubImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- const gl::Offset &origDestOffset,
- const gl::Rectangle &origSourceArea,
- const gl::Framebuffer *source)
-{
- gl::Extents fbSize = source->getReadColorbuffer()->getSize();
- gl::Rectangle sourceArea;
- if (!ClipRectangle(origSourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height),
- &sourceArea))
- {
- return gl::NoError();
- }
- const gl::Offset destOffset(origDestOffset.x + sourceArea.x - origSourceArea.x,
- origDestOffset.y + sourceArea.y - origSourceArea.y, 0);
-
- int faceIndex = static_cast<int>(gl::CubeMapTextureTargetToLayerIndex(target));
-
- GLint level = static_cast<GLint>(imageLevel);
- gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
-
- // If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders,
- // so we should use the non-rendering copy path.
- if (!canCreateRenderTargetForImage(index) || mRenderer->getWorkarounds().zeroMaxLodWorkaround)
- {
- ANGLE_TRY(mImageArray[faceIndex][level]->copyFromFramebuffer(context, destOffset,
- sourceArea, source));
- mDirtyImages = true;
- }
- else
- {
- ANGLE_TRY(ensureRenderTarget(context));
- if (isValidFaceLevel(faceIndex, level))
- {
- ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, level));
- ANGLE_TRY(mRenderer->copyImageCube(context, source, sourceArea,
- gl::GetUnsizedFormat(getBaseLevelInternalFormat()),
- destOffset, mTexStorage, target, level));
- }
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_Cube::copyTexture(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- GLenum type,
- size_t sourceLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const gl::Texture *source)
-{
- ASSERT(gl::IsCubeMapTextureTarget(target));
-
- GLenum sourceTarget = source->getTarget();
-
- GLint destLevel = static_cast<GLint>(level);
- int faceIndex = static_cast<int>(gl::CubeMapTextureTargetToLayerIndex(target));
-
- 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, destLevel, internalFormatInfo.sizedInternalFormat,
- size, false));
-
- gl::Rectangle sourceRect(0, 0, size.width, size.height);
- gl::Offset destOffset(0, 0, 0);
-
- if (!isSRGB(destLevel, faceIndex) &&
- canCreateRenderTargetForImage(gl::ImageIndex::MakeCube(target, destLevel)))
- {
- ANGLE_TRY(ensureRenderTarget(context));
- ASSERT(isValidFaceLevel(faceIndex, destLevel));
- ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, destLevel));
-
- ANGLE_TRY(mRenderer->copyTexture(context, source, static_cast<GLint>(sourceLevel),
- sourceRect, internalFormatInfo.format, destOffset,
- mTexStorage, target, destLevel, 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));
-
- gl::ImageIndex destImageIndex =
- gl::ImageIndex::MakeCube(target, static_cast<GLint>(destLevel));
- ImageD3D *destImage = nullptr;
- ANGLE_TRY(getImageAndSyncFromStorage(context, destImageIndex, &destImage));
-
- ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceRect, destOffset,
- unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
-
- mDirtyImages = true;
-
- gl::Box destRegion(destOffset, size);
- ANGLE_TRY(commitRegion(context, destImageIndex, destRegion));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_Cube::copySubTexture(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- size_t sourceLevel,
- const gl::Rectangle &sourceArea,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const gl::Texture *source)
-{
- ASSERT(gl::IsCubeMapTextureTarget(target));
-
- GLint destLevel = static_cast<GLint>(level);
- int faceIndex = static_cast<int>(gl::CubeMapTextureTargetToLayerIndex(target));
-
- if (!isSRGB(destLevel, faceIndex) &&
- canCreateRenderTargetForImage(gl::ImageIndex::MakeCube(target, destLevel)))
- {
- ANGLE_TRY(ensureRenderTarget(context));
- ASSERT(isValidFaceLevel(faceIndex, destLevel));
- ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, destLevel));
-
- ANGLE_TRY(mRenderer->copyTexture(
- context, source, static_cast<GLint>(sourceLevel), sourceArea,
- gl::GetUnsizedFormat(getInternalFormat(destLevel, faceIndex)), destOffset, mTexStorage,
- target, destLevel, 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));
-
- gl::ImageIndex destImageIndex =
- gl::ImageIndex::MakeCube(target, static_cast<GLint>(destLevel));
- ImageD3D *destImage = nullptr;
- ANGLE_TRY(getImageAndSyncFromStorage(context, destImageIndex, &destImage));
-
- ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceArea, destOffset,
- unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
-
- mDirtyImages = true;
-
- gl::Box destRegion(destOffset.x, destOffset.y, 0, sourceArea.width, sourceArea.height, 1);
- ANGLE_TRY(commitRegion(context, destImageIndex, destRegion));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_Cube::setStorage(const gl::Context *context,
- GLenum target,
- 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 (int faceIndex = 0; faceIndex < 6; faceIndex++)
- {
- mImageArray[faceIndex][level]->redefine(GL_TEXTURE_CUBE_MAP, internalFormat, gl::Extents(mipSize, mipSize, 1), true);
- }
- }
-
- for (size_t level = levels; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
- {
- for (int faceIndex = 0; faceIndex < 6; faceIndex++)
- {
- mImageArray[faceIndex][level]->redefine(GL_TEXTURE_CUBE_MAP, 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 gl::NoError();
-}
-
-// 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 (int faceIndex = 1; faceIndex < 6; faceIndex++)
- {
- const ImageD3D &faceBaseImage = *mImageArray[faceIndex][getBaseLevel()];
-
- if (faceBaseImage.getWidth() != baseWidth ||
- faceBaseImage.getHeight() != baseHeight ||
- faceBaseImage.getInternalFormat() != baseFormat )
- {
- return false;
- }
- }
-
- return true;
-}
-
-gl::Error TextureD3D_Cube::bindTexImage(const gl::Context *context, egl::Surface *surface)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_Cube::releaseTexImage(const gl::Context *context)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error 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 (int faceIndex = 0; faceIndex < 6; 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 gl::NoError();
-}
-
-gl::Error TextureD3D_Cube::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
-{
- ASSERT(gl::IsCubeMapTextureTarget(index.type));
-
- // ensure the underlying texture is created
- ANGLE_TRY(ensureRenderTarget(context));
- ANGLE_TRY(updateStorageFaceLevel(context, index.layerIndex, index.mipIndex));
-
- return mTexStorage->getRenderTarget(context, index, outRT);
-}
-
-gl::Error 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 gl::NoError();
- }
-
- // do not attempt to create storage for nonexistant data
- if (!isFaceLevelComplete(0, getBaseLevel()))
- {
- return gl::NoError();
- }
-
- 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 gl::NoError();
-}
-
-gl::Error 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->getWorkarounds().zeroMaxLodWorkaround)
- {
- // 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 (int faceIndex = 0; faceIndex < 6 && 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 gl::NoError();
-}
-
-gl::Error TextureD3D_Cube::setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage)
-{
- if (newCompleteTexStorage && newCompleteTexStorage->isManaged())
- {
- for (int faceIndex = 0; faceIndex < 6; 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 gl::NoError();
-}
-
-gl::Error TextureD3D_Cube::updateStorage(const gl::Context *context)
-{
- if (!mDirtyImages)
- {
- return gl::NoError();
- }
-
- ASSERT(mTexStorage != nullptr);
- GLint storageLevels = mTexStorage->getLevelCount();
- for (int face = 0; face < 6; 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 gl::NoError();
-}
-
-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 && faceIndex < 6 && level < static_cast<int>(mImageArray[faceIndex].size()) &&
- mImageArray[faceIndex][level] != nullptr);
-
- if (isImmutable())
- {
- return true;
- }
-
- int levelZeroSize = getLevelZeroWidth();
-
- if (levelZeroSize <= 0)
- {
- return false;
- }
-
- // "isCubeComplete" checks for base level completeness and we must call that
- // to determine if any face at level 0 is complete. We omit that check here
- // to avoid re-checking cube-completeness for every face at level 0.
- if (level == 0)
- {
- return true;
- }
-
- // Check that non-zero levels are consistent with the base level.
- const 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.layerIndex, index.mipIndex);
-}
-
-gl::Error TextureD3D_Cube::updateStorageFaceLevel(const gl::Context *context,
- int faceIndex,
- int level)
-{
- ASSERT(level >= 0 && faceIndex < 6 && level < static_cast<int>(mImageArray[faceIndex].size()) &&
- mImageArray[faceIndex][level] != nullptr);
- ImageD3D *image = mImageArray[faceIndex][level].get();
-
- if (image->isDirty())
- {
- GLenum faceTarget = gl::LayerIndexToCubeMapTextureTarget(faceIndex);
- gl::ImageIndex index = gl::ImageIndex::MakeCube(faceTarget, level);
- gl::Box region(0, 0, 0, image->getWidth(), image->getHeight(), 1);
- ANGLE_TRY(commitRegion(context, index, region));
- }
-
- return gl::NoError();
-}
-
-gl::Error 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_TEXTURE_CUBE_MAP, 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 gl::NoError();
-}
-
-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::MakeCube(gl::LayerIndexToCubeMapTextureTarget(layer), mip);
-}
-
-bool TextureD3D_Cube::isValidIndex(const gl::ImageIndex &index) const
-{
- return (mTexStorage && gl::IsCubeMapTextureTarget(index.type) &&
- index.mipIndex >= 0 && index.mipIndex < mTexStorage->getLevelCount());
-}
-
-void TextureD3D_Cube::markAllImagesDirty()
-{
- for (int dirtyLevel = 0; dirtyLevel < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; dirtyLevel++)
- {
- for (int dirtyFace = 0; dirtyFace < 6; 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());
- }
-}
-
-gl::Error 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.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
- ASSERT(!index.hasLayer());
- ASSERT(index.type == GL_TEXTURE_3D);
- return mImageArray[index.mipIndex].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;
-}
-
-gl::Error TextureD3D_3D::setEGLImageTarget(const gl::Context *context,
- GLenum target,
- egl::Image *image)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_3D::setImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- GLenum internalFormat,
- const gl::Extents &size,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels)
-{
- ASSERT(target == GL_TEXTURE_3D);
- const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type);
-
- GLint level = static_cast<GLint>(imageLevel);
- ANGLE_TRY(redefineImage(context, level, internalFormatInfo.sizedInternalFormat, size, false));
-
- bool fastUnpacked = false;
-
- gl::ImageIndex index = gl::ImageIndex::Make3D(level);
-
- // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer
- gl::Buffer *unpackBuffer =
- context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
- if (isFastUnpackable(unpackBuffer, internalFormatInfo.sizedInternalFormat) && !size.empty() &&
- isLevelComplete(level))
- {
- // 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(level), getHeight(level), getDepth(level));
-
- ANGLE_TRY(fastUnpackPixels(context, unpack, pixels, destArea,
- internalFormatInfo.sizedInternalFormat, type, destRenderTarget));
-
- // Ensure we don't overwrite our newly initialized data
- mImageArray[level]->markClean();
-
- fastUnpacked = true;
- }
-
- if (!fastUnpacked)
- {
- ANGLE_TRY(setImageImpl(context, index, type, unpack, pixels, 0));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_3D::setSubImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels)
-{
- ASSERT(target == GL_TEXTURE_3D);
-
- GLint level = static_cast<GLint>(imageLevel);
- gl::ImageIndex index = gl::ImageIndex::Make3D(level);
-
- // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer
- gl::Buffer *unpackBuffer =
- context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
- if (isFastUnpackable(unpackBuffer, getInternalFormat(level)) && isLevelComplete(level))
- {
- RenderTargetD3D *destRenderTarget = nullptr;
- ANGLE_TRY(getRenderTarget(context, index, &destRenderTarget));
- ASSERT(!mImageArray[level]->isDirty());
-
- return fastUnpackPixels(context, unpack, pixels, area, getInternalFormat(level), type,
- destRenderTarget);
- }
- else
- {
- return TextureD3D::subImage(context, index, area, format, type, unpack, pixels, 0);
- }
-}
-
-gl::Error TextureD3D_3D::setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- GLenum internalFormat,
- const gl::Extents &size,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels)
-{
- ASSERT(target == GL_TEXTURE_3D);
-
- GLint level = static_cast<GLint>(imageLevel);
- // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
- ANGLE_TRY(redefineImage(context, level, internalFormat, size, false));
-
- gl::ImageIndex index = gl::ImageIndex::Make3D(level);
- return setCompressedImageImpl(context, index, unpack, pixels, 0);
-}
-
-gl::Error TextureD3D_3D::setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels)
-{
- ASSERT(target == GL_TEXTURE_3D);
-
- gl::ImageIndex index = gl::ImageIndex::Make3D(static_cast<GLint>(level));
- ANGLE_TRY(TextureD3D::subImageCompressed(context, index, area, format, unpack, pixels, 0));
- return commitRegion(context, index, area);
-}
-
-gl::Error TextureD3D_3D::copyImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Rectangle &sourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source)
-{
- UNIMPLEMENTED();
- return gl::InternalError() << "Copying 3D textures is unimplemented.";
-}
-
-gl::Error TextureD3D_3D::copySubImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source)
-{
- ASSERT(target == GL_TEXTURE_3D);
-
- GLint level = static_cast<GLint>(imageLevel);
-
- gl::Extents fbSize = source->getReadColorbuffer()->getSize();
- gl::Rectangle clippedSourceArea;
- if (!ClipRectangle(sourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height),
- &clippedSourceArea))
- {
- return gl::NoError();
- }
- 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(level);
- if (syncTexStorage)
- {
- gl::ImageIndex index = gl::ImageIndex::Make3D(level);
- ANGLE_TRY(mImageArray[level]->copyFromTexStorage(context, index, mTexStorage));
- }
- ANGLE_TRY(mImageArray[level]->copyFromFramebuffer(context, clippedDestOffset, clippedSourceArea,
- source));
- mDirtyImages = true;
-
- if (syncTexStorage)
- {
- ANGLE_TRY(updateStorageLevel(context, level));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_3D::setStorage(const gl::Context *context,
- GLenum target,
- size_t levels,
- GLenum internalFormat,
- const gl::Extents &size)
-{
- ASSERT(target == GL_TEXTURE_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_TEXTURE_3D, internalFormat, levelSize, true);
- }
-
- for (size_t level = levels; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
- {
- mImageArray[level]->redefine(GL_TEXTURE_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 gl::NoError();
-}
-
-gl::Error TextureD3D_3D::bindTexImage(const gl::Context *context, egl::Surface *surface)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_3D::releaseTexImage(const gl::Context *context)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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.mipIndex));
- }
-
- return mTexStorage->getRenderTarget(context, index, outRT);
-}
-
-gl::Error 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 gl::NoError();
- }
-
- // do not attempt to create storage for nonexistant data
- if (!isLevelComplete(getBaseLevel()))
- {
- return gl::NoError();
- }
-
- 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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error TextureD3D_3D::updateStorage(const gl::Context *context)
-{
- if (!mDirtyImages)
- {
- return gl::NoError();
- }
-
- 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 gl::NoError();
-}
-
-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.mipIndex);
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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_TEXTURE_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 gl::NoError();
-}
-
-gl::ImageIndexIterator TextureD3D_3D::imageIterator() const
-{
- return gl::ImageIndexIterator::Make3D(0, mTexStorage->getLevelCount(),
- gl::ImageIndex::ENTIRE_LEVEL, gl::ImageIndex::ENTIRE_LEVEL);
-}
-
-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.type == GL_TEXTURE_3D &&
- index.mipIndex >= 0 && index.mipIndex < 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;
- }
-}
-
-gl::Error 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.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
- ASSERT(index.layerIndex != gl::ImageIndex::ENTIRE_LEVEL);
- ASSERT((index.layerIndex == 0 && mLayerCounts[index.mipIndex] == 0) ||
- index.layerIndex < mLayerCounts[index.mipIndex]);
- ASSERT(index.type == GL_TEXTURE_2D_ARRAY);
- return (mImageArray[index.mipIndex] ? mImageArray[index.mipIndex][index.layerIndex] : 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;
-}
-
-gl::Error TextureD3D_2DArray::setEGLImageTarget(const gl::Context *context,
- GLenum target,
- egl::Image *image)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_2DArray::setImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- GLenum internalFormat,
- const gl::Extents &size,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels)
-{
- ASSERT(target == GL_TEXTURE_2D_ARRAY);
-
- const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat, type);
-
- GLint level = static_cast<GLint>(imageLevel);
- ANGLE_TRY(redefineImage(context, level, formatInfo.sizedInternalFormat, size, false));
-
- GLsizei inputDepthPitch = 0;
- ANGLE_TRY_RESULT(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 index = gl::ImageIndex::Make2DArray(level, i);
- ANGLE_TRY(setImageImpl(context, index, type, unpack, pixels, layerOffset));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2DArray::setSubImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels)
-{
- ASSERT(target == GL_TEXTURE_2D_ARRAY);
- GLint level = static_cast<GLint>(imageLevel);
- const gl::InternalFormat &formatInfo =
- gl::GetInternalFormatInfo(getInternalFormat(level), type);
- GLsizei inputDepthPitch = 0;
- ANGLE_TRY_RESULT(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 index = gl::ImageIndex::Make2DArray(level, layer);
- ANGLE_TRY(TextureD3D::subImage(context, index, layerArea, format, type, unpack, pixels,
- layerOffset));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2DArray::setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- GLenum internalFormat,
- const gl::Extents &size,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels)
-{
- ASSERT(target == GL_TEXTURE_2D_ARRAY);
-
- GLint level = static_cast<GLint>(imageLevel);
- // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
- ANGLE_TRY(redefineImage(context, level, internalFormat, size, false));
-
- const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalFormat);
- GLsizei inputDepthPitch = 0;
- ANGLE_TRY_RESULT(
- 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 index = gl::ImageIndex::Make2DArray(level, i);
- ANGLE_TRY(setCompressedImageImpl(context, index, unpack, pixels, layerOffset));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2DArray::setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels)
-{
- ASSERT(target == GL_TEXTURE_2D_ARRAY);
-
- const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(format);
- GLsizei inputDepthPitch = 0;
- ANGLE_TRY_RESULT(
- 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 index = gl::ImageIndex::Make2DArray(static_cast<GLint>(level), layer);
- ANGLE_TRY(TextureD3D::subImageCompressed(context, index, layerArea, format, unpack, pixels,
- layerOffset));
- ANGLE_TRY(commitRegion(context, index, layerArea));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2DArray::copyImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Rectangle &sourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source)
-{
- UNIMPLEMENTED();
- return gl::InternalError() << "Copying 2D array textures is unimplemented.";
-}
-
-gl::Error TextureD3D_2DArray::copySubImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source)
-{
- ASSERT(target == GL_TEXTURE_2D_ARRAY);
-
- GLint level = static_cast<GLint>(imageLevel);
- gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, destOffset.z);
-
- gl::Extents fbSize = source->getReadColorbuffer()->getSize();
- gl::Rectangle clippedSourceArea;
- if (!ClipRectangle(sourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height),
- &clippedSourceArea))
- {
- return gl::NoError();
- }
- 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[level][clippedDestOffset.z]->copyFromFramebuffer(
- context, destLayerOffset, clippedSourceArea, source));
- mDirtyImages = true;
- }
- else
- {
- ANGLE_TRY(ensureRenderTarget(context));
-
- if (isValidLevel(level))
- {
- ANGLE_TRY(updateStorageLevel(context, level));
- ANGLE_TRY(
- mRenderer->copyImage2DArray(context, source, clippedSourceArea,
- gl::GetUnsizedFormat(getInternalFormat(getBaseLevel())),
- clippedDestOffset, mTexStorage, level));
- }
- }
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2DArray::setStorage(const gl::Context *context,
- GLenum target,
- size_t levels,
- GLenum internalFormat,
- const gl::Extents &size)
-{
- ASSERT(target == GL_TEXTURE_2D_ARRAY);
-
- 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_TEXTURE_2D_ARRAY, 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 gl::NoError();
-}
-
-gl::Error TextureD3D_2DArray::bindTexImage(const gl::Context *context, egl::Surface *surface)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_2DArray::releaseTexImage(const gl::Context *context)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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.mipIndex));
- return mTexStorage->getRenderTarget(context, index, outRT);
-}
-
-gl::Error 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 gl::NoError();
- }
-
- // do not attempt to create storage for nonexistant data
- if (!isLevelComplete(getBaseLevel()))
- {
- return gl::NoError();
- }
-
- 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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error TextureD3D_2DArray::updateStorage(const gl::Context *context)
-{
- if (!mDirtyImages)
- {
- return gl::NoError();
- }
-
- 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 gl::NoError();
-}
-
-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.mipIndex);
-}
-
-gl::Error 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 gl::NoError();
-}
-
-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;
- }
-}
-
-gl::Error 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();
- 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_TEXTURE_2D_ARRAY, internalformat,
- gl::Extents(size.width, size.height, 1),
- forceRelease);
- mDirtyImages = mDirtyImages || mImageArray[level][layer]->isDirty();
- }
- }
-
- if (mTexStorage)
- {
- const GLenum storageFormat = getBaseLevelInternalFormat();
- 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 gl::NoError();
-}
-
-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.type != GL_TEXTURE_2D_ARRAY)
- {
- return false;
- }
-
- // Check the mip index
- if (index.mipIndex < 0 || index.mipIndex >= mTexStorage->getLevelCount())
- {
- return false;
- }
-
- // Check the layer index
- return (!index.hasLayer() || (index.layerIndex >= 0 && index.layerIndex < mLayerCounts[index.mipIndex]));
-}
-
-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;
-}
-
-TextureD3D_External::TextureD3D_External(const gl::TextureState &state, RendererD3D *renderer)
- : TextureD3D(state, renderer)
-{
-}
-
-TextureD3D_External::~TextureD3D_External()
-{
-}
-
-ImageD3D *TextureD3D_External::getImage(const gl::ImageIndex &index) const
-{
- UNREACHABLE();
- return nullptr;
-}
-
-GLsizei TextureD3D_External::getLayerCount(int level) const
-{
- return 1;
-}
-
-gl::Error TextureD3D_External::setImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- GLenum internalFormat,
- const gl::Extents &size,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels)
-{
- // Image setting is not supported for external images
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_External::setSubImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_External::setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- GLenum internalFormat,
- const gl::Extents &size,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_External::setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_External::copyImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- const gl::Rectangle &sourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_External::copySubImage(const gl::Context *context,
- GLenum target,
- size_t imageLevel,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_External::setStorage(const gl::Context *context,
- GLenum target,
- size_t levels,
- GLenum internalFormat,
- const gl::Extents &size)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_External::setImageExternal(const gl::Context *context,
- GLenum target,
- egl::Stream *stream,
- const egl::Stream::GLTextureDescription &desc)
-{
- ASSERT(target == GL_TEXTURE_EXTERNAL_OES);
-
- 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 gl::NoError();
-}
-
-gl::Error TextureD3D_External::bindTexImage(const gl::Context *context, egl::Surface *surface)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_External::releaseTexImage(const gl::Context *context)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_External::setEGLImageTarget(const gl::Context *context,
- GLenum target,
- 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 gl::NoError();
-}
-
-gl::Error TextureD3D_External::initMipmapImages(const gl::Context *context)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_External::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-bool TextureD3D_External::isImageComplete(const gl::ImageIndex &index) const
-{
- return (index.mipIndex == 0) ? (mTexStorage != nullptr) : false;
-}
-
-gl::Error TextureD3D_External::initializeStorage(const gl::Context *context, bool renderTarget)
-{
- // Texture storage is created when an external image is bound
- ASSERT(mTexStorage);
- return gl::NoError();
-}
-
-gl::Error TextureD3D_External::createCompleteStorage(bool renderTarget,
- TexStoragePointer *outStorage) const
-{
- UNREACHABLE();
- return gl::NoError();
-}
-
-gl::Error TextureD3D_External::setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage)
-{
- UNREACHABLE();
- return gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-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.type == GL_TEXTURE_EXTERNAL_OES && index.mipIndex == 0);
-}
-
-void TextureD3D_External::markAllImagesDirty()
-{
- UNREACHABLE();
-}
-
-TextureD3D_2DMultisample::TextureD3D_2DMultisample(const gl::TextureState &state,
- RendererD3D *renderer)
- : TextureD3D(state, renderer)
-{
-}
-
-TextureD3D_2DMultisample::~TextureD3D_2DMultisample()
-{
-}
-
-ImageD3D *TextureD3D_2DMultisample::getImage(const gl::ImageIndex &index) const
-{
- return nullptr;
-}
-
-gl::Error TextureD3D_2DMultisample::setImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_2DMultisample::setSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_2DMultisample::setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_2DMultisample::setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_2DMultisample::copyImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Rectangle &sourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_2DMultisample::copySubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureD3D_2DMultisample::setStorageMultisample(const gl::Context *context,
- GLenum target,
- GLsizei samples,
- GLint internalFormat,
- const gl::Extents &size,
- bool fixedSampleLocations)
-{
- ASSERT(target == GL_TEXTURE_2D_MULTISAMPLE && size.depth == 1);
-
- 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();
-
- ANGLE_TRY(updateStorage(context));
-
- mImmutable = false;
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2DMultisample::bindTexImage(const gl::Context *context, egl::Surface *surface)
-{
- UNREACHABLE();
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2DMultisample::releaseTexImage(const gl::Context *context)
-{
- UNREACHABLE();
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2DMultisample::setEGLImageTarget(const gl::Context *context,
- GLenum target,
- egl::Image *image)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error 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.type == GL_TEXTURE_2D_MULTISAMPLE && index.mipIndex == 0);
-}
-
-GLsizei TextureD3D_2DMultisample::getLayerCount(int level) const
-{
- return 1;
-}
-
-void TextureD3D_2DMultisample::markAllImagesDirty()
-{
-}
-
-gl::Error TextureD3D_2DMultisample::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 gl::NoError();
- }
-
- 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 gl::NoError();
-}
-
-gl::Error TextureD3D_2DMultisample::createCompleteStorage(bool renderTarget,
- TexStoragePointer *outStorage) const
-{
- outStorage->reset(mTexStorage);
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2DMultisample::setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage)
-{
- ANGLE_TRY(releaseTexStorage(context));
- mTexStorage = newCompleteTexStorage;
-
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2DMultisample::updateStorage(const gl::Context *context)
-{
- return gl::NoError();
-}
-
-gl::Error TextureD3D_2DMultisample::initMipmapImages(const gl::Context *context)
-{
- UNIMPLEMENTED();
- return gl::NoError();
-}
-
-bool TextureD3D_2DMultisample::isImageComplete(const gl::ImageIndex &index) const
-{
- return true;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureD3D.h
deleted file mode 100644
index eb206a6ccc..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureD3D.h
+++ /dev/null
@@ -1,891 +0,0 @@
-//
-// 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;
-
-template <typename T>
-using TexLevelsArray = std::array<T, gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS>;
-
-class TextureD3D : public TextureImpl
-{
- public:
- TextureD3D(const gl::TextureState &data, RendererD3D *renderer);
- ~TextureD3D() override;
-
- gl::Error onDestroy(const gl::Context *context) override;
-
- gl::Error 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;
-
- gl::Error getImageAndSyncFromStorage(const gl::Context *context,
- const gl::ImageIndex &index,
- ImageD3D **outImage);
-
- GLint getBaseLevelWidth() const;
- GLint getBaseLevelHeight() const;
- GLenum getBaseLevelInternalFormat() const;
-
- gl::Error setStorage(const gl::Context *context,
- GLenum target,
- size_t levels,
- GLenum internalFormat,
- const gl::Extents &size) override;
-
- gl::Error setStorageMultisample(const gl::Context *context,
- GLenum target,
- GLsizei samples,
- GLint internalFormat,
- const gl::Extents &size,
- bool fixedSampleLocations) override;
-
- bool isImmutable() const { return mImmutable; }
-
- virtual gl::Error 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;
-
- gl::Error setImageExternal(const gl::Context *context,
- GLenum target,
- egl::Stream *stream,
- const egl::Stream::GLTextureDescription &desc) override;
- gl::Error generateMipmap(const gl::Context *context) override;
- TextureStorage *getStorage();
- ImageD3D *getBaseLevelImage() const;
-
- gl::Error getAttachmentRenderTarget(const gl::Context *context,
- GLenum binding,
- const gl::ImageIndex &imageIndex,
- FramebufferAttachmentRenderTarget **rtOut) override;
-
- gl::Error setBaseLevel(const gl::Context *context, GLuint baseLevel) override;
-
- void syncState(const gl::Texture::DirtyBits &dirtyBits) override;
-
- gl::Error initializeContents(const gl::Context *context,
- const gl::ImageIndex &imageIndex) override;
-
- protected:
- gl::Error setImageImpl(const gl::Context *context,
- const gl::ImageIndex &index,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- ptrdiff_t layerOffset);
- gl::Error subImage(const gl::Context *context,
- const gl::ImageIndex &index,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- ptrdiff_t layerOffset);
- gl::Error setCompressedImageImpl(const gl::Context *context,
- const gl::ImageIndex &index,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- ptrdiff_t layerOffset);
- gl::Error 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);
- gl::Error 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 gl::Error 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;
- gl::Error ensureRenderTarget(const gl::Context *context);
-
- virtual gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outTexStorage) const = 0;
- virtual gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) = 0;
- gl::Error commitRegion(const gl::Context *context,
- const gl::ImageIndex &index,
- const gl::Box &region);
-
- gl::Error 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 gl::Error initializeStorage(const gl::Context *context, bool renderTarget) = 0;
-
- virtual gl::Error updateStorage(const gl::Context *context) = 0;
-
- bool shouldUseSetData(const ImageD3D *image) const;
-
- gl::Error 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;
-
- gl::Error 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;
-
- gl::Error setImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) override;
- gl::Error setSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) override;
-
- gl::Error setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) override;
- gl::Error setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) override;
-
- gl::Error copyImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Rectangle &sourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source) override;
- gl::Error copySubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source) override;
-
- gl::Error copyTexture(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- GLenum type,
- size_t sourceLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const gl::Texture *source) override;
- gl::Error copySubTexture(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- size_t sourceLevel,
- const gl::Rectangle &sourceArea,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const gl::Texture *source) override;
- gl::Error copyCompressedTexture(const gl::Context *context, const gl::Texture *source) override;
-
- gl::Error setStorage(const gl::Context *context,
- GLenum target,
- size_t levels,
- GLenum internalFormat,
- const gl::Extents &size) override;
-
- gl::Error bindTexImage(const gl::Context *context, egl::Surface *surface) override;
- gl::Error releaseTexImage(const gl::Context *context) override;
-
- gl::Error setEGLImageTarget(const gl::Context *context,
- GLenum target,
- egl::Image *image) override;
-
- gl::Error 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:
- gl::Error initializeStorage(const gl::Context *context, bool renderTarget) override;
- gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outTexStorage) const override;
- gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) override;
-
- gl::Error updateStorage(const gl::Context *context) override;
- gl::Error initMipmapImages(const gl::Context *context) override;
-
- bool isValidLevel(int level) const;
- bool isLevelComplete(int level) const;
- bool isImageComplete(const gl::ImageIndex &index) const override;
-
- gl::Error updateStorageLevel(const gl::Context *context, int level);
-
- gl::Error redefineImage(const gl::Context *context,
- size_t level,
- GLenum internalformat,
- const gl::Extents &size,
- bool forceRelease);
-
- bool mEGLImageTarget;
- TexLevelsArray<std::unique_ptr<ImageD3D>> mImageArray;
-};
-
-class TextureD3D_Cube : public TextureD3D
-{
- public:
- TextureD3D_Cube(const gl::TextureState &data, RendererD3D *renderer);
- ~TextureD3D_Cube() override;
-
- gl::Error 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;
-
- gl::Error setImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) override;
- gl::Error setSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) override;
-
- gl::Error setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) override;
- gl::Error setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) override;
-
- gl::Error copyImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Rectangle &sourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source) override;
- gl::Error copySubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source) override;
-
- gl::Error copyTexture(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- GLenum type,
- size_t sourceLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const gl::Texture *source) override;
- gl::Error copySubTexture(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- size_t sourceLevel,
- const gl::Rectangle &sourceArea,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const gl::Texture *source) override;
-
- gl::Error setStorage(const gl::Context *context,
- GLenum target,
- size_t levels,
- GLenum internalFormat,
- const gl::Extents &size) override;
-
- gl::Error bindTexImage(const gl::Context *context, egl::Surface *surface) override;
- gl::Error releaseTexImage(const gl::Context *context) override;
-
- gl::Error setEGLImageTarget(const gl::Context *context,
- GLenum target,
- egl::Image *image) override;
-
- gl::Error 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:
- gl::Error initializeStorage(const gl::Context *context, bool renderTarget) override;
- gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outTexStorage) const override;
- gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) override;
-
- gl::Error updateStorage(const gl::Context *context) override;
- gl::Error 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;
- gl::Error updateStorageFaceLevel(const gl::Context *context, int faceIndex, int level);
-
- gl::Error redefineImage(const gl::Context *context,
- int faceIndex,
- GLint level,
- GLenum internalformat,
- const gl::Extents &size,
- bool forceRelease);
-
- std::array<TexLevelsArray<std::unique_ptr<ImageD3D>>, 6> mImageArray;
-};
-
-class TextureD3D_3D : public TextureD3D
-{
- public:
- TextureD3D_3D(const gl::TextureState &data, RendererD3D *renderer);
- ~TextureD3D_3D() override;
-
- gl::Error 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;
-
- gl::Error setImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) override;
- gl::Error setSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) override;
-
- gl::Error setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) override;
- gl::Error setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) override;
-
- gl::Error copyImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Rectangle &sourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source) override;
- gl::Error copySubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source) override;
-
- gl::Error setStorage(const gl::Context *context,
- GLenum target,
- size_t levels,
- GLenum internalFormat,
- const gl::Extents &size) override;
-
- gl::Error bindTexImage(const gl::Context *context, egl::Surface *surface) override;
- gl::Error releaseTexImage(const gl::Context *context) override;
-
- gl::Error setEGLImageTarget(const gl::Context *context,
- GLenum target,
- egl::Image *image) override;
-
- gl::Error 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:
- gl::Error initializeStorage(const gl::Context *context, bool renderTarget) override;
- gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outStorage) const override;
- gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) override;
-
- gl::Error updateStorage(const gl::Context *context) override;
- gl::Error initMipmapImages(const gl::Context *context) override;
-
- bool isValidLevel(int level) const;
- bool isLevelComplete(int level) const;
- bool isImageComplete(const gl::ImageIndex &index) const override;
- gl::Error updateStorageLevel(const gl::Context *context, int level);
-
- gl::Error redefineImage(const gl::Context *context,
- GLint level,
- GLenum internalformat,
- const gl::Extents &size,
- bool forceRelease);
-
- TexLevelsArray<std::unique_ptr<ImageD3D>> mImageArray;
-};
-
-class TextureD3D_2DArray : public TextureD3D
-{
- public:
- TextureD3D_2DArray(const gl::TextureState &data, RendererD3D *renderer);
- ~TextureD3D_2DArray() override;
-
- gl::Error 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;
-
- gl::Error setImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) override;
- gl::Error setSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) override;
-
- gl::Error setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) override;
- gl::Error setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) override;
-
- gl::Error copyImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Rectangle &sourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source) override;
- gl::Error copySubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source) override;
-
- gl::Error setStorage(const gl::Context *context,
- GLenum target,
- size_t levels,
- GLenum internalFormat,
- const gl::Extents &size) override;
-
- gl::Error bindTexImage(const gl::Context *context, egl::Surface *surface) override;
- gl::Error releaseTexImage(const gl::Context *context) override;
-
- gl::Error setEGLImageTarget(const gl::Context *context,
- GLenum target,
- egl::Image *image) override;
-
- gl::Error 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:
- gl::Error initializeStorage(const gl::Context *context, bool renderTarget) override;
- gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outStorage) const override;
- gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) override;
-
- gl::Error updateStorage(const gl::Context *context) override;
- gl::Error initMipmapImages(const gl::Context *context) override;
-
- bool isValidLevel(int level) const;
- bool isLevelComplete(int level) const;
- bool isImageComplete(const gl::ImageIndex &index) const override;
- gl::Error updateStorageLevel(const gl::Context *context, int level);
-
- void deleteImages();
- gl::Error 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];
-};
-
-class TextureD3D_External : public TextureD3D
-{
- public:
- TextureD3D_External(const gl::TextureState &data, RendererD3D *renderer);
- ~TextureD3D_External() override;
-
- ImageD3D *getImage(const gl::ImageIndex &index) const override;
- GLsizei getLayerCount(int level) const override;
-
- gl::Error setImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) override;
- gl::Error setSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) override;
-
- gl::Error setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) override;
- gl::Error setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) override;
-
- gl::Error copyImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Rectangle &sourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source) override;
- gl::Error copySubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source) override;
-
- gl::Error setStorage(const gl::Context *context,
- GLenum target,
- size_t levels,
- GLenum internalFormat,
- const gl::Extents &size) override;
-
- gl::Error setImageExternal(const gl::Context *context,
- GLenum target,
- egl::Stream *stream,
- const egl::Stream::GLTextureDescription &desc) override;
-
- gl::Error bindTexImage(const gl::Context *context, egl::Surface *surface) override;
- gl::Error releaseTexImage(const gl::Context *context) override;
-
- gl::Error setEGLImageTarget(const gl::Context *context,
- GLenum target,
- egl::Image *image) override;
-
- gl::Error 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:
- gl::Error initializeStorage(const gl::Context *context, bool renderTarget) override;
- gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outTexStorage) const override;
- gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) override;
-
- gl::Error updateStorage(const gl::Context *context) override;
- gl::Error initMipmapImages(const gl::Context *context) override;
-
- bool isImageComplete(const gl::ImageIndex &index) const override;
-};
-
-class TextureD3D_2DMultisample : public TextureD3D
-{
- public:
- TextureD3D_2DMultisample(const gl::TextureState &data, RendererD3D *renderer);
- ~TextureD3D_2DMultisample() override;
-
- ImageD3D *getImage(const gl::ImageIndex &index) const override;
- gl::Error setImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) override;
- gl::Error setSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels) override;
-
- gl::Error setCompressedImage(const gl::Context *context,
- GLenum target,
- size_t level,
- GLenum internalFormat,
- const gl::Extents &size,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) override;
- gl::Error setCompressedSubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- size_t imageSize,
- const uint8_t *pixels) override;
-
- gl::Error copyImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Rectangle &sourceArea,
- GLenum internalFormat,
- const gl::Framebuffer *source) override;
- gl::Error copySubImage(const gl::Context *context,
- GLenum target,
- size_t level,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source) override;
-
- gl::Error setStorageMultisample(const gl::Context *context,
- GLenum target,
- GLsizei samples,
- GLint internalFormat,
- const gl::Extents &size,
- bool fixedSampleLocations) override;
-
- gl::Error bindTexImage(const gl::Context *context, egl::Surface *surface) override;
- gl::Error releaseTexImage(const gl::Context *context) override;
-
- gl::Error setEGLImageTarget(const gl::Context *context,
- GLenum target,
- egl::Image *image) override;
-
- gl::Error 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;
-
- private:
- gl::Error initializeStorage(const gl::Context *context, bool renderTarget) override;
- gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outTexStorage) const override;
- gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) override;
-
- gl::Error updateStorage(const gl::Context *context) override;
- gl::Error initMipmapImages(const gl::Context *context) override;
-
- bool isImageComplete(const gl::ImageIndex &index) const override;
-};
-}
-
-#endif // LIBANGLE_RENDERER_D3D_TEXTURED3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureStorage.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureStorage.h
deleted file mode 100644
index 383fbc2141..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureStorage.h
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// 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;
-struct ImageIndex;
-struct Box;
-struct PixelUnpackState;
-} // namespace gl
-
-namespace rx
-{
-class SwapChainD3D;
-class RenderTargetD3D;
-class ImageD3D;
-
-class TextureStorage : angle::NonCopyable
-{
- public:
- TextureStorage() {}
- virtual ~TextureStorage() {}
-
- virtual gl::Error 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 gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) = 0;
- virtual gl::Error generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex) = 0;
-
- virtual gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) = 0;
- virtual gl::Error 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 gl::Error useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture);
-};
-
-inline gl::Error TextureStorage::onDestroy(const gl::Context *context)
-{
- return gl::NoError();
-}
-
-inline gl::Error TextureStorage::useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture)
-{
- return gl::NoError();
-}
-
-using TexStoragePointer = angle::UniqueObjectPointer<TextureStorage, gl::Context>;
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexBuffer.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexBuffer.cpp
deleted file mode 100644
index 7c2d5aec70..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexBuffer.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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/renderer/d3d/BufferD3D.h"
-#include "libANGLE/renderer/d3d/RendererD3D.h"
-#include "libANGLE/VertexAttribute.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();
- }
-}
-
-unsigned int VertexBufferInterface::getSerial() const
-{
- return mVertexBuffer->getSerial();
-}
-
-unsigned int VertexBufferInterface::getBufferSize() const
-{
- return mVertexBuffer->getBufferSize();
-}
-
-gl::Error VertexBufferInterface::setBufferSize(unsigned int size)
-{
- if (mVertexBuffer->getBufferSize() == 0)
- {
- return mVertexBuffer->initialize(size, mDynamic);
- }
-
- return mVertexBuffer->setBufferSize(size);
-}
-
-gl::ErrorOrResult<unsigned int> VertexBufferInterface::getSpaceRequired(
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLsizei count,
- GLsizei instances) const
-{
- unsigned int spaceRequired = 0;
- ANGLE_TRY_RESULT(mFactory->getVertexSpaceRequired(attrib, binding, count, instances),
- spaceRequired);
-
- // Align to 16-byte boundary
- unsigned int alignedSpaceRequired = roundUp(spaceRequired, 16u);
-
- if (alignedSpaceRequired < spaceRequired)
- {
- return gl::OutOfMemory()
- << "Vertex buffer overflow in VertexBufferInterface::getSpaceRequired.";
- }
-
- return alignedSpaceRequired;
-}
-
-gl::Error VertexBufferInterface::discard()
-{
- return mVertexBuffer->discard();
-}
-
-VertexBuffer *VertexBufferInterface::getVertexBuffer() const
-{
- return mVertexBuffer;
-}
-
-// StreamingVertexBufferInterface Implementation
-StreamingVertexBufferInterface::StreamingVertexBufferInterface(BufferFactoryD3D *factory,
- std::size_t initialSize)
- : VertexBufferInterface(factory, true), mWritePosition(0), mReservedSpace(0)
-{
- // TODO(jmadill): Make an initialize method that can return an error.
- ANGLE_SWALLOW_ERR(setBufferSize(static_cast<unsigned int>(initialSize)));
-}
-
-StreamingVertexBufferInterface::~StreamingVertexBufferInterface()
-{
-}
-
-gl::Error StreamingVertexBufferInterface::reserveSpace(unsigned int size)
-{
- unsigned int curBufferSize = getBufferSize();
- if (size > curBufferSize)
- {
- ANGLE_TRY(setBufferSize(std::max(size, 3 * curBufferSize / 2)));
- mWritePosition = 0;
- }
- else if (mWritePosition + size > curBufferSize)
- {
- ANGLE_TRY(discard());
- mWritePosition = 0;
- }
-
- return gl::NoError();
-}
-
-gl::Error StreamingVertexBufferInterface::storeDynamicAttribute(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- GLsizei count,
- GLsizei instances,
- unsigned int *outStreamOffset,
- const uint8_t *sourceData)
-{
- unsigned int spaceRequired = 0;
- ANGLE_TRY_RESULT(getSpaceRequired(attrib, binding, count, instances), spaceRequired);
-
- // Protect against integer overflow
- angle::CheckedNumeric<unsigned int> checkedPosition(mWritePosition);
- checkedPosition += spaceRequired;
- if (!checkedPosition.IsValid())
- {
- return gl::OutOfMemory()
- << "Internal error, new vertex buffer write position would overflow.";
- }
-
- ANGLE_TRY(reserveSpace(mReservedSpace));
- mReservedSpace = 0;
-
- ANGLE_TRY(mVertexBuffer->storeVertexAttributes(attrib, binding, currentValueType, start, count,
- instances, mWritePosition, sourceData));
-
- if (outStreamOffset)
- {
- *outStreamOffset = mWritePosition;
- }
-
- mWritePosition += spaceRequired;
-
- return gl::NoError();
-}
-
-gl::Error StreamingVertexBufferInterface::reserveVertexSpace(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLsizei count,
- GLsizei instances)
-{
- unsigned int requiredSpace = 0;
- ANGLE_TRY_RESULT(mFactory->getVertexSpaceRequired(attrib, binding, count, instances),
- requiredSpace);
-
- // Align to 16-byte boundary
- auto alignedRequiredSpace = rx::CheckedRoundUp(requiredSpace, 16u);
- alignedRequiredSpace += mReservedSpace;
-
- // Protect against integer overflow
- if (!alignedRequiredSpace.IsValid())
- {
- return gl::OutOfMemory()
- << "Unable to reserve " << requiredSpace
- << " extra bytes in internal vertex buffer, it would result in an overflow.";
- }
-
- mReservedSpace = alignedRequiredSpace.ValueOrDie();
-
- return gl::NoError();
-}
-
-// StaticVertexBufferInterface Implementation
-StaticVertexBufferInterface::AttributeSignature::AttributeSignature()
- : type(GL_NONE), size(0), stride(0), normalized(false), pureInteger(false), offset(0)
-{
-}
-
-bool StaticVertexBufferInterface::AttributeSignature::matchesAttribute(
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding) const
-{
- size_t attribStride = ComputeVertexAttributeStride(attrib, binding);
-
- if (type != attrib.type || size != attrib.size || static_cast<GLuint>(stride) != attribStride ||
- normalized != attrib.normalized || pureInteger != attrib.pureInteger)
- {
- 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)
-{
- type = attrib.type;
- size = attrib.size;
- normalized = attrib.normalized;
- pureInteger = attrib.pureInteger;
- 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);
-}
-
-gl::Error StaticVertexBufferInterface::storeStaticAttribute(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLint start,
- GLsizei count,
- GLsizei instances,
- const uint8_t *sourceData)
-{
- unsigned int spaceRequired = 0;
- ANGLE_TRY_RESULT(getSpaceRequired(attrib, binding, count, instances), spaceRequired);
- ANGLE_TRY(setBufferSize(spaceRequired));
-
- ASSERT(attrib.enabled);
- ANGLE_TRY(mVertexBuffer->storeVertexAttributes(attrib, binding, GL_NONE, start, count,
- instances, 0, sourceData));
-
- mSignature.set(attrib, binding);
- mVertexBuffer->hintUnmapResource();
- return gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexBuffer.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexBuffer.h
deleted file mode 100644
index df8085d3cb..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexBuffer.h
+++ /dev/null
@@ -1,175 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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/angleutils.h"
-#include "libANGLE/Error.h"
-
-#include <GLES2/gl2.h>
-
-#include <cstddef>
-#include <cstdint>
-#include <vector>
-
-namespace gl
-{
-struct VertexAttribute;
-class VertexBinding;
-struct VertexAttribCurrentValueData;
-}
-
-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 gl::Error initialize(unsigned int size, bool dynamicUsage) = 0;
-
- // Warning: you should ensure binding really matches attrib.bindingIndex before using this
- // function.
- virtual gl::Error storeVertexAttributes(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- GLsizei count,
- GLsizei instances,
- unsigned int offset,
- const uint8_t *sourceData) = 0;
-
- virtual unsigned int getBufferSize() const = 0;
- virtual gl::Error setBufferSize(unsigned int size) = 0;
- virtual gl::Error discard() = 0;
-
- unsigned int getSerial() const;
-
- // This may be overridden (e.g. by VertexBuffer11) if necessary.
- virtual void hintUnmapResource() { };
-
- // 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:
- gl::Error discard();
-
- gl::Error setBufferSize(unsigned int size);
-
- gl::ErrorOrResult<unsigned int> getSpaceRequired(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLsizei count,
- GLsizei instances) const;
- BufferFactoryD3D *const mFactory;
- VertexBuffer *mVertexBuffer;
- bool mDynamic;
-};
-
-class StreamingVertexBufferInterface : public VertexBufferInterface
-{
- public:
- StreamingVertexBufferInterface(BufferFactoryD3D *factory, std::size_t initialSize);
- ~StreamingVertexBufferInterface() override;
-
- gl::Error storeDynamicAttribute(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- GLsizei count,
- GLsizei instances,
- unsigned int *outStreamOffset,
- const uint8_t *sourceData);
-
- gl::Error reserveVertexSpace(const gl::VertexAttribute &attribute,
- const gl::VertexBinding &binding,
- GLsizei count,
- GLsizei instances);
-
- private:
- gl::Error reserveSpace(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.
- gl::Error storeStaticAttribute(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:
- GLenum type;
- GLuint size;
- GLuint stride;
- bool normalized;
- bool pureInteger;
- size_t offset;
- };
-
- AttributeSignature mSignature;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_VERTEXBUFFER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexDataManager.cpp
deleted file mode 100644
index 54ad5e54f5..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexDataManager.cpp
+++ /dev/null
@@ -1,646 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// VertexDataManager.h: Defines the VertexDataManager, a class that
-// runs the Buffer translation process.
-
-#include "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/RendererD3D.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: you should ensure binding really matches attrib.bindingIndex before using this function.
-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::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();
-
- gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib);
-
- // CPU-converted vertex data must be converted (naturally).
- if ((factory->getVertexConversionType(vertexFormatType) & VERTEX_CONVERT_CPU) != 0)
- {
- return false;
- }
-
- if (attrib.type != GL_FLOAT)
- {
- auto errorOrElementSize = factory->getVertexSpaceRequired(attrib, binding, 1, 0);
- if (errorOrElementSize.isError())
- {
- ERR() << "Unlogged error in DirectStoragePossible.";
- return false;
- }
-
- alignment = std::min<size_t>(errorOrElementSize.getResult(), 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_NONE),
- baseOffset(0),
- usesFirstVertexOffset(false),
- stride(0),
- vertexBuffer(),
- storage(nullptr),
- serial(0),
- divisor(0)
-{
-}
-
-TranslatedAttribute::TranslatedAttribute(const TranslatedAttribute &other) = default;
-
-gl::ErrorOrResult<unsigned int> TranslatedAttribute::computeOffset(GLint startVertex) const
-{
- if (!usesFirstVertexOffset)
- {
- return baseOffset;
- }
-
- CheckedNumeric<unsigned int> offset;
-
- offset = baseOffset + stride * static_cast<unsigned int>(startVertex);
- ANGLE_TRY_CHECKED_MATH(offset);
- return offset.ValueOrDie();
-}
-
-// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
-VertexStorageType ClassifyAttributeStorage(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.
- auto *buffer = binding.getBuffer().get();
- if (!buffer)
- {
- return VertexStorageType::DYNAMIC;
- }
-
- // Check if the buffer supports direct storage.
- if (DirectStoragePossible(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() : buffer(), offset(0)
-{
- data.FloatValues[0] = std::numeric_limits<float>::quiet_NaN();
- data.FloatValues[1] = std::numeric_limits<float>::quiet_NaN();
- data.FloatValues[2] = std::numeric_limits<float>::quiet_NaN();
- data.FloatValues[3] = std::numeric_limits<float>::quiet_NaN();
- data.Type = GL_FLOAT;
-}
-
-VertexDataManager::CurrentValueState::~CurrentValueState()
-{
-}
-
-VertexDataManager::VertexDataManager(BufferFactoryD3D *factory)
- : mFactory(factory), mStreamingBuffer(), mCurrentValueCache(gl::MAX_VERTEX_ATTRIBS)
-{
-}
-
-VertexDataManager::~VertexDataManager()
-{
-}
-
-gl::Error VertexDataManager::initialize()
-{
- mStreamingBuffer.reset(
- new StreamingVertexBufferInterface(mFactory, INITIAL_STREAM_BUFFER_SIZE));
- if (!mStreamingBuffer)
- {
- return gl::OutOfMemory() << "Failed to allocate the streaming vertex buffer.";
- }
-
- return gl::NoError();
-}
-
-void VertexDataManager::deinitialize()
-{
- mStreamingBuffer.reset();
- mCurrentValueCache.clear();
-}
-
-gl::Error VertexDataManager::prepareVertexData(const gl::Context *context,
- GLint start,
- GLsizei count,
- std::vector<TranslatedAttribute> *translatedAttribs,
- GLsizei instances)
-{
- ASSERT(mStreamingBuffer);
-
- const gl::State &state = context->getGLState();
- 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(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(translated);
- break;
- case VertexStorageType::CURRENT_VALUE:
- {
- ANGLE_TRY(storeCurrentValue(currentValueData, translated, attribIndex));
- break;
- }
- default:
- UNREACHABLE();
- break;
- }
- }
-
- if (mDynamicAttribsMaskCache.none())
- {
- return gl::NoError();
- }
-
- ANGLE_TRY(storeDynamicAttribs(context, translatedAttribs, mDynamicAttribsMaskCache, start,
- count, instances));
-
- PromoteDynamicAttribs(context, *translatedAttribs, mDynamicAttribsMaskCache, count);
-
- return gl::NoError();
-}
-
-// static
-void VertexDataManager::StoreDirectAttrib(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(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
-gl::Error 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(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));
- sourceData += offset;
-
- unsigned int streamOffset = 0;
-
- translated->storage = nullptr;
- ANGLE_TRY_RESULT(bufferD3D->getFactory()->getVertexSpaceRequired(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));
-
- ANGLE_TRY(staticBuffer->storeStaticAttribute(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;
-
- if (!checkedOffset.IsValid())
- {
- return gl::InternalError() << "Integer overflow in VertexDataManager::StoreStaticAttrib";
- }
-
- 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 gl::NoError();
-}
-
-gl::Error VertexDataManager::storeDynamicAttribs(
- const gl::Context *context,
- std::vector<TranslatedAttribute> *translatedAttribs,
- const gl::AttributesMask &dynamicAttribsMask,
- GLint start,
- GLsizei 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.get());
-
- // Reserve the required space for the dynamic buffers.
- for (auto attribIndex : dynamicAttribsMask)
- {
- const auto &dynamicAttrib = (*translatedAttribs)[attribIndex];
- ANGLE_TRY(reserveSpaceForAttrib(dynamicAttrib, start, count, instances));
- }
-
- // Store dynamic attributes
- for (auto attribIndex : dynamicAttribsMask)
- {
- auto *dynamicAttrib = &(*translatedAttribs)[attribIndex];
- ANGLE_TRY(storeDynamicAttrib(context, dynamicAttrib, start, count, instances));
- }
-
- return gl::NoError();
-}
-
-void VertexDataManager::PromoteDynamicAttribs(
- const gl::Context *context,
- const std::vector<TranslatedAttribute> &translatedAttribs,
- const gl::AttributesMask &dynamicAttribsMask,
- GLsizei 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)
- {
- BufferD3D *bufferD3D = GetImplAs<BufferD3D>(buffer);
- size_t typeSize = ComputeVertexAttributeTypeSize(*dynamicAttrib.attribute);
- bufferD3D->promoteStaticUsage(context, count * static_cast<int>(typeSize));
- }
- }
-}
-
-gl::Error VertexDataManager::reserveSpaceForAttrib(const TranslatedAttribute &translatedAttrib,
- GLint start,
- GLsizei count,
- GLsizei instances) const
-{
- ASSERT(translatedAttrib.attribute && translatedAttrib.binding);
- const auto &attrib = *translatedAttrib.attribute;
- const auto &binding = *translatedAttrib.binding;
-
- ASSERT(!DirectStoragePossible(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(), static_cast<size_t>(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);
- int elementsInBuffer =
- ElementsInBuffer(attrib, binding, static_cast<unsigned int>(bufferD3D->getSize()));
-
- if (maxVertexCount > elementsInBuffer)
- {
- return gl::InvalidOperation() << "Vertex buffer is not big enough for the draw call.";
- }
- }
- return mStreamingBuffer->reserveVertexSpace(attrib, binding, static_cast<GLsizei>(totalCount),
- instances);
-}
-
-gl::Error VertexDataManager::storeDynamicAttrib(const gl::Context *context,
- TranslatedAttribute *translated,
- GLint start,
- GLsizei 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_RESULT(mFactory->getVertexSpaceRequired(attrib, binding, 1, 0), translated->stride);
-
- size_t totalCount = gl::ComputeVertexBindingElementCount(
- binding.getDivisor(), static_cast<size_t>(count), static_cast<size_t>(instances));
-
- ANGLE_TRY(mStreamingBuffer->storeDynamicAttribute(
- 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 gl::NoError();
-}
-
-gl::Error VertexDataManager::storeCurrentValue(const gl::VertexAttribCurrentValueData &currentValue,
- TranslatedAttribute *translated,
- size_t attribIndex)
-{
- CurrentValueState *cachedState = &mCurrentValueCache[attribIndex];
- auto &buffer = cachedState->buffer;
-
- if (!buffer)
- {
- buffer.reset(new StreamingVertexBufferInterface(mFactory, 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(attrib, binding, 1, 0));
-
- const uint8_t *sourceData = reinterpret_cast<const uint8_t*>(currentValue.FloatValues);
- unsigned int streamOffset;
- ANGLE_TRY(buffer->storeDynamicAttribute(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 gl::NoError();
-}
-
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexDataManager.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexDataManager.h
deleted file mode 100644
index 694366deb7..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexDataManager.h
+++ /dev/null
@@ -1,152 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// VertexDataManager.h: Defines the VertexDataManager, a class that
-// runs the Buffer translation process.
-
-#ifndef LIBANGLE_RENDERER_D3D_VERTEXDATAMANAGER_H_
-#define LIBANGLE_RENDERER_D3D_VERTEXDATAMANAGER_H_
-
-#include "common/angleutils.h"
-#include "libANGLE/angletypes.h"
-#include "libANGLE/Constants.h"
-#include "libANGLE/VertexAttribute.h"
-
-namespace gl
-{
-class State;
-struct VertexAttribute;
-class VertexBinding;
-struct VertexAttribCurrentValueData;
-}
-
-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.
- gl::ErrorOrResult<unsigned int> computeOffset(GLint startVertex) const;
-
- bool active;
-
- const gl::VertexAttribute *attribute;
- const gl::VertexBinding *binding;
- GLenum 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::VertexAttribute &attrib,
- const gl::VertexBinding &binding);
-
-class VertexDataManager : angle::NonCopyable
-{
- public:
- VertexDataManager(BufferFactoryD3D *factory);
- virtual ~VertexDataManager();
-
- gl::Error initialize();
- void deinitialize();
-
- gl::Error prepareVertexData(const gl::Context *context,
- GLint start,
- GLsizei count,
- std::vector<TranslatedAttribute> *translatedAttribs,
- GLsizei instances);
-
- static void StoreDirectAttrib(TranslatedAttribute *directAttrib);
-
- static gl::Error StoreStaticAttrib(const gl::Context *context, TranslatedAttribute *translated);
-
- gl::Error storeDynamicAttribs(const gl::Context *context,
- std::vector<TranslatedAttribute> *translatedAttribs,
- const gl::AttributesMask &dynamicAttribsMask,
- GLint start,
- GLsizei 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,
- GLsizei count);
-
- gl::Error storeCurrentValue(const gl::VertexAttribCurrentValueData &currentValue,
- TranslatedAttribute *translated,
- size_t attribIndex);
-
- private:
- struct CurrentValueState
- {
- CurrentValueState();
- ~CurrentValueState();
-
- std::unique_ptr<StreamingVertexBufferInterface> buffer;
- gl::VertexAttribCurrentValueData data;
- size_t offset;
- };
-
- gl::Error reserveSpaceForAttrib(const TranslatedAttribute &translatedAttrib,
- GLsizei count,
- GLint start,
- GLsizei instances) const;
-
- gl::Error storeDynamicAttrib(const gl::Context *context,
- TranslatedAttribute *translated,
- GLint start,
- GLsizei count,
- GLsizei instances);
-
- BufferFactoryD3D *const mFactory;
-
- std::unique_ptr<StreamingVertexBufferInterface> mStreamingBuffer;
- std::vector<CurrentValueState> mCurrentValueCache;
- gl::AttributesMask mDynamicAttribsMaskCache;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_VERTEXDATAMANAGER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp
deleted file mode 100644
index f032e888f1..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp
+++ /dev/null
@@ -1,2153 +0,0 @@
-//
-// 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/formatutils.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 "third_party/trace_event/trace_event.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/passthrougha2d11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.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/passthroughr2d11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h"
-
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_ps.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/passthroughlum3d11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h"
-#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.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
-
-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()
-{
-}
-
-gl::Error Blit11::initResources()
-{
- if (mResourcesInitialized)
- {
- return gl::NoError();
- }
-
- 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;
-
- ANGLE_TRY(mRenderer->allocateResource(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(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(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(rasterDesc, &mScissorEnabledRasterizerState));
- mScissorEnabledRasterizerState.setDebugName("Blit11 scissoring rasterizer state");
-
- rasterDesc.ScissorEnable = FALSE;
- ANGLE_TRY(mRenderer->allocateResource(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(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(swizzleBufferDesc, &mSwizzleCB));
- mSwizzleCB.setDebugName("Blit11 swizzle constant buffer");
-
- mResourcesInitialized = true;
-
- return gl::NoError();
-}
-
-// static
-Blit11::BlitShaderType Blit11::GetBlitShaderType(GLenum destinationFormat,
- GLenum sourceFormat,
- bool isSigned,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- ShaderDimension dimension)
-{
- if (dimension == SHADER_3D)
- {
- ASSERT(!unpackPremultiplyAlpha && !unpackUnmultiplyAlpha);
-
- if (isSigned)
- {
- switch (destinationFormat)
- {
- case GL_RGBA_INTEGER:
- return BLITSHADER_3D_RGBAI;
- case GL_RGB_INTEGER:
- return BLITSHADER_3D_RGBI;
- case GL_RG_INTEGER:
- return BLITSHADER_3D_RGI;
- case GL_RED_INTEGER:
- return BLITSHADER_3D_RI;
- default:
- UNREACHABLE();
- return BLITSHADER_INVALID;
- }
- }
- else
- {
- switch (destinationFormat)
- {
- case GL_RGBA:
- return BLITSHADER_3D_RGBAF;
- case GL_RGBA_INTEGER:
- return BLITSHADER_3D_RGBAUI;
- case GL_BGRA_EXT:
- return BLITSHADER_3D_BGRAF;
- case GL_RGB:
- return BLITSHADER_3D_RGBF;
- case GL_RGB_INTEGER:
- return BLITSHADER_3D_RGBUI;
- case GL_RG:
- return BLITSHADER_3D_RGF;
- case GL_RG_INTEGER:
- return BLITSHADER_3D_RGUI;
- case GL_RED:
- return BLITSHADER_3D_RF;
- case GL_RED_INTEGER:
- return BLITSHADER_3D_RUI;
- case GL_ALPHA:
- return BLITSHADER_3D_ALPHA;
- case GL_LUMINANCE:
- return BLITSHADER_3D_LUMA;
- case GL_LUMINANCE_ALPHA:
- return BLITSHADER_3D_LUMAALPHA;
- default:
- UNREACHABLE();
- return BLITSHADER_INVALID;
- }
- }
- }
- else if (isSigned)
- {
- ASSERT(!unpackPremultiplyAlpha && !unpackUnmultiplyAlpha);
-
- switch (destinationFormat)
- {
- case GL_RGBA_INTEGER:
- return BLITSHADER_2D_RGBAI;
- case GL_RGB_INTEGER:
- return BLITSHADER_2D_RGBI;
- case GL_RG_INTEGER:
- return BLITSHADER_2D_RGI;
- case GL_RED_INTEGER:
- return BLITSHADER_2D_RI;
- default:
- UNREACHABLE();
- return BLITSHADER_INVALID;
- }
- }
- else
- {
- bool floatToIntBlit =
- !gl::IsIntegerFormat(sourceFormat) && gl::IsIntegerFormat(destinationFormat);
- if (unpackPremultiplyAlpha != unpackUnmultiplyAlpha || floatToIntBlit)
- {
- switch (destinationFormat)
- {
- case GL_RGBA:
- case GL_BGRA_EXT:
- ASSERT(!floatToIntBlit);
- return unpackPremultiplyAlpha ? BLITSHADER_2D_RGBAF_PREMULTIPLY
- : BLITSHADER_2D_RGBAF_UNMULTIPLY;
-
- case GL_RGB:
- case GL_RG:
- case GL_RED:
- ASSERT(!floatToIntBlit);
- return unpackPremultiplyAlpha ? BLITSHADER_2D_RGBF_PREMULTIPLY
- : BLITSHADER_2D_RGBF_UNMULTIPLY;
-
- case GL_RGBA_INTEGER:
- if (unpackPremultiplyAlpha == unpackUnmultiplyAlpha)
- {
- return BLITSHADER_2D_RGBAF_TOUI;
- }
- else
- {
- return unpackPremultiplyAlpha ? BLITSHADER_2D_RGBAF_TOUI_PREMULTIPLY
- : BLITSHADER_2D_RGBAF_TOUI_UNMULTIPLY;
- }
-
- case GL_RGB_INTEGER:
- case GL_RG_INTEGER:
- case GL_RED_INTEGER:
- if (unpackPremultiplyAlpha == unpackUnmultiplyAlpha)
- {
- return BLITSHADER_2D_RGBF_TOUI;
- }
- else
- {
- return unpackPremultiplyAlpha ? BLITSHADER_2D_RGBF_TOUI_PREMULTIPLY
- : BLITSHADER_2D_RGBF_TOUI_UNMULTIPLY;
- }
- case GL_LUMINANCE:
- ASSERT(!floatToIntBlit);
- return unpackPremultiplyAlpha ? BLITSHADER_2D_LUMAF_PREMULTIPLY
- : BLITSHADER_2D_LUMAF_UNMULTIPLY;
- case GL_LUMINANCE_ALPHA:
- ASSERT(!floatToIntBlit);
- return unpackPremultiplyAlpha ? BLITSHADER_2D_LUMAALPHAF_PREMULTIPLY
- : BLITSHADER_2D_LUMAALPHAF_UNMULTIPLY;
- case GL_ALPHA:
- ASSERT(!floatToIntBlit);
- return BLITSHADER_2D_ALPHA;
- default:
- UNREACHABLE();
- return BLITSHADER_INVALID;
- }
- }
- else
- {
- switch (destinationFormat)
- {
- case GL_RGBA:
- return BLITSHADER_2D_RGBAF;
- case GL_RGBA_INTEGER:
- return BLITSHADER_2D_RGBAUI;
- case GL_BGRA_EXT:
- return BLITSHADER_2D_BGRAF;
- case GL_RGB:
- return BLITSHADER_2D_RGBF;
- case GL_RGB_INTEGER:
- return BLITSHADER_2D_RGBUI;
- case GL_RG:
- return BLITSHADER_2D_RGF;
- case GL_RG_INTEGER:
- return BLITSHADER_2D_RGUI;
- case GL_RED:
- return BLITSHADER_2D_RF;
- case GL_RED_INTEGER:
- return BLITSHADER_2D_RUI;
- case GL_ALPHA:
- return BLITSHADER_2D_ALPHA;
- case GL_LUMINANCE:
- return BLITSHADER_2D_LUMA;
- case GL_LUMINANCE_ALPHA:
- return BLITSHADER_2D_LUMAALPHA;
- default:
- UNREACHABLE();
- return BLITSHADER_INVALID;
- }
- }
- }
-}
-
-// static
-Blit11::SwizzleShaderType Blit11::GetSwizzleShaderType(GLenum type,
- D3D11_SRV_DIMENSION dimensionality)
-{
- switch (dimensionality)
- {
- case D3D11_SRV_DIMENSION_TEXTURE2D:
- switch (type)
- {
- case GL_FLOAT:
- return SWIZZLESHADER_2D_FLOAT;
- case GL_UNSIGNED_INT:
- return SWIZZLESHADER_2D_UINT;
- case GL_INT:
- return SWIZZLESHADER_2D_INT;
- default:
- UNREACHABLE();
- return SWIZZLESHADER_INVALID;
- }
- case D3D11_SRV_DIMENSION_TEXTURECUBE:
- switch (type)
- {
- case GL_FLOAT:
- return SWIZZLESHADER_CUBE_FLOAT;
- case GL_UNSIGNED_INT:
- return SWIZZLESHADER_CUBE_UINT;
- case GL_INT:
- return SWIZZLESHADER_CUBE_INT;
- default:
- UNREACHABLE();
- return SWIZZLESHADER_INVALID;
- }
- case D3D11_SRV_DIMENSION_TEXTURE3D:
- switch (type)
- {
- case GL_FLOAT:
- return SWIZZLESHADER_3D_FLOAT;
- case GL_UNSIGNED_INT:
- return SWIZZLESHADER_3D_UINT;
- case GL_INT:
- return SWIZZLESHADER_3D_INT;
- default:
- UNREACHABLE();
- return SWIZZLESHADER_INVALID;
- }
- case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
- switch (type)
- {
- case GL_FLOAT:
- return SWIZZLESHADER_ARRAY_FLOAT;
- case GL_UNSIGNED_INT:
- return SWIZZLESHADER_ARRAY_UINT;
- case GL_INT:
- return SWIZZLESHADER_ARRAY_INT;
- default:
- UNREACHABLE();
- return SWIZZLESHADER_INVALID;
- }
- default:
- UNREACHABLE();
- return SWIZZLESHADER_INVALID;
- }
-}
-
-gl::Error Blit11::getShaderSupport(const Shader &shader, Blit11::ShaderSupport *supportOut)
-{
- if (shader.dimension == SHADER_2D)
- {
- ANGLE_TRY(mQuad2DIL.resolve(mRenderer));
- ANGLE_TRY(mQuad2DVS.resolve(mRenderer));
- supportOut->inputLayout = &mQuad2DIL.getObj();
- supportOut->vertexShader = &mQuad2DVS.getObj();
- supportOut->geometryShader = nullptr;
- supportOut->vertexWriteFunction = Write2DVertices;
- }
- else
- {
- ASSERT(shader.dimension == SHADER_3D);
- ANGLE_TRY(mQuad3DIL.resolve(mRenderer));
- ANGLE_TRY(mQuad3DVS.resolve(mRenderer));
- ANGLE_TRY(mQuad3DGS.resolve(mRenderer));
- supportOut->inputLayout = &mQuad2DIL.getObj();
- supportOut->vertexShader = &mQuad3DVS.getObj();
- supportOut->geometryShader = &mQuad3DGS.getObj();
- supportOut->vertexWriteFunction = Write3DVertices;
- }
-
- return gl::NoError();
-}
-
-gl::Error 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());
-
- HRESULT result;
- 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(shaderType, sourceSRVDesc.ViewDimension, &shader));
-
- // Set vertices
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result =
- deviceContext->Map(mVertexBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to map internal vertex buffer for swizzle, "
- << gl::FmtHR(result);
- }
-
- ShaderSupport support;
- ANGLE_TRY(getShaderSupport(*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
- result = deviceContext->Map(mSwizzleCB.get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to map internal constant buffer for swizzle, "
- << gl::FmtHR(result);
- }
-
- unsigned int *swizzleIndices = reinterpret_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 gl::NoError();
-}
-
-gl::Error 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 filter,
- bool maskOffAlpha,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha)
-{
- ANGLE_TRY(initResources());
-
- HRESULT result;
- 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 isSigned = (componentType == GL_INT);
-
- ShaderDimension dimension =
- (sourceSRVDesc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE3D) ? SHADER_3D : SHADER_2D;
-
- const Shader *shader = nullptr;
- ANGLE_TRY(getBlitShader(destFormat, sourceFormat, isSigned, unpackPremultiplyAlpha,
- unpackUnmultiplyAlpha, dimension, &shader));
-
- ShaderSupport support;
- ANGLE_TRY(getShaderSupport(*shader, &support));
-
- // Set vertices
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result =
- deviceContext->Map(mVertexBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to map internal vertex buffer for texture copy, "
- << gl::FmtHR(result);
- }
-
- 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(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();
- return gl::InternalError() << "Internal error, unknown blit filter mode.";
- }
-
- // Draw the quad
- deviceContext->Draw(drawCount, 0);
-
- return gl::NoError();
-}
-
-gl::Error 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(source, sourceSubresource, sourceArea, sourceSize, dest,
- destSubresource, destArea, destSize, scissor, true);
-}
-
-gl::Error 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());
-
- HRESULT result;
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
-
- // Set vertices
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result =
- deviceContext->Map(mVertexBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to map internal vertex buffer for texture copy, "
- << gl::FmtHR(result);
- }
-
- 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);
- }
-
- ANGLE_TRY(mQuad2DIL.resolve(mRenderer));
- ANGLE_TRY(mQuad2DVS.resolve(mRenderer));
- ANGLE_TRY(mDepthPS.resolve(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 gl::NoError();
-}
-
-gl::Error Blit11::copyDepthStencil(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(source, sourceSubresource, sourceArea, sourceSize, dest,
- destSubresource, destArea, destSize, scissor, false);
-}
-
-gl::Error Blit11::copyDepthStencilImpl(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(source, sourceSubresource, sourceArea, sourceSize, dest,
- destSubresource, destArea, destSize, scissor, copyOffset,
- copyOffset, copySize, srcPixelSize, destPixelSize,
- BlitD24S8ToD32F);
- }
- ASSERT(srcDXGIFormat == DXGI_FORMAT_R32G8X24_TYPELESS);
- return copyAndConvert(source, sourceSubresource, sourceArea, sourceSize, dest,
- destSubresource, destArea, destSize, scissor, copyOffset, copyOffset,
- copySize, srcPixelSize, destPixelSize, BlitD32FS8ToD32F);
- }
-
- return copyAndConvert(source, sourceSubresource, sourceArea, sourceSize, dest, destSubresource,
- destArea, destSize, scissor, copyOffset, copyOffset, copySize,
- srcPixelSize, destPixelSize, StretchedBlitNearest);
-}
-
-gl::Error Blit11::copyAndConvertImpl(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());
-
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
-
- TextureHelper11 sourceStaging;
- ANGLE_TRY_RESULT(mRenderer->createStagingTexture(ResourceType::Texture2D, source.getFormatSet(),
- sourceSize, StagingAccess::READ),
- sourceStaging);
-
- deviceContext->CopySubresourceRegion(sourceStaging.get(), 0, 0, 0, 0, source.get(),
- sourceSubresource, nullptr);
-
- D3D11_MAPPED_SUBRESOURCE sourceMapping;
- HRESULT result = deviceContext->Map(sourceStaging.get(), 0, D3D11_MAP_READ, 0, &sourceMapping);
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to map internal source staging texture for depth stencil blit, "
- << gl::FmtHR(result);
- }
-
- D3D11_MAPPED_SUBRESOURCE destMapping;
- result = deviceContext->Map(destStaging.get(), 0, D3D11_MAP_WRITE, 0, &destMapping);
- if (FAILED(result))
- {
- deviceContext->Unmap(sourceStaging.get(), 0);
- return gl::OutOfMemory()
- << "Failed to map internal destination staging texture for depth stencil blit, "
- << gl::FmtHR(result);
- }
-
- // 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)
- {
- gl::ClipRectangle(clipRect, *scissor, &clipRect);
- }
-
- 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 gl::NoError();
-}
-
-gl::Error Blit11::copyAndConvert(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());
-
- 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_RESULT(mRenderer->createStagingTexture(ResourceType::Texture2D, dest.getFormatSet(),
- destSize, StagingAccess::READ_WRITE),
- destStaging);
-
- deviceContext->CopySubresourceRegion(destStaging.get(), 0, 0, 0, 0, dest.get(), destSubresource,
- nullptr);
-
- ANGLE_TRY(copyAndConvertImpl(source, sourceSubresource, sourceArea, sourceSize, destStaging,
- destArea, destSize, scissor, readOffset, writeOffset, copySize,
- srcPixelStride, destPixelStride, convertFunction));
-
- // Work around timeouts/TDRs in older NVIDIA drivers.
- if (mRenderer->getWorkarounds().depthStencilBlitExtraCopy)
- {
- D3D11_MAPPED_SUBRESOURCE mapped;
- deviceContext->Map(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 gl::NoError();
-}
-
-gl::Error Blit11::addBlitShaderToMap(BlitShaderType blitShaderType,
- ShaderDimension dimension,
- const ShaderData &shaderData,
- const char *name)
-{
- ASSERT(mBlitShaderMap.find(blitShaderType) == mBlitShaderMap.end());
-
- d3d11::PixelShader ps;
- ANGLE_TRY(mRenderer->allocateResource(shaderData, &ps));
- ps.setDebugName(name);
-
- Shader shader;
- shader.dimension = dimension;
- shader.pixelShader = std::move(ps);
-
- mBlitShaderMap[blitShaderType] = std::move(shader);
- return gl::NoError();
-}
-
-gl::Error Blit11::addSwizzleShaderToMap(SwizzleShaderType swizzleShaderType,
- ShaderDimension dimension,
- const ShaderData &shaderData,
- const char *name)
-{
- ASSERT(mSwizzleShaderMap.find(swizzleShaderType) == mSwizzleShaderMap.end());
-
- d3d11::PixelShader ps;
- ANGLE_TRY(mRenderer->allocateResource(shaderData, &ps));
- ps.setDebugName(name);
-
- Shader shader;
- shader.dimension = dimension;
- shader.pixelShader = std::move(ps);
-
- mSwizzleShaderMap[swizzleShaderType] = std::move(shader);
- return gl::NoError();
-}
-
-void Blit11::clearShaderMap()
-{
- mBlitShaderMap.clear();
- mSwizzleShaderMap.clear();
-}
-
-gl::Error Blit11::getBlitShader(GLenum destFormat,
- GLenum sourceFormat,
- bool isSigned,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- ShaderDimension dimension,
- const Shader **shader)
-{
- BlitShaderType blitShaderType =
- GetBlitShaderType(destFormat, sourceFormat, isSigned, unpackPremultiplyAlpha,
- unpackUnmultiplyAlpha, dimension);
-
- if (blitShaderType == BLITSHADER_INVALID)
- {
- return gl::InternalError() << "Internal blit shader type mismatch";
- }
-
- auto blitShaderIt = mBlitShaderMap.find(blitShaderType);
- if (blitShaderIt != mBlitShaderMap.end())
- {
- *shader = &blitShaderIt->second;
- return gl::NoError();
- }
-
- ASSERT(dimension == SHADER_2D || mRenderer->isES3Capable());
-
- switch (blitShaderType)
- {
- case BLITSHADER_2D_RGBAF:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughRGBA2D),
- "Blit11 2D RGBA pixel shader"));
- break;
- case BLITSHADER_2D_BGRAF:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughRGBA2D),
- "Blit11 2D BGRA pixel shader"));
- break;
- case BLITSHADER_2D_RGBF:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughRGB2D),
- "Blit11 2D RGB pixel shader"));
- break;
- case BLITSHADER_2D_RGF:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughRG2D),
- "Blit11 2D RG pixel shader"));
- break;
- case BLITSHADER_2D_RF:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_PassthroughR2D),
- "Blit11 2D R pixel shader"));
- break;
- case BLITSHADER_2D_ALPHA:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_PassthroughA2D),
- "Blit11 2D alpha pixel shader"));
- break;
- case BLITSHADER_2D_LUMA:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughLum2D),
- "Blit11 2D lum pixel shader"));
- break;
- case BLITSHADER_2D_LUMAALPHA:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughLumAlpha2D),
- "Blit11 2D luminance alpha pixel shader"));
- break;
- case BLITSHADER_2D_RGBAUI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughRGBA2DUI),
- "Blit11 2D RGBA UI pixel shader"));
- break;
- case BLITSHADER_2D_RGBAI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughRGBA2DI),
- "Blit11 2D RGBA I pixel shader"));
- break;
- case BLITSHADER_2D_RGBUI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughRGB2DUI),
- "Blit11 2D RGB UI pixel shader"));
- break;
- case BLITSHADER_2D_RGBI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughRGB2DI),
- "Blit11 2D RGB I pixel shader"));
- break;
- case BLITSHADER_2D_RGUI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughRG2DUI),
- "Blit11 2D RG UI pixel shader"));
- break;
- case BLITSHADER_2D_RGI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughRG2DI),
- "Blit11 2D RG I pixel shader"));
- break;
- case BLITSHADER_2D_RUI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughR2DUI),
- "Blit11 2D R UI pixel shader"));
- break;
- case BLITSHADER_2D_RI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_PassthroughR2DI),
- "Blit11 2D R I pixel shader"));
- break;
- case BLITSHADER_3D_RGBAF:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughRGBA3D),
- "Blit11 3D RGBA pixel shader"));
- break;
- case BLITSHADER_3D_RGBAUI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughRGBA3DUI),
- "Blit11 3D UI RGBA pixel shader"));
- break;
- case BLITSHADER_3D_RGBAI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughRGBA3DI),
- "Blit11 3D I RGBA pixel shader"));
- break;
- case BLITSHADER_3D_BGRAF:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughRGBA3D),
- "Blit11 3D BGRA pixel shader"));
- break;
- case BLITSHADER_3D_RGBF:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughRGB3D),
- "Blit11 3D RGB pixel shader"));
- break;
- case BLITSHADER_3D_RGBUI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughRGB3DUI),
- "Blit11 3D RGB UI pixel shader"));
- break;
- case BLITSHADER_3D_RGBI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughRGB3DI),
- "Blit11 3D RGB I pixel shader"));
- break;
- case BLITSHADER_3D_RGF:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughRG3D),
- "Blit11 3D RG pixel shader"));
- break;
- case BLITSHADER_3D_RGUI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughRG3DUI),
- "Blit11 3D RG UI pixel shader"));
- break;
- case BLITSHADER_3D_RGI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughRG3DI),
- "Blit11 3D RG I pixel shader"));
- break;
- case BLITSHADER_3D_RF:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D, ShaderData(g_PS_PassthroughR3D),
- "Blit11 3D R pixel shader"));
- break;
- case BLITSHADER_3D_RUI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughR3DUI),
- "Blit11 3D R UI pixel shader"));
- break;
- case BLITSHADER_3D_RI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughR3DI),
- "Blit11 3D R I pixel shader"));
- break;
- case BLITSHADER_3D_ALPHA:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughRGBA3D),
- "Blit11 3D alpha pixel shader"));
- break;
- case BLITSHADER_3D_LUMA:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughLum3D),
- "Blit11 3D luminance pixel shader"));
- break;
- case BLITSHADER_3D_LUMAALPHA:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_3D,
- ShaderData(g_PS_PassthroughLumAlpha3D),
- "Blit11 3D luminance alpha pixel shader"));
- break;
-
- case BLITSHADER_2D_RGBAF_PREMULTIPLY:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_FtoF_PM_RGBA),
- "Blit11 2D RGBA premultiply pixel shader"));
- break;
-
- case BLITSHADER_2D_RGBAF_UNMULTIPLY:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_FtoF_UM_RGBA),
- "Blit11 2D RGBA unmultiply pixel shader"));
- break;
-
- case BLITSHADER_2D_RGBF_PREMULTIPLY:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_FtoF_PM_RGB),
- "Blit11 2D RGB premultiply pixel shader"));
- break;
-
- case BLITSHADER_2D_RGBF_UNMULTIPLY:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_FtoF_UM_RGB),
- "Blit11 2D RGB unmultiply pixel shader"));
- break;
-
- case BLITSHADER_2D_RGBAF_TOUI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_FtoU_PT_RGBA),
- "Blit11 2D RGBA to uint pixel shader"));
- break;
-
- case BLITSHADER_2D_RGBAF_TOUI_PREMULTIPLY:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_FtoU_PM_RGBA),
- "Blit11 2D RGBA to uint premultiply pixel shader"));
- break;
-
- case BLITSHADER_2D_RGBAF_TOUI_UNMULTIPLY:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_FtoU_UM_RGBA),
- "Blit11 2D RGBA to uint unmultiply pixel shader"));
- break;
-
- case BLITSHADER_2D_RGBF_TOUI:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_FtoU_PT_RGB),
- "Blit11 2D RGB to uint pixel shader"));
- break;
-
- case BLITSHADER_2D_RGBF_TOUI_PREMULTIPLY:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_FtoU_PM_RGB),
- "Blit11 2D RGB to uint premultiply pixel shader"));
- break;
-
- case BLITSHADER_2D_RGBF_TOUI_UNMULTIPLY:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_FtoU_UM_RGB),
- "Blit11 2D RGB to uint unmultiply pixel shader"));
- break;
- case BLITSHADER_2D_LUMAF_PREMULTIPLY:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_FtoF_PM_LUMA),
- "Blit11 2D LUMA premultiply pixel shader"));
- break;
- case BLITSHADER_2D_LUMAF_UNMULTIPLY:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D, ShaderData(g_PS_FtoF_UM_LUMA),
- "Blit11 2D LUMA unmultiply pixel shader"));
- break;
- case BLITSHADER_2D_LUMAALPHAF_PREMULTIPLY:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_FtoF_PM_LUMAALPHA),
- "Blit11 2D LUMAALPHA premultiply pixel shader"));
- break;
- case BLITSHADER_2D_LUMAALPHAF_UNMULTIPLY:
- ANGLE_TRY(addBlitShaderToMap(blitShaderType, SHADER_2D,
- ShaderData(g_PS_FtoF_UM_LUMAALPHA),
- "Blit11 2D LUMAALPHA unmultiply pixel shader"));
- break;
-
- default:
- UNREACHABLE();
- return gl::InternalError() << "Internal error";
- }
-
- blitShaderIt = mBlitShaderMap.find(blitShaderType);
- ASSERT(blitShaderIt != mBlitShaderMap.end());
- *shader = &blitShaderIt->second;
- return gl::NoError();
-}
-
-gl::Error Blit11::getSwizzleShader(GLenum type,
- D3D11_SRV_DIMENSION viewDimension,
- const Shader **shader)
-{
- SwizzleShaderType swizzleShaderType = GetSwizzleShaderType(type, viewDimension);
-
- if (swizzleShaderType == SWIZZLESHADER_INVALID)
- {
- return gl::InternalError() << "Swizzle shader type not found";
- }
-
- auto swizzleShaderIt = mSwizzleShaderMap.find(swizzleShaderType);
- if (swizzleShaderIt != mSwizzleShaderMap.end())
- {
- *shader = &swizzleShaderIt->second;
- return gl::NoError();
- }
-
- // Swizzling shaders (OpenGL ES 3+)
- ASSERT(mRenderer->isES3Capable());
-
- switch (swizzleShaderType)
- {
- case SWIZZLESHADER_2D_FLOAT:
- ANGLE_TRY(addSwizzleShaderToMap(swizzleShaderType, SHADER_2D,
- ShaderData(g_PS_SwizzleF2D),
- "Blit11 2D F swizzle pixel shader"));
- break;
- case SWIZZLESHADER_2D_UINT:
- ANGLE_TRY(addSwizzleShaderToMap(swizzleShaderType, SHADER_2D,
- ShaderData(g_PS_SwizzleUI2D),
- "Blit11 2D UI swizzle pixel shader"));
- break;
- case SWIZZLESHADER_2D_INT:
- ANGLE_TRY(addSwizzleShaderToMap(swizzleShaderType, SHADER_2D,
- ShaderData(g_PS_SwizzleI2D),
- "Blit11 2D I swizzle pixel shader"));
- break;
- case SWIZZLESHADER_CUBE_FLOAT:
- ANGLE_TRY(addSwizzleShaderToMap(swizzleShaderType, SHADER_3D,
- ShaderData(g_PS_SwizzleF2DArray),
- "Blit11 2D Cube F swizzle pixel shader"));
- break;
- case SWIZZLESHADER_CUBE_UINT:
- ANGLE_TRY(addSwizzleShaderToMap(swizzleShaderType, SHADER_3D,
- ShaderData(g_PS_SwizzleUI2DArray),
- "Blit11 2D Cube UI swizzle pixel shader"));
- break;
- case SWIZZLESHADER_CUBE_INT:
- ANGLE_TRY(addSwizzleShaderToMap(swizzleShaderType, SHADER_3D,
- ShaderData(g_PS_SwizzleI2DArray),
- "Blit11 2D Cube I swizzle pixel shader"));
- break;
- case SWIZZLESHADER_3D_FLOAT:
- ANGLE_TRY(addSwizzleShaderToMap(swizzleShaderType, SHADER_3D,
- ShaderData(g_PS_SwizzleF3D),
- "Blit11 3D F swizzle pixel shader"));
- break;
- case SWIZZLESHADER_3D_UINT:
- ANGLE_TRY(addSwizzleShaderToMap(swizzleShaderType, SHADER_3D,
- ShaderData(g_PS_SwizzleUI3D),
- "Blit11 3D UI swizzle pixel shader"));
- break;
- case SWIZZLESHADER_3D_INT:
- ANGLE_TRY(addSwizzleShaderToMap(swizzleShaderType, SHADER_3D,
- ShaderData(g_PS_SwizzleI3D),
- "Blit11 3D I swizzle pixel shader"));
- break;
- case SWIZZLESHADER_ARRAY_FLOAT:
- ANGLE_TRY(addSwizzleShaderToMap(swizzleShaderType, SHADER_3D,
- ShaderData(g_PS_SwizzleF2DArray),
- "Blit11 2D Array F swizzle pixel shader"));
- break;
- case SWIZZLESHADER_ARRAY_UINT:
- ANGLE_TRY(addSwizzleShaderToMap(swizzleShaderType, SHADER_3D,
- ShaderData(g_PS_SwizzleUI2DArray),
- "Blit11 2D Array UI swizzle pixel shader"));
- break;
- case SWIZZLESHADER_ARRAY_INT:
- ANGLE_TRY(addSwizzleShaderToMap(swizzleShaderType, SHADER_3D,
- ShaderData(g_PS_SwizzleI2DArray),
- "Blit11 2D Array I swizzle pixel shader"));
- break;
- default:
- UNREACHABLE();
- return gl::InternalError() << "Internal error";
- }
-
- swizzleShaderIt = mSwizzleShaderMap.find(swizzleShaderType);
- ASSERT(swizzleShaderIt != mSwizzleShaderMap.end());
- *shader = &swizzleShaderIt->second;
- return gl::NoError();
-}
-
-gl::ErrorOrResult<TextureHelper11> Blit11::resolveDepth(const gl::Context *context,
- RenderTarget11 *depth)
-{
- ANGLE_TRY(initResources());
-
- // 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(depth->getFormatSet(), extents));
-
- ANGLE_TRY(mResolveDepthStencilVS.resolve(mRenderer));
- ANGLE_TRY(mResolveDepthPS.resolve(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::SAMPLER_PIXEL, 0, &depth->getShaderResourceView());
-
- // Trigger the blit on the GPU.
- deviceContext->Draw(6, 0);
-
- return mResolvedDepth;
-}
-
-gl::Error Blit11::initResolveDepthOnly(const d3d11::Format &format, const gl::Extents &extents)
-{
- if (mResolvedDepth.valid() && extents == mResolvedDepth.getExtents() &&
- format.texFormat == mResolvedDepth.getFormat())
- {
- return gl::NoError();
- }
-
- 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;
-
- ANGLE_TRY(mRenderer->allocateTexture(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(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 *context = mRenderer->getDeviceContext();
- context->ClearDepthStencilView(mResolvedDepthDSView.get(), D3D11_CLEAR_DEPTH, 1.0f, 0);
-
- return gl::NoError();
-}
-
-gl::Error Blit11::initResolveDepthStencil(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 gl::NoError();
- }
-
- 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;
-
- ANGLE_TRY(mRenderer->allocateTexture(textureDesc, formatSet, &mResolvedDepthStencil));
- mResolvedDepthStencil.setDebugName("Blit11::mResolvedDepthStencil");
-
- ANGLE_TRY(mRenderer->allocateResourceNoDesc(mResolvedDepthStencil.get(),
- &mResolvedDepthStencilRTView));
- mResolvedDepthStencilRTView.setDebugName("Blit11::mResolvedDepthStencilRTView");
-
- return gl::NoError();
-}
-
-gl::ErrorOrResult<TextureHelper11> Blit11::resolveStencil(const gl::Context *context,
- RenderTarget11 *depthStencil,
- bool alsoDepth)
-{
- ANGLE_TRY(initResources());
-
- // 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(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);
- }
-
- if (!mStencilSRV.valid())
- {
- D3D11_SHADER_RESOURCE_VIEW_DESC srViewDesc;
- srViewDesc.Format = GetStencilSRVFormat(depthStencil->getFormatSet());
- srViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
-
- ANGLE_TRY(mRenderer->allocateResource(srViewDesc, stencilResource, &mStencilSRV));
- mStencilSRV.setDebugName("Blit11::mStencilSRV");
- }
-
- // Notify the Renderer that all state should be invalidated.
- ANGLE_TRY(mResolveDepthStencilVS.resolve(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(mRenderer));
- pixelShader = &mResolveDepthStencilPS.getObj();
- }
- else
- {
- ANGLE_TRY(mResolveStencilPS.resolve(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::SAMPLER_PIXEL, 0,
- &depthStencil->getShaderResourceView());
- stateManager->setShaderResource(gl::SAMPLER_PIXEL, 1, &mStencilSRV);
-
- // Trigger the blit on the GPU.
- deviceContext->Draw(6, 0);
-
- gl::Box copyBox(0, 0, 0, extents.width, extents.height, 1);
-
- TextureHelper11 dest;
- ANGLE_TRY_RESULT(
- mRenderer->createStagingTexture(ResourceType::Texture2D, depthStencil->getFormatSet(),
- extents, StagingAccess::READ_WRITE),
- dest);
-
- const auto &copyFunction = GetCopyDepthStencilFunction(depthStencil->getInternalFormat());
- const auto &dsFormatSet = depthStencil->getFormatSet();
- const auto &dsDxgiInfo = d3d11::GetDXGIFormatSizeInfo(dsFormatSet.texFormat);
-
- ANGLE_TRY(copyAndConvertImpl(mResolvedDepthStencil, 0, copyBox, extents, dest, copyBox, extents,
- nullptr, 0, 0, 0, 8u, dsDxgiInfo.pixelBytes, copyFunction));
-
- // Return the resolved depth texture, which the caller must Release.
- return dest;
-}
-
-void Blit11::releaseResolveDepthStencilResources()
-{
- mStencilSRV.reset();
- mResolvedDepthStencilRTView.reset();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.h
deleted file mode 100644
index 14078f9db8..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.h
+++ /dev/null
@@ -1,332 +0,0 @@
-//
-// 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();
-
- gl::Error swizzleTexture(const gl::Context *context,
- const d3d11::SharedSRV &source,
- const d3d11::RenderTargetView &dest,
- const gl::Extents &size,
- const gl::SwizzleState &swizzleTarget);
-
- gl::Error 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 filter,
- bool maskOffAlpha,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha);
-
- gl::Error 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);
-
- gl::Error 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);
-
- gl::Error copyDepthStencil(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);
-
- gl::ErrorOrResult<TextureHelper11> resolveDepth(const gl::Context *context,
- RenderTarget11 *depth);
-
- gl::ErrorOrResult<TextureHelper11> resolveStencil(const gl::Context *context,
- RenderTarget11 *depthStencil,
- bool alsoDepth);
-
- 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 BlitShaderType
- {
- BLITSHADER_INVALID,
-
- // Passthrough shaders
- BLITSHADER_2D_RGBAF,
- BLITSHADER_2D_BGRAF,
- BLITSHADER_2D_RGBF,
- BLITSHADER_2D_RGF,
- BLITSHADER_2D_RF,
- BLITSHADER_2D_ALPHA,
- BLITSHADER_2D_LUMA,
- BLITSHADER_2D_LUMAALPHA,
- BLITSHADER_2D_RGBAUI,
- BLITSHADER_2D_RGBAI,
- BLITSHADER_2D_RGBUI,
- BLITSHADER_2D_RGBI,
- BLITSHADER_2D_RGUI,
- BLITSHADER_2D_RGI,
- BLITSHADER_2D_RUI,
- BLITSHADER_2D_RI,
- BLITSHADER_3D_RGBAF,
- BLITSHADER_3D_RGBAUI,
- BLITSHADER_3D_RGBAI,
- BLITSHADER_3D_BGRAF,
- BLITSHADER_3D_RGBF,
- BLITSHADER_3D_RGBUI,
- BLITSHADER_3D_RGBI,
- BLITSHADER_3D_RGF,
- BLITSHADER_3D_RGUI,
- BLITSHADER_3D_RGI,
- BLITSHADER_3D_RF,
- BLITSHADER_3D_RUI,
- BLITSHADER_3D_RI,
- BLITSHADER_3D_ALPHA,
- BLITSHADER_3D_LUMA,
- BLITSHADER_3D_LUMAALPHA,
-
- // Multiply alpha shaders
- 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
- };
-
- 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_2D,
- SHADER_3D,
- };
-
- 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;
- };
-
- gl::Error initResources();
-
- gl::Error getShaderSupport(const Shader &shader, ShaderSupport *supportOut);
-
- static BlitShaderType GetBlitShaderType(GLenum destinationFormat,
- GLenum sourceFormat,
- bool isSigned,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- ShaderDimension dimension);
- static SwizzleShaderType GetSwizzleShaderType(GLenum type, D3D11_SRV_DIMENSION dimensionality);
-
- gl::Error copyDepthStencilImpl(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);
-
- gl::Error copyAndConvertImpl(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);
-
- gl::Error copyAndConvert(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);
-
- gl::Error addBlitShaderToMap(BlitShaderType blitShaderType,
- ShaderDimension dimension,
- const ShaderData &shaderData,
- const char *name);
-
- gl::Error getBlitShader(GLenum destFormat,
- GLenum sourceFormat,
- bool isSigned,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- ShaderDimension dimension,
- const Shader **shaderOut);
- gl::Error getSwizzleShader(GLenum type,
- D3D11_SRV_DIMENSION viewDimension,
- const Shader **shaderOut);
-
- gl::Error addSwizzleShaderToMap(SwizzleShaderType swizzleShaderType,
- ShaderDimension dimension,
- const ShaderData &shaderData,
- const char *name);
-
- void clearShaderMap();
- void releaseResolveDepthStencilResources();
- gl::Error initResolveDepthOnly(const d3d11::Format &format, const gl::Extents &extents);
- gl::Error initResolveDepthStencil(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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
deleted file mode 100644
index 2317c9abdb..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
+++ /dev/null
@@ -1,1600 +0,0 @@
-//
-// 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/renderer/d3d/IndexDataManager.h"
-#include "libANGLE/renderer/d3d/VertexDataManager.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 gl::ErrorOrResult<CopyResult> copyFromStorage(const gl::Context *context,
- BufferStorage *source,
- size_t sourceOffset,
- size_t size,
- size_t destOffset) = 0;
- virtual gl::Error resize(const gl::Context *context, size_t size, bool preserveData) = 0;
-
- virtual gl::Error map(size_t offset,
- size_t length,
- GLbitfield access,
- uint8_t **mapPointerOut) = 0;
- virtual void unmap() = 0;
-
- gl::Error setData(const uint8_t *data, size_t offset, size_t size);
-
- protected:
- BufferStorage(Renderer11 *renderer, BufferUsage usage);
-
- Renderer11 *mRenderer;
- DataRevision mRevision;
- const BufferUsage mUsage;
- size_t mBufferSize;
-};
-
-// A native buffer storage represents an underlying D3D11 buffer for a particular
-// type of storage.
-class Buffer11::NativeStorage : public Buffer11::BufferStorage
-{
- public:
- NativeStorage(Renderer11 *renderer,
- BufferUsage usage,
- const OnBufferDataDirtyChannel *onStorageChanged);
- ~NativeStorage() override;
-
- bool isCPUAccessible(GLbitfield access) const override;
-
- bool isGPUAccessible() const override { return true; }
-
- const d3d11::Buffer &getBuffer() const { return mBuffer; }
- gl::ErrorOrResult<CopyResult> copyFromStorage(const gl::Context *context,
- BufferStorage *source,
- size_t sourceOffset,
- size_t size,
- size_t destOffset) override;
- gl::Error resize(const gl::Context *context, size_t size, bool preserveData) override;
-
- gl::Error map(size_t offset,
- size_t length,
- GLbitfield access,
- uint8_t **mapPointerOut) override;
- void unmap() override;
-
- gl::ErrorOrResult<const d3d11::ShaderResourceView *> getSRVForFormat(DXGI_FORMAT srvFormat);
-
- private:
- static void FillBufferDesc(D3D11_BUFFER_DESC *bufferDesc,
- Renderer11 *renderer,
- BufferUsage usage,
- unsigned int bufferSize);
- void clearSRVs();
-
- d3d11::Buffer mBuffer;
- const OnBufferDataDirtyChannel *mOnStorageChanged;
- std::map<DXGI_FORMAT, d3d11::ShaderResourceView> mBufferResourceViews;
-};
-
-// 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; }
-
- gl::ErrorOrResult<const d3d11::Buffer *> getBuffer(SourceIndexData *indexInfo,
- const TranslatedAttribute &attribute,
- GLint startVertex);
-
- gl::ErrorOrResult<CopyResult> copyFromStorage(const gl::Context *context,
- BufferStorage *source,
- size_t sourceOffset,
- size_t size,
- size_t destOffset) override;
-
- gl::Error resize(const gl::Context *context, size_t size, bool preserveData) override;
-
- gl::Error map(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; }
-
- gl::ErrorOrResult<CopyResult> copyFromStorage(const gl::Context *context,
- BufferStorage *source,
- size_t sourceOffset,
- size_t size,
- size_t destOffset) override;
- gl::Error resize(const gl::Context *context, size_t size, bool preserveData) override;
-
- gl::Error map(size_t offset,
- size_t length,
- GLbitfield access,
- uint8_t **mapPointerOut) override;
- void unmap() override;
-
- gl::Error packPixels(const gl::Context *context,
- const gl::FramebufferAttachment &readAttachment,
- const PackPixelsParams &params);
-
- private:
- gl::Error flushQueuedPackCommand();
-
- 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; }
-
- gl::ErrorOrResult<CopyResult> copyFromStorage(const gl::Context *context,
- BufferStorage *source,
- size_t sourceOffset,
- size_t size,
- size_t destOffset) override;
- gl::Error resize(const gl::Context *context, size_t size, bool preserveData) override;
-
- gl::Error map(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);
-}
-
-gl::Error Buffer11::setData(const gl::Context *context,
- gl::BufferBinding target,
- const void *data,
- size_t size,
- gl::BufferUsage usage)
-{
- updateD3DBufferUsage(context, usage);
- ANGLE_TRY(setSubData(context, target, data, size, 0));
- return gl::NoError();
-}
-
-gl::Error Buffer11::getData(const gl::Context *context, const uint8_t **outData)
-{
- SystemMemoryStorage *systemMemoryStorage = nullptr;
- ANGLE_TRY_RESULT(getSystemMemoryStorage(context), systemMemoryStorage);
-
- ASSERT(systemMemoryStorage->getSize() >= mSize);
-
- *outData = systemMemoryStorage->getSystemCopy()->data();
- return gl::NoError();
-}
-
-gl::ErrorOrResult<Buffer11::SystemMemoryStorage *> Buffer11::getSystemMemoryStorage(
- const gl::Context *context)
-{
- BufferStorage *storage = nullptr;
- ANGLE_TRY_RESULT(getBufferStorage(context, BUFFER_USAGE_SYSTEM_MEMORY), storage);
- return GetAs<SystemMemoryStorage>(storage);
-}
-
-gl::Error 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->getWorkarounds().useSystemMemoryForConstantBuffers)
- {
- ANGLE_TRY_RESULT(getBufferStorage(context, BUFFER_USAGE_UNIFORM), writeBuffer);
- }
- else
- {
- ANGLE_TRY_RESULT(getSystemMemoryStorage(context), writeBuffer);
- }
- }
- else if (supportsDirectBinding())
- {
- ANGLE_TRY_RESULT(getStagingStorage(context), writeBuffer);
- }
- else
- {
- ANGLE_TRY_RESULT(getSystemMemoryStorage(context), 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(static_cast<const uint8_t *>(data), offset, size));
- onStorageUpdate(writeBuffer);
-
- // Notify any vertex arrays that we have dirty data.
- // TODO(jmadill): Use a more fine grained notification for data updates.
- mDirectBroadcastChannel.signal(context);
- }
-
- mSize = std::max(mSize, requiredSize);
- invalidateStaticData(context);
-
- return gl::NoError();
-}
-
-gl::Error 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_RESULT(getLatestBufferStorage(context), copyDest);
-
- if (!copyDest)
- {
- ANGLE_TRY_RESULT(getStagingStorage(context), copyDest);
- }
-
- BufferStorage *copySource = nullptr;
- ANGLE_TRY_RESULT(sourceBuffer->getLatestBufferStorage(context), copySource);
-
- if (!copySource)
- {
- ANGLE_TRY_RESULT(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_RESULT(sourceBuffer->getStagingStorage(context), copySource);
- }
- else if (!copySource->isGPUAccessible() && !copyDest->isCPUAccessible(GL_MAP_WRITE_BIT))
- {
- ANGLE_TRY_RESULT(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_RESULT(getBufferStorage(context, BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK),
- copySource);
- }
- else
- {
- ANGLE_TRY_RESULT(getStagingStorage(context), copySource);
- }
- }
-
- CopyResult copyResult = CopyResult::NOT_RECREATED;
- ANGLE_TRY_RESULT(copyDest->copyFromStorage(context, copySource, sourceOffset, size, destOffset),
- copyResult);
- onStorageUpdate(copyDest);
-
- mSize = std::max<size_t>(mSize, destOffset + size);
- invalidateStaticData(context);
-
- // Also notify that direct buffers are dirty.
- mDirectBroadcastChannel.signal(context);
-
- return gl::NoError();
-}
-
-gl::Error 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);
-}
-
-gl::Error Buffer11::mapRange(const gl::Context *context,
- size_t offset,
- size_t length,
- GLbitfield access,
- void **mapPtr)
-{
- ASSERT(!mMappedStorage);
-
- BufferStorage *latestStorage = nullptr;
- ANGLE_TRY_RESULT(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_RESULT(getStagingStorage(context), mMappedStorage);
- }
-
- if (!mMappedStorage)
- {
- return gl::OutOfMemory() << "Failed to allocate mappable internal buffer.";
- }
-
- 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(offset, length, access, &mappedBuffer));
- ASSERT(mappedBuffer);
-
- *mapPtr = static_cast<void *>(mappedBuffer);
- return gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error Buffer11::markTransformFeedbackUsage(const gl::Context *context)
-{
- BufferStorage *transformFeedbackStorage = nullptr;
- ANGLE_TRY_RESULT(getBufferStorage(context, BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK),
- transformFeedbackStorage);
-
- if (transformFeedbackStorage)
- {
- onStorageUpdate(transformFeedbackStorage);
- }
-
- invalidateStaticData(context);
- return gl::NoError();
-}
-
-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.
-gl::Error 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_RESULT(getLatestBufferStorage(context), latestStorage);
- if (latestStorage != storage)
- {
- SafeDelete(storage);
- }
- }
-
- return gl::NoError();
-}
-
-// 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->getWorkarounds().useSystemMemoryForConstantBuffers)
- {
- return false;
- }
-
- return (!mBufferStorages[BUFFER_USAGE_UNIFORM] ||
- mSize <= mRenderer->getNativeCaps().maxUniformBlockSize);
-}
-
-void Buffer11::markBufferUsage(BufferUsage usage)
-{
- mIdleness[usage] = 0;
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::ErrorOrResult<ID3D11Buffer *> Buffer11::getBuffer(const gl::Context *context, BufferUsage usage)
-{
- BufferStorage *storage = nullptr;
- ANGLE_TRY_RESULT(getBufferStorage(context, usage), storage);
- return GetAs<NativeStorage>(storage)->getBuffer().get();
-}
-
-gl::ErrorOrResult<ID3D11Buffer *> Buffer11::getEmulatedIndexedBuffer(
- const gl::Context *context,
- SourceIndexData *indexInfo,
- const TranslatedAttribute &attribute,
- GLint startVertex)
-{
- ASSERT(indexInfo);
-
- BufferStorage *untypedStorage = nullptr;
- ANGLE_TRY_RESULT(getBufferStorage(context, BUFFER_USAGE_EMULATED_INDEXED_VERTEX),
- untypedStorage);
-
- EmulatedIndexedStorage *emulatedStorage = GetAs<EmulatedIndexedStorage>(untypedStorage);
-
- const d3d11::Buffer *nativeStorage = nullptr;
- ANGLE_TRY_RESULT(emulatedStorage->getBuffer(indexInfo, attribute, startVertex), nativeStorage);
-
- return nativeStorage->get();
-}
-
-gl::Error Buffer11::getConstantBufferRange(const gl::Context *context,
- GLintptr offset,
- GLsizeiptr size,
- const d3d11::Buffer **bufferOut,
- UINT *firstConstantOut,
- UINT *numConstantsOut)
-{
- BufferStorage *bufferStorage = nullptr;
-
- if (offset == 0 || mRenderer->getRenderer11DeviceCaps().supportsConstantBufferOffsets)
- {
- ANGLE_TRY_RESULT(getBufferStorage(context, BUFFER_USAGE_UNIFORM), bufferStorage);
- CalculateConstantBufferParams(offset, size, firstConstantOut, numConstantsOut);
- }
- else
- {
- ANGLE_TRY_RESULT(getConstantBufferRangeStorage(context, offset, size), bufferStorage);
- *firstConstantOut = 0;
- *numConstantsOut = 0;
- }
-
- *bufferOut = &GetAs<NativeStorage>(bufferStorage)->getBuffer();
-
- return gl::NoError();
-}
-
-gl::ErrorOrResult<const d3d11::ShaderResourceView *> Buffer11::getSRV(const gl::Context *context,
- DXGI_FORMAT srvFormat)
-{
- BufferStorage *storage = nullptr;
- ANGLE_TRY_RESULT(getBufferStorage(context, BUFFER_USAGE_PIXEL_UNPACK), storage);
- NativeStorage *nativeStorage = GetAs<NativeStorage>(storage);
- return nativeStorage->getSRVForFormat(srvFormat);
-}
-
-gl::Error Buffer11::packPixels(const gl::Context *context,
- const gl::FramebufferAttachment &readAttachment,
- const PackPixelsParams &params)
-{
- PackStorage *packStorage = nullptr;
- ANGLE_TRY_RESULT(getPackStorage(context), packStorage);
-
- ASSERT(packStorage);
- ANGLE_TRY(packStorage->packPixels(context, readAttachment, params));
- onStorageUpdate(packStorage);
-
- return gl::NoError();
-}
-
-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;
-}
-
-gl::ErrorOrResult<Buffer11::BufferStorage *> Buffer11::getBufferStorage(const gl::Context *context,
- BufferUsage usage)
-{
- 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));
-
- return newStorage;
-}
-
-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, &mDirectBroadcastChannel);
- default:
- return new NativeStorage(mRenderer, usage, nullptr);
- }
-}
-
-gl::ErrorOrResult<Buffer11::BufferStorage *> Buffer11::getConstantBufferRangeStorage(
- const gl::Context *context,
- GLintptr offset,
- GLsizeiptr size)
-{
- BufferStorage *newStorage;
-
- {
- // Keep the cacheEntry in a limited scope because it may be invalidated later in the code if
- // we need to reclaim some space.
- ConstantBufferCacheEntry *cacheEntry = &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));
- return newStorage;
-}
-
-gl::Error Buffer11::updateBufferStorage(const gl::Context *context,
- BufferStorage *storage,
- size_t sourceOffset,
- size_t storageSize)
-{
- BufferStorage *latestBuffer = nullptr;
- ANGLE_TRY_RESULT(getLatestBufferStorage(context), latestBuffer);
-
- ASSERT(storage);
-
- if (!latestBuffer)
- {
- onStorageUpdate(storage);
- return gl::NoError();
- }
-
- if (latestBuffer->getDataRevision() <= storage->getDataRevision())
- {
- return gl::NoError();
- }
-
- // 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_RESULT(getStagingStorage(context), stagingBuffer);
-
- CopyResult copyResult = CopyResult::NOT_RECREATED;
- ANGLE_TRY_RESULT(
- stagingBuffer->copyFromStorage(context, latestBuffer, 0, latestBuffer->getSize(), 0),
- copyResult);
- onCopyStorage(stagingBuffer, latestBuffer);
-
- latestBuffer = stagingBuffer;
- }
-
- CopyResult copyResult = CopyResult::NOT_RECREATED;
- ANGLE_TRY_RESULT(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 gl::NoError();
-}
-
-gl::ErrorOrResult<Buffer11::BufferStorage *> Buffer11::getLatestBufferStorage(
- const gl::Context *context) const
-{
- // resize buffer
- if (mLatestBufferStorage && mLatestBufferStorage->getSize() < mSize)
- {
- ANGLE_TRY(mLatestBufferStorage->resize(context, mSize, true));
- }
-
- return mLatestBufferStorage;
-}
-
-gl::ErrorOrResult<Buffer11::NativeStorage *> Buffer11::getStagingStorage(const gl::Context *context)
-{
- BufferStorage *stagingStorage = nullptr;
- ANGLE_TRY_RESULT(getBufferStorage(context, BUFFER_USAGE_STAGING), stagingStorage);
- return GetAs<NativeStorage>(stagingStorage);
-}
-
-gl::ErrorOrResult<Buffer11::PackStorage *> Buffer11::getPackStorage(const gl::Context *context)
-{
- BufferStorage *packStorage = nullptr;
- ANGLE_TRY_RESULT(getBufferStorage(context, BUFFER_USAGE_PIXEL_PACK), packStorage);
- return GetAs<PackStorage>(packStorage);
-}
-
-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);
-
- // Notify when static data changes.
- mStaticBroadcastChannel.signal(context);
-}
-
-void Buffer11::invalidateStaticData(const gl::Context *context)
-{
- BufferD3D::invalidateStaticData(context);
-
- // Notify when static data changes.
- mStaticBroadcastChannel.signal(context);
-}
-
-OnBufferDataDirtyChannel *Buffer11::getStaticBroadcastChannel()
-{
- return &mStaticBroadcastChannel;
-}
-
-OnBufferDataDirtyChannel *Buffer11::getDirectBroadcastChannel()
-{
- return &mDirectBroadcastChannel;
-}
-
-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)
-{
-}
-
-gl::Error Buffer11::BufferStorage::setData(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(offset, mapSize, GL_MAP_WRITE_BIT, &writePointer));
-
- memcpy(writePointer, data, mapSize);
-
- unmap();
-
- return gl::NoError();
-}
-
-// Buffer11::NativeStorage implementation
-
-Buffer11::NativeStorage::NativeStorage(Renderer11 *renderer,
- BufferUsage usage,
- const OnBufferDataDirtyChannel *onStorageChanged)
- : BufferStorage(renderer, usage), mBuffer(), mOnStorageChanged(onStorageChanged)
-{
-}
-
-Buffer11::NativeStorage::~NativeStorage()
-{
- clearSRVs();
-}
-
-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
-gl::ErrorOrResult<CopyResult> Buffer11::NativeStorage::copyFromStorage(const gl::Context *context,
- BufferStorage *source,
- size_t sourceOffset,
- size_t size,
- size_t destOffset)
-{
- size_t requiredSize = destOffset + size;
- bool createBuffer = !mBuffer.valid() || mBufferSize < requiredSize;
-
- // (Re)initialize D3D buffer if needed
- bool preserveData = (destOffset > 0);
- if (createBuffer)
- {
- ANGLE_TRY(resize(context, requiredSize, preserveData));
- }
-
- size_t clampedSize = size;
- if (mUsage == BUFFER_USAGE_UNIFORM)
- {
- clampedSize = std::min(clampedSize, mBufferSize - destOffset);
- }
-
- 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(sourceOffset, clampedSize, GL_MAP_READ_BIT, &sourcePointer));
-
- auto err = setData(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 createBuffer ? CopyResult::RECREATED : CopyResult::NOT_RECREATED;
-}
-
-gl::Error Buffer11::NativeStorage::resize(const gl::Context *context,
- size_t size,
- bool preserveData)
-{
- D3D11_BUFFER_DESC bufferDesc;
- FillBufferDesc(&bufferDesc, mRenderer, mUsage, static_cast<unsigned int>(size));
-
- d3d11::Buffer newBuffer;
- ANGLE_TRY(mRenderer->allocateResource(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();
-
- // Notify that the storage has changed.
- if (mOnStorageChanged)
- {
- mOnStorageChanged->signal(context);
- }
-
- return gl::NoError();
-}
-
-// 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;
-
- default:
- UNREACHABLE();
- }
-}
-
-gl::Error Buffer11::NativeStorage::map(size_t offset,
- size_t length,
- GLbitfield access,
- uint8_t **mapPointerOut)
-{
- ASSERT(isCPUAccessible(access));
-
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- D3D11_MAP d3dMapType = gl_d3d11::GetD3DMapTypeFromBits(mUsage, access);
- UINT d3dMapFlag = ((access & GL_MAP_UNSYNCHRONIZED_BIT) != 0 ? D3D11_MAP_FLAG_DO_NOT_WAIT : 0);
-
- HRESULT result = context->Map(mBuffer.get(), 0, d3dMapType, d3dMapFlag, &mappedResource);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to map native storage in Buffer11::NativeStorage::map";
- }
- ASSERT(mappedResource.pData);
- *mapPointerOut = static_cast<uint8_t *>(mappedResource.pData) + offset;
- return gl::NoError();
-}
-
-void Buffer11::NativeStorage::unmap()
-{
- ASSERT(isCPUAccessible(GL_MAP_WRITE_BIT) || isCPUAccessible(GL_MAP_READ_BIT));
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- context->Unmap(mBuffer.get(), 0);
-}
-
-gl::ErrorOrResult<const d3d11::ShaderResourceView *> Buffer11::NativeStorage::getSRVForFormat(
- DXGI_FORMAT srvFormat)
-{
- auto bufferSRVIt = mBufferResourceViews.find(srvFormat);
-
- if (bufferSRVIt != mBufferResourceViews.end())
- {
- return &bufferSRVIt->second;
- }
-
- 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(bufferSRVDesc, mBuffer.get(),
- &mBufferResourceViews[srvFormat]));
-
- return &mBufferResourceViews[srvFormat];
-}
-
-void Buffer11::NativeStorage::clearSRVs()
-{
- mBufferResourceViews.clear();
-}
-
-// Buffer11::EmulatedIndexStorage implementation
-
-Buffer11::EmulatedIndexedStorage::EmulatedIndexedStorage(Renderer11 *renderer)
- : BufferStorage(renderer, BUFFER_USAGE_EMULATED_INDEXED_VERTEX), mBuffer()
-{
-}
-
-Buffer11::EmulatedIndexedStorage::~EmulatedIndexedStorage()
-{
-}
-
-gl::ErrorOrResult<const d3d11::Buffer *> Buffer11::EmulatedIndexedStorage::getBuffer(
- SourceIndexData *indexInfo,
- const TranslatedAttribute &attribute,
- GLint startVertex)
-{
- // 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_UNSIGNED_INT:
- indicesDataSize = sizeof(GLuint) * indexInfo->srcCount;
- break;
- case GL_UNSIGNED_SHORT:
- indicesDataSize = sizeof(GLushort) * indexInfo->srcCount;
- break;
- case GL_UNSIGNED_BYTE:
- indicesDataSize = sizeof(GLubyte) * indexInfo->srcCount;
- break;
- default:
- indicesDataSize = sizeof(GLushort) * indexInfo->srcCount;
- break;
- }
-
- if (!mIndicesMemoryBuffer.resize(indicesDataSize))
- {
- return gl::OutOfMemory() << "Error resizing index memory buffer in "
- "Buffer11::EmulatedIndexedStorage::getBuffer";
- }
-
- memcpy(mIndicesMemoryBuffer.data(), indexInfo->srcIndices, indicesDataSize);
-
- indexInfo->srcIndicesChanged = false;
- }
-
- if (!mBuffer.valid())
- {
- unsigned int offset = 0;
- ANGLE_TRY_RESULT(attribute.computeOffset(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;
- if (!expandedData.resize(expandedDataSize))
- {
- return gl::OutOfMemory()
- << "Error resizing buffer in Buffer11::EmulatedIndexedStorage::getBuffer";
- }
-
- // 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_UNSIGNED_INT:
- readIndexValue = ReadIndexValueFromIndices<GLuint>;
- break;
- case GL_UNSIGNED_SHORT:
- readIndexValue = ReadIndexValueFromIndices<GLushort>;
- break;
- case GL_UNSIGNED_BYTE:
- readIndexValue = ReadIndexValueFromIndices<GLubyte>;
- break;
- }
-
- // 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(bufferDesc, &subResourceData, &mBuffer));
- mBuffer.setDebugName("Buffer11::EmulatedIndexedStorage");
- }
-
- return &mBuffer;
-}
-
-gl::ErrorOrResult<CopyResult> Buffer11::EmulatedIndexedStorage::copyFromStorage(
- const gl::Context *context,
- BufferStorage *source,
- size_t sourceOffset,
- size_t size,
- size_t destOffset)
-{
- ASSERT(source->isCPUAccessible(GL_MAP_READ_BIT));
- uint8_t *sourceData = nullptr;
- ANGLE_TRY(source->map(sourceOffset, size, GL_MAP_READ_BIT, &sourceData));
- ASSERT(destOffset + size <= mMemoryBuffer.size());
- memcpy(mMemoryBuffer.data() + destOffset, sourceData, size);
- source->unmap();
- return CopyResult::RECREATED;
-}
-
-gl::Error Buffer11::EmulatedIndexedStorage::resize(const gl::Context *context,
- size_t size,
- bool preserveData)
-{
- if (mMemoryBuffer.size() < size)
- {
- if (!mMemoryBuffer.resize(size))
- {
- return gl::OutOfMemory() << "Failed to resize EmulatedIndexedStorage";
- }
- mBufferSize = size;
- }
-
- return gl::NoError();
-}
-
-gl::Error Buffer11::EmulatedIndexedStorage::map(size_t offset,
- size_t length,
- GLbitfield access,
- uint8_t **mapPointerOut)
-{
- ASSERT(!mMemoryBuffer.empty() && offset + length <= mMemoryBuffer.size());
- *mapPointerOut = mMemoryBuffer.data() + offset;
- return gl::NoError();
-}
-
-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()
-{
-}
-
-gl::ErrorOrResult<CopyResult> Buffer11::PackStorage::copyFromStorage(const gl::Context *context,
- BufferStorage *source,
- size_t sourceOffset,
- size_t size,
- size_t destOffset)
-{
- ANGLE_TRY(flushQueuedPackCommand());
-
- // 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(sourceOffset, size, GL_MAP_READ_BIT, &sourceData));
- ASSERT(destOffset + size <= mMemoryBuffer.size());
- memcpy(mMemoryBuffer.data() + destOffset, sourceData, size);
- source->unmap();
- return CopyResult::NOT_RECREATED;
-}
-
-gl::Error Buffer11::PackStorage::resize(const gl::Context *context, size_t size, bool preserveData)
-{
- if (size != mBufferSize)
- {
- if (!mMemoryBuffer.resize(size))
- {
- return gl::OutOfMemory() << "Failed to resize internal buffer storage.";
- }
- mBufferSize = size;
- }
-
- return gl::NoError();
-}
-
-gl::Error Buffer11::PackStorage::map(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());
-
- mDataModified = (mDataModified || (access & GL_MAP_WRITE_BIT) != 0);
-
- *mapPointerOut = mMemoryBuffer.data() + offset;
- return gl::NoError();
-}
-
-void Buffer11::PackStorage::unmap()
-{
- // No-op
-}
-
-gl::Error Buffer11::PackStorage::packPixels(const gl::Context *context,
- const gl::FramebufferAttachment &readAttachment,
- const PackPixelsParams &params)
-{
- ANGLE_TRY(flushQueuedPackCommand());
-
- 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_RESULT(
- mRenderer->createStagingTexture(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 gl::NoError();
-}
-
-gl::Error Buffer11::PackStorage::flushQueuedPackCommand()
-{
- ASSERT(mMemoryBuffer.size() > 0);
-
- if (mQueuedPackCommand)
- {
- ANGLE_TRY(
- mRenderer->packPixels(mStagingTexture, *mQueuedPackCommand, mMemoryBuffer.data()));
- mQueuedPackCommand.reset(nullptr);
- }
-
- return gl::NoError();
-}
-
-// Buffer11::SystemMemoryStorage implementation
-
-Buffer11::SystemMemoryStorage::SystemMemoryStorage(Renderer11 *renderer)
- : Buffer11::BufferStorage(renderer, BUFFER_USAGE_SYSTEM_MEMORY)
-{
-}
-
-gl::ErrorOrResult<CopyResult> Buffer11::SystemMemoryStorage::copyFromStorage(
- const gl::Context *context,
- BufferStorage *source,
- size_t sourceOffset,
- size_t size,
- size_t destOffset)
-{
- ASSERT(source->isCPUAccessible(GL_MAP_READ_BIT));
- uint8_t *sourceData = nullptr;
- ANGLE_TRY(source->map(sourceOffset, size, GL_MAP_READ_BIT, &sourceData));
- ASSERT(destOffset + size <= mSystemCopy.size());
- memcpy(mSystemCopy.data() + destOffset, sourceData, size);
- source->unmap();
- return CopyResult::RECREATED;
-}
-
-gl::Error Buffer11::SystemMemoryStorage::resize(const gl::Context *context,
- size_t size,
- bool preserveData)
-{
- if (mSystemCopy.size() < size)
- {
- if (!mSystemCopy.resize(size))
- {
- return gl::OutOfMemory() << "Failed to resize SystemMemoryStorage";
- }
- mBufferSize = size;
- }
-
- return gl::NoError();
-}
-
-gl::Error Buffer11::SystemMemoryStorage::map(size_t offset,
- size_t length,
- GLbitfield access,
- uint8_t **mapPointerOut)
-{
- ASSERT(!mSystemCopy.empty() && offset + length <= mSystemCopy.size());
- *mapPointerOut = mSystemCopy.data() + offset;
- return gl::NoError();
-}
-
-void Buffer11::SystemMemoryStorage::unmap()
-{
- // No-op
-}
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.h
deleted file mode 100644
index ddbeeb90d2..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.h
+++ /dev/null
@@ -1,189 +0,0 @@
-//
-// 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,
- // TODO: possibly share this buffer type with shader storage buffers.
- BUFFER_USAGE_INDIRECT,
- BUFFER_USAGE_PIXEL_UNPACK,
- BUFFER_USAGE_PIXEL_PACK,
- BUFFER_USAGE_UNIFORM,
- BUFFER_USAGE_EMULATED_INDEXED_VERTEX,
-
- BUFFER_USAGE_COUNT,
-};
-
-typedef size_t DataRevision;
-
-class Buffer11 : public BufferD3D
-{
- public:
- Buffer11(const gl::BufferState &state, Renderer11 *renderer);
- ~Buffer11() override;
-
- gl::ErrorOrResult<ID3D11Buffer *> getBuffer(const gl::Context *context, BufferUsage usage);
- gl::ErrorOrResult<ID3D11Buffer *> getEmulatedIndexedBuffer(const gl::Context *context,
- SourceIndexData *indexInfo,
- const TranslatedAttribute &attribute,
- GLint startVertex);
- gl::Error getConstantBufferRange(const gl::Context *context,
- GLintptr offset,
- GLsizeiptr size,
- const d3d11::Buffer **bufferOut,
- UINT *firstConstantOut,
- UINT *numConstantsOut);
- gl::ErrorOrResult<const d3d11::ShaderResourceView *> getSRV(const gl::Context *context,
- DXGI_FORMAT srvFormat);
- bool isMapped() const { return mMappedStorage != nullptr; }
- gl::Error 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;
- gl::Error 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
- gl::Error setData(const gl::Context *context,
- gl::BufferBinding target,
- const void *data,
- size_t size,
- gl::BufferUsage usage) override;
- gl::Error setSubData(const gl::Context *context,
- gl::BufferBinding target,
- const void *data,
- size_t size,
- size_t offset) override;
- gl::Error copySubData(const gl::Context *context,
- BufferImpl *source,
- GLintptr sourceOffset,
- GLintptr destOffset,
- GLsizeiptr size) override;
- gl::Error map(const gl::Context *context, GLenum access, void **mapPtr) override;
- gl::Error mapRange(const gl::Context *context,
- size_t offset,
- size_t length,
- GLbitfield access,
- void **mapPtr) override;
- gl::Error unmap(const gl::Context *context, GLboolean *result) override;
- gl::Error markTransformFeedbackUsage(const gl::Context *context) override;
-
- // We use two set of dirty events. Static buffers are marked dirty whenever
- // data changes, because they must be re-translated. Direct buffers only need to be
- // updated when the underlying ID3D11Buffer pointer changes - hopefully far less often.
- OnBufferDataDirtyChannel *getStaticBroadcastChannel();
- OnBufferDataDirtyChannel *getDirectBroadcastChannel();
-
- 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);
- gl::Error garbageCollection(const gl::Context *context, BufferUsage currentUsage);
- gl::ErrorOrResult<NativeStorage *> getStagingStorage(const gl::Context *context);
- gl::ErrorOrResult<PackStorage *> getPackStorage(const gl::Context *context);
- gl::ErrorOrResult<SystemMemoryStorage *> getSystemMemoryStorage(const gl::Context *context);
-
- gl::Error updateBufferStorage(const gl::Context *context,
- BufferStorage *storage,
- size_t sourceOffset,
- size_t storageSize);
- gl::ErrorOrResult<BufferStorage *> getBufferStorage(const gl::Context *context,
- BufferUsage usage);
- gl::ErrorOrResult<BufferStorage *> getLatestBufferStorage(const gl::Context *context) const;
-
- gl::ErrorOrResult<BufferStorage *> getConstantBufferRangeStorage(const gl::Context *context,
- GLintptr offset,
- GLsizeiptr size);
-
- BufferStorage *allocateStorage(BufferUsage usage);
- void updateDeallocThreshold(BufferUsage usage);
-
- // Free the storage if we decide it isn't being used very often.
- gl::Error 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;
-
- OnBufferDataDirtyChannel mStaticBroadcastChannel;
- OnBufferDataDirtyChannel mDirectBroadcastChannel;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_BUFFER11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
deleted file mode 100644
index f9dda0aeb4..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
+++ /dev/null
@@ -1,833 +0,0 @@
-
-// 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/FramebufferAttachment.h"
-#include "libANGLE/formatutils.h"
-#include "libANGLE/renderer/d3d/FramebufferD3D.h"
-#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
-#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
-#include "third_party/trace_event/trace_event.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;
-}
-
-bool AllOffsetsAreNonNegative(const std::vector<gl::Offset> &viewportOffsets)
-{
- for (size_t i = 0u; i < viewportOffsets.size(); ++i)
- {
- const auto &offset = viewportOffsets[i];
- if (offset.x < 0 || offset.y < 0)
- {
- return false;
- }
- }
- return true;
-}
-} // 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()
-{
-}
-
-gl::Error Clear11::ShaderManager::getShadersAndLayout(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)
-{
- if (renderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3)
- {
- ASSERT(clearType == GL_FLOAT);
-
- ANGLE_TRY(mVs9.resolve(renderer));
- ANGLE_TRY(mPsFloat9.resolve(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(ilDescArray, &vertexShader, &mIl9));
- }
-
- *vs = &mVs9.getObj();
- *gs = nullptr;
- *il = &mIl9;
- *ps = &mPsFloat9.getObj();
- return gl::NoError();
- }
- if (!hasLayeredLayout)
- {
- ANGLE_TRY(mVs.resolve(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(renderer));
- ANGLE_TRY(mGsMultiview.resolve(renderer));
- *vs = &mVsMultiview.getObj();
- *gs = &mGsMultiview.getObj();
- }
-
- *il = nullptr;
-
- if (numRTs == 0)
- {
- ANGLE_TRY(mPsDepth.resolve(renderer));
- *ps = &mPsDepth.getObj();
- return gl::NoError();
- }
-
- switch (clearType)
- {
- case GL_FLOAT:
- ANGLE_TRY(mPsFloat[numRTs - 1].resolve(renderer));
- *ps = &mPsFloat[numRTs - 1].getObj();
- break;
- case GL_UNSIGNED_INT:
- ANGLE_TRY(mPsUInt[numRTs - 1].resolve(renderer));
- *ps = &mPsUInt[numRTs - 1].getObj();
- break;
- case GL_INT:
- ANGLE_TRY(mPsSInt[numRTs - 1].resolve(renderer));
- *ps = &mPsSInt[numRTs - 1].getObj();
- break;
- default:
- UNREACHABLE();
- break;
- }
-
- return gl::NoError();
-}
-
-Clear11::Clear11(Renderer11 *renderer)
- : mRenderer(renderer),
- mResourcesInitialized(false),
- mScissorEnabledRasterizerState(),
- mScissorDisabledRasterizerState(),
- mShaderManager(),
- mConstantBuffer(),
- mVertexBuffer(),
- mShaderData({})
-{
-}
-
-Clear11::~Clear11()
-{
-}
-
-gl::Error Clear11::ensureResourcesInitialized()
-{
- if (mResourcesInitialized)
- {
- return gl::NoError();
- }
-
- 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;
-
- ANGLE_TRY(mRenderer->allocateResource(rsDesc, &mScissorDisabledRasterizerState));
- mScissorDisabledRasterizerState.setDebugName("Clear11 Rasterizer State with scissor disabled");
-
- rsDesc.ScissorEnable = TRUE;
- ANGLE_TRY(mRenderer->allocateResource(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 gl::NoError();
-}
-
-bool Clear11::useVertexBuffer() const
-{
- return (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3);
-}
-
-gl::Error Clear11::ensureConstantBufferCreated()
-{
- if (mConstantBuffer.valid())
- {
- return gl::NoError();
- }
-
- // 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(bufferDesc, &initialData, &mConstantBuffer));
- mConstantBuffer.setDebugName("Clear11 Constant Buffer");
- return gl::NoError();
-}
-
-gl::Error Clear11::ensureVertexBufferCreated()
-{
- ASSERT(useVertexBuffer());
-
- if (mVertexBuffer.valid())
- {
- return gl::NoError();
- }
-
- // 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(bufferDesc, &initialData, &mVertexBuffer));
- mVertexBuffer.setDebugName("Clear11 Vertex Buffer");
- return gl::NoError();
-}
-
-gl::Error Clear11::clearFramebuffer(const gl::Context *context,
- const ClearParameters &clearParams,
- const gl::FramebufferState &fboData)
-{
- ANGLE_TRY(ensureResourcesInitialized());
-
- // 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();
-
- if (!colorAttachment)
- {
- UNREACHABLE();
- return gl::InternalError();
- }
-
- framebufferSize = colorAttachment->getSize();
- }
-
- const bool isSideBySideFBO =
- (fboData.getMultiviewLayout() == GL_FRAMEBUFFER_MULTIVIEW_SIDE_BY_SIDE_ANGLE);
- bool needScissoredClear = false;
- std::vector<D3D11_RECT> scissorRects;
- if (clearParams.scissorEnabled)
- {
- const std::vector<gl::Offset> *viewportOffsets = fboData.getViewportOffsets();
- ASSERT(viewportOffsets != nullptr);
- ASSERT(AllOffsetsAreNonNegative(*fboData.getViewportOffsets()));
-
- 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
- // ANGLE_multiview spec.
- // Scissor rect is outside the renderbuffer or is an empty rect.
- return gl::NoError();
- }
-
- if (isSideBySideFBO)
- {
- // We always have to do a scissor clear for side-by-side framebuffers.
- needScissoredClear = true;
- }
- else
- {
- // Because the viewport offsets can generate scissor rectangles within the framebuffer's
- // bounds, we can do this check only for non-side-by-side framebuffers.
- if (clearParams.scissor.x + clearParams.scissor.width <= 0 ||
- clearParams.scissor.y + clearParams.scissor.height <= 0)
- {
- // Scissor rect is outside the renderbuffer.
- return gl::NoError();
- }
- 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. This is valid also
- // for non-side-by-side framebuffers, because the default viewport offset is {0,0}.
- const size_t numViews = viewportOffsets->size();
- scissorRects.reserve(numViews);
- for (size_t i = 0u; i < numViews; ++i)
- {
- const gl::Offset &offset = (*viewportOffsets)[i];
- D3D11_RECT rect;
- int x = clearParams.scissor.x + offset.x;
- int y = clearParams.scissor.y + offset.y;
- rect.left = x;
- rect.right = x + clearParams.scissor.width;
- rect.top = y;
- rect.bottom = y + clearParams.scissor.height;
- scissorRects.emplace_back(rect);
- }
- }
- }
-
- 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))
- {
- ERR() << "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());
-
- if ((!(mRenderer->getRenderer11DeviceCaps().supportsClearView) && 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);
- // There must be at least one scissor rectangle.
- ASSERT(!scissorRects.empty());
- deviceContext1->ClearView(framebufferRTV.get(), clearValues, scissorRects.data(),
- static_cast<UINT>(scissorRects.size()));
- if (mRenderer->getWorkarounds().callClearTwice)
- {
- deviceContext1->ClearView(framebufferRTV.get(), clearValues,
- scissorRects.data(),
- static_cast<UINT>(scissorRects.size()));
- }
- }
- else
- {
- deviceContext->ClearRenderTargetView(framebufferRTV.get(), clearValues);
- if (mRenderer->getWorkarounds().callClearTwice)
- {
- 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 gl::NoError();
- }
-
- // 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(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(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(reinterpret_cast<RtvDsvClearInfo<float> *>(&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());
-
- 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;
- HRESULT result = deviceContext->Map(mConstantBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0,
- &mappedResource);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Clear11: Failed to map CB, " << gl::FmtHR(result);
- }
-
- 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.getMultiviewLayout() == GL_FRAMEBUFFER_MULTIVIEW_LAYERED_ANGLE);
- ANGLE_TRY(mShaderManager.getShadersAndLayout(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());
- 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 scissors are necessary to be applied, then the number of clears is the number of scissor
- // rects. If no scissors are necessary, then a single full-size clear is enough.
- size_t necessaryNumClears = needScissoredClear ? scissorRects.size() : 1u;
- for (size_t i = 0u; i < necessaryNumClears; ++i)
- {
- if (needScissoredClear)
- {
- ASSERT(i < scissorRects.size());
- stateManager->setScissorRectD3D(scissorRects[i]);
- }
- // Draw the fullscreen quad.
- if (!hasLayeredLayout || isSideBySideFBO)
- {
- deviceContext->Draw(6, 0);
- }
- else
- {
- ASSERT(hasLayeredLayout);
- deviceContext->DrawInstanced(6, static_cast<UINT>(fboData.getNumViews()), 0, 0);
- }
- }
-
- return gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.h
deleted file mode 100644
index a09812c42b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.h
+++ /dev/null
@@ -1,100 +0,0 @@
-//
-// 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/angletypes.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/Framebuffer.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.
- gl::Error clearFramebuffer(const gl::Context *context,
- const ClearParameters &clearParams,
- const gl::FramebufferState &fboData);
-
- private:
- class ShaderManager final : angle::NonCopyable
- {
- public:
- ShaderManager();
- ~ShaderManager();
- gl::Error getShadersAndLayout(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;
- gl::Error ensureConstantBufferCreated();
- gl::Error ensureVertexBufferCreated();
- gl::Error ensureResourcesInitialized();
-
- 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Context11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
deleted file mode 100644
index b79dd3603a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-//
-// 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/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/d3d11/Buffer11.h"
-#include "libANGLE/renderer/d3d/d3d11/Fence11.h"
-#include "libANGLE/renderer/d3d/d3d11/Framebuffer11.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"
-
-namespace rx
-{
-
-Context11::Context11(const gl::ContextState &state, Renderer11 *renderer)
- : ContextImpl(state), mRenderer(renderer)
-{
-}
-
-Context11::~Context11()
-{
-}
-
-gl::Error Context11::initialize()
-{
- return gl::NoError();
-}
-
-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->getWorkarounds(), mRenderer->getNativeExtensions());
-}
-
-ProgramImpl *Context11::createProgram(const gl::ProgramState &data)
-{
- return new ProgramD3D(data, mRenderer);
-}
-
-FramebufferImpl *Context11::createFramebuffer(const gl::FramebufferState &data)
-{
- return new Framebuffer11(data, mRenderer);
-}
-
-TextureImpl *Context11::createTexture(const gl::TextureState &state)
-{
- switch (state.getTarget())
- {
- case GL_TEXTURE_2D:
- return new TextureD3D_2D(state, mRenderer);
- case GL_TEXTURE_CUBE_MAP:
- return new TextureD3D_Cube(state, mRenderer);
- case GL_TEXTURE_3D:
- return new TextureD3D_3D(state, mRenderer);
- case GL_TEXTURE_2D_ARRAY:
- return new TextureD3D_2DArray(state, mRenderer);
- case GL_TEXTURE_EXTERNAL_OES:
- return new TextureD3D_External(state, mRenderer);
- case GL_TEXTURE_2D_MULTISAMPLE:
- return new TextureD3D_2DMultisample(state, mRenderer);
- break;
- default:
- UNREACHABLE();
- }
-
- return nullptr;
-}
-
-RenderbufferImpl *Context11::createRenderbuffer()
-{
- return new RenderbufferD3D(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(GLenum 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 *>();
-}
-
-gl::Error Context11::flush(const gl::Context *context)
-{
- return mRenderer->flush();
-}
-
-gl::Error Context11::finish(const gl::Context *context)
-{
- return mRenderer->finish();
-}
-
-gl::Error Context11::drawArrays(const gl::Context *context, GLenum mode, GLint first, GLsizei count)
-{
- ANGLE_TRY(prepareForDrawCall(context, mode));
- return mRenderer->drawArrays(context, mode, first, count, 0);
-}
-
-gl::Error Context11::drawArraysInstanced(const gl::Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei instanceCount)
-{
- ANGLE_TRY(prepareForDrawCall(context, mode));
- return mRenderer->drawArrays(context, mode, first, count, instanceCount);
-}
-
-gl::Error Context11::drawElements(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices)
-{
- ANGLE_TRY(prepareForDrawCall(context, mode));
- return mRenderer->drawElements(context, mode, count, type, indices, 0);
-}
-
-gl::Error Context11::drawElementsInstanced(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances)
-{
- ANGLE_TRY(prepareForDrawCall(context, mode));
- return mRenderer->drawElements(context, mode, count, type, indices, instances);
-}
-
-gl::Error Context11::drawRangeElements(const gl::Context *context,
- GLenum mode,
- GLuint start,
- GLuint end,
- GLsizei count,
- GLenum type,
- const void *indices)
-{
- ANGLE_TRY(prepareForDrawCall(context, mode));
- return mRenderer->drawElements(context, mode, count, type, indices, 0);
-}
-
-gl::Error Context11::drawArraysIndirect(const gl::Context *context,
- GLenum mode,
- const void *indirect)
-{
- ANGLE_TRY(prepareForDrawCall(context, mode));
- return mRenderer->drawArraysIndirect(context, mode, indirect);
-}
-
-gl::Error Context11::drawElementsIndirect(const gl::Context *context,
- GLenum mode,
- GLenum type,
- const void *indirect)
-{
- ANGLE_TRY(prepareForDrawCall(context, mode));
- return mRenderer->drawElementsIndirect(context, mode, type, indirect);
-}
-
-GLenum 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)
-{
- auto optionalString = angle::WidenString(static_cast<size_t>(length), marker);
- if (optionalString.valid())
- {
- mRenderer->getAnnotator()->setMarker(optionalString.value().data());
- }
-}
-
-void Context11::pushGroupMarker(GLsizei length, const char *marker)
-{
- auto optionalString = angle::WidenString(static_cast<size_t>(length), marker);
- if (optionalString.valid())
- {
- mRenderer->getAnnotator()->beginEvent(optionalString.value().data());
- }
-}
-
-void Context11::popGroupMarker()
-{
- mRenderer->getAnnotator()->endEvent();
-}
-
-void Context11::pushDebugGroup(GLenum source, GLuint id, GLsizei length, const char *message)
-{
- // Fall through to the EXT_debug_marker functions
- pushGroupMarker(length, message);
-}
-
-void Context11::popDebugGroup()
-{
- // Fall through to the EXT_debug_marker functions
- popGroupMarker();
-}
-
-void Context11::syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits)
-{
- mRenderer->getStateManager()->syncState(context, dirtyBits);
-}
-
-GLint Context11::getGPUDisjoint()
-{
- return mRenderer->getGPUDisjoint();
-}
-
-GLint64 Context11::getTimestamp()
-{
- return mRenderer->getTimestamp();
-}
-
-void Context11::onMakeCurrent(const gl::Context *context)
-{
- ANGLE_SWALLOW_ERR(mRenderer->getStateManager()->onMakeCurrent(context));
-}
-
-const gl::Caps &Context11::getNativeCaps() const
-{
- return mRenderer->getNativeCaps();
-}
-
-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();
-}
-
-gl::Error Context11::dispatchCompute(const gl::Context *context,
- GLuint numGroupsX,
- GLuint numGroupsY,
- GLuint numGroupsZ)
-{
- return mRenderer->dispatchCompute(context, numGroupsX, numGroupsY, numGroupsZ);
-}
-
-gl::Error Context11::triggerDrawCallProgramRecompilation(const gl::Context *context,
- GLenum drawMode)
-{
- const auto &glState = context->getGLState();
- 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(drawMode);
- bool recompilePS = !programD3D->hasPixelExecutableForCachedOutputLayout();
-
- if (!recompileVS && !recompileGS && !recompilePS)
- {
- return gl::NoError();
- }
-
- // Load the compiler if necessary and recompile the programs.
- ANGLE_TRY(mRenderer->ensureHLSLCompilerInitialized());
-
- gl::InfoLog infoLog;
-
- if (recompileVS)
- {
- ShaderExecutableD3D *vertexExe = nullptr;
- ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(&vertexExe, &infoLog));
- if (!programD3D->hasVertexExecutableForCachedInputLayout())
- {
- ASSERT(infoLog.getLength() > 0);
- ERR() << "Dynamic recompilation error log: " << infoLog.str();
- return gl::InternalError()
- << "Error compiling dynamic vertex executable:" << infoLog.str();
- }
- }
-
- if (recompileGS)
- {
- ShaderExecutableD3D *geometryExe = nullptr;
- ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(context, drawMode, &geometryExe,
- &infoLog));
- if (!programD3D->hasGeometryExecutableForPrimitiveType(drawMode))
- {
- ASSERT(infoLog.getLength() > 0);
- ERR() << "Dynamic recompilation error log: " << infoLog.str();
- return gl::InternalError()
- << "Error compiling dynamic geometry executable:" << infoLog.str();
- }
- }
-
- if (recompilePS)
- {
- ShaderExecutableD3D *pixelExe = nullptr;
- ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(&pixelExe, &infoLog));
- if (!programD3D->hasPixelExecutableForCachedOutputLayout())
- {
- ASSERT(infoLog.getLength() > 0);
- ERR() << "Dynamic recompilation error log: " << infoLog.str();
- return gl::InternalError()
- << "Error compiling dynamic pixel executable:" << infoLog.str();
- }
- }
-
- // Refresh the program cache entry.
- if (mMemoryProgramCache)
- {
- mMemoryProgramCache->updateProgram(context, program);
- }
-
- return gl::NoError();
-}
-
-gl::Error Context11::prepareForDrawCall(const gl::Context *context, GLenum drawMode)
-{
- ANGLE_TRY(mRenderer->getStateManager()->updateState(context, drawMode));
- return gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Context11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Context11.h
deleted file mode 100644
index dd99111b19..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Context11.h
+++ /dev/null
@@ -1,155 +0,0 @@
-//
-// 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 "libANGLE/renderer/ContextImpl.h"
-
-namespace rx
-{
-class Renderer11;
-
-class Context11 : public ContextImpl
-{
- public:
- Context11(const gl::ContextState &state, Renderer11 *renderer);
- ~Context11() override;
-
- gl::Error initialize() 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() 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(GLenum 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;
-
- // Flush and finish.
- gl::Error flush(const gl::Context *context) override;
- gl::Error finish(const gl::Context *context) override;
-
- // Drawing methods.
- gl::Error drawArrays(const gl::Context *context,
- GLenum mode,
- GLint first,
- GLsizei count) override;
- gl::Error drawArraysInstanced(const gl::Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei instanceCount) override;
-
- gl::Error drawElements(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices) override;
- gl::Error drawElementsInstanced(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances) override;
- gl::Error drawRangeElements(const gl::Context *context,
- GLenum mode,
- GLuint start,
- GLuint end,
- GLsizei count,
- GLenum type,
- const void *indices) override;
- gl::Error drawArraysIndirect(const gl::Context *context,
- GLenum mode,
- const void *indirect) override;
- gl::Error drawElementsIndirect(const gl::Context *context,
- GLenum mode,
- GLenum type,
- const void *indirect) override;
-
- // Device loss
- GLenum 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, GLsizei length, const char *message) override;
- void popDebugGroup() override;
-
- // State sync with dirty bits.
- void syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits) override;
-
- // Disjoint timer queries
- GLint getGPUDisjoint() override;
- GLint64 getTimestamp() override;
-
- // Context switching
- void onMakeCurrent(const gl::Context *context) override;
-
- // Caps queries
- const 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; }
-
- gl::Error dispatchCompute(const gl::Context *context,
- GLuint numGroupsX,
- GLuint numGroupsY,
- GLuint numGroupsZ) override;
-
- gl::Error triggerDrawCallProgramRecompilation(const gl::Context *context, GLenum drawMode);
-
- private:
- gl::Error prepareForDrawCall(const gl::Context *context, GLenum drawMode);
-
- Renderer11 *mRenderer;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_CONTEXT11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp
deleted file mode 100644
index 1e70363e11..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-//
-// 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 "common/debug.h"
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-
-namespace rx
-{
-
-DebugAnnotator11::DebugAnnotator11()
- : mInitialized(false),
- mD3d11Module(nullptr),
- mUserDefinedAnnotation(nullptr)
-{
- // D3D11 devices can't be created during DllMain.
- // We defer device creation until the object is actually used.
-}
-
-DebugAnnotator11::~DebugAnnotator11()
-{
- if (mInitialized)
- {
- SafeRelease(mUserDefinedAnnotation);
-
-#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
- FreeLibrary(mD3d11Module);
-#endif // !ANGLE_ENABLE_WINDOWS_STORE
- }
-}
-
-void DebugAnnotator11::beginEvent(const wchar_t *eventName)
-{
- initializeDevice();
-
- if (mUserDefinedAnnotation != nullptr)
- {
- mUserDefinedAnnotation->BeginEvent(eventName);
- }
-}
-
-void DebugAnnotator11::endEvent()
-{
- initializeDevice();
-
- if (mUserDefinedAnnotation != nullptr)
- {
- mUserDefinedAnnotation->EndEvent();
- }
-}
-
-void DebugAnnotator11::setMarker(const wchar_t *markerName)
-{
- initializeDevice();
-
- if (mUserDefinedAnnotation != nullptr)
- {
- mUserDefinedAnnotation->SetMarker(markerName);
- }
-}
-
-bool DebugAnnotator11::getStatus()
-{
-#if defined(ANGLE_ENABLE_WINDOWS_STORE)
- static_assert(NTDDI_VERSION >= NTDDI_WIN10, "GetStatus only works on Win10 and above");
- initializeDevice();
-
- if (mUserDefinedAnnotation != nullptr)
- {
- return !!(mUserDefinedAnnotation->GetStatus());
- }
-
- return true; // Default if initializeDevice() failed
-#else
- // We can't detect GetStatus() on desktop ANGLE builds so always return true.
- return true;
-#endif // ANGLE_ENABLE_WINDOWS_STORE
-}
-
-void DebugAnnotator11::initializeDevice()
-{
- if (!mInitialized)
- {
-#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
- mD3d11Module = LoadLibrary(TEXT("d3d11.dll"));
- ASSERT(mD3d11Module);
-
- PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(mD3d11Module, "D3D11CreateDevice");
- ASSERT(D3D11CreateDevice != nullptr);
-#endif // !ANGLE_ENABLE_WINDOWS_STORE
-
- ID3D11Device *device = nullptr;
- ID3D11DeviceContext *context = nullptr;
-
- HRESULT hr = E_FAIL;
-
- // Create a D3D_DRIVER_TYPE_NULL device, which is much cheaper than other types of device.
- hr = D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_NULL, nullptr, 0, nullptr, 0,
- D3D11_SDK_VERSION, &device, nullptr, &context);
- ASSERT(SUCCEEDED(hr));
- if (SUCCEEDED(hr))
- {
- mUserDefinedAnnotation = d3d11::DynamicCastComObject<ID3DUserDefinedAnnotation>(context);
- ASSERT(mUserDefinedAnnotation != nullptr);
- mInitialized = true;
- }
-
- SafeRelease(device);
- SafeRelease(context);
- }
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h
deleted file mode 100644
index 62662c49ae..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// 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"
-
-namespace rx
-{
-
-class DebugAnnotator11 : public angle::LoggingAnnotator
-{
- public:
- DebugAnnotator11();
- ~DebugAnnotator11() override;
- void beginEvent(const wchar_t *eventName) override;
- void endEvent() override;
- void setMarker(const wchar_t *markerName) override;
- bool getStatus() override;
-
- private:
- void initializeDevice();
-
- bool mInitialized;
- HMODULE mD3d11Module;
- ID3DUserDefinedAnnotation *mUserDefinedAnnotation;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
deleted file mode 100644
index 082f28d794..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-//
-// 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 "libANGLE/renderer/d3d/d3d11/Renderer11.h"
-
-#include "common/utilities.h"
-
-namespace rx
-{
-
-static const int kDeviceLostCheckPeriod = 64;
-
-//
-// Template helpers for set and test operations.
-//
-
-template <class FenceClass>
-gl::Error FenceSetHelper(FenceClass *fence)
-{
- if (!fence->mQuery)
- {
- D3D11_QUERY_DESC queryDesc;
- queryDesc.Query = D3D11_QUERY_EVENT;
- queryDesc.MiscFlags = 0;
-
- HRESULT result = fence->mRenderer->getDevice()->CreateQuery(&queryDesc, &fence->mQuery);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to create event query, " << gl::FmtHR(result);
- }
- }
-
- fence->mRenderer->getDeviceContext()->End(fence->mQuery);
- return gl::NoError();
-}
-
-template <class FenceClass>
-gl::Error FenceTestHelper(FenceClass *fence, bool flushCommandBuffer, GLboolean *outFinished)
-{
- ASSERT(fence->mQuery);
-
- UINT getDataFlags = (flushCommandBuffer ? 0 : D3D11_ASYNC_GETDATA_DONOTFLUSH);
- HRESULT result =
- fence->mRenderer->getDeviceContext()->GetData(fence->mQuery, nullptr, 0, getDataFlags);
-
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to get query data, " << gl::FmtHR(result);
- }
-
- ASSERT(result == S_OK || result == S_FALSE);
- *outFinished = ((result == S_OK) ? GL_TRUE : GL_FALSE);
- return gl::NoError();
-}
-
-//
-// FenceNV11
-//
-
-FenceNV11::FenceNV11(Renderer11 *renderer) : FenceNVImpl(), mRenderer(renderer), mQuery(nullptr)
-{
-}
-
-FenceNV11::~FenceNV11()
-{
- SafeRelease(mQuery);
-}
-
-gl::Error FenceNV11::set(GLenum condition)
-{
- return FenceSetHelper(this);
-}
-
-gl::Error FenceNV11::test(GLboolean *outFinished)
-{
- return FenceTestHelper(this, true, outFinished);
-}
-
-gl::Error FenceNV11::finish()
-{
- GLboolean finished = GL_FALSE;
-
- int loopCount = 0;
- while (finished != GL_TRUE)
- {
- loopCount++;
- ANGLE_TRY(FenceTestHelper(this, true, &finished));
-
- if (loopCount % kDeviceLostCheckPeriod == 0 && mRenderer->testDeviceLost())
- {
- return gl::OutOfMemory() << "Device was lost while querying result of an event query.";
- }
-
- ScheduleYield();
- }
-
- return gl::NoError();
-}
-
-//
-// 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);
-}
-
-gl::Error Sync11::set(GLenum condition, GLbitfield flags)
-{
- ASSERT(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0);
- return FenceSetHelper(this);
-}
-
-gl::Error Sync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult)
-{
- ASSERT(outResult);
-
- bool flushCommandBuffer = ((flags & GL_SYNC_FLUSH_COMMANDS_BIT) != 0);
-
- GLboolean result = GL_FALSE;
- gl::Error error = FenceTestHelper(this, flushCommandBuffer, &result);
- if (error.isError())
- {
- *outResult = GL_WAIT_FAILED;
- return error;
- }
-
- if (result == GL_TRUE)
- {
- *outResult = GL_ALREADY_SIGNALED;
- return gl::NoError();
- }
-
- if (timeout == 0)
- {
- *outResult = GL_TIMEOUT_EXPIRED;
- return gl::NoError();
- }
-
- 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);
-
- error = FenceTestHelper(this, flushCommandBuffer, &result);
- if (error.isError())
- {
- *outResult = GL_WAIT_FAILED;
- return error;
- }
-
- if ((loopCount % kDeviceLostCheckPeriod) == 0 && mRenderer->testDeviceLost())
- {
- *outResult = GL_WAIT_FAILED;
- return gl::OutOfMemory() << "Device was lost while querying result of an event query.";
- }
- }
-
- if (currentCounter.QuadPart >= endCounter)
- {
- *outResult = GL_TIMEOUT_EXPIRED;
- }
- else
- {
- *outResult = GL_CONDITION_SATISFIED;
- }
-
- return gl::NoError();
-}
-
-gl::Error Sync11::serverWait(GLbitfield flags, GLuint64 timeout)
-{
- // Because our API is currently designed to be called from a single thread, we don't need to do
- // extra work for a server-side fence. GPU commands issued after the fence is created will
- // always be processed after the fence is signaled.
- return gl::NoError();
-}
-
-gl::Error Sync11::getStatus(GLint *outResult)
-{
- GLboolean result = GL_FALSE;
- gl::Error error = FenceTestHelper(this, false, &result);
- if (error.isError())
- {
- // The spec does not specify any way to report errors during the status test (e.g. device
- // lost) so we report the fence is unblocked in case of error or signaled.
- *outResult = GL_SIGNALED;
-
- return error;
- }
-
- *outResult = (result ? GL_SIGNALED : GL_UNSIGNALED);
- return gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.h
deleted file mode 100644
index 4168df5365..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.h
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// 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;
-
- gl::Error set(GLenum condition) override;
- gl::Error test(GLboolean *outFinished) override;
- gl::Error finish() override;
-
- private:
- template<class T> friend gl::Error FenceSetHelper(T *fence);
- template<class T> friend gl::Error FenceTestHelper(T *fence, bool flushCommandBuffer, GLboolean *outFinished);
-
- Renderer11 *mRenderer;
- ID3D11Query *mQuery;
-};
-
-class Sync11 : public SyncImpl
-{
- public:
- explicit Sync11(Renderer11 *renderer);
- ~Sync11() override;
-
- gl::Error set(GLenum condition, GLbitfield flags) override;
- gl::Error clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult) override;
- gl::Error serverWait(GLbitfield flags, GLuint64 timeout) override;
- gl::Error getStatus(GLint *outResult) override;
-
- private:
- template<class T> friend gl::Error FenceSetHelper(T *fence);
- template<class T> friend gl::Error FenceTestHelper(T *fence, bool flushCommandBuffer, GLboolean *outFinished);
-
- Renderer11 *mRenderer;
- ID3D11Query *mQuery;
- LONGLONG mCounterFrequency;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_FENCE11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
deleted file mode 100644
index 02326d7b50..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
+++ /dev/null
@@ -1,507 +0,0 @@
-//
-// 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
-{
-gl::Error 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 gl::NoError();
-}
-
-void UpdateCachedRenderTarget(const gl::Context *context,
- const gl::FramebufferAttachment *attachment,
- RenderTarget11 *&cachedRenderTarget,
- OnRenderTargetDirtyBinding *channelBinding)
-{
- RenderTarget11 *newRenderTarget = nullptr;
- if (attachment)
- {
- // TODO(jmadill): Don't swallow this error.
- gl::Error error = attachment->getRenderTarget(context, &newRenderTarget);
- if (error.isError())
- {
- ERR() << "Internal rendertarget error: " << error;
- }
- }
- if (newRenderTarget != cachedRenderTarget)
- {
- OnRenderTargetDirtyChannel *channel =
- (newRenderTarget ? newRenderTarget->getBroadcastChannel() : nullptr);
- channelBinding->bind(channel);
- cachedRenderTarget = newRenderTarget;
- }
-}
-} // anonymous namespace
-
-Framebuffer11::Framebuffer11(const gl::FramebufferState &data, Renderer11 *renderer)
- : FramebufferD3D(data, renderer),
- mRenderer(renderer),
- mCachedDepthStencilRenderTarget(nullptr),
- mDepthStencilRenderTargetDirty(this, gl::IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS)
-{
- ASSERT(mRenderer != nullptr);
- mCachedColorRenderTargets.fill(nullptr);
- for (size_t colorIndex = 0; colorIndex < data.getColorAttachments().size(); ++colorIndex)
- {
- mColorRenderTargetsDirty.emplace_back(this, colorIndex);
- }
-}
-
-Framebuffer11::~Framebuffer11()
-{
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error Framebuffer11::invalidate(const gl::Context *context,
- size_t count,
- const GLenum *attachments)
-{
- return invalidateBase(context, count, attachments, false);
-}
-
-gl::Error Framebuffer11::discard(const gl::Context *context,
- size_t count,
- const GLenum *attachments)
-{
- return invalidateBase(context, count, attachments, true);
-}
-
-gl::Error 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 gl::NoError();
- }
-
- 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 gl::NoError();
-}
-
-gl::Error Framebuffer11::invalidateSub(const gl::Context *context,
- size_t,
- const GLenum *,
- const gl::Rectangle &)
-{
- // A no-op implementation conforms to the spec, so don't call UNIMPLEMENTED()
- return gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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->getGLState().getTargetBuffer(gl::BufferBinding::PixelPack);
- if (packBuffer != nullptr)
- {
- Buffer11 *packBufferStorage = GetImplAs<Buffer11>(packBuffer);
- PackPixelsParams packParams(area, format, type, static_cast<GLuint>(outputPitch), pack,
- 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);
-}
-
-gl::Error 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->getReadColorbuffer();
- 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->getDepthOrStencilbuffer();
- ASSERT(readBuffer);
-
- RenderTargetD3D *readRenderTarget = nullptr;
- ANGLE_TRY(readBuffer->getRenderTarget(context, &readRenderTarget));
- ASSERT(readRenderTarget);
-
- const gl::FramebufferAttachment *drawBuffer = mState.getDepthOrStencilAttachment();
- ASSERT(drawBuffer);
-
- RenderTargetD3D *drawRenderTarget = nullptr;
- ANGLE_TRY(drawBuffer->getRenderTarget(context, &drawRenderTarget));
- ASSERT(drawRenderTarget);
-
- ANGLE_TRY(mRenderer->blitRenderbufferRect(context, sourceArea, destArea, readRenderTarget,
- drawRenderTarget, filter, scissor, false,
- blitDepth, blitStencil));
- }
-
- ANGLE_TRY(markAttachmentsDirty(context));
- return gl::NoError();
-}
-
-GLenum Framebuffer11::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const
-{
- RenderTarget11 *renderTarget11 = GetAs<RenderTarget11>(renderTarget);
- return renderTarget11->getFormatSet().format().fboImplementationInternalFormat;
-}
-
-void Framebuffer11::updateColorRenderTarget(const gl::Context *context, size_t colorIndex)
-{
- UpdateCachedRenderTarget(context, mState.getColorAttachment(colorIndex),
- mCachedColorRenderTargets[colorIndex],
- &mColorRenderTargetsDirty[colorIndex]);
-}
-
-void Framebuffer11::updateDepthStencilRenderTarget(const gl::Context *context)
-{
- UpdateCachedRenderTarget(context, mState.getDepthOrStencilAttachment(),
- mCachedDepthStencilRenderTarget, &mDepthStencilRenderTargetDirty);
-}
-
-void Framebuffer11::syncState(const gl::Context *context,
- const gl::Framebuffer::DirtyBits &dirtyBits)
-{
- const auto &mergedDirtyBits = dirtyBits | mInternalDirtyBits;
- mInternalDirtyBits.reset();
-
- for (auto dirtyBit : mergedDirtyBits)
- {
- switch (dirtyBit)
- {
- case gl::Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT:
- case gl::Framebuffer::DIRTY_BIT_STENCIL_ATTACHMENT:
- updateDepthStencilRenderTarget(context);
- break;
- case gl::Framebuffer::DIRTY_BIT_DRAW_BUFFERS:
- case gl::Framebuffer::DIRTY_BIT_READ_BUFFER:
- break;
- 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:
- {
- ASSERT(gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0 == 0 &&
- dirtyBit < gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_MAX);
- size_t colorIndex =
- static_cast<size_t>(dirtyBit - gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0);
- updateColorRenderTarget(context, colorIndex);
- break;
- }
- }
- }
-
- // We should not have dirtied any additional state during our sync.
- ASSERT(!mInternalDirtyBits.any());
-
- 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);
- }
-}
-
-void Framebuffer11::signal(size_t channelID, const gl::Context *context)
-{
- if (channelID == gl::IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS)
- {
- // Stencil is redundant in this case.
- mInternalDirtyBits.set(gl::Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT);
- mCachedDepthStencilRenderTarget = nullptr;
- }
- else
- {
- mInternalDirtyBits.set(gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0 + channelID);
- mCachedColorRenderTargets[channelID] = nullptr;
- }
-
- // Notify the context we need to re-validate the RenderTarget.
- // TODO(jmadill): Check that we're the active draw framebuffer.
- mRenderer->getStateManager()->invalidateRenderTarget();
-}
-
-gl::Error Framebuffer11::getSamplePosition(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 gl::NoError();
-}
-
-bool Framebuffer11::hasAnyInternalDirtyBit() const
-{
- return mInternalDirtyBits.any();
-}
-
-void Framebuffer11::syncInternalState(const gl::Context *context)
-{
- syncState(context, gl::Framebuffer::DirtyBits());
-}
-
-RenderTarget11 *Framebuffer11::getFirstRenderTarget() const
-{
- ASSERT(mInternalDirtyBits.none());
- for (auto *renderTarget : mCachedColorRenderTargets)
- {
- if (renderTarget)
- {
- return renderTarget;
- }
- }
-
- return mCachedDepthStencilRenderTarget;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h
deleted file mode 100644
index afdda299b9..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h
+++ /dev/null
@@ -1,104 +0,0 @@
-//
-// 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/renderer/d3d/FramebufferD3D.h"
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-#include "libANGLE/signal_utils.h"
-
-namespace rx
-{
-class Renderer11;
-
-class Framebuffer11 : public FramebufferD3D, public OnRenderTargetDirtyReceiver
-{
- public:
- Framebuffer11(const gl::FramebufferState &data, Renderer11 *renderer);
- ~Framebuffer11() override;
-
- gl::Error discard(const gl::Context *context, size_t count, const GLenum *attachments) override;
- gl::Error invalidate(const gl::Context *context,
- size_t count,
- const GLenum *attachments) override;
- gl::Error 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.
- gl::Error markAttachmentsDirty(const gl::Context *context) const;
-
- void syncState(const gl::Context *context,
- const gl::Framebuffer::DirtyBits &dirtyBits) override;
-
- const RenderTargetArray &getCachedColorRenderTargets() const
- {
- return mCachedColorRenderTargets;
- }
- const RenderTarget11 *getCachedDepthStencilRenderTarget() const
- {
- return mCachedDepthStencilRenderTarget;
- }
-
- RenderTarget11 *getFirstRenderTarget() const;
-
- bool hasAnyInternalDirtyBit() const;
- void syncInternalState(const gl::Context *context);
-
- void signal(size_t channelID, const gl::Context *context) override;
-
- gl::Error getSamplePosition(size_t index, GLfloat *xy) const override;
-
- private:
- gl::Error clearImpl(const gl::Context *context, const ClearParameters &clearParams) override;
-
- gl::Error readPixelsImpl(const gl::Context *context,
- const gl::Rectangle &area,
- GLenum format,
- GLenum type,
- size_t outputPitch,
- const gl::PixelPackState &pack,
- uint8_t *pixels) override;
-
- gl::Error 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;
-
- gl::Error invalidateBase(const gl::Context *context,
- size_t count,
- const GLenum *attachments,
- bool useEXTBehavior) const;
- gl::Error invalidateAttachment(const gl::Context *context,
- const gl::FramebufferAttachment *attachment) const;
-
- GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const override;
-
- void updateColorRenderTarget(const gl::Context *context, size_t colorIndex);
- void updateDepthStencilRenderTarget(const gl::Context *context);
-
- Renderer11 *const mRenderer;
- RenderTargetArray mCachedColorRenderTargets;
- RenderTarget11 *mCachedDepthStencilRenderTarget;
-
- std::vector<OnRenderTargetDirtyBinding> mColorRenderTargetsDirty;
- OnRenderTargetDirtyBinding mDepthStencilRenderTargetDirty;
-
- gl::Framebuffer::DirtyBits mInternalDirtyBits;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Image11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
deleted file mode 100644
index bd921f1935..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
+++ /dev/null
@@ -1,657 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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/formatutils.h"
-#include "libANGLE/Framebuffer.h"
-#include "libANGLE/FramebufferAttachment.h"
-#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
-#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
-#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
-#include "libANGLE/renderer/d3d/d3d11/TextureStorage11.h"
-
-namespace rx
-{
-
-Image11::Image11(Renderer11 *renderer)
- : mRenderer(renderer),
- mDXGIFormat(DXGI_FORMAT_UNKNOWN),
- mStagingTexture(),
- mStagingSubresource(0),
- mRecoverFromStorage(false),
- mAssociatedStorage(nullptr),
- mAssociatedImageIndex(gl::ImageIndex::MakeInvalid()),
- mRecoveredFromStorageCount(0)
-{
-}
-
-Image11::~Image11()
-{
- disassociateStorage();
- releaseStagingTexture();
-}
-
-// static
-gl::Error 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_MAPPED_SUBRESOURCE srcMapped;
- gl::Error error = src->map(context, D3D11_MAP_READ, &srcMapped);
- if (error.isError())
- {
- dest->unmap();
- return error;
- }
-
- const uint8_t *sourceData = reinterpret_cast<const uint8_t *>(srcMapped.pData);
- uint8_t *destData = reinterpret_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->unmap();
- src->unmap();
-
- dest->markDirty();
-
- return gl::NoError();
-}
-
-// static
-gl::Error Image11::CopyImage(const gl::Context *context,
- Image11 *dest,
- Image11 *source,
- const gl::Rectangle &sourceRect,
- 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_MAPPED_SUBRESOURCE srcMapped;
- gl::Error error = source->map(context, D3D11_MAP_READ, &srcMapped);
- if (error.isError())
- {
- dest->unmap();
- return error;
- }
-
- 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 = reinterpret_cast<const uint8_t *>(srcMapped.pData) +
- sourceRect.x * sourcePixelBytes + sourceRect.y * srcMapped.RowPitch;
- uint8_t *destData = reinterpret_cast<uint8_t *>(destMapped.pData) +
- destOffset.x * destPixelBytes + destOffset.y * destMapped.RowPitch;
-
- CopyImageCHROMIUM(sourceData, srcMapped.RowPitch, sourcePixelBytes,
- sourceFormat.colorReadFunction, destData, destMapped.RowPitch, destPixelBytes,
- destFormat.colorWriteFunction, destUnsizedFormat,
- destFormatInfo.componentType, sourceRect.width, sourceRect.height,
- unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
-
- dest->unmap();
- source->unmap();
-
- dest->markDirty();
-
- return gl::NoError();
-}
-
-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;
-}
-
-gl::Error 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(&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 gl::NoError();
-}
-
-void Image11::verifyAssociatedStorageValid(TextureStorage11 *textureStorage) const
-{
- ASSERT(mAssociatedStorage == textureStorage);
-}
-
-gl::Error Image11::recoverFromAssociatedStorage(const gl::Context *context)
-{
- if (mRecoverFromStorage)
- {
- ANGLE_TRY(createStagingTexture());
-
- 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 gl::NoError();
-}
-
-void Image11::disassociateStorage()
-{
- if (mRecoverFromStorage)
- {
- // Make the texturestorage release the Image11 too
- mAssociatedStorage->disassociateImage(mAssociatedImageIndex, this);
-
- mRecoverFromStorage = false;
- mAssociatedStorage = nullptr;
- mAssociatedImageIndex = gl::ImageIndex::MakeInvalid();
- }
-}
-
-bool Image11::redefine(GLenum target,
- 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;
- mTarget = target;
-
- // 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.
-gl::Error Image11::loadData(const gl::Context *context,
- const gl::Box &area,
- const gl::PixelUnpackState &unpack,
- GLenum type,
- const void *input,
- bool applySkipImages)
-{
- const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
- GLuint inputRowPitch = 0;
- ANGLE_TRY_RESULT(
- formatInfo.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength),
- inputRowPitch);
- GLuint inputDepthPitch = 0;
- ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(area.height, unpack.imageHeight, inputRowPitch),
- inputDepthPitch);
- GLuint inputSkipBytes = 0;
- ANGLE_TRY_RESULT(
- formatInfo.computeSkipBytes(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 = (reinterpret_cast<uint8_t *>(mappedImage.pData) +
- (area.y * mappedImage.RowPitch + area.x * outputPixelSize +
- area.z * mappedImage.DepthPitch));
- loadFunction(area.width, area.height, area.depth,
- reinterpret_cast<const uint8_t *>(input) + inputSkipBytes, inputRowPitch,
- inputDepthPitch, offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch);
-
- unmap();
-
- return gl::NoError();
-}
-
-gl::Error Image11::loadCompressedData(const gl::Context *context,
- const gl::Box &area,
- const void *input)
-{
- const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
- GLsizei inputRowPitch = 0;
- ANGLE_TRY_RESULT(formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0), inputRowPitch);
- GLsizei inputDepthPitch = 0;
- ANGLE_TRY_RESULT(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 =
- reinterpret_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, reinterpret_cast<const uint8_t *>(input),
- inputRowPitch, inputDepthPitch, offsetMappedData, mappedImage.RowPitch,
- mappedImage.DepthPitch);
-
- unmap();
-
- return gl::NoError();
-}
-
-gl::Error 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 = storage11->getSubresourceIndex(imageIndex);
-
- gl::Box sourceBox(0, 0, 0, mWidth, mHeight, mDepth);
- return copyWithoutConversion(gl::Offset(), sourceBox, *textureHelper, subresourceIndex);
-}
-
-gl::Error Image11::copyFromFramebuffer(const gl::Context *context,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *sourceFBO)
-{
- const gl::FramebufferAttachment *srcAttachment = sourceFBO->getReadColorbuffer();
- 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(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);
- gl::Error error = gl::NoError();
- if (loadFunction.requiresConversion)
- {
- size_t bufferSize = destFormatInfo.pixelBytes * sourceArea.width * sourceArea.height;
- angle::MemoryBuffer *memoryBuffer = nullptr;
- error = mRenderer->getScratchMemoryBuffer(bufferSize, &memoryBuffer);
-
- if (!error.isError())
- {
- GLuint memoryBufferRowPitch = destFormatInfo.pixelBytes * sourceArea.width;
-
- error = 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
- {
- error = mRenderer->readFromAttachment(
- context, *srcAttachment, sourceArea, destFormatInfo.format, destFormatInfo.type,
- mappedImage.RowPitch, gl::PixelPackState(), dataOffset);
- }
-
- unmap();
- mDirty = true;
-
- return error;
-}
-
-gl::Error Image11::copyWithoutConversion(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(&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(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 gl::NoError();
-}
-
-gl::Error Image11::getStagingTexture(const TextureHelper11 **outStagingTexture,
- unsigned int *outSubresourceIndex)
-{
- ANGLE_TRY(createStagingTexture());
-
- *outStagingTexture = &mStagingTexture;
- *outSubresourceIndex = mStagingSubresource;
- return gl::NoError();
-}
-
-void Image11::releaseStagingTexture()
-{
- mStagingTexture.reset();
-}
-
-gl::Error Image11::createStagingTexture()
-{
- if (mStagingTexture.valid())
- {
- return gl::NoError();
- }
-
- 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);
-
- if (mTarget == GL_TEXTURE_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)
- {
- std::vector<D3D11_SUBRESOURCE_DATA> initialData;
- std::vector<std::vector<BYTE>> textureData;
- d3d11::GenerateInitialTextureData(mInternalFormat, mRenderer->getRenderer11DeviceCaps(),
- width, height, mDepth, lodOffset + 1, &initialData,
- &textureData);
-
- ANGLE_TRY(
- mRenderer->allocateTexture(desc, formatInfo, initialData.data(), &mStagingTexture));
- }
- else
- {
- ANGLE_TRY(mRenderer->allocateTexture(desc, formatInfo, &mStagingTexture));
- }
-
- mStagingTexture.setDebugName("Image11::StagingTexture3D");
- mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
- }
- else if (mTarget == GL_TEXTURE_2D || mTarget == GL_TEXTURE_2D_ARRAY ||
- mTarget == GL_TEXTURE_CUBE_MAP)
- {
- 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)
- {
- std::vector<D3D11_SUBRESOURCE_DATA> initialData;
- std::vector<std::vector<BYTE>> textureData;
- d3d11::GenerateInitialTextureData(mInternalFormat, mRenderer->getRenderer11DeviceCaps(),
- width, height, 1, lodOffset + 1, &initialData,
- &textureData);
-
- ANGLE_TRY(
- mRenderer->allocateTexture(desc, formatInfo, initialData.data(), &mStagingTexture));
- }
- else
- {
- ANGLE_TRY(mRenderer->allocateTexture(desc, formatInfo, &mStagingTexture));
- }
-
- mStagingTexture.setDebugName("Image11::StagingTexture2D");
- mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
- }
- else
- {
- UNREACHABLE();
- }
-
- mDirty = false;
- return gl::NoError();
-}
-
-gl::Error 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(&stagingTexture, &subresourceIndex));
-
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
-
- ASSERT(stagingTexture && stagingTexture->valid());
- HRESULT result = deviceContext->Map(stagingTexture->get(), subresourceIndex, mapType, 0, map);
-
- if (FAILED(result))
- {
- // this can fail if the device is removed (from TDR)
- if (d3d11::isDeviceLostError(result))
- {
- mRenderer->notifyDeviceLost();
- }
- return gl::OutOfMemory() << "Failed to map staging texture, " << gl::FmtHR(result);
- }
-
- mDirty = true;
-
- return gl::NoError();
-}
-
-void Image11::unmap()
-{
- if (mStagingTexture.valid())
- {
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
- deviceContext->Unmap(mStagingTexture.get(), mStagingSubresource);
- }
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Image11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Image11.h
deleted file mode 100644
index 584d231b37..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Image11.h
+++ /dev/null
@@ -1,112 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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/renderer11_utils.h"
-
-namespace gl
-{
-class Framebuffer;
-}
-
-namespace rx
-{
-class Renderer11;
-class TextureHelper11;
-class TextureStorage11;
-struct Renderer11DeviceCaps;
-
-class Image11 : public ImageD3D
-{
- public:
- Image11(Renderer11 *renderer);
- ~Image11() override;
-
- static gl::Error GenerateMipmap(const gl::Context *context,
- Image11 *dest,
- Image11 *src,
- const Renderer11DeviceCaps &rendererCaps);
- static gl::Error CopyImage(const gl::Context *context,
- Image11 *dest,
- Image11 *source,
- const gl::Rectangle &sourceRect,
- const gl::Offset &destOffset,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha,
- const Renderer11DeviceCaps &rendererCaps);
-
- bool isDirty() const override;
-
- gl::Error copyToStorage(const gl::Context *context,
- TextureStorage *storage,
- const gl::ImageIndex &index,
- const gl::Box &region) override;
-
- bool redefine(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease) override;
-
- DXGI_FORMAT getDXGIFormat() const;
-
- gl::Error loadData(const gl::Context *context,
- const gl::Box &area,
- const gl::PixelUnpackState &unpack,
- GLenum type,
- const void *input,
- bool applySkipImages) override;
- gl::Error loadCompressedData(const gl::Context *context,
- const gl::Box &area,
- const void *input) override;
-
- gl::Error copyFromTexStorage(const gl::Context *context,
- const gl::ImageIndex &imageIndex,
- TextureStorage *source) override;
- gl::Error copyFromFramebuffer(const gl::Context *context,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source) override;
-
- gl::Error recoverFromAssociatedStorage(const gl::Context *context);
- void verifyAssociatedStorageValid(TextureStorage11 *textureStorage) const;
- void disassociateStorage();
-
- protected:
- gl::Error map(const gl::Context *context, D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map);
- void unmap();
-
- private:
- gl::Error copyWithoutConversion(const gl::Offset &destOffset,
- const gl::Box &sourceArea,
- const TextureHelper11 &textureHelper,
- UINT sourceSubResource);
-
- gl::Error getStagingTexture(const TextureHelper11 **outStagingTexture,
- unsigned int *outSubresourceIndex);
- gl::Error createStagingTexture();
- void releaseStagingTexture();
-
- Renderer11 *mRenderer;
-
- DXGI_FORMAT mDXGIFormat;
- TextureHelper11 mStagingTexture;
- unsigned int mStagingSubresource;
-
- bool mRecoverFromStorage;
- TextureStorage11 *mAssociatedStorage;
- gl::ImageIndex mAssociatedImageIndex;
- unsigned int mRecoveredFromStorageCount;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_IMAGE11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp
deleted file mode 100644
index a79fb71f71..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// IndexBuffer11.cpp: Defines the D3D11 IndexBuffer implementation.
-
-#include "libANGLE/renderer/d3d/d3d11/IndexBuffer11.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_NONE), mDynamicUsage(false)
-{
-}
-
-IndexBuffer11::~IndexBuffer11()
-{
-}
-
-gl::Error IndexBuffer11::initialize(unsigned int bufferSize, GLenum 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(bufferDesc, &mBuffer));
-
- if (dynamic)
- {
- mBuffer.setDebugName("IndexBuffer11 (dynamic)");
- }
- else
- {
- mBuffer.setDebugName("IndexBuffer11 (static)");
- }
- }
-
- mBufferSize = bufferSize;
- mIndexType = indexType;
- mDynamicUsage = dynamic;
-
- return gl::NoError();
-}
-
-gl::Error IndexBuffer11::mapBuffer(unsigned int offset, unsigned int size, void** outMappedMemory)
-{
- if (!mBuffer.valid())
- {
- return gl::OutOfMemory() << "Internal index buffer is not initialized.";
- }
-
- // Check for integer overflows and out-out-bounds map requests
- if (offset + size < offset || offset + size > mBufferSize)
- {
- return gl::OutOfMemory() << "Index buffer map range is not inside the buffer.";
- }
-
- ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
-
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- HRESULT result =
- dxContext->Map(mBuffer.get(), 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to map internal index buffer, " << gl::FmtHR(result);
- }
-
- *outMappedMemory = reinterpret_cast<char*>(mappedResource.pData) + offset;
- return gl::NoError();
-}
-
-gl::Error IndexBuffer11::unmapBuffer()
-{
- if (!mBuffer.valid())
- {
- return gl::OutOfMemory() << "Internal index buffer is not initialized.";
- }
-
- ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
- dxContext->Unmap(mBuffer.get(), 0);
- return gl::NoError();
-}
-
-GLenum IndexBuffer11::getIndexType() const
-{
- return mIndexType;
-}
-
-unsigned int IndexBuffer11::getBufferSize() const
-{
- return mBufferSize;
-}
-
-gl::Error IndexBuffer11::setSize(unsigned int bufferSize, GLenum indexType)
-{
- if (bufferSize > mBufferSize || indexType != mIndexType)
- {
- return initialize(bufferSize, indexType, mDynamicUsage);
- }
- else
- {
- return gl::NoError();
- }
-}
-
-gl::Error IndexBuffer11::discard()
-{
- if (!mBuffer.valid())
- {
- return gl::OutOfMemory() << "Internal index buffer is not initialized.";
- }
-
- ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
-
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- HRESULT result = dxContext->Map(mBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to map internal index buffer, " << gl::FmtHR(result);
- }
-
- dxContext->Unmap(mBuffer.get(), 0);
-
- return gl::NoError();
-}
-
-DXGI_FORMAT IndexBuffer11::getIndexFormat() const
-{
- switch (mIndexType)
- {
- case GL_UNSIGNED_BYTE: return DXGI_FORMAT_R16_UINT;
- case GL_UNSIGNED_SHORT: return DXGI_FORMAT_R16_UINT;
- case GL_UNSIGNED_INT: return DXGI_FORMAT_R32_UINT;
- default: UNREACHABLE(); return DXGI_FORMAT_UNKNOWN;
- }
-}
-
-const d3d11::Buffer &IndexBuffer11::getBuffer() const
-{
- return mBuffer;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h
deleted file mode 100644
index 7b5d744c02..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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;
-
- gl::Error initialize(unsigned int bufferSize, GLenum indexType, bool dynamic) override;
-
- gl::Error mapBuffer(unsigned int offset, unsigned int size, void **outMappedMemory) override;
- gl::Error unmapBuffer() override;
-
- GLenum getIndexType() const override;
- unsigned int getBufferSize() const override;
- gl::Error setSize(unsigned int bufferSize, GLenum indexType) override;
-
- gl::Error discard() override;
-
- DXGI_FORMAT getIndexFormat() const;
- const d3d11::Buffer &getBuffer() const;
-
- private:
- Renderer11 *const mRenderer;
-
- d3d11::Buffer mBuffer;
- unsigned int mBufferSize;
- GLenum mIndexType;
- bool mDynamicUsage;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_INDEXBUFFER11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
deleted file mode 100644
index a238f97b08..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
+++ /dev/null
@@ -1,503 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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/Buffer11.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/VertexBuffer11.h"
-#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
-
-namespace rx
-{
-
-namespace
-{
-
-size_t GetReservedBufferCount(bool usesPointSpriteEmulation)
-{
- return usesPointSpriteEmulation ? 1 : 0;
-}
-
-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 divisor;
-};
-
-} // anonymous namespace
-
-PackedAttributeLayout::PackedAttributeLayout() : numAttributes(0), flags(0), attributeData({})
-{
-}
-
-PackedAttributeLayout::PackedAttributeLayout(const PackedAttributeLayout &other) = default;
-
-void PackedAttributeLayout::addAttributeData(GLenum glType,
- UINT semanticIndex,
- gl::VertexFormatType vertexFormatType,
- 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>(vertexFormatType);
- packedAttrib.divisor = static_cast<uint8_t>(divisor);
-
- ASSERT(static_cast<gl::AttributeType>(packedAttrib.attribType) == attribType);
- ASSERT(static_cast<UINT>(packedAttrib.semanticIndex) == semanticIndex);
- ASSERT(static_cast<gl::VertexFormatType>(packedAttrib.vertexFormatType) == vertexFormatType);
- ASSERT(static_cast<unsigned int>(packedAttrib.divisor) == divisor);
-
- static_assert(sizeof(uint32_t) == sizeof(PackedAttribute), "PackedAttributes must be 32-bits exactly.");
-
- attributeData[numAttributes++] = gl::bitCast<uint32_t>(packedAttrib);
-}
-
-bool PackedAttributeLayout::operator==(const PackedAttributeLayout &other) const
-{
- return (numAttributes == other.numAttributes) && (flags == other.flags) &&
- (attributeData == other.attributeData);
-}
-
-InputLayoutCache::InputLayoutCache()
- : mLayoutCache(kDefaultCacheSize * 2), mPointSpriteVertexBuffer(), mPointSpriteIndexBuffer()
-{
-}
-
-InputLayoutCache::~InputLayoutCache()
-{
-}
-
-void InputLayoutCache::clear()
-{
- mLayoutCache.Clear();
- mPointSpriteVertexBuffer.reset();
- mPointSpriteIndexBuffer.reset();
-}
-
-gl::Error InputLayoutCache::applyVertexBuffers(
- const gl::Context *context,
- const std::vector<const TranslatedAttribute *> &currentAttributes,
- GLenum mode,
- GLint start,
- bool isIndexedRendering)
-{
- Renderer11 *renderer = GetImplAs<Context11>(context)->getRenderer();
- const gl::State &state = context->getGLState();
- auto *stateManager = renderer->getStateManager();
- gl::Program *program = state.getProgram();
- ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
-
- bool programUsesInstancedPointSprites = programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation();
- bool instancedPointSpritesActive = programUsesInstancedPointSprites && (mode == GL_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 < currentAttributes.size())
- {
- const auto &attrib = *currentAttributes[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 && isIndexedRendering)
- {
- VertexArray11 *vao11 = GetImplAs<VertexArray11>(state.getVertexArray());
- ASSERT(vao11->isCachedIndexInfoValid());
- TranslatedIndexData *indexInfo = vao11->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_RESULT(bufferStorage->getEmulatedIndexedBuffer(
- context, &indexInfo->srcIndexData, attrib, start),
- buffer);
- }
- else
- {
- ANGLE_TRY_RESULT(
- bufferStorage->getBuffer(context, BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK),
- buffer);
- }
-
- vertexStride = attrib.stride;
- ANGLE_TRY_RESULT(attrib.computeOffset(start), vertexOffset);
- }
-
- size_t bufferIndex = reservedBuffers + attribIndex;
-
- stateManager->queueVertexBufferChange(bufferIndex, buffer, vertexStride, vertexOffset);
- }
-
- // 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)
- {
- const UINT pointSpriteVertexStride = sizeof(float) * 5;
-
- if (!mPointSpriteVertexBuffer.valid())
- {
- static const float pointSpriteVertices[] =
- {
- // Position // TexCoord
- -1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
- -1.0f, 1.0f, 0.0f, 0.0f, 0.0f,
- 1.0f, 1.0f, 0.0f, 1.0f, 0.0f,
- 1.0f, -1.0f, 0.0f, 1.0f, 1.0f,
- -1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
- 1.0f, 1.0f, 0.0f, 1.0f, 0.0f,
- };
-
- D3D11_SUBRESOURCE_DATA vertexBufferData = { pointSpriteVertices, 0, 0 };
- D3D11_BUFFER_DESC vertexBufferDesc;
- vertexBufferDesc.ByteWidth = sizeof(pointSpriteVertices);
- vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
- vertexBufferDesc.Usage = D3D11_USAGE_IMMUTABLE;
- vertexBufferDesc.CPUAccessFlags = 0;
- vertexBufferDesc.MiscFlags = 0;
- vertexBufferDesc.StructureByteStride = 0;
-
- ANGLE_TRY(renderer->allocateResource(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 ? pointSpriteVertexStride : 0;
- stateManager->queueVertexBufferChange(0, mPointSpriteVertexBuffer.get(), stride, 0);
-
- if (!mPointSpriteIndexBuffer.valid())
- {
- // Create an index buffer and set it for pointsprite rendering
- static const unsigned short pointSpriteIndices[] =
- {
- 0, 1, 2, 3, 4, 5,
- };
-
- D3D11_SUBRESOURCE_DATA indexBufferData = { pointSpriteIndices, 0, 0 };
- D3D11_BUFFER_DESC indexBufferDesc;
- indexBufferDesc.ByteWidth = sizeof(pointSpriteIndices);
- indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
- indexBufferDesc.Usage = D3D11_USAGE_IMMUTABLE;
- indexBufferDesc.CPUAccessFlags = 0;
- indexBufferDesc.MiscFlags = 0;
- indexBufferDesc.StructureByteStride = 0;
-
- ANGLE_TRY(renderer->allocateResource(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.
- stateManager->setIndexBuffer(mPointSpriteIndexBuffer.get(), DXGI_FORMAT_R16_UINT, 0);
- }
- }
-
- stateManager->applyVertexBufferChanges();
- return gl::NoError();
-}
-
-gl::Error InputLayoutCache::updateVertexOffsetsForPointSpritesEmulation(
- Renderer11 *renderer,
- const std::vector<const TranslatedAttribute *> &currentAttributes,
- GLint startVertex,
- GLsizei emulatedInstanceId)
-{
- auto *stateManager = renderer->getStateManager();
-
- size_t reservedBuffers = GetReservedBufferCount(true);
- for (size_t attribIndex = 0; attribIndex < currentAttributes.size(); ++attribIndex)
- {
- const auto &attrib = *currentAttributes[attribIndex];
- size_t bufferIndex = reservedBuffers + attribIndex;
-
- if (attrib.divisor > 0)
- {
- unsigned int offset = 0;
- ANGLE_TRY_RESULT(attrib.computeOffset(startVertex), offset);
- offset += (attrib.stride * (emulatedInstanceId / attrib.divisor));
- stateManager->queueVertexOffsetChange(bufferIndex, offset);
- }
- }
-
- stateManager->applyVertexBufferChanges();
- return gl::NoError();
-}
-
-gl::Error InputLayoutCache::updateInputLayout(
- Renderer11 *renderer,
- const gl::State &state,
- const std::vector<const TranslatedAttribute *> &currentAttributes,
- GLenum mode,
- const AttribIndexArray &sortedSemanticIndices,
- const DrawCallVertexParams &vertexParams)
-{
- 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_POINTS);
-
- if (programUsesInstancedPointSprites)
- {
- layout.flags |= PackedAttributeLayout::FLAG_USES_INSTANCED_SPRITES;
- }
-
- if (instancedPointSpritesActive)
- {
- layout.flags |= PackedAttributeLayout::FLAG_INSTANCED_SPRITES_ACTIVE;
- }
-
- if (vertexParams.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));
- gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib, currentValue.Type);
-
- layout.addAttributeData(glslElementType, d3dSemantic, vertexFormatType,
- binding.getDivisor() * divisorMultiplier);
- }
-
- const d3d11::InputLayout *inputLayout = nullptr;
- if (layout.numAttributes > 0 || layout.flags != 0)
- {
- auto it = mLayoutCache.Get(layout);
- if (it != mLayoutCache.end())
- {
- inputLayout = &it->second;
- }
- else
- {
- angle::TrimCache(mLayoutCache.max_size() / 2, kGCLimit, "input layout", &mLayoutCache);
-
- d3d11::InputLayout newInputLayout;
- ANGLE_TRY(createInputLayout(renderer, sortedSemanticIndices, currentAttributes, mode,
- program, vertexParams, &newInputLayout));
-
- auto insertIt = mLayoutCache.Put(layout, std::move(newInputLayout));
- inputLayout = &insertIt->second;
- }
- }
-
- renderer->getStateManager()->setInputLayout(inputLayout);
- return gl::NoError();
-}
-
-gl::Error InputLayoutCache::createInputLayout(
- Renderer11 *renderer,
- const AttribIndexArray &sortedSemanticIndices,
- const std::vector<const TranslatedAttribute *> &currentAttributes,
- GLenum mode,
- gl::Program *program,
- const DrawCallVertexParams &vertexParams,
- d3d11::InputLayout *inputLayoutOut)
-{
- ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
- auto featureLevel = renderer->getRenderer11DeviceCaps().featureLevel;
-
- bool programUsesInstancedPointSprites =
- programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation();
-
- unsigned int inputElementCount = 0;
- std::array<D3D11_INPUT_ELEMENT_DESC, gl::MAX_VERTEX_ATTRIBS> 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;
-
- const auto &vertexFormatType =
- gl::GetVertexFormatType(*attrib.attribute, attrib.currentValueType);
- const auto &vertexFormatInfo = d3d11::GetVertexFormatInfo(vertexFormatType, 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.
-
- GLsizei numIndicesPerInstance = 0;
- if (vertexParams.instances() > 0)
- {
- // This may trigger an evaluation of the index range.
- numIndicesPerInstance = vertexParams.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_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(&shader, nullptr));
-
- ShaderExecutableD3D *shader11 = GetAs<ShaderExecutable11>(shader);
-
- InputElementArray inputElementArray(inputElements.data(), inputElementCount);
- ShaderData vertexShaderData(shader11->getFunction(), shader11->getLength());
-
- ANGLE_TRY(renderer->allocateResource(inputElementArray, &vertexShaderData, inputLayoutOut));
- return gl::NoError();
-}
-
-void InputLayoutCache::setCacheSize(size_t newCacheSize)
-{
- // Forces a reset of the cache.
- LayoutCache newCache(newCacheSize);
- mLayoutCache.Swap(newCache);
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h
deleted file mode 100644
index 8d7c7dd0f0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h
+++ /dev/null
@@ -1,135 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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
-{
-class DrawCallVertexParams;
-struct PackedAttributeLayout
-{
- PackedAttributeLayout();
- PackedAttributeLayout(const PackedAttributeLayout &other);
-
- void addAttributeData(GLenum glType,
- UINT semanticIndex,
- gl::VertexFormatType vertexFormatType,
- 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;
- std::array<uint32_t, gl::MAX_VERTEX_ATTRIBS> 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
-{
-struct TranslatedAttribute;
-struct TranslatedIndexData;
-struct SourceIndexData;
-class ProgramD3D;
-class Renderer11;
-
-class InputLayoutCache : angle::NonCopyable
-{
- public:
- InputLayoutCache();
- ~InputLayoutCache();
-
- void clear();
-
- gl::Error applyVertexBuffers(const gl::Context *context,
- const std::vector<const TranslatedAttribute *> &currentAttributes,
- GLenum mode,
- GLint start,
- bool isIndexedRendering);
-
- gl::Error updateVertexOffsetsForPointSpritesEmulation(
- Renderer11 *renderer,
- const std::vector<const TranslatedAttribute *> &currentAttributes,
- GLint startVertex,
- GLsizei emulatedInstanceId);
-
- // Useful for testing
- void setCacheSize(size_t newCacheSize);
-
- gl::Error updateInputLayout(Renderer11 *renderer,
- const gl::State &state,
- const std::vector<const TranslatedAttribute *> &currentAttributes,
- GLenum mode,
- const AttribIndexArray &sortedSemanticIndices,
- const DrawCallVertexParams &vertexParams);
-
- private:
- gl::Error createInputLayout(Renderer11 *renderer,
- const AttribIndexArray &sortedSemanticIndices,
- const std::vector<const TranslatedAttribute *> &currentAttributes,
- GLenum mode,
- gl::Program *program,
- const DrawCallVertexParams &vertexParams,
- 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;
-
- d3d11::Buffer mPointSpriteVertexBuffer;
- d3d11::Buffer mPointSpriteIndexBuffer;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_INPUTLAYOUTCACHE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/NativeWindow11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/NativeWindow11.h
deleted file mode 100644
index ab234d4450..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/NativeWindow11.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp
deleted file mode 100644
index 7d7ecb0976..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-//
-// 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/formatutils.h"
-#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
-#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
-#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
-#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
-#include "libANGLE/renderer/d3d/d3d11/TextureStorage11.h"
-#include "libANGLE/Texture.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()
-{
-}
-
-gl::Error PixelTransfer11::loadResources()
-{
- if (mResourcesLoaded)
- {
- return gl::NoError();
- }
-
- 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;
-
- ANGLE_TRY(mRenderer->allocateResource(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(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(constantBufferDesc, &mParamsConstantBuffer));
- mParamsConstantBuffer.setDebugName("PixelTransfer11 constant buffer");
-
- // init shaders
- ANGLE_TRY(mRenderer->allocateResource(ShaderData(g_VS_BufferToTexture), &mBufferToTextureVS));
- mBufferToTextureVS.setDebugName("BufferToTexture VS");
-
- ANGLE_TRY(mRenderer->allocateResource(ShaderData(g_GS_BufferToTexture), &mBufferToTextureGS));
- mBufferToTextureGS.setDebugName("BufferToTexture GS");
-
- ANGLE_TRY(buildShaderMap());
-
- StructZero(&mParamsData);
-
- mResourcesLoaded = true;
-
- return gl::NoError();
-}
-
-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 - 1);
- float texelCenterY = 0.5f / static_cast<float>(destSize.height - 1);
-
- 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;
-}
-
-gl::Error 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());
-
- 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->getGLState().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_RESULT(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::SAMPLER_PIXEL, 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 gl::NoError();
-}
-
-gl::Error PixelTransfer11::buildShaderMap()
-{
- d3d11::PixelShader bufferToTextureFloat;
- d3d11::PixelShader bufferToTextureInt;
- d3d11::PixelShader bufferToTextureUint;
-
- ANGLE_TRY(
- mRenderer->allocateResource(ShaderData(g_PS_BufferToTexture_4F), &bufferToTextureFloat));
- ANGLE_TRY(
- mRenderer->allocateResource(ShaderData(g_PS_BufferToTexture_4I), &bufferToTextureInt));
- ANGLE_TRY(
- mRenderer->allocateResource(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 gl::NoError();
-}
-
-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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h
deleted file mode 100644
index a93544247e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h
+++ /dev/null
@@ -1,93 +0,0 @@
-//
-// 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 rx
-{
-class Renderer11;
-class RenderTargetD3D;
-
-class PixelTransfer11
-{
- public:
- explicit PixelTransfer11(Renderer11 *renderer);
- ~PixelTransfer11();
-
- // unpack: the source buffer is stored in the unpack state, and buffer strides
- // offset: the start of the data within the unpack buffer
- // destRenderTarget: individual slice/layer of a target texture
- // destinationFormat/sourcePixelsType: determines shaders + shader parameters
- // destArea: the sub-section of destRenderTarget to copy to
- gl::Error copyBufferToTexture(const gl::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);
-
- gl::Error loadResources();
- gl::Error buildShaderMap();
- 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.cpp
deleted file mode 100644
index c9554431e5..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h
deleted file mode 100644
index cf838eec05..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
deleted file mode 100644
index 66b9476e7f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
+++ /dev/null
@@ -1,375 +0,0 @@
-//
-// 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/renderer/d3d/d3d11/Renderer11.h"
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-
-namespace
-{
-
-GLuint64 MergeQueryResults(GLenum type, GLuint64 currentResult, GLuint64 newResult)
-{
- switch (type)
- {
- case GL_ANY_SAMPLES_PASSED:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
- return (currentResult == GL_TRUE || newResult == GL_TRUE) ? GL_TRUE : GL_FALSE;
-
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- return currentResult + newResult;
-
- case GL_TIME_ELAPSED_EXT:
- return currentResult + newResult;
-
- case GL_TIMESTAMP_EXT:
- return newResult;
-
- case GL_COMMANDS_COMPLETED_CHROMIUM:
- return newResult;
-
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-} // anonymous namespace
-
-namespace rx
-{
-
-Query11::QueryState::QueryState() : query(), beginTimestamp(), endTimestamp(), finished(false)
-{
-}
-
-Query11::QueryState::~QueryState()
-{
-}
-
-Query11::Query11(Renderer11 *renderer, GLenum type)
- : QueryImpl(type), mResult(0), mResultSum(0), mRenderer(renderer)
-{
- mActiveQuery = std::unique_ptr<QueryState>(new QueryState());
-}
-
-Query11::~Query11()
-{
- mRenderer->getStateManager()->onDeleteQueryObject(this);
-}
-
-gl::Error Query11::begin()
-{
- mResultSum = 0;
- mRenderer->getStateManager()->onBeginQuery(this);
- return resume();
-}
-
-gl::Error Query11::end()
-{
- return pause();
-}
-
-gl::Error Query11::queryCounter()
-{
- // This doesn't do anything for D3D11 as we don't support timestamps
- ASSERT(getType() == GL_TIMESTAMP_EXT);
- mResultSum = 0;
- mPendingQueries.push_back(std::unique_ptr<QueryState>(new QueryState()));
- return gl::NoError();
-}
-
-template <typename T>
-gl::Error Query11::getResultBase(T *params)
-{
- ASSERT(!mActiveQuery->query.valid());
- ANGLE_TRY(flush(true));
- ASSERT(mPendingQueries.empty());
- *params = static_cast<T>(mResultSum);
-
- return gl::NoError();
-}
-
-gl::Error Query11::getResult(GLint *params)
-{
- return getResultBase(params);
-}
-
-gl::Error Query11::getResult(GLuint *params)
-{
- return getResultBase(params);
-}
-
-gl::Error Query11::getResult(GLint64 *params)
-{
- return getResultBase(params);
-}
-
-gl::Error Query11::getResult(GLuint64 *params)
-{
- return getResultBase(params);
-}
-
-gl::Error Query11::isResultAvailable(bool *available)
-{
- ANGLE_TRY(flush(false));
-
- *available = mPendingQueries.empty();
- return gl::NoError();
-}
-
-gl::Error Query11::pause()
-{
- if (mActiveQuery->query.valid())
- {
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- GLenum queryType = getType();
-
- // If we are doing time elapsed query the end timestamp
- if (queryType == GL_TIME_ELAPSED_EXT)
- {
- 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(false);
-}
-
-gl::Error Query11::resume()
-{
- if (!mActiveQuery->query.valid())
- {
- ANGLE_TRY(flush(false));
-
- GLenum queryType = getType();
- D3D11_QUERY d3dQueryType = gl_d3d11::ConvertQueryType(queryType);
-
- D3D11_QUERY_DESC queryDesc;
- queryDesc.Query = d3dQueryType;
- queryDesc.MiscFlags = 0;
-
- ANGLE_TRY(mRenderer->allocateResource(queryDesc, &mActiveQuery->query));
-
- // If we are doing time elapsed we also need a query to actually query the timestamp
- if (queryType == GL_TIME_ELAPSED_EXT)
- {
- D3D11_QUERY_DESC desc;
- desc.Query = D3D11_QUERY_TIMESTAMP;
- desc.MiscFlags = 0;
-
- ANGLE_TRY(mRenderer->allocateResource(desc, &mActiveQuery->beginTimestamp));
- ANGLE_TRY(mRenderer->allocateResource(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 (queryType == GL_TIME_ELAPSED_EXT)
- {
- context->End(mActiveQuery->beginTimestamp.get());
- }
- }
-
- return gl::NoError();
-}
-
-gl::Error Query11::flush(bool force)
-{
- while (!mPendingQueries.empty())
- {
- QueryState *query = mPendingQueries.front().get();
-
- do
- {
- ANGLE_TRY(testQuery(query));
- if (!query->finished && !force)
- {
- return gl::NoError();
- }
- } while (!query->finished);
-
- mResultSum = MergeQueryResults(getType(), mResultSum, mResult);
- mPendingQueries.pop_front();
- }
-
- return gl::NoError();
-}
-
-gl::Error Query11::testQuery(QueryState *queryState)
-{
- if (!queryState->finished)
- {
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- switch (getType())
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- {
- ASSERT(queryState->query.valid());
- UINT64 numPixels = 0;
- HRESULT result =
- context->GetData(queryState->query.get(), &numPixels, sizeof(numPixels), 0);
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to get the data of an internal query, " << gl::FmtHR(result);
- }
-
- if (result == S_OK)
- {
- queryState->finished = true;
- mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
- }
- }
- break;
-
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- {
- ASSERT(queryState->query.valid());
- D3D11_QUERY_DATA_SO_STATISTICS soStats = {0};
- HRESULT result =
- context->GetData(queryState->query.get(), &soStats, sizeof(soStats), 0);
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to get the data of an internal query, " << gl::FmtHR(result);
- }
-
- if (result == S_OK)
- {
- queryState->finished = true;
- mResult = static_cast<GLuint64>(soStats.NumPrimitivesWritten);
- }
- }
- break;
-
- case GL_TIME_ELAPSED_EXT:
- {
- 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);
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to get the data of an internal query, " << gl::FmtHR(result);
- }
-
- if (result == S_OK)
- {
- UINT64 beginTime = 0;
- HRESULT beginRes = context->GetData(queryState->beginTimestamp.get(),
- &beginTime, sizeof(UINT64), 0);
- if (FAILED(beginRes))
- {
- return gl::OutOfMemory() << "Failed to get the data of an internal query, "
- << gl::FmtHR(beginRes);
- }
- UINT64 endTime = 0;
- HRESULT endRes = context->GetData(queryState->endTimestamp.get(), &endTime,
- sizeof(UINT64), 0);
- if (FAILED(endRes))
- {
- return gl::OutOfMemory() << "Failed to get the data of an internal query, "
- << gl::FmtHR(endRes);
- }
-
- 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_TIMESTAMP_EXT:
- {
- // 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_COMMANDS_COMPLETED_CHROMIUM:
- {
- ASSERT(queryState->query.valid());
- BOOL completed = 0;
- HRESULT result =
- context->GetData(queryState->query.get(), &completed, sizeof(completed), 0);
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to get the data of an internal query, " << gl::FmtHR(result);
- }
-
- if (result == S_OK)
- {
- queryState->finished = true;
- ASSERT(completed == TRUE);
- mResult = (completed == TRUE) ? GL_TRUE : GL_FALSE;
- }
- }
- break;
-
- default:
- UNREACHABLE();
- break;
- }
-
- if (!queryState->finished && mRenderer->testDeviceLost())
- {
- mRenderer->notifyDeviceLost();
- return gl::OutOfMemory() << "Failed to test get query result, device is lost.";
- }
- }
-
- return gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.h
deleted file mode 100644
index a88a8892aa..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// 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 Renderer11;
-
-class Query11 : public QueryImpl
-{
- public:
- Query11(Renderer11 *renderer, GLenum type);
- ~Query11() override;
-
- gl::Error begin() override;
- gl::Error end() override;
- gl::Error queryCounter() override;
- gl::Error getResult(GLint *params) override;
- gl::Error getResult(GLuint *params) override;
- gl::Error getResult(GLint64 *params) override;
- gl::Error getResult(GLuint64 *params) override;
- gl::Error isResultAvailable(bool *available) override;
-
- gl::Error pause();
- gl::Error resume();
-
- private:
- struct QueryState final : private angle::NonCopyable
- {
- QueryState();
- ~QueryState();
-
- d3d11::Query query;
- d3d11::Query beginTimestamp;
- d3d11::Query endTimestamp;
- bool finished;
- };
-
- gl::Error flush(bool force);
- gl::Error testQuery(QueryState *queryState);
-
- template <typename T>
- gl::Error getResultBase(T *params);
-
- GLuint64 mResult;
- GLuint64 mResultSum;
-
- Renderer11 *mRenderer;
-
- std::unique_ptr<QueryState> mActiveQuery;
- std::deque<std::unique_ptr<QueryState>> mPendingQueries;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_QUERY11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
deleted file mode 100644
index 5b85196c2e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-//
-// 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/debug.h"
-#include "libANGLE/Framebuffer.h"
-#include "libANGLE/FramebufferAttachment.h"
-#include "libANGLE/renderer/d3d/FramebufferD3D.h"
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-#include "libANGLE/renderer/d3d/d3d11/Renderer11.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,
- const gl::Framebuffer *framebuffer,
- const gl::BlendState &blendState)
-{
- d3d11::BlendStateKey key;
- FramebufferD3D *framebufferD3D = GetImplAs<FramebufferD3D>(framebuffer);
- const gl::AttachmentList &colorbuffers = framebufferD3D->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;
-}
-
-gl::Error RenderStateCache::getBlendState(Renderer11 *renderer,
- const d3d11::BlendStateKey &key,
- const d3d11::BlendState **outBlendState)
-{
- auto keyIter = mBlendStateCache.Get(key);
- if (keyIter != mBlendStateCache.end())
- {
- *outBlendState = &keyIter->second;
- return gl::NoError();
- }
-
- 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(blendDesc, &d3dBlendState));
- const auto &iter = mBlendStateCache.Put(key, std::move(d3dBlendState));
-
- *outBlendState = &iter->second;
-
- return gl::NoError();
-}
-
-gl::Error RenderStateCache::getRasterizerState(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 gl::NoError();
- }
-
- 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(rasterDesc, &dx11RasterizerState));
- *outRasterizerState = dx11RasterizerState.get();
- mRasterizerStateCache.Put(key, std::move(dx11RasterizerState));
-
- return gl::NoError();
-}
-
-gl::Error RenderStateCache::getDepthStencilState(Renderer11 *renderer,
- const gl::DepthStencilState &glState,
- const d3d11::DepthStencilState **outDSState)
-{
- auto keyIter = mDepthStencilStateCache.Get(glState);
- if (keyIter != mDepthStencilStateCache.end())
- {
- *outDSState = &keyIter->second;
- return gl::NoError();
- }
-
- 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(dsDesc, &dx11DepthStencilState));
- const auto &iter = mDepthStencilStateCache.Put(glState, std::move(dx11DepthStencilState));
-
- *outDSState = &iter->second;
-
- return gl::NoError();
-}
-
-gl::Error RenderStateCache::getSamplerState(Renderer11 *renderer,
- const gl::SamplerState &samplerState,
- ID3D11SamplerState **outSamplerState)
-{
- auto keyIter = mSamplerStateCache.Get(samplerState);
- if (keyIter != mSamplerStateCache.end())
- {
- *outSamplerState = keyIter->second.get();
- return gl::NoError();
- }
-
- TrimCache(kMaxStates, kGCLimit, "sampler state", &mSamplerStateCache);
-
- const auto &featureLevel = renderer->getRenderer11DeviceCaps().featureLevel;
-
- D3D11_SAMPLER_DESC samplerDesc;
- samplerDesc.Filter =
- gl_d3d11::ConvertFilter(samplerState.minFilter, samplerState.magFilter,
- samplerState.maxAnisotropy, samplerState.compareMode);
- samplerDesc.AddressU = gl_d3d11::ConvertTextureWrap(samplerState.wrapS);
- samplerDesc.AddressV = gl_d3d11::ConvertTextureWrap(samplerState.wrapT);
- samplerDesc.AddressW = gl_d3d11::ConvertTextureWrap(samplerState.wrapR);
- samplerDesc.MipLODBias = 0;
- samplerDesc.MaxAnisotropy =
- gl_d3d11::ConvertMaxAnisotropy(samplerState.maxAnisotropy, featureLevel);
- samplerDesc.ComparisonFunc = gl_d3d11::ConvertComparison(samplerState.compareFunc);
- samplerDesc.BorderColor[0] = 0.0f;
- samplerDesc.BorderColor[1] = 0.0f;
- samplerDesc.BorderColor[2] = 0.0f;
- samplerDesc.BorderColor[3] = 0.0f;
- samplerDesc.MinLOD = samplerState.minLod;
- samplerDesc.MaxLOD = samplerState.maxLod;
-
- if (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.maxLod >= 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(samplerDesc, &dx11SamplerState));
- *outSamplerState = dx11SamplerState.get();
- mSamplerStateCache.Put(samplerState, std::move(dx11SamplerState));
-
- return gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h
deleted file mode 100644
index 7501e83fc4..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// 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 gl
-{
-class Framebuffer;
-}
-
-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 Renderer11;
-
-class RenderStateCache : angle::NonCopyable
-{
- public:
- RenderStateCache();
- virtual ~RenderStateCache();
-
- void clear();
-
- static d3d11::BlendStateKey GetBlendStateKey(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::BlendState &blendState);
- gl::Error getBlendState(Renderer11 *renderer,
- const d3d11::BlendStateKey &key,
- const d3d11::BlendState **outBlendState);
- gl::Error getRasterizerState(Renderer11 *renderer,
- const gl::RasterizerState &rasterState,
- bool scissorEnabled,
- ID3D11RasterizerState **outRasterizerState);
- gl::Error getDepthStencilState(Renderer11 *renderer,
- const gl::DepthStencilState &dsState,
- const d3d11::DepthStencilState **outDSState);
- gl::Error getSamplerState(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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp
deleted file mode 100644
index 594a382a72..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// RenderTarget11.cpp: Implements a DX11-specific wrapper for ID3D11View pointers
-// retained by Renderbuffers.
-
-#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
-
-#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
-#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-#include "libANGLE/renderer/d3d/d3d11/SwapChain11.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()
-{
- ASSERT(mBroadcastChannel.empty());
-}
-
-void RenderTarget11::signalDirty(const gl::Context *context)
-{
- mBroadcastChannel.signal(context);
-
- // Clear the list. We can't do this in the receiver because it would mutate during iteration.
- mBroadcastChannel.reset();
-}
-
-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::Format::ID::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::Format::ID::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
-{
- return mShaderResource;
-}
-
-const d3d11::SharedSRV &TextureRenderTarget11::getBlitShaderResourceView() 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
-{
- return (mDepth ? mSwapChain->getDepthStencilShaderResource()
- : mSwapChain->getRenderTargetShaderResource());
-}
-
-const d3d11::SharedSRV &SurfaceRenderTarget11::getBlitShaderResourceView() const
-{
- // The SurfaceRenderTargetView format should always be such that the normal SRV works for blits.
- return getShaderResourceView();
-}
-
-unsigned int SurfaceRenderTarget11::getSubresourceIndex() const
-{
- return 0;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h
deleted file mode 100644
index db49cac9f5..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h
+++ /dev/null
@@ -1,131 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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 = 0;
- virtual const d3d11::SharedSRV &getBlitShaderResourceView() const = 0;
-
- virtual unsigned int getSubresourceIndex() const = 0;
-
- void signalDirty(const gl::Context *context) override;
- OnRenderTargetDirtyChannel *getBroadcastChannel() { return &mBroadcastChannel; }
-
- const d3d11::Format &getFormatSet() const { return mFormatSet; }
-
- protected:
- OnRenderTargetDirtyChannel mBroadcastChannel;
- 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 override;
- const d3d11::SharedSRV &getBlitShaderResourceView() 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 override;
- const d3d11::SharedSRV &getBlitShaderResourceView() const override;
-
- unsigned int getSubresourceIndex() const override;
-
- private:
- SwapChain11 *mSwapChain;
- bool mDepth;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_RENDERTARGET11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
deleted file mode 100644
index b0ef9abddc..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ /dev/null
@@ -1,4089 +0,0 @@
-//
-// 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/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/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/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/Query11.h"
-#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
-#include "libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h"
-#include "libANGLE/renderer/d3d/d3d11/StreamProducerNV12.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 "third_party/trace_event/trace_event.h"
-
-#ifdef ANGLE_ENABLE_WINDOWS_STORE
-#include "libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h"
-#else
-#include "libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.h"
-#endif
-
-// Include the D3D9 debug annotator header for use by the desktop D3D11 renderer
-// because the D3D11 interface method ID3DUserDefinedAnnotation::GetStatus
-// doesn't work with the Graphics Diagnostics tools in Visual Studio 2013.
-#ifdef ANGLE_ENABLE_D3D9
-#include "libANGLE/renderer/d3d/d3d9/DebugAnnotator9.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;
- }
-}
-
-template <typename T>
-void CopyLineLoopIndicesWithRestart(const void *indices,
- size_t count,
- GLenum indexType,
- std::vector<GLuint> *bufferOut)
-{
- GLuint restartIndex = gl::GetPrimitiveRestartIndex(indexType);
- GLuint d3dRestartIndex = static_cast<GLuint>(d3d11::GetPrimitiveRestartIndex());
- const T *srcPtr = static_cast<const T *>(indices);
- Optional<GLuint> currentLoopStart;
-
- bufferOut->clear();
-
- for (size_t indexIdx = 0; indexIdx < count; ++indexIdx)
- {
- GLuint value = static_cast<GLuint>(srcPtr[indexIdx]);
-
- if (value == restartIndex)
- {
- if (currentLoopStart.valid())
- {
- bufferOut->push_back(currentLoopStart.value());
- bufferOut->push_back(d3dRestartIndex);
- currentLoopStart.reset();
- }
- }
- else
- {
- bufferOut->push_back(value);
- if (!currentLoopStart.valid())
- {
- currentLoopStart = value;
- }
- }
- }
-
- if (currentLoopStart.valid())
- {
- bufferOut->push_back(currentLoopStart.value());
- }
-}
-
-void GetLineLoopIndices(const void *indices,
- GLenum indexType,
- GLuint count,
- bool usePrimitiveRestartFixedIndex,
- std::vector<GLuint> *bufferOut)
-{
- if (indexType != GL_NONE && usePrimitiveRestartFixedIndex)
- {
- switch (indexType)
- {
- case GL_UNSIGNED_BYTE:
- CopyLineLoopIndicesWithRestart<GLubyte>(indices, count, indexType, bufferOut);
- break;
- case GL_UNSIGNED_SHORT:
- CopyLineLoopIndicesWithRestart<GLushort>(indices, count, indexType, bufferOut);
- break;
- case GL_UNSIGNED_INT:
- CopyLineLoopIndicesWithRestart<GLuint>(indices, count, indexType, bufferOut);
- 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_NONE:
- SetLineLoopIndices(&(*bufferOut)[0], count);
- break;
- case GL_UNSIGNED_BYTE:
- CopyLineLoopIndices<GLubyte>(indices, &(*bufferOut)[0], count);
- break;
- case GL_UNSIGNED_SHORT:
- CopyLineLoopIndices<GLushort>(indices, &(*bufferOut)[0], count);
- break;
- case GL_UNSIGNED_INT:
- 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,
- GLenum indexType,
- std::vector<GLuint> *bufferOut)
-{
- GLuint restartIndex = gl::GetPrimitiveRestartIndex(indexType);
- GLuint d3dRestartIndex = gl::GetPrimitiveRestartIndex(GL_UNSIGNED_INT);
- 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,
- GLenum indexType,
- GLuint count,
- bool usePrimitiveRestartFixedIndex,
- std::vector<GLuint> *bufferOut)
-{
- if (indexType != GL_NONE && usePrimitiveRestartFixedIndex)
- {
- switch (indexType)
- {
- case GL_UNSIGNED_BYTE:
- CopyTriangleFanIndicesWithRestart<GLubyte>(indices, count, indexType, bufferOut);
- break;
- case GL_UNSIGNED_SHORT:
- CopyTriangleFanIndicesWithRestart<GLushort>(indices, count, indexType, bufferOut);
- break;
- case GL_UNSIGNED_INT:
- 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_NONE:
- SetTriangleFanIndices(&(*bufferOut)[0], numTris);
- break;
- case GL_UNSIGNED_BYTE:
- CopyTriangleFanIndices<GLubyte>(indices, &(*bufferOut)[0], numTris);
- break;
- case GL_UNSIGNED_SHORT:
- CopyTriangleFanIndices<GLushort>(indices, &(*bufferOut)[0], numTris);
- break;
- case GL_UNSIGNED_INT:
- CopyTriangleFanIndices<GLuint>(indices, &(*bufferOut)[0], numTris);
- break;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-bool DrawCallNeedsTranslation(const gl::Context *context, GLenum mode)
-{
- const auto &glState = context->getGLState();
- const gl::VertexArray *vertexArray = glState.getVertexArray();
- VertexArray11 *vertexArray11 = GetImplAs<VertexArray11>(vertexArray);
- // 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 (vertexArray11->hasActiveDynamicAttrib(context) || mode == GL_LINE_LOOP ||
- mode == GL_TRIANGLE_FAN)
- {
- return true;
- }
-
- ProgramD3D *programD3D = GetImplAs<ProgramD3D>(glState.getProgram());
- if (InstancedPointSpritesActive(programD3D, mode))
- {
- return true;
- }
-
- return false;
-}
-
-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;
-}
-
-int GetAdjustedInstanceCount(const gl::Program *program, int instanceCount)
-{
- if (!program->usesMultiview())
- {
- return instanceCount;
- }
- if (instanceCount == 0)
- {
- return program->getNumViews();
- }
- return program->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;
- }
-}
-
-bool CullsEverything(const gl::State &glState)
-{
- return (glState.getRasterizerState().cullFace &&
- glState.getRasterizerState().cullMode == gl::CullFaceMode::FrontAndBack);
-}
-
-} // 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),
- mAnnotator(nullptr)
-{
- 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.B5G6R5support = 0;
- mRenderer11DeviceCaps.B4G4R4A4support = 0;
- mRenderer11DeviceCaps.B5G5R5A1support = 0;
-
- mD3d11Module = nullptr;
- mDxgiModule = nullptr;
- mDCompModule = nullptr;
- mCreatedWithDeviceEXT = false;
- mEGLDevice = nullptr;
-
- mDevice = nullptr;
- mDeviceContext = nullptr;
- mDeviceContext1 = nullptr;
- mDeviceContext3 = nullptr;
- mDxgiAdapter = nullptr;
- mDxgiFactory = nullptr;
-
- ZeroMemory(&mAdapterDescription, sizeof(mAdapterDescription));
-
- if (mDisplay->getPlatform() == EGL_PLATFORM_ANGLE_ANGLE)
- {
- const auto &attributes = mDisplay->getAttributeMap();
-
- 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)
- {
- if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 3)
- {
- mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
- }
-#if defined(ANGLE_ENABLE_WINDOWS_STORE)
- if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 2)
- {
- mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_2);
- }
- if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 1)
- {
- mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_1);
- }
-#endif
- }
-
- 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_WARP_ANGLE:
- mRequestedDriverType = D3D_DRIVER_TYPE_WARP;
- break;
-
- case EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE:
- mRequestedDriverType = D3D_DRIVER_TYPE_REFERENCE;
- break;
-
- case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE:
- mRequestedDriverType = D3D_DRIVER_TYPE_NULL;
- break;
-
- default:
- UNREACHABLE();
- }
-
- 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);
-
- mCreateDebugDevice = ShouldUseDebugLayers(attributes);
- }
- else if (display->getPlatform() == EGL_PLATFORM_DEVICE_EXT)
- {
- mEGLDevice = GetImplAs<DeviceD3D>(display->getDevice());
- ASSERT(mEGLDevice != 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;
- mPresentPathFastEnabled = false;
- }
-
-// The D3D11 renderer must choose the D3D9 debug annotator because the D3D11 interface
-// method ID3DUserDefinedAnnotation::GetStatus on desktop builds doesn't work with the Graphics
-// Diagnostics tools in Visual Studio 2013.
-// The D3D9 annotator works properly for both D3D11 and D3D9.
-// Incorrect status reporting can cause ANGLE to log unnecessary debug events.
-#ifdef ANGLE_ENABLE_D3D9
- mAnnotator = new DebugAnnotator9();
-#else
- mAnnotator = new DebugAnnotator11();
-#endif
- ASSERT(mAnnotator);
- gl::InitializeDebugAnnotations(mAnnotator);
-}
-
-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
- {
- 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
-
- {
- 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)
- {
- 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};
-
- 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;
- {
- SCOPED_ANGLE_HISTOGRAM_TIMER("GPU.ANGLE.Renderer11InitializeDLLsMS");
- 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)
- {
- 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))
- {
- SCOPED_ANGLE_HISTOGRAM_TIMER("GPU.ANGLE.D3D11CreateDeviceMS");
- 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
- {
- // We should use the inputted D3D11 device instead
- void *device = nullptr;
- ANGLE_TRY(mEGLDevice->getDevice(&device));
-
- ID3D11Device *d3dDevice = reinterpret_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");
-
- 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()
-{
- SCOPED_ANGLE_HISTOGRAM_TIMER("GPU.ANGLE.Renderer11InitializeDeviceMS");
- 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);
-
- const gl::Caps &rendererCaps = getNativeCaps();
-
- if (mStateManager.initialize(rendererCaps, getNativeExtensions()).isError())
- {
- return egl::EglBadAlloc() << "Error initializing state manager.";
- }
-
- // 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 (getWorkarounds().disableB5G6R5Support)
- {
- mRenderer11DeviceCaps.B5G6R5support = 0;
- mRenderer11DeviceCaps.B5G6R5maxSamples = 0;
- }
- else
- {
- PopulateFormatDeviceCaps(mDevice, DXGI_FORMAT_B5G6R5_UNORM,
- &mRenderer11DeviceCaps.B5G6R5support,
- &mRenderer11DeviceCaps.B5G6R5maxSamples);
- }
-
- 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;
-
-#if 0 // Disabling support for multisampling with Qt5 as it's causing a crash in the D3D11 shaders.
-
- // 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;
- }
-
-#endif
-
- // 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.renderable)
- {
- continue;
- }
-
- for (GLenum depthStencilBufferInternalFormat : depthStencilBufferFormats)
- {
- const gl::TextureCaps &depthStencilBufferFormatCaps =
- rendererTextureCaps.get(depthStencilBufferInternalFormat);
- if (!depthStencilBufferFormatCaps.renderable &&
- depthStencilBufferInternalFormat != GL_NONE)
- {
- 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->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;
- // Not all D3D11 devices support NV12 textures
- if (getNV12TextureSupport())
- {
- outExtensions->streamProducerD3DTextureNV12 = 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;
-}
-
-gl::Error Renderer11::flush()
-{
- mDeviceContext->Flush();
- return gl::NoError();
-}
-
-gl::Error Renderer11::finish()
-{
- if (!mSyncQuery.valid())
- {
- D3D11_QUERY_DESC queryDesc;
- queryDesc.Query = D3D11_QUERY_EVENT;
- queryDesc.MiscFlags = 0;
-
- ANGLE_TRY(allocateResource(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);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to get event query data, " << gl::FmtHR(result);
- }
-
- if (result == S_FALSE)
- {
- // Keep polling, but allow other threads to do something useful first
- ScheduleYield();
- }
-
- if (testDeviceLost())
- {
- mDisplay->notifyDeviceLost();
- return gl::OutOfMemory() << "Device was lost while waiting for sync.";
- }
- } while (result == S_FALSE);
-
- return gl::NoError();
-}
-
-bool Renderer11::isValidNativeWindow(EGLNativeWindowType window) const
-{
-#ifdef ANGLE_ENABLE_WINDOWS_STORE
- return NativeWindow11WinRT::IsValidNativeWindow(window);
-#else
- return NativeWindow11Win32::IsValidNativeWindow(window);
-#endif
-}
-
-NativeWindowD3D *Renderer11::createNativeWindow(EGLNativeWindowType window,
- const egl::Config *config,
- const egl::AttributeMap &attribs) const
-{
-#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,
- GLenum *fboFormat) 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);
- }
- if (static_cast<EGLint>(desc.SampleDesc.Count) != configuration->samples)
- {
- // 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 || desc.SampleDesc.Count != 1)
- {
- return egl::EglBadParameter() << "Texture's sample count does not match.";
- }
- }
- // 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_B8G8R8A8_UNORM:
- case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- break;
-
- default:
- return egl::EglBadParameter()
- << "Unknown client buffer texture format: " << desc.Format;
- }
-
- if (fboFormat)
- {
- const angle::Format &angleFormat = d3d11_angle::GetFormat(desc.Format);
- *fboFormat = angleFormat.fboImplementationInternalFormat;
- }
-
- 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 reinterpret_cast<void *>(mDevice);
-}
-
-bool Renderer11::applyPrimitiveType(const gl::State &glState, GLenum mode, GLsizei count)
-{
- D3D11_PRIMITIVE_TOPOLOGY primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
-
- GLsizei minCount = 0;
-
- switch (mode)
- {
- case GL_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 false;
- }
-
- // If instanced pointsprites are enabled and the shader uses gl_PointSize, the topology
- // must be D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST.
- if (usesPointSize && getWorkarounds().useInstancedPointSpriteEmulation)
- {
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
- }
- else
- {
- primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST;
- }
- minCount = 1;
- break;
- }
- case GL_LINES:
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINELIST;
- minCount = 2;
- break;
- case GL_LINE_LOOP:
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
- minCount = 2;
- break;
- case GL_LINE_STRIP:
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
- minCount = 2;
- break;
- case GL_TRIANGLES:
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
- minCount = CullsEverything(glState) ? std::numeric_limits<GLsizei>::max() : 3;
- break;
- case GL_TRIANGLE_STRIP:
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
- minCount = CullsEverything(glState) ? std::numeric_limits<GLsizei>::max() : 3;
- break;
- // emulate fans via rewriting index buffer
- case GL_TRIANGLE_FAN:
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
- minCount = CullsEverything(glState) ? std::numeric_limits<GLsizei>::max() : 3;
- break;
- default:
- UNREACHABLE();
- return false;
- }
-
- mStateManager.setPrimitiveTopology(primitiveTopology);
-
- return count >= minCount;
-}
-
-gl::Error Renderer11::drawArrays(const gl::Context *context,
- GLenum mode,
- GLint startVertex,
- GLsizei count,
- GLsizei instances)
-{
- const auto &glState = context->getGLState();
-
- if (!applyPrimitiveType(glState, mode, count))
- {
- return gl::NoError();
- }
-
- DrawCallVertexParams vertexParams(startVertex, count, instances);
- ANGLE_TRY(mStateManager.applyVertexBuffer(context, mode, vertexParams, false));
-
- if (glState.isTransformFeedbackActiveUnpaused())
- {
- ANGLE_TRY(markTransformFeedbackUsage(context));
- }
-
- gl::Program *program = glState.getProgram();
- ASSERT(program != nullptr);
- GLsizei adjustedInstanceCount = GetAdjustedInstanceCount(program, instances);
- ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
-
- if (programD3D->usesGeometryShader(mode) && glState.isTransformFeedbackActiveUnpaused())
- {
- // 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 (adjustedInstanceCount > 0)
- {
- mDeviceContext->DrawInstanced(count, adjustedInstanceCount, 0, 0);
- }
- else
- {
- mDeviceContext->Draw(count, 0);
- }
-
- rx::ShaderExecutableD3D *pixelExe = nullptr;
- ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(&pixelExe, nullptr));
-
- // Skip the draw call if rasterizer discard is enabled (or no fragment shader).
- if (!pixelExe || glState.getRasterizerState().rasterizerDiscard)
- {
- return gl::NoError();
- }
-
- mStateManager.setPixelShader(&GetAs<ShaderExecutable11>(pixelExe)->getPixelShader());
-
- // Retrieve the geometry shader.
- rx::ShaderExecutableD3D *geometryExe = nullptr;
- ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(context, mode, &geometryExe,
- nullptr));
-
- mStateManager.setGeometryShader(
- &GetAs<ShaderExecutable11>(geometryExe)->getGeometryShader());
-
- if (adjustedInstanceCount > 0)
- {
- mDeviceContext->DrawInstanced(count, adjustedInstanceCount, 0, 0);
- }
- else
- {
- mDeviceContext->Draw(count, 0);
- }
- return gl::NoError();
- }
-
- if (mode == GL_LINE_LOOP)
- {
- return drawLineLoop(context, count, GL_NONE, nullptr, 0, adjustedInstanceCount);
- }
-
- if (mode == GL_TRIANGLE_FAN)
- {
- return drawTriangleFan(context, count, GL_NONE, nullptr, 0, adjustedInstanceCount);
- }
-
- bool useInstancedPointSpriteEmulation =
- programD3D->usesPointSize() && getWorkarounds().useInstancedPointSpriteEmulation;
-
- if (mode != GL_POINTS || !useInstancedPointSpriteEmulation)
- {
- if (adjustedInstanceCount == 0)
- {
- mDeviceContext->Draw(count, 0);
- }
- else
- {
- mDeviceContext->DrawInstanced(count, adjustedInstanceCount, 0, 0);
- }
- return gl::NoError();
- }
-
- // This code should not be reachable by multi-view programs.
- ASSERT(program->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, count, 0, 0, 0);
- return gl::NoError();
- }
-
- // 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 < instances; i++)
- {
- ANGLE_TRY(mStateManager.updateVertexOffsetsForPointSpritesEmulation(startVertex, i));
- mDeviceContext->DrawIndexedInstanced(6, count, 0, 0, 0);
- }
-
- // This required by updateVertexOffsets... above but is outside of the loop for speed.
- mStateManager.invalidateVertexBuffer();
- return gl::NoError();
-}
-
-gl::Error Renderer11::drawElements(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances)
-{
- const auto &glState = context->getGLState();
-
- if (!applyPrimitiveType(glState, mode, count))
- {
- return gl::NoError();
- }
-
- // Transform feedback is not allowed for DrawElements, this error should have been caught at the
- // API validation layer.
- ASSERT(!glState.isTransformFeedbackActiveUnpaused());
-
- const auto &lazyIndexRange = context->getParams<gl::HasIndexRange>();
-
- bool usePrimitiveRestartWorkaround =
- UsePrimitiveRestartWorkaround(glState.isPrimitiveRestartEnabled(), type);
- DrawCallVertexParams vertexParams(!usePrimitiveRestartWorkaround, lazyIndexRange, 0, instances);
-
- ANGLE_TRY(mStateManager.applyIndexBuffer(context, indices, count, type, lazyIndexRange,
- usePrimitiveRestartWorkaround));
- ANGLE_TRY(mStateManager.applyVertexBuffer(context, mode, vertexParams, true));
-
- int startVertex = static_cast<int>(vertexParams.firstVertex());
- int baseVertex = -startVertex;
-
- const gl::Program *program = glState.getProgram();
- GLsizei adjustedInstanceCount = GetAdjustedInstanceCount(program, instances);
-
- if (mode == GL_LINE_LOOP)
- {
- return drawLineLoop(context, count, type, indices, baseVertex, adjustedInstanceCount);
- }
-
- if (mode == GL_TRIANGLE_FAN)
- {
- return drawTriangleFan(context, count, type, indices, baseVertex, adjustedInstanceCount);
- }
-
- const ProgramD3D *programD3D = GetImplAs<ProgramD3D>(glState.getProgram());
-
- if (mode != GL_POINTS || !programD3D->usesInstancedPointSpriteEmulation())
- {
- if (adjustedInstanceCount == 0)
- {
- mDeviceContext->DrawIndexed(count, 0, baseVertex);
- }
- else
- {
- mDeviceContext->DrawIndexedInstanced(count, adjustedInstanceCount, 0, baseVertex, 0);
- }
- return gl::NoError();
- }
-
- // This code should not be reachable by multi-view programs.
- ASSERT(program->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 (instances == 0)
- {
- mDeviceContext->DrawIndexedInstanced(6, count, 0, 0, 0);
- return gl::NoError();
- }
-
- // 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.
- GLsizei elementsToRender = vertexParams.vertexCount();
-
- // Each instance being rendered requires the inputlayout cache to reapply buffers and offsets.
- for (GLsizei i = 0; i < instances; i++)
- {
- ANGLE_TRY(mStateManager.updateVertexOffsetsForPointSpritesEmulation(startVertex, i));
- mDeviceContext->DrawIndexedInstanced(6, elementsToRender, 0, 0, 0);
- }
- mStateManager.invalidateVertexBuffer();
- return gl::NoError();
-}
-
-gl::Error Renderer11::drawArraysIndirect(const gl::Context *context,
- GLenum mode,
- const void *indirect)
-{
- const auto &glState = context->getGLState();
- ASSERT(!glState.isTransformFeedbackActiveUnpaused());
-
- if (!applyPrimitiveType(glState, mode, std::numeric_limits<int>::max() - 1))
- {
- return gl::NoError();
- }
-
- gl::Buffer *drawIndirectBuffer = glState.getTargetBuffer(gl::BufferBinding::DrawIndirect);
- ASSERT(drawIndirectBuffer);
- Buffer11 *storage = GetImplAs<Buffer11>(drawIndirectBuffer);
- uintptr_t offset = reinterpret_cast<uintptr_t>(indirect);
-
- if (!DrawCallNeedsTranslation(context, mode))
- {
- DrawCallVertexParams vertexParams(0, 0, 0);
- ANGLE_TRY(mStateManager.applyVertexBuffer(context, mode, vertexParams, false));
- ID3D11Buffer *buffer = nullptr;
- ANGLE_TRY_RESULT(storage->getBuffer(context, BUFFER_USAGE_INDIRECT), buffer);
- mDeviceContext->DrawInstancedIndirect(buffer, static_cast<unsigned int>(offset));
- return gl::NoError();
- }
-
- const uint8_t *bufferData = nullptr;
- ANGLE_TRY(storage->getData(context, &bufferData));
- ASSERT(bufferData);
- const gl::DrawArraysIndirectCommand *args =
- reinterpret_cast<const gl::DrawArraysIndirectCommand *>(bufferData + offset);
- GLuint count = args->count;
- GLuint instances = args->instanceCount;
- GLuint first = args->first;
-
- DrawCallVertexParams vertexParams(first, count, instances);
- ANGLE_TRY(mStateManager.applyVertexBuffer(context, mode, vertexParams, false));
-
- if (mode == GL_LINE_LOOP)
- {
- return drawLineLoop(context, count, GL_NONE, nullptr, 0, instances);
- }
- if (mode == GL_TRIANGLE_FAN)
- {
- return drawTriangleFan(context, count, GL_NONE, nullptr, 0, instances);
- }
-
- mDeviceContext->DrawInstanced(count, instances, 0, 0);
- return gl::NoError();
-}
-
-gl::Error Renderer11::drawElementsIndirect(const gl::Context *context,
- GLenum mode,
- GLenum type,
- const void *indirect)
-{
- const auto &glState = context->getGLState();
- ASSERT(!glState.isTransformFeedbackActiveUnpaused());
-
- if (!applyPrimitiveType(glState, mode, std::numeric_limits<int>::max() - 1))
- {
- return gl::NoError();
- }
-
- gl::Buffer *drawIndirectBuffer = glState.getTargetBuffer(gl::BufferBinding::DrawIndirect);
- ASSERT(drawIndirectBuffer);
- Buffer11 *storage = GetImplAs<Buffer11>(drawIndirectBuffer);
- uintptr_t offset = reinterpret_cast<uintptr_t>(indirect);
-
- // TODO(jmadill): Remove the if statement and compute indirect parameters lazily.
- bool usePrimitiveRestartWorkaround =
- UsePrimitiveRestartWorkaround(glState.isPrimitiveRestartEnabled(), type);
-
- if (!DrawCallNeedsTranslation(context, mode) && !IsStreamingIndexData(context, type))
- {
- ANGLE_TRY(mStateManager.applyIndexBuffer(context, nullptr, 0, type, gl::HasIndexRange(),
- usePrimitiveRestartWorkaround));
- DrawCallVertexParams vertexParams(0, 0, 0);
- ANGLE_TRY(mStateManager.applyVertexBuffer(context, mode, vertexParams, true));
- ID3D11Buffer *buffer = nullptr;
- ANGLE_TRY_RESULT(storage->getBuffer(context, BUFFER_USAGE_INDIRECT), buffer);
- mDeviceContext->DrawIndexedInstancedIndirect(buffer, static_cast<unsigned int>(offset));
- return gl::NoError();
- }
-
- const uint8_t *bufferData = nullptr;
- ANGLE_TRY(storage->getData(context, &bufferData));
- ASSERT(bufferData);
-
- const gl::DrawElementsIndirectCommand *cmd =
- reinterpret_cast<const gl::DrawElementsIndirectCommand *>(bufferData + offset);
- GLsizei count = cmd->count;
- GLuint instances = cmd->primCount;
- GLuint firstIndex = cmd->firstIndex;
- GLint baseVertex = cmd->baseVertex;
-
- // TODO(jmadill): Fix const cast.
- const gl::Type &typeInfo = gl::GetTypeInfo(type);
- const void *indices =
- reinterpret_cast<const void *>(static_cast<uintptr_t>(firstIndex * typeInfo.bytes));
- gl::HasIndexRange lazyIndexRange(const_cast<gl::Context *>(context), count, type, indices);
-
- ANGLE_TRY(mStateManager.applyIndexBuffer(context, indices, count, type, lazyIndexRange,
- usePrimitiveRestartWorkaround));
-
- DrawCallVertexParams vertexParams(false, lazyIndexRange, baseVertex, instances);
-
- ANGLE_TRY(mStateManager.applyVertexBuffer(context, mode, vertexParams, true));
-
- int baseVertexLocation = -static_cast<int>(lazyIndexRange.getIndexRange().value().start);
-
- if (mode == GL_LINE_LOOP)
- {
- return drawLineLoop(context, count, type, indices, baseVertexLocation, instances);
- }
-
- if (mode == GL_TRIANGLE_FAN)
- {
- return drawTriangleFan(context, count, type, indices, baseVertexLocation, instances);
- }
-
- mDeviceContext->DrawIndexedInstanced(count, instances, 0, baseVertexLocation, 0);
- return gl::NoError();
-}
-
-gl::Error Renderer11::drawLineLoop(const gl::Context *context,
- GLsizei count,
- GLenum type,
- const void *indexPointer,
- int baseVertex,
- int instances)
-{
- const gl::State &glState = context->getGLState();
- gl::VertexArray *vao = glState.getVertexArray();
- gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get();
-
- const void *indices = indexPointer;
-
- // Get the raw indices for an indexed draw
- if (type != GL_NONE && 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);
- gl::Error error =
- mLineLoopIB->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
- if (error.isError())
- {
- SafeDelete(mLineLoopIB);
- return error;
- }
- }
-
- // Checked by Renderer11::applyPrimitiveType
- ASSERT(count >= 0);
-
- if (static_cast<unsigned int>(count) + 1 >
- (std::numeric_limits<unsigned int>::max() / sizeof(unsigned int)))
- {
- return gl::OutOfMemory() << "Failed to create a 32-bit looping index buffer for "
- "GL_LINE_LOOP, too many indices required.";
- }
-
- 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(spaceNeeded, GL_UNSIGNED_INT));
-
- void *mappedMemory = nullptr;
- unsigned int offset;
- ANGLE_TRY(mLineLoopIB->mapBuffer(spaceNeeded, &mappedMemory, &offset));
-
- // Copy over the converted index data.
- memcpy(mappedMemory, &mScratchIndexDataBuffer[0],
- sizeof(GLuint) * mScratchIndexDataBuffer.size());
-
- ANGLE_TRY(mLineLoopIB->unmapBuffer());
-
- 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 gl::NoError();
-}
-
-gl::Error Renderer11::drawTriangleFan(const gl::Context *context,
- GLsizei count,
- GLenum type,
- const void *indices,
- int baseVertex,
- int instances)
-{
- const gl::State &glState = context->getGLState();
- gl::VertexArray *vao = glState.getVertexArray();
- gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get();
-
- const void *indexPointer = indices;
-
- // Get the raw indices for an indexed draw
- if (type != GL_NONE && 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);
- gl::Error error =
- mTriangleFanIB->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
- if (error.isError())
- {
- SafeDelete(mTriangleFanIB);
- return error;
- }
- }
-
- // Checked by Renderer11::applyPrimitiveType
- ASSERT(count >= 3);
-
- const GLuint numTris = count - 2;
-
- if (numTris > (std::numeric_limits<unsigned int>::max() / (sizeof(unsigned int) * 3)))
- {
- return gl::OutOfMemory() << "Failed to create a scratch index buffer for GL_TRIANGLE_FAN, "
- "too many indices required.";
- }
-
- GetTriFanIndices(indexPointer, type, count, glState.isPrimitiveRestartEnabled(),
- &mScratchIndexDataBuffer);
-
- const unsigned int spaceNeeded =
- static_cast<unsigned int>(mScratchIndexDataBuffer.size() * sizeof(unsigned int));
- ANGLE_TRY(mTriangleFanIB->reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT));
-
- void *mappedMemory = nullptr;
- unsigned int offset;
- ANGLE_TRY(mTriangleFanIB->mapBuffer(spaceNeeded, &mappedMemory, &offset));
-
- memcpy(mappedMemory, &mScratchIndexDataBuffer[0], spaceNeeded);
-
- ANGLE_TRY(mTriangleFanIB->unmapBuffer());
-
- 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 gl::NoError();
-}
-
-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()
-{
- RendererD3D::cleanup();
-
- mScratchMemoryBuffer.clear();
-
- if (mAnnotator != nullptr)
- {
- gl::UninitializeDebugAnnotations();
- SafeDelete(mAnnotator);
- }
-
- releaseDeviceResources();
-
- if (!mCreatedWithDeviceEXT)
- {
- // Only delete the device if the Renderer11 owns it
- // Otherwise we should keep it around in case we try to reinitialize the renderer later
- SafeDelete(mEGLDevice);
- }
-
- 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);
-}
-
-unsigned int Renderer11::getReservedVertexUniformBuffers() const
-{
- // we reserve one buffer for the application uniforms, and one for driver uniforms
- return 2;
-}
-
-unsigned int Renderer11::getReservedFragmentUniformBuffers() const
-{
- // we reserve one buffer for the application uniforms, and one for driver uniforms
- return 2;
-}
-
-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;
- }
-
- // Qt: we don't care about the 9_3 limitation
-#if 0
- // 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;
- }
-#endif
-
- // 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;
-}
-
-bool Renderer11::getNV12TextureSupport() const
-{
- HRESULT result;
- UINT formatSupport;
- result = mDevice->CheckFormatSupport(DXGI_FORMAT_NV12, &formatSupport);
- if (result == E_FAIL)
- {
- return false;
- }
- return (formatSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D) != 0;
-}
-
-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 "";
- }
-}
-
-const angle::WorkaroundsD3D &RendererD3D::getWorkarounds() const
-{
- if (!mWorkaroundsInitialized)
- {
- mWorkarounds = generateWorkarounds();
- mWorkaroundsInitialized = true;
- }
-
- return mWorkarounds;
-}
-
-gl::Error 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->getReadColorbuffer();
- ASSERT(colorAttachment);
-
- RenderTarget11 *sourceRenderTarget = nullptr;
- ANGLE_TRY(colorAttachment->getRenderTarget(context, &sourceRenderTarget));
- ASSERT(sourceRenderTarget);
-
- const d3d11::SharedSRV &source = sourceRenderTarget->getBlitShaderResourceView();
- ASSERT(source.valid());
-
- 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;
- ANGLE_TRY(mBlit->copyTexture(context, source, sourceArea, sourceSize, sourceFormat, dest,
- destArea, destSize, nullptr, gl::GetUnsizedFormat(destFormat),
- GL_NEAREST, false, false, false));
-
- return gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error Renderer11::copyImageCube(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum target,
- GLint level)
-{
- TextureStorage11_Cube *storage11 = GetAs<TextureStorage11_Cube>(storage);
- ASSERT(storage11);
-
- gl::ImageIndex index = gl::ImageIndex::MakeCube(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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error Renderer11::copyTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum destTarget,
- GLint destLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha)
-{
- TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
-
- TextureStorage *sourceStorage = nullptr;
- ANGLE_TRY(sourceD3D->getNativeTexture(context, &sourceStorage));
-
- TextureStorage11_2D *sourceStorage11 = GetAs<TextureStorage11_2D>(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(GL_TEXTURE_2D, sourceLevel).info->format == destFormat &&
- sourceStorage11->getFormatSet().texFormat == destStorage11->getFormatSet().texFormat)
- {
- const TextureHelper11 *sourceResource = nullptr;
- ANGLE_TRY(sourceStorage11->getResource(context, &sourceResource));
-
- gl::ImageIndex sourceIndex = gl::ImageIndex::Make2D(sourceLevel);
- UINT sourceSubresource = sourceStorage11->getSubresourceIndex(sourceIndex);
-
- const TextureHelper11 *destResource = nullptr;
- ANGLE_TRY(destStorage11->getResource(context, &destResource));
-
- gl::ImageIndex destIndex = gl::ImageIndex::MakeGeneric(destTarget, destLevel);
- UINT destSubresource = destStorage11->getSubresourceIndex(destIndex);
-
- D3D11_BOX sourceBox{
- static_cast<UINT>(sourceRect.x),
- static_cast<UINT>(sourceRect.y),
- 0u,
- static_cast<UINT>(sourceRect.x + sourceRect.width),
- static_cast<UINT>(sourceRect.y + sourceRect.height),
- 1u,
- };
-
- mDeviceContext->CopySubresourceRegion(destResource->get(), destSubresource, destOffset.x,
- destOffset.y, destOffset.z, sourceResource->get(),
- sourceSubresource, &sourceBox);
- }
- else
- {
- const d3d11::SharedSRV *sourceSRV = nullptr;
- ANGLE_TRY(sourceStorage11->getSRVLevels(context, sourceLevel, sourceLevel, &sourceSRV));
-
- gl::ImageIndex destIndex = gl::ImageIndex::MakeGeneric(destTarget, destLevel);
- 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(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
- gl::Extents sourceSize(
- static_cast<int>(source->getWidth(source->getTarget(), sourceLevel)),
- static_cast<int>(source->getHeight(source->getTarget(), sourceLevel)), 1);
- if (unpackFlipY)
- {
- sourceArea.y += sourceArea.height;
- sourceArea.height = -sourceArea.height;
- }
-
- gl::Box destArea(destOffset.x, destOffset.y, 0, sourceRect.width, sourceRect.height, 1);
- gl::Extents destSize(destRenderTarget11->getWidth(), destRenderTarget11->getHeight(), 1);
-
- // Use nearest filtering because source and destination are the same size for the direct
- // copy
- GLenum sourceFormat = source->getFormat(GL_TEXTURE_2D, sourceLevel).info->format;
- ANGLE_TRY(mBlit->copyTexture(context, *sourceSRV, sourceArea, sourceSize, sourceFormat,
- destRTV, destArea, destSize, nullptr, destFormat, GL_NEAREST,
- false, unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
- }
-
- destStorage11->markLevelDirty(destLevel);
-
- return gl::NoError();
-}
-
-gl::Error 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 = destStorage11->getSubresourceIndex(destIndex);
-
- 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 = sourceStorage11->getSubresourceIndex(sourceIndex);
-
- mDeviceContext->CopySubresourceRegion(destResource->get(), destSubresource, 0, 0, 0,
- sourceResource->get(), sourceSubresource, nullptr);
-
- return gl::NoError();
-}
-
-gl::Error Renderer11::createRenderTarget(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);
-
- 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(desc, formatInfo, &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(srvDesc, texture.get(), &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(blitSRVDesc, texture.get(), &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(dsvDesc, texture.get(), &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(rtvDesc, texture.get(), &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 gl::NoError();
-}
-
-gl::Error Renderer11::createRenderTargetCopy(RenderTargetD3D *source, RenderTargetD3D **outRT)
-{
- ASSERT(source != nullptr);
-
- RenderTargetD3D *newRT = nullptr;
- ANGLE_TRY(createRenderTarget(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 gl::NoError();
-}
-
-gl::Error Renderer11::loadExecutable(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::SHADER_VERTEX:
- {
- d3d11::VertexShader vertexShader;
- d3d11::GeometryShader streamOutShader;
- ANGLE_TRY(allocateResource(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(shaderData, &soDeclaration, &streamOutShader));
- }
-
- *outExecutable = new ShaderExecutable11(function, length, std::move(vertexShader),
- std::move(streamOutShader));
- }
- break;
- case gl::SHADER_FRAGMENT:
- {
- d3d11::PixelShader pixelShader;
- ANGLE_TRY(allocateResource(shaderData, &pixelShader));
- *outExecutable = new ShaderExecutable11(function, length, std::move(pixelShader));
- }
- break;
- case gl::SHADER_GEOMETRY:
- {
- d3d11::GeometryShader geometryShader;
- ANGLE_TRY(allocateResource(shaderData, &geometryShader));
- *outExecutable = new ShaderExecutable11(function, length, std::move(geometryShader));
- }
- break;
- case gl::SHADER_COMPUTE:
- {
- d3d11::ComputeShader computeShader;
- ANGLE_TRY(allocateResource(shaderData, &computeShader));
- *outExecutable = new ShaderExecutable11(function, length, std::move(computeShader));
- }
- break;
- default:
- UNREACHABLE();
- return gl::InternalError();
- }
-
- return gl::NoError();
-}
-
-gl::Error Renderer11::compileToExecutable(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::SHADER_VERTEX:
- profileStream << "vs";
- break;
- case gl::SHADER_FRAGMENT:
- profileStream << "ps";
- break;
- case gl::SHADER_GEOMETRY:
- profileStream << "gs";
- break;
- case gl::SHADER_COMPUTE:
- profileStream << "cs";
- break;
- default:
- UNREACHABLE();
- return gl::InternalError();
- }
-
- 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(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 gl::NoError();
- }
-
- gl::Error error = loadExecutable(reinterpret_cast<const uint8_t *>(binary->GetBufferPointer()),
- binary->GetBufferSize(), type, streamOutVaryings,
- separatedOutputBuffers, outExectuable);
-
- SafeRelease(binary);
- if (error.isError())
- {
- return error;
- }
-
- if (!debugInfo.empty())
- {
- (*outExectuable)->appendDebugInfo(debugInfo);
- }
-
- return gl::NoError();
-}
-
-gl::Error Renderer11::ensureHLSLCompilerInitialized()
-{
- return mCompiler.ensureInitialized();
-}
-
-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::createStreamProducerD3DTextureNV12(
- egl::Stream::ConsumerType consumerType,
- const egl::AttributeMap &attribs)
-{
- return new StreamProducerNV12(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;
-}
-
-gl::Error 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);
-}
-
-gl::Error 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);
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error Renderer11::copyImage(const gl::Context *context,
- ImageD3D *dest,
- ImageD3D *source,
- const gl::Rectangle &sourceRect,
- 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, sourceRect, 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);
-}
-
-gl::Error 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;
- if (invertTexture)
- {
- actualArea.y = texSize.height - actualArea.y - actualArea.height;
- }
-
- // 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 gl::NoError();
- }
-
- gl::Extents safeSize(safeArea.width, safeArea.height, 1);
- TextureHelper11 stagingHelper;
- ANGLE_TRY_RESULT(
- createStagingTexture(textureHelper.getTextureType(), textureHelper.getFormatSet(), safeSize,
- StagingAccess::READ),
- 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(resolveDesc, textureHelper.getFormatSet(), &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);
-
- gl::Buffer *packBuffer = context->getGLState().getTargetBuffer(gl::BufferBinding::PixelPack);
- if (!invertTexture)
- {
- PackPixelsParams packParams(safeArea, format, type, outputPitch, pack, packBuffer, 0);
- return packPixels(stagingHelper, packParams, pixelsOut);
- }
-
- // Create a new PixelPackState with reversed row order. Note that we can't just assign
- // 'invertTexturePack' to be 'pack' (or memcpy) since that breaks the ref counting/object
- // tracking in the 'pixelBuffer' members, causing leaks. Instead we must use
- // pixelBuffer.set() twice, which performs the addRef/release correctly
- gl::PixelPackState invertTexturePack;
- invertTexturePack.alignment = pack.alignment;
- invertTexturePack.reverseRowOrder = !pack.reverseRowOrder;
-
- PackPixelsParams packParams(safeArea, format, type, outputPitch, invertTexturePack, packBuffer,
- 0);
- gl::Error error = packPixels(stagingHelper, packParams, pixelsOut);
- ANGLE_TRY(error);
- return gl::NoError();
-}
-
-gl::Error Renderer11::packPixels(const TextureHelper11 &textureHelper,
- const PackPixelsParams &params,
- uint8_t *pixelsOut)
-{
- ID3D11Resource *readResource = textureHelper.get();
-
- D3D11_MAPPED_SUBRESOURCE mapping;
- HRESULT hr = mDeviceContext->Map(readResource, 0, D3D11_MAP_READ, 0, &mapping);
- if (FAILED(hr))
- {
- ASSERT(hr == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to map internal texture for reading, " << gl::FmtHR(hr);
- }
-
- 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 gl::NoError();
-}
-
-gl::Error 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);
- if (!drawRenderTarget11)
- {
- return gl::OutOfMemory()
- << "Failed to retrieve the internal draw render target from the draw framebuffer.";
- }
-
- const TextureHelper11 &drawTexture = drawRenderTarget11->getTexture();
- unsigned int drawSubresource = drawRenderTarget11->getSubresourceIndex();
-
- RenderTarget11 *readRenderTarget11 = GetAs<RenderTarget11>(readRenderTarget);
- if (!readRenderTarget11)
- {
- return gl::OutOfMemory()
- << "Failed to retrieve the internal read render target from the read framebuffer.";
- }
-
- TextureHelper11 readTexture;
- unsigned int readSubresource = 0;
- d3d11::SharedSRV readSRV;
-
- if (readRenderTarget->isMultisampled())
- {
- ANGLE_TRY_RESULT(
- 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(viewDesc, readTexture.get(), &readSRV));
- }
- }
- else
- {
- ASSERT(readRenderTarget11);
- readTexture = readRenderTarget11->getTexture();
- readSubresource = readRenderTarget11->getSubresourceIndex();
- readSRV = readRenderTarget11->getBlitShaderResourceView().makeCopy();
- if (!readSRV.valid())
- {
- ASSERT(depthBlit || stencilBlit);
- readSRV = readRenderTarget11->getShaderResourceView().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.
- gl::Rectangle readRect = readRectIn;
- gl::Rectangle drawRect = drawRectIn;
-
- auto flip = [](int val) { return val >= 0 ? 1 : -1; };
-
- if (readRect.x > readSize.width && readRect.width < 0)
- {
- int delta = readRect.x - readSize.width;
- readRect.x -= delta;
- readRect.width += delta;
-
- int drawDelta = delta * flip(drawRect.width);
- drawRect.x += drawDelta;
- drawRect.width -= drawDelta;
- }
-
- if (readRect.y > readSize.height && readRect.height < 0)
- {
- int delta = readRect.y - readSize.height;
- readRect.y -= delta;
- readRect.height += delta;
-
- int drawDelta = delta * flip(drawRect.height);
- drawRect.y += drawDelta;
- drawRect.height -= drawDelta;
- }
-
- auto readToDrawX = [&drawRectIn, &readRectIn](int readOffset) {
- double readToDrawScale =
- static_cast<double>(drawRectIn.width) / static_cast<double>(readRectIn.width);
- return static_cast<int>(round(static_cast<double>(readOffset) * readToDrawScale));
- };
- if (readRect.x < 0)
- {
- int readOffset = -readRect.x;
- readRect.x += readOffset;
- readRect.width -= readOffset;
-
- int drawOffset = readToDrawX(readOffset);
- drawRect.x += drawOffset;
- drawRect.width -= drawOffset;
- }
-
- auto readToDrawY = [&drawRectIn, &readRectIn](int readOffset) {
- double readToDrawScale =
- static_cast<double>(drawRectIn.height) / static_cast<double>(readRectIn.height);
- return static_cast<int>(round(static_cast<double>(readOffset) * readToDrawScale));
- };
- if (readRect.y < 0)
- {
- int readOffset = -readRect.y;
- readRect.y += readOffset;
- readRect.height -= readOffset;
-
- int drawOffset = readToDrawY(readOffset);
- drawRect.y += drawOffset;
- drawRect.height -= drawOffset;
- }
-
- if (readRect.x1() < 0)
- {
- int readOffset = -readRect.x1();
- readRect.width += readOffset;
-
- int drawOffset = readToDrawX(readOffset);
- drawRect.width += drawOffset;
- }
-
- if (readRect.y1() < 0)
- {
- int readOffset = -readRect.y1();
- readRect.height += readOffset;
-
- int drawOffset = readToDrawY(readOffset);
- drawRect.height += drawOffset;
- }
-
- if (readRect.x1() > readSize.width)
- {
- int delta = readRect.x1() - readSize.width;
- readRect.width -= delta;
- drawRect.width -= delta * flip(drawRect.width);
- }
-
- if (readRect.y1() > readSize.height)
- {
- int delta = readRect.y1() - readSize.height;
- readRect.height -= delta;
- drawRect.height -= delta * flip(drawRect.height);
- }
-
- bool scissorNeeded = scissor && gl::ClipRectangle(drawRect, *scissor, nullptr);
-
- 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;
-
- bool flipRequired =
- readRect.width < 0 || readRect.height < 0 || drawRect.width < 0 || drawRect.height < 0;
-
- bool outOfBounds = readRect.x < 0 || readRect.x + readRect.width > readSize.width ||
- readRect.y < 0 || readRect.y + readRect.height > readSize.height ||
- drawRect.x < 0 || drawRect.x + drawRect.width > drawSize.width ||
- drawRect.y < 0 || drawRect.y + drawRect.height > drawSize.height;
-
- bool partialDSBlit =
- (nativeFormat.depthBits > 0 && depthBlit) != (nativeFormat.stencilBits > 0 && stencilBlit);
-
- if (readRenderTarget11->getFormatSet().formatID ==
- drawRenderTarget11->getFormatSet().formatID &&
- !stretchRequired && !outOfBounds && !flipRequired && !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(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, filter, maskOffAlpha, false, false));
- }
- }
-
- return gl::NoError();
-}
-
-bool Renderer11::isES3Capable() const
-{
- return (d3d11_gl::GetMaximumClientVersion(mRenderer11DeviceCaps.featureLevel).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);
-}
-
-gl::ErrorOrResult<TextureHelper11> Renderer11::resolveMultisampledTexture(
- const gl::Context *context,
- RenderTarget11 *renderTarget,
- bool depth,
- bool stencil)
-{
- if (depth && !stencil)
- {
- return mBlit->resolveDepth(context, renderTarget);
- }
-
- if (stencil)
- {
- return mBlit->resolveStencil(context, renderTarget, depth);
- }
-
- const auto &formatSet = renderTarget->getFormatSet();
-
- ASSERT(renderTarget->isMultisampled());
- const d3d11::SharedSRV &sourceSRV = renderTarget->getShaderResourceView();
- D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
- sourceSRV.get()->GetDesc(&sourceSRVDesc);
- ASSERT(sourceSRVDesc.ViewDimension == D3D_SRV_DIMENSION_TEXTURE2DMS);
-
- 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(resolveDesc, formatSet, &mCachedResolveTexture));
- }
-
- mDeviceContext->ResolveSubresource(mCachedResolveTexture.get(), 0,
- renderTarget->getTexture().get(),
- renderTarget->getSubresourceIndex(), formatSet.texFormat);
- return mCachedResolveTexture;
-}
-
-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(
- gl::VertexFormatType vertexFormatType) const
-{
- return d3d11::GetVertexFormatInfo(vertexFormatType, mRenderer11DeviceCaps.featureLevel)
- .conversionType;
-}
-
-GLenum Renderer11::getVertexComponentType(gl::VertexFormatType vertexFormatType) const
-{
- const auto &format =
- d3d11::GetVertexFormatInfo(vertexFormatType, mRenderer11DeviceCaps.featureLevel);
- return d3d11::GetComponentType(format.nativeFormat);
-}
-
-gl::ErrorOrResult<unsigned int> Renderer11::getVertexSpaceRequired(
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLsizei count,
- GLsizei instances) const
-{
- if (!attrib.enabled)
- {
- return 16u;
- }
-
- unsigned int elementCount = 0;
- const unsigned int divisor = binding.getDivisor();
- if (instances == 0 || divisor == 0)
- {
- elementCount = count;
- }
- else
- {
- // Round up to divisor, if possible
- elementCount = UnsignedCeilDivide(static_cast<unsigned int>(instances), divisor);
- }
-
- gl::VertexFormatType formatType = gl::GetVertexFormatType(attrib);
- const D3D_FEATURE_LEVEL featureLevel = mRenderer11DeviceCaps.featureLevel;
- const d3d11::VertexFormat &vertexFormatInfo =
- d3d11::GetVertexFormatInfo(formatType, featureLevel);
- const d3d11::DXGIFormatSize &dxgiFormatInfo =
- d3d11::GetDXGIFormatSizeInfo(vertexFormatInfo.nativeFormat);
- unsigned int elementSize = dxgiFormatInfo.pixelBytes;
- if (elementSize > std::numeric_limits<unsigned int>::max() / elementCount)
- {
- return gl::OutOfMemory() << "New vertex buffer size would result in an overflow.";
- }
-
- return elementSize * elementCount;
-}
-
-void Renderer11::generateCaps(gl::Caps *outCaps,
- gl::TextureCapsMap *outTextureCaps,
- gl::Extensions *outExtensions,
- gl::Limitations *outLimitations) const
-{
- d3d11_gl::GenerateCaps(mDevice, mDeviceContext, mRenderer11DeviceCaps, outCaps, outTextureCaps,
- outExtensions, outLimitations);
-}
-
-angle::WorkaroundsD3D Renderer11::generateWorkarounds() const
-{
- return d3d11::GenerateWorkarounds(mRenderer11DeviceCaps, mAdapterDescription);
-}
-
-egl::Error Renderer11::getEGLDevice(DeviceImpl **device)
-{
- if (mEGLDevice == nullptr)
- {
- ASSERT(mDevice != nullptr);
- mEGLDevice = new DeviceD3D();
- egl::Error error = mEGLDevice->initialize(reinterpret_cast<void *>(mDevice),
- EGL_D3D11_DEVICE_ANGLE, EGL_FALSE);
-
- if (error.isError())
- {
- SafeDelete(mEGLDevice);
- return error;
- }
- }
-
- *device = static_cast<DeviceImpl *>(mEGLDevice);
- return egl::NoError();
-}
-
-ContextImpl *Renderer11::createContext(const gl::ContextState &state)
-{
- return new Context11(state, this);
-}
-
-FramebufferImpl *Renderer11::createDefaultFramebuffer(const gl::FramebufferState &state)
-{
- return new Framebuffer11(state, this);
-}
-
-gl::Error Renderer11::getScratchMemoryBuffer(size_t requestedSize, angle::MemoryBuffer **bufferOut)
-{
- if (!mScratchMemoryBuffer.get(requestedSize, bufferOut))
- {
- return gl::OutOfMemory() << "Failed to allocate internal buffer.";
- }
- return gl::NoError();
-}
-
-gl::Version Renderer11::getMaxSupportedESVersion() const
-{
- return d3d11_gl::GetMaximumClientVersion(mRenderer11DeviceCaps.featureLevel);
-}
-
-gl::DebugAnnotator *Renderer11::getAnnotator()
-{
- return mAnnotator;
-}
-
-gl::Error Renderer11::applyComputeShader(const gl::Context *context)
-{
- ANGLE_TRY(ensureHLSLCompilerInitialized());
-
- const auto &glState = context->getGLState();
- ProgramD3D *programD3D = GetImplAs<ProgramD3D>(glState.getProgram());
-
- ShaderExecutableD3D *computeExe = nullptr;
- ANGLE_TRY(programD3D->getComputeExecutable(&computeExe));
- ASSERT(computeExe != nullptr);
-
- mStateManager.setComputeShader(&GetAs<ShaderExecutable11>(computeExe)->getComputeShader());
- ANGLE_TRY(mStateManager.applyComputeUniforms(programD3D));
-
- return gl::NoError();
-}
-
-gl::Error Renderer11::dispatchCompute(const gl::Context *context,
- GLuint numGroupsX,
- GLuint numGroupsY,
- GLuint numGroupsZ)
-{
- ANGLE_TRY(mStateManager.updateStateForCompute(context, numGroupsX, numGroupsY, numGroupsZ));
- ANGLE_TRY(applyComputeShader(context));
-
- mDeviceContext->Dispatch(numGroupsX, numGroupsY, numGroupsZ);
-
- return gl::NoError();
-}
-
-gl::ErrorOrResult<TextureHelper11> Renderer11::createStagingTexture(
- ResourceType textureType,
- const d3d11::Format &formatSet,
- const gl::Extents &size,
- StagingAccess readAndWriteAccess)
-{
- 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;
- }
-
- TextureHelper11 stagingTex;
- ANGLE_TRY(allocateTexture(stagingDesc, formatSet, &stagingTex));
- return stagingTex;
- }
- 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;
-
- TextureHelper11 stagingTex;
- ANGLE_TRY(allocateTexture(stagingDesc, formatSet, &stagingTex));
- return stagingTex;
-}
-
-gl::Error Renderer11::allocateTexture(const D3D11_TEXTURE2D_DESC &desc,
- const d3d11::Format &format,
- const D3D11_SUBRESOURCE_DATA *initData,
- TextureHelper11 *textureOut)
-{
- d3d11::Texture2D texture;
- ANGLE_TRY(mResourceManager11.allocate(this, &desc, initData, &texture));
- textureOut->init(std::move(texture), desc, format);
- return gl::NoError();
-}
-
-gl::Error Renderer11::allocateTexture(const D3D11_TEXTURE3D_DESC &desc,
- const d3d11::Format &format,
- const D3D11_SUBRESOURCE_DATA *initData,
- TextureHelper11 *textureOut)
-{
- d3d11::Texture3D texture;
- ANGLE_TRY(mResourceManager11.allocate(this, &desc, initData, &texture));
- textureOut->init(std::move(texture), desc, format);
- return gl::NoError();
-}
-
-gl::Error Renderer11::getBlendState(const d3d11::BlendStateKey &key,
- const d3d11::BlendState **outBlendState)
-{
- return mStateCache.getBlendState(this, key, outBlendState);
-}
-
-gl::Error Renderer11::getRasterizerState(const gl::RasterizerState &rasterState,
- bool scissorEnabled,
- ID3D11RasterizerState **outRasterizerState)
-{
- return mStateCache.getRasterizerState(this, rasterState, scissorEnabled, outRasterizerState);
-}
-
-gl::Error Renderer11::getDepthStencilState(const gl::DepthStencilState &dsState,
- const d3d11::DepthStencilState **outDSState)
-{
- return mStateCache.getDepthStencilState(this, dsState, outDSState);
-}
-
-gl::Error Renderer11::getSamplerState(const gl::SamplerState &samplerState,
- ID3D11SamplerState **outSamplerState)
-{
- return mStateCache.getSamplerState(this, samplerState, outSamplerState);
-}
-
-gl::Error Renderer11::clearRenderTarget(RenderTargetD3D *renderTarget,
- const gl::ColorF &clearColorValue,
- const float clearDepthValue,
- const unsigned int clearStencilValue)
-{
- RenderTarget11 *rt11 = GetAs<RenderTarget11>(renderTarget);
-
- if (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 gl::NoError();
- }
-
- 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 gl::NoError();
-}
-
-bool Renderer11::canSelectViewInVertexShader() const
-{
- return !getWorkarounds().selectViewInGeometryShader &&
- getRenderer11DeviceCaps().supportsVpRtIndexWriteFromVertexShader;
-}
-
-gl::Error Renderer11::markTransformFeedbackUsage(const gl::Context *context)
-{
- const gl::State &glState = context->getGLState();
- 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 gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
deleted file mode 100644
index a8c24e681b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
+++ /dev/null
@@ -1,576 +0,0 @@
-//
-// 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;
-struct ImageIndex;
-}
-
-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
- 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::ContextState &state) override;
-
- gl::Error flush();
- gl::Error finish();
-
- 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,
- GLenum *fboFormat) const override;
- egl::Error validateShareHandle(const egl::Config *config,
- HANDLE shareHandle,
- const egl::AttributeMap &attribs) const override;
-
- bool applyPrimitiveType(const gl::State &glState, GLenum mode, GLsizei count);
-
- // lost device
- bool testDeviceLost() override;
- bool testDeviceResettable() override;
-
- std::string getRendererDescription() const;
- DeviceIdentifier getAdapterIdentifier() const override;
-
- unsigned int getReservedVertexUniformVectors() const;
- unsigned int getReservedFragmentUniformVectors() const;
- unsigned int getReservedVertexUniformBuffers() const;
- unsigned int getReservedFragmentUniformBuffers() const;
-
- bool getShareHandleSupport() const;
-
- bool getNV12TextureSupport() const;
-
- int getMajorShaderModel() const override;
- int getMinorShaderModel() const override;
- std::string getShaderModelSuffix() const override;
-
- // Pixel operations
- gl::Error copyImage2D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) override;
- gl::Error copyImageCube(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum target,
- GLint level) override;
- gl::Error copyImage3D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) override;
- gl::Error copyImage2DArray(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) override;
-
- gl::Error copyTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum destTarget,
- GLint destLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha) override;
- gl::Error copyCompressedTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel) override;
-
- // RenderTarget creation
- gl::Error createRenderTarget(int width,
- int height,
- GLenum format,
- GLsizei samples,
- RenderTargetD3D **outRT) override;
- gl::Error createRenderTargetCopy(RenderTargetD3D *source, RenderTargetD3D **outRT) override;
-
- // Shader operations
- gl::Error loadExecutable(const uint8_t *function,
- size_t length,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- ShaderExecutableD3D **outExecutable) override;
- gl::Error compileToExecutable(gl::InfoLog &infoLog,
- const std::string &shaderHLSL,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- const angle::CompilerWorkaroundsD3D &workarounds,
- ShaderExecutableD3D **outExectuable) override;
- gl::Error ensureHLSLCompilerInitialized() override;
-
- UniformStorageD3D *createUniformStorage(size_t storageSize) override;
-
- // Image operations
- ImageD3D *createImage() override;
- gl::Error generateMipmap(const gl::Context *context, ImageD3D *dest, ImageD3D *source) override;
- gl::Error generateMipmapUsingD3D(const gl::Context *context,
- TextureStorage *storage,
- const gl::TextureState &textureState) override;
- gl::Error copyImage(const gl::Context *context,
- ImageD3D *dest,
- ImageD3D *source,
- const gl::Rectangle &sourceRect,
- 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;
-
- VertexBuffer *createVertexBuffer() override;
- IndexBuffer *createIndexBuffer() override;
-
- // Stream Creation
- StreamProducerImpl *createStreamProducerD3DTextureNV12(
- 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; };
-
- gl::Error getBlendState(const d3d11::BlendStateKey &key,
- const d3d11::BlendState **outBlendState);
- gl::Error getRasterizerState(const gl::RasterizerState &rasterState,
- bool scissorEnabled,
- ID3D11RasterizerState **outRasterizerState);
- gl::Error getDepthStencilState(const gl::DepthStencilState &dsState,
- const d3d11::DepthStencilState **outDSState);
- gl::Error getSamplerState(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;
- gl::Error fastCopyBufferToTexture(const gl::Context *context,
- const gl::PixelUnpackState &unpack,
- unsigned int offset,
- RenderTargetD3D *destRenderTarget,
- GLenum destinationFormat,
- GLenum sourcePixelsType,
- const gl::Box &destArea) override;
-
- gl::Error packPixels(const TextureHelper11 &textureHelper,
- const PackPixelsParams &params,
- uint8_t *pixelsOut);
-
- bool getLUID(LUID *adapterLuid) const override;
- VertexConversionType getVertexConversionType(
- gl::VertexFormatType vertexFormatType) const override;
- GLenum getVertexComponentType(gl::VertexFormatType vertexFormatType) const override;
-
- // Warning: you should ensure binding really matches attrib.bindingIndex before using this
- // function.
- gl::ErrorOrResult<unsigned int> getVertexSpaceRequired(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLsizei count,
- GLsizei instances) const override;
-
- gl::Error 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);
-
- gl::Error 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);
-
- egl::Error getEGLDevice(DeviceImpl **device) override;
-
- gl::Error drawArrays(const gl::Context *context,
- GLenum mode,
- GLint startVertex,
- GLsizei count,
- GLsizei instances);
-
- gl::Error drawElements(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances);
-
- gl::Error drawArraysIndirect(const gl::Context *context, GLenum mode, const void *indirect);
- gl::Error drawElementsIndirect(const gl::Context *context,
- GLenum mode,
- GLenum type,
- const void *indirect);
-
- // Necessary hack for default framebuffers in D3D.
- FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) override;
-
- gl::Error getScratchMemoryBuffer(size_t requestedSize, angle::MemoryBuffer **bufferOut);
-
- gl::Version getMaxSupportedESVersion() const override;
-
- gl::Error dispatchCompute(const gl::Context *context,
- GLuint numGroupsX,
- GLuint numGroupsY,
- GLuint numGroupsZ);
- gl::Error applyComputeShader(const gl::Context *context);
-
- gl::ErrorOrResult<TextureHelper11> createStagingTexture(ResourceType textureType,
- const d3d11::Format &formatSet,
- const gl::Extents &size,
- StagingAccess readAndWriteAccess);
-
- template <typename DescT, typename ResourceT>
- gl::Error allocateResource(const DescT &desc, ResourceT *resourceOut)
- {
- return mResourceManager11.allocate(this, &desc, nullptr, resourceOut);
- }
-
- template <typename DescT, typename InitDataT, typename ResourceT>
- gl::Error allocateResource(const DescT &desc, InitDataT *initData, ResourceT *resourceOut)
- {
- return mResourceManager11.allocate(this, &desc, initData, resourceOut);
- }
-
- template <typename InitDataT, typename ResourceT>
- gl::Error allocateResourceNoDesc(InitDataT *initData, ResourceT *resourceOut)
- {
- return mResourceManager11.allocate(this, nullptr, initData, resourceOut);
- }
-
- template <typename DescT>
- gl::Error allocateTexture(const DescT &desc,
- const d3d11::Format &format,
- TextureHelper11 *textureOut)
- {
- return allocateTexture(desc, format, nullptr, textureOut);
- }
-
- gl::Error allocateTexture(const D3D11_TEXTURE2D_DESC &desc,
- const d3d11::Format &format,
- const D3D11_SUBRESOURCE_DATA *initData,
- TextureHelper11 *textureOut);
-
- gl::Error allocateTexture(const D3D11_TEXTURE3D_DESC &desc,
- const d3d11::Format &format,
- const D3D11_SUBRESOURCE_DATA *initData,
- TextureHelper11 *textureOut);
-
- gl::Error clearRenderTarget(RenderTargetD3D *renderTarget,
- const gl::ColorF &clearColorValue,
- const float clearDepthValue,
- const unsigned int clearStencilValue) override;
-
- bool canSelectViewInVertexShader() const override;
-
- private:
- void generateCaps(gl::Caps *outCaps,
- gl::TextureCapsMap *outTextureCaps,
- gl::Extensions *outExtensions,
- gl::Limitations *outLimitations) const override;
-
- angle::WorkaroundsD3D generateWorkarounds() const override;
-
- gl::Error drawLineLoop(const gl::Context *context,
- GLsizei count,
- GLenum type,
- const void *indices,
- int baseVertex,
- int instances);
- gl::Error drawTriangleFan(const gl::Context *context,
- GLsizei count,
- GLenum type,
- const void *indices,
- int baseVertex,
- int instances);
-
- gl::ErrorOrResult<TextureHelper11> resolveMultisampledTexture(const gl::Context *context,
- RenderTarget11 *renderTarget,
- bool depth,
- bool stencil);
-
- void populateRenderer11DeviceCaps();
-
- void updateHistograms();
-
- gl::Error 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;
-
- gl::Error markTransformFeedbackUsage(const gl::Context *context);
-
- HMODULE mD3d11Module;
- HMODULE mDxgiModule;
- HMODULE mDCompModule;
- std::vector<D3D_FEATURE_LEVEL> mAvailableFeatureLevels;
- D3D_DRIVER_TYPE mRequestedDriverType;
- bool mCreateDebugDevice;
- bool mCreatedWithDeviceEXT;
- DeviceD3D *mEGLDevice;
-
- 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;
-
- gl::DebugAnnotator *mAnnotator;
-
- mutable Optional<bool> mSupportsShareHandles;
- ResourceManager11 mResourceManager11;
-
- TextureHelper11 mCachedResolveTexture;
-};
-
-} // namespace rx
-#endif // LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.cpp
deleted file mode 100644
index c228380a34..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.cpp
+++ /dev/null
@@ -1,533 +0,0 @@
-//
-// 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;
-
-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)
-{
- 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_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>
-gl::Error ClearResource(Renderer11 *renderer, const DescT *desc, ResourceT *texture)
-{
- // No-op.
- return gl::NoError();
-}
-
-template <>
-gl::Error ClearResource(Renderer11 *renderer,
- const D3D11_TEXTURE2D_DESC *desc,
- ID3D11Texture2D *texture)
-{
- ID3D11DeviceContext *context = 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(dsvDesc, texture, &dsv));
-
- context->ClearDepthStencilView(dsv.get(), clearFlags, kDebugDepthInitValue,
- kDebugStencilInitValue);
- }
- }
- else
- {
- ASSERT((desc->BindFlags & D3D11_BIND_RENDER_TARGET) != 0);
- d3d11::RenderTargetView rtv;
- ANGLE_TRY(renderer->allocateResourceNoDesc(texture, &rtv));
-
- context->ClearRenderTargetView(rtv.get(), kDebugColorInitClearValue);
- }
-
- return gl::NoError();
-}
-
-template <>
-gl::Error ClearResource(Renderer11 *renderer,
- const D3D11_TEXTURE3D_DESC *desc,
- ID3D11Texture3D *texture)
-{
- ID3D11DeviceContext *context = 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(texture, &rtv));
-
- context->ClearRenderTargetView(rtv.get(), kDebugColorInitClearValue);
- return gl::NoError();
-}
-
-#define ANGLE_RESOURCE_STRINGIFY_OP(NAME, RESTYPE, D3D11TYPE, DESCTYPE, INITDATATYPE) #RESTYPE,
-
-constexpr std::array<const char *, NumResourceTypes> kResourceTypeNames = {
- {ANGLE_RESOURCE_TYPE_OP(Stringify, ANGLE_RESOURCE_STRINGIFY_OP)}};
-static_assert(kResourceTypeNames[NumResourceTypes - 1] != nullptr,
- "All members must be initialized.");
-
-} // anonymous namespace
-
-// ResourceManager11 Implementation.
-ResourceManager11::ResourceManager11()
- : mInitializeAllocations(false),
- mAllocatedResourceCounts({{}}),
- mAllocatedResourceDeviceMemory({{}})
-{
-}
-
-ResourceManager11::~ResourceManager11()
-{
- for (size_t count : mAllocatedResourceCounts)
- {
- ASSERT(count == 0);
- }
-
- for (uint64_t memorySize : mAllocatedResourceDeviceMemory)
- {
- ASSERT(memorySize == 0);
- }
-}
-
-template <typename T>
-gl::Error ResourceManager11::allocate(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);
- if (FAILED(hr))
- {
- ASSERT(!resource);
- if (d3d11::isDeviceLostError(hr))
- {
- renderer->notifyDeviceLost();
- }
- return gl::OutOfMemory() << "Error allocating "
- << std::string(kResourceTypeNames[ResourceTypeIndex<T>()]) << ". "
- << gl::FmtHR(hr);
- }
-
- if (!shadowInitData && mInitializeAllocations)
- {
- ANGLE_TRY(ClearResource(renderer, desc, resource));
- }
-
- ASSERT(resource);
- incrResource(GetResourceTypeFromD3D11<T>(), ComputeMemoryUsage(desc));
- *resourceOut = std::move(Resource11<T>(resource, this));
- return gl::NoError();
-}
-
-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 \
-gl::Error \
- ResourceManager11::allocate(Renderer11 *, const DESCTYPE *, INITDATATYPE *, \
- Resource11<D3D11TYPE> *);
-
-ANGLE_RESOURCE_TYPE_OP(Instantitate, ANGLE_INSTANTIATE_OP)
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.h
deleted file mode 100644
index 0bdde9f8b6..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.h
+++ /dev/null
@@ -1,366 +0,0 @@
-//
-// 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 <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
-
-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, 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>
- gl::Error allocate(Renderer11 *renderer,
- const GetDescFromD3D11<T> *desc,
- GetInitDataFromD3D11<T> *initData,
- Resource11<T> *resourceOut);
-
- template <typename T>
- gl::Error allocate(Renderer11 *renderer,
- const GetDescFromD3D11<T> *desc,
- GetInitDataFromD3D11<T> *initData,
- SharedResource11<T> *sharedRes)
- {
- Resource11<T> res;
- ANGLE_TRY(allocate(renderer, desc, initData, &res));
- *sharedRes = std::move(res);
- return gl::NoError();
- }
-
- 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<size_t, NumResourceTypes> mAllocatedResourceCounts;
- std::array<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>;
-} // namespace d3d11
-
-#undef ANGLE_RESOURCE_TYPE_CLASS
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_RESOURCEFACTORY11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp
deleted file mode 100644
index 73a530add0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-//
-// 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/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()
-{
-}
-
-gl::Error UniformStorage11::getConstantBuffer(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(desc, &mConstantBuffer));
- }
-
- *bufferOut = &mConstantBuffer;
- return gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h
deleted file mode 100644
index 3f417578a3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// 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;
-
- gl::Error getConstantBuffer(Renderer11 *renderer, const d3d11::Buffer **bufferOut);
-
- private:
- d3d11::Buffer mConstantBuffer;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_SHADEREXECUTABLE11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
deleted file mode 100644
index e9902d3f14..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
+++ /dev/null
@@ -1,3075 +0,0 @@
-//
-// 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/bitset_utils.h"
-#include "common/utilities.h"
-#include "libANGLE/Context.h"
-#include "libANGLE/Query.h"
-#include "libANGLE/VertexArray.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"
-
-namespace rx
-{
-
-namespace
-{
-bool ImageIndexConflictsWithSRV(const gl::ImageIndex &index, D3D11_SHADER_RESOURCE_VIEW_DESC desc)
-{
- unsigned mipLevel = index.mipIndex;
- GLint layerIndex = index.layerIndex;
- GLenum type = index.type;
-
- 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.mipIndex;
- unsigned mipMax = (layerIndex == -1) ? INT_MAX : layerIndex;
-
- return type == GL_TEXTURE_2D &&
- gl::RangeUI(mipMin, mipMax)
- .intersects(gl::RangeUI(desc.Texture2D.MostDetailedMip, maxSrvMip));
- }
-
- case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
- {
- 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 (type == GL_TEXTURE_2D_ARRAY || gl::IsCubeMapTextureTarget(type)) &&
- 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 gl::IsCubeMapTextureTarget(type) &&
- 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 type == GL_TEXTURE_3D && desc.Texture3D.MostDetailedMip <= mipLevel &&
- mipLevel < maxSrvMip;
- }
- default:
- // We only handle the cases corresponding to valid image indexes
- UNIMPLEMENTED();
- }
-
- return false;
-}
-
-// Does *not* increment the resource ref count!!
-ID3D11Resource *GetViewResource(ID3D11View *view)
-{
- ID3D11Resource *resource = nullptr;
- ASSERT(view);
- view->GetResource(&resource);
- resource->Release();
- return resource;
-}
-
-int GetWrapBits(GLenum wrap)
-{
- switch (wrap)
- {
- case GL_CLAMP_TO_EDGE:
- return 0x1;
- case GL_REPEAT:
- return 0x2;
- case GL_MIRRORED_REPEAT:
- 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 gl::Program *program,
- const std::vector<TranslatedAttribute> &vertexArrayAttribs,
- const std::vector<TranslatedAttribute> &currentValueAttribs,
- AttribIndexArray *sortedD3DSemanticsOut,
- std::vector<const TranslatedAttribute *> *sortedAttributesOut)
-{
- sortedAttributesOut->clear();
-
- const auto &locationToSemantic =
- GetImplAs<ProgramD3D>(program)->getAttribLocationToD3DSemantics();
-
- for (auto locationIndex : program->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);
-}
-
-} // anonymous namespace
-
-// StateManager11::SRVCache Implementation.
-
-StateManager11::SRVCache::SRVCache() : mHighestUsedSRV(0)
-{
-}
-
-StateManager11::SRVCache::~SRVCache()
-{
-}
-
-void StateManager11::SRVCache::update(size_t resourceIndex, ID3D11ShaderResourceView *srv)
-{
- ASSERT(resourceIndex < mCurrentSRVs.size());
- SRVRecord *record = &mCurrentSRVs[resourceIndex];
-
- record->srv = reinterpret_cast<uintptr_t>(srv);
- if (srv)
- {
- record->resource = reinterpret_cast<uintptr_t>(GetViewResource(srv));
- srv->GetDesc(&record->desc);
- mHighestUsedSRV = std::max(resourceIndex + 1, mHighestUsedSRV);
- }
- else
- {
- record->resource = 0;
-
- if (resourceIndex + 1 == mHighestUsedSRV)
- {
- do
- {
- --mHighestUsedSRV;
- } while (mHighestUsedSRV > 0 && mCurrentSRVs[mHighestUsedSRV].srv == 0);
- }
- }
-}
-
-void StateManager11::SRVCache::clear()
-{
- if (mCurrentSRVs.empty())
- {
- return;
- }
-
- memset(&mCurrentSRVs[0], 0, sizeof(SRVRecord) * mCurrentSRVs.size());
- mHighestUsedSRV = 0;
-}
-
-// ShaderConstants11 implementation
-
-ShaderConstants11::ShaderConstants11()
- : mVertexDirty(true),
- mPixelDirty(true),
- mComputeDirty(true),
- mSamplerMetadataVSDirty(true),
- mSamplerMetadataPSDirty(true),
- mSamplerMetadataCSDirty(true)
-{
-}
-
-ShaderConstants11::~ShaderConstants11()
-{
-}
-
-void ShaderConstants11::init(const gl::Caps &caps)
-{
- mSamplerMetadataVS.resize(caps.maxVertexTextureImageUnits);
- mSamplerMetadataPS.resize(caps.maxTextureImageUnits);
- mSamplerMetadataCS.resize(caps.maxComputeTextureImageUnits);
-}
-
-size_t ShaderConstants11::getRequiredBufferSize(gl::SamplerType samplerType) const
-{
- switch (samplerType)
- {
- case gl::SAMPLER_VERTEX:
- return sizeof(Vertex) + mSamplerMetadataVS.size() * sizeof(SamplerMetadata);
- case gl::SAMPLER_PIXEL:
- return sizeof(Pixel) + mSamplerMetadataPS.size() * sizeof(SamplerMetadata);
- case gl::SAMPLER_COMPUTE:
- return sizeof(Compute) + mSamplerMetadataCS.size() * sizeof(SamplerMetadata);
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-void ShaderConstants11::markDirty()
-{
- mVertexDirty = true;
- mPixelDirty = true;
- mComputeDirty = true;
- mSamplerMetadataVSDirty = true;
- mSamplerMetadataPSDirty = true;
- mSamplerMetadataCSDirty = true;
-}
-
-bool ShaderConstants11::updateSamplerMetadata(SamplerMetadata *data, const gl::Texture &texture)
-{
- bool dirty = false;
- unsigned int baseLevel = texture.getTextureState().getEffectiveBaseLevel();
- GLenum sizedFormat =
- texture.getFormat(texture.getTarget(), 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 one 4-integer
- // vector.
- GLenum wrapS = texture.getWrapS();
- GLenum wrapT = texture.getWrapT();
- GLenum wrapR = texture.getWrapR();
- int wrapModes = GetWrapBits(wrapS) | (GetWrapBits(wrapT) << 2) | (GetWrapBits(wrapR) << 4);
- if (data->wrapModes != wrapModes)
- {
- data->wrapModes = wrapModes;
- 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;
- mComputeDirty = true;
-}
-
-void ShaderConstants11::setMultiviewWriteToViewportIndex(GLfloat index)
-{
- mVertex.multiviewWriteToViewportIndex = index;
- mVertexDirty = true;
- mPixel.multiviewWriteToViewportIndex = index;
- mPixelDirty = true;
-}
-
-void ShaderConstants11::onViewportChange(const gl::Rectangle &glViewport,
- const D3D11_VIEWPORT &dxViewport,
- bool is9_3,
- bool presentPathFast)
-{
- mVertexDirty = true;
- mPixelDirty = true;
-
- // 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];
-}
-
-void ShaderConstants11::onSamplerChange(gl::SamplerType samplerType,
- unsigned int samplerIndex,
- const gl::Texture &texture)
-{
- switch (samplerType)
- {
- case gl::SAMPLER_VERTEX:
- if (updateSamplerMetadata(&mSamplerMetadataVS[samplerIndex], texture))
- {
- mSamplerMetadataVSDirty = true;
- }
- break;
- case gl::SAMPLER_PIXEL:
- if (updateSamplerMetadata(&mSamplerMetadataPS[samplerIndex], texture))
- {
- mSamplerMetadataPSDirty = true;
- }
- break;
- case gl::SAMPLER_COMPUTE:
- if (updateSamplerMetadata(&mSamplerMetadataCS[samplerIndex], texture))
- {
- mSamplerMetadataCSDirty = true;
- }
- break;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-gl::Error ShaderConstants11::updateBuffer(ID3D11DeviceContext *deviceContext,
- gl::SamplerType samplerType,
- const ProgramD3D &programD3D,
- const d3d11::Buffer &driverConstantBuffer)
-{
- bool dirty = false;
- size_t dataSize = 0;
- const uint8_t *data = nullptr;
- const uint8_t *samplerData = nullptr;
-
- switch (samplerType)
- {
- case gl::SAMPLER_VERTEX:
- dirty = mVertexDirty || mSamplerMetadataVSDirty;
- dataSize = sizeof(Vertex);
- data = reinterpret_cast<const uint8_t *>(&mVertex);
- samplerData = reinterpret_cast<const uint8_t *>(mSamplerMetadataVS.data());
- mVertexDirty = false;
- mSamplerMetadataVSDirty = false;
- break;
- case gl::SAMPLER_PIXEL:
- dirty = mPixelDirty || mSamplerMetadataPSDirty;
- dataSize = sizeof(Pixel);
- data = reinterpret_cast<const uint8_t *>(&mPixel);
- samplerData = reinterpret_cast<const uint8_t *>(mSamplerMetadataPS.data());
- mPixelDirty = false;
- mSamplerMetadataPSDirty = false;
- break;
- case gl::SAMPLER_COMPUTE:
- dirty = mComputeDirty || mSamplerMetadataCSDirty;
- dataSize = sizeof(Compute);
- data = reinterpret_cast<const uint8_t *>(&mCompute);
- samplerData = reinterpret_cast<const uint8_t *>(mSamplerMetadataCS.data());
- mComputeDirty = false;
- mSamplerMetadataCSDirty = false;
- break;
- default:
- UNREACHABLE();
- break;
- }
-
- ASSERT(driverConstantBuffer.valid());
-
- if (!dirty)
- {
- return gl::NoError();
- }
-
- // Previous buffer contents are discarded, so we need to refresh the whole buffer.
- D3D11_MAPPED_SUBRESOURCE mapping = {0};
- HRESULT result =
- deviceContext->Map(driverConstantBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mapping);
-
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Internal error mapping constant buffer: " << gl::FmtHR(result);
- }
-
- size_t samplerDataBytes = sizeof(SamplerMetadata) * programD3D.getUsedSamplerRange(samplerType);
-
- memcpy(mapping.pData, data, dataSize);
- memcpy(reinterpret_cast<uint8_t *>(mapping.pData) + dataSize, samplerData, samplerDataBytes);
-
- deviceContext->Unmap(driverConstantBuffer.get(), 0);
-
- return gl::NoError();
-}
-
-static const GLenum QueryTypes[] = {GL_ANY_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED_CONSERVATIVE,
- GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_TIME_ELAPSED_EXT,
- GL_COMMANDS_COMPLETED_CHROMIUM};
-
-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(),
- mInputLayoutIsDirty(false),
- mVertexAttribsNeedTranslation(false),
- mDirtyVertexBufferRange(gl::MAX_VERTEX_ATTRIBS, 0),
- mCurrentPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_UNDEFINED),
- mDirtySwizzles(false),
- mAppliedIB(nullptr),
- mAppliedIBFormat(DXGI_FORMAT_UNKNOWN),
- mAppliedIBOffset(0),
- mIndexBufferIsDirty(false),
- mVertexDataManager(renderer),
- mIndexDataManager(renderer),
- mIsMultiviewEnabled(false),
- mEmptySerial(mRenderer->generateSerial()),
- mIsTransformFeedbackCurrentlyActiveUnpaused(false)
-{
- 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.
- mInternalDirtyBits.set();
-
- // 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::SamplerType shaderType,
- UINT resourceSlot,
- const SRVType *srv)
-{
- auto &currentSRVs = (shaderType == gl::SAMPLER_VERTEX ? mCurVertexSRVs : mCurPixelSRVs);
-
- ASSERT(static_cast<size_t>(resourceSlot) < currentSRVs.size());
- const SRVRecord &record = currentSRVs[resourceSlot];
-
- if (record.srv != reinterpret_cast<uintptr_t>(srv))
- {
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
- ID3D11ShaderResourceView *srvPtr = srv ? srv->get() : nullptr;
- if (shaderType == gl::SAMPLER_VERTEX)
- {
- deviceContext->VSSetShaderResources(resourceSlot, 1, &srvPtr);
- }
- else
- {
- deviceContext->PSSetShaderResources(resourceSlot, 1, &srvPtr);
- }
-
- currentSRVs.update(resourceSlot, srvPtr);
- }
-}
-
-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->getGLState().getDrawFramebuffer();
- const auto *firstColorAttachment = framebuffer->getFirstColorbuffer();
- 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);
- }
-}
-
-gl::Error StateManager11::updateStateForCompute(const gl::Context *context,
- GLuint numGroupsX,
- GLuint numGroupsY,
- GLuint numGroupsZ)
-{
- mShaderConstants.setComputeWorkGroups(numGroupsX, numGroupsY, numGroupsZ);
-
- // TODO(jmadill): Use dirty bits.
- const auto &glState = context->getGLState();
- auto *programD3D = GetImplAs<ProgramD3D>(glState.getProgram());
- programD3D->updateSamplerMapping();
-
- // TODO(jmadill): Use dirty bits.
- ANGLE_TRY(generateSwizzlesForShader(context, gl::SAMPLER_COMPUTE));
-
- // TODO(jmadill): More complete implementation.
- ANGLE_TRY(syncTextures(context));
-
- // TODO(Xinghua): applyUniformBuffers for compute shader.
-
- return gl::NoError();
-}
-
-void StateManager11::syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits)
-{
- if (!dirtyBits.any())
- {
- return;
- }
-
- const auto &state = context->getGLState();
-
- for (auto 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);
- }
- break;
- case gl::State::DIRTY_BIT_CULL_FACE:
- if (state.getRasterizerState().cullMode != mCurRasterState.cullMode)
- {
- mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
- }
- break;
- case gl::State::DIRTY_BIT_FRONT_FACE:
- if (state.getRasterizerState().frontFace != mCurRasterState.frontFace)
- {
- mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
- }
- 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:
- if (state.getNearPlane() != mCurNear || state.getFarPlane() != mCurFar)
- {
- 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);
- }
- 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.
- mIndexBufferIsDirty = true;
- break;
- case gl::State::DIRTY_BIT_TEXTURE_BINDINGS:
- invalidateTexturesAndSamplers();
- break;
- case gl::State::DIRTY_BIT_SAMPLER_BINDINGS:
- invalidateTexturesAndSamplers();
- break;
- case gl::State::DIRTY_BIT_PROGRAM_EXECUTABLE:
- {
- mInternalDirtyBits.set(DIRTY_BIT_SHADERS);
- invalidateVertexBuffer();
- invalidateRenderTarget();
- invalidateTexturesAndSamplers();
- invalidateProgramUniforms();
- invalidateProgramUniformBuffers();
- gl::VertexArray *vao = state.getVertexArray();
- if (mIsMultiviewEnabled && vao != nullptr)
- {
- // If ANGLE_multiview is enabled, the attribute divisor has to be updated for
- // each binding.
- VertexArray11 *vao11 = GetImplAs<VertexArray11>(vao);
- const gl::Program *program = state.getProgram();
- int numViews = 1;
- if (program != nullptr && program->usesMultiview())
- {
- numViews = program->getNumViews();
- }
- vao11->markAllAttributeDivisorsForAdjustment(numViews);
- }
- break;
- }
- case gl::State::DIRTY_BIT_CURRENT_VALUES:
- {
- for (auto attribIndex : state.getAndResetDirtyCurrentValues())
- {
- invalidateCurrentValueAttrib(attribIndex);
- }
- }
- default:
- break;
- }
- }
-
- // TODO(jmadill): Input layout and vertex buffer state.
-}
-
-void StateManager11::handleMultiviewDrawFramebufferChange(const gl::Context *context)
-{
- const auto &glState = context->getGLState();
- const gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer();
- ASSERT(drawFramebuffer != nullptr);
-
- // Update viewport offsets.
- const std::vector<gl::Offset> *attachmentViewportOffsets =
- drawFramebuffer->getViewportOffsets();
- const std::vector<gl::Offset> &viewportOffsets =
- attachmentViewportOffsets != nullptr
- ? *attachmentViewportOffsets
- : gl::FramebufferAttachment::GetDefaultViewportOffsetVector();
- if (mViewportOffsets != viewportOffsets)
- {
- mViewportOffsets = viewportOffsets;
-
- // Because new viewport offsets are to be applied, we have to mark the internal viewport and
- // scissor state as dirty.
- invalidateViewport(context);
- mInternalDirtyBits.set(DIRTY_BIT_SCISSOR_STATE);
- }
- switch (drawFramebuffer->getMultiviewLayout())
- {
- case GL_FRAMEBUFFER_MULTIVIEW_SIDE_BY_SIDE_ANGLE:
- mShaderConstants.setMultiviewWriteToViewportIndex(1.0f);
- break;
- case GL_FRAMEBUFFER_MULTIVIEW_LAYERED_ANGLE:
- // 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);
- break;
- default:
- // There is no need to update the value in the constant buffer if the active framebuffer
- // object does not have a multiview layout.
- break;
- }
-}
-
-gl::Error StateManager11::syncBlendState(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::BlendState &blendState,
- const gl::ColorF &blendColor,
- unsigned int sampleMask)
-{
- const d3d11::BlendState *dxBlendState = nullptr;
- const d3d11::BlendStateKey &key =
- RenderStateCache::GetBlendStateKey(context, framebuffer, blendState);
-
- ANGLE_TRY(mRenderer->getBlendState(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 gl::NoError();
-}
-
-gl::Error StateManager11::syncDepthStencilState(const gl::State &glState)
-{
- 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(mCurStencilRef == mCurStencilBackRef);
- 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.stencilWritemask = 0;
- modifiedGLState.stencilBackWritemask = 0;
- modifiedGLState.stencilTest = false;
- }
-
- const d3d11::DepthStencilState *d3dState = nullptr;
- ANGLE_TRY(mRenderer->getDepthStencilState(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 = std::min<UINT>(mCurStencilRef, 0xFFu);
-
- mRenderer->getDeviceContext()->OMSetDepthStencilState(d3dState->get(), dxStencilRef);
-
- return gl::NoError();
-}
-
-gl::Error StateManager11::syncRasterizerState(const gl::Context *context, bool pointDrawMode)
-{
- // TODO: Remove pointDrawMode and multiSample from gl::RasterizerState.
- gl::RasterizerState rasterState = context->getGLState().getRasterizerState();
- rasterState.pointDrawMode = pointDrawMode;
- 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(modifiedRasterState, mCurScissorEnabled, &dxRasterState));
- }
- else
- {
- ANGLE_TRY(mRenderer->getRasterizerState(rasterState, mCurScissorEnabled, &dxRasterState));
- }
-
- mRenderer->getDeviceContext()->RSSetState(dxRasterState);
-
- mCurRasterState = rasterState;
-
- return gl::NoError();
-}
-
-void StateManager11::syncScissorRectangle(const gl::Rectangle &scissor, bool enabled)
-{
- int modifiedScissorY = scissor.y;
- if (mCurPresentPathFastEnabled)
- {
- modifiedScissorY = mCurPresentPathFastColorBufferHeight - scissor.height - scissor.y;
- }
-
- if (enabled)
- {
- std::array<D3D11_RECT, gl::IMPLEMENTATION_ANGLE_MULTIVIEW_MAX_VIEWS> rectangles;
- const UINT numRectangles = static_cast<UINT>(mViewportOffsets.size());
- for (UINT i = 0u; i < numRectangles; ++i)
- {
- D3D11_RECT &rect = rectangles[i];
- int x = scissor.x + mViewportOffsets[i].x;
- int y = modifiedScissorY + mViewportOffsets[i].y;
- 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(numRectangles, rectangles.data());
- }
-
- mCurScissorRect = scissor;
- mCurScissorEnabled = enabled;
-}
-
-void StateManager11::syncViewport(const gl::Context *context)
-{
- const auto &glState = context->getGLState();
- 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();
- std::array<D3D11_VIEWPORT, gl::IMPLEMENTATION_ANGLE_MULTIVIEW_MAX_VIEWS> dxViewports;
- const UINT numRectangles = static_cast<UINT>(mViewportOffsets.size());
-
- int dxViewportTopLeftX = 0;
- int dxViewportTopLeftY = 0;
- int dxViewportWidth = 0;
- int dxViewportHeight = 0;
-
- for (UINT i = 0u; i < numRectangles; ++i)
- {
- dxViewportTopLeftX = gl::clamp(viewport.x + mViewportOffsets[i].x, dxMinViewportBoundsX,
- dxMaxViewportBoundsX);
- dxViewportTopLeftY = gl::clamp(viewport.y + mViewportOffsets[i].y, dxMinViewportBoundsY,
- dxMaxViewportBoundsY);
- dxViewportWidth = gl::clamp(viewport.width, 0, dxMaxViewportBoundsX - dxViewportTopLeftX);
- dxViewportHeight = gl::clamp(viewport.height, 0, dxMaxViewportBoundsY - dxViewportTopLeftY);
-
- D3D11_VIEWPORT &dxViewport = dxViewports[i];
- 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(numRectangles, dxViewports.data());
-
- 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)
-{
- if (!mRenderTargetIsDirty)
- {
- return;
- }
-
- ASSERT(context);
-
- mRenderTargetIsDirty = false;
- 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->getGLState().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()
-{
- mCurVertexSRVs.clear();
- mCurPixelSRVs.clear();
-
- invalidateRenderTarget();
-}
-
-void StateManager11::invalidateVertexBuffer()
-{
- unsigned int limit = std::min<unsigned int>(mRenderer->getNativeCaps().maxVertexAttributes,
- gl::MAX_VERTEX_ATTRIBS);
- mDirtyVertexBufferRange = gl::RangeUI(0, limit);
- mInputLayoutIsDirty = true;
- mInternalDirtyBits.set(DIRTY_BIT_CURRENT_VALUE_ATTRIBS);
- invalidateVertexAttributeTranslation();
-}
-
-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::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::setRenderTarget(ID3D11RenderTargetView *rtv, ID3D11DepthStencilView *dsv)
-{
- if ((rtv && unsetConflictingView(rtv)) || (dsv && unsetConflictingView(dsv)))
- {
- mInternalDirtyBits.set(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE);
- }
-
- mRenderer->getDeviceContext()->OMSetRenderTargets(1, &rtv, dsv);
- mInternalDirtyBits.set(DIRTY_BIT_RENDER_TARGET);
-}
-
-void StateManager11::setRenderTargets(ID3D11RenderTargetView **rtvs,
- UINT numRTVs,
- ID3D11DepthStencilView *dsv)
-{
- bool anyDirty = false;
-
- for (UINT rtvIndex = 0; rtvIndex < numRTVs; ++rtvIndex)
- {
- anyDirty = anyDirty || unsetConflictingView(rtvs[rtvIndex]);
- }
-
- if (dsv)
- {
- anyDirty = anyDirty || unsetConflictingView(dsv);
- }
-
- if (anyDirty)
- {
- mInternalDirtyBits.set(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE);
- }
-
- mRenderer->getDeviceContext()->OMSetRenderTargets(numRTVs, (numRTVs > 0) ? rtvs : nullptr, dsv);
- mInternalDirtyBits.set(DIRTY_BIT_RENDER_TARGET);
-}
-
-void StateManager11::invalidateVertexAttributeTranslation()
-{
- mVertexAttribsNeedTranslation = true;
-}
-
-void StateManager11::onBeginQuery(Query11 *query)
-{
- mCurrentQueries.insert(query);
-}
-
-void StateManager11::onDeleteQueryObject(Query11 *query)
-{
- mCurrentQueries.erase(query);
-}
-
-gl::Error StateManager11::onMakeCurrent(const gl::Context *context)
-{
- const gl::State &state = context->getGLState();
-
- for (Query11 *query : mCurrentQueries)
- {
- ANGLE_TRY(query->pause());
- }
- mCurrentQueries.clear();
-
- for (GLenum queryType : QueryTypes)
- {
- gl::Query *query = state.getActiveQuery(queryType);
- if (query != nullptr)
- {
- Query11 *query11 = GetImplAs<Query11>(query);
- ANGLE_TRY(query11->resume());
- mCurrentQueries.insert(query11);
- }
- }
-
- return gl::NoError();
-}
-
-gl::Error StateManager11::clearTextures(gl::SamplerType samplerType,
- size_t rangeStart,
- size_t rangeEnd)
-{
- if (rangeStart == rangeEnd)
- {
- return gl::NoError();
- }
-
- auto &currentSRVs = (samplerType == gl::SAMPLER_VERTEX ? mCurVertexSRVs : mCurPixelSRVs);
-
- gl::Range<size_t> clearRange(rangeStart, std::min(rangeEnd, currentSRVs.highestUsed()));
- if (clearRange.empty())
- {
- return gl::NoError();
- }
-
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
- if (samplerType == gl::SAMPLER_VERTEX)
- {
- deviceContext->VSSetShaderResources(static_cast<unsigned int>(clearRange.low()),
- static_cast<unsigned int>(clearRange.length()),
- &mNullSRVs[0]);
- }
- else
- {
- deviceContext->PSSetShaderResources(static_cast<unsigned int>(clearRange.low()),
- static_cast<unsigned int>(clearRange.length()),
- &mNullSRVs[0]);
- }
-
- for (size_t samplerIndex : clearRange)
- {
- currentSRVs.update(samplerIndex, nullptr);
- }
-
- return gl::NoError();
-}
-
-bool StateManager11::unsetConflictingView(ID3D11View *view)
-{
- uintptr_t resource = reinterpret_cast<uintptr_t>(GetViewResource(view));
- return unsetConflictingSRVs(gl::SAMPLER_VERTEX, resource, nullptr) ||
- unsetConflictingSRVs(gl::SAMPLER_PIXEL, resource, nullptr);
-}
-
-bool StateManager11::unsetConflictingSRVs(gl::SamplerType samplerType,
- uintptr_t resource,
- const gl::ImageIndex *index)
-{
- auto &currentSRVs = (samplerType == gl::SAMPLER_VERTEX ? mCurVertexSRVs : mCurPixelSRVs);
-
- bool foundOne = false;
-
- for (size_t resourceIndex = 0; resourceIndex < currentSRVs.size(); ++resourceIndex)
- {
- auto &record = currentSRVs[resourceIndex];
-
- if (record.srv && record.resource == resource &&
- (!index || ImageIndexConflictsWithSRV(*index, record.desc)))
- {
- setShaderResourceInternal<d3d11::ShaderResourceView>(
- samplerType, static_cast<UINT>(resourceIndex), nullptr);
- foundOne = true;
- }
- }
-
- return foundOne;
-}
-
-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::SAMPLER_VERTEX, resourcePtr, &index);
- unsetConflictingSRVs(gl::SAMPLER_PIXEL, resourcePtr, &index);
- }
- else if (attachment->type() == GL_FRAMEBUFFER_DEFAULT)
- {
- uintptr_t resourcePtr = reinterpret_cast<uintptr_t>(resource);
- unsetConflictingSRVs(gl::SAMPLER_VERTEX, resourcePtr, nullptr);
- unsetConflictingSRVs(gl::SAMPLER_PIXEL, resourcePtr, nullptr);
- }
-}
-
-gl::Error StateManager11::initialize(const gl::Caps &caps, const gl::Extensions &extensions)
-{
- mCurVertexSRVs.initialize(caps.maxVertexTextureImageUnits);
- mCurPixelSRVs.initialize(caps.maxTextureImageUnits);
-
- // Initialize cached NULL SRV block
- mNullSRVs.resize(caps.maxTextureImageUnits, nullptr);
-
- mCurrentValueAttribs.resize(caps.maxVertexAttributes);
-
- mForceSetVertexSamplerStates.resize(caps.maxVertexTextureImageUnits, true);
- mForceSetPixelSamplerStates.resize(caps.maxTextureImageUnits, true);
- mForceSetComputeSamplerStates.resize(caps.maxComputeTextureImageUnits, true);
-
- mCurVertexSamplerStates.resize(caps.maxVertexTextureImageUnits);
- mCurPixelSamplerStates.resize(caps.maxTextureImageUnits);
- mCurComputeSamplerStates.resize(caps.maxComputeTextureImageUnits);
-
- mShaderConstants.init(caps);
-
- mIsMultiviewEnabled = extensions.multiview;
- mViewportOffsets.resize(1u);
-
- ANGLE_TRY(mVertexDataManager.initialize());
-
- mCurrentAttributes.reserve(gl::MAX_VERTEX_ATTRIBS);
-
- return gl::NoError();
-}
-
-void StateManager11::deinitialize()
-{
- mCurrentValueAttribs.clear();
- mInputLayoutCache.clear();
- mVertexDataManager.deinitialize();
- mIndexDataManager.deinitialize();
-
- mDriverConstantBufferVS.reset();
- mDriverConstantBufferPS.reset();
- mDriverConstantBufferCS.reset();
-}
-
-gl::Error StateManager11::syncFramebuffer(const gl::Context *context, gl::Framebuffer *framebuffer)
-{
- Framebuffer11 *framebuffer11 = GetImplAs<Framebuffer11>(framebuffer);
-
- // Applies the render target surface, depth stencil surface, viewport rectangle and
- // scissor rectangle to the renderer
- ASSERT(framebuffer && !framebuffer->hasAnyDirtyBit() && framebuffer->cachedComplete());
-
- // 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 (framebuffer->id() == 0)
- {
- ASSERT(!framebuffer11->hasAnyInternalDirtyBit());
- const gl::Extents &size = framebuffer->getFirstColorbuffer()->getSize();
- if (size.width == 0 || size.height == 0)
- {
- return gl::NoError();
- }
- }
-
- RTVArray framebufferRTVs = {{}};
-
- const auto &colorRTs = framebuffer11->getCachedColorRenderTargets();
-
- size_t appliedRTIndex = 0;
- bool skipInactiveRTs = mRenderer->getWorkarounds().mrtPerfWorkaround;
- const auto &drawStates = framebuffer->getDrawBufferStates();
- gl::DrawBufferMask activeProgramOutputs =
- context->getContextState().getState().getProgram()->getActiveOutputVariables();
- UINT maxExistingRT = 0;
-
- 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 auto *attachment = framebuffer->getColorbuffer(rtIndex);
- ASSERT(attachment);
- unsetConflictingAttachmentResources(attachment, renderTarget->getTexture().get());
- }
-
- appliedRTIndex++;
- }
-
- // Get the depth stencil buffers
- ID3D11DepthStencilView *framebufferDSV = nullptr;
- const auto *depthStencilRenderTarget = framebuffer11->getCachedDepthStencilRenderTarget();
- if (depthStencilRenderTarget)
- {
- framebufferDSV = depthStencilRenderTarget->getDepthStencilView().get();
- ASSERT(framebufferDSV);
-
- // Unset conflicting texture SRVs
- const auto *attachment = framebuffer->getDepthOrStencilbuffer();
- ASSERT(attachment);
- unsetConflictingAttachmentResources(attachment,
- depthStencilRenderTarget->getTexture().get());
- }
-
- // TODO(jmadill): Use context caps?
- ASSERT(maxExistingRT <= static_cast<UINT>(mRenderer->getNativeCaps().maxDrawBuffers));
-
- // Apply the render target and depth stencil
- mRenderer->getDeviceContext()->OMSetRenderTargets(maxExistingRT, framebufferRTVs.data(),
- framebufferDSV);
-
- return gl::NoError();
-}
-
-void StateManager11::invalidateCurrentValueAttrib(size_t attribIndex)
-{
- mDirtyCurrentValueAttribs.set(attribIndex);
- mInternalDirtyBits.set(DIRTY_BIT_CURRENT_VALUE_ATTRIBS);
-}
-
-gl::Error StateManager11::syncCurrentValueAttribs(const gl::State &glState)
-{
- const auto &activeAttribsMask = glState.getProgram()->getActiveAttribLocationsMask();
- const auto &dirtyActiveAttribs = (activeAttribsMask & mDirtyCurrentValueAttribs);
-
- if (!dirtyActiveAttribs.any())
- {
- return gl::NoError();
- }
-
- const auto &vertexAttributes = glState.getVertexArray()->getVertexAttributes();
- const auto &vertexBindings = glState.getVertexArray()->getVertexBindings();
- mDirtyCurrentValueAttribs = (mDirtyCurrentValueAttribs & ~dirtyActiveAttribs);
-
- for (auto attribIndex : dirtyActiveAttribs)
- {
- if (vertexAttributes[attribIndex].enabled)
- continue;
-
- const auto *attrib = &vertexAttributes[attribIndex];
- const auto &currentValue = glState.getVertexAttribCurrentValue(attribIndex);
- TranslatedAttribute *currentValueAttrib = &mCurrentValueAttribs[attribIndex];
- currentValueAttrib->currentValueType = currentValue.Type;
- currentValueAttrib->attribute = attrib;
- currentValueAttrib->binding = &vertexBindings[attrib->bindingIndex];
-
- mDirtyVertexBufferRange.extend(static_cast<unsigned int>(attribIndex));
- mInputLayoutIsDirty = true;
-
- ANGLE_TRY(mVertexDataManager.storeCurrentValue(currentValue, currentValueAttrib,
- static_cast<size_t>(attribIndex)));
- }
-
- return gl::NoError();
-}
-
-void StateManager11::setInputLayout(const d3d11::InputLayout *inputLayout)
-{
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
- if (inputLayout == nullptr)
- {
- if (!mCurrentInputLayout.empty())
- {
- deviceContext->IASetInputLayout(nullptr);
- mCurrentInputLayout.clear();
- mInputLayoutIsDirty = true;
- }
- }
- else if (inputLayout->getSerial() != mCurrentInputLayout)
- {
- deviceContext->IASetInputLayout(inputLayout->get());
- mCurrentInputLayout = inputLayout->getSerial();
- mInputLayoutIsDirty = true;
- }
-}
-
-bool StateManager11::queueVertexBufferChange(size_t bufferIndex,
- ID3D11Buffer *buffer,
- UINT stride,
- UINT offset)
-{
- if (buffer != mCurrentVertexBuffers[bufferIndex] ||
- stride != mCurrentVertexStrides[bufferIndex] ||
- offset != mCurrentVertexOffsets[bufferIndex])
- {
- mInputLayoutIsDirty = true;
- mDirtyVertexBufferRange.extend(static_cast<unsigned int>(bufferIndex));
-
- mCurrentVertexBuffers[bufferIndex] = buffer;
- mCurrentVertexStrides[bufferIndex] = stride;
- mCurrentVertexOffsets[bufferIndex] = offset;
- return true;
- }
-
- return false;
-}
-
-bool StateManager11::queueVertexOffsetChange(size_t bufferIndex, UINT offsetOnly)
-{
- if (offsetOnly != mCurrentVertexOffsets[bufferIndex])
- {
- mInputLayoutIsDirty = true;
- mDirtyVertexBufferRange.extend(static_cast<unsigned int>(bufferIndex));
- mCurrentVertexOffsets[bufferIndex] = offsetOnly;
- 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))
- {
- applyVertexBufferChanges();
- }
-}
-
-gl::Error StateManager11::updateState(const gl::Context *context, GLenum drawMode)
-{
- const auto &glState = context->getGLState();
- auto *programD3D = GetImplAs<ProgramD3D>(glState.getProgram());
-
- // TODO(jmadill): Use dirty bits.
- processFramebufferInvalidation(context);
-
- // TODO(jmadill): Use dirty bits.
- if (programD3D->updateSamplerMapping() == ProgramD3D::SamplerMapping::WasDirty)
- {
- invalidateTexturesAndSamplers();
- }
-
- // TODO(jmadill): Use dirty bits.
- if (programD3D->areVertexUniformsDirty() || programD3D->areFragmentUniformsDirty())
- {
- mInternalDirtyBits.set(DIRTY_BIT_PROGRAM_UNIFORMS);
- }
-
- // Transform feedback affects the stream-out geometry shader.
- // TODO(jmadill): Use dirty bits.
- if (glState.isTransformFeedbackActiveUnpaused() != mIsTransformFeedbackCurrentlyActiveUnpaused)
- {
- mIsTransformFeedbackCurrentlyActiveUnpaused = glState.isTransformFeedbackActiveUnpaused();
- invalidateShaders();
- }
-
- // Swizzling can cause internal state changes with blit shaders.
- if (mDirtySwizzles)
- {
- ANGLE_TRY(generateSwizzles(context));
- mDirtySwizzles = false;
- }
-
- gl::Framebuffer *framebuffer = glState.getDrawFramebuffer();
- Framebuffer11 *framebuffer11 = GetImplAs<Framebuffer11>(framebuffer);
- ANGLE_TRY(framebuffer11->markAttachmentsDirty(context));
-
- if (framebuffer11->hasAnyInternalDirtyBit())
- {
- ASSERT(framebuffer->id() != 0);
- framebuffer11->syncInternalState(context);
- }
-
- bool pointDrawMode = (drawMode == GL_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();
- }
-
- // TODO(jiawei.shao@intel.com): This can be recomputed only on framebuffer or multisample mask
- // state changes.
- RenderTarget11 *firstRT = framebuffer11->getFirstRenderTarget();
- int samples = (firstRT ? firstRT->getSamples() : 0);
- unsigned int sampleMask = GetBlendSampleMask(glState, samples);
- if (sampleMask != mCurSampleMask)
- {
- mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE);
- }
-
- // Changing the vertex attribute state can affect the vertex shader.
- gl::VertexArray *vao = glState.getVertexArray();
- VertexArray11 *vao11 = GetImplAs<VertexArray11>(vao);
- if (vao11->flushAttribUpdates(context))
- {
- mInternalDirtyBits.set(DIRTY_BIT_SHADERS);
- }
-
- auto dirtyBitsCopy = mInternalDirtyBits;
- mInternalDirtyBits.reset();
-
- for (auto dirtyBit : dirtyBitsCopy)
- {
- switch (dirtyBit)
- {
- case DIRTY_BIT_RENDER_TARGET:
- ANGLE_TRY(syncFramebuffer(context, framebuffer));
- 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, pointDrawMode));
- break;
- case DIRTY_BIT_BLEND_STATE:
- ANGLE_TRY(syncBlendState(context, framebuffer, glState.getBlendState(),
- glState.getBlendColor(), sampleMask));
- break;
- case DIRTY_BIT_DEPTH_STENCIL_STATE:
- ANGLE_TRY(syncDepthStencilState(glState));
- 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(programD3D));
- break;
- case DIRTY_BIT_DRIVER_UNIFORMS:
- // This must happen after viewport sync; the viewport affects builtin uniforms.
- ANGLE_TRY(applyDriverUniforms(*programD3D));
- break;
- case DIRTY_BIT_PROGRAM_UNIFORM_BUFFERS:
- ANGLE_TRY(syncUniformBuffers(context, programD3D));
- break;
- case DIRTY_BIT_SHADERS:
- ANGLE_TRY(syncProgram(context, drawMode));
- break;
- case DIRTY_BIT_CURRENT_VALUE_ATTRIBS:
- ANGLE_TRY(syncCurrentValueAttribs(glState));
- break;
- default:
- UNREACHABLE();
- break;
- }
- }
-
- ANGLE_TRY(syncTransformFeedbackBuffers(context));
-
- // Check that we haven't set any dirty bits in the flushing of the dirty bits loop.
- ASSERT(mInternalDirtyBits.none());
-
- return gl::NoError();
-}
-
-void StateManager11::setShaderResourceShared(gl::SamplerType 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::SamplerType 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 (primitiveTopology != mCurrentPrimitiveTopology)
- {
- mRenderer->getDeviceContext()->IASetPrimitiveTopology(primitiveTopology);
- mCurrentPrimitiveTopology = primitiveTopology;
- }
-}
-
-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 != mAppliedVertexShader)
- {
- ID3D11VertexShader *appliedShader = shader ? shader->get() : nullptr;
- mRenderer->getDeviceContext()->VSSetShader(appliedShader, nullptr, 0);
- mAppliedVertexShader = serial;
- invalidateShaders();
- }
-}
-
-void StateManager11::setGeometryShader(const d3d11::GeometryShader *shader)
-{
- ResourceSerial serial = shader ? shader->getSerial() : ResourceSerial(0);
-
- if (serial != mAppliedGeometryShader)
- {
- ID3D11GeometryShader *appliedShader = shader ? shader->get() : nullptr;
- mRenderer->getDeviceContext()->GSSetShader(appliedShader, nullptr, 0);
- mAppliedGeometryShader = serial;
- invalidateShaders();
- }
-}
-
-void StateManager11::setPixelShader(const d3d11::PixelShader *shader)
-{
- ResourceSerial serial = shader ? shader->getSerial() : ResourceSerial(0);
-
- if (serial != mAppliedPixelShader)
- {
- ID3D11PixelShader *appliedShader = shader ? shader->get() : nullptr;
- mRenderer->getDeviceContext()->PSSetShader(appliedShader, nullptr, 0);
- mAppliedPixelShader = serial;
- invalidateShaders();
- }
-}
-
-void StateManager11::setComputeShader(const d3d11::ComputeShader *shader)
-{
- ResourceSerial serial = shader ? shader->getSerial() : ResourceSerial(0);
-
- if (serial != mAppliedComputeShader)
- {
- ID3D11ComputeShader *appliedShader = shader ? shader->get() : nullptr;
- mRenderer->getDeviceContext()->CSSetShader(appliedShader, nullptr, 0);
- mAppliedComputeShader = serial;
- // TODO(jmadill): Dirty bits for compute.
- }
-}
-
-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::SAMPLER_PIXEL, 0, &srv);
- deviceContext->PSSetSamplers(0, 1, samplerState.getPointer());
-
- mInternalDirtyBits.set(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE);
- mForceSetPixelSamplerStates[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);
-}
-
-// 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.
-gl::Error StateManager11::applyTextures(const gl::Context *context, gl::SamplerType shaderType)
-{
- const auto &glState = context->getGLState();
- const auto &caps = context->getCaps();
- ProgramD3D *programD3D = GetImplAs<ProgramD3D>(glState.getProgram());
-
- ASSERT(!programD3D->isSamplerMappingDirty());
-
- // TODO(jmadill): Use the Program's sampler bindings.
- const auto &completeTextures = glState.getCompleteTextureCache();
-
- unsigned int samplerRange = programD3D->getUsedSamplerRange(shaderType);
- for (unsigned int samplerIndex = 0; samplerIndex < samplerRange; samplerIndex++)
- {
- GLint textureUnit = programD3D->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(setTexture(context, shaderType, samplerIndex, texture));
- }
- else
- {
- GLenum 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(mRenderer->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::SAMPLER_PIXEL) ? caps.maxTextureImageUnits
- : caps.maxVertexTextureImageUnits;
- ANGLE_TRY(clearTextures(shaderType, samplerRange, samplerCount));
-
- return gl::NoError();
-}
-
-gl::Error StateManager11::syncTextures(const gl::Context *context)
-{
- ANGLE_TRY(applyTextures(context, gl::SAMPLER_VERTEX));
- ANGLE_TRY(applyTextures(context, gl::SAMPLER_PIXEL));
- return gl::NoError();
-}
-
-gl::Error StateManager11::setSamplerState(const gl::Context *context,
- gl::SamplerType 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();
-
- if (type == gl::SAMPLER_PIXEL)
- {
- ASSERT(static_cast<unsigned int>(index) < mRenderer->getNativeCaps().maxTextureImageUnits);
-
- if (mForceSetPixelSamplerStates[index] ||
- memcmp(&samplerState, &mCurPixelSamplerStates[index], sizeof(gl::SamplerState)) != 0)
- {
- ID3D11SamplerState *dxSamplerState = nullptr;
- ANGLE_TRY(mRenderer->getSamplerState(samplerState, &dxSamplerState));
-
- ASSERT(dxSamplerState != nullptr);
- deviceContext->PSSetSamplers(index, 1, &dxSamplerState);
-
- mCurPixelSamplerStates[index] = samplerState;
- }
-
- mForceSetPixelSamplerStates[index] = false;
- }
- else if (type == gl::SAMPLER_VERTEX)
- {
- ASSERT(static_cast<unsigned int>(index) <
- mRenderer->getNativeCaps().maxVertexTextureImageUnits);
-
- if (mForceSetVertexSamplerStates[index] ||
- memcmp(&samplerState, &mCurVertexSamplerStates[index], sizeof(gl::SamplerState)) != 0)
- {
- ID3D11SamplerState *dxSamplerState = nullptr;
- ANGLE_TRY(mRenderer->getSamplerState(samplerState, &dxSamplerState));
-
- ASSERT(dxSamplerState != nullptr);
- deviceContext->VSSetSamplers(index, 1, &dxSamplerState);
-
- mCurVertexSamplerStates[index] = samplerState;
- }
-
- mForceSetVertexSamplerStates[index] = false;
- }
- else if (type == gl::SAMPLER_COMPUTE)
- {
- ASSERT(static_cast<unsigned int>(index) <
- mRenderer->getNativeCaps().maxComputeTextureImageUnits);
-
- if (mForceSetComputeSamplerStates[index] ||
- memcmp(&samplerState, &mCurComputeSamplerStates[index], sizeof(gl::SamplerState)) != 0)
- {
- ID3D11SamplerState *dxSamplerState = nullptr;
- ANGLE_TRY(mRenderer->getSamplerState(samplerState, &dxSamplerState));
-
- ASSERT(dxSamplerState != nullptr);
- deviceContext->CSSetSamplers(index, 1, &dxSamplerState);
-
- mCurComputeSamplerStates[index] = samplerState;
- }
-
- mForceSetComputeSamplerStates[index] = false;
- }
- else
- UNREACHABLE();
-
- // 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.
- mShaderConstants.onSamplerChange(type, index, *texture);
-
- return gl::NoError();
-}
-
-gl::Error StateManager11::setTexture(const gl::Context *context,
- gl::SamplerType type,
- int index,
- gl::Texture *texture)
-{
- 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->getSRV(context, texture->getTextureState(), &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::SAMPLER_PIXEL &&
- static_cast<unsigned int>(index) < mRenderer->getNativeCaps().maxTextureImageUnits) ||
- (type == gl::SAMPLER_VERTEX &&
- static_cast<unsigned int>(index) < mRenderer->getNativeCaps().maxVertexTextureImageUnits));
-
- setShaderResourceInternal(type, index, textureSRV);
- return gl::NoError();
-}
-
-// 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.
-gl::Error StateManager11::syncProgram(const gl::Context *context, GLenum drawMode)
-{
- Context11 *context11 = GetImplAs<Context11>(context);
- ANGLE_TRY(context11->triggerDrawCallProgramRecompilation(context, drawMode));
-
- const auto &glState = context->getGLState();
- const auto *va11 = GetImplAs<VertexArray11>(glState.getVertexArray());
- auto *programD3D = GetImplAs<ProgramD3D>(glState.getProgram());
-
- programD3D->updateCachedInputLayout(va11->getCurrentStateSerial(), glState);
-
- // Binaries must be compiled before the sync.
- ASSERT(programD3D->hasVertexExecutableForCachedInputLayout());
- ASSERT(programD3D->hasGeometryExecutableForPrimitiveType(drawMode));
- ASSERT(programD3D->hasPixelExecutableForCachedOutputLayout());
-
- ShaderExecutableD3D *vertexExe = nullptr;
- ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(&vertexExe, nullptr));
-
- ShaderExecutableD3D *pixelExe = nullptr;
- ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(&pixelExe, nullptr));
-
- ShaderExecutableD3D *geometryExe = nullptr;
- ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(context, 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 gl::NoError();
-}
-
-gl::Error StateManager11::applyVertexBuffer(const gl::Context *context,
- GLenum mode,
- const DrawCallVertexParams &vertexParams,
- bool isIndexedRendering)
-{
- const auto &state = context->getGLState();
- const gl::VertexArray *vertexArray = state.getVertexArray();
- VertexArray11 *vertexArray11 = GetImplAs<VertexArray11>(vertexArray);
-
- if (mVertexAttribsNeedTranslation)
- {
- ANGLE_TRY(vertexArray11->updateDirtyAndDynamicAttribs(context, &mVertexDataManager,
- vertexParams));
- mInputLayoutIsDirty = true;
-
- // Determine if we need to update attribs on the next draw.
- mVertexAttribsNeedTranslation = (vertexArray11->hasActiveDynamicAttrib(context));
- }
-
- if (!mLastFirstVertex.valid() || mLastFirstVertex.value() != vertexParams.firstVertex())
- {
- mLastFirstVertex = vertexParams.firstVertex();
- mInputLayoutIsDirty = true;
- }
-
- if (!mInputLayoutIsDirty)
- {
- return gl::NoError();
- }
-
- const auto &vertexArrayAttribs = vertexArray11->getTranslatedAttribs();
- gl::Program *program = state.getProgram();
-
- // Sort the attributes according to ensure we re-use similar input layouts.
- AttribIndexArray sortedSemanticIndices;
- SortAttributesByLayout(program, vertexArrayAttribs, mCurrentValueAttribs,
- &sortedSemanticIndices, &mCurrentAttributes);
-
- auto 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.
- ANGLE_TRY(mInputLayoutCache.updateInputLayout(mRenderer, state, mCurrentAttributes, mode,
- sortedSemanticIndices, vertexParams));
-
- // Update the applied vertex buffers.
- ANGLE_TRY(mInputLayoutCache.applyVertexBuffers(context, mCurrentAttributes, mode,
- vertexParams.firstVertex(), isIndexedRendering));
-
- // InputLayoutCache::applyVertexBuffers calls through to the Bufer11 to get the native vertex
- // buffer (ID3D11Buffer *). Because we allocate these buffers lazily, this will trigger
- // allocation. This in turn will signal that the buffer is dirty. Since we just resolved the
- // dirty-ness in VertexArray11::updateDirtyAndDynamicAttribs, this can make us do a needless
- // update on the second draw call.
- // Hence we clear the flags here, after we've applied vertex data, since we know everything
- // is clean. This is a bit of a hack.
- vertexArray11->clearDirtyAndPromoteDynamicAttribs(context, vertexParams);
-
- mInputLayoutIsDirty = false;
- return gl::NoError();
-}
-
-gl::Error StateManager11::applyIndexBuffer(const gl::Context *context,
- const void *indices,
- GLsizei count,
- GLenum type,
- const gl::HasIndexRange &lazyIndexRange,
- bool usePrimitiveRestartWorkaround)
-{
- const auto &glState = context->getGLState();
- gl::VertexArray *vao = glState.getVertexArray();
- VertexArray11 *vao11 = GetImplAs<VertexArray11>(vao);
-
- GLenum destElementType =
- GetIndexTranslationDestType(type, lazyIndexRange, usePrimitiveRestartWorkaround);
-
- if (!vao11->updateElementArrayStorage(context, type, destElementType, indices) &&
- !mIndexBufferIsDirty)
- {
- // No streaming or index buffer application necessary.
- return gl::NoError();
- }
-
- gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get();
-
- TranslatedIndexData *indexInfo = vao11->getCachedIndexInfo();
- ANGLE_TRY(mIndexDataManager.prepareIndexData(context, type, destElementType, count,
- elementArrayBuffer, indices, indexInfo));
-
- ID3D11Buffer *buffer = nullptr;
- DXGI_FORMAT bufferFormat =
- (indexInfo->indexType == GL_UNSIGNED_INT) ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT;
-
- if (indexInfo->storage)
- {
- Buffer11 *storage = GetAs<Buffer11>(indexInfo->storage);
- ANGLE_TRY_RESULT(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;
-
- vao11->setCachedIndexInfoValid();
- return gl::NoError();
-}
-
-void StateManager11::setIndexBuffer(ID3D11Buffer *buffer,
- DXGI_FORMAT indexFormat,
- unsigned int offset)
-{
- if (syncIndexBuffer(buffer, indexFormat, offset))
- {
- mIndexBufferIsDirty = true;
- }
-}
-
-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.
-gl::Error StateManager11::updateVertexOffsetsForPointSpritesEmulation(GLint startVertex,
- GLsizei emulatedInstanceId)
-{
- return mInputLayoutCache.updateVertexOffsetsForPointSpritesEmulation(
- mRenderer, mCurrentAttributes, startVertex, emulatedInstanceId);
-}
-
-gl::Error StateManager11::generateSwizzle(const gl::Context *context, gl::Texture *texture)
-{
- if (!texture)
- {
- return gl::NoError();
- }
-
- 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 gl::NoError();
-}
-
-gl::Error StateManager11::generateSwizzlesForShader(const gl::Context *context,
- gl::SamplerType type)
-{
- const auto &glState = context->getGLState();
- ProgramD3D *programD3D = GetImplAs<ProgramD3D>(glState.getProgram());
-
- unsigned int samplerRange = programD3D->getUsedSamplerRange(type);
-
- for (unsigned int i = 0; i < samplerRange; i++)
- {
- GLenum textureType = programD3D->getSamplerTextureType(type, i);
- GLint textureUnit = programD3D->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 gl::NoError();
-}
-
-gl::Error StateManager11::generateSwizzles(const gl::Context *context)
-{
- ANGLE_TRY(generateSwizzlesForShader(context, gl::SAMPLER_VERTEX));
- ANGLE_TRY(generateSwizzlesForShader(context, gl::SAMPLER_PIXEL));
- return gl::NoError();
-}
-
-gl::Error StateManager11::applyUniforms(ProgramD3D *programD3D)
-{
- UniformStorage11 *vertexUniformStorage =
- GetAs<UniformStorage11>(&programD3D->getVertexUniformStorage());
- UniformStorage11 *fragmentUniformStorage =
- GetAs<UniformStorage11>(&programD3D->getFragmentUniformStorage());
- ASSERT(vertexUniformStorage);
- ASSERT(fragmentUniformStorage);
-
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
-
- const d3d11::Buffer *vertexConstantBuffer = nullptr;
- ANGLE_TRY(vertexUniformStorage->getConstantBuffer(mRenderer, &vertexConstantBuffer));
- const d3d11::Buffer *pixelConstantBuffer = nullptr;
- ANGLE_TRY(fragmentUniformStorage->getConstantBuffer(mRenderer, &pixelConstantBuffer));
-
- if (vertexUniformStorage->size() > 0 && programD3D->areVertexUniformsDirty())
- {
- UpdateUniformBuffer(deviceContext, vertexUniformStorage, vertexConstantBuffer);
- }
-
- if (fragmentUniformStorage->size() > 0 && programD3D->areFragmentUniformsDirty())
- {
- UpdateUniformBuffer(deviceContext, fragmentUniformStorage, pixelConstantBuffer);
- }
-
- unsigned int slot = d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DEFAULT_UNIFORM_BLOCK;
-
- if (mCurrentConstantBufferVS[slot] != vertexConstantBuffer->getSerial())
- {
- deviceContext->VSSetConstantBuffers(slot, 1, vertexConstantBuffer->getPointer());
- mCurrentConstantBufferVS[slot] = vertexConstantBuffer->getSerial();
- mCurrentConstantBufferVSOffset[slot] = 0;
- mCurrentConstantBufferVSSize[slot] = 0;
- }
-
- if (mCurrentConstantBufferPS[slot] != pixelConstantBuffer->getSerial())
- {
- deviceContext->PSSetConstantBuffers(slot, 1, pixelConstantBuffer->getPointer());
- mCurrentConstantBufferPS[slot] = pixelConstantBuffer->getSerial();
- mCurrentConstantBufferPSOffset[slot] = 0;
- mCurrentConstantBufferPSSize[slot] = 0;
- }
-
- programD3D->markUniformsClean();
-
- return gl::NoError();
-}
-
-gl::Error StateManager11::applyDriverUniforms(const ProgramD3D &programD3D)
-{
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
-
- if (!mDriverConstantBufferVS.valid())
- {
- size_t requiredSize = mShaderConstants.getRequiredBufferSize(gl::SAMPLER_VERTEX);
-
- D3D11_BUFFER_DESC constantBufferDescription = {0};
- d3d11::InitConstantBufferDesc(&constantBufferDescription, requiredSize);
- ANGLE_TRY(mRenderer->allocateResource(constantBufferDescription, &mDriverConstantBufferVS));
-
- ID3D11Buffer *driverVSConstants = mDriverConstantBufferVS.get();
- deviceContext->VSSetConstantBuffers(d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DRIVER, 1,
- &driverVSConstants);
- }
-
- if (!mDriverConstantBufferPS.valid())
- {
- size_t requiredSize = mShaderConstants.getRequiredBufferSize(gl::SAMPLER_PIXEL);
-
- D3D11_BUFFER_DESC constantBufferDescription = {0};
- d3d11::InitConstantBufferDesc(&constantBufferDescription, requiredSize);
- ANGLE_TRY(mRenderer->allocateResource(constantBufferDescription, &mDriverConstantBufferPS));
-
- ID3D11Buffer *driverVSConstants = mDriverConstantBufferPS.get();
- deviceContext->PSSetConstantBuffers(d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DRIVER, 1,
- &driverVSConstants);
- }
-
- // 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(deviceContext, gl::SAMPLER_VERTEX, programD3D,
- mDriverConstantBufferVS));
- ANGLE_TRY(mShaderConstants.updateBuffer(deviceContext, gl::SAMPLER_PIXEL, programD3D,
- mDriverConstantBufferPS));
-
- // 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())
- {
- if (mCurrentGeometryConstantBuffer != mDriverConstantBufferPS.getSerial())
- {
- ASSERT(mDriverConstantBufferPS.valid());
- deviceContext->GSSetConstantBuffers(0, 1, mDriverConstantBufferPS.getPointer());
- mCurrentGeometryConstantBuffer = mDriverConstantBufferPS.getSerial();
- }
- }
-
- return gl::NoError();
-}
-
-gl::Error StateManager11::applyComputeUniforms(ProgramD3D *programD3D)
-{
- UniformStorage11 *computeUniformStorage =
- GetAs<UniformStorage11>(&programD3D->getComputeUniformStorage());
- ASSERT(computeUniformStorage);
-
- const d3d11::Buffer *constantBuffer = nullptr;
- ANGLE_TRY(computeUniformStorage->getConstantBuffer(mRenderer, &constantBuffer));
-
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
-
- if (computeUniformStorage->size() > 0 && programD3D->areComputeUniformsDirty())
- {
- 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 (!mDriverConstantBufferCS.valid())
- {
- size_t requiredSize = mShaderConstants.getRequiredBufferSize(gl::SAMPLER_COMPUTE);
-
- D3D11_BUFFER_DESC constantBufferDescription = {0};
- d3d11::InitConstantBufferDesc(&constantBufferDescription, requiredSize);
- ANGLE_TRY(mRenderer->allocateResource(constantBufferDescription, &mDriverConstantBufferCS));
- ID3D11Buffer *buffer = mDriverConstantBufferCS.get();
- deviceContext->CSSetConstantBuffers(d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DRIVER, 1,
- &buffer);
- }
-
- ANGLE_TRY(mShaderConstants.updateBuffer(deviceContext, gl::SAMPLER_COMPUTE, *programD3D,
- mDriverConstantBufferCS));
-
- return gl::NoError();
-}
-
-gl::Error StateManager11::syncUniformBuffers(const gl::Context *context, ProgramD3D *programD3D)
-{
- unsigned int reservedVertex = mRenderer->getReservedVertexUniformBuffers();
- unsigned int reservedFragment = mRenderer->getReservedFragmentUniformBuffers();
-
- programD3D->updateUniformBufferCache(context->getCaps(), reservedVertex, reservedFragment);
-
- const auto &vertexUniformBuffers = programD3D->getVertexUniformBufferCache();
- const auto &fragmentUniformBuffers = programD3D->getFragmentUniformBufferCache();
- const auto &glState = context->getGLState();
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
- ID3D11DeviceContext1 *deviceContext1 = mRenderer->getDeviceContext1IfSupported();
-
- for (size_t bufferIndex = 0; bufferIndex < vertexUniformBuffers.size(); bufferIndex++)
- {
- GLint binding = vertexUniformBuffers[bufferIndex];
-
- if (binding == -1)
- {
- continue;
- }
-
- const auto &uniformBuffer = glState.getIndexedUniformBuffer(binding);
- GLintptr uniformBufferOffset = uniformBuffer.getOffset();
- 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);
-
- if (mCurrentConstantBufferVS[bufferIndex] == constantBuffer->getSerial() &&
- mCurrentConstantBufferVSOffset[bufferIndex] == uniformBufferOffset &&
- mCurrentConstantBufferVSSize[bufferIndex] == uniformBufferSize)
- {
- continue;
- }
-
- unsigned int appliedIndex = reservedVertex + static_cast<unsigned int>(bufferIndex);
-
- 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;
- }
-
- for (size_t bufferIndex = 0; bufferIndex < fragmentUniformBuffers.size(); bufferIndex++)
- {
- GLint binding = fragmentUniformBuffers[bufferIndex];
-
- if (binding == -1)
- {
- continue;
- }
-
- const auto &uniformBuffer = glState.getIndexedUniformBuffer(binding);
- GLintptr uniformBufferOffset = uniformBuffer.getOffset();
- 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);
-
- if (mCurrentConstantBufferPS[bufferIndex] == constantBuffer->getSerial() &&
- mCurrentConstantBufferPSOffset[bufferIndex] == uniformBufferOffset &&
- mCurrentConstantBufferPSSize[bufferIndex] == uniformBufferSize)
- {
- continue;
- }
-
- unsigned int appliedIndex = reservedFragment + static_cast<unsigned int>(bufferIndex);
-
- 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;
- }
-
- return gl::NoError();
-}
-
-gl::Error StateManager11::syncTransformFeedbackBuffers(const gl::Context *context)
-{
- const auto &glState = context->getGLState();
-
- 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 gl::NoError();
- }
-
- gl::TransformFeedback *transformFeedback = glState.getCurrentTransformFeedback();
- TransformFeedback11 *tf11 = GetImplAs<TransformFeedback11>(transformFeedback);
- if (mAppliedTFSerial == tf11->getSerial() && !tf11->isDirty())
- {
- return gl::NoError();
- }
-
- const std::vector<ID3D11Buffer *> *soBuffers = nullptr;
- ANGLE_TRY_RESULT(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 gl::NoError();
-}
-
-// DrawCallVertexParams implementation.
-DrawCallVertexParams::DrawCallVertexParams(GLint firstVertex,
- GLsizei vertexCount,
- GLsizei instances)
- : mHasIndexRange(nullptr),
- mFirstVertex(firstVertex),
- mVertexCount(vertexCount),
- mInstances(instances),
- mBaseVertex(0)
-{
-}
-
-// Use when in a drawElements call.
-DrawCallVertexParams::DrawCallVertexParams(bool firstVertexDefinitelyZero,
- const gl::HasIndexRange &hasIndexRange,
- GLint baseVertex,
- GLsizei instances)
- : mHasIndexRange(&hasIndexRange),
- mFirstVertex(),
- mVertexCount(0),
- mInstances(instances),
- mBaseVertex(baseVertex)
-{
- if (firstVertexDefinitelyZero)
- {
- mFirstVertex = baseVertex;
- }
-}
-
-GLint DrawCallVertexParams::firstVertex() const
-{
- if (!mFirstVertex.valid())
- {
- ensureResolved();
- ASSERT(mFirstVertex.valid());
- }
- return mFirstVertex.value();
-}
-
-GLsizei DrawCallVertexParams::vertexCount() const
-{
- ensureResolved();
- return mVertexCount;
-}
-
-GLsizei DrawCallVertexParams::instances() const
-{
- return mInstances;
-}
-
-void DrawCallVertexParams::ensureResolved() const
-{
- if (mHasIndexRange)
- {
- ASSERT(!mFirstVertex.valid() || mFirstVertex == mBaseVertex);
-
- // Resolve the index range now if we need to.
- const auto &indexRange = mHasIndexRange->getIndexRange().value();
- mFirstVertex = mBaseVertex + static_cast<GLint>(indexRange.start);
- mVertexCount = static_cast<GLsizei>(indexRange.vertexCount());
- mHasIndexRange = nullptr;
- }
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.h
deleted file mode 100644
index e48bc83a22..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.h
+++ /dev/null
@@ -1,557 +0,0 @@
-//
-// 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/ContextState.h"
-#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/RenderStateCache.h"
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-
-namespace rx
-{
-
-struct RenderTargetDesc;
-struct Renderer11DeviceCaps;
-
-class ShaderConstants11 : angle::NonCopyable
-{
- public:
- ShaderConstants11();
- ~ShaderConstants11();
-
- void init(const gl::Caps &caps);
- size_t getRequiredBufferSize(gl::SamplerType samplerType) 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);
- void onSamplerChange(gl::SamplerType samplerType,
- unsigned int samplerIndex,
- const gl::Texture &texture);
-
- gl::Error updateBuffer(ID3D11DeviceContext *deviceContext,
- gl::SamplerType samplerType,
- const ProgramD3D &programD3D,
- const d3d11::Buffer &driverConstantBuffer);
-
- private:
- struct Vertex
- {
- Vertex()
- : depthRange{.0f},
- viewAdjust{.0f},
- viewCoords{.0f},
- viewScale{.0f},
- multiviewWriteToViewportIndex{.0f},
- padding{.0f}
- {
- }
-
- 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;
-
- // Added here to manually pad the struct.
- float padding;
- };
-
- 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) {}
-
- int baseLevel;
- int internalFormatBits;
- int wrapModes;
- int padding; // This just pads the struct to 16 bytes
- };
-
- static_assert(sizeof(SamplerMetadata) == 16u,
- "Sampler metadata struct must be one 4-vec / 16 bytes.");
-
- // Return true if dirty.
- bool updateSamplerMetadata(SamplerMetadata *data, const gl::Texture &texture);
-
- Vertex mVertex;
- bool mVertexDirty;
- Pixel mPixel;
- bool mPixelDirty;
- Compute mCompute;
- bool mComputeDirty;
-
- std::vector<SamplerMetadata> mSamplerMetadataVS;
- bool mSamplerMetadataVSDirty;
- std::vector<SamplerMetadata> mSamplerMetadataPS;
- bool mSamplerMetadataPSDirty;
- std::vector<SamplerMetadata> mSamplerMetadataCS;
- bool mSamplerMetadataCSDirty;
-};
-
-class DrawCallVertexParams final : angle::NonCopyable
-{
- public:
- // Use when in a drawArrays call.
- DrawCallVertexParams(GLint firstVertex, GLsizei vertexCount, GLsizei instances);
-
- // Use when in a drawElements call.
- DrawCallVertexParams(bool firstVertexDefinitelyZero,
- const gl::HasIndexRange &hasIndexRange,
- GLint baseVertex,
- GLsizei instances);
-
- // It should be possible to also use an overload to handle the 'slow' indirect draw path.
- // TODO(jmadill): Indirect draw slow path overload.
-
- GLint firstVertex() const;
- GLsizei vertexCount() const;
- GLsizei instances() const;
-
- private:
- void ensureResolved() const;
-
- mutable const gl::HasIndexRange *mHasIndexRange;
- mutable Optional<GLint> mFirstVertex;
- mutable GLsizei mVertexCount;
- GLsizei mInstances;
- GLint mBaseVertex;
-};
-
-class StateManager11 final : angle::NonCopyable
-{
- public:
- StateManager11(Renderer11 *renderer);
- ~StateManager11();
-
- gl::Error initialize(const gl::Caps &caps, const gl::Extensions &extensions);
- void deinitialize();
-
- void syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits);
-
- gl::Error 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 VertexArray11 to trigger attribute translation.
- void invalidateVertexAttributeTranslation();
-
- void setRenderTarget(ID3D11RenderTargetView *rtv, ID3D11DepthStencilView *dsv);
- void setRenderTargets(ID3D11RenderTargetView **rtvs, UINT numRtvs, ID3D11DepthStencilView *dsv);
-
- void onBeginQuery(Query11 *query);
- void onDeleteQueryObject(Query11 *query);
- gl::Error onMakeCurrent(const gl::Context *context);
-
- void setInputLayout(const d3d11::InputLayout *inputLayout);
-
- // TODO(jmadill): Migrate to d3d11::Buffer.
- bool queueVertexBufferChange(size_t bufferIndex,
- ID3D11Buffer *buffer,
- UINT stride,
- UINT offset);
- bool queueVertexOffsetChange(size_t bufferIndex, UINT offsetOnly);
- void applyVertexBufferChanges();
-
- void setSingleVertexBuffer(const d3d11::Buffer *buffer, UINT stride, UINT offset);
-
- gl::Error updateState(const gl::Context *context, GLenum drawMode);
-
- void setShaderResourceShared(gl::SamplerType shaderType,
- UINT resourceSlot,
- const d3d11::SharedSRV *srv);
- void setShaderResource(gl::SamplerType 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);
-
- // Not handled by an internal dirty bit because of the extra draw parameters.
- gl::Error applyVertexBuffer(const gl::Context *context,
- GLenum mode,
- const DrawCallVertexParams &vertexParams,
- bool isIndexedRendering);
-
- gl::Error applyIndexBuffer(const gl::Context *context,
- const void *indices,
- GLsizei count,
- GLenum type,
- const gl::HasIndexRange &lazyIndexRange,
- bool usePrimitiveRestartWorkaround);
-
- void setIndexBuffer(ID3D11Buffer *buffer, DXGI_FORMAT indexFormat, unsigned int offset);
-
- gl::Error updateVertexOffsetsForPointSpritesEmulation(GLint startVertex,
- GLsizei emulatedInstanceId);
-
- // TODO(jmadill): Should be private.
- gl::Error applyComputeUniforms(ProgramD3D *programD3D);
-
- // Only used in testing.
- InputLayoutCache *getInputLayoutCache() { return &mInputLayoutCache; }
-
- private:
- template <typename SRVType>
- void setShaderResourceInternal(gl::SamplerType shaderType,
- UINT resourceSlot,
- const SRVType *srv);
-
- bool unsetConflictingView(ID3D11View *view);
- bool unsetConflictingSRVs(gl::SamplerType shaderType,
- uintptr_t resource,
- const gl::ImageIndex *index);
- void unsetConflictingAttachmentResources(const gl::FramebufferAttachment *attachment,
- ID3D11Resource *resource);
-
- gl::Error syncBlendState(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::BlendState &blendState,
- const gl::ColorF &blendColor,
- unsigned int sampleMask);
-
- gl::Error syncDepthStencilState(const gl::State &glState);
-
- gl::Error syncRasterizerState(const gl::Context *context, bool pointDrawMode);
-
- void syncScissorRectangle(const gl::Rectangle &scissor, bool enabled);
-
- void syncViewport(const gl::Context *context);
-
- void checkPresentPath(const gl::Context *context);
-
- gl::Error syncFramebuffer(const gl::Context *context, gl::Framebuffer *framebuffer);
- gl::Error syncProgram(const gl::Context *context, GLenum drawMode);
-
- gl::Error syncTextures(const gl::Context *context);
- gl::Error applyTextures(const gl::Context *context, gl::SamplerType shaderType);
-
- gl::Error setSamplerState(const gl::Context *context,
- gl::SamplerType type,
- int index,
- gl::Texture *texture,
- const gl::SamplerState &sampler);
- gl::Error setTexture(const gl::Context *context,
- gl::SamplerType type,
- int index,
- gl::Texture *texture);
-
- // Faster than calling setTexture a jillion times
- gl::Error clearTextures(gl::SamplerType samplerType, size_t rangeStart, size_t rangeEnd);
- void handleMultiviewDrawFramebufferChange(const gl::Context *context);
-
- gl::Error syncCurrentValueAttribs(const gl::State &glState);
-
- gl::Error generateSwizzle(const gl::Context *context, gl::Texture *texture);
- gl::Error generateSwizzlesForShader(const gl::Context *context, gl::SamplerType type);
- gl::Error generateSwizzles(const gl::Context *context);
-
- gl::Error applyDriverUniforms(const ProgramD3D &programD3D);
- gl::Error applyUniforms(ProgramD3D *programD3D);
-
- gl::Error syncUniformBuffers(const gl::Context *context, ProgramD3D *programD3D);
- gl::Error syncTransformFeedbackBuffers(const gl::Context *context);
-
- // These are currently only called internally.
- void invalidateTexturesAndSamplers();
- void invalidateDriverUniforms();
- void invalidateProgramUniforms();
- void invalidateProgramUniformBuffers();
- void invalidateConstantBuffer(unsigned int slot);
-
- // Called by the Framebuffer11 directly.
- void processFramebufferInvalidation(const gl::Context *context);
-
- bool syncIndexBuffer(ID3D11Buffer *buffer, DXGI_FORMAT indexFormat, unsigned int offset);
-
- 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_TEXTURE_AND_SAMPLER_STATE,
- DIRTY_BIT_PROGRAM_UNIFORMS,
- DIRTY_BIT_DRIVER_UNIFORMS,
- DIRTY_BIT_PROGRAM_UNIFORM_BUFFERS,
- DIRTY_BIT_SHADERS,
- DIRTY_BIT_CURRENT_VALUE_ATTRIBS,
- DIRTY_BIT_INVALID,
- DIRTY_BIT_MAX = DIRTY_BIT_INVALID,
- };
-
- using DirtyBits = angle::BitSet<DIRTY_BIT_MAX>;
-
- Renderer11 *mRenderer;
-
- // Internal dirty bits.
- DirtyBits mInternalDirtyBits;
-
- // 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;
-
- // The viewport offsets are guaranteed to be updated whenever the gl::State::DirtyBits are
- // resolved and can be applied to the viewport and scissor whenever the internal viewport and
- // scissor bits are resolved.
- std::vector<gl::Offset> mViewportOffsets;
-
- // 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
- struct SRVRecord
- {
- uintptr_t srv;
- uintptr_t resource;
- D3D11_SHADER_RESOURCE_VIEW_DESC desc;
- };
-
- // A cache of current SRVs that also tracks the highest 'used' (non-NULL) SRV
- // We might want to investigate a more robust approach that is also fast when there's
- // a large gap between used SRVs (e.g. if SRV 0 and 7 are non-NULL, this approach will
- // waste time on SRVs 1-6.)
- class SRVCache : angle::NonCopyable
- {
- public:
- SRVCache();
- ~SRVCache();
-
- void initialize(size_t size) { mCurrentSRVs.resize(size); }
-
- size_t size() const { return mCurrentSRVs.size(); }
- size_t highestUsed() const { return mHighestUsedSRV; }
-
- const SRVRecord &operator[](size_t index) const { return mCurrentSRVs[index]; }
- void clear();
- void update(size_t resourceIndex, ID3D11ShaderResourceView *srv);
-
- private:
- std::vector<SRVRecord> mCurrentSRVs;
- size_t mHighestUsedSRV;
- };
-
- SRVCache mCurVertexSRVs;
- SRVCache mCurPixelSRVs;
-
- // A block of NULL pointers, cached so we don't re-allocate every draw call
- std::vector<ID3D11ShaderResourceView *> mNullSRVs;
-
- // Current translations of "Current-Value" data - owned by Context, not VertexArray.
- gl::AttributesMask mDirtyCurrentValueAttribs;
- std::vector<TranslatedAttribute> mCurrentValueAttribs;
-
- // Current applied input layout.
- ResourceSerial mCurrentInputLayout;
- bool mInputLayoutIsDirty;
- bool mVertexAttribsNeedTranslation;
-
- // Current applied vertex states.
- // TODO(jmadill): Figure out how to use ResourceSerial here.
- std::array<ID3D11Buffer *, gl::MAX_VERTEX_ATTRIBS> mCurrentVertexBuffers;
- std::array<UINT, gl::MAX_VERTEX_ATTRIBS> mCurrentVertexStrides;
- std::array<UINT, gl::MAX_VERTEX_ATTRIBS> mCurrentVertexOffsets;
- gl::RangeUI mDirtyVertexBufferRange;
-
- // Currently applied primitive topology
- D3D11_PRIMITIVE_TOPOLOGY mCurrentPrimitiveTopology;
-
- // Currently applied shaders
- ResourceSerial mAppliedVertexShader;
- ResourceSerial mAppliedGeometryShader;
- ResourceSerial mAppliedPixelShader;
- ResourceSerial mAppliedComputeShader;
-
- // Currently applied sampler states
- std::vector<bool> mForceSetVertexSamplerStates;
- std::vector<gl::SamplerState> mCurVertexSamplerStates;
-
- std::vector<bool> mForceSetPixelSamplerStates;
- std::vector<gl::SamplerState> mCurPixelSamplerStates;
-
- std::vector<bool> mForceSetComputeSamplerStates;
- std::vector<gl::SamplerState> mCurComputeSamplerStates;
-
- // 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.
- d3d11::Buffer mDriverConstantBufferVS;
- d3d11::Buffer mDriverConstantBufferPS;
- d3d11::Buffer mDriverConstantBufferCS;
-
- ResourceSerial mCurrentComputeConstantBuffer;
- ResourceSerial mCurrentGeometryConstantBuffer;
-
- 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;
-
- // Currently applied transform feedback buffers
- Serial mAppliedTFSerial;
-
- Serial mEmptySerial;
-
- bool mIsTransformFeedbackCurrentlyActiveUnpaused;
-};
-
-} // namespace rx
-#endif // LIBANGLE_RENDERER_D3D11_STATEMANAGER11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StreamProducerNV12.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StreamProducerNV12.cpp
deleted file mode 100644
index 1981b5f7b2..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StreamProducerNV12.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// 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.
-//
-
-// StreamProducerNV12.cpp: Implements the stream producer for NV12 textures
-
-#include "libANGLE/renderer/d3d/d3d11/StreamProducerNV12.h"
-
-#include "common/utilities.h"
-#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-
-namespace rx
-{
-
-StreamProducerNV12::StreamProducerNV12(Renderer11 *renderer)
- : mRenderer(renderer), mTexture(nullptr), mArraySlice(0), mTextureWidth(0), mTextureHeight(0)
-{
-}
-
-StreamProducerNV12::~StreamProducerNV12()
-{
- SafeRelease(mTexture);
-}
-
-egl::Error StreamProducerNV12::validateD3DNV12Texture(void *pointer) 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";
- }
-
- // Get the description and validate it
- D3D11_TEXTURE2D_DESC desc;
- textureD3D->GetDesc(&desc);
- if (desc.Format != DXGI_FORMAT_NV12)
- {
- return egl::EglBadParameter() << "Texture format not DXGI_FORMAT_NV12";
- }
- if (desc.Width < 1 || desc.Height < 1)
- {
- return egl::EglBadParameter() << "Texture is of size 0";
- }
- if ((desc.Width % 2) != 0 || (desc.Height % 2) != 0)
- {
- return egl::EglBadParameter() << "Texture dimensions are not even";
- }
- return egl::NoError();
-}
-
-void StreamProducerNV12::postD3DNV12Texture(void *pointer, const egl::AttributeMap &attributes)
-{
- ASSERT(pointer != nullptr);
- ID3D11Texture2D *textureD3D = static_cast<ID3D11Texture2D *>(pointer);
-
- // Check that the texture originated from our device
- ID3D11Device *device;
- textureD3D->GetDevice(&device);
-
- // Get the description
- D3D11_TEXTURE2D_DESC desc;
- textureD3D->GetDesc(&desc);
-
- // Release the previous texture if there is one
- SafeRelease(mTexture);
-
- mTexture = textureD3D;
- mTexture->AddRef();
- mTextureWidth = desc.Width;
- mTextureHeight = desc.Height;
- mArraySlice = static_cast<UINT>(attributes.get(EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE, 0));
-}
-
-egl::Stream::GLTextureDescription StreamProducerNV12::getGLFrameDescription(int planeIndex)
-{
- // The UV plane of NV12 textures has half the width/height of the Y plane
- egl::Stream::GLTextureDescription desc;
- desc.width = (planeIndex == 0) ? mTextureWidth : (mTextureWidth / 2);
- desc.height = (planeIndex == 0) ? mTextureHeight : (mTextureHeight / 2);
- desc.internalFormat = (planeIndex == 0) ? GL_R8 : GL_RG8;
- desc.mipLevels = 0;
- return desc;
-}
-
-ID3D11Texture2D *StreamProducerNV12::getD3DTexture()
-{
- return mTexture;
-}
-
-UINT StreamProducerNV12::getArraySlice()
-{
- return mArraySlice;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StreamProducerNV12.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StreamProducerNV12.h
deleted file mode 100644
index 304c9dfe53..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StreamProducerNV12.h
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// 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.
-//
-
-// StreamProducerNV12.h: Interface for a NV12 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 StreamProducerNV12 : public StreamProducerImpl
-{
- public:
- StreamProducerNV12(Renderer11 *renderer);
- ~StreamProducerNV12() override;
-
- egl::Error validateD3DNV12Texture(void *pointer) const override;
- void postD3DNV12Texture(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 mTextureWidth;
- UINT mTextureHeight;
-};
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_STREAM11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
deleted file mode 100644
index e8f13b388f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
+++ /dev/null
@@ -1,1075 +0,0 @@
-//
-// 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/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 "third_party/trace_event/trace_event.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"
-
-#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(),
- mPassThroughPS(),
- 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();
- mPassThroughPS.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(const gl::Context *context,
- int backbufferWidth,
- int backbufferHeight)
-{
- if (mNeedsOffscreenTexture)
- {
- EGLint result = resetOffscreenColorBuffer(context, backbufferWidth, backbufferHeight);
- if (result != EGL_SUCCESS)
- {
- return result;
- }
- }
-
- EGLint result = resetOffscreenDepthBuffer(backbufferWidth, backbufferHeight);
- if (result != EGL_SUCCESS)
- {
- return result;
- }
-
- mWidth = backbufferWidth;
- mHeight = backbufferHeight;
-
- return EGL_SUCCESS;
-}
-
-EGLint SwapChain11::resetOffscreenColorBuffer(const gl::Context *context,
- int backbufferWidth,
- int backbufferHeight)
-{
- ASSERT(mNeedsOffscreenTexture);
-
- 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);
- ASSERT(SUCCEEDED(result));
-
- 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;
-
- gl::Error err = mRenderer->allocateTexture(offscreenTextureDesc, backbufferFormatInfo,
- &mOffscreenTexture);
- if (err.isError())
- {
- ERR() << "Could not create offscreen texture, " << err;
- 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 result = mOffscreenTexture.get()->QueryInterface(
- __uuidof(IDXGIResource), (void **)&offscreenTextureResource);
-
- // Fall back to no share handle on failure
- if (FAILED(result))
- {
- ERR() << "Could not query offscreen texture resource, " << gl::FmtHR(result);
- }
- else
- {
- result = offscreenTextureResource->GetSharedHandle(&mShareHandle);
- SafeRelease(offscreenTextureResource);
-
- if (FAILED(result))
- {
- mShareHandle = nullptr;
- ERR() << "Could not get offscreen texture shared handle, " << gl::FmtHR(result);
- }
- }
- }
- }
-
- // 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;
-
- gl::Error err =
- mRenderer->allocateResource(offscreenRTVDesc, mOffscreenTexture.get(), &mOffscreenRTView);
- ASSERT(!err.isError());
- 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)
- {
- err = mRenderer->allocateResource(offscreenSRVDesc, mOffscreenTexture.get(),
- &mOffscreenSRView);
- ASSERT(!err.isError());
- 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(context, 0, 0, backbufferWidth, backbufferHeight);
- }
- }
-
- return EGL_SUCCESS;
-}
-
-EGLint SwapChain11::resetOffscreenDepthBuffer(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;
-
- gl::Error err = mRenderer->allocateTexture(depthStencilTextureDesc, depthBufferFormatInfo,
- &mDepthStencilTexture);
- if (err.isError())
- {
- ERR() << "Could not create depthstencil surface for new swap chain, " << err;
- 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;
-
- err = mRenderer->allocateResource(depthStencilDesc, mDepthStencilTexture.get(),
- &mDepthStencilDSView);
- ASSERT(!err.isError());
- 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);
-
- err = mRenderer->allocateResource(depthStencilSRVDesc, mDepthStencilTexture.get(),
- &mDepthStencilSRView);
- ASSERT(!err.isError());
- mDepthStencilSRView.setDebugName("Offscreen depth stencil shader resource");
- }
- }
-
- return EGL_SUCCESS;
-}
-
-EGLint SwapChain11::resize(const gl::Context *context,
- EGLint backbufferWidth,
- EGLint backbufferHeight)
-{
- 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 result = mSwapChain->GetDesc(&desc);
- if (FAILED(result))
- {
- ERR() << "Error reading swap chain description, " << gl::FmtHR(result);
- release();
- return EGL_BAD_ALLOC;
- }
-
- result = mSwapChain->ResizeBuffers(desc.BufferCount, backbufferWidth, backbufferHeight, getSwapChainNativeFormat(), 0);
-
- if (FAILED(result))
- {
- ERR() << "Error resizing swap chain buffers, " << gl::FmtHR(result);
- release();
-
- if (d3d11::isDeviceLostError(result))
- {
- return EGL_CONTEXT_LOST;
- }
- else
- {
- return EGL_BAD_ALLOC;
- }
- }
-
- ID3D11Texture2D *backbufferTexture = nullptr;
- result = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D),
- reinterpret_cast<void **>(&backbufferTexture));
- ASSERT(SUCCEEDED(result));
- if (SUCCEEDED(result))
- {
-#ifndef ANGLE_ENABLE_WINDOWS_STORE
- if (mNativeWindow->getNativeWindow())
- InvalidateRect(mNativeWindow->getNativeWindow(), nullptr, FALSE);
-#endif
- const auto &format =
- d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps());
- mBackBufferTexture.set(backbufferTexture, format);
- mBackBufferTexture.setDebugName("Back buffer texture");
-
- gl::Error err =
- mRenderer->allocateResourceNoDesc(mBackBufferTexture.get(), &mBackBufferRTView);
- ASSERT(!err.isError());
- mBackBufferRTView.setDebugName("Back buffer render target");
-
- err = mRenderer->allocateResourceNoDesc(mBackBufferTexture.get(), &mBackBufferSRView);
- ASSERT(!err.isError());
- mBackBufferSRView.setDebugName("Back buffer shader resource");
- }
-
- mFirstSwap = true;
-
- return resetOffscreenBuffers(context, 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(const gl::Context *context,
- 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(context, backbufferWidth, backbufferHeight);
- }
-
- 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 result = mNativeWindow->createSwapChain(
- device, mRenderer->getDxgiFactory(), getSwapChainNativeFormat(), backbufferWidth,
- backbufferHeight, getD3DSamples(), &mSwapChain);
-
- if (FAILED(result))
- {
- ERR() << "Could not create additional swap chains or offscreen surfaces, "
- << gl::FmtHR(result);
- release();
-
- if (d3d11::isDeviceLostError(result))
- {
- return EGL_CONTEXT_LOST;
- }
- else
- {
- return EGL_BAD_ALLOC;
- }
- }
-
- if (mRenderer->getRenderer11DeviceCaps().supportsDXGI1_2)
- {
- mSwapChain1 = d3d11::DynamicCastComObject<IDXGISwapChain1>(mSwapChain);
- }
-
- ID3D11Texture2D *backbufferTex = nullptr;
- result = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D),
- reinterpret_cast<LPVOID *>(&backbufferTex));
- ASSERT(SUCCEEDED(result));
- const auto &format =
- d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps());
- mBackBufferTexture.set(backbufferTex, format);
- mBackBufferTexture.setDebugName("Back buffer texture");
-
- gl::Error err =
- mRenderer->allocateResourceNoDesc(mBackBufferTexture.get(), &mBackBufferRTView);
- ASSERT(!err.isError());
- mBackBufferRTView.setDebugName("Back buffer render target");
-
- err = mRenderer->allocateResourceNoDesc(mBackBufferTexture.get(), &mBackBufferSRView);
- ASSERT(!err.isError());
- mBackBufferSRView.setDebugName("Back buffer shader resource view");
- }
-
- mFirstSwap = true;
-
- return resetOffscreenBuffers(context, backbufferWidth, backbufferHeight);
-}
-
-void SwapChain11::initPassThroughResources()
-{
- if (mPassThroughResourcesInit)
- {
- return;
- }
-
- 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() && !mPassThroughPS.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;
-
- gl::Error err = mRenderer->allocateResource(vbDesc, &mQuadVB);
- ASSERT(!err.isError());
- 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;
-
- err = mRenderer->allocateResource(samplerDesc, &mPassThroughSampler);
- ASSERT(!err.isError());
- 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);
-
- err = mRenderer->allocateResource(quadElements, &vertexShaderData, &mPassThroughIL);
- ASSERT(!err.isError());
- mPassThroughIL.setDebugName("Swap chain pass through layout");
-
- err = mRenderer->allocateResource(vertexShaderData, &mPassThroughVS);
- ASSERT(!err.isError());
- mPassThroughVS.setDebugName("Swap chain pass through vertex shader");
-
- if (mEGLSamples <= 1)
- {
- ShaderData pixelShaderData(g_PS_PassthroughRGBA2D);
- err = mRenderer->allocateResource(pixelShaderData, &mPassThroughPS);
- }
- else
- {
- ShaderData pixelShaderData(g_PS_PassthroughRGBA2DMS);
- err = mRenderer->allocateResource(pixelShaderData, &mPassThroughPS);
- }
-
- ASSERT(!err.isError());
- mPassThroughPS.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;
-
- err = mRenderer->allocateResource(rasterizerDesc, &mPassThroughRS);
- ASSERT(!err.isError());
- mPassThroughRS.setDebugName("Swap chain pass through rasterizer state");
-
- mPassThroughResourcesInit = true;
-}
-
-// parameters should be validated/clamped by caller
-EGLint SwapChain11::swapRect(const gl::Context *context,
- EGLint x,
- EGLint y,
- EGLint width,
- EGLint height)
-{
- if (mNeedsOffscreenTexture)
- {
- EGLint result = copyOffscreenToBackbuffer(context, x, y, width, height);
- if (result != EGL_SUCCESS)
- {
- return result;
- }
- }
-
- EGLint result = present(context, x, y, width, height);
- if (result != EGL_SUCCESS)
- {
- return result;
- }
-
- mRenderer->onSwap();
-
- return EGL_SUCCESS;
-}
-
-EGLint SwapChain11::copyOffscreenToBackbuffer(const gl::Context *context,
- EGLint x,
- EGLint y,
- EGLint width,
- EGLint height)
-{
- if (!mSwapChain)
- {
- return EGL_SUCCESS;
- }
-
- initPassThroughResources();
-
- 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(width)) * 2.0f - 1.0f;
- float y1 = (y / float(height)) * 2.0f - 1.0f;
- float x2 = ((x + width) / float(width)) * 2.0f - 1.0f;
- float y2 = ((y + height) / float(height)) * 2.0f - 1.0f;
-
- float u1 = x / float(width);
- float v1 = y / float(height);
- float u2 = (x + width) / float(width);
- float v2 = (y + height) / float(height);
- // 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, &mPassThroughPS);
-
- // 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(const gl::Context *context,
- 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()
-{
- 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;
- gl::Error err = mRenderer->allocateTexture(offscreenCopyDesc, backbufferFormatInfo,
- &mOffscreenTextureCopyForSRV);
- ASSERT(!err.isError());
- 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);
-
- err = mRenderer->allocateResource(offscreenSRVDesc, mOffscreenTextureCopyForSRV.get(),
- &mOffscreenSRView);
- ASSERT(!err.isError());
- 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
-}
-
-void *rx::SwapChain11::getDevice()
-{
- return mRenderer->getDevice();
-}
-
-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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h
deleted file mode 100644
index eca068210b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h
+++ /dev/null
@@ -1,137 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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(const gl::Context *context,
- EGLint backbufferWidth,
- EGLint backbufferHeight) override;
- EGLint reset(const gl::Context *context,
- EGLint backbufferWidth,
- EGLint backbufferHeight,
- EGLint swapInterval) override;
- EGLint swapRect(const gl::Context *context,
- 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();
-
- 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; }
-
- void *getDevice() override;
-
- egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override;
-
- private:
- void release();
- void initPassThroughResources();
-
- void releaseOffscreenColorBuffer();
- void releaseOffscreenDepthBuffer();
- EGLint resetOffscreenBuffers(const gl::Context *context,
- int backbufferWidth,
- int backbufferHeight);
- EGLint resetOffscreenColorBuffer(const gl::Context *context,
- int backbufferWidth,
- int backbufferHeight);
- EGLint resetOffscreenDepthBuffer(int backbufferWidth, int backbufferHeight);
-
- DXGI_FORMAT getSwapChainNativeFormat() const;
-
- EGLint copyOffscreenToBackbuffer(const gl::Context *context,
- EGLint x,
- EGLint y,
- EGLint width,
- EGLint height);
- EGLint present(const gl::Context *context, 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 mPassThroughPS;
- d3d11::RasterizerState mPassThroughRS;
-
- SurfaceRenderTarget11 mColorRenderTarget;
- SurfaceRenderTarget11 mDepthStencilRenderTarget;
-
- EGLint mEGLSamples;
- LONGLONG mQPCFrequency;
-};
-
-} // namespace rx
-#endif // LIBANGLE_RENDERER_D3D_D3D11_SWAPCHAIN11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
deleted file mode 100644
index b702450ded..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
+++ /dev/null
@@ -1,3155 +0,0 @@
-//
-// 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/formatutils.h"
-#include "libANGLE/ImageIndex.h"
-#include "libANGLE/renderer/d3d/d3d11/Blit11.h"
-#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
-#include "libANGLE/renderer/d3d/d3d11/Image11.h"
-#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
-#include "libANGLE/renderer/d3d/d3d11/StreamProducerNV12.h"
-#include "libANGLE/renderer/d3d/d3d11/SwapChain11.h"
-#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
-#include "libANGLE/renderer/d3d/EGLImageD3D.h"
-#include "libANGLE/renderer/d3d/TextureD3D.h"
-
-namespace rx
-{
-
-namespace
-{
-
-void InvalidateRenderTarget(const gl::Context *context, RenderTarget11 *renderTarget)
-{
- if (renderTarget)
- {
- renderTarget->signalDirty(context);
- }
-}
-
-RenderTarget11 *GetRenderTarget(std::unique_ptr<RenderTarget11> *pointer)
-{
- return pointer->get();
-}
-
-template <typename KeyT>
-RenderTarget11 *GetRenderTarget(std::pair<KeyT, std::unique_ptr<RenderTarget11>> *pair)
-{
- return pair->second.get();
-}
-
-template <typename T>
-void InvalidateRenderTargetContainer(const gl::Context *context, T *renderTargetContainer)
-{
- for (auto &rt : *renderTargetContainer)
- {
- InvalidateRenderTarget(context, GetRenderTarget(&rt));
- }
-}
-
-} // anonymous namespace
-
-TextureStorage11::SRVKey::SRVKey(int baseLevel, int mipLevels, bool swizzle, bool dropStencil)
- : baseLevel(baseLevel), mipLevels(mipLevels), swizzle(swizzle), dropStencil(dropStencil)
-{
-}
-
-bool TextureStorage11::SRVKey::operator<(const SRVKey &rhs) const
-{
- return std::tie(baseLevel, mipLevels, swizzle, dropStencil) <
- std::tie(rhs.baseLevel, rhs.mipLevels, rhs.swizzle, rhs.dropStencil);
-}
-
-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()
-{
- mSrvCache.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.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);
-}
-
-gl::Error TextureStorage11::getMippedResource(const gl::Context *context,
- const TextureHelper11 **outResource)
-{
- return getResource(context, outResource);
-}
-
-UINT TextureStorage11::getSubresourceIndex(const gl::ImageIndex &index) const
-{
- UINT mipSlice = static_cast<UINT>(index.mipIndex + mTopLevel);
- UINT arraySlice = static_cast<UINT>(index.hasLayer() ? index.layerIndex : 0);
- UINT subresource = D3D11CalcSubresource(mipSlice, arraySlice, mMipLevels);
- ASSERT(subresource != std::numeric_limits<UINT>::max());
- return subresource;
-}
-
-gl::Error TextureStorage11::getSRV(const gl::Context *context,
- const gl::TextureState &textureState,
- const d3d11::SharedSRV **outSRV)
-{
- // Make sure to add the level offset for our tiny compressed texture workaround
- const GLuint effectiveBaseLevel = textureState.getEffectiveBaseLevel();
- bool swizzleRequired = textureState.swizzleRequired();
- bool mipmapping = gl::IsMipmapFiltered(textureState.getSamplerState());
- 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->getWorkarounds().zeroMaxLodWorkaround)
- {
- // 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.
- bool workaround = mRenderer->getWorkarounds().emulateTinyStencilTextures;
- // 2. this is a stencil texture.
- bool hasStencil = (mFormatInfo.format().stencilBits > 0);
- // 3. the texture has a 1x1 or 2x2 mip.
- int effectiveTopLevel = effectiveBaseLevel + mipLevels - 1;
- bool hasSmallMips =
- (getLevelWidth(effectiveTopLevel) <= 2 || getLevelHeight(effectiveTopLevel) <= 2);
-
- bool useDropStencil = (workaround && hasStencil && hasSmallMips);
- SRVKey key(effectiveBaseLevel, mipLevels, swizzleRequired, useDropStencil);
- if (useDropStencil)
- {
- // Ensure drop texture gets created.
- DropStencil result = DropStencil::CREATED;
- ANGLE_TRY_RESULT(ensureDropStencilTexture(context), result);
-
- // Clear the SRV cache if necessary.
- // TODO(jmadill): Re-use find query result.
- auto srvEntry = mSrvCache.find(key);
- if (result == DropStencil::CREATED && srvEntry != mSrvCache.end())
- {
- mSrvCache.erase(key);
- }
- }
-
- ANGLE_TRY(getCachedOrCreateSRV(context, key, outSRV));
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11::getCachedOrCreateSRV(const gl::Context *context,
- const SRVKey &key,
- const d3d11::SharedSRV **outSRV)
-{
- auto iter = mSrvCache.find(key);
- if (iter != mSrvCache.end())
- {
- *outSRV = &iter->second;
- return gl::NoError();
- }
-
- 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(&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(createSRV(context, key.baseLevel, key.mipLevels, format, *texture, &srv));
-
- const auto &insertIt = mSrvCache.insert(std::make_pair(key, std::move(srv)));
- *outSRV = &insertIt.first->second;
-
- return gl::NoError();
-}
-
-gl::Error 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(
- createSRV(context, mipLevel, 1, resourceFormat, *resource, &levelSRVs[mipLevel]));
- }
- }
-
- *outSRV = &levelSRVs[mipLevel];
-
- return gl::NoError();
-}
-
-gl::Error 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->getWorkarounds().zeroMaxLodWorkaround)
- {
- // 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.
-
- SRVKey key(baseLevel, mipLevels, false, false);
- ANGLE_TRY(getCachedOrCreateSRV(context, key, outSRV));
-
- return gl::NoError();
-}
-
-const d3d11::Format &TextureStorage11::getFormatSet() const
-{
- return mFormatInfo;
-}
-
-gl::Error 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(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 gl::NoError();
-}
-
-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));
- }
-}
-
-gl::Error 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.mipIndex;
-
- 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 (index.mipIndex > 0 && mRenderer->getWorkarounds().zeroMaxLodWorkaround)
- {
- ANGLE_TRY(getMippedResource(context, &dstTexture));
- }
- else
- {
- ANGLE_TRY(getResource(context, &dstTexture));
- }
-
- unsigned int dstSubresource = getSubresourceIndex(index);
-
- 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(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 gl::NoError();
-}
-
-gl::Error 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.mipIndex > 0 && mRenderer->getWorkarounds().zeroMaxLodWorkaround)
- {
- ANGLE_TRY(getMippedResource(context, &srcTexture));
- }
- else
- {
- ANGLE_TRY(getResource(context, &srcTexture));
- }
-
- ASSERT(srcTexture->valid());
-
- unsigned int srcSubresource = getSubresourceIndex(index);
-
- 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 gl::NoError();
-}
-
-gl::Error TextureStorage11::generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex)
-{
- ASSERT(sourceIndex.layerIndex == destIndex.layerIndex);
-
- markLevelDirty(destIndex.mipIndex);
-
- 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();
- 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();
- GLenum format = gl::GetUnsizedFormat(source->getInternalFormat());
- return blitter->copyTexture(context, sourceSRV, sourceArea, sourceSize, format, destRTV,
- destArea, destSize, nullptr, format, 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();
- mSrvCache.clear();
-
- for (size_t level = 0; level < mLevelSRVs.size(); level++)
- {
- mLevelSRVs[level].reset();
- mLevelBlitSRVs[level].reset();
- }
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error 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.mipIndex);
-
- const TextureHelper11 *resource = nullptr;
- ANGLE_TRY(getResource(context, &resource));
- ASSERT(resource && resource->valid());
-
- UINT destSubresource = getSubresourceIndex(index);
-
- const gl::InternalFormat &internalFormatInfo =
- gl::GetInternalFormatInfo(image->getInternalFormat(), type);
-
- gl::Box levelBox(0, 0, 0, getLevelWidth(index.mipIndex), getLevelHeight(index.mipIndex),
- getLevelDepth(index.mipIndex));
- 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);
-
- const int imageWidth = static_cast<int>(image->getWidth());
- const int width = destBox ? destBox->width : imageWidth;
- const int imageHeight = static_cast<int>(image->getHeight());
- const int height = destBox ? destBox->height : imageHeight;
- const int imageDepth = static_cast<int>(image->getDepth());
- const int depth = destBox ? destBox->depth : imageDepth;
- if (imageWidth < width || imageHeight < height || imageDepth < depth)
- fullUpdate = true;
- GLuint srcRowPitch = 0;
- ANGLE_TRY_RESULT(
- internalFormatInfo.computeRowPitch(type, width, unpack.alignment, unpack.rowLength),
- srcRowPitch);
- GLuint srcDepthPitch = 0;
- ANGLE_TRY_RESULT(internalFormatInfo.computeDepthPitch(height, unpack.imageHeight, srcRowPitch),
- srcDepthPitch);
- GLuint srcSkipBytes = 0;
- ANGLE_TRY_RESULT(
- internalFormatInfo.computeSkipBytes(srcRowPitch, srcDepthPitch, unpack, index.is3D()),
- 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(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 gl::NoError();
-}
-
-gl::ErrorOrResult<TextureStorage11::DropStencil> TextureStorage11::ensureDropStencilTexture(
- const gl::Context *context)
-{
- UNIMPLEMENTED();
- return gl::InternalError() << "Drop stencil texture not implemented.";
-}
-
-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->getWorkarounds().zeroMaxLodWorkaround);
-}
-
-gl::Error 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();
- }
-
- // Invalidate RenderTargets.
- InvalidateRenderTargetContainer(context, &mRenderTarget);
- InvalidateRenderTarget(context, mLevelZeroRenderTarget.get());
-
- return gl::NoError();
-}
-
-TextureStorage11_2D::~TextureStorage11_2D()
-{
-}
-
-gl::Error TextureStorage11_2D::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
-{
- ASSERT(destStorage);
-
- TextureStorage11_2D *dest11 = GetAs<TextureStorage11_2D>(destStorage);
- ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext();
-
- if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
- {
- // 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 gl::NoError();
- }
-
- 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 gl::NoError();
-}
-
-gl::Error TextureStorage11_2D::useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture)
-{
- bool lastSetting = mUseLevelZeroTexture;
-
- if (useLevelZeroTexture && mMipLevels > 1)
- {
- if (!mUseLevelZeroTexture && mTexture.valid())
- {
- ANGLE_TRY(ensureTextureExists(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(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;
- }
-
- if (lastSetting != mUseLevelZeroTexture)
- {
- // Mark everything as dirty to be conservative.
- if (mLevelZeroRenderTarget)
- {
- mLevelZeroRenderTarget->signalDirty(context);
- }
- for (auto &renderTarget : mRenderTarget)
- {
- if (renderTarget)
- {
- renderTarget->signalDirty(context);
- }
- }
- }
-
- return gl::NoError();
-}
-
-void TextureStorage11_2D::associateImage(Image11 *image, const gl::ImageIndex &index)
-{
- const GLint level = index.mipIndex;
-
- 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.mipIndex;
-
- 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.mipIndex;
-
- 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.
-gl::Error TextureStorage11_2D::releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage)
-{
- const GLint level = index.mipIndex;
-
- 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 gl::NoError();
-}
-
-gl::Error TextureStorage11_2D::getResource(const gl::Context *context,
- const TextureHelper11 **outResource)
-{
- if (mUseLevelZeroTexture && mMipLevels > 1)
- {
- ANGLE_TRY(ensureTextureExists(1));
-
- *outResource = &mLevelZeroTexture;
- return gl::NoError();
- }
-
- ANGLE_TRY(ensureTextureExists(mMipLevels));
-
- *outResource = &mTexture;
- return gl::NoError();
-}
-
-gl::Error 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->getWorkarounds().zeroMaxLodWorkaround);
-
- ANGLE_TRY(ensureTextureExists(mMipLevels));
-
- *outResource = &mTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2D::ensureTextureExists(int mipLevels)
-{
- // If mMipLevels = 1 then always use mTexture rather than mLevelZeroTexture.
- bool useLevelZeroTexture = mRenderer->getWorkarounds().zeroMaxLodWorkaround
- ? (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(desc, mFormatInfo, outputTexture));
- outputTexture->setDebugName("TexStorage2D.Texture");
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2D::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
-{
- ASSERT(!index.hasLayer());
-
- const int level = index.mipIndex;
- 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 gl::NoError();
- }
-
- if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
- {
- ASSERT(index.mipIndex == 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));
-
- 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(rtvDesc, mLevelZeroTexture.get(), &rtv));
-
- 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 gl::NoError();
- }
-
- 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(rtvDesc, texture->get(), &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 gl::NoError();
- }
-
- 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(dsvDesc, texture->get(), &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 gl::NoError();
-}
-
-gl::Error TextureStorage11_2D::createSRV(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->getWorkarounds().zeroMaxLodWorkaround)
- {
- 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(1));
- srvTexture = &mLevelZeroTexture;
- }
- else
- {
- ASSERT(mipLevels == static_cast<int>(mMipLevels));
- ASSERT(mTexture.valid() && texture == mTexture);
- srvTexture = &mTexture;
- }
- }
-
- ANGLE_TRY(mRenderer->allocateResource(srvDesc, srvTexture->get(), outSRV));
- outSRV->setDebugName("TexStorage2D.SRV");
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2D::getSwizzleTexture(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(desc, format, &mSwizzleTexture));
- mSwizzleTexture.setDebugName("TexStorage2D.SwizzleTexture");
- }
-
- *outTexture = &mSwizzleTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2D::getSwizzleRenderTarget(int mipLevel,
- const d3d11::RenderTargetView **outRTV)
-{
- ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
- ASSERT(outRTV);
-
- if (!mSwizzleRenderTargets[mipLevel].valid())
- {
- const TextureHelper11 *swizzleTexture = nullptr;
- ANGLE_TRY(getSwizzleTexture(&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(rtvDesc, mSwizzleTexture.get(),
- &mSwizzleRenderTargets[mipLevel]));
- }
-
- *outRTV = &mSwizzleRenderTargets[mipLevel];
- return gl::NoError();
-}
-
-gl::ErrorOrResult<TextureStorage11::DropStencil> TextureStorage11_2D::ensureDropStencilTexture(
- const gl::Context *context)
-{
- if (mDropStencilTexture.valid())
- {
- return DropStencil::ALREADY_EXISTS;
- }
-
- 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(dropDesc, format, &mDropStencilTexture));
- mDropStencilTexture.setDebugName("TexStorage2D.DropStencil");
-
- ANGLE_TRY(initDropStencilTexture(context, gl::ImageIndexIterator::Make2D(0, mMipLevels)));
-
- return DropStencil::CREATED;
-}
-
-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::D3D11TextureNV12);
- StreamProducerNV12 *producer = static_cast<StreamProducerNV12 *>(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;
-}
-
-gl::Error 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 gl::NoError();
-}
-
-TextureStorage11_External::~TextureStorage11_External()
-{
-}
-
-gl::Error TextureStorage11_External::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
-{
- UNIMPLEMENTED();
- return gl::NoError();
-}
-
-void TextureStorage11_External::associateImage(Image11 *image, const gl::ImageIndex &index)
-{
- ASSERT(index.mipIndex == 0);
- mAssociatedImage = image;
-}
-
-void TextureStorage11_External::verifyAssociatedImageValid(const gl::ImageIndex &index,
- Image11 *expectedImage)
-{
- ASSERT(index.mipIndex == 0 && mAssociatedImage == expectedImage);
-}
-
-void TextureStorage11_External::disassociateImage(const gl::ImageIndex &index,
- Image11 *expectedImage)
-{
- ASSERT(index.mipIndex == 0);
- ASSERT(mAssociatedImage == expectedImage);
- mAssociatedImage = nullptr;
-}
-
-gl::Error TextureStorage11_External::releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage)
-{
- ASSERT(index.mipIndex == 0);
-
- if (mAssociatedImage != nullptr && mAssociatedImage != incomingImage)
- {
- mAssociatedImage->verifyAssociatedStorageValid(this);
-
- ANGLE_TRY(mAssociatedImage->recoverFromAssociatedStorage(context));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_External::getResource(const gl::Context *context,
- const TextureHelper11 **outResource)
-{
- *outResource = &mTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_External::getMippedResource(const gl::Context *context,
- const TextureHelper11 **outResource)
-{
- *outResource = &mTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_External::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
-{
- // Render targets are not supported for external textures
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureStorage11_External::createSRV(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(srvDesc, texture.get(), outSRV));
- outSRV->setDebugName("TexStorage2D.SRV");
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_External::getSwizzleTexture(const TextureHelper11 **outTexture)
-{
- UNIMPLEMENTED();
- return gl::InternalError();
-}
-
-gl::Error TextureStorage11_External::getSwizzleRenderTarget(int mipLevel,
- const d3d11::RenderTargetView **outRTV)
-{
- UNIMPLEMENTED();
- return gl::InternalError();
-}
-
-TextureStorage11_EGLImage::TextureStorage11_EGLImage(Renderer11 *renderer,
- EGLImageD3D *eglImage,
- RenderTarget11 *renderTarget11)
- : TextureStorage11(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()
-{
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error TextureStorage11_EGLImage::getSRV(const gl::Context *context,
- const gl::TextureState &textureState,
- const d3d11::SharedSRV **outSRV)
-{
- ANGLE_TRY(checkForUpdatedRenderTarget(context));
- return TextureStorage11::getSRV(context, textureState, outSRV);
-}
-
-gl::Error 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.
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureStorage11_EGLImage::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
-{
- ASSERT(!index.hasLayer());
- ASSERT(index.mipIndex == 0);
-
- ANGLE_TRY(checkForUpdatedRenderTarget(context));
-
- return mImage->getRenderTarget(context, outRT);
-}
-
-gl::Error 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 gl::NoError();
-}
-
-void TextureStorage11_EGLImage::associateImage(Image11 *, const gl::ImageIndex &)
-{
-}
-
-void TextureStorage11_EGLImage::disassociateImage(const gl::ImageIndex &, Image11 *)
-{
-}
-
-void TextureStorage11_EGLImage::verifyAssociatedImageValid(const gl::ImageIndex &, Image11 *)
-{
-}
-
-gl::Error TextureStorage11_EGLImage::releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &,
- Image11 *)
-{
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_EGLImage::useLevelZeroWorkaroundTexture(const gl::Context *context, bool)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureStorage11_EGLImage::getSwizzleTexture(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(desc, format, &mSwizzleTexture));
- mSwizzleTexture.setDebugName("TexStorageEGLImage.SwizzleTexture");
- }
-
- *outTexture = &mSwizzleTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_EGLImage::getSwizzleRenderTarget(int mipLevel,
- const d3d11::RenderTargetView **outRTV)
-{
- ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
- ASSERT(outRTV);
-
- if (!mSwizzleRenderTargets[mipLevel].valid())
- {
- const TextureHelper11 *swizzleTexture = nullptr;
- ANGLE_TRY(getSwizzleTexture(&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(rtvDesc, mSwizzleTexture.get(),
- &mSwizzleRenderTargets[mipLevel]));
- }
-
- *outRTV = &mSwizzleRenderTargets[mipLevel];
- return gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-gl::Error TextureStorage11_EGLImage::createSRV(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(srvDesc, texture.get(), outSRV));
- outSRV->setDebugName("TexStorageEGLImage.SRV");
- }
- else
- {
- RenderTarget11 *renderTarget = nullptr;
- ANGLE_TRY(getImageRenderTarget(context, &renderTarget));
-
- ASSERT(texture == renderTarget->getTexture());
-
- *outSRV = renderTarget->getShaderResourceView().makeCopy();
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_EGLImage::getImageRenderTarget(const gl::Context *context,
- RenderTarget11 **outRT) const
-{
- RenderTargetD3D *renderTargetD3D = nullptr;
- ANGLE_TRY(mImage->getRenderTarget(context, &renderTargetD3D));
- *outRT = GetAs<RenderTarget11>(renderTargetD3D);
- return gl::NoError();
-}
-
-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::CUBE_FACE_COUNT; face++)
- {
- mAssociatedImages[face][level] = nullptr;
- mRenderTarget[face][level] = nullptr;
- }
- }
-
- for (unsigned int face = 0; face < gl::CUBE_FACE_COUNT; 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->getWorkarounds().zeroMaxLodWorkaround);
-}
-
-gl::Error 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::CUBE_FACE_COUNT; 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));
- }
- }
- }
-
- for (auto &faceRenderTargets : mRenderTarget)
- {
- InvalidateRenderTargetContainer(context, &faceRenderTargets);
- }
- InvalidateRenderTargetContainer(context, &mLevelZeroRenderTarget);
-
- return gl::NoError();
-}
-
-TextureStorage11_Cube::~TextureStorage11_Cube()
-{
-}
-
-UINT TextureStorage11_Cube::getSubresourceIndex(const gl::ImageIndex &index) const
-{
- if (mRenderer->getWorkarounds().zeroMaxLodWorkaround && mUseLevelZeroTexture &&
- index.mipIndex == 0)
- {
- UINT arraySlice = static_cast<UINT>(index.hasLayer() ? index.layerIndex : 0);
- UINT subresource = D3D11CalcSubresource(0, arraySlice, 1);
- ASSERT(subresource != std::numeric_limits<UINT>::max());
- return subresource;
- }
- else
- {
- UINT mipSlice = static_cast<UINT>(index.mipIndex + mTopLevel);
- UINT arraySlice = static_cast<UINT>(index.hasLayer() ? index.layerIndex : 0);
- UINT subresource = D3D11CalcSubresource(mipSlice, arraySlice, mMipLevels);
- ASSERT(subresource != std::numeric_limits<UINT>::max());
- return subresource;
- }
-}
-
-gl::Error TextureStorage11_Cube::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
-{
- ASSERT(destStorage);
-
- TextureStorage11_Cube *dest11 = GetAs<TextureStorage11_Cube>(destStorage);
-
- if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
- {
- 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 gl::NoError();
-}
-
-gl::Error TextureStorage11_Cube::useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture)
-{
- if (useLevelZeroTexture && mMipLevels > 1)
- {
- if (!mUseLevelZeroTexture && mTexture.valid())
- {
- ANGLE_TRY(ensureTextureExists(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(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 gl::NoError();
-}
-
-void TextureStorage11_Cube::associateImage(Image11 *image, const gl::ImageIndex &index)
-{
- const GLint level = index.mipIndex;
- const GLint layerTarget = index.layerIndex;
-
- ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
- ASSERT(0 <= layerTarget && layerTarget < static_cast<GLint>(gl::CUBE_FACE_COUNT));
-
- if (0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- {
- if (0 <= layerTarget && layerTarget < static_cast<GLint>(gl::CUBE_FACE_COUNT))
- {
- mAssociatedImages[layerTarget][level] = image;
- }
- }
-}
-
-void TextureStorage11_Cube::verifyAssociatedImageValid(const gl::ImageIndex &index,
- Image11 *expectedImage)
-{
- const GLint level = index.mipIndex;
- const GLint layerTarget = index.layerIndex;
-
- ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
- ASSERT(0 <= layerTarget && layerTarget < static_cast<GLint>(gl::CUBE_FACE_COUNT));
- // 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.mipIndex;
- const GLint layerTarget = index.layerIndex;
-
- ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
- ASSERT(0 <= layerTarget && layerTarget < static_cast<GLint>(gl::CUBE_FACE_COUNT));
- 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.
-gl::Error TextureStorage11_Cube::releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage)
-{
- const GLint level = index.mipIndex;
- const GLint layerTarget = index.layerIndex;
-
- ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
- ASSERT(0 <= layerTarget && layerTarget < static_cast<GLint>(gl::CUBE_FACE_COUNT));
-
- if ((0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
- {
- if (0 <= layerTarget && layerTarget < static_cast<GLint>(gl::CUBE_FACE_COUNT))
- {
- // 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 gl::NoError();
-}
-
-gl::Error TextureStorage11_Cube::getResource(const gl::Context *context,
- const TextureHelper11 **outResource)
-{
- if (mUseLevelZeroTexture && mMipLevels > 1)
- {
- ANGLE_TRY(ensureTextureExists(1));
- *outResource = &mLevelZeroTexture;
- return gl::NoError();
- }
- else
- {
- ANGLE_TRY(ensureTextureExists(mMipLevels));
- *outResource = &mTexture;
- return gl::NoError();
- }
-}
-
-gl::Error 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->getWorkarounds().zeroMaxLodWorkaround);
-
- ANGLE_TRY(ensureTextureExists(mMipLevels));
- *outResource = &mTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_Cube::ensureTextureExists(int mipLevels)
-{
- // If mMipLevels = 1 then always use mTexture rather than mLevelZeroTexture.
- bool useLevelZeroTexture = mRenderer->getWorkarounds().zeroMaxLodWorkaround
- ? (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::CUBE_FACE_COUNT;
- 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(desc, mFormatInfo, outputTexture));
- outputTexture->setDebugName("TexStorageCube.Texture");
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_Cube::createRenderTargetSRV(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.mipIndex;
- srvDesc.Texture2DArray.MipLevels = 1;
- srvDesc.Texture2DArray.FirstArraySlice = index.layerIndex;
- 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(srvDesc, texture.get(), srv));
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_Cube::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
-{
- const int faceIndex = index.layerIndex;
- const int level = index.mipIndex;
-
- ASSERT(level >= 0 && level < getLevelCount());
- ASSERT(faceIndex >= 0 && faceIndex < static_cast<GLint>(gl::CUBE_FACE_COUNT));
-
- if (!mRenderTarget[faceIndex][level])
- {
- if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
- {
- ASSERT(index.mipIndex == 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(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 gl::NoError();
- }
-
- d3d11::SharedSRV srv;
- ANGLE_TRY(createRenderTargetSRV(*texture, index, mFormatInfo.srvFormat, &srv));
- d3d11::SharedSRV blitSRV;
- if (mFormatInfo.blitSRVFormat != mFormatInfo.srvFormat)
- {
- ANGLE_TRY(createRenderTargetSRV(*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(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(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 gl::NoError();
-}
-
-gl::Error TextureStorage11_Cube::createSRV(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::CUBE_FACE_COUNT;
- }
- else
- {
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
- srvDesc.TextureCube.MipLevels = mipLevels;
- srvDesc.TextureCube.MostDetailedMip = mTopLevel + baseLevel;
- }
-
- const TextureHelper11 *srvTexture = &texture;
-
- if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
- {
- 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(1));
- srvTexture = &mLevelZeroTexture;
- }
- else
- {
- ASSERT(mipLevels == static_cast<int>(mMipLevels));
- ASSERT(mTexture.valid() && texture == mTexture);
- srvTexture = &mTexture;
- }
- }
-
- ANGLE_TRY(mRenderer->allocateResource(srvDesc, srvTexture->get(), outSRV));
- outSRV->setDebugName("TexStorageCube.SRV");
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_Cube::getSwizzleTexture(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::CUBE_FACE_COUNT;
- 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(desc, format, &mSwizzleTexture));
- mSwizzleTexture.setDebugName("TexStorageCube.SwizzleTexture");
- }
-
- *outTexture = &mSwizzleTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_Cube::getSwizzleRenderTarget(int mipLevel,
- const d3d11::RenderTargetView **outRTV)
-{
- ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
- ASSERT(outRTV);
-
- if (!mSwizzleRenderTargets[mipLevel].valid())
- {
- const TextureHelper11 *swizzleTexture = nullptr;
- ANGLE_TRY(getSwizzleTexture(&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::CUBE_FACE_COUNT;
-
- ANGLE_TRY(mRenderer->allocateResource(rtvDesc, mSwizzleTexture.get(),
- &mSwizzleRenderTargets[mipLevel]));
- }
-
- *outRTV = &mSwizzleRenderTargets[mipLevel];
- return gl::NoError();
-}
-
-gl::Error 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.mipIndex), getLevelHeight(index.mipIndex),
- 1);
- gl::Extents wholeSize(wholeArea.width, wholeArea.height, 1);
- UINT subresource = getSubresourceIndex(index);
- ANGLE_TRY(mRenderer->getBlitter()->copyDepthStencil(
- *sourceTexture, subresource, wholeArea, wholeSize, mDropStencilTexture, subresource,
- wholeArea, wholeSize, nullptr));
- }
-
- return gl::NoError();
-}
-
-gl::ErrorOrResult<TextureStorage11::DropStencil> TextureStorage11_Cube::ensureDropStencilTexture(
- const gl::Context *context)
-{
- if (mDropStencilTexture.valid())
- {
- return DropStencil::ALREADY_EXISTS;
- }
-
- 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(dropDesc, format, &mDropStencilTexture));
- mDropStencilTexture.setDebugName("TexStorageCube.DropStencil");
-
- ANGLE_TRY(initDropStencilTexture(context, gl::ImageIndexIterator::MakeCube(0, mMipLevels)));
-
- return DropStencil::CREATED;
-}
-
-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;
-}
-
-gl::Error 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));
- }
- }
-
- InvalidateRenderTargetContainer(context, &mLevelRenderTargets);
- InvalidateRenderTargetContainer(context, &mLevelLayerRenderTargets);
-
- return gl::NoError();
-}
-
-TextureStorage11_3D::~TextureStorage11_3D()
-{
-}
-
-void TextureStorage11_3D::associateImage(Image11 *image, const gl::ImageIndex &index)
-{
- const GLint level = index.mipIndex;
-
- 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.mipIndex;
-
- 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.mipIndex;
-
- 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.
-gl::Error TextureStorage11_3D::releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage)
-{
- const GLint level = index.mipIndex;
-
- 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 gl::NoError();
-}
-
-gl::Error 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(desc, mFormatInfo, &mTexture));
- mTexture.setDebugName("TexStorage3D.Texture");
- }
-
- *outResource = &mTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_3D::createSRV(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(srvDesc, texture.get(), outSRV));
- outSRV->setDebugName("TexStorage3D.SRV");
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_3D::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
-{
- const int mipLevel = index.mipIndex;
- ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
-
- ASSERT(mFormatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN);
-
- 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(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 gl::NoError();
- }
-
- const int layer = index.layerIndex;
-
- 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(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 gl::NoError();
-}
-
-gl::Error TextureStorage11_3D::getSwizzleTexture(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(desc, format, &mSwizzleTexture));
- mSwizzleTexture.setDebugName("TexStorage3D.SwizzleTexture");
- }
-
- *outTexture = &mSwizzleTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_3D::getSwizzleRenderTarget(int mipLevel,
- const d3d11::RenderTargetView **outRTV)
-{
- ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
- ASSERT(outRTV);
-
- if (!mSwizzleRenderTargets[mipLevel].valid())
- {
- const TextureHelper11 *swizzleTexture = nullptr;
- ANGLE_TRY(getSwizzleTexture(&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(rtvDesc, mSwizzleTexture.get(),
- &mSwizzleRenderTargets[mipLevel]));
- mSwizzleRenderTargets[mipLevel].setDebugName("TexStorage3D.SwizzleRTV");
- }
-
- *outRTV = &mSwizzleRenderTargets[mipLevel];
- return gl::NoError();
-}
-
-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;
-}
-
-gl::Error 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();
-
- InvalidateRenderTargetContainer(context, &mRenderTargets);
-
- return gl::NoError();
-}
-
-TextureStorage11_2DArray::~TextureStorage11_2DArray()
-{
-}
-
-void TextureStorage11_2DArray::associateImage(Image11 *image, const gl::ImageIndex &index)
-{
- const GLint level = index.mipIndex;
- const GLint layerTarget = index.layerIndex;
- const GLint numLayers = index.numLayers;
-
- 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.mipIndex;
- const GLint layerTarget = index.layerIndex;
- const GLint numLayers = index.numLayers;
-
- 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.mipIndex;
- const GLint layerTarget = index.layerIndex;
- const GLint numLayers = index.numLayers;
-
- 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.
-gl::Error TextureStorage11_2DArray::releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage)
-{
- const GLint level = index.mipIndex;
- const GLint layerTarget = index.layerIndex;
- const GLint numLayers = index.numLayers;
-
- 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 gl::NoError();
-}
-
-gl::Error 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(desc, mFormatInfo, &mTexture));
- mTexture.setDebugName("TexStorage2DArray.Texture");
- }
-
- *outResource = &mTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2DArray::createSRV(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(srvDesc, texture.get(), outSRV));
- outSRV->setDebugName("TexStorage2DArray.SRV");
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2DArray::createRenderTargetSRV(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.mipIndex;
- srvDesc.Texture2DArray.MipLevels = 1;
- srvDesc.Texture2DArray.FirstArraySlice = index.layerIndex;
- srvDesc.Texture2DArray.ArraySize = index.numLayers;
-
- ANGLE_TRY(mRenderer->allocateResource(srvDesc, texture.get(), srv));
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2DArray::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
-{
- ASSERT(index.hasLayer());
-
- const int mipLevel = index.mipIndex;
- const int layer = index.layerIndex;
- const int numLayers = index.numLayers;
-
- 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(*texture, index, mFormatInfo.srvFormat, &srv));
- d3d11::SharedSRV blitSRV;
- if (mFormatInfo.blitSRVFormat != mFormatInfo.srvFormat)
- {
- ANGLE_TRY(createRenderTargetSRV(*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(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(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 gl::NoError();
-}
-
-gl::Error TextureStorage11_2DArray::getSwizzleTexture(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(desc, format, &mSwizzleTexture));
- mSwizzleTexture.setDebugName("TexStorage2DArray.SwizzleTexture");
- }
-
- *outTexture = &mSwizzleTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2DArray::getSwizzleRenderTarget(int mipLevel,
- const d3d11::RenderTargetView **outRTV)
-{
- ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
- ASSERT(outRTV);
-
- if (!mSwizzleRenderTargets[mipLevel].valid())
- {
- const TextureHelper11 *swizzleTexture = nullptr;
- ANGLE_TRY(getSwizzleTexture(&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(rtvDesc, mSwizzleTexture.get(),
- &mSwizzleRenderTargets[mipLevel]));
- }
-
- *outRTV = &mSwizzleRenderTargets[mipLevel];
- return gl::NoError();
-}
-
-gl::ErrorOrResult<TextureStorage11::DropStencil> TextureStorage11_2DArray::ensureDropStencilTexture(
- const gl::Context *context)
-{
- if (mDropStencilTexture.valid())
- {
- return DropStencil::ALREADY_EXISTS;
- }
-
- 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(dropDesc, format, &mDropStencilTexture));
- mDropStencilTexture.setDebugName("TexStorage2DArray.DropStencil");
-
- std::vector<GLsizei> layerCounts(mMipLevels, mTextureDepth);
-
- ANGLE_TRY(initDropStencilTexture(
- context, gl::ImageIndexIterator::Make2DArray(0, mMipLevels, layerCounts.data())));
-
- return DropStencil::CREATED;
-}
-
-TextureStorage11_2DMultisample::TextureStorage11_2DMultisample(Renderer11 *renderer,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- int levels,
- int samples,
- bool fixedSampleLocations)
- : TextureStorage11(
- renderer,
- GetTextureBindFlags(internalformat, renderer->getRenderer11DeviceCaps(), true),
- GetTextureMiscFlags(internalformat, renderer->getRenderer11DeviceCaps(), true, levels),
- internalformat),
- mTexture(),
- mRenderTarget(nullptr)
-{
- // adjust size if needed for compressed textures
- d3d11::MakeValidSize(false, mFormatInfo.texFormat, &width, &height, &mTopLevel);
-
- mMipLevels = 1;
- mTextureWidth = width;
- mTextureHeight = height;
- mTextureDepth = 1;
- mSamples = samples;
- mFixedSampleLocations = fixedSampleLocations;
-}
-
-gl::Error TextureStorage11_2DMultisample::onDestroy(const gl::Context *context)
-{
- InvalidateRenderTarget(context, mRenderTarget.get());
- mRenderTarget.reset();
- return gl::NoError();
-}
-
-TextureStorage11_2DMultisample::~TextureStorage11_2DMultisample()
-{
-}
-
-gl::Error TextureStorage11_2DMultisample::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
-{
- UNIMPLEMENTED();
- return gl::InternalError() << "copyToStorage is unimplemented";
-}
-
-void TextureStorage11_2DMultisample::associateImage(Image11 *image, const gl::ImageIndex &index)
-{
-}
-
-void TextureStorage11_2DMultisample::verifyAssociatedImageValid(const gl::ImageIndex &index,
- Image11 *expectedImage)
-{
-}
-
-void TextureStorage11_2DMultisample::disassociateImage(const gl::ImageIndex &index,
- Image11 *expectedImage)
-{
-}
-
-gl::Error TextureStorage11_2DMultisample::releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage)
-{
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2DMultisample::getResource(const gl::Context *context,
- const TextureHelper11 **outResource)
-{
- ANGLE_TRY(ensureTextureExists(1));
-
- *outResource = &mTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2DMultisample::ensureTextureExists(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();
- 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(desc, mFormatInfo, &mTexture));
- mTexture.setDebugName("TexStorage2DMS.Texture");
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2DMultisample::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
-{
- ASSERT(!index.hasLayer());
-
- const int level = index.mipIndex;
- ASSERT(level == 0);
-
- ASSERT(outRT);
- if (mRenderTarget)
- {
- *outRT = mRenderTarget.get();
- return gl::NoError();
- }
-
- 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));
-
- 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(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 gl::NoError();
- }
-
- 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(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 gl::NoError();
-}
-
-gl::Error TextureStorage11_2DMultisample::createSRV(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(srvDesc, texture.get(), outSRV));
- outSRV->setDebugName("TexStorage2DMS.SRV");
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2DMultisample::getSwizzleTexture(const TextureHelper11 **outTexture)
-{
- UNIMPLEMENTED();
- return gl::InternalError() << "getSwizzleTexture is unimplemented.";
-}
-
-gl::Error TextureStorage11_2DMultisample::getSwizzleRenderTarget(
- int mipLevel,
- const d3d11::RenderTargetView **outRTV)
-{
- UNIMPLEMENTED();
- return gl::InternalError() << "getSwizzleRenderTarget is unimplemented.";
-}
-
-gl::ErrorOrResult<TextureStorage11::DropStencil>
-TextureStorage11_2DMultisample::ensureDropStencilTexture(const gl::Context *context)
-{
- UNIMPLEMENTED();
- return gl::InternalError() << "Drop stencil texture not implemented.";
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
deleted file mode 100644
index 336aa495a8..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
+++ /dev/null
@@ -1,589 +0,0 @@
-//
-// 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
-{
-struct ImageIndex;
-}
-
-namespace rx
-{
-class EGLImageD3D;
-class RenderTargetD3D;
-class RenderTarget11;
-class Renderer11;
-class SwapChain11;
-class Image11;
-struct Renderer11DeviceCaps;
-
-template <typename T>
-using TexLevelArray = std::array<T, gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS>;
-
-template <typename T>
-using CubeFaceArray = std::array<T, gl::CUBE_FACE_COUNT>;
-
-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;
- gl::Error getSRVLevels(const gl::Context *context,
- GLint baseLevel,
- GLint maxLevel,
- const d3d11::SharedSRV **outSRV);
- gl::Error generateSwizzles(const gl::Context *context, const gl::SwizzleState &swizzleTarget);
- void markLevelDirty(int mipLevel);
- void markDirty();
-
- gl::Error updateSubresourceLevel(const gl::Context *context,
- const TextureHelper11 &texture,
- unsigned int sourceSubresource,
- const gl::ImageIndex &index,
- const gl::Box &copyArea);
-
- gl::Error 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;
- gl::Error generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex) override;
- gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
- gl::Error 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;
-
- virtual gl::Error getSRV(const gl::Context *context,
- const gl::TextureState &textureState,
- const d3d11::SharedSRV **outSRV);
- virtual UINT getSubresourceIndex(const gl::ImageIndex &index) const;
- virtual gl::Error 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 gl::Error 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 gl::Error getMippedResource(const gl::Context *context,
- const TextureHelper11 **outResource);
-
- virtual gl::Error getSwizzleTexture(const TextureHelper11 **outTexture) = 0;
- virtual gl::Error getSwizzleRenderTarget(int mipLevel,
- const d3d11::RenderTargetView **outRTV) = 0;
- gl::Error 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 gl::ErrorOrResult<DropStencil> ensureDropStencilTexture(const gl::Context *context);
- gl::Error initDropStencilTexture(const gl::Context *context, const gl::ImageIndexIterator &it);
-
- // The baseLevel parameter should *not* have mTopLevel applied.
- virtual gl::Error createSRV(const gl::Context *context,
- int baseLevel,
- int mipLevels,
- DXGI_FORMAT format,
- const TextureHelper11 &texture,
- d3d11::SharedSRV *outSRV) = 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;
-
- TexLevelArray<gl::SwizzleState> mSwizzleCache;
- TextureHelper11 mDropStencilTexture;
-
- private:
- const UINT mBindFlags;
- const UINT mMiscFlags;
-
- struct SRVKey
- {
- SRVKey(int baseLevel, int mipLevels, bool swizzle, bool dropStencil);
-
- bool operator<(const SRVKey &rhs) const;
-
- int baseLevel = 0; // Without mTopLevel applied.
- int mipLevels = 0;
- bool swizzle = false;
- bool dropStencil = false;
- };
- typedef std::map<SRVKey, d3d11::SharedSRV> SRVCache;
-
- gl::Error getCachedOrCreateSRV(const gl::Context *context,
- const SRVKey &key,
- const d3d11::SharedSRV **outSRV);
-
- SRVCache mSrvCache;
- TexLevelArray<d3d11::SharedSRV> mLevelSRVs;
- 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;
-
- gl::Error onDestroy(const gl::Context *context) override;
-
- gl::Error getResource(const gl::Context *context, const TextureHelper11 **outResource) override;
- gl::Error getMippedResource(const gl::Context *context,
- const TextureHelper11 **outResource) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
-
- gl::Error 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;
- gl::Error releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage) override;
-
- gl::Error useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture) override;
-
- protected:
- gl::Error getSwizzleTexture(const TextureHelper11 **outTexture) override;
- gl::Error getSwizzleRenderTarget(int mipLevel, const d3d11::RenderTargetView **outRTV) override;
-
- gl::ErrorOrResult<DropStencil> ensureDropStencilTexture(const gl::Context *context) override;
-
- gl::Error ensureTextureExists(int mipLevels);
-
- private:
- gl::Error createSRV(const gl::Context *context,
- int baseLevel,
- int mipLevels,
- DXGI_FORMAT format,
- const TextureHelper11 &texture,
- d3d11::SharedSRV *outSRV) override;
-
- TextureHelper11 mTexture;
- 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;
- TexLevelArray<d3d11::RenderTargetView> mSwizzleRenderTargets;
-
- TexLevelArray<Image11 *> mAssociatedImages;
-};
-
-class TextureStorage11_External : public TextureStorage11
-{
- public:
- TextureStorage11_External(Renderer11 *renderer,
- egl::Stream *stream,
- const egl::Stream::GLTextureDescription &glDesc);
- ~TextureStorage11_External() override;
-
- gl::Error onDestroy(const gl::Context *context) override;
-
- gl::Error getResource(const gl::Context *context, const TextureHelper11 **outResource) override;
- gl::Error getMippedResource(const gl::Context *context,
- const TextureHelper11 **outResource) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
-
- gl::Error 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;
- gl::Error releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage) override;
-
- protected:
- gl::Error getSwizzleTexture(const TextureHelper11 **outTexture) override;
- gl::Error getSwizzleRenderTarget(int mipLevel, const d3d11::RenderTargetView **outRTV) override;
-
- private:
- gl::Error createSRV(const gl::Context *context,
- int baseLevel,
- int mipLevels,
- DXGI_FORMAT format,
- const TextureHelper11 &texture,
- d3d11::SharedSRV *outSRV) override;
-
- TextureHelper11 mTexture;
- int mSubresourceIndex;
- bool mHasKeyedMutex;
-
- Image11 *mAssociatedImage;
-};
-
-class TextureStorage11_EGLImage final : public TextureStorage11
-{
- public:
- TextureStorage11_EGLImage(Renderer11 *renderer,
- EGLImageD3D *eglImage,
- RenderTarget11 *renderTarget11);
- ~TextureStorage11_EGLImage() override;
-
- gl::Error getResource(const gl::Context *context, const TextureHelper11 **outResource) override;
- gl::Error getSRV(const gl::Context *context,
- const gl::TextureState &textureState,
- const d3d11::SharedSRV **outSRV) override;
- gl::Error getMippedResource(const gl::Context *context,
- const TextureHelper11 **outResource) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
-
- gl::Error 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;
- gl::Error releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage) override;
-
- gl::Error useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture) override;
-
- protected:
- gl::Error getSwizzleTexture(const TextureHelper11 **outTexture) override;
- gl::Error getSwizzleRenderTarget(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.
- gl::Error checkForUpdatedRenderTarget(const gl::Context *context);
-
- gl::Error createSRV(const gl::Context *context,
- int baseLevel,
- int mipLevels,
- DXGI_FORMAT format,
- const TextureHelper11 &texture,
- d3d11::SharedSRV *outSRV) override;
-
- gl::Error 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;
-
- gl::Error onDestroy(const gl::Context *context) override;
-
- UINT getSubresourceIndex(const gl::ImageIndex &index) const override;
-
- gl::Error getResource(const gl::Context *context, const TextureHelper11 **outResource) override;
- gl::Error getMippedResource(const gl::Context *context,
- const TextureHelper11 **outResource) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
-
- gl::Error 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;
- gl::Error releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage) override;
-
- gl::Error useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture) override;
-
- protected:
- gl::Error getSwizzleTexture(const TextureHelper11 **outTexture) override;
- gl::Error getSwizzleRenderTarget(int mipLevel, const d3d11::RenderTargetView **outRTV) override;
-
- gl::ErrorOrResult<DropStencil> ensureDropStencilTexture(const gl::Context *context) override;
-
- gl::Error ensureTextureExists(int mipLevels);
-
- private:
- gl::Error createSRV(const gl::Context *context,
- int baseLevel,
- int mipLevels,
- DXGI_FORMAT format,
- const TextureHelper11 &texture,
- d3d11::SharedSRV *outSRV) override;
- gl::Error createRenderTargetSRV(const TextureHelper11 &texture,
- const gl::ImageIndex &index,
- DXGI_FORMAT resourceFormat,
- d3d11::SharedSRV *srv) const;
-
- TextureHelper11 mTexture;
- CubeFaceArray<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;
- TexLevelArray<d3d11::RenderTargetView> mSwizzleRenderTargets;
-
- CubeFaceArray<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;
-
- gl::Error onDestroy(const gl::Context *context) override;
-
- gl::Error getResource(const gl::Context *context, const TextureHelper11 **outResource) override;
-
- // Handles both layer and non-layer RTs
- gl::Error 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;
- gl::Error releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage) override;
-
- protected:
- gl::Error getSwizzleTexture(const TextureHelper11 **outTexture) override;
- gl::Error getSwizzleRenderTarget(int mipLevel, const d3d11::RenderTargetView **outRTV) override;
-
- private:
- gl::Error createSRV(const gl::Context *context,
- int baseLevel,
- int mipLevels,
- DXGI_FORMAT format,
- const TextureHelper11 &texture,
- d3d11::SharedSRV *outSRV) override;
-
- typedef std::pair<int, int> LevelLayerKey;
- std::map<LevelLayerKey, std::unique_ptr<RenderTarget11>> mLevelLayerRenderTargets;
-
- TexLevelArray<std::unique_ptr<RenderTarget11>> mLevelRenderTargets;
-
- TextureHelper11 mTexture;
- TextureHelper11 mSwizzleTexture;
- TexLevelArray<d3d11::RenderTargetView> mSwizzleRenderTargets;
-
- 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;
-
- gl::Error onDestroy(const gl::Context *context) override;
-
- gl::Error getResource(const gl::Context *context, const TextureHelper11 **outResource) override;
- gl::Error 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;
- gl::Error releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage) override;
-
- protected:
- gl::Error getSwizzleTexture(const TextureHelper11 **outTexture) override;
- gl::Error getSwizzleRenderTarget(int mipLevel, const d3d11::RenderTargetView **outRTV) override;
-
- gl::ErrorOrResult<DropStencil> ensureDropStencilTexture(const gl::Context *context) override;
-
- private:
- 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;
- };
-
- private:
- gl::Error createSRV(const gl::Context *context,
- int baseLevel,
- int mipLevels,
- DXGI_FORMAT format,
- const TextureHelper11 &texture,
- d3d11::SharedSRV *outSRV) override;
- gl::Error createRenderTargetSRV(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;
- TexLevelArray<d3d11::RenderTargetView> mSwizzleRenderTargets;
-
- typedef std::map<LevelLayerRangeKey, Image11 *> ImageMap;
- ImageMap mAssociatedImages;
-};
-
-class TextureStorage11_2DMultisample : public TextureStorage11
-{
- public:
- TextureStorage11_2DMultisample(Renderer11 *renderer,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- int levels,
- int samples,
- bool fixedSampleLocations);
- ~TextureStorage11_2DMultisample() override;
-
- gl::Error onDestroy(const gl::Context *context) override;
-
- gl::Error getResource(const gl::Context *context, const TextureHelper11 **outResource) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
-
- gl::Error 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;
- gl::Error releaseAssociatedImage(const gl::Context *context,
- const gl::ImageIndex &index,
- Image11 *incomingImage) override;
-
- protected:
- gl::Error getSwizzleTexture(const TextureHelper11 **outTexture) override;
- gl::Error getSwizzleRenderTarget(int mipLevel, const d3d11::RenderTargetView **outRTV) override;
-
- gl::ErrorOrResult<DropStencil> ensureDropStencilTexture(const gl::Context *context) override;
-
- gl::Error ensureTextureExists(int mipLevels);
-
- private:
- gl::Error createSRV(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;
-};
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_TEXTURESTORAGE11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp
deleted file mode 100644
index 4b08edf71f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-//
-// 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()
-{
-}
-
-void TransformFeedback11::begin(GLenum 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;
- }
- }
-}
-
-void TransformFeedback11::end()
-{
- if (mRenderer->getWorkarounds().flushAfterEndingTransformFeedback)
- {
- mRenderer->getDeviceContext()->Flush();
- }
-}
-
-void TransformFeedback11::pause()
-{
-}
-
-void TransformFeedback11::resume()
-{
-}
-
-void TransformFeedback11::bindGenericBuffer(const gl::BindingPointer<gl::Buffer> &binding)
-{
-}
-
-void TransformFeedback11::bindIndexedBuffer(size_t index,
- const gl::OffsetBindingPointer<gl::Buffer> &binding)
-{
- mIsDirty = true;
- mBufferOffsets[index] = static_cast<UINT>(binding.getOffset());
-}
-
-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());
-}
-
-gl::ErrorOrResult<const std::vector<ID3D11Buffer *> *> TransformFeedback11::getSOBuffers(
- const gl::Context *context)
-{
- 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_RESULT(storage->getBuffer(context, BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK),
- mBuffers[bindingIdx]);
- }
- }
-
- return &mBuffers;
-}
-
-const std::vector<UINT> &TransformFeedback11::getSOBufferOffsets() const
-{
- return mBufferOffsets;
-}
-
-Serial TransformFeedback11::getSerial() const
-{
- return mSerial;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h
deleted file mode 100644
index cc9fcc335a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// 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;
-
- void begin(GLenum primitiveMode) override;
- void end() override;
- void pause() override;
- void resume() override;
-
- void bindGenericBuffer(const gl::BindingPointer<gl::Buffer> &binding) override;
- void bindIndexedBuffer(size_t index,
- const gl::OffsetBindingPointer<gl::Buffer> &binding) override;
-
- void onApply();
-
- bool isDirty() const;
-
- UINT getNumSOBuffers() const;
- gl::ErrorOrResult<const std::vector<ID3D11Buffer *> *> getSOBuffers(const gl::Context *context);
- 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp
deleted file mode 100644
index 29185a9d93..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-//
-// 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 <wrl.h>
-#include <wrl/wrappers/corewrappers.h>
-#include <windows.applicationmodel.core.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
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Trim11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Trim11.h
deleted file mode 100644
index 69fa05a57b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Trim11.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// 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/angletypes.h"
-#include "libANGLE/Error.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();
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_TRIM11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp
deleted file mode 100644
index 97c29415ed..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp
+++ /dev/null
@@ -1,413 +0,0 @@
-//
-// 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/d3d11/Buffer11.h"
-#include "libANGLE/renderer/d3d/d3d11/Context11.h"
-
-using namespace angle;
-
-namespace rx
-{
-
-namespace
-{
-OnBufferDataDirtyChannel *GetBufferBroadcastChannel(Buffer11 *buffer11,
- IndexStorageType storageType)
-{
- switch (storageType)
- {
- case IndexStorageType::Direct:
- return buffer11->getDirectBroadcastChannel();
- case IndexStorageType::Static:
- return buffer11->getStaticBroadcastChannel();
- case IndexStorageType::Dynamic:
- return buffer11 ? buffer11->getStaticBroadcastChannel() : nullptr;
- default:
- UNREACHABLE();
- return nullptr;
- }
-}
-} // anonymous namespace
-
-VertexArray11::VertexArray11(const gl::VertexArrayState &data)
- : VertexArrayImpl(data),
- mAttributeStorageTypes(data.getMaxAttribs(), VertexStorageType::CURRENT_VALUE),
- mTranslatedAttribs(data.getMaxAttribs()),
- mCurrentArrayBuffers(data.getMaxAttribs()),
- mCurrentElementArrayBuffer(),
- mOnArrayBufferDataDirty(),
- mOnElementArrayBufferDataDirty(this, mCurrentArrayBuffers.size()),
- mAppliedNumViewsToDivisor(1),
- mLastElementType(GL_NONE),
- mLastDrawElementsOffset(0),
- mCurrentElementArrayStorage(IndexStorageType::Invalid),
- mCachedIndexInfoValid(false)
-{
- for (size_t attribIndex = 0; attribIndex < mCurrentArrayBuffers.size(); ++attribIndex)
- {
- mOnArrayBufferDataDirty.emplace_back(this, attribIndex);
- }
-}
-
-VertexArray11::~VertexArray11()
-{
-}
-
-void VertexArray11::destroy(const gl::Context *context)
-{
- for (auto &buffer : mCurrentArrayBuffers)
- {
- if (buffer.get())
- {
- buffer.set(context, nullptr);
- }
- }
-
- mCurrentElementArrayBuffer.set(context, nullptr);
-}
-
-void VertexArray11::syncState(const gl::Context *context,
- const gl::VertexArray::DirtyBits &dirtyBits)
-{
- ASSERT(dirtyBits.any());
-
- // 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.
- Renderer11 *renderer = GetImplAs<Context11>(context)->getRenderer();
- mCurrentStateSerial = renderer->generateSerial();
-
- // TODO(jmadill): Individual attribute invalidation.
- renderer->getStateManager()->invalidateVertexBuffer();
-
- for (auto dirtyBit : dirtyBits)
- {
- if (dirtyBit == gl::VertexArray::DIRTY_BIT_ELEMENT_ARRAY_BUFFER)
- {
- mCachedIndexInfoValid = false;
- mLastElementType = GL_NONE;
- }
- else
- {
- size_t index = gl::VertexArray::GetVertexIndexFromDirtyBit(dirtyBit);
- // TODO(jiawei.shao@intel.com): Vertex Attrib Bindings
- ASSERT(index == mState.getBindingIndexFromAttribIndex(index));
- mAttribsToUpdate.set(index);
- }
- }
-}
-
-bool VertexArray11::flushAttribUpdates(const gl::Context *context)
-{
- if (mAttribsToUpdate.any())
- {
- const auto &activeLocations =
- context->getGLState().getProgram()->getActiveAttribLocationsMask();
-
- // Skip attrib locations the program doesn't use.
- gl::AttributesMask activeToUpdate = mAttribsToUpdate & activeLocations;
-
- for (auto toUpdateIndex : activeToUpdate)
- {
- mAttribsToUpdate.reset(toUpdateIndex);
- updateVertexAttribStorage(context, toUpdateIndex);
- }
-
- return true;
- }
-
- return false;
-}
-
-bool VertexArray11::updateElementArrayStorage(const gl::Context *context,
- GLenum elementType,
- GLenum destElementType,
- const void *indices)
-{
- unsigned int offset = static_cast<unsigned int>(reinterpret_cast<uintptr_t>(indices));
-
- if (mCachedIndexInfoValid && mLastElementType == elementType &&
- offset == mLastDrawElementsOffset)
- {
- // Dynamic index buffers must be re-streamed every draw.
- return (mCurrentElementArrayStorage == IndexStorageType::Dynamic);
- }
-
- gl::Buffer *newBuffer = mState.getElementArrayBuffer().get();
- gl::Buffer *oldBuffer = mCurrentElementArrayBuffer.get();
- bool needsTranslation = false;
- IndexStorageType newStorageType = ClassifyIndexStorage(
- context->getGLState(), newBuffer, elementType, destElementType, offset, &needsTranslation);
-
- if (newBuffer != oldBuffer)
- {
- mCurrentElementArrayBuffer.set(context, newBuffer);
- }
-
- if (newStorageType != mCurrentElementArrayStorage || newBuffer != oldBuffer)
- {
- Buffer11 *newBuffer11 = SafeGetImplAs<Buffer11>(newBuffer);
-
- auto *newChannel = GetBufferBroadcastChannel(newBuffer11, newStorageType);
-
- mCurrentElementArrayStorage = newStorageType;
- mOnElementArrayBufferDataDirty.bind(newChannel);
- needsTranslation = true;
- }
-
- if (mLastDrawElementsOffset != offset)
- {
- needsTranslation = true;
- mLastDrawElementsOffset = offset;
- }
-
- if (mLastElementType != elementType)
- {
- needsTranslation = true;
- mLastElementType = elementType;
- }
-
- // TODO(jmadill): We should probably promote static usage immediately, because this can change
- // the storage type for dynamic buffers.
- return needsTranslation || !mCachedIndexInfoValid;
-}
-
-void VertexArray11::updateVertexAttribStorage(const gl::Context *context, size_t attribIndex)
-{
- const auto &attrib = mState.getVertexAttribute(attribIndex);
- const auto &binding = mState.getBindingFromAttribIndex(attribIndex);
-
- // Note: having an unchanged storage type doesn't mean the attribute is clean.
- auto oldStorageType = mAttributeStorageTypes[attribIndex];
- auto newStorageType = ClassifyAttributeStorage(attrib, binding);
-
- mAttributeStorageTypes[attribIndex] = newStorageType;
-
- StateManager11 *stateManager = GetImplAs<Context11>(context)->getRenderer()->getStateManager();
-
- if (newStorageType == VertexStorageType::DYNAMIC)
- {
- if (oldStorageType != VertexStorageType::DYNAMIC)
- {
- // Sync dynamic attribs in a different set.
- mAttribsToTranslate.reset(attribIndex);
- mDynamicAttribsMask.set(attribIndex);
- }
- }
- else
- {
- mAttribsToTranslate.set(attribIndex);
- stateManager->invalidateVertexAttributeTranslation();
-
- if (oldStorageType == VertexStorageType::DYNAMIC)
- {
- ASSERT(mDynamicAttribsMask[attribIndex]);
- mDynamicAttribsMask.reset(attribIndex);
- }
- }
-
- gl::Buffer *oldBufferGL = mCurrentArrayBuffers[attribIndex].get();
- gl::Buffer *newBufferGL = binding.getBuffer().get();
- Buffer11 *oldBuffer11 = oldBufferGL ? GetImplAs<Buffer11>(oldBufferGL) : nullptr;
- Buffer11 *newBuffer11 = newBufferGL ? GetImplAs<Buffer11>(newBufferGL) : nullptr;
-
- if (oldBuffer11 != newBuffer11 || oldStorageType != newStorageType)
- {
- OnBufferDataDirtyChannel *newChannel = nullptr;
-
- if (newStorageType == VertexStorageType::CURRENT_VALUE)
- {
- stateManager->invalidateCurrentValueAttrib(attribIndex);
- }
- else if (newBuffer11 != nullptr)
- {
- // Note that for static callbacks, promotion to a static buffer from a dynamic buffer
- // means we need to tag dynamic buffers with static callbacks.
- switch (newStorageType)
- {
- case VertexStorageType::DIRECT:
- newChannel = newBuffer11->getDirectBroadcastChannel();
- break;
- case VertexStorageType::STATIC:
- case VertexStorageType::DYNAMIC:
- newChannel = newBuffer11->getStaticBroadcastChannel();
- break;
- default:
- UNREACHABLE();
- break;
- }
- }
-
- mOnArrayBufferDataDirty[attribIndex].bind(newChannel);
- mCurrentArrayBuffers[attribIndex].set(context, binding.getBuffer().get());
- }
-}
-
-bool VertexArray11::hasActiveDynamicAttrib(const gl::Context *context)
-{
- flushAttribUpdates(context);
- const auto &activeLocations =
- context->getGLState().getProgram()->getActiveAttribLocationsMask();
- auto activeDynamicAttribs = (mDynamicAttribsMask & activeLocations);
- return activeDynamicAttribs.any();
-}
-
-gl::Error VertexArray11::updateDirtyAndDynamicAttribs(const gl::Context *context,
- VertexDataManager *vertexDataManager,
- const DrawCallVertexParams &vertexParams)
-{
- flushAttribUpdates(context);
-
- const auto &glState = context->getGLState();
- const gl::Program *program = glState.getProgram();
- const auto &activeLocations = program->getActiveAttribLocationsMask();
- const auto &attribs = mState.getVertexAttributes();
- const auto &bindings = mState.getVertexBindings();
- mAppliedNumViewsToDivisor =
- (program != nullptr && program->usesMultiview()) ? program->getNumViews() : 1;
-
- if (mAttribsToTranslate.any())
- {
- // Skip attrib locations the program doesn't use, saving for the next frame.
- gl::AttributesMask dirtyActiveAttribs = (mAttribsToTranslate & activeLocations);
-
- for (auto dirtyAttribIndex : dirtyActiveAttribs)
- {
- 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(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;
- }
- }
- }
-
- if (mDynamicAttribsMask.any())
- {
- auto activeDynamicAttribs = (mDynamicAttribsMask & activeLocations);
- if (activeDynamicAttribs.none())
- {
- return gl::NoError();
- }
-
- for (auto 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, vertexParams.firstVertex(),
- vertexParams.vertexCount(), vertexParams.instances()));
- }
-
- return gl::NoError();
-}
-
-const std::vector<TranslatedAttribute> &VertexArray11::getTranslatedAttribs() const
-{
- return mTranslatedAttribs;
-}
-
-void VertexArray11::signal(size_t channelID, const gl::Context *context)
-{
- if (channelID == mAttributeStorageTypes.size())
- {
- mCachedIndexInfoValid = false;
- mLastElementType = GL_NONE;
- mLastDrawElementsOffset = 0;
- }
- else
- {
- ASSERT(mAttributeStorageTypes[channelID] != VertexStorageType::CURRENT_VALUE);
-
- // This can change a buffer's storage, we'll need to re-check.
- mAttribsToUpdate.set(channelID);
-
- // Changing the vertex attribute state can affect the vertex shader.
- Renderer11 *renderer = GetImplAs<Context11>(context)->getRenderer();
- renderer->getStateManager()->invalidateShaders();
- }
-}
-
-void VertexArray11::clearDirtyAndPromoteDynamicAttribs(const gl::Context *context,
- const DrawCallVertexParams &vertexParams)
-{
- const gl::State &state = context->getGLState();
- const gl::Program *program = state.getProgram();
- const auto &activeLocations = program->getActiveAttribLocationsMask();
- mAttribsToUpdate &= ~activeLocations;
-
- // Promote to static after we clear the dirty attributes, otherwise we can lose dirtyness.
- auto activeDynamicAttribs = (mDynamicAttribsMask & activeLocations);
- if (activeDynamicAttribs.any())
- {
- VertexDataManager::PromoteDynamicAttribs(context, mTranslatedAttribs, activeDynamicAttribs,
- vertexParams.vertexCount());
- }
-}
-
-void VertexArray11::markAllAttributeDivisorsForAdjustment(int numViews)
-{
- if (mAppliedNumViewsToDivisor != numViews)
- {
- mAppliedNumViewsToDivisor = numViews;
- mAttribsToUpdate.set();
- }
-}
-
-TranslatedIndexData *VertexArray11::getCachedIndexInfo()
-{
- return &mCachedIndexInfo;
-}
-
-void VertexArray11::setCachedIndexInfoValid()
-{
- mCachedIndexInfoValid = true;
-}
-
-bool VertexArray11::isCachedIndexInfoValid() const
-{
- return mCachedIndexInfoValid;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h
deleted file mode 100644
index 4cdc92531d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// 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"
-#include "libANGLE/signal_utils.h"
-
-namespace rx
-{
-class Renderer11;
-
-class VertexArray11 : public VertexArrayImpl, public OnBufferDataDirtyReceiver
-{
- public:
- VertexArray11(const gl::VertexArrayState &data);
- ~VertexArray11() override;
- void destroy(const gl::Context *context) override;
-
- void syncState(const gl::Context *context,
- const gl::VertexArray::DirtyBits &dirtyBits) override;
- // This will flush any pending attrib updates and then check the dynamic attribs mask.
- bool hasActiveDynamicAttrib(const gl::Context *context);
- gl::Error updateDirtyAndDynamicAttribs(const gl::Context *context,
- VertexDataManager *vertexDataManager,
- const DrawCallVertexParams &vertexParams);
- void clearDirtyAndPromoteDynamicAttribs(const gl::Context *context,
- const DrawCallVertexParams &vertexParams);
-
- const std::vector<TranslatedAttribute> &getTranslatedAttribs() const;
-
- // SignalReceiver implementation
- void signal(size_t channelID, const gl::Context *context) override;
-
- 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);
-
- bool flushAttribUpdates(const gl::Context *context);
-
- // Returns true if the element array buffer needs to be translated.
- bool updateElementArrayStorage(const gl::Context *context,
- GLenum elementType,
- GLenum destElementType,
- const void *indices);
-
- TranslatedIndexData *getCachedIndexInfo();
- void setCachedIndexInfoValid();
- bool isCachedIndexInfoValid() const;
-
- private:
- void updateVertexAttribStorage(const gl::Context *context, size_t attribIndex);
-
- std::vector<VertexStorageType> mAttributeStorageTypes;
- std::vector<TranslatedAttribute> mTranslatedAttribs;
-
- // The mask of attributes marked as dynamic.
- gl::AttributesMask mDynamicAttribsMask;
-
- // A mask of attributes that need to be re-evaluated.
- gl::AttributesMask mAttribsToUpdate;
-
- // A set of attributes we know are dirty, and need to be re-translated.
- gl::AttributesMask mAttribsToTranslate;
-
- // We need to keep a safe pointer to the Buffer so we can attach the correct dirty callbacks.
- std::vector<gl::BindingPointer<gl::Buffer>> mCurrentArrayBuffers;
- gl::BindingPointer<gl::Buffer> mCurrentElementArrayBuffer;
-
- std::vector<OnBufferDataDirtyBinding> mOnArrayBufferDataDirty;
- OnBufferDataDirtyBinding mOnElementArrayBufferDataDirty;
-
- Serial mCurrentStateSerial;
-
- // The numViews value used to adjust the divisor.
- int mAppliedNumViewsToDivisor;
-
- // If the index buffer needs re-streaming.
- GLenum mLastElementType;
- unsigned int mLastDrawElementsOffset;
- IndexStorageType mCurrentElementArrayStorage;
- TranslatedIndexData mCachedIndexInfo;
- bool mCachedIndexInfoValid;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_VERTEXARRAY11_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
deleted file mode 100644
index 611bd0f18b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-//
-// 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/VertexAttribute.h"
-#include "libANGLE/formatutils.h"
-#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
-#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
-#include "libANGLE/renderer/d3d/d3d11/Renderer11.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);
-}
-
-gl::Error VertexBuffer11::initialize(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(bufferDesc, &mBuffer));
-
- if (dynamicUsage)
- {
- mBuffer.setDebugName("VertexBuffer11 (dynamic)");
- }
- else
- {
- mBuffer.setDebugName("VertexBuffer11 (static)");
- }
- }
-
- mBufferSize = size;
- mDynamicUsage = dynamicUsage;
-
- return gl::NoError();
-}
-
-gl::Error VertexBuffer11::mapResource()
-{
- if (mMappedResourceData == nullptr)
- {
- ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
-
- D3D11_MAPPED_SUBRESOURCE mappedResource;
-
- HRESULT result =
- dxContext->Map(mBuffer.get(), 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to map internal vertex buffer, " << gl::FmtHR(result);
- }
-
- mMappedResourceData = reinterpret_cast<uint8_t *>(mappedResource.pData);
- }
-
- return gl::NoError();
-}
-
-void VertexBuffer11::hintUnmapResource()
-{
- if (mMappedResourceData != nullptr)
- {
- ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
- dxContext->Unmap(mBuffer.get(), 0);
-
- mMappedResourceData = nullptr;
- }
-}
-
-gl::Error VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- GLsizei count,
- GLsizei instances,
- unsigned int offset,
- const uint8_t *sourceData)
-{
- if (!mBuffer.valid())
- {
- return gl::OutOfMemory() << "Internal vertex buffer is not initialized.";
- }
-
- int inputStride = static_cast<int>(ComputeVertexAttributeStride(attrib, binding));
-
- // This will map the resource if it isn't already mapped.
- ANGLE_TRY(mapResource());
-
- uint8_t *output = mMappedResourceData + offset;
-
- const uint8_t *input = sourceData;
-
- if (instances == 0 || binding.getDivisor() == 0)
- {
- input += inputStride * start;
- }
-
- gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib, currentValueType);
- const D3D_FEATURE_LEVEL featureLevel = mRenderer->getRenderer11DeviceCaps().featureLevel;
- const d3d11::VertexFormat &vertexFormatInfo =
- d3d11::GetVertexFormatInfo(vertexFormatType, featureLevel);
- ASSERT(vertexFormatInfo.copyFunction != nullptr);
- vertexFormatInfo.copyFunction(input, inputStride, count, output);
-
- return gl::NoError();
-}
-
-unsigned int VertexBuffer11::getBufferSize() const
-{
- return mBufferSize;
-}
-
-gl::Error VertexBuffer11::setBufferSize(unsigned int size)
-{
- if (size > mBufferSize)
- {
- return initialize(size, mDynamicUsage);
- }
- else
- {
- return gl::NoError();
- }
-}
-
-gl::Error VertexBuffer11::discard()
-{
- if (!mBuffer.valid())
- {
- return gl::OutOfMemory() << "Internal vertex buffer is not initialized.";
- }
-
- ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
-
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- HRESULT result = dxContext->Map(mBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to map internal buffer for discarding, "
- << gl::FmtHR(result);
- }
-
- dxContext->Unmap(mBuffer.get(), 0);
-
- return gl::NoError();
-}
-
-const d3d11::Buffer &VertexBuffer11::getBuffer() const
-{
- return mBuffer;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h
deleted file mode 100644
index ab619ae503..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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);
-
- gl::Error initialize(unsigned int size, bool dynamicUsage) override;
-
- // Warning: you should ensure binding really matches attrib.bindingIndex before using this
- // function.
- gl::Error storeVertexAttributes(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- GLsizei count,
- GLsizei instances,
- unsigned int offset,
- const uint8_t *sourceData) override;
-
- unsigned int getBufferSize() const override;
- gl::Error setBufferSize(unsigned int size) override;
- gl::Error discard() override;
-
- void hintUnmapResource() override;
-
- const d3d11::Buffer &getBuffer() const;
-
- private:
- ~VertexBuffer11() override;
- gl::Error mapResource();
-
- 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/copyvertex.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/copyvertex.h
deleted file mode 100644
index 5501e361f1..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/copyvertex.h
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// Copyright (c) 2013-2015 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// copyvertex.h: Defines D3D11 vertex buffer copying and conversion functions
-
-#ifndef LIBANGLE_RENDERER_D3D_D3D11_COPYVERTEX_H_
-#define LIBANGLE_RENDERER_D3D_D3D11_COPYVERTEX_H_
-
-#include "common/mathutil.h"
-
-namespace rx
-{
-
-// 'alphaDefaultValueBits' gives the default value for the alpha channel (4th component)
-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);
-
-template <size_t inputComponentCount, size_t outputComponentCount>
-inline void Copy8SintTo16SintVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
-
-template <size_t componentCount>
-inline void Copy8SnormTo16SnormVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
-
-template <size_t inputComponentCount, size_t outputComponentCount>
-inline 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>
-inline void CopyTo32FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
-
-template <bool isSigned, bool normalized, bool toFloat>
-inline void CopyXYZ10W2ToXYZW32FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
-
-}
-
-#include "copyvertex.inl"
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_COPYVERTEX_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/copyvertex.inl b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/copyvertex.inl
deleted file mode 100644
index 7c5c157c6f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/copyvertex.inl
+++ /dev/null
@@ -1,386 +0,0 @@
-//
-// Copyright (c) 2014-2015 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-namespace rx
-{
-
-template <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 GLfixed* offsetInput = reinterpret_cast<const GLfixed*>(input + (stride * i));
- float* offsetOutput = reinterpret_cast<float*>(output) + i * outputComponentCount;
-
- for (size_t j = 0; j < inputComponentCount; j++)
- {
- offsetOutput[j] = static_cast<float>(offsetInput[j]) * 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();
- }
- }
- }
-}
-
-}
-
-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));
- }
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_data.json b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_data.json
deleted file mode 100644
index 891d30d252..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_data.json
+++ /dev/null
@@ -1,118 +0,0 @@
-{
- "UNKNOWN": "NONE",
- "R32G32B32A32_TYPELESS": "",
- "R32G32B32A32_FLOAT": "",
- "R32G32B32A32_UINT": "",
- "R32G32B32A32_SINT": "",
- "R32G32B32_TYPELESS": "",
- "R32G32B32_FLOAT": "",
- "R32G32B32_UINT": "",
- "R32G32B32_SINT": "",
- "R16G16B16A16_TYPELESS": "",
- "R16G16B16A16_FLOAT": "",
- "R16G16B16A16_UNORM": "",
- "R16G16B16A16_UINT": "",
- "R16G16B16A16_SNORM": "",
- "R16G16B16A16_SINT": "",
- "R32G32_TYPELESS": "",
- "R32G32_FLOAT": "",
- "R32G32_UINT": "",
- "R32G32_SINT": "",
- "R32G8X24_TYPELESS": "",
- "D32_FLOAT_S8X24_UINT": "",
- "R32_FLOAT_X8X24_TYPELESS": "",
- "X32_TYPELESS_G8X24_UINT": "",
- "R10G10B10A2_TYPELESS": "",
- "R10G10B10A2_UNORM": "",
- "R10G10B10A2_UINT": "",
- "R11G11B10_FLOAT": "",
- "R8G8B8A8_TYPELESS": "",
- "R8G8B8A8_UNORM": "",
- "R8G8B8A8_UNORM_SRGB": "",
- "R8G8B8A8_UINT": "",
- "R8G8B8A8_SNORM": "",
- "R8G8B8A8_SINT": "",
- "R16G16_TYPELESS": "",
- "R16G16_FLOAT": "",
- "R16G16_UNORM": "",
- "R16G16_UINT": "",
- "R16G16_SNORM": "",
- "R16G16_SINT": "",
- "R32_TYPELESS": "",
- "D32_FLOAT": "",
- "R32_FLOAT": "",
- "R32_UINT": "",
- "R32_SINT": "",
- "R24G8_TYPELESS": "",
- "D24_UNORM_S8_UINT": "",
- "R24_UNORM_X8_TYPELESS": "",
- "X24_TYPELESS_G8_UINT": "",
- "R8G8_TYPELESS": "",
- "R8G8_UNORM": "",
- "R8G8_UINT": "",
- "R8G8_SNORM": "",
- "R8G8_SINT": "",
- "R16_TYPELESS": "",
- "R16_FLOAT": "",
- "D16_UNORM": "",
- "R16_UNORM": "",
- "R16_UINT": "",
- "R16_SNORM": "",
- "R16_SINT": "",
- "R8_TYPELESS": "",
- "R8_UNORM": "",
- "R8_UINT": "",
- "R8_SNORM": "",
- "R8_SINT": "",
- "A8_UNORM": "",
- "R1_UNORM": "",
- "R9G9B9E5_SHAREDEXP": "",
- "R8G8_B8G8_UNORM": "",
- "G8R8_G8B8_UNORM": "",
- "BC1_TYPELESS": "",
- "BC1_UNORM": "BC1_RGBA_UNORM_BLOCK",
- "BC1_UNORM_SRGB": "BC1_RGBA_UNORM_SRGB_BLOCK",
- "BC2_TYPELESS": "",
- "BC2_UNORM": "BC2_RGBA_UNORM_BLOCK",
- "BC2_UNORM_SRGB": "BC2_RGBA_UNORM_SRGB_BLOCK",
- "BC3_TYPELESS": "",
- "BC3_UNORM": "BC3_RGBA_UNORM_BLOCK",
- "BC3_UNORM_SRGB": "BC3_RGBA_UNORM_SRGB_BLOCK",
- "BC4_TYPELESS": "",
- "BC4_UNORM": "",
- "BC4_SNORM": "",
- "BC5_TYPELESS": "",
- "BC5_UNORM": "",
- "BC5_SNORM": "",
- "B5G6R5_UNORM": "",
- "B5G5R5A1_UNORM": "",
- "B8G8R8A8_UNORM": "",
- "B8G8R8X8_UNORM": "",
- "R10G10B10_XR_BIAS_A2_UNORM": "",
- "B8G8R8A8_TYPELESS": "",
- "B8G8R8A8_UNORM_SRGB": "",
- "B8G8R8X8_TYPELESS": "",
- "B8G8R8X8_UNORM_SRGB": "",
- "BC6H_TYPELESS": "",
- "BC6H_UF16": "",
- "BC6H_SF16": "",
- "BC7_TYPELESS": "",
- "BC7_UNORM": "",
- "BC7_UNORM_SRGB": "",
- "AYUV": "",
- "Y410": "",
- "Y416": "",
- "NV12": "",
- "P010": "",
- "P016": "",
- "420_OPAQUE": "",
- "YUY2": "",
- "Y210": "",
- "Y216": "",
- "NV11": "",
- "AI44": "",
- "IA44": "",
- "P8": "",
- "A8P8": "",
- "B4G4R4A4_UNORM": ""
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp
deleted file mode 100644
index b0697bc5db..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp
+++ /dev/null
@@ -1,516 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by gen_dxgi_format_table.py using data from dxgi_format_data.json.
-//
-// 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.
-//
-// 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(Format::ID::A8_UNORM);
- case DXGI_FORMAT_AI44:
- break;
- case DXGI_FORMAT_AYUV:
- break;
- case DXGI_FORMAT_B4G4R4A4_UNORM:
- return Format::Get(Format::ID::B4G4R4A4_UNORM);
- case DXGI_FORMAT_B5G5R5A1_UNORM:
- return Format::Get(Format::ID::B5G5R5A1_UNORM);
- case DXGI_FORMAT_B5G6R5_UNORM:
- return Format::Get(Format::ID::B5G6R5_UNORM);
- case DXGI_FORMAT_B8G8R8A8_TYPELESS:
- break;
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- return Format::Get(Format::ID::B8G8R8A8_UNORM);
- case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
- return Format::Get(Format::ID::B8G8R8A8_UNORM_SRGB);
- case DXGI_FORMAT_B8G8R8X8_TYPELESS:
- break;
- case DXGI_FORMAT_B8G8R8X8_UNORM:
- return Format::Get(Format::ID::B8G8R8X8_UNORM);
- case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
- break;
- case DXGI_FORMAT_BC1_TYPELESS:
- break;
- case DXGI_FORMAT_BC1_UNORM:
- return Format::Get(Format::ID::BC1_RGBA_UNORM_BLOCK);
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- return Format::Get(Format::ID::BC1_RGBA_UNORM_SRGB_BLOCK);
- case DXGI_FORMAT_BC2_TYPELESS:
- break;
- case DXGI_FORMAT_BC2_UNORM:
- return Format::Get(Format::ID::BC2_RGBA_UNORM_BLOCK);
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- return Format::Get(Format::ID::BC2_RGBA_UNORM_SRGB_BLOCK);
- case DXGI_FORMAT_BC3_TYPELESS:
- break;
- case DXGI_FORMAT_BC3_UNORM:
- return Format::Get(Format::ID::BC3_RGBA_UNORM_BLOCK);
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- return Format::Get(Format::ID::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(Format::ID::D16_UNORM);
- case DXGI_FORMAT_D24_UNORM_S8_UINT:
- return Format::Get(Format::ID::D24_UNORM_S8_UINT);
- case DXGI_FORMAT_D32_FLOAT:
- return Format::Get(Format::ID::D32_FLOAT);
- case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
- return Format::Get(Format::ID::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(Format::ID::R10G10B10A2_UINT);
- case DXGI_FORMAT_R10G10B10A2_UNORM:
- return Format::Get(Format::ID::R10G10B10A2_UNORM);
- case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
- break;
- case DXGI_FORMAT_R11G11B10_FLOAT:
- return Format::Get(Format::ID::R11G11B10_FLOAT);
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- return Format::Get(Format::ID::R16G16B16A16_FLOAT);
- case DXGI_FORMAT_R16G16B16A16_SINT:
- return Format::Get(Format::ID::R16G16B16A16_SINT);
- case DXGI_FORMAT_R16G16B16A16_SNORM:
- return Format::Get(Format::ID::R16G16B16A16_SNORM);
- case DXGI_FORMAT_R16G16B16A16_TYPELESS:
- break;
- case DXGI_FORMAT_R16G16B16A16_UINT:
- return Format::Get(Format::ID::R16G16B16A16_UINT);
- case DXGI_FORMAT_R16G16B16A16_UNORM:
- return Format::Get(Format::ID::R16G16B16A16_UNORM);
- case DXGI_FORMAT_R16G16_FLOAT:
- return Format::Get(Format::ID::R16G16_FLOAT);
- case DXGI_FORMAT_R16G16_SINT:
- return Format::Get(Format::ID::R16G16_SINT);
- case DXGI_FORMAT_R16G16_SNORM:
- return Format::Get(Format::ID::R16G16_SNORM);
- case DXGI_FORMAT_R16G16_TYPELESS:
- break;
- case DXGI_FORMAT_R16G16_UINT:
- return Format::Get(Format::ID::R16G16_UINT);
- case DXGI_FORMAT_R16G16_UNORM:
- return Format::Get(Format::ID::R16G16_UNORM);
- case DXGI_FORMAT_R16_FLOAT:
- return Format::Get(Format::ID::R16_FLOAT);
- case DXGI_FORMAT_R16_SINT:
- return Format::Get(Format::ID::R16_SINT);
- case DXGI_FORMAT_R16_SNORM:
- return Format::Get(Format::ID::R16_SNORM);
- case DXGI_FORMAT_R16_TYPELESS:
- break;
- case DXGI_FORMAT_R16_UINT:
- return Format::Get(Format::ID::R16_UINT);
- case DXGI_FORMAT_R16_UNORM:
- return Format::Get(Format::ID::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(Format::ID::R32G32B32A32_FLOAT);
- case DXGI_FORMAT_R32G32B32A32_SINT:
- return Format::Get(Format::ID::R32G32B32A32_SINT);
- case DXGI_FORMAT_R32G32B32A32_TYPELESS:
- break;
- case DXGI_FORMAT_R32G32B32A32_UINT:
- return Format::Get(Format::ID::R32G32B32A32_UINT);
- case DXGI_FORMAT_R32G32B32_FLOAT:
- return Format::Get(Format::ID::R32G32B32_FLOAT);
- case DXGI_FORMAT_R32G32B32_SINT:
- return Format::Get(Format::ID::R32G32B32_SINT);
- case DXGI_FORMAT_R32G32B32_TYPELESS:
- break;
- case DXGI_FORMAT_R32G32B32_UINT:
- return Format::Get(Format::ID::R32G32B32_UINT);
- case DXGI_FORMAT_R32G32_FLOAT:
- return Format::Get(Format::ID::R32G32_FLOAT);
- case DXGI_FORMAT_R32G32_SINT:
- return Format::Get(Format::ID::R32G32_SINT);
- case DXGI_FORMAT_R32G32_TYPELESS:
- break;
- case DXGI_FORMAT_R32G32_UINT:
- return Format::Get(Format::ID::R32G32_UINT);
- case DXGI_FORMAT_R32G8X24_TYPELESS:
- break;
- case DXGI_FORMAT_R32_FLOAT:
- return Format::Get(Format::ID::R32_FLOAT);
- case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
- break;
- case DXGI_FORMAT_R32_SINT:
- return Format::Get(Format::ID::R32_SINT);
- case DXGI_FORMAT_R32_TYPELESS:
- break;
- case DXGI_FORMAT_R32_UINT:
- return Format::Get(Format::ID::R32_UINT);
- case DXGI_FORMAT_R8G8B8A8_SINT:
- return Format::Get(Format::ID::R8G8B8A8_SINT);
- case DXGI_FORMAT_R8G8B8A8_SNORM:
- return Format::Get(Format::ID::R8G8B8A8_SNORM);
- case DXGI_FORMAT_R8G8B8A8_TYPELESS:
- break;
- case DXGI_FORMAT_R8G8B8A8_UINT:
- return Format::Get(Format::ID::R8G8B8A8_UINT);
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- return Format::Get(Format::ID::R8G8B8A8_UNORM);
- case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
- return Format::Get(Format::ID::R8G8B8A8_UNORM_SRGB);
- case DXGI_FORMAT_R8G8_B8G8_UNORM:
- break;
- case DXGI_FORMAT_R8G8_SINT:
- return Format::Get(Format::ID::R8G8_SINT);
- case DXGI_FORMAT_R8G8_SNORM:
- return Format::Get(Format::ID::R8G8_SNORM);
- case DXGI_FORMAT_R8G8_TYPELESS:
- break;
- case DXGI_FORMAT_R8G8_UINT:
- return Format::Get(Format::ID::R8G8_UINT);
- case DXGI_FORMAT_R8G8_UNORM:
- return Format::Get(Format::ID::R8G8_UNORM);
- case DXGI_FORMAT_R8_SINT:
- return Format::Get(Format::ID::R8_SINT);
- case DXGI_FORMAT_R8_SNORM:
- return Format::Get(Format::ID::R8_SNORM);
- case DXGI_FORMAT_R8_TYPELESS:
- break;
- case DXGI_FORMAT_R8_UINT:
- return Format::Get(Format::ID::R8_UINT);
- case DXGI_FORMAT_R8_UNORM:
- return Format::Get(Format::ID::R8_UNORM);
- case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
- return Format::Get(Format::ID::R9G9B9E5_SHAREDEXP);
- case DXGI_FORMAT_UNKNOWN:
- return Format::Get(Format::ID::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(Format::ID::NONE);
-}
-
-} // namespace d3d11_angle
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_data.json b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_data.json
deleted file mode 100644
index 942745674f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_data.json
+++ /dev/null
@@ -1,1279 +0,0 @@
-[
- {
- "DXGI_FORMAT_UNKNOWN":
- {
- "texture2D": "never",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32G32B32A32_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32G32B32A32_FLOAT":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "10_0check10_1always",
- "renderTarget": "always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
- },
- "DXGI_FORMAT_R32G32B32A32_UINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32G32B32A32_SINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32G32B32_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32G32B32_FLOAT":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "11_0check",
- "renderTarget": "check",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32G32B32_UINT":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "check",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32G32B32_SINT":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "check",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R16G16B16A16_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R16G16B16A16_FLOAT":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "9_3check_10_0always",
- "renderTarget": "always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
- },
- "DXGI_FORMAT_R16G16B16A16_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
- },
- "DXGI_FORMAT_R16G16B16A16_UINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R16G16B16A16_SNORM":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "10_0",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R16G16B16A16_SINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32G32_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32G32_FLOAT":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "10_0check10_1always",
- "renderTarget": "always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R32G32_UINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32G32_SINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32G8X24_TYPELESS":
- {
- "texture2D": "10_0",
- "texture3D": "never",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_D32_FLOAT_S8X24_UINT":
- {
- "texture2D": "always",
- "texture3D": "never",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "check",
- "depthStencil": "10_0",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "never",
- "textureCube": "always",
- "shaderSample": "10_0check10_1always",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_X32_TYPELESS_G8X24_UINT":
- {
- "texture2D": "always",
- "texture3D": "never",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R10G10B10A2_TYPELESS":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R10G10B10A2_UNORM":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "10_0",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R10G10B10A2_UINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R11G11B10_FLOAT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "10_0",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R8G8B8A8_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R8G8B8A8_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
- },
- "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
- },
- "DXGI_FORMAT_R8G8B8A8_UINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R8G8B8A8_SNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R8G8B8A8_SINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R16G16_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R16G16_FLOAT":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "10_0",
- "renderTarget": "always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
- },
- "DXGI_FORMAT_R16G16_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
- },
- "DXGI_FORMAT_R16G16_UINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R16G16_SNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R16G16_SINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32_TYPELESS":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_D32_FLOAT":
- {
- "texture2D": "always",
- "texture3D": "never",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "check",
- "depthStencil": "10_0",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32_FLOAT":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "10_0check10_1always",
- "renderTarget": "always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
- },
- "DXGI_FORMAT_R32_UINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R32_SINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R24G8_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "never",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_D24_UNORM_S8_UINT":
- {
- "texture2D": "always",
- "texture3D": "never",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "check",
- "depthStencil": "always"
- },
- "DXGI_FORMAT_R24_UNORM_X8_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "never",
- "textureCube": "always",
- "shaderSample": "10_0check10_1always",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_X24_TYPELESS_G8_UINT":
- {
- "texture2D": "always",
- "texture3D": "never",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R8G8_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R8G8_UNORM":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "9_3check_10_0always",
- "renderTarget": "9_3check_10_0always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R8G8_UINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R8G8_SNORM":
- {
- "texture2D": "always",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "always",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R8G8_SINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R16_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R16_FLOAT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "10_0",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_D16_UNORM":
- {
- "texture2D": "always",
- "texture3D": "never",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "check",
- "depthStencil": "always",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R16_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R16_UINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R16_SNORM":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "10_0",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R16_SINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R8_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R8_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "9_3check_10_0always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R8_UINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R8_SNORM":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "10_0",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R8_SINT":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "never",
- "renderTarget": "10_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_A8_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "10_0",
- "renderTarget": "always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
- },
- "DXGI_FORMAT_R1_UNORM":
- {
- "texture2D": "always",
- "texture3D": "11_0",
- "textureCube": "11_0",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R9G9B9E5_SHAREDEXP":
- {
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "10_0",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R8G8_B8G8_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "10_0",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_G8R8_G8B8_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "10_0",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC1_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC1_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC1_UNORM_SRGB":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC2_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC2_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC2_UNORM_SRGB":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC3_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC3_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC3_UNORM_SRGB":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC4_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC4_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "10_0",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC4_SNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "10_0",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC5_TYPELESS":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC5_UNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "10_0",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC5_SNORM":
- {
- "texture2D": "always",
- "texture3D": "always",
- "textureCube": "always",
- "shaderSample": "10_0",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_B5G6R5_UNORM":
- {
- "texture2D": "dxgi1_2",
- "texture3D": "dxgi1_2",
- "textureCube": "dxgi1_2",
- "shaderSample": "dxgi1_2",
- "renderTarget": "dxgi1_2",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "dxgi1_2"
- },
- "DXGI_FORMAT_B5G5R5A1_UNORM":
- {
- "texture2D": "dxgi1_2",
- "texture3D": "dxgi1_2",
- "textureCube": "dxgi1_2",
- "shaderSample": "dxgi1_2",
- "renderTarget": "check",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "dxgi1_2"
- },
- "DXGI_FORMAT_B8G8R8A8_UNORM":
- {
- "texture2D": "check",
- "texture3D": "check",
- "textureCube": "check",
- "shaderSample": "9_3always_10_0check11_0always",
- "renderTarget": "9_3always_10_0check11_0always",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
- },
- "DXGI_FORMAT_B8G8R8X8_UNORM":
- {
- "texture2D": "check",
- "texture3D": "check",
- "textureCube": "check",
- "shaderSample": "10_0check11_0always",
- "renderTarget": "11_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM":
- {
- "texture2D": "check",
- "texture3D": "check",
- "textureCube": "never",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_B8G8R8A8_TYPELESS":
- {
- "texture2D": "check",
- "texture3D": "check",
- "textureCube": "check",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_B8G8R8A8_UNORM_SRGB":
- {
- "texture2D": "check",
- "texture3D": "check",
- "textureCube": "check",
- "shaderSample": "10_0check11_0always",
- "renderTarget": "11_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_B8G8R8X8_TYPELESS":
- {
- "texture2D": "check",
- "texture3D": "check",
- "textureCube": "check",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_B8G8R8X8_UNORM_SRGB":
- {
- "texture2D": "check",
- "texture3D": "check",
- "textureCube": "check",
- "shaderSample": "10_0check11_0always",
- "renderTarget": "11_0",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC6H_TYPELESS":
- {
- "texture2D": "11_0",
- "texture3D": "11_0",
- "textureCube": "11_0",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC6H_UF16":
- {
- "texture2D": "11_0",
- "texture3D": "11_0",
- "textureCube": "11_0",
- "shaderSample": "11_0",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC6H_SF16":
- {
- "texture2D": "11_0",
- "texture3D": "11_0",
- "textureCube": "11_0",
- "shaderSample": "11_0",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC7_TYPELESS":
- {
- "texture2D": "11_0",
- "texture3D": "11_0",
- "textureCube": "11_0",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC7_UNORM":
- {
- "texture2D": "11_0",
- "texture3D": "11_0",
- "textureCube": "11_0",
- "shaderSample": "11_0",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_BC7_UNORM_SRGB":
- {
- "texture2D": "11_0",
- "texture3D": "11_0",
- "textureCube": "11_0",
- "shaderSample": "11_0",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_AYUV":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "11_1",
- "renderTarget": "11_1",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_Y410":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "11_1",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_Y416":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "11_1",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_NV12":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "11_1",
- "renderTarget": "11_1",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_P010":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "11_1",
- "renderTarget": "11_1",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_P016":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "11_1",
- "renderTarget": "11_1",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_420_OPAQUE":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_YUY2":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "11_1",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_Y210":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "11_1",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_Y216":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "11_1",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_NV11":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "11_1",
- "renderTarget": "11_1",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_AI44":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_IA44":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_P8":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_A8P8":
- {
- "texture2D": "11_1",
- "texture3D": "never",
- "textureCube": "never",
- "shaderSample": "never",
- "renderTarget": "never",
- "multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
- },
- "DXGI_FORMAT_B4G4R4A4_UNORM":
- {
- "texture2D": "dxgi1_2",
- "texture3D": "dxgi1_2",
- "textureCube": "dxgi1_2",
- "shaderSample": "dxgi1_2",
- "renderTarget": "check",
- "multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "dxgi1_2"
- }
- }
-]
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.cpp
deleted file mode 100644
index 4d7e46bdf2..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.cpp
+++ /dev/null
@@ -1,3042 +0,0 @@
-// 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(0, F_DS | F_MIPGEN, 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(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(0, F_DS | F_MIPGEN, 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(0, F_DS | F_MIPGEN, 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_RT | F_SAMPLE, F_DS | F_MIPGEN, 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_RT | F_SAMPLE, F_DS | F_MIPGEN, 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
-}
-
-}
-
-#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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.h
deleted file mode 100644
index a818f376ef..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp
deleted file mode 100644
index ce4edd26db..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp
+++ /dev/null
@@ -1,1023 +0,0 @@
-//
-// 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/d3d/d3d11/copyvertex.h"
-#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-#include "libANGLE/renderer/d3d/d3d11/Renderer11.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(gl::VertexFormatType vertexFormatType)
-{
- // 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 (vertexFormatType)
- {
- // GL_BYTE -- unnormalized
- case gl::VERTEX_FORMAT_SBYTE1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16_SINT,
- &Copy8SintTo16SintVertexData<1, 2>);
- return &info;
- }
- case gl::VERTEX_FORMAT_SBYTE2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16_SINT,
- &Copy8SintTo16SintVertexData<2, 2>);
- return &info;
- }
- case gl::VERTEX_FORMAT_SBYTE3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT,
- &Copy8SintTo16SintVertexData<3, 4>);
- return &info;
- }
- case gl::VERTEX_FORMAT_SBYTE4:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT,
- &Copy8SintTo16SintVertexData<4, 4>);
- return &info;
- }
-
- // GL_BYTE -- normalized
- case gl::VERTEX_FORMAT_SBYTE1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16_SNORM,
- &Copy8SnormTo16SnormVertexData<1, 2>);
- return &info;
- }
- case gl::VERTEX_FORMAT_SBYTE2_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16_SNORM,
- &Copy8SnormTo16SnormVertexData<2, 2>);
- return &info;
- }
- case gl::VERTEX_FORMAT_SBYTE3_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SNORM,
- &Copy8SnormTo16SnormVertexData<3, 4>);
- return &info;
- }
- case gl::VERTEX_FORMAT_SBYTE4_NORM:
- {
- 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 gl::VERTEX_FORMAT_UBYTE1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT,
- &CopyNativeVertexData<GLubyte, 1, 4, 1>);
- return &info;
- }
- case gl::VERTEX_FORMAT_UBYTE2:
- {
- 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 gl::VERTEX_FORMAT_UBYTE1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UNORM,
- &CopyNativeVertexData<GLubyte, 1, 4, UINT8_MAX>);
- return &info;
- }
- case gl::VERTEX_FORMAT_UBYTE2_NORM:
- {
- 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 gl::VERTEX_FORMAT_SSHORT1:
- {
- 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 gl::VERTEX_FORMAT_SSHORT1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16_SNORM,
- &CopyNativeVertexData<GLshort, 1, 2, 0>);
- return &info;
- }
-
- // GL_UNSIGNED_SHORT -- un-normalized
- case gl::VERTEX_FORMAT_USHORT1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyTo32FVertexData<GLushort, 1, 2, false>);
- return &info;
- }
- case gl::VERTEX_FORMAT_USHORT2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyTo32FVertexData<GLushort, 2, 2, false>);
- return &info;
- }
- case gl::VERTEX_FORMAT_USHORT3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
- &CopyTo32FVertexData<GLushort, 3, 3, false>);
- return &info;
- }
- case gl::VERTEX_FORMAT_USHORT4:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyTo32FVertexData<GLushort, 4, 4, false>);
- return &info;
- }
-
- // GL_UNSIGNED_SHORT -- normalized
- case gl::VERTEX_FORMAT_USHORT1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyTo32FVertexData<GLushort, 1, 2, true>);
- return &info;
- }
- case gl::VERTEX_FORMAT_USHORT2_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyTo32FVertexData<GLushort, 2, 2, true>);
- return &info;
- }
- case gl::VERTEX_FORMAT_USHORT3_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
- &CopyTo32FVertexData<GLushort, 3, 3, true>);
- return &info;
- }
- case gl::VERTEX_FORMAT_USHORT4_NORM:
- {
- 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 gl::VERTEX_FORMAT_FIXED1:
- {
- 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 gl::VERTEX_FORMAT_FLOAT1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyNativeVertexData<GLfloat, 1, 2, 0>);
- return &info;
- }
-
- default:
- return nullptr;
- }
-}
-
-const VertexFormat &GetVertexFormatInfo(gl::VertexFormatType vertexFormatType, D3D_FEATURE_LEVEL featureLevel)
-{
- if (featureLevel == D3D_FEATURE_LEVEL_9_3)
- {
- const VertexFormat *result = GetVertexFormatInfo_FL_9_3(vertexFormatType);
- if (result)
- {
- return *result;
- }
- }
-
- switch (vertexFormatType)
- {
- //
- // Float formats
- //
-
- // GL_BYTE -- un-normalized
- case gl::VERTEX_FORMAT_SBYTE1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8_SINT,
- &CopyNativeVertexData<GLbyte, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SBYTE2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8_SINT,
- &CopyNativeVertexData<GLbyte, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SBYTE3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_SINT,
- &CopyNativeVertexData<GLbyte, 3, 4, 1>);
- return info;
- }
- case gl::VERTEX_FORMAT_SBYTE4:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8B8A8_SINT,
- &CopyNativeVertexData<GLbyte, 4, 4, 0>);
- return info;
- }
-
- // GL_BYTE -- normalized
- case gl::VERTEX_FORMAT_SBYTE1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_SNORM,
- &CopyNativeVertexData<GLbyte, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SBYTE2_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_SNORM,
- &CopyNativeVertexData<GLbyte, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SBYTE3_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_SNORM,
- &CopyNativeVertexData<GLbyte, 3, 4, INT8_MAX>);
- return info;
- }
- case gl::VERTEX_FORMAT_SBYTE4_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_SNORM,
- &CopyNativeVertexData<GLbyte, 4, 4, 0>);
- return info;
- }
-
- // GL_UNSIGNED_BYTE -- un-normalized
- case gl::VERTEX_FORMAT_UBYTE1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8_UINT,
- &CopyNativeVertexData<GLubyte, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_UBYTE2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8_UINT,
- &CopyNativeVertexData<GLubyte, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_UBYTE3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT,
- &CopyNativeVertexData<GLubyte, 3, 4, 1>);
- return info;
- }
- case gl::VERTEX_FORMAT_UBYTE4:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8B8A8_UINT,
- &CopyNativeVertexData<GLubyte, 4, 4, 0>);
- return info;
- }
-
- // GL_UNSIGNED_BYTE -- normalized
- case gl::VERTEX_FORMAT_UBYTE1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_UNORM,
- &CopyNativeVertexData<GLubyte, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_UBYTE2_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_UNORM,
- &CopyNativeVertexData<GLubyte, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_UBYTE3_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UNORM,
- &CopyNativeVertexData<GLubyte, 3, 4, UINT8_MAX>);
- return info;
- }
- case gl::VERTEX_FORMAT_UBYTE4_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_UNORM,
- &CopyNativeVertexData<GLubyte, 4, 4, 0>);
- return info;
- }
-
- // GL_SHORT -- un-normalized
- case gl::VERTEX_FORMAT_SSHORT1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16_SINT,
- &CopyNativeVertexData<GLshort, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SSHORT2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16_SINT,
- &CopyNativeVertexData<GLshort, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SSHORT3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT,
- &CopyNativeVertexData<GLshort, 3, 4, 1>);
- return info;
- }
- case gl::VERTEX_FORMAT_SSHORT4:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16B16A16_SINT,
- &CopyNativeVertexData<GLshort, 4, 4, 0>);
- return info;
- }
-
- // GL_SHORT -- normalized
- case gl::VERTEX_FORMAT_SSHORT1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_SNORM,
- &CopyNativeVertexData<GLshort, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SSHORT2_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_SNORM,
- &CopyNativeVertexData<GLshort, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SSHORT3_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SNORM,
- &CopyNativeVertexData<GLshort, 3, 4, INT16_MAX>);
- return info;
- }
- case gl::VERTEX_FORMAT_SSHORT4_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_SNORM,
- &CopyNativeVertexData<GLshort, 4, 4, 0>);
- return info;
- }
-
- // GL_UNSIGNED_SHORT -- un-normalized
- case gl::VERTEX_FORMAT_USHORT1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16_UINT,
- &CopyNativeVertexData<GLushort, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_USHORT2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16_UINT,
- &CopyNativeVertexData<GLushort, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_USHORT3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_UINT,
- &CopyNativeVertexData<GLushort, 3, 4, 1>);
- return info;
- }
- case gl::VERTEX_FORMAT_USHORT4:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16B16A16_UINT,
- &CopyNativeVertexData<GLushort, 4, 4, 0>);
- return info;
- }
-
- // GL_UNSIGNED_SHORT -- normalized
- case gl::VERTEX_FORMAT_USHORT1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_UNORM,
- &CopyNativeVertexData<GLushort, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_USHORT2_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_UNORM,
- &CopyNativeVertexData<GLushort, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_USHORT3_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_UNORM,
- &CopyNativeVertexData<GLushort, 3, 4, UINT16_MAX>);
- return info;
- }
- case gl::VERTEX_FORMAT_USHORT4_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_UNORM,
- &CopyNativeVertexData<GLushort, 4, 4, 0>);
- return info;
- }
-
- // GL_INT -- un-normalized
- case gl::VERTEX_FORMAT_SINT1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32_SINT,
- &CopyNativeVertexData<GLint, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SINT2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32_SINT,
- &CopyNativeVertexData<GLint, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SINT3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32_SINT,
- &CopyNativeVertexData<GLint, 3, 3, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SINT4:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32A32_SINT,
- &CopyNativeVertexData<GLint, 4, 4, 0>);
- return info;
- }
-
- // GL_INT -- normalized
- case gl::VERTEX_FORMAT_SINT1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT,
- &CopyTo32FVertexData<GLint, 1, 1, true>);
- return info;
- }
- case gl::VERTEX_FORMAT_SINT2_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyTo32FVertexData<GLint, 2, 2, true>);
- return info;
- }
- case gl::VERTEX_FORMAT_SINT3_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
- &CopyTo32FVertexData<GLint, 3, 3, true>);
- return info;
- }
- case gl::VERTEX_FORMAT_SINT4_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyTo32FVertexData<GLint, 4, 4, true>);
- return info;
- }
-
- // GL_UNSIGNED_INT -- un-normalized
- case gl::VERTEX_FORMAT_UINT1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32_UINT,
- &CopyNativeVertexData<GLuint, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_UINT2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32_UINT,
- &CopyNativeVertexData<GLuint, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_UINT3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32_UINT,
- &CopyNativeVertexData<GLuint, 3, 3, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_UINT4:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32A32_UINT,
- &CopyNativeVertexData<GLuint, 4, 4, 0>);
- return info;
- }
-
- // GL_UNSIGNED_INT -- normalized
- case gl::VERTEX_FORMAT_UINT1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT,
- &CopyTo32FVertexData<GLuint, 1, 1, true>);
- return info;
- }
- case gl::VERTEX_FORMAT_UINT2_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyTo32FVertexData<GLuint, 2, 2, true>);
- return info;
- }
- case gl::VERTEX_FORMAT_UINT3_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
- &CopyTo32FVertexData<GLuint, 3, 3, true>);
- return info;
- }
- case gl::VERTEX_FORMAT_UINT4_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyTo32FVertexData<GLuint, 4, 4, true>);
- return info;
- }
-
- // GL_FIXED
- case gl::VERTEX_FORMAT_FIXED1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT,
- &Copy32FixedTo32FVertexData<1, 1>);
- return info;
- }
- case gl::VERTEX_FORMAT_FIXED2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &Copy32FixedTo32FVertexData<2, 2>);
- return info;
- }
- case gl::VERTEX_FORMAT_FIXED3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
- &Copy32FixedTo32FVertexData<3, 3>);
- return info;
- }
- case gl::VERTEX_FORMAT_FIXED4:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &Copy32FixedTo32FVertexData<4, 4>);
- return info;
- }
-
- // GL_HALF_FLOAT
- case gl::VERTEX_FORMAT_HALF1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_FLOAT,
- &CopyNativeVertexData<GLhalf, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_HALF2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_FLOAT,
- &CopyNativeVertexData<GLhalf, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_HALF3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_FLOAT,
- &CopyNativeVertexData<GLhalf, 3, 4, gl::Float16One>);
- return info;
- }
- case gl::VERTEX_FORMAT_HALF4:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_FLOAT,
- &CopyNativeVertexData<GLhalf, 4, 4, 0>);
- return info;
- }
-
- // GL_FLOAT
- case gl::VERTEX_FORMAT_FLOAT1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_FLOAT,
- &CopyNativeVertexData<GLfloat, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_FLOAT2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_FLOAT,
- &CopyNativeVertexData<GLfloat, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_FLOAT3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_FLOAT,
- &CopyNativeVertexData<GLfloat, 3, 3, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_FLOAT4:
- {
- 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 gl::VERTEX_FORMAT_SINT210:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyXYZ10W2ToXYZW32FVertexData<true, false, true>);
- return info;
- }
- case gl::VERTEX_FORMAT_SINT210_NORM:
- {
- 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 gl::VERTEX_FORMAT_UINT210:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyXYZ10W2ToXYZW32FVertexData<false, false, true>);
- return info;
- }
- case gl::VERTEX_FORMAT_UINT210_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R10G10B10A2_UNORM,
- &CopyNativeVertexData<GLuint, 1, 1, 0>);
- return info;
- }
-
- //
- // Integer Formats
- //
-
- // GL_BYTE
- case gl::VERTEX_FORMAT_SBYTE1_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_SINT,
- &CopyNativeVertexData<GLbyte, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SBYTE2_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_SINT,
- &CopyNativeVertexData<GLbyte, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SBYTE3_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_SINT,
- &CopyNativeVertexData<GLbyte, 3, 4, 1>);
- return info;
- }
- case gl::VERTEX_FORMAT_SBYTE4_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_SINT,
- &CopyNativeVertexData<GLbyte, 4, 4, 0>);
- return info;
- }
-
- // GL_UNSIGNED_BYTE
- case gl::VERTEX_FORMAT_UBYTE1_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_UINT,
- &CopyNativeVertexData<GLubyte, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_UBYTE2_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_UINT,
- &CopyNativeVertexData<GLubyte, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_UBYTE3_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UINT,
- &CopyNativeVertexData<GLubyte, 3, 4, 1>);
- return info;
- }
- case gl::VERTEX_FORMAT_UBYTE4_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_UINT,
- &CopyNativeVertexData<GLubyte, 4, 4, 0>);
- return info;
- }
-
- // GL_SHORT
- case gl::VERTEX_FORMAT_SSHORT1_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_SINT,
- &CopyNativeVertexData<GLshort, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SSHORT2_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_SINT,
- &CopyNativeVertexData<GLshort, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SSHORT3_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SINT,
- &CopyNativeVertexData<GLshort, 3, 4, 1>);
- return info;
- }
- case gl::VERTEX_FORMAT_SSHORT4_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_SINT,
- &CopyNativeVertexData<GLshort, 4, 4, 0>);
- return info;
- }
-
- // GL_UNSIGNED_SHORT
- case gl::VERTEX_FORMAT_USHORT1_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_UINT,
- &CopyNativeVertexData<GLushort, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_USHORT2_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_UINT,
- &CopyNativeVertexData<GLushort, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_USHORT3_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_UINT,
- &CopyNativeVertexData<GLushort, 3, 4, 1>);
- return info;
- }
- case gl::VERTEX_FORMAT_USHORT4_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_UINT,
- &CopyNativeVertexData<GLushort, 4, 4, 0>);
- return info;
- }
-
- // GL_INT
- case gl::VERTEX_FORMAT_SINT1_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_SINT,
- &CopyNativeVertexData<GLint, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SINT2_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_SINT,
- &CopyNativeVertexData<GLint, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SINT3_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_SINT,
- &CopyNativeVertexData<GLint, 3, 3, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_SINT4_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_SINT,
- &CopyNativeVertexData<GLint, 4, 4, 0>);
- return info;
- }
-
- // GL_UNSIGNED_INT
- case gl::VERTEX_FORMAT_UINT1_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_SINT,
- &CopyNativeVertexData<GLuint, 1, 1, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_UINT2_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_SINT,
- &CopyNativeVertexData<GLuint, 2, 2, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_UINT3_INT:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_SINT,
- &CopyNativeVertexData<GLuint, 3, 3, 0>);
- return info;
- }
- case gl::VERTEX_FORMAT_UINT4_INT:
- {
- 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 gl::VERTEX_FORMAT_SINT210_INT:
- {
- 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 gl::VERTEX_FORMAT_UINT210_INT:
- {
- 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.h
deleted file mode 100644
index 883d338377..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.h
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// 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/renderer_utils.h"
-#include "libANGLE/renderer/d3d/formatutilsD3D.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(gl::VertexFormatType vertexFormatType,
- 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
deleted file mode 100644
index d059b36120..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
+++ /dev/null
@@ -1,2421 +0,0 @@
-//
-// 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/IndexBuffer.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/Platform.h"
-#include "platform/WorkaroundsD3D.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}}}};
-
-// 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.renderable =
- (support.query(formatInfo.rtvFormat, D3D11_FORMAT_SUPPORT_RENDER_TARGET)) ||
- (support.query(formatInfo.dsvFormat, D3D11_FORMAT_SUPPORT_DEPTH_STENCIL));
-
- 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;
- }
-}
-
-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;
- }
-}
-
-size_t GetMaximumImageUnits(D3D_FEATURE_LEVEL featureLevel)
-{
- switch (featureLevel)
- {
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- // TODO(xinghua.cao@intel.com): Get a more accurate limit. For now using
- // the minimum requirement for GLES 3.1.
- return 4;
- default:
- return 0;
- }
-}
-
-size_t GetMaximumComputeImageUniforms(D3D_FEATURE_LEVEL featureLevel)
-{
- switch (featureLevel)
- {
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- // TODO(xinghua.cao@intel.com): Get a more accurate limit. For now using
- // the minimum requirement for GLES 3.1.
- return 4;
- default:
- return 0;
- }
-}
-
-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;
- }
-}
-
-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(D3D_FEATURE_LEVEL featureLevel)
-{
- switch (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:
- 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);
- }
-}
-
-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, 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(featureLevel), 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->maxVertexUniformComponents =
- static_cast<GLuint>(GetMaximumVertexUniformVectors(featureLevel)) * 4;
- caps->maxVertexUniformVectors =
- static_cast<GLuint>(GetMaximumVertexUniformVectors(featureLevel));
- caps->maxVertexUniformBlocks = static_cast<GLuint>(GetMaximumVertexUniformBlocks(featureLevel));
- caps->maxVertexOutputComponents =
- static_cast<GLuint>(GetMaximumVertexOutputVectors(featureLevel)) * 4;
- caps->maxVertexTextureImageUnits =
- 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->maxFragmentUniformComponents =
- static_cast<GLuint>(GetMaximumPixelUniformVectors(featureLevel)) * 4;
- caps->maxFragmentUniformVectors =
- static_cast<GLuint>(GetMaximumPixelUniformVectors(featureLevel));
- caps->maxFragmentUniformBlocks =
- static_cast<GLuint>(GetMaximumPixelUniformBlocks(featureLevel));
- caps->maxFragmentInputComponents =
- static_cast<GLuint>(GetMaximumPixelInputVectors(featureLevel)) * 4;
- caps->maxTextureImageUnits = 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->maxComputeUniformComponents =
- static_cast<GLuint>(GetMaximumComputeUniformVectors(featureLevel)) * 4;
- caps->maxComputeUniformBlocks =
- static_cast<GLuint>(GetMaximumComputeUniformBlocks(featureLevel));
- caps->maxComputeTextureImageUnits =
- static_cast<GLuint>(GetMaximumComputeTextureUnits(featureLevel));
- caps->maxImageUnits = static_cast<GLuint>(GetMaximumImageUnits(featureLevel));
- caps->maxComputeImageUniforms =
- static_cast<GLuint>(GetMaximumComputeImageUniforms(featureLevel));
-
- // Aggregate shader limits
- caps->maxUniformBufferBindings = caps->maxVertexUniformBlocks + caps->maxFragmentUniformBlocks;
- 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->maxVertexUniformBlocks + caps->maxFragmentUniformBlocks;
- caps->maxCombinedVertexUniformComponents = (static_cast<GLint64>(caps->maxVertexUniformBlocks) * static_cast<GLint64>(caps->maxUniformBlockSize / 4)) +
- static_cast<GLint64>(caps->maxVertexUniformComponents);
- caps->maxCombinedFragmentUniformComponents = (static_cast<GLint64>(caps->maxFragmentUniformBlocks) * static_cast<GLint64>(caps->maxUniformBlockSize / 4)) +
- static_cast<GLint64>(caps->maxFragmentUniformComponents);
- caps->maxCombinedComputeUniformComponents =
- static_cast<GLuint>(caps->maxComputeUniformBlocks * (caps->maxUniformBlockSize / 4) +
- caps->maxComputeUniformComponents);
- caps->maxVaryingComponents =
- static_cast<GLuint>(GetMaximumVertexOutputVectors(featureLevel)) * 4;
- caps->maxVaryingVectors = static_cast<GLuint>(GetMaximumVertexOutputVectors(featureLevel));
- caps->maxCombinedTextureImageUnits = caps->maxVertexTextureImageUnits + caps->maxTextureImageUnits;
-
- // 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;
-
- // GL extension support
- extensions->setTextureExtensionSupport(*textureCapsMap);
- 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;
- extensions->framebufferBlit = GetFramebufferBlitSupport(featureLevel);
- extensions->framebufferMultisample = GetFramebufferMultisampleSupport(featureLevel);
- extensions->instancedArrays = GetInstancingSupport(featureLevel);
- extensions->packReverseRowOrder = true;
- extensions->standardDerivatives = GetDerivativeInstructionSupport(featureLevel);
- extensions->shaderTextureLOD = GetShaderTextureLODSupport(featureLevel);
- extensions->fragDepth = true;
- extensions->multiview = IsMultiviewSupported(featureLevel);
- if (extensions->multiview)
- {
- 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;
-
- // 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;
-
-#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(log(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;
- 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_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(GLenum queryType)
-{
- switch (queryType)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- return D3D11_QUERY_OCCLUSION;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- return D3D11_QUERY_SO_STATISTICS;
- case GL_TIME_ELAPSED_EXT:
- // Two internal queries are also created for begin/end timestamps
- return D3D11_QUERY_TIMESTAMP_DISJOINT;
- case GL_COMMANDS_COMPLETED_CHROMIUM:
- 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;
- }
-}
-
-void GenerateInitialTextureData(GLint internalFormat,
- const Renderer11DeviceCaps &renderer11DeviceCaps,
- GLuint width,
- GLuint height,
- GLuint depth,
- GLuint mipLevels,
- std::vector<D3D11_SUBRESOURCE_DATA> *outSubresourceData,
- std::vector<std::vector<BYTE>> *outData)
-{
- const d3d11::Format &d3dFormatInfo = d3d11::Format::Get(internalFormat, renderer11DeviceCaps);
- ASSERT(d3dFormatInfo.dataInitializerFunction != nullptr);
-
- const d3d11::DXGIFormatSize &dxgiFormatInfo =
- d3d11::GetDXGIFormatSizeInfo(d3dFormatInfo.texFormat);
-
- outSubresourceData->resize(mipLevels);
- outData->resize(mipLevels);
-
- 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 mipDepth = std::max(depth >> i, 1U);
-
- unsigned int rowWidth = dxgiFormatInfo.pixelBytes * mipWidth;
- unsigned int imageSize = rowWidth * height;
-
- outData->at(i).resize(rowWidth * mipHeight * mipDepth);
- d3dFormatInfo.dataInitializerFunction(mipWidth, mipHeight, mipDepth, outData->at(i).data(), rowWidth, imageSize);
-
- outSubresourceData->at(i).pSysMem = outData->at(i).data();
- outSubresourceData->at(i).SysMemPitch = rowWidth;
- outSubresourceData->at(i).SysMemSlicePitch = imageSize;
- }
-}
-
-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>
-gl::Error LazyResource<ResourceT>::resolveImpl(Renderer11 *renderer,
- const GetDescType<ResourceT> &desc,
- GetInitDataType<ResourceT> *initData,
- const char *name)
-{
- if (!mResource.valid())
- {
- ANGLE_TRY(renderer->allocateResource(desc, initData, &mResource));
- mResource.setDebugName(name);
- }
- return gl::NoError();
-}
-
-template gl::Error LazyResource<ResourceType::BlendState>::resolveImpl(Renderer11 *renderer,
- const D3D11_BLEND_DESC &desc,
- void *initData,
- const char *name);
-template gl::Error LazyResource<ResourceType::ComputeShader>::resolveImpl(Renderer11 *renderer,
- const ShaderData &desc,
- void *initData,
- const char *name);
-template gl::Error LazyResource<ResourceType::GeometryShader>::resolveImpl(
- Renderer11 *renderer,
- const ShaderData &desc,
- const std::vector<D3D11_SO_DECLARATION_ENTRY> *initData,
- const char *name);
-template gl::Error LazyResource<ResourceType::InputLayout>::resolveImpl(
- Renderer11 *renderer,
- const InputElementArray &desc,
- const ShaderData *initData,
- const char *name);
-template gl::Error LazyResource<ResourceType::PixelShader>::resolveImpl(Renderer11 *renderer,
- const ShaderData &desc,
- void *initData,
- const char *name);
-template gl::Error LazyResource<ResourceType::VertexShader>::resolveImpl(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()
-{
-}
-
-gl::Error LazyInputLayout::resolve(Renderer11 *renderer)
-{
- return resolveImpl(renderer, mInputDesc, &mByteCode, mDebugName);
-}
-
-LazyBlendState::LazyBlendState(const D3D11_BLEND_DESC &desc, const char *debugName)
- : mDesc(desc), mDebugName(debugName)
-{
-}
-
-gl::Error LazyBlendState::resolve(Renderer11 *renderer)
-{
- return resolveImpl(renderer, mDesc, nullptr, mDebugName);
-}
-
-angle::WorkaroundsD3D GenerateWorkarounds(const Renderer11DeviceCaps &deviceCaps,
- const DXGI_ADAPTER_DESC &adapterDesc)
-{
- bool is9_3 = (deviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3);
-
- angle::WorkaroundsD3D workarounds;
- workarounds.mrtPerfWorkaround = true;
- workarounds.setDataFasterThanImageUpload = true;
- workarounds.zeroMaxLodWorkaround = is9_3;
- workarounds.useInstancedPointSpriteEmulation = 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.
- workarounds.depthStencilBlitExtraCopy = (part1 <= 13u && part2 < 6881);
- }
- else
- {
- workarounds.depthStencilBlitExtraCopy = true;
- }
- }
-
- // TODO(jmadill): Disable workaround when we have a fixed compiler DLL.
- workarounds.expandIntegerPowExpressions = true;
-
- workarounds.flushAfterEndingTransformFeedback = IsNvidia(adapterDesc.VendorId);
- workarounds.getDimensionsIgnoresBaseLevel = IsNvidia(adapterDesc.VendorId);
-
- if (IsIntel(adapterDesc.VendorId))
- {
- IntelDriverVersion capsVersion = d3d11_gl::GetIntelDriverVersion(deviceCaps.driverVersion);
-
- workarounds.preAddTexelFetchOffsets = true;
- workarounds.useSystemMemoryForConstantBuffers = true;
- workarounds.disableB5G6R5Support = capsVersion < IntelDriverVersion(4539);
- workarounds.addDummyTextureNoRenderTarget = capsVersion < IntelDriverVersion(4815);
- if (IsSkylake(adapterDesc.DeviceId))
- {
- workarounds.callClearTwice = capsVersion < IntelDriverVersion(4771);
- workarounds.emulateIsnanFloat = capsVersion < IntelDriverVersion(4542);
- }
- else if (IsBroadwell(adapterDesc.DeviceId) || IsHaswell(adapterDesc.DeviceId))
- {
- workarounds.rewriteUnaryMinusOperator = capsVersion < IntelDriverVersion(4624);
- }
- }
-
- // TODO(jmadill): Disable when we have a fixed driver version.
- workarounds.emulateTinyStencilTextures = 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)
- {
- workarounds.emulateTinyStencilTextures = false;
- }
-
- // If the VPAndRTArrayIndexFromAnyShaderFeedingRasterizer feature is not available, we have to
- // select the viewport / RT array index in the geometry shader.
- workarounds.selectViewInGeometryShader =
- (deviceCaps.supportsVpRtIndexWriteFromVertexShader == false);
-
- // Call platform hooks for testing overrides.
- auto *platform = ANGLEPlatformCurrent();
- platform->overrideWorkaroundsD3D(platform, &workarounds);
-
- return workarounds;
-}
-
-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, GLenum 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_UNSIGNED_SHORT);
-}
-
-bool IsStreamingIndexData(const gl::Context *context, GLenum srcType)
-{
- const auto &glState = context->getGLState();
- gl::Buffer *glBuffer = glState.getVertexArray()->getElementArrayBuffer().get();
-
- // Case 1: the indices are passed by pointer, which forces the streaming of index data
- if (glBuffer == nullptr)
- {
- return true;
- }
-
- bool primitiveRestartWorkaround =
- UsePrimitiveRestartWorkaround(glState.isPrimitiveRestartEnabled(), srcType);
-
- BufferD3D *buffer = GetImplAs<BufferD3D>(glBuffer);
- const GLenum dstType = (srcType == GL_UNSIGNED_INT || primitiveRestartWorkaround)
- ? GL_UNSIGNED_INT
- : GL_UNSIGNED_SHORT;
-
- // Case 2a: the buffer can be used directly
- if (buffer->supportsDirectBinding() && dstType == srcType)
- {
- return false;
- }
-
- // Case 2b: use a static translated copy or fall back to streaming
- StaticIndexBufferInterface *staticBuffer = buffer->getStaticIndexBuffer();
- if (staticBuffer == nullptr)
- {
- return true;
- }
-
- if ((staticBuffer->getBufferSize() == 0) || (staticBuffer->getIndexType() != dstType))
- {
- return true;
- }
-
- return false;
-}
-
-IndexStorageType ClassifyIndexStorage(const gl::State &glState,
- const gl::Buffer *elementArrayBuffer,
- GLenum elementType,
- GLenum destElementType,
- unsigned int offset,
- bool *needsTranslation)
-{
- // No buffer bound means we are streaming from a client pointer.
- if (!elementArrayBuffer || !IsOffsetAligned(elementType, offset))
- {
- *needsTranslation = true;
- 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)
- {
- *needsTranslation = false;
- return IndexStorageType::Direct;
- }
-
- // Use a static copy when available.
- StaticIndexBufferInterface *staticBuffer = bufferD3D->getStaticIndexBuffer();
- if (staticBuffer != nullptr)
- {
- // Need to re-translate the static data if has never been used, or changed type.
- *needsTranslation =
- (staticBuffer->getBufferSize() == 0 || staticBuffer->getIndexType() != destElementType);
- return IndexStorageType::Static;
- }
-
- // Static buffer not available, fall back to streaming.
- *needsTranslation = true;
- return IndexStorageType::Dynamic;
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h
deleted file mode 100644
index 3af51bb0f6..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h
+++ /dev/null
@@ -1,431 +0,0 @@
-//
-// 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 Renderer11;
-class RenderTarget11;
-struct Renderer11DeviceCaps;
-
-using RenderTargetArray = std::array<RenderTarget11 *, gl::IMPLEMENTATION_MAX_DRAW_BUFFERS>;
-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(GLenum queryType);
-
-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(D3D_FEATURE_LEVEL featureLevel);
-void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, const Renderer11DeviceCaps &renderer11DeviceCaps, gl::Caps *caps,
- gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions, gl::Limitations *limitations);
-
-void GetSamplePosition(GLsizei sampleCount, size_t index, GLfloat *xy);
-
-} // 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);
-
-void GenerateInitialTextureData(GLint internalFormat,
- const Renderer11DeviceCaps &renderer11DeviceCaps,
- GLuint width,
- GLuint height,
- GLuint depth,
- GLuint mipLevels,
- std::vector<D3D11_SUBRESOURCE_DATA> *outSubresourceData,
- std::vector<std::vector<BYTE>> *outData);
-
-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 gl::Error resolve(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.
- gl::Error resolveImpl(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)
- {
- }
-
- gl::Error resolve(Renderer11 *renderer) override
- {
- return this->resolveImpl(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;
-
- gl::Error resolve(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);
-
- gl::Error resolve(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);
- }
-}
-
-angle::WorkaroundsD3D GenerateWorkarounds(const Renderer11DeviceCaps &deviceCaps,
- const DXGI_ADAPTER_DESC &adapterDesc);
-
-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);
-} // 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, GLenum type);
-bool IsStreamingIndexData(const gl::Context *context, GLenum srcType);
-
-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,
- GLenum elementType,
- GLenum destElementType,
- unsigned int offset,
- bool *needsTranslation);
-
-// Used for state change notifications between buffers and vertex arrays.
-using OnBufferDataDirtyBinding = angle::ChannelBinding<size_t, const gl::Context *>;
-using OnBufferDataDirtyChannel = angle::BroadcastChannel<size_t, const gl::Context *>;
-using OnBufferDataDirtyReceiver = angle::SignalReceiver<size_t, const gl::Context *>;
-
-// Used for state change notifications between RenderTarget11 and Framebuffer11.
-using OnRenderTargetDirtyBinding = angle::ChannelBinding<size_t, const gl::Context *>;
-using OnRenderTargetDirtyChannel = angle::BroadcastChannel<size_t, const gl::Context *>;
-using OnRenderTargetDirtyReceiver = angle::SignalReceiver<size_t, const gl::Context *>;
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_UTILS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/BufferToTexture11.hlsl b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/BufferToTexture11.hlsl
deleted file mode 100644
index c43734f6a3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/BufferToTexture11.hlsl
+++ /dev/null
@@ -1,77 +0,0 @@
-Buffer<float4> Buffer4F : register(t0);
-Buffer<int4> Buffer4I : register(t0);
-Buffer<uint4> Buffer4UI : register(t0);
-
-struct VS_OUTPUT
-{
- float4 position : SV_Position;
- uint index : TEXCOORD0;
- uint slice : LAYER;
-};
-
-struct GS_OUTPUT
-{
- float4 position : SV_Position;
- uint index : TEXCOORD0;
- uint slice : SV_RenderTargetArrayIndex;
-};
-
-cbuffer BufferCopyParams : register(b0)
-{
- uint FirstPixelOffset;
- uint PixelsPerRow;
- uint RowStride;
- uint RowsPerSlice;
- float2 PositionOffset;
- float2 PositionScale;
- int2 TexLocationOffset;
- int2 TexLocationScale;
- uint FirstSlice;
-}
-
-void ComputePositionAndIndex(uint vertexID, out VS_OUTPUT outVertex)
-{
- uint PixelsPerSlice = PixelsPerRow * RowsPerSlice;
- uint SliceStride = RowStride * RowsPerSlice;
-
- uint slice = vertexID / PixelsPerSlice;
- uint sliceOffset = slice * PixelsPerSlice;
- uint row = (vertexID - sliceOffset) / PixelsPerRow;
- uint col = vertexID - sliceOffset - (row * PixelsPerRow);
-
- float2 coords = float2(float(col), float(row));
-
- outVertex.position = float4(PositionOffset + PositionScale * coords, 0.0f, 1.0f);
- outVertex.index = FirstPixelOffset + slice * SliceStride + row * RowStride + col;
- outVertex.slice = FirstSlice + slice;
-}
-
-void VS_BufferToTexture(in uint vertexID : SV_VertexID, out VS_OUTPUT outVertex)
-{
- ComputePositionAndIndex(vertexID, outVertex);
-}
-
-[maxvertexcount(1)]
-void GS_BufferToTexture(point VS_OUTPUT inVertex[1], inout PointStream<GS_OUTPUT> outStream)
-{
- GS_OUTPUT outVertex;
- outVertex.position = inVertex[0].position;
- outVertex.index = inVertex[0].index;
- outVertex.slice = inVertex[0].slice;
- outStream.Append(outVertex);
-}
-
-float4 PS_BufferToTexture_4F(in float4 inPosition : SV_Position, in uint inIndex : TEXCOORD0) : SV_Target
-{
- return Buffer4F.Load(inIndex);
-}
-
-int4 PS_BufferToTexture_4I(in float4 inPosition : SV_Position, in uint inIndex : TEXCOORD0) : SV_Target
-{
- return Buffer4I.Load(inIndex);
-}
-
-uint4 PS_BufferToTexture_4UI(in float4 inPosition : SV_Position, in uint inIndex : TEXCOORD0) : SV_Target
-{
- return Buffer4UI.Load(inIndex);
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Clear11.hlsl b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Clear11.hlsl
deleted file mode 100644
index 48f5b427ec..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Clear11.hlsl
+++ /dev/null
@@ -1,635 +0,0 @@
-//
-// Copyright (c) 2017 The ANGLE Project. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Clear11.hlsl: Shaders for clearing RTVs and DSVs using draw calls and
-// specifying float depth values and either float, uint or sint clear colors.
-// Notes:
-// - UINT & SINT clears can only be compiled with FL10+
-// - VS_Clear_FL9 requires a VB to be bound with vertices to create
-// a primitive covering the entire surface (in clip co-ordinates)
-
-// Constants
-static const float2 g_Corners[6] =
-{
- float2(-1.0f, 1.0f),
- float2( 1.0f, -1.0f),
- float2(-1.0f, -1.0f),
- float2(-1.0f, 1.0f),
- float2( 1.0f, 1.0f),
- float2( 1.0f, -1.0f),
-};
-
-// Vertex Shaders
-void VS_Clear(in uint id : SV_VertexID,
- out float4 outPosition : SV_POSITION)
-{
- float2 corner = g_Corners[id];
- outPosition = float4(corner.x, corner.y, 0.0f, 1.0f);
-}
-
-void VS_Multiview_Clear(in uint id : SV_VertexID,
- in uint instanceID : SV_InstanceID,
- out float4 outPosition : SV_POSITION,
- out uint outLayerID : TEXCOORD0)
-{
- float2 corner = g_Corners[id];
- outPosition = float4(corner.x, corner.y, 0.0f, 1.0f);
- outLayerID = instanceID;
-}
-
-void VS_Clear_FL9( in float4 inPosition : POSITION,
- out float4 outPosition : SV_POSITION)
-{
- outPosition = inPosition;
-}
-
-// Geometry shader for clearing multiview layered textures
-struct GS_INPUT
-{
- float4 inPosition : SV_Position;
- uint inLayerID : TEXCOORD0;
-};
-
-struct GS_OUTPUT
-{
- float4 outPosition : SV_Position;
- uint outLayerID : SV_RenderTargetArrayIndex;
-};
-
-[maxvertexcount(3)]
-void GS_Multiview_Clear(triangle GS_INPUT input[3], inout TriangleStream<GS_OUTPUT> outStream)
-{
- GS_OUTPUT output = (GS_OUTPUT)0;
- for (int i = 0; i < 3; i++)
- {
- output.outPosition = input[i].inPosition;
- output.outLayerID = input[i].inLayerID;
- outStream.Append(output);
- }
- outStream.RestartStrip();
-}
-
-// Pixel Shader Constant Buffers
-cbuffer ColorAndDepthDataFloat : register(b0)
-{
- float4 color_Float : packoffset(c0);
- float zValueF_Float : packoffset(c1);
-}
-
-cbuffer ColorAndDepthDataSint : register(b0)
-{
- int4 color_Sint : packoffset(c0);
- float zValueF_Sint : packoffset(c1);
-}
-
-cbuffer ColorAndDepthDataUint : register(b0)
-{
- uint4 color_Uint : packoffset(c0);
- float zValueF_Uint : packoffset(c1);
-}
-
-cbuffer DepthOnlyData : register(b0)
-{
- float zValue_Depth : packoffset(c1);
-}
-
-// Pixel Shader Output Structs
-struct PS_OutputFloat_FL9
-{
- float4 color0 : SV_TARGET0;
- float4 color1 : SV_TARGET1;
- float4 color2 : SV_TARGET2;
- float4 color3 : SV_TARGET3;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputFloat1
-{
- float4 color0 : SV_TARGET0;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputFloat2
-{
- float4 color0 : SV_TARGET0;
- float4 color1 : SV_TARGET1;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputFloat3
-{
- float4 color0 : SV_TARGET0;
- float4 color1 : SV_TARGET1;
- float4 color2 : SV_TARGET2;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputFloat4
-{
- float4 color0 : SV_TARGET0;
- float4 color1 : SV_TARGET1;
- float4 color2 : SV_TARGET2;
- float4 color3 : SV_TARGET3;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputFloat5
-{
- float4 color0 : SV_TARGET0;
- float4 color1 : SV_TARGET1;
- float4 color2 : SV_TARGET2;
- float4 color3 : SV_TARGET3;
- float4 color4 : SV_TARGET4;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputFloat6
-{
- float4 color0 : SV_TARGET0;
- float4 color1 : SV_TARGET1;
- float4 color2 : SV_TARGET2;
- float4 color3 : SV_TARGET3;
- float4 color4 : SV_TARGET4;
- float4 color5 : SV_TARGET5;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputFloat7
-{
- float4 color0 : SV_TARGET0;
- float4 color1 : SV_TARGET1;
- float4 color2 : SV_TARGET2;
- float4 color3 : SV_TARGET3;
- float4 color4 : SV_TARGET4;
- float4 color5 : SV_TARGET5;
- float4 color6 : SV_TARGET6;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputFloat8
-{
- float4 color0 : SV_TARGET0;
- float4 color1 : SV_TARGET1;
- float4 color2 : SV_TARGET2;
- float4 color3 : SV_TARGET3;
- float4 color4 : SV_TARGET4;
- float4 color5 : SV_TARGET5;
- float4 color6 : SV_TARGET6;
- float4 color7 : SV_TARGET7;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputUint1
-{
- uint4 color0 : SV_TARGET0;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputUint2
-{
- uint4 color0 : SV_TARGET0;
- uint4 color1 : SV_TARGET1;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputUint3
-{
- uint4 color0 : SV_TARGET0;
- uint4 color1 : SV_TARGET1;
- uint4 color2 : SV_TARGET2;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputUint4
-{
- uint4 color0 : SV_TARGET0;
- uint4 color1 : SV_TARGET1;
- uint4 color2 : SV_TARGET2;
- uint4 color3 : SV_TARGET3;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputUint5
-{
- uint4 color0 : SV_TARGET0;
- uint4 color1 : SV_TARGET1;
- uint4 color2 : SV_TARGET2;
- uint4 color3 : SV_TARGET3;
- uint4 color4 : SV_TARGET4;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputUint6
-{
- uint4 color0 : SV_TARGET0;
- uint4 color1 : SV_TARGET1;
- uint4 color2 : SV_TARGET2;
- uint4 color3 : SV_TARGET3;
- uint4 color4 : SV_TARGET4;
- uint4 color5 : SV_TARGET5;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputUint7
-{
- uint4 color0 : SV_TARGET0;
- uint4 color1 : SV_TARGET1;
- uint4 color2 : SV_TARGET2;
- uint4 color3 : SV_TARGET3;
- uint4 color4 : SV_TARGET4;
- uint4 color5 : SV_TARGET5;
- uint4 color6 : SV_TARGET6;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputUint8
-{
- uint4 color0 : SV_TARGET0;
- uint4 color1 : SV_TARGET1;
- uint4 color2 : SV_TARGET2;
- uint4 color3 : SV_TARGET3;
- uint4 color4 : SV_TARGET4;
- uint4 color5 : SV_TARGET5;
- uint4 color6 : SV_TARGET6;
- uint4 color7 : SV_TARGET7;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputSint1
-{
- int4 color0 : SV_TARGET0;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputSint2
-{
- int4 color0 : SV_TARGET0;
- int4 color1 : SV_TARGET1;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputSint3
-{
- int4 color0 : SV_TARGET0;
- int4 color1 : SV_TARGET1;
- int4 color2 : SV_TARGET2;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputSint4
-{
- int4 color0 : SV_TARGET0;
- int4 color1 : SV_TARGET1;
- int4 color2 : SV_TARGET2;
- int4 color3 : SV_TARGET3;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputSint5
-{
- int4 color0 : SV_TARGET0;
- int4 color1 : SV_TARGET1;
- int4 color2 : SV_TARGET2;
- int4 color3 : SV_TARGET3;
- int4 color4 : SV_TARGET4;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputSint6
-{
- int4 color0 : SV_TARGET0;
- int4 color1 : SV_TARGET1;
- int4 color2 : SV_TARGET2;
- int4 color3 : SV_TARGET3;
- int4 color4 : SV_TARGET4;
- int4 color5 : SV_TARGET5;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputSint7
-{
- int4 color0 : SV_TARGET0;
- int4 color1 : SV_TARGET1;
- int4 color2 : SV_TARGET2;
- int4 color3 : SV_TARGET3;
- int4 color4 : SV_TARGET4;
- int4 color5 : SV_TARGET5;
- int4 color6 : SV_TARGET6;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputSint8
-{
- int4 color0 : SV_TARGET0;
- int4 color1 : SV_TARGET1;
- int4 color2 : SV_TARGET2;
- int4 color3 : SV_TARGET3;
- int4 color4 : SV_TARGET4;
- int4 color5 : SV_TARGET5;
- int4 color6 : SV_TARGET6;
- int4 color7 : SV_TARGET7;
- float depth : SV_DEPTH;
-};
-
-struct PS_OutputDepth
-{
- float depth : SV_DEPTH;
-};
-
-// Pixel Shaders
-PS_OutputFloat_FL9 PS_ClearFloat_FL9(in float4 inPosition : SV_POSITION)
-{
- PS_OutputFloat_FL9 outData;
- outData.color0 = color_Float;
- outData.color1 = color_Float;
- outData.color2 = color_Float;
- outData.color3 = color_Float;
- outData.depth = zValueF_Float;
- return outData;
-}
-
-PS_OutputFloat1 PS_ClearFloat1(in float4 inPosition : SV_POSITION)
-{
- PS_OutputFloat1 outData;
- outData.color0 = color_Float;
- outData.depth = zValueF_Float;
- return outData;
-}
-
-PS_OutputFloat2 PS_ClearFloat2(in float4 inPosition : SV_POSITION)
-{
- PS_OutputFloat2 outData;
- outData.color0 = color_Float;
- outData.color1 = color_Float;
- outData.depth = zValueF_Float;
- return outData;
-}
-
-PS_OutputFloat3 PS_ClearFloat3(in float4 inPosition : SV_POSITION)
-{
- PS_OutputFloat3 outData;
- outData.color0 = color_Float;
- outData.color1 = color_Float;
- outData.color2 = color_Float;
- outData.depth = zValueF_Float;
- return outData;
-}
-
-PS_OutputFloat4 PS_ClearFloat4(in float4 inPosition : SV_POSITION)
-{
- PS_OutputFloat4 outData;
- outData.color0 = color_Float;
- outData.color1 = color_Float;
- outData.color2 = color_Float;
- outData.color3 = color_Float;
- outData.depth = zValueF_Float;
- return outData;
-}
-
-PS_OutputFloat5 PS_ClearFloat5(in float4 inPosition : SV_POSITION)
-{
- PS_OutputFloat5 outData;
- outData.color0 = color_Float;
- outData.color1 = color_Float;
- outData.color2 = color_Float;
- outData.color3 = color_Float;
- outData.color4 = color_Float;
- outData.depth = zValueF_Float;
- return outData;
-}
-
-PS_OutputFloat6 PS_ClearFloat6(in float4 inPosition : SV_POSITION)
-{
- PS_OutputFloat6 outData;
- outData.color0 = color_Float;
- outData.color1 = color_Float;
- outData.color2 = color_Float;
- outData.color3 = color_Float;
- outData.color4 = color_Float;
- outData.color5 = color_Float;
- outData.depth = zValueF_Float;
- return outData;
-}
-
-PS_OutputFloat7 PS_ClearFloat7(in float4 inPosition : SV_POSITION)
-{
- PS_OutputFloat7 outData;
- outData.color0 = color_Float;
- outData.color1 = color_Float;
- outData.color2 = color_Float;
- outData.color3 = color_Float;
- outData.color4 = color_Float;
- outData.color5 = color_Float;
- outData.color6 = color_Float;
- outData.depth = zValueF_Float;
- return outData;
-}
-
-PS_OutputFloat8 PS_ClearFloat8(in float4 inPosition : SV_POSITION)
-{
- PS_OutputFloat8 outData;
- outData.color0 = color_Float;
- outData.color1 = color_Float;
- outData.color2 = color_Float;
- outData.color3 = color_Float;
- outData.color4 = color_Float;
- outData.color5 = color_Float;
- outData.color6 = color_Float;
- outData.color7 = color_Float;
- outData.depth = zValueF_Float;
- return outData;
-}
-
-PS_OutputUint1 PS_ClearUint1(in float4 inPosition : SV_POSITION)
-{
- PS_OutputUint1 outData;
- outData.color0 = color_Uint;
- outData.depth = zValueF_Uint;
- return outData;
-}
-
-PS_OutputUint2 PS_ClearUint2(in float4 inPosition : SV_POSITION)
-{
- PS_OutputUint2 outData;
- outData.color0 = color_Uint;
- outData.color1 = color_Uint;
- outData.depth = zValueF_Uint;
- return outData;
-}
-
-PS_OutputUint3 PS_ClearUint3(in float4 inPosition : SV_POSITION)
-{
- PS_OutputUint3 outData;
- outData.color0 = color_Uint;
- outData.color1 = color_Uint;
- outData.color2 = color_Uint;
- outData.depth = zValueF_Uint;
- return outData;
-}
-
-PS_OutputUint4 PS_ClearUint4(in float4 inPosition : SV_POSITION)
-{
- PS_OutputUint4 outData;
- outData.color0 = color_Uint;
- outData.color1 = color_Uint;
- outData.color2 = color_Uint;
- outData.color3 = color_Uint;
- outData.depth = zValueF_Uint;
- return outData;
-}
-
-PS_OutputUint5 PS_ClearUint5(in float4 inPosition : SV_POSITION)
-{
- PS_OutputUint5 outData;
- outData.color0 = color_Uint;
- outData.color1 = color_Uint;
- outData.color2 = color_Uint;
- outData.color3 = color_Uint;
- outData.color4 = color_Uint;
- outData.depth = zValueF_Uint;
- return outData;
-}
-
-PS_OutputUint6 PS_ClearUint6(in float4 inPosition : SV_POSITION)
-{
- PS_OutputUint6 outData;
- outData.color0 = color_Uint;
- outData.color1 = color_Uint;
- outData.color2 = color_Uint;
- outData.color3 = color_Uint;
- outData.color4 = color_Uint;
- outData.color5 = color_Uint;
- outData.depth = zValueF_Uint;
- return outData;
-}
-
-PS_OutputUint7 PS_ClearUint7(in float4 inPosition : SV_POSITION)
-{
- PS_OutputUint7 outData;
- outData.color0 = color_Uint;
- outData.color1 = color_Uint;
- outData.color2 = color_Uint;
- outData.color3 = color_Uint;
- outData.color4 = color_Uint;
- outData.color5 = color_Uint;
- outData.color6 = color_Uint;
- outData.depth = zValueF_Uint;
- return outData;
-}
-
-PS_OutputUint8 PS_ClearUint8(in float4 inPosition : SV_POSITION)
-{
- PS_OutputUint8 outData;
- outData.color0 = color_Uint;
- outData.color1 = color_Uint;
- outData.color2 = color_Uint;
- outData.color3 = color_Uint;
- outData.color4 = color_Uint;
- outData.color5 = color_Uint;
- outData.color6 = color_Uint;
- outData.color7 = color_Uint;
- outData.depth = zValueF_Uint;
- return outData;
-}
-
-PS_OutputSint1 PS_ClearSint1(in float4 inPosition : SV_POSITION)
-{
- PS_OutputSint1 outData;
- outData.color0 = color_Sint;
- outData.depth = zValueF_Sint;
- return outData;
-}
-
-PS_OutputSint2 PS_ClearSint2(in float4 inPosition : SV_POSITION)
-{
- PS_OutputSint2 outData;
- outData.color0 = color_Sint;
- outData.color1 = color_Sint;
- outData.depth = zValueF_Sint;
- return outData;
-}
-
-PS_OutputSint3 PS_ClearSint3(in float4 inPosition : SV_POSITION)
-{
- PS_OutputSint3 outData;
- outData.color0 = color_Sint;
- outData.color1 = color_Sint;
- outData.color2 = color_Sint;
- outData.depth = zValueF_Sint;
- return outData;
-}
-
-PS_OutputSint4 PS_ClearSint4(in float4 inPosition : SV_POSITION)
-{
- PS_OutputSint4 outData;
- outData.color0 = color_Sint;
- outData.color1 = color_Sint;
- outData.color2 = color_Sint;
- outData.color3 = color_Sint;
- outData.depth = zValueF_Sint;
- return outData;
-}
-
-PS_OutputSint5 PS_ClearSint5(in float4 inPosition : SV_POSITION)
-{
- PS_OutputSint5 outData;
- outData.color0 = color_Sint;
- outData.color1 = color_Sint;
- outData.color2 = color_Sint;
- outData.color3 = color_Sint;
- outData.color4 = color_Sint;
- outData.depth = zValueF_Sint;
- return outData;
-}
-
-PS_OutputSint6 PS_ClearSint6(in float4 inPosition : SV_POSITION)
-{
- PS_OutputSint6 outData;
- outData.color0 = color_Sint;
- outData.color1 = color_Sint;
- outData.color2 = color_Sint;
- outData.color3 = color_Sint;
- outData.color4 = color_Sint;
- outData.color5 = color_Sint;
- outData.depth = zValueF_Sint;
- return outData;
-}
-
-PS_OutputSint7 PS_ClearSint7(in float4 inPosition : SV_POSITION)
-{
- PS_OutputSint7 outData;
- outData.color0 = color_Sint;
- outData.color1 = color_Sint;
- outData.color2 = color_Sint;
- outData.color3 = color_Sint;
- outData.color4 = color_Sint;
- outData.color5 = color_Sint;
- outData.color6 = color_Sint;
- outData.depth = zValueF_Sint;
- return outData;
-}
-
-PS_OutputSint8 PS_ClearSint8(in float4 inPosition : SV_POSITION)
-{
- PS_OutputSint8 outData;
- outData.color0 = color_Sint;
- outData.color1 = color_Sint;
- outData.color2 = color_Sint;
- outData.color3 = color_Sint;
- outData.color4 = color_Sint;
- outData.color5 = color_Sint;
- outData.color6 = color_Sint;
- outData.color7 = color_Sint;
- outData.depth = zValueF_Sint;
- return outData;
-}
-
-PS_OutputDepth PS_ClearDepth(in float4 inPosition : SV_POSITION)
-{
- PS_OutputDepth outData;
- outData.depth = zValue_Depth;
- return outData;
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/MultiplyAlpha.hlsl b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/MultiplyAlpha.hlsl
deleted file mode 100644
index 0d10b8eafa..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/MultiplyAlpha.hlsl
+++ /dev/null
@@ -1,131 +0,0 @@
-Texture2D<float4> TextureF : register(t0);
-Texture2D<uint4> TextureUI : register(t0);
-
-SamplerState Sampler : register(s0);
-
-// Notation:
-// PM: premultiply, UM: unmulitply, PT: passthrough
-// F: float, U: uint
-
-// Float to float LUMA
-float4 PS_FtoF_PM_LUMA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- color.rgb = color.r * color.a;
- color.a = 1.0f;
- return color;
-}
-float4 PS_FtoF_UM_LUMA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- if (color.a > 0.0f)
- {
- color.rgb = color.r / color.a;
- }
- color.a = 1.0f;
- return color;
-}
-
-// Float to float LUMAALPHA
-float4 PS_FtoF_PM_LUMAALPHA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- color.rgb = color.r * color.a;
- return color;
-}
-
-float4 PS_FtoF_UM_LUMAALPHA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- if (color.a > 0.0f)
- {
- color.rgb = color.r / color.a;
- }
- return color;
-}
-
-// Float to float RGBA
-float4 PS_FtoF_PM_RGBA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- color.rgb *= color.a;
- return color;
-}
-
-float4 PS_FtoF_UM_RGBA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- if (color.a > 0.0f)
- {
- color.rgb /= color.a;
- }
- return color;
-}
-
-// Float to float RGB
-float4 PS_FtoF_PM_RGB(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- color.rgb *= color.a;
- color.a = 1.0f;
- return color;
-}
-
-float4 PS_FtoF_UM_RGB(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- if (color.a > 0.0f)
- {
- color.rgb /= color.a;
- }
- color.a = 1.0f;
- return color;
-}
-
-// Float to uint RGBA
-uint4 PS_FtoU_PT_RGBA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- return uint4(color * 255);
-}
-
-uint4 PS_FtoU_PM_RGBA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- color.rgb *= color.a;
- return uint4(color * 255);
-}
-
-uint4 PS_FtoU_UM_RGBA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- if (color.a > 0.0f)
- {
- color.rgb /= color.a;
- }
- return uint4(color * 255);
-}
-
-// Float to uint RGB
-uint4 PS_FtoU_PT_RGB(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- return uint4(color.rgb * 255, 1);
-}
-
-uint4 PS_FtoU_PM_RGB(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- color.rgb *= color.a;
- return uint4(color.rgb * 255, 1);
-}
-
-uint4 PS_FtoU_UM_RGB(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
- if (color.a > 0.0f)
- {
- color.rgb /= color.a;
- }
- return uint4(color.rgb * 255, 1);
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough2D11.hlsl b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough2D11.hlsl
deleted file mode 100644
index 0b1a5ad169..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough2D11.hlsl
+++ /dev/null
@@ -1,122 +0,0 @@
-Texture2D<float4> TextureF : register(t0);
-Texture2DMS<float4> TextureF_MS: register(t0);
-Texture2D<uint4> TextureUI : register(t0);
-Texture2D<int4> TextureI : register(t0);
-
-SamplerState Sampler : register(s0);
-
-void VS_Passthrough2D( in float2 inPosition : POSITION, in float2 inTexCoord : TEXCOORD0,
- out float4 outPosition : SV_POSITION, out float2 outTexCoord : TEXCOORD0)
-{
- outPosition = float4(inPosition, 0.0f, 1.0f);
- outTexCoord = inTexCoord;
-}
-
-float PS_PassthroughDepth2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_DEPTH
-{
- return TextureF.Sample(Sampler, inTexCoord).r;
-}
-
-float4 PS_PassthroughRGBA2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return TextureF.Sample(Sampler, inTexCoord).rgba;
-}
-
-float4 PS_PassthroughA2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return float4(0.0f, 0.0f, 0.0f, TextureF.Sample(Sampler, inTexCoord).a);
-}
-
-float4 PS_PassthroughRGBA2DMS(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCORD0, in uint inSampleIndex : SV_SAMPLEINDEX) : SV_TARGET0
-{
- return TextureF_MS.sample[inSampleIndex][inTexCoord].rgba;
-}
-
-uint4 PS_PassthroughRGBA2DUI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint2 size;
- TextureUI.GetDimensions(size.x, size.y);
-
- return TextureUI.Load(int3(size * inTexCoord, 0)).rgba;
-}
-
-int4 PS_PassthroughRGBA2DI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint2 size;
- TextureI.GetDimensions(size.x, size.y);
-
- return TextureI.Load(int3(size * inTexCoord, 0)).rgba;
-}
-
-float4 PS_PassthroughRGB2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return float4(TextureF.Sample(Sampler, inTexCoord).rgb, 1.0f);
-}
-
-uint4 PS_PassthroughRGB2DUI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint2 size;
- TextureUI.GetDimensions(size.x, size.y);
-
- return uint4(TextureUI.Load(int3(size * inTexCoord, 0)).rgb, 0);
-}
-
-int4 PS_PassthroughRGB2DI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint2 size;
- TextureI.GetDimensions(size.x, size.y);
-
- return int4(TextureI.Load(int3(size * inTexCoord, 0)).rgb, 0);
-}
-
-float4 PS_PassthroughRG2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return float4(TextureF.Sample(Sampler, inTexCoord).rg, 0.0f, 1.0f);
-}
-
-uint4 PS_PassthroughRG2DUI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint2 size;
- TextureUI.GetDimensions(size.x, size.y);
-
- return uint4(TextureUI.Load(int3(size * inTexCoord, 0)).rg, 0, 0);
-}
-
-int4 PS_PassthroughRG2DI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint2 size;
- TextureI.GetDimensions(size.x, size.y);
-
- return int4(TextureI.Load(int3(size * inTexCoord, 0)).rg, 0, 0);
-}
-
-float4 PS_PassthroughR2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return float4(TextureF.Sample(Sampler, inTexCoord).r, 0.0f, 0.0f, 1.0f);
-}
-
-uint4 PS_PassthroughR2DUI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint2 size;
- TextureUI.GetDimensions(size.x, size.y);
-
- return uint4(TextureUI.Load(int3(size * inTexCoord, 0)).r, 0, 0, 0);
-}
-
-int4 PS_PassthroughR2DI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint2 size;
- TextureI.GetDimensions(size.x, size.y);
-
- return int4(TextureI.Load(int3(size * inTexCoord, 0)).r, 0, 0, 0);
-}
-
-float4 PS_PassthroughLum2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return float4(TextureF.Sample(Sampler, inTexCoord).rrr, 1.0f);
-}
-
-float4 PS_PassthroughLumAlpha2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return TextureF.Sample(Sampler, inTexCoord).rrra;
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough3D11.hlsl b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough3D11.hlsl
deleted file mode 100644
index c23c9032ec..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough3D11.hlsl
+++ /dev/null
@@ -1,146 +0,0 @@
-Texture3D<float4> TextureF : register(t0);
-Texture3D<uint4> TextureUI : register(t0);
-Texture3D<int4> TextureI : register(t0);
-
-SamplerState Sampler : register(s0);
-
-struct VS_INPUT
-{
- float2 Position : POSITION;
- uint Layer : LAYER;
- float3 TexCoord : TEXCOORD;
-};
-
-struct VS_OUTPUT
-{
- float4 Position : SV_POSITION;
- uint Layer : LAYER;
- float3 TexCoord : TEXCOORD;
-};
-
-struct GS_OUTPUT
-{
- float4 Position : SV_POSITION;
- uint Layer : SV_RENDERTARGETARRAYINDEX;
- float3 TexCoord : TEXCOORD;
-};
-
-VS_OUTPUT VS_Passthrough3D(VS_INPUT input)
-{
- VS_OUTPUT output;
-
- output.Position = float4(input.Position, 0.0f, 1.0f);
- output.Layer = input.Layer;
- output.TexCoord = input.TexCoord;
-
- return output;
-}
-
-[maxvertexcount(3)]
-void GS_Passthrough3D(triangle VS_OUTPUT input[3], inout TriangleStream<GS_OUTPUT> outputStream)
-{
- GS_OUTPUT output;
-
- for (int i = 0; i < 3; i++)
- {
- output.Position = input[i].Position;
- output.Layer = input[i].Layer;
- output.TexCoord = input[i].TexCoord;
-
- outputStream.Append(output);
- }
-}
-
-float4 PS_PassthroughRGBA3D(GS_OUTPUT input) : SV_TARGET0
-{
- return TextureF.Sample(Sampler, input.TexCoord).rgba;
-}
-
-uint4 PS_PassthroughRGBA3DUI(GS_OUTPUT input) : SV_TARGET0
-{
- uint3 size;
- TextureUI.GetDimensions(size.x, size.y, size.z);
-
- return TextureUI.Load(int4(size * input.TexCoord, 0)).rgba;
-}
-
-int4 PS_PassthroughRGBA3DI(GS_OUTPUT input) : SV_TARGET0
-{
- uint3 size;
- TextureI.GetDimensions(size.x, size.y, size.z);
-
- return TextureI.Load(int4(size * input.TexCoord, 0)).rgba;
-}
-
-float4 PS_PassthroughRGB3D(GS_OUTPUT input) : SV_TARGET0
-{
- return float4(TextureF.Sample(Sampler, input.TexCoord).rgb, 1.0f);
-}
-
-uint4 PS_PassthroughRGB3DUI(GS_OUTPUT input) : SV_TARGET0
-{
- uint3 size;
- TextureUI.GetDimensions(size.x, size.y, size.z);
-
- return uint4(TextureUI.Load(int4(size * input.TexCoord, 0)).rgb, 0);
-}
-
-int4 PS_PassthroughRGB3DI(GS_OUTPUT input) : SV_TARGET0
-{
- uint3 size;
- TextureI.GetDimensions(size.x, size.y, size.z);
-
- return int4(TextureI.Load(int4(size * input.TexCoord, 0)).rgb, 0);
-}
-
-float4 PS_PassthroughRG3D(GS_OUTPUT input) : SV_TARGET0
-{
- return float4(TextureF.Sample(Sampler, input.TexCoord).rg, 0.0f, 1.0f);
-}
-
-uint4 PS_PassthroughRG3DUI(GS_OUTPUT input) : SV_TARGET0
-{
- uint3 size;
- TextureUI.GetDimensions(size.x, size.y, size.z);
-
- return uint4(TextureUI.Load(int4(size * input.TexCoord, 0)).rg, 0, 0);
-}
-
-int4 PS_PassthroughRG3DI(GS_OUTPUT input) : SV_TARGET0
-{
- uint3 size;
- TextureI.GetDimensions(size.x, size.y, size.z);
-
- return int4(TextureI.Load(int4(size * input.TexCoord, 0)).rg, 0, 0);
-}
-
-float4 PS_PassthroughR3D(GS_OUTPUT input) : SV_TARGET0
-{
- return float4(TextureF.Sample(Sampler, input.TexCoord).r, 0.0f, 0.0f, 1.0f);
-}
-
-uint4 PS_PassthroughR3DUI(GS_OUTPUT input) : SV_TARGET0
-{
- uint3 size;
- TextureUI.GetDimensions(size.x, size.y, size.z);
-
- return uint4(TextureUI.Load(int4(size * input.TexCoord, 0)).r, 0, 0, 0);
-}
-
-int4 PS_PassthroughR3DI(GS_OUTPUT input) : SV_TARGET0
-{
- uint3 size;
- TextureI.GetDimensions(size.x, size.y, size.z);
-
- return int4(TextureI.Load(int4(size * input.TexCoord, 0)).r, 0, 0, 0);
-}
-
-float4 PS_PassthroughLum3D(GS_OUTPUT input) : SV_TARGET0
-{
- return float4(TextureF.Sample(Sampler, input.TexCoord).rrr, 1.0f);
-}
-
-float4 PS_PassthroughLumAlpha3D(GS_OUTPUT input) : SV_TARGET0
-{
- return TextureF.Sample(Sampler, input.TexCoord).rrra;
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/ResolveDepthStencil.hlsl b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/ResolveDepthStencil.hlsl
deleted file mode 100644
index 7dc40d4b6a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/ResolveDepthStencil.hlsl
+++ /dev/null
@@ -1,56 +0,0 @@
-static const float2 g_Corners[6] =
-{
- float2(-1.0f, 1.0f),
- float2( 1.0f, -1.0f),
- float2(-1.0f, -1.0f),
- float2(-1.0f, 1.0f),
- float2( 1.0f, 1.0f),
- float2( 1.0f, -1.0f),
-};
-
-void VS_ResolveDepthStencil(in uint id : SV_VertexID,
- out float4 position : SV_Position,
- out float2 texCoord : TEXCOORD0)
-{
- float2 corner = g_Corners[id];
- position = float4(corner.x, corner.y, 0.0f, 1.0f);
- texCoord = float2((corner.x + 1.0f) * 0.5f, (-corner.y + 1.0f) * 0.5f);
-}
-
-Texture2DMS<float> Depth : register(t0);
-Texture2DMS<uint2> Stencil : register(t1);
-
-void PS_ResolveDepth(in float4 position : SV_Position,
- in float2 texCoord : TEXCOORD0,
- out float depth : SV_Depth)
-{
- // MS samplers must use Load
- uint width, height, samples;
- Depth.GetDimensions(width, height, samples);
- uint2 coord = uint2(texCoord.x * float(width), texCoord.y * float(height));
- depth = Depth.Load(coord, 0).r;
-}
-
-void PS_ResolveDepthStencil(in float4 position : SV_Position,
- in float2 texCoord : TEXCOORD0,
- out float2 depthStencil : SV_Target0)
-{
- // MS samplers must use Load
- uint width, height, samples;
- Depth.GetDimensions(width, height, samples);
- uint2 coord = uint2(texCoord.x * float(width), texCoord.y * float(height));
- depthStencil.r = Depth.Load(coord, 0).r;
- depthStencil.g = float(Stencil.Load(coord, 0).g);
-}
-
-void PS_ResolveStencil(in float4 position : SV_Position,
- in float2 texCoord : TEXCOORD0,
- out float2 stencil : SV_Target0)
-{
- // MS samplers must use Load
- uint width, height, samples;
- Stencil.GetDimensions(width, height, samples);
- uint2 coord = uint2(texCoord.x * float(width), texCoord.y * float(height));
- stencil.r = 0.0f;
- stencil.g = float(Stencil.Load(coord, 0).g);
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Swizzle11.hlsl b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Swizzle11.hlsl
deleted file mode 100644
index 505e222137..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Swizzle11.hlsl
+++ /dev/null
@@ -1,99 +0,0 @@
-Texture2D<float4> TextureF2D : register(t0);
-Texture2D<uint4> TextureUI2D : register(t0);
-Texture2D<int4> TextureI2D : register(t0);
-
-Texture3D<float4> TextureF3D : register(t0);
-Texture3D<uint4> TextureUI3D : register(t0);
-Texture3D<int4> TextureI3D : register(t0);
-
-Texture2DArray<float4> TextureF2DArray : register(t0);
-Texture2DArray<uint4> TextureUI2DArray : register(t0);
-Texture2DArray<int4> TextureI2DArray : register(t0);
-
-SamplerState Sampler : register(s0);
-
-cbuffer SwizzleProperties : register(b0)
-{
- uint4 SwizzleIndices : packoffset(c0);
-}
-
-float4 SwizzleLookup(in float4 sample)
-{
- float lookup[6] = { sample[0], sample[1], sample[2], sample[3], 0.0f, 1.0f };
- return float4(lookup[SwizzleIndices[0]], lookup[SwizzleIndices[1]], lookup[SwizzleIndices[2]], lookup[SwizzleIndices[3]]);
-}
-
-int4 SwizzleLookup(in int4 sample)
-{
- int lookup[6] = { sample[0], sample[1], sample[2], sample[3], 0.0f, 1.0f };
- return int4(lookup[SwizzleIndices[0]], lookup[SwizzleIndices[1]], lookup[SwizzleIndices[2]], lookup[SwizzleIndices[3]]);
-}
-
-uint4 SwizzleLookup(in uint4 sample)
-{
- uint lookup[6] = { sample[0], sample[1], sample[2], sample[3], 0.0f, 1.0f };
- return uint4(lookup[SwizzleIndices[0]], lookup[SwizzleIndices[1]], lookup[SwizzleIndices[2]], lookup[SwizzleIndices[3]]);
-}
-
-float4 PS_SwizzleF2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return SwizzleLookup(TextureF2D.Sample(Sampler, inTexCoord));
-}
-
-int4 PS_SwizzleI2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint2 size;
- TextureI2D.GetDimensions(size.x, size.y);
-
- return SwizzleLookup(TextureI2D.Load(int3(size * inTexCoord, 0)));
-}
-
-uint4 PS_SwizzleUI2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint2 size;
- TextureUI2D.GetDimensions(size.x, size.y);
-
- return SwizzleLookup(TextureUI2D.Load(int3(size * inTexCoord, 0)));
-}
-
-float4 PS_SwizzleF3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return SwizzleLookup(TextureF3D.Sample(Sampler, inTexCoord));
-}
-
-int4 PS_SwizzleI3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint3 size;
- TextureI3D.GetDimensions(size.x, size.y, size.z);
-
- return SwizzleLookup(TextureI3D.Load(int4(size * inTexCoord, 0)));
-}
-
-uint4 PS_SwizzleUI3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint3 size;
- TextureUI3D.GetDimensions(size.x, size.y, size.z);
-
- return SwizzleLookup(TextureUI3D.Load(int4(size * inTexCoord, 0)));
-}
-
-float4 PS_SwizzleF2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return SwizzleLookup(TextureF2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)));
-}
-
-int4 PS_SwizzleI2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint3 size;
- TextureI2DArray.GetDimensions(size.x, size.y, size.z);
-
- return SwizzleLookup(TextureI2DArray.Load(int4(size.xy * inTexCoord.xy, inLayer, 0)));
-}
-
-uint4 PS_SwizzleUI2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- uint3 size;
- TextureUI2DArray.GetDimensions(size.x, size.y, size.z);
-
- return SwizzleLookup(TextureUI2DArray.Load(int4(size.xy * inTexCoord.xy, inLayer, 0)));
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dms11ps.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dms11ps.h
deleted file mode 100644
index a5cccdc98e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dms11ps.h
+++ /dev/null
@@ -1,155 +0,0 @@
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 10.1
-//
-//
-// Resource Bindings:
-//
-// Name Type Format Dim HLSL Bind Count
-// ------------------------------ ---------- ------- ----------- -------------- ------
-// TextureF_MS texture float4 2dMS t0 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 constant 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, 206, 115,
- 73, 27, 160, 237, 59, 223,
- 179, 180, 28, 146, 74, 174,
- 29, 197, 1, 0, 0, 0,
- 136, 2, 0, 0, 5, 0,
- 0, 0, 52, 0, 0, 0,
- 172, 0, 0, 0, 40, 1,
- 0, 0, 92, 1, 0, 0,
- 12, 2, 0, 0, 82, 68,
- 69, 70, 112, 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, 49,
- 48, 46, 49, 0, 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_data.json b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_data.json
deleted file mode 100644
index 61cd44a62b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_data.json
+++ /dev/null
@@ -1,523 +0,0 @@
-{
- "NONE": {
- },
- "A8_UNORM": {
- "texFormat": "DXGI_FORMAT_A8_UNORM",
- "srvFormat": "DXGI_FORMAT_A8_UNORM",
- "rtvFormat": "DXGI_FORMAT_A8_UNORM",
- "channels": "a",
- "componentType": "unorm",
- "bits": { "alpha": 8 },
- "supportTest": "OnlyFL10Plus(deviceCaps)",
- "fallbackFormat": "R8G8B8A8_UNORM"
- },
- "R8G8B8A8_UNORM": {
- "texFormat": "DXGI_FORMAT_R8G8B8A8_UNORM",
- "srvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM",
- "rtvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM",
- "channels": "rgba",
- "componentType": "unorm",
- "bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
- "glInternalFormat": "GL_RGBA8"
- },
- "R16G16B16A16_UNORM": {
- "texFormat": "DXGI_FORMAT_R16G16B16A16_UNORM",
- "srvFormat": "DXGI_FORMAT_R16G16B16A16_UNORM",
- "rtvFormat": "DXGI_FORMAT_R16G16B16A16_UNORM",
- "channels": "rgba",
- "componentType": "unorm",
- "bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
- "glInternalFormat": "GL_RGBA16_EXT"
- },
- "R16G16B16A16_FLOAT": {
- "texFormat": "DXGI_FORMAT_R16G16B16A16_FLOAT",
- "srvFormat": "DXGI_FORMAT_R16G16B16A16_FLOAT",
- "rtvFormat": "DXGI_FORMAT_R16G16B16A16_FLOAT",
- "channels": "rgba",
- "componentType": "float",
- "bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
- "glInternalFormat": "GL_RGBA16F"
- },
- "R32G32B32A32_FLOAT": {
- "texFormat": "DXGI_FORMAT_R32G32B32A32_FLOAT",
- "srvFormat": "DXGI_FORMAT_R32G32B32A32_FLOAT",
- "rtvFormat": "DXGI_FORMAT_R32G32B32A32_FLOAT",
- "channels": "rgba",
- "componentType": "float",
- "bits": { "red": 32, "green": 32, "blue": 32, "alpha": 32 },
- "glInternalFormat": "GL_RGBA32F"
- },
- "B8G8R8A8_UNORM": {
- "texFormat": "DXGI_FORMAT_B8G8R8A8_UNORM",
- "srvFormat": "DXGI_FORMAT_B8G8R8A8_UNORM",
- "rtvFormat": "DXGI_FORMAT_B8G8R8A8_UNORM",
- "channels": "bgra",
- "componentType": "unorm",
- "bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
- "glInternalFormat": "GL_BGRA8_EXT"
- },
- "B8G8R8A8_UNORM_SRGB": {
- "texFormat": "DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",
- "srvFormat": "DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",
- "rtvFormat": "DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",
- "channels": "bgra",
- "componentType": "unorm",
- "bits": {"red": 8, "green": 8, "blue": 8,"alpha": 8},
- "siwzzleFormat": "GL_RGBA8"
- },
- "BC1_RGBA_UNORM_BLOCK": {
- "texFormat": "DXGI_FORMAT_BC1_UNORM",
- "srvFormat": "DXGI_FORMAT_BC1_UNORM",
- "channels": "rgba",
- "componentType": "unorm",
- "swizzleFormat": "GL_RGBA8"
- },
- "BC1_RGB_UNORM_BLOCK": {
- "texFormat": "DXGI_FORMAT_BC1_UNORM",
- "srvFormat": "DXGI_FORMAT_BC1_UNORM",
- "channels": "rgba",
- "componentType": "unorm",
- "swizzleFormat": "GL_RGBA8"
- },
- "BC2_RGBA_UNORM_BLOCK": {
- "texFormat": "DXGI_FORMAT_BC2_UNORM",
- "srvFormat": "DXGI_FORMAT_BC2_UNORM",
- "channels": "rgba",
- "componentType": "unorm",
- "swizzleFormat": "GL_RGBA8"
- },
- "BC3_RGBA_UNORM_BLOCK": {
- "texFormat": "DXGI_FORMAT_BC3_UNORM",
- "srvFormat": "DXGI_FORMAT_BC3_UNORM",
- "channels": "rgba",
- "componentType": "unorm",
- "swizzleFormat": "GL_RGBA8"
- },
- "BC1_RGBA_UNORM_SRGB_BLOCK": {
- "texFormat": "DXGI_FORMAT_BC1_UNORM_SRGB",
- "srvFormat": "DXGI_FORMAT_BC1_UNORM_SRGB",
- "channels": "rgba",
- "componentType": "unorm",
- "swizzleFormat": "GL_RGBA8"
- },
- "BC1_RGB_UNORM_SRGB_BLOCK": {
- "texFormat": "DXGI_FORMAT_BC1_UNORM_SRGB",
- "srvFormat": "DXGI_FORMAT_BC1_UNORM_SRGB",
- "channels": "rgba",
- "componentType": "unorm",
- "swizzleFormat": "GL_RGBA8"
- },
- "BC2_RGBA_UNORM_SRGB_BLOCK": {
- "texFormat": "DXGI_FORMAT_BC2_UNORM_SRGB",
- "srvFormat": "DXGI_FORMAT_BC2_UNORM_SRGB",
- "channels": "rgba",
- "componentType": "unorm",
- "swizzleFormat": "GL_RGBA8"
- },
- "BC3_RGBA_UNORM_SRGB_BLOCK": {
- "texFormat": "DXGI_FORMAT_BC3_UNORM_SRGB",
- "srvFormat": "DXGI_FORMAT_BC3_UNORM_SRGB",
- "channels": "rgba",
- "componentType": "unorm",
- "swizzleFormat": "GL_RGBA8"
- },
- "D24_UNORM_S8_UINT": {
- "FL10Plus": {
- "texFormat": "DXGI_FORMAT_R24G8_TYPELESS",
- "srvFormat": "DXGI_FORMAT_R24_UNORM_X8_TYPELESS"
- },
- "FL9_3": {
- "texFormat": "DXGI_FORMAT_D24_UNORM_S8_UINT"
- },
- "dsvFormat": "DXGI_FORMAT_D24_UNORM_S8_UINT",
- "channels": "ds",
- "bits": { "depth": 24, "stencil": 8 },
- "glInternalFormat": "GL_DEPTH24_STENCIL8_OES"
- },
- "D32_FLOAT_S8X24_UINT": {
- "texFormat": "DXGI_FORMAT_R32G8X24_TYPELESS",
- "srvFormat": "DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",
- "dsvFormat": "DXGI_FORMAT_D32_FLOAT_S8X24_UINT",
- "channels": "ds",
- "bits": { "depth": 32, "stencil": 8 },
- "glInternalFormat": "GL_DEPTH32F_STENCIL8"
- },
- "D16_UNORM": {
- "FL10Plus": {
- "texFormat": "DXGI_FORMAT_R16_TYPELESS",
- "srvFormat": "DXGI_FORMAT_R16_UNORM"
- },
- "FL9_3": {
- "texFormat": "DXGI_FORMAT_D16_UNORM"
- },
- "dsvFormat": "DXGI_FORMAT_D16_UNORM",
- "channels": "d",
- "componentType": "unorm",
- "bits": { "depth": 16 },
- "glInternalFormat": "GL_DEPTH_COMPONENT16"
- },
- "D32_FLOAT": {
- "texFormat": "DXGI_FORMAT_R32_TYPELESS",
- "srvFormat": "DXGI_FORMAT_R32_FLOAT",
- "dsvFormat": "DXGI_FORMAT_D32_FLOAT",
- "channels": "d",
- "componentType": "float",
- "bits": { "depth": 32 },
- "glInternalFormat": "GL_DEPTH_COMPONENT32F"
- },
- "R11G11B10_FLOAT": {
- "texFormat": "DXGI_FORMAT_R11G11B10_FLOAT",
- "srvFormat": "DXGI_FORMAT_R11G11B10_FLOAT",
- "rtvFormat": "DXGI_FORMAT_R11G11B10_FLOAT",
- "channels": "rgb",
- "componentType": "float",
- "bits": { "red": 11, "green": 11, "blue": 10 },
- "glInternalFormat": "GL_R11F_G11F_B10F"
- },
- "R16_FLOAT": {
- "texFormat": "DXGI_FORMAT_R16_FLOAT",
- "srvFormat": "DXGI_FORMAT_R16_FLOAT",
- "rtvFormat": "DXGI_FORMAT_R16_FLOAT",
- "channels": "r",
- "componentType": "float",
- "bits": { "red": 16 },
- "glInternalFormat": "GL_R16F"
- },
- "R16_SINT": {
- "texFormat": "DXGI_FORMAT_R16_SINT",
- "srvFormat": "DXGI_FORMAT_R16_SINT",
- "rtvFormat": "DXGI_FORMAT_R16_SINT",
- "channels": "r",
- "componentType": "int",
- "bits": { "red": 16 },
- "glInternalFormat": "GL_R16I"
- },
- "R16_UINT": {
- "texFormat": "DXGI_FORMAT_R16_UINT",
- "srvFormat": "DXGI_FORMAT_R16_UINT",
- "rtvFormat": "DXGI_FORMAT_R16_UINT",
- "channels": "r",
- "componentType": "uint",
- "bits": { "red": 16 },
- "glInternalFormat": "GL_R16UI"
- },
- "R32_FLOAT": {
- "texFormat": "DXGI_FORMAT_R32_FLOAT",
- "srvFormat": "DXGI_FORMAT_R32_FLOAT",
- "rtvFormat": "DXGI_FORMAT_R32_FLOAT",
- "channels": "r",
- "componentType": "float",
- "bits": { "red": 32 },
- "glInternalFormat": "GL_R32F"
- },
- "R32_SINT": {
- "texFormat": "DXGI_FORMAT_R32_SINT",
- "srvFormat": "DXGI_FORMAT_R32_SINT",
- "rtvFormat": "DXGI_FORMAT_R32_SINT",
- "channels": "r",
- "componentType": "int",
- "bits": { "red": 32 },
- "glInternalFormat": "GL_R32I"
- },
- "R32_UINT": {
- "texFormat": "DXGI_FORMAT_R32_UINT",
- "srvFormat": "DXGI_FORMAT_R32_UINT",
- "rtvFormat": "DXGI_FORMAT_R32_UINT",
- "channels": "r",
- "componentType": "uint",
- "bits": { "red": 32 },
- "glInternalFormat": "GL_R32UI"
- },
- "R8_UNORM": {
- "texFormat": "DXGI_FORMAT_R8_UNORM",
- "srvFormat": "DXGI_FORMAT_R8_UNORM",
- "rtvFormat": "DXGI_FORMAT_R8_UNORM",
- "channels": "r",
- "componentType": "unorm",
- "bits": { "red": 8 },
- "glInternalFormat": "GL_R8"
- },
- "R8_SINT": {
- "texFormat": "DXGI_FORMAT_R8_SINT",
- "srvFormat": "DXGI_FORMAT_R8_SINT",
- "rtvFormat": "DXGI_FORMAT_R8_SINT",
- "channels": "r",
- "componentType": "int",
- "bits": { "red": 8 },
- "glInternalFormat": "GL_R8I"
- },
- "R8_UINT": {
- "texFormat": "DXGI_FORMAT_R8_UINT",
- "srvFormat": "DXGI_FORMAT_R8_UINT",
- "rtvFormat": "DXGI_FORMAT_R8_UINT",
- "channels": "r",
- "componentType": "uint",
- "bits": { "red": 8 },
- "glInternalFormat": "GL_R8UI"
- },
- "R8_SNORM": {
- "texFormat": "DXGI_FORMAT_R8_SNORM",
- "srvFormat": "DXGI_FORMAT_R8_SNORM",
- "channels": "r",
- "componentType": "snorm",
- "bits": { "red": 8 },
- "glInternalFormat": "GL_R8_SNORM"
- },
- "R16G16_FLOAT": {
- "texFormat": "DXGI_FORMAT_R16G16_FLOAT",
- "srvFormat": "DXGI_FORMAT_R16G16_FLOAT",
- "rtvFormat": "DXGI_FORMAT_R16G16_FLOAT",
- "channels": "rg",
- "componentType": "float",
- "bits": { "red": 16, "green": 16 },
- "glInternalFormat": "GL_RG16F"
- },
- "R16G16_SINT": {
- "texFormat": "DXGI_FORMAT_R16G16_SINT",
- "srvFormat": "DXGI_FORMAT_R16G16_SINT",
- "rtvFormat": "DXGI_FORMAT_R16G16_SINT",
- "channels": "rg",
- "componentType": "int",
- "bits": { "red": 16, "green": 16 },
- "glInternalFormat": "GL_RG16I"
- },
- "R16G16_UINT": {
- "texFormat": "DXGI_FORMAT_R16G16_UINT",
- "srvFormat": "DXGI_FORMAT_R16G16_UINT",
- "rtvFormat": "DXGI_FORMAT_R16G16_UINT",
- "channels": "rg",
- "componentType": "uint",
- "bits": { "red": 16, "green": 16 },
- "glInternalFormat": "GL_RG16UI"
- },
- "R32G32_FLOAT": {
- "texFormat": "DXGI_FORMAT_R32G32_FLOAT",
- "srvFormat": "DXGI_FORMAT_R32G32_FLOAT",
- "rtvFormat": "DXGI_FORMAT_R32G32_FLOAT",
- "channels": "rg",
- "componentType": "float",
- "bits": { "red": 32, "green": 32 },
- "glInternalFormat": "GL_RG32F"
- },
- "R32G32_SINT": {
- "texFormat": "DXGI_FORMAT_R32G32_SINT",
- "srvFormat": "DXGI_FORMAT_R32G32_SINT",
- "rtvFormat": "DXGI_FORMAT_R32G32_SINT",
- "channels": "rg",
- "componentType": "int",
- "bits": { "red": 32, "green": 32 },
- "glInternalFormat": "GL_RG32I"
- },
- "R32G32_UINT": {
- "texFormat": "DXGI_FORMAT_R32G32_UINT",
- "srvFormat": "DXGI_FORMAT_R32G32_UINT",
- "rtvFormat": "DXGI_FORMAT_R32G32_UINT",
- "channels": "rg",
- "componentType": "uint",
- "bits": { "red": 32, "green": 32 },
- "glInternalFormat": "GL_RG32UI"
- },
- "R8G8_UNORM": {
- "texFormat": "DXGI_FORMAT_R8G8_UNORM",
- "srvFormat": "DXGI_FORMAT_R8G8_UNORM",
- "rtvFormat": "DXGI_FORMAT_R8G8_UNORM",
- "channels": "rg",
- "componentType": "unorm",
- "bits": { "red": 8, "green": 8 },
- "glInternalFormat": "GL_RG8"
- },
- "R8G8_SINT": {
- "texFormat": "DXGI_FORMAT_R8G8_SINT",
- "srvFormat": "DXGI_FORMAT_R8G8_SINT",
- "rtvFormat": "DXGI_FORMAT_R8G8_SINT",
- "channels": "rg",
- "componentType": "int",
- "bits": { "red": 8, "green": 8 },
- "glInternalFormat": "GL_RG8I"
- },
- "R8G8_UINT": {
- "texFormat": "DXGI_FORMAT_R8G8_UINT",
- "srvFormat": "DXGI_FORMAT_R8G8_UINT",
- "rtvFormat": "DXGI_FORMAT_R8G8_UINT",
- "channels": "rg",
- "componentType": "uint",
- "bits": { "red": 8, "green": 8 },
- "glInternalFormat": "GL_RG8UI"
- },
- "R8G8_SNORM": {
- "texFormat": "DXGI_FORMAT_R8G8_SNORM",
- "srvFormat": "DXGI_FORMAT_R8G8_SNORM",
- "channels": "rg",
- "componentType": "snorm",
- "bits": { "red": 8, "green": 8 },
- "glInternalFormat": "GL_RG8_SNORM"
- },
- "R10G10B10A2_UNORM": {
- "texFormat": "DXGI_FORMAT_R10G10B10A2_UNORM",
- "srvFormat": "DXGI_FORMAT_R10G10B10A2_UNORM",
- "rtvFormat": "DXGI_FORMAT_R10G10B10A2_UNORM",
- "channels": "rgba",
- "componentType": "unorm",
- "bits": { "red": 10, "green": 10, "blue": 10, "alpha": 2 },
- "glInternalFormat": "GL_RGB10_A2"
- },
- "R10G10B10A2_UINT": {
- "texFormat": "DXGI_FORMAT_R10G10B10A2_UINT",
- "srvFormat": "DXGI_FORMAT_R10G10B10A2_UINT",
- "rtvFormat": "DXGI_FORMAT_R10G10B10A2_UINT",
- "channels": "rgba",
- "componentType": "uint",
- "bits": { "red": 10, "green": 10, "blue": 10, "alpha": 2 },
- "glInternalFormat": "GL_RGB10_A2UI"
- },
- "R16G16B16A16_SINT": {
- "texFormat": "DXGI_FORMAT_R16G16B16A16_SINT",
- "srvFormat": "DXGI_FORMAT_R16G16B16A16_SINT",
- "rtvFormat": "DXGI_FORMAT_R16G16B16A16_SINT",
- "channels": "rgba",
- "componentType": "int",
- "bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
- "glInternalFormat": "GL_RGBA16I"
- },
- "R16G16B16A16_UINT": {
- "texFormat": "DXGI_FORMAT_R16G16B16A16_UINT",
- "srvFormat": "DXGI_FORMAT_R16G16B16A16_UINT",
- "rtvFormat": "DXGI_FORMAT_R16G16B16A16_UINT",
- "channels": "rgba",
- "componentType": "uint",
- "bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
- "glInternalFormat": "GL_RGBA16UI"
- },
- "R32G32B32A32_SINT": {
- "texFormat": "DXGI_FORMAT_R32G32B32A32_SINT",
- "srvFormat": "DXGI_FORMAT_R32G32B32A32_SINT",
- "rtvFormat": "DXGI_FORMAT_R32G32B32A32_SINT",
- "channels": "rgba",
- "componentType": "int",
- "bits": { "red": 32, "green": 32, "blue": 32, "alpha": 32 },
- "glInternalFormat": "GL_RGBA32I"
- },
- "R32G32B32A32_UINT": {
- "texFormat": "DXGI_FORMAT_R32G32B32A32_UINT",
- "srvFormat": "DXGI_FORMAT_R32G32B32A32_UINT",
- "rtvFormat": "DXGI_FORMAT_R32G32B32A32_UINT",
- "channels": "rgba",
- "componentType": "uint",
- "bits": { "red": 32, "green": 32, "blue": 32, "alpha": 32 },
- "glInternalFormat": "GL_RGBA32UI"
- },
- "B5G6R5_UNORM": {
- "texFormat": "DXGI_FORMAT_B5G6R5_UNORM",
- "srvFormat": "DXGI_FORMAT_B5G6R5_UNORM",
- "rtvFormat": "DXGI_FORMAT_B5G6R5_UNORM",
- "channels": "bgr",
- "componentType": "unorm",
- "bits": { "red": 5, "green": 6, "blue": 5 },
- "supportTest": "SupportsFormat(DXGI_FORMAT_B5G6R5_UNORM, deviceCaps)",
- "fallbackFormat": "R8G8B8A8_UNORM"
- },
- "B5G5R5A1_UNORM": {
- "texFormat": "DXGI_FORMAT_B5G5R5A1_UNORM",
- "srvFormat": "DXGI_FORMAT_B5G5R5A1_UNORM",
- "rtvFormat": "DXGI_FORMAT_B5G5R5A1_UNORM",
- "channels": "bgra",
- "componentType": "unorm",
- "bits": { "red": 5, "green": 5, "blue": 5, "alpha": 1 },
- "supportTest": "SupportsFormat(DXGI_FORMAT_B5G5R5A1_UNORM, deviceCaps)",
- "fallbackFormat": "R8G8B8A8_UNORM"
- },
- "R8G8B8A8_SINT": {
- "texFormat": "DXGI_FORMAT_R8G8B8A8_SINT",
- "srvFormat": "DXGI_FORMAT_R8G8B8A8_SINT",
- "rtvFormat": "DXGI_FORMAT_R8G8B8A8_SINT",
- "channels": "rgba",
- "componentType": "int",
- "bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
- "glInternalFormat": "GL_RGBA8I"
- },
- "R8G8B8A8_UINT": {
- "texFormat": "DXGI_FORMAT_R8G8B8A8_UINT",
- "srvFormat": "DXGI_FORMAT_R8G8B8A8_UINT",
- "rtvFormat": "DXGI_FORMAT_R8G8B8A8_UINT",
- "channels": "rgba",
- "componentType": "uint",
- "bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
- "glInternalFormat": "GL_RGBA8UI"
- },
- "R8G8B8A8_SNORM": {
- "texFormat": "DXGI_FORMAT_R8G8B8A8_SNORM",
- "srvFormat": "DXGI_FORMAT_R8G8B8A8_SNORM",
- "channels": "rgba",
- "componentType": "snorm",
- "bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
- "glInternalFormat": "GL_RGBA8_SNORM"
- },
- "R9G9B9E5_SHAREDEXP": {
- "texFormat": "DXGI_FORMAT_R9G9B9E5_SHAREDEXP",
- "srvFormat": "DXGI_FORMAT_R9G9B9E5_SHAREDEXP",
- "channels": "rgb",
- "componentType": "float",
- "bits": { "red": 9, "green": 9, "blue": 9, "shared": 5 }
- },
- "B4G4R4A4_UNORM": {
- "texFormat": "DXGI_FORMAT_B4G4R4A4_UNORM",
- "srvFormat": "DXGI_FORMAT_B4G4R4A4_UNORM",
- "rtvFormat": "DXGI_FORMAT_B4G4R4A4_UNORM",
- "channels": "bgra",
- "componentType": "unorm",
- "bits": { "red": 4, "green": 4, "blue": 4, "alpha": 4 },
- "supportTest": "SupportsFormat(DXGI_FORMAT_B4G4R4A4_UNORM, deviceCaps)",
- "fallbackFormat": "R8G8B8A8_UNORM"
- },
- "R8G8B8A8_UNORM_SRGB": {
- "texFormat": "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",
- "srvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",
- "rtvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",
- "channels": "rgba",
- "componentType": "unorm",
- "bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
- "glInternalFormat": "GL_SRGB8_ALPHA8"
- },
- "R16_UNORM": {
- "texFormat": "DXGI_FORMAT_R16_UNORM",
- "srvFormat": "DXGI_FORMAT_R16_UNORM",
- "rtvFormat": "DXGI_FORMAT_R16_UNORM",
- "channels": "r",
- "componentType": "unorm",
- "bits": { "red": 16 },
- "glInternalFormat": "GL_R16_EXT"
- },
- "R16G16_UNORM": {
- "texFormat": "DXGI_FORMAT_R16G16_UNORM",
- "srvFormat": "DXGI_FORMAT_R16G16_UNORM",
- "rtvFormat": "DXGI_FORMAT_R16G16_UNORM",
- "channels": "rg",
- "componentType": "unorm",
- "bits": { "red": 16, "green": 16 },
- "glInternalFormat": "GL_RG16_EXT"
- },
- "R16_SNORM": {
- "texFormat": "DXGI_FORMAT_R16_SNORM",
- "srvFormat": "DXGI_FORMAT_R16_SNORM",
- "channels": "r",
- "componentType": "snorm",
- "bits": { "red": 16 },
- "glInternalFormat": "GL_R16_SNORM_EXT"
- },
- "R16G16_SNORM": {
- "texFormat": "DXGI_FORMAT_R16G16_SNORM",
- "srvFormat": "DXGI_FORMAT_R16G16_SNORM",
- "channels": "rg",
- "componentType": "snorm",
- "bits": { "red": 16, "green": 16 },
- "glInternalFormat": "GL_RG16_SNORM_EXT"
- },
- "R16G16B16A16_SNORM": {
- "texFormat": "DXGI_FORMAT_R16G16B16A16_SNORM",
- "srvFormat": "DXGI_FORMAT_R16G16B16A16_SNORM",
- "channels": "rgba",
- "componentType": "snorm",
- "bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
- "glInternalFormat": "GL_RGBA16_SNORM_EXT"
- }
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_map.json b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_map.json
deleted file mode 100644
index 3ef2355645..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_map.json
+++ /dev/null
@@ -1,78 +0,0 @@
-{
- "GL_ALPHA16F_EXT": "R16G16B16A16_FLOAT",
- "GL_ALPHA32F_EXT": "R32G32B32A32_FLOAT",
- "GL_BGR5_A1_ANGLEX": "B8G8R8A8_UNORM",
- "GL_BGRA4_ANGLEX": "B8G8R8A8_UNORM",
- "GL_BGRA8_SRGB_ANGLEX": "B8G8R8A8_UNORM_SRGB",
- "GL_COMPRESSED_R11_EAC": "R8_UNORM",
- "GL_COMPRESSED_RG11_EAC": "R8G8_UNORM",
- "GL_COMPRESSED_RGB8_ETC2": "R8G8B8A8_UNORM",
- "GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2": "R8G8B8A8_UNORM",
- "GL_COMPRESSED_RGBA8_ETC2_EAC": "R8G8B8A8_UNORM",
- "GL_COMPRESSED_RGBA_ASTC_4x4_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_5x4_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_5x5_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_6x5_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_6x6_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_8x5_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_8x6_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_8x8_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_10x5_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_10x6_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_10x8_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_10x10_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_12x10_KHR": "NONE",
- "GL_COMPRESSED_RGBA_ASTC_12x12_KHR": "NONE",
- "GL_COMPRESSED_SIGNED_R11_EAC": "R8_SNORM",
- "GL_COMPRESSED_SIGNED_RG11_EAC": "R8G8_SNORM",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR": "NONE",
- "GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC": "R8G8B8A8_UNORM_SRGB",
- "GL_COMPRESSED_SRGB8_ETC2": "R8G8B8A8_UNORM_SRGB",
- "GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2": "R8G8B8A8_UNORM_SRGB",
- "GL_DEPTH_COMPONENT24": "D24_UNORM_S8_UINT",
- "GL_DEPTH_COMPONENT32_OES": "D24_UNORM_S8_UINT",
- "GL_ETC1_RGB8_OES": "R8G8B8A8_UNORM",
- "GL_ETC1_RGB8_LOSSY_DECODE_ANGLE": "BC1_RGB_UNORM_BLOCK",
- "GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE": "BC1_RGB_UNORM_BLOCK",
- "GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE": "BC1_RGB_UNORM_SRGB_BLOCK",
- "GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE": "BC1_RGBA_UNORM_BLOCK",
- "GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE": "BC1_RGBA_UNORM_SRGB_BLOCK",
- "GL_LUMINANCE16F_EXT": "R16G16B16A16_FLOAT",
- "GL_LUMINANCE32F_EXT": "R32G32B32A32_FLOAT",
- "GL_LUMINANCE8_ALPHA8_EXT": "R8G8B8A8_UNORM",
- "GL_LUMINANCE8_EXT": "R8G8B8A8_UNORM",
- "GL_LUMINANCE_ALPHA16F_EXT": "R16G16B16A16_FLOAT",
- "GL_LUMINANCE_ALPHA32F_EXT": "R32G32B32A32_FLOAT",
- "GL_RGB": "R8G8B8A8_UNORM",
- "GL_RGB16F": "R16G16B16A16_FLOAT",
- "GL_RGB16I": "R16G16B16A16_SINT",
- "GL_RGB16UI": "R16G16B16A16_UINT",
- "GL_RGB565": "B5G6R5_UNORM",
- "GL_RGB5_A1": "B5G5R5A1_UNORM",
- "GL_RGB8": "R8G8B8A8_UNORM",
- "GL_RGB8I": "R8G8B8A8_SINT",
- "GL_RGB8UI": "R8G8B8A8_UINT",
- "GL_RGB8_SNORM": "R8G8B8A8_SNORM",
- "GL_RGBA4": "B4G4R4A4_UNORM",
- "GL_SRGB8": "R8G8B8A8_UNORM_SRGB",
- "GL_STENCIL_INDEX8": "D24_UNORM_S8_UINT",
- "GL_RGB16_EXT": "R16G16B16A16_UNORM",
- "GL_RGBA16_EXT": "R16G16B16A16_UNORM",
- "GL_RGB16_SNORM_EXT": "R16G16B16A16_SNORM",
- "GL_RGB32F": "R32G32B32A32_FLOAT",
- "GL_RGB32I": "R32G32B32A32_SINT",
- "GL_RGB32UI": "R32G32B32A32_UINT"
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp
deleted file mode 100644
index a9dfec56b8..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h
deleted file mode 100644
index 3efcb81adb..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// 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/renderer_utils.h"
-#include "libANGLE/renderer/d3d/formatutilsD3D.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
-{
- constexpr Format();
- constexpr Format(GLenum internalFormat,
- angle::Format::ID formatID,
- DXGI_FORMAT texFormat,
- DXGI_FORMAT srvFormat,
- 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::Format::ID formatID;
-
- DXGI_FORMAT texFormat;
- DXGI_FORMAT srvFormat;
- DXGI_FORMAT rtvFormat;
- DXGI_FORMAT dsvFormat;
-
- DXGI_FORMAT blitSRVFormat;
-
- GLenum swizzleFormat;
-
- InitializeTextureDataFunction dataInitializerFunction;
-};
-
-constexpr Format::Format()
- : internalFormat(GL_NONE),
- formatID(angle::Format::ID::NONE),
- texFormat(DXGI_FORMAT_UNKNOWN),
- srvFormat(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::Format::ID formatID,
- DXGI_FORMAT texFormat,
- DXGI_FORMAT srvFormat,
- DXGI_FORMAT rtvFormat,
- DXGI_FORMAT dsvFormat,
- DXGI_FORMAT blitSRVFormat,
- GLenum swizzleFormat,
- InitializeTextureDataFunction internalFormatInitializer)
- : internalFormat(internalFormat),
- formatID(formatID),
- texFormat(texFormat),
- srvFormat(srvFormat),
- rtvFormat(rtvFormat),
- dsvFormat(dsvFormat),
- blitSRVFormat(blitSRVFormat),
- swizzleFormat(swizzleFormat),
- dataInitializerFunction(internalFormatInitializer)
-{
-}
-
-} // namespace d3d11
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_TEXTUREFORMATTABLE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp
deleted file mode 100644
index 3c1c2bcd50..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp
+++ /dev/null
@@ -1,1938 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by gen_texture_format_table.py using data from texture_format_data.json
-//
-// 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.
-//
-// 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::Format::ID::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::Format::ID::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::Format::ID::A8_UNORM,
- DXGI_FORMAT_A8_UNORM,
- DXGI_FORMAT_A8_UNORM,
- 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::Format::ID::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::Format::ID::B5G6R5_UNORM,
- DXGI_FORMAT_B5G6R5_UNORM,
- DXGI_FORMAT_B5G6R5_UNORM,
- 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::Format::ID::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::Format::ID::B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- 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::Format::ID::B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- 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::Format::ID::B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- 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::Format::ID::B8G8R8A8_UNORM_SRGB,
- DXGI_FORMAT_B8G8R8A8_UNORM_SRGB,
- DXGI_FORMAT_B8G8R8A8_UNORM_SRGB,
- DXGI_FORMAT_B8G8R8A8_UNORM_SRGB,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_B8G8R8A8_UNORM_SRGB,
- GL_BGRA8_SRGB_ANGLEX,
- nullptr);
- return info;
- }
- case GL_COMPRESSED_R11_EAC:
- {
- static constexpr Format info(GL_COMPRESSED_R11_EAC,
- angle::Format::ID::R8_UNORM,
- DXGI_FORMAT_R8_UNORM,
- DXGI_FORMAT_R8_UNORM,
- DXGI_FORMAT_R8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8_UNORM,
- GL_RGBA8,
- nullptr);
- return info;
- }
- case GL_COMPRESSED_RG11_EAC:
- {
- static constexpr Format info(GL_COMPRESSED_RG11_EAC,
- angle::Format::ID::R8G8_UNORM,
- DXGI_FORMAT_R8G8_UNORM,
- DXGI_FORMAT_R8G8_UNORM,
- DXGI_FORMAT_R8G8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8_UNORM,
- GL_RGBA8,
- nullptr);
- return info;
- }
- case GL_COMPRESSED_RGB8_ETC2:
- {
- static constexpr Format info(GL_COMPRESSED_RGB8_ETC2,
- angle::Format::ID::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::Format::ID::BC1_RGB_UNORM_BLOCK,
- DXGI_FORMAT_BC1_UNORM,
- DXGI_FORMAT_BC1_UNORM,
- 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::Format::ID::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::Format::ID::BC1_RGBA_UNORM_BLOCK,
- DXGI_FORMAT_BC1_UNORM,
- DXGI_FORMAT_BC1_UNORM,
- 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::Format::ID::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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
- return info;
- }
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- {
- static constexpr Format info(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
- angle::Format::ID::BC1_RGBA_UNORM_BLOCK,
- DXGI_FORMAT_BC1_UNORM,
- DXGI_FORMAT_BC1_UNORM,
- 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::Format::ID::BC2_RGBA_UNORM_BLOCK,
- DXGI_FORMAT_BC2_UNORM,
- DXGI_FORMAT_BC2_UNORM,
- 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::Format::ID::BC3_RGBA_UNORM_BLOCK,
- DXGI_FORMAT_BC3_UNORM,
- DXGI_FORMAT_BC3_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_BC3_UNORM,
- GL_RGBA8,
- nullptr);
- return info;
- }
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- {
- static constexpr Format info(GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
- angle::Format::ID::BC1_RGB_UNORM_BLOCK,
- DXGI_FORMAT_BC1_UNORM,
- DXGI_FORMAT_BC1_UNORM,
- 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::Format::ID::R8_SNORM,
- DXGI_FORMAT_R8_SNORM,
- DXGI_FORMAT_R8_SNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8_SNORM,
- GL_RGBA8_SNORM,
- nullptr);
- return info;
- }
- case GL_COMPRESSED_SIGNED_RG11_EAC:
- {
- static constexpr Format info(GL_COMPRESSED_SIGNED_RG11_EAC,
- angle::Format::ID::R8G8_SNORM,
- DXGI_FORMAT_R8G8_SNORM,
- DXGI_FORMAT_R8G8_SNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8_SNORM,
- GL_RGBA8_SNORM,
- nullptr);
- return info;
- }
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
- {
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
- angle::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::NONE,
- 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::Format::ID::R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- 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::Format::ID::R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- 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::Format::ID::BC1_RGB_UNORM_SRGB_BLOCK,
- DXGI_FORMAT_BC1_UNORM_SRGB,
- DXGI_FORMAT_BC1_UNORM_SRGB,
- 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::Format::ID::R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- 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::Format::ID::BC1_RGBA_UNORM_SRGB_BLOCK,
- DXGI_FORMAT_BC1_UNORM_SRGB,
- DXGI_FORMAT_BC1_UNORM_SRGB,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_BC1_UNORM_SRGB,
- GL_RGBA8,
- nullptr);
- return info;
- }
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- {
- static constexpr Format info(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
- angle::Format::ID::BC1_RGBA_UNORM_SRGB_BLOCK,
- DXGI_FORMAT_BC1_UNORM_SRGB,
- DXGI_FORMAT_BC1_UNORM_SRGB,
- 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::Format::ID::BC2_RGBA_UNORM_SRGB_BLOCK,
- DXGI_FORMAT_BC2_UNORM_SRGB,
- DXGI_FORMAT_BC2_UNORM_SRGB,
- 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::Format::ID::BC3_RGBA_UNORM_SRGB_BLOCK,
- DXGI_FORMAT_BC3_UNORM_SRGB,
- DXGI_FORMAT_BC3_UNORM_SRGB,
- 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::Format::ID::BC1_RGB_UNORM_SRGB_BLOCK,
- DXGI_FORMAT_BC1_UNORM_SRGB,
- DXGI_FORMAT_BC1_UNORM_SRGB,
- 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::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_R24G8_TYPELESS,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
- 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::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- 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::Format::ID::D32_FLOAT_S8X24_UINT,
- DXGI_FORMAT_R32G8X24_TYPELESS,
- DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS,
- 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::Format::ID::D16_UNORM,
- DXGI_FORMAT_R16_TYPELESS,
- DXGI_FORMAT_R16_UNORM,
- 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::Format::ID::D16_UNORM,
- DXGI_FORMAT_D16_UNORM,
- 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::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_R24G8_TYPELESS,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
- 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::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- 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::Format::ID::D32_FLOAT,
- DXGI_FORMAT_R32_TYPELESS,
- DXGI_FORMAT_R32_FLOAT,
- 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::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_R24G8_TYPELESS,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
- 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::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- 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::Format::ID::BC1_RGB_UNORM_BLOCK,
- DXGI_FORMAT_BC1_UNORM,
- DXGI_FORMAT_BC1_UNORM,
- 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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::NONE,
- 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::Format::ID::R11G11B10_FLOAT,
- DXGI_FORMAT_R11G11B10_FLOAT,
- DXGI_FORMAT_R11G11B10_FLOAT,
- 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::Format::ID::R16_FLOAT,
- DXGI_FORMAT_R16_FLOAT,
- DXGI_FORMAT_R16_FLOAT,
- 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::Format::ID::R16_SINT,
- DXGI_FORMAT_R16_SINT,
- DXGI_FORMAT_R16_SINT,
- 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::Format::ID::R16_UINT,
- DXGI_FORMAT_R16_UINT,
- DXGI_FORMAT_R16_UINT,
- 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::Format::ID::R16_UNORM,
- DXGI_FORMAT_R16_UNORM,
- DXGI_FORMAT_R16_UNORM,
- 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::Format::ID::R16_SNORM,
- DXGI_FORMAT_R16_SNORM,
- DXGI_FORMAT_R16_SNORM,
- 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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::R8_UNORM,
- DXGI_FORMAT_R8_UNORM,
- DXGI_FORMAT_R8_UNORM,
- 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::Format::ID::R8_SINT,
- DXGI_FORMAT_R8_SINT,
- DXGI_FORMAT_R8_SINT,
- 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::Format::ID::R8_UINT,
- DXGI_FORMAT_R8_UINT,
- DXGI_FORMAT_R8_UINT,
- 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::Format::ID::R8_SNORM,
- DXGI_FORMAT_R8_SNORM,
- DXGI_FORMAT_R8_SNORM,
- 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::Format::ID::R16G16_FLOAT,
- DXGI_FORMAT_R16G16_FLOAT,
- DXGI_FORMAT_R16G16_FLOAT,
- 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::Format::ID::R16G16_SINT,
- DXGI_FORMAT_R16G16_SINT,
- DXGI_FORMAT_R16G16_SINT,
- 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::Format::ID::R16G16_UINT,
- DXGI_FORMAT_R16G16_UINT,
- DXGI_FORMAT_R16G16_UINT,
- 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::Format::ID::R16G16_UNORM,
- DXGI_FORMAT_R16G16_UNORM,
- DXGI_FORMAT_R16G16_UNORM,
- 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::Format::ID::R16G16_SNORM,
- DXGI_FORMAT_R16G16_SNORM,
- DXGI_FORMAT_R16G16_SNORM,
- 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::Format::ID::R32G32_FLOAT,
- DXGI_FORMAT_R32G32_FLOAT,
- DXGI_FORMAT_R32G32_FLOAT,
- 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::Format::ID::R32G32_SINT,
- DXGI_FORMAT_R32G32_SINT,
- DXGI_FORMAT_R32G32_SINT,
- 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::Format::ID::R32G32_UINT,
- DXGI_FORMAT_R32G32_UINT,
- DXGI_FORMAT_R32G32_UINT,
- 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::Format::ID::R8G8_UNORM,
- DXGI_FORMAT_R8G8_UNORM,
- DXGI_FORMAT_R8G8_UNORM,
- 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::Format::ID::R8G8_SINT,
- DXGI_FORMAT_R8G8_SINT,
- DXGI_FORMAT_R8G8_SINT,
- 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::Format::ID::R8G8_UINT,
- DXGI_FORMAT_R8G8_UINT,
- DXGI_FORMAT_R8G8_UINT,
- 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::Format::ID::R8G8_SNORM,
- DXGI_FORMAT_R8G8_SNORM,
- DXGI_FORMAT_R8G8_SNORM,
- 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::Format::ID::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::Format::ID::R10G10B10A2_UNORM,
- DXGI_FORMAT_R10G10B10A2_UNORM,
- DXGI_FORMAT_R10G10B10A2_UNORM,
- 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::Format::ID::R10G10B10A2_UINT,
- DXGI_FORMAT_R10G10B10A2_UINT,
- DXGI_FORMAT_R10G10B10A2_UINT,
- 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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::R16G16B16A16_UNORM,
- DXGI_FORMAT_R16G16B16A16_UNORM,
- DXGI_FORMAT_R16G16B16A16_UNORM,
- 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::Format::ID::R16G16B16A16_SNORM,
- DXGI_FORMAT_R16G16B16A16_SNORM,
- DXGI_FORMAT_R16G16B16A16_SNORM,
- 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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::B5G6R5_UNORM,
- DXGI_FORMAT_B5G6R5_UNORM,
- DXGI_FORMAT_B5G6R5_UNORM,
- DXGI_FORMAT_B5G6R5_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_B5G6R5_UNORM,
- GL_RGBA8,
- nullptr);
- return info;
- }
- else
- {
- static constexpr Format info(GL_RGB565,
- angle::Format::ID::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::Format::ID::B5G5R5A1_UNORM,
- DXGI_FORMAT_B5G5R5A1_UNORM,
- DXGI_FORMAT_B5G5R5A1_UNORM,
- 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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::R9G9B9E5_SHAREDEXP,
- DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
- DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
- 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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::R16G16B16A16_UNORM,
- DXGI_FORMAT_R16G16B16A16_UNORM,
- DXGI_FORMAT_R16G16B16A16_UNORM,
- 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::Format::ID::R16G16B16A16_SNORM,
- DXGI_FORMAT_R16G16B16A16_SNORM,
- DXGI_FORMAT_R16G16B16A16_SNORM,
- 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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::B4G4R4A4_UNORM,
- DXGI_FORMAT_B4G4R4A4_UNORM,
- DXGI_FORMAT_B4G4R4A4_UNORM,
- DXGI_FORMAT_B4G4R4A4_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_B4G4R4A4_UNORM,
- GL_RGBA4,
- nullptr);
- return info;
- }
- else
- {
- static constexpr Format info(GL_RGBA4,
- angle::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::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::Format::ID::R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- 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::Format::ID::R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- 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::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_R24G8_TYPELESS,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
- 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::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_utils.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_utils.h
deleted file mode 100644
index d5351ff882..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_utils.h
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// 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 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.featureLevel).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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp
deleted file mode 100644
index 5394e3d3e7..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-//
-// 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"
-
-#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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.h
deleted file mode 100644
index baeba6a347..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp
deleted file mode 100644
index 1ef90e7b09..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// CoreWindowNativeWindow.cpp: NativeWindow for managing ICoreWindow native window types.
-
-#include "libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h"
-
-#include <windows.graphics.display.h>
-
-using namespace ABI::Windows::Foundation::Collections;
-
-namespace rx
-{
-CoreWindowNativeWindow::~CoreWindowNativeWindow()
-{
- unregisterForSizeChangeEvents();
-}
-
-bool CoreWindowNativeWindow::initialize(EGLNativeWindowType window, IPropertySet *propertySet)
-{
- ComPtr<IPropertySet> props = propertySet;
- ComPtr<IInspectable> win = window;
- SIZE swapChainSize = {};
- HRESULT result = S_OK;
-
- // IPropertySet is an optional parameter and can be null.
- // If one is specified, cache as an IMap and read the properties
- // used for initial host initialization.
- if (propertySet)
- {
- result = props.As(&mPropertyMap);
- if (FAILED(result))
- {
- return false;
- }
-
- // The EGLRenderSurfaceSizeProperty is optional and may be missing. The IPropertySet
- // was prevalidated to contain the EGLNativeWindowType before being passed to
- // this host.
- result = GetOptionalSizePropertyValue(mPropertyMap, EGLRenderSurfaceSizeProperty, &swapChainSize, &mSwapChainSizeSpecified);
- if (FAILED(result))
- {
- return false;
- }
-
- // The EGLRenderResolutionScaleProperty is optional and may be missing. The IPropertySet
- // was prevalidated to contain the EGLNativeWindowType before being passed to
- // this host.
- result = GetOptionalSinglePropertyValue(mPropertyMap, EGLRenderResolutionScaleProperty, &mSwapChainScale, &mSwapChainScaleSpecified);
- if (FAILED(result))
- {
- return false;
- }
-
- if (!mSwapChainScaleSpecified)
- {
- // Default value for the scale is 1.0f
- mSwapChainScale = 1.0f;
- }
-
- // A EGLRenderSurfaceSizeProperty and a EGLRenderResolutionScaleProperty can't both be specified
- if (mSwapChainScaleSpecified && mSwapChainSizeSpecified)
- {
- ERR() << "It is invalid to specify both an EGLRenderSurfaceSizeProperty and a "
- "EGLRenderResolutionScaleProperty.";
- return false;
- }
- }
-
- if (SUCCEEDED(result))
- {
- result = win.As(&mCoreWindow);
- }
-
- if (SUCCEEDED(result))
- {
- // If a swapchain size is specfied, then the automatic resize
- // behaviors implemented by the host should be disabled. The swapchain
- // will be still be scaled when being rendered to fit the bounds
- // of the host.
- // Scaling of the swapchain output occurs automatically because if
- // the scaling mode setting DXGI_SCALING_STRETCH on the swapchain.
- if (mSwapChainSizeSpecified)
- {
- mClientRect = { 0, 0, swapChainSize.cx, swapChainSize.cy };
- }
- else
- {
- Size coreWindowSize;
- result = GetCoreWindowSizeInPixels(mCoreWindow, &coreWindowSize);
-
- if (SUCCEEDED(result))
- {
- mClientRect = clientRect(coreWindowSize);
- }
- }
- }
-
- if (SUCCEEDED(result))
- {
- mNewClientRect = mClientRect;
- mClientRectChanged = false;
- return registerForSizeChangeEvents();
- }
-
- return false;
-}
-
-bool CoreWindowNativeWindow::registerForSizeChangeEvents()
-{
- ComPtr<IWindowSizeChangedEventHandler> sizeChangedHandler;
- HRESULT result = Microsoft::WRL::MakeAndInitialize<CoreWindowSizeChangedHandler>(sizeChangedHandler.ReleaseAndGetAddressOf(), this->shared_from_this());
- if (SUCCEEDED(result))
- {
- result = mCoreWindow->add_SizeChanged(sizeChangedHandler.Get(), &mSizeChangedEventToken);
- }
-
- if (SUCCEEDED(result))
- {
- return true;
- }
-
- return false;
-}
-
-void CoreWindowNativeWindow::unregisterForSizeChangeEvents()
-{
- if (mCoreWindow)
- {
- (void)mCoreWindow->remove_SizeChanged(mSizeChangedEventToken);
- }
- mSizeChangedEventToken.value = 0;
-}
-
-HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device,
- IDXGIFactory2 *factory,
- DXGI_FORMAT format,
- unsigned int width,
- unsigned int height,
- bool containsAlpha,
- IDXGISwapChain1 **swapChain)
-{
- if (device == nullptr || factory == nullptr || swapChain == nullptr || width == 0 ||
- height == 0)
- {
- return E_INVALIDARG;
- }
-
- DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 };
- swapChainDesc.Width = width;
- swapChainDesc.Height = height;
- swapChainDesc.Format = format;
- swapChainDesc.Stereo = FALSE;
- swapChainDesc.SampleDesc.Count = 1;
- swapChainDesc.SampleDesc.Quality = 0;
- swapChainDesc.BufferUsage =
- DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER;
- swapChainDesc.BufferCount = 2;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
- swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
- swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;
-
- *swapChain = nullptr;
-
- ComPtr<IDXGISwapChain1> newSwapChain;
- HRESULT result = factory->CreateSwapChainForCoreWindow(device, mCoreWindow.Get(), &swapChainDesc, nullptr, newSwapChain.ReleaseAndGetAddressOf());
- if (SUCCEEDED(result))
- {
- result = newSwapChain.CopyTo(swapChain);
- }
-
- if (SUCCEEDED(result))
- {
- // If automatic swapchain resize behaviors have been disabled, then
- // unregister for the resize change events.
- if (mSupportsSwapChainResize == false)
- {
- unregisterForSizeChangeEvents();
- }
- }
-
- return result;
-}
-
-inline HRESULT CoreWindowNativeWindow::scaleSwapChain(const Size &windowSize,
- const RECT &clientRect)
-{
- // We don't need to do any additional work to scale CoreWindow swapchains.
- // Using DXGI_SCALING_STRETCH to create the swapchain above does all the necessary work.
- return S_OK;
-}
-
-HRESULT GetCoreWindowSizeInPixels(const ComPtr<ABI::Windows::UI::Core::ICoreWindow> &coreWindow,
- Size *windowSize)
-{
- ABI::Windows::Foundation::Rect bounds;
- HRESULT result = coreWindow->get_Bounds(&bounds);
- if (SUCCEEDED(result))
- {
- *windowSize = { ConvertDipsToPixels(bounds.Width), ConvertDipsToPixels(bounds.Height) };
- }
-
- return result;
-}
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h
deleted file mode 100644
index 21855c2c3b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h
+++ /dev/null
@@ -1,90 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// CoreWindowNativeWindow.h: NativeWindow for managing ICoreWindow native window types.
-
-#ifndef LIBANGLE_RENDERER_D3D_D3D11_WINRT_COREWINDOWNATIVEWINDOW_H_
-#define LIBANGLE_RENDERER_D3D_D3D11_WINRT_COREWINDOWNATIVEWINDOW_H_
-
-#include "libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h"
-
-#include <memory>
-
-#include <EGL/eglplatform.h>
-
-typedef ABI::Windows::Foundation::__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowSizeChangedEventArgs_t IWindowSizeChangedEventHandler;
-
-namespace rx
-{
-class CoreWindowNativeWindow : public InspectableNativeWindow, public std::enable_shared_from_this<CoreWindowNativeWindow>
-{
- public:
- ~CoreWindowNativeWindow();
-
- bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) override;
- HRESULT createSwapChain(ID3D11Device *device,
- IDXGIFactory2 *factory,
- DXGI_FORMAT format,
- unsigned int width,
- unsigned int height,
- bool containsAlpha,
- IDXGISwapChain1 **swapChain) override;
-
- protected:
- HRESULT scaleSwapChain(const Size &windowSize, const RECT &clientRect) override;
-
- bool registerForSizeChangeEvents();
- void unregisterForSizeChangeEvents();
-
- private:
- ComPtr<ABI::Windows::UI::Core::ICoreWindow> mCoreWindow;
- ComPtr<IMap<HSTRING, IInspectable*>> mPropertyMap;
-};
-
-[uuid(7F924F66-EBAE-40E5-A10B-B8F35E245190)]
-class CoreWindowSizeChangedHandler :
- public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, IWindowSizeChangedEventHandler>
-{
- public:
- CoreWindowSizeChangedHandler() { }
- HRESULT RuntimeClassInitialize(std::shared_ptr<InspectableNativeWindow> host)
- {
- if (!host)
- {
- return E_INVALIDARG;
- }
-
- mHost = host;
- return S_OK;
- }
-
- // IWindowSizeChangedEventHandler
- IFACEMETHOD(Invoke)(ABI::Windows::UI::Core::ICoreWindow *sender, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *sizeChangedEventArgs)
- {
- std::shared_ptr<InspectableNativeWindow> host = mHost.lock();
- if (host)
- {
- ABI::Windows::Foundation::Size windowSize;
- if (SUCCEEDED(sizeChangedEventArgs->get_Size(&windowSize)))
- {
- Size windowSizeInPixels = {ConvertDipsToPixels(windowSize.Width),
- ConvertDipsToPixels(windowSize.Height)};
- host->setNewClientSize(windowSizeInPixels);
- }
- }
-
- return S_OK;
- }
-
- private:
- std::weak_ptr<InspectableNativeWindow> mHost;
-};
-
-HRESULT GetCoreWindowSizeInPixels(const ComPtr<ABI::Windows::UI::Core::ICoreWindow> &coreWindow,
- Size *windowSize);
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_WINRT_COREWINDOWNATIVEWINDOW_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
deleted file mode 100644
index 1bd796e58f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// InspectableNativeWindow.cpp: NativeWindow base class for managing IInspectable native window types.
-
-#include "libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h"
-#include "libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h"
-
-namespace rx
-{
-
-bool IsCoreWindow(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Core::ICoreWindow> *coreWindow)
-{
- if (!window)
- {
- return false;
- }
-
- ComPtr<IInspectable> win = window;
- ComPtr<ABI::Windows::UI::Core::ICoreWindow> coreWin;
- if (SUCCEEDED(win.As(&coreWin)))
- {
- if (coreWindow != nullptr)
- {
- *coreWindow = coreWin;
- }
- return true;
- }
-
- return false;
-}
-
-bool IsSwapChainPanel(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> *swapChainPanel)
-{
- if (!window)
- {
- return false;
- }
-
- ComPtr<IInspectable> win = window;
- ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> panel;
- if (SUCCEEDED(win.As(&panel)))
- {
- if (swapChainPanel != nullptr)
- {
- *swapChainPanel = panel;
- }
- return true;
- }
-
- return false;
-}
-
-bool IsEGLConfiguredPropertySet(EGLNativeWindowType window, ABI::Windows::Foundation::Collections::IPropertySet **propertySet, IInspectable **eglNativeWindow)
-{
- if (!window)
- {
- return false;
- }
-
- ComPtr<IInspectable> props = window;
- ComPtr<IPropertySet> propSet;
- ComPtr<IInspectable> nativeWindow;
- ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> propMap;
- boolean hasEglNativeWindowPropertyKey = false;
-
- HRESULT result = props.As(&propSet);
- if (SUCCEEDED(result))
- {
- result = propSet.As(&propMap);
- }
-
- // Look for the presence of the EGLNativeWindowType in the property set
- if (SUCCEEDED(result))
- {
- result = propMap->HasKey(HStringReference(EGLNativeWindowTypeProperty).Get(), &hasEglNativeWindowPropertyKey);
- }
-
- // If the IPropertySet does not contain the required EglNativeWindowType key, the property set is
- // considered invalid.
- if (SUCCEEDED(result) && !hasEglNativeWindowPropertyKey)
- {
- ERR() << "Could not find EGLNativeWindowTypeProperty in IPropertySet. Valid "
- "EGLNativeWindowTypeProperty values include ICoreWindow";
- return false;
- }
-
- // The EglNativeWindowType property exists, so retreive the IInspectable that represents the EGLNativeWindowType
- if (SUCCEEDED(result) && hasEglNativeWindowPropertyKey)
- {
- result = propMap->Lookup(HStringReference(EGLNativeWindowTypeProperty).Get(), &nativeWindow);
- }
-
- if (SUCCEEDED(result))
- {
- if (propertySet != nullptr)
- {
- result = propSet.CopyTo(propertySet);
- }
- }
-
- if (SUCCEEDED(result))
- {
- if (eglNativeWindow != nullptr)
- {
- result = nativeWindow.CopyTo(eglNativeWindow);
- }
- }
-
- if (SUCCEEDED(result))
- {
- return true;
- }
-
- return false;
-}
-
-// Retrieve an optional property from a property set
-HRESULT GetOptionalPropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
- const wchar_t *propertyName,
- boolean *hasKey,
- ComPtr<ABI::Windows::Foundation::IPropertyValue> &propertyValue)
-{
- if (!propertyMap || !hasKey)
- {
- return E_INVALIDARG;
- }
-
- // Assume that the value does not exist
- *hasKey = false;
-
- HRESULT result = propertyMap->HasKey(HStringReference(propertyName).Get(), hasKey);
- if (SUCCEEDED(result) && !(*hasKey))
- {
- // Value does not exist, so return S_OK and set the exists parameter to false to indicate
- // that a the optional property does not exist.
- return S_OK;
- }
-
- if (SUCCEEDED(result))
- {
- result = propertyMap->Lookup(HStringReference(propertyName).Get(), &propertyValue);
- }
-
- return result;
-}
-
-// Attempts to read an optional SIZE property value that is assumed to be in the form of
-// an ABI::Windows::Foundation::Size. This function validates the Size value before returning
-// it to the caller.
-//
-// Possible return values are:
-// S_OK, valueExists == true - optional SIZE value was successfully retrieved and validated
-// S_OK, valueExists == false - optional SIZE value was not found
-// E_INVALIDARG, valueExists = false - optional SIZE value was malformed in the property set.
-// * Incorrect property type ( must be PropertyType_Size)
-// * Invalid property value (width/height must be > 0)
-// Additional errors may be returned from IMap or IPropertyValue
-//
-HRESULT GetOptionalSizePropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
- const wchar_t *propertyName, SIZE *value, bool *valueExists)
-{
- ComPtr<ABI::Windows::Foundation::IPropertyValue> propertyValue;
- ABI::Windows::Foundation::PropertyType propertyType = ABI::Windows::Foundation::PropertyType::PropertyType_Empty;
- Size sizeValue = { 0, 0 };
- boolean hasKey = false;
-
- if (!propertyMap || !value || !valueExists)
- {
- return E_INVALIDARG;
- }
-
- // Assume that the value does not exist
- *valueExists = false;
- *value = { 0, 0 };
-
- HRESULT result = GetOptionalPropertyValue(propertyMap, propertyName, &hasKey, propertyValue);
- if (SUCCEEDED(result) && hasKey)
- {
- result = propertyValue->get_Type(&propertyType);
-
- // Check if the expected Size property is of PropertyType_Size type.
- if (SUCCEEDED(result) && propertyType == ABI::Windows::Foundation::PropertyType::PropertyType_Size)
- {
- if (SUCCEEDED(propertyValue->GetSize(&sizeValue)) && (sizeValue.Width > 0 && sizeValue.Height > 0))
- {
- // A valid property value exists
- *value = { static_cast<long>(sizeValue.Width), static_cast<long>(sizeValue.Height) };
- *valueExists = true;
- result = S_OK;
- }
- else
- {
- // An invalid Size property was detected. Width/Height values must > 0
- result = E_INVALIDARG;
- }
- }
- else
- {
- // An invalid property type was detected. Size property must be of PropertyType_Size
- result = E_INVALIDARG;
- }
- }
-
- return result;
-}
-
-// Attempts to read an optional float property value that is assumed to be in the form of
-// an ABI::Windows::Foundation::Single. This function validates the Single value before returning
-// it to the caller.
-//
-// Possible return values are:
-// S_OK, valueExists == true - optional Single value was successfully retrieved and validated
-// S_OK, valueExists == false - optional Single value was not found
-// E_INVALIDARG, valueExists = false - optional Single value was malformed in the property set.
-// * Incorrect property type ( must be PropertyType_Single)
-// * Invalid property value (must be > 0)
-// Additional errors may be returned from IMap or IPropertyValue
-//
-HRESULT GetOptionalSinglePropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
- const wchar_t *propertyName, float *value, bool *valueExists)
-{
- ComPtr<ABI::Windows::Foundation::IPropertyValue> propertyValue;
- ABI::Windows::Foundation::PropertyType propertyType = ABI::Windows::Foundation::PropertyType::PropertyType_Empty;
- float scaleValue = 0.0f;
- boolean hasKey = false;
-
- if (!propertyMap || !value || !valueExists)
- {
- return E_INVALIDARG;
- }
-
- // Assume that the value does not exist
- *valueExists = false;
- *value = 0.0f;
-
- HRESULT result = GetOptionalPropertyValue(propertyMap, propertyName, &hasKey, propertyValue);
- if (SUCCEEDED(result) && hasKey)
- {
- result = propertyValue->get_Type(&propertyType);
-
- // Check if the expected Scale property is of PropertyType_Single type.
- if (SUCCEEDED(result) && propertyType == ABI::Windows::Foundation::PropertyType::PropertyType_Single)
- {
- if (SUCCEEDED(propertyValue->GetSingle(&scaleValue)) && (scaleValue > 0.0f))
- {
- // A valid property value exists
- *value = scaleValue;
- *valueExists = true;
- result = S_OK;
- }
- else
- {
- // An invalid scale was set
- result = E_INVALIDARG;
- }
- }
- else
- {
- // An invalid property type was detected. Size property must be of PropertyType_Single
- result = E_INVALIDARG;
- }
- }
-
- return result;
-}
-
-RECT InspectableNativeWindow::clientRect(const Size &size)
-{
- return {0, 0, static_cast<long>(ConvertDipsToPixels(size.Width)),
- static_cast<long>(ConvertDipsToPixels(size.Height))};
-}
-
-float GetLogicalDpi()
-{
- ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> displayProperties;
- float dpi = 96.0f;
-
- if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), displayProperties.GetAddressOf())))
- {
- if (SUCCEEDED(displayProperties->get_LogicalDpi(&dpi)))
- {
- return dpi;
- }
- }
- return dpi;
-}
-
-float ConvertDipsToPixels(float dips)
-{
- static const float dipsPerInch = 96.0f;
- return lround((dips * GetLogicalDpi() / dipsPerInch));
-}
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h
deleted file mode 100644
index d81c3e5fb9..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h
+++ /dev/null
@@ -1,136 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// InspectableNativeWindow.h: Host specific implementation interface for
-// managing IInspectable native window types.
-
-#ifndef LIBANGLE_RENDERER_D3D_D3D11_WINRT_INSPECTABLENATIVEWINDOW_H_
-#define LIBANGLE_RENDERER_D3D_D3D11_WINRT_INSPECTABLENATIVEWINDOW_H_
-
-#include "common/debug.h"
-#include "common/platform.h"
-
-#include "angle_windowsstore.h"
-
-#include <EGL/eglplatform.h>
-
-#include <windows.applicationmodel.core.h>
-#include <windows.ui.xaml.h>
-#include <windows.ui.xaml.media.dxinterop.h>
-#include <wrl.h>
-#include <wrl/wrappers/corewrappers.h>
-
-using namespace Microsoft::WRL;
-using namespace Microsoft::WRL::Wrappers;
-using namespace ABI::Windows::Foundation;
-using namespace ABI::Windows::Foundation::Collections;
-
-namespace rx
-{
-float ConvertDipsToPixels(float dips);
-float GetLogicalDpi();
-
-class InspectableNativeWindow
-{
- public:
- InspectableNativeWindow() :
- mSupportsSwapChainResize(true),
- mSwapChainSizeSpecified(false),
- mSwapChainScaleSpecified(false),
- mClientRectChanged(false),
- mClientRect({0,0,0,0}),
- mNewClientRect({0,0,0,0})
- {
- mSizeChangedEventToken.value = 0;
- mSwapChainScale = 96.0f / GetLogicalDpi();
- if (mSwapChainScale != 1.0f)
- mSwapChainScaleSpecified = true;
- }
- virtual ~InspectableNativeWindow(){}
-
- virtual bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) = 0;
- virtual HRESULT createSwapChain(ID3D11Device *device,
- IDXGIFactory2 *factory,
- DXGI_FORMAT format,
- unsigned int width,
- unsigned int height,
- bool containsAlpha,
- IDXGISwapChain1 **swapChain) = 0;
-
- bool getClientRect(RECT *rect)
- {
- if (mClientRectChanged)
- {
- mClientRect = mNewClientRect;
- }
-
- *rect = mClientRect;
-
- return true;
- }
-
- // setNewClientSize is used by the WinRT size change handler. It isn't used by the rest of ANGLE.
- void setNewClientSize(const Size &newWindowSize)
- {
- // If the client doesn't support swapchain resizing then we should have already unregistered from size change handler
- ASSERT(mSupportsSwapChainResize);
-
- if (mSupportsSwapChainResize)
- {
- // If the swapchain size was specified then we should ignore this call too
- if (!mSwapChainSizeSpecified)
- {
- mNewClientRect = clientRect(newWindowSize);
- mClientRectChanged = true;
-
- // If a scale was specified, then now is the time to apply the scale matrix for the new swapchain size and window size
- if (mSwapChainScaleSpecified)
- {
- scaleSwapChain(newWindowSize, mNewClientRect);
- }
- }
-
- // Even if the swapchain size was fixed, the window might have changed size.
- // In this case, we should recalculate the scale matrix to account for the new window size
- if (mSwapChainSizeSpecified)
- {
- scaleSwapChain(newWindowSize, mClientRect);
- }
- }
- }
-
- protected:
- virtual HRESULT scaleSwapChain(const Size &windowSize, const RECT &clientRect) = 0;
- RECT clientRect(const Size &size);
-
- bool mSupportsSwapChainResize; // Support for IDXGISwapChain::ResizeBuffers method
- bool mSwapChainSizeSpecified; // If an EGLRenderSurfaceSizeProperty was specified
- bool mSwapChainScaleSpecified; // If an EGLRenderResolutionScaleProperty was specified
- float mSwapChainScale; // The scale value specified by the EGLRenderResolutionScaleProperty property
- RECT mClientRect;
- RECT mNewClientRect;
- bool mClientRectChanged;
-
- EventRegistrationToken mSizeChangedEventToken;
-};
-
-bool IsCoreWindow(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Core::ICoreWindow> *coreWindow = nullptr);
-bool IsSwapChainPanel(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> *swapChainPanel = nullptr);
-bool IsEGLConfiguredPropertySet(EGLNativeWindowType window, ABI::Windows::Foundation::Collections::IPropertySet **propertySet = nullptr, IInspectable **inspectable = nullptr);
-
-HRESULT GetOptionalPropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
- const wchar_t *propertyName,
- boolean *hasKey,
- ComPtr<ABI::Windows::Foundation::IPropertyValue> &propertyValue);
-
-HRESULT GetOptionalSizePropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
- const wchar_t *propertyName, SIZE *value, bool *valueExists);
-
-HRESULT GetOptionalSinglePropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
- const wchar_t *propertyName, float *value, bool *valueExists);
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_WINRT_INSPECTABLENATIVEWINDOW_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp
deleted file mode 100644
index 655b23be83..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-// 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.
-//
-
-// NativeWindow11WinRT.cpp: NativeWindow base class for managing IInspectable native window types.
-
-#include "libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h"
-
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-#include "libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h"
-#include "libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h"
-#include "libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h"
-
-using namespace Microsoft::WRL;
-using namespace Microsoft::WRL::Wrappers;
-
-namespace rx
-{
-NativeWindow11WinRT::NativeWindow11WinRT(EGLNativeWindowType window, bool hasAlpha)
- : NativeWindow11(window), mHasAlpha(hasAlpha)
-{
-}
-
-bool NativeWindow11WinRT::initialize()
-{
- EGLNativeWindowType window = getNativeWindow();
-
- // If the native window type is a IPropertySet, extract the
- // EGLNativeWindowType (IInspectable) and initialize the
- // proper host with this IPropertySet.
- ComPtr<ABI::Windows::Foundation::Collections::IPropertySet> propertySet;
- ComPtr<IInspectable> eglNativeWindow;
- if (IsEGLConfiguredPropertySet(window, &propertySet, &eglNativeWindow))
- {
- // A property set was found and the EGLNativeWindowType was
- // retrieved. The mWindow member of the host to must be updated
- // to use the EGLNativeWindowType specified in the property set.
- // mWindow is treated as a raw pointer not an AddRef'd interface, so
- // the old mWindow does not need a Release() before this assignment.
- window = eglNativeWindow.Get();
- }
-
- ComPtr<ABI::Windows::UI::Core::ICoreWindow> coreWindow;
- ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> swapChainPanel;
- if (IsCoreWindow(window, &coreWindow))
- {
- mImpl = std::make_shared<CoreWindowNativeWindow>();
- if (mImpl)
- {
- return mImpl->initialize(window, propertySet.Get());
- }
- }
- else if (IsSwapChainPanel(window, &swapChainPanel))
- {
- mImpl = std::make_shared<SwapChainPanelNativeWindow>();
- if (mImpl)
- {
- return mImpl->initialize(window, propertySet.Get());
- }
- }
- else
- {
- ERR() << "Invalid IInspectable EGLNativeWindowType detected. Valid IInspectables include "
- "ICoreWindow, ISwapChainPanel and IPropertySet";
- }
-
- return false;
-}
-
-bool NativeWindow11WinRT::getClientRect(LPRECT rect) const
-{
- if (mImpl)
- {
- return mImpl->getClientRect(rect);
- }
-
- return false;
-}
-
-bool NativeWindow11WinRT::isIconic() const
-{
- return false;
-}
-
-HRESULT NativeWindow11WinRT::createSwapChain(ID3D11Device *device,
- IDXGIFactory *factory,
- DXGI_FORMAT format,
- UINT width,
- UINT height,
- UINT samples,
- IDXGISwapChain **swapChain)
-{
- if (mImpl)
- {
- IDXGIFactory2 *factory2 = d3d11::DynamicCastComObject<IDXGIFactory2>(factory);
- IDXGISwapChain1 *swapChain1 = nullptr;
- HRESULT result =
- mImpl->createSwapChain(device, factory2, format, width, height, mHasAlpha, &swapChain1);
- SafeRelease(factory2);
- *swapChain = static_cast<IDXGISwapChain *>(swapChain1);
- return result;
- }
-
- return E_UNEXPECTED;
-}
-
-void NativeWindow11WinRT::commitChange()
-{
-}
-
-// static
-bool NativeWindow11WinRT::IsValidNativeWindow(EGLNativeWindowType window)
-{
- // A Valid EGLNativeWindowType IInspectable can only be:
- //
- // ICoreWindow
- // ISwapChainPanel
- // IPropertySet
- //
- // Anything else will be rejected as an invalid IInspectable.
- return IsCoreWindow(window) || IsSwapChainPanel(window) || IsEGLConfiguredPropertySet(window);
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h
deleted file mode 100644
index c4ac997a55..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// 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.
-//
-
-// NativeWindow11WinRT.h: NativeWindow base class for managing IInspectable native window types.
-
-#ifndef LIBANGLE_RENDERER_D3D_D3D11_WINRT_NATIVEWINDOW11WINRT_H_
-#define LIBANGLE_RENDERER_D3D_D3D11_WINRT_NATIVEWINDOW11WINRT_H_
-
-#include "libANGLE/renderer/d3d/d3d11/NativeWindow11.h"
-
-#include <memory>
-#include <windows.applicationmodel.core.h>
-#include <wrl.h>
-#include <wrl/wrappers/corewrappers.h>
-
-namespace rx
-{
-class InspectableNativeWindow;
-
-class NativeWindow11WinRT : public NativeWindow11
-{
- public:
- NativeWindow11WinRT(EGLNativeWindowType window, bool hasAlpha);
-
- 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 mHasAlpha;
- std::shared_ptr<InspectableNativeWindow> mImpl;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_WINRT_NATIVEWINDOW11WINRT_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp
deleted file mode 100644
index 3425fad95d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp
+++ /dev/null
@@ -1,359 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// SwapChainPanelNativeWindow.cpp: NativeWindow for managing ISwapChainPanel native window types.
-
-#include "libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h"
-
-#include <algorithm>
-#include <math.h>
-
-using namespace ABI::Windows::Foundation;
-using namespace ABI::Windows::Foundation::Collections;
-using namespace ABI::Windows::UI::Core;
-using namespace ABI::Windows::UI::Xaml;
-using namespace Microsoft::WRL;
-
-namespace rx
-{
-SwapChainPanelNativeWindow::~SwapChainPanelNativeWindow()
-{
- unregisterForSizeChangeEvents();
-}
-
-template <typename T>
-struct AddFtmBase
-{
- typedef Implements<RuntimeClassFlags<ClassicCom>, T, FtmBase> Type;
-};
-
-template <typename CODE>
-HRESULT RunOnUIThread(CODE &&code, const ComPtr<ICoreDispatcher> &dispatcher)
-{
- ComPtr<IAsyncAction> asyncAction;
- HRESULT result = S_OK;
-
- boolean hasThreadAccess;
- result = dispatcher->get_HasThreadAccess(&hasThreadAccess);
- if (FAILED(result))
- {
- return result;
- }
-
- if (hasThreadAccess)
- {
- return code();
- }
- else
- {
- Event waitEvent(
- CreateEventEx(nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS));
- if (!waitEvent.IsValid())
- {
- return E_FAIL;
- }
-
- HRESULT codeResult = E_FAIL;
- auto handler =
- Callback<AddFtmBase<IDispatchedHandler>::Type>([&codeResult, &code, &waitEvent]
- {
- codeResult = code();
- SetEvent(waitEvent.Get());
- return S_OK;
- });
-
- result = dispatcher->RunAsync(CoreDispatcherPriority_Normal, handler.Get(),
- asyncAction.GetAddressOf());
- if (FAILED(result))
- {
- return result;
- }
-
- auto waitResult = WaitForSingleObjectEx(waitEvent.Get(), 10 * 1000, true);
- if (waitResult != WAIT_OBJECT_0)
- {
- // Wait 10 seconds before giving up. At this point, the application is in an
- // unrecoverable state (probably deadlocked). We therefore terminate the application
- // entirely. This also prevents stack corruption if the async operation is eventually
- // run.
- ERR()
- << "Timeout waiting for async action on UI thread. The UI thread might be blocked.";
- std::terminate();
- return E_FAIL;
- }
-
- return codeResult;
- }
-}
-
-bool SwapChainPanelNativeWindow::initialize(EGLNativeWindowType window, IPropertySet *propertySet)
-{
- ComPtr<IPropertySet> props = propertySet;
- ComPtr<IInspectable> win = window;
- SIZE swapChainSize = {};
- HRESULT result = S_OK;
-
- // IPropertySet is an optional parameter and can be null.
- // If one is specified, cache as an IMap and read the properties
- // used for initial host initialization.
- if (propertySet)
- {
- result = props.As(&mPropertyMap);
- if (FAILED(result))
- {
- return false;
- }
-
- // The EGLRenderSurfaceSizeProperty is optional and may be missing. The IPropertySet
- // was prevalidated to contain the EGLNativeWindowType before being passed to
- // this host.
- result = GetOptionalSizePropertyValue(mPropertyMap, EGLRenderSurfaceSizeProperty, &swapChainSize, &mSwapChainSizeSpecified);
- if (FAILED(result))
- {
- return false;
- }
-
- // The EGLRenderResolutionScaleProperty is optional and may be missing. The IPropertySet
- // was prevalidated to contain the EGLNativeWindowType before being passed to
- // this host.
- result = GetOptionalSinglePropertyValue(mPropertyMap, EGLRenderResolutionScaleProperty, &mSwapChainScale, &mSwapChainScaleSpecified);
- if (FAILED(result))
- {
- return false;
- }
-
- if (!mSwapChainScaleSpecified)
- {
- // Default value for the scale is 1.0f
- mSwapChainScale = 1.0f;
- }
-
- // A EGLRenderSurfaceSizeProperty and a EGLRenderResolutionScaleProperty can't both be specified
- if (mSwapChainScaleSpecified && mSwapChainSizeSpecified)
- {
- ERR() << "It is invalid to specify both an EGLRenderSurfaceSizeProperty and a "
- "EGLRenderResolutionScaleProperty.";
- return false;
- }
- }
-
- if (SUCCEEDED(result))
- {
- result = win.As(&mSwapChainPanel);
- }
-
- ComPtr<IDependencyObject> swapChainPanelDependencyObject;
- if (SUCCEEDED(result))
- {
- result = mSwapChainPanel.As(&swapChainPanelDependencyObject);
- }
-
- if (SUCCEEDED(result))
- {
- result = swapChainPanelDependencyObject->get_Dispatcher(
- mSwapChainPanelDispatcher.GetAddressOf());
- }
-
- if (SUCCEEDED(result))
- {
- // If a swapchain size is specfied, then the automatic resize
- // behaviors implemented by the host should be disabled. The swapchain
- // will be still be scaled when being rendered to fit the bounds
- // of the host.
- // Scaling of the swapchain output needs to be handled by the
- // host for swapchain panels even though the scaling mode setting
- // DXGI_SCALING_STRETCH is configured on the swapchain.
- if (mSwapChainSizeSpecified)
- {
- mClientRect = { 0, 0, swapChainSize.cx, swapChainSize.cy };
- }
- else
- {
- Size swapChainPanelSize;
- result = GetSwapChainPanelSize(mSwapChainPanel, mSwapChainPanelDispatcher,
- &swapChainPanelSize);
-
- if (SUCCEEDED(result))
- {
- // Update the client rect to account for any swapchain scale factor
- mClientRect = clientRect(swapChainPanelSize);
- }
- }
- }
-
- if (SUCCEEDED(result))
- {
- mNewClientRect = mClientRect;
- mClientRectChanged = false;
- return registerForSizeChangeEvents();
- }
-
- return false;
-}
-
-bool SwapChainPanelNativeWindow::registerForSizeChangeEvents()
-{
- ComPtr<ISizeChangedEventHandler> sizeChangedHandler;
- ComPtr<IFrameworkElement> frameworkElement;
- HRESULT result = Microsoft::WRL::MakeAndInitialize<SwapChainPanelSizeChangedHandler>(sizeChangedHandler.ReleaseAndGetAddressOf(), this->shared_from_this());
-
- if (SUCCEEDED(result))
- {
- result = mSwapChainPanel.As(&frameworkElement);
- }
-
- if (SUCCEEDED(result))
- {
- result = RunOnUIThread(
- [this, frameworkElement, sizeChangedHandler]
- {
- return frameworkElement->add_SizeChanged(sizeChangedHandler.Get(),
- &mSizeChangedEventToken);
- },
- mSwapChainPanelDispatcher);
- }
-
- if (SUCCEEDED(result))
- {
- return true;
- }
-
- return false;
-}
-
-void SwapChainPanelNativeWindow::unregisterForSizeChangeEvents()
-{
- ComPtr<IFrameworkElement> frameworkElement;
- if (mSwapChainPanel && SUCCEEDED(mSwapChainPanel.As(&frameworkElement)))
- {
- RunOnUIThread(
- [this, frameworkElement]
- {
- return frameworkElement->remove_SizeChanged(mSizeChangedEventToken);
- },
- mSwapChainPanelDispatcher);
- }
-
- mSizeChangedEventToken.value = 0;
-}
-
-HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device,
- IDXGIFactory2 *factory,
- DXGI_FORMAT format,
- unsigned int width,
- unsigned int height,
- bool containsAlpha,
- IDXGISwapChain1 **swapChain)
-{
- if (device == nullptr || factory == nullptr || swapChain == nullptr || width == 0 ||
- height == 0)
- {
- return E_INVALIDARG;
- }
-
- DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 };
- swapChainDesc.Width = width;
- swapChainDesc.Height = height;
- swapChainDesc.Format = format;
- swapChainDesc.Stereo = FALSE;
- swapChainDesc.SampleDesc.Count = 1;
- swapChainDesc.SampleDesc.Quality = 0;
- swapChainDesc.BufferUsage =
- DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER;
- swapChainDesc.BufferCount = 2;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
- swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
- swapChainDesc.AlphaMode =
- containsAlpha ? DXGI_ALPHA_MODE_PREMULTIPLIED : DXGI_ALPHA_MODE_IGNORE;
-
- *swapChain = nullptr;
-
- ComPtr<IDXGISwapChain1> newSwapChain;
- ComPtr<ISwapChainPanelNative> swapChainPanelNative;
- Size currentPanelSize = {};
-
- HRESULT result = factory->CreateSwapChainForComposition(device, &swapChainDesc, nullptr, newSwapChain.ReleaseAndGetAddressOf());
-
- if (SUCCEEDED(result))
- {
- result = mSwapChainPanel.As(&swapChainPanelNative);
- }
-
- if (SUCCEEDED(result))
- {
- result = RunOnUIThread(
- [swapChainPanelNative, newSwapChain]
- {
- return swapChainPanelNative->SetSwapChain(newSwapChain.Get());
- },
- mSwapChainPanelDispatcher);
- }
-
- if (SUCCEEDED(result))
- {
- // The swapchain panel host requires an instance of the swapchain set on the SwapChainPanel
- // to perform the runtime-scale behavior. This swapchain is cached here because there are
- // no methods for retreiving the currently configured on from ISwapChainPanelNative.
- mSwapChain = newSwapChain;
- result = newSwapChain.CopyTo(swapChain);
- }
-
- // If the host is responsible for scaling the output of the swapchain, then
- // scale it now before returning an instance to the caller. This is done by
- // first reading the current size of the swapchain panel, then scaling
- if (SUCCEEDED(result))
- {
- if (mSwapChainSizeSpecified || mSwapChainScaleSpecified)
- {
- result = GetSwapChainPanelSize(mSwapChainPanel, mSwapChainPanelDispatcher,
- &currentPanelSize);
-
- // Scale the swapchain to fit inside the contents of the panel.
- if (SUCCEEDED(result))
- {
- result = scaleSwapChain(currentPanelSize, mClientRect);
- }
- }
- }
-
- return result;
-}
-
-HRESULT SwapChainPanelNativeWindow::scaleSwapChain(const Size &windowSize, const RECT &clientRect)
-{
- Size renderScale = {windowSize.Width / std::max(LONG(1), clientRect.right),
- windowSize.Height / std::max(LONG(1), clientRect.bottom)};
- // Setup a scale matrix for the swap chain
- DXGI_MATRIX_3X2_F scaleMatrix = {};
- scaleMatrix._11 = renderScale.Width;
- scaleMatrix._22 = renderScale.Height;
-
- ComPtr<IDXGISwapChain2> swapChain2;
- HRESULT result = mSwapChain.As(&swapChain2);
- if (SUCCEEDED(result))
- {
- result = swapChain2->SetMatrixTransform(&scaleMatrix);
- }
-
- return result;
-}
-
-HRESULT GetSwapChainPanelSize(
- const ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> &swapChainPanel,
- const ComPtr<ICoreDispatcher> &dispatcher,
- Size *windowSize)
-{
- ComPtr<IUIElement> uiElement;
- HRESULT result = swapChainPanel.As(&uiElement);
- if (SUCCEEDED(result))
- {
- result = RunOnUIThread(
- [uiElement, windowSize] { return uiElement->get_RenderSize(windowSize); }, dispatcher);
- }
-
- return result;
-}
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h
deleted file mode 100644
index f9a2fc0e4b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h
+++ /dev/null
@@ -1,93 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// SwapChainPanelNativeWindow.h: NativeWindow for managing ISwapChainPanel native window types.
-
-#ifndef LIBANGLE_RENDERER_D3D_D3D11_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_
-#define LIBANGLE_RENDERER_D3D_D3D11_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_
-
-#include "libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h"
-
-#include <memory>
-
-namespace rx
-{
-class SwapChainPanelNativeWindow : public InspectableNativeWindow, public std::enable_shared_from_this<SwapChainPanelNativeWindow>
-{
- public:
- ~SwapChainPanelNativeWindow();
-
- bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) override;
- HRESULT createSwapChain(ID3D11Device *device,
- IDXGIFactory2 *factory,
- DXGI_FORMAT format,
- unsigned int width,
- unsigned int height,
- bool containsAlpha,
- IDXGISwapChain1 **swapChain) override;
-
- protected:
- HRESULT scaleSwapChain(const Size &windowSize, const RECT &clientRect) override;
-
- bool registerForSizeChangeEvents();
- void unregisterForSizeChangeEvents();
-
- private:
- ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> mSwapChainPanel;
- ComPtr<ABI::Windows::UI::Core::ICoreDispatcher> mSwapChainPanelDispatcher;
- ComPtr<IMap<HSTRING, IInspectable*>> mPropertyMap;
- ComPtr<IDXGISwapChain1> mSwapChain;
-};
-
-[uuid(8ACBD974-8187-4508-AD80-AEC77F93CF36)]
-class SwapChainPanelSizeChangedHandler :
- public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, ABI::Windows::UI::Xaml::ISizeChangedEventHandler>
-{
- public:
- SwapChainPanelSizeChangedHandler() { }
- HRESULT RuntimeClassInitialize(std::shared_ptr<InspectableNativeWindow> host)
- {
- if (!host)
- {
- return E_INVALIDARG;
- }
-
- mHost = host;
- return S_OK;
- }
-
- // ISizeChangedEventHandler
- IFACEMETHOD(Invoke)(IInspectable *sender, ABI::Windows::UI::Xaml::ISizeChangedEventArgs *sizeChangedEventArgs)
- {
- std::shared_ptr<InspectableNativeWindow> host = mHost.lock();
- if (host)
- {
- // The size of the ISwapChainPanel control is returned in DIPs.
- // We are keeping these in dips because the swapchain created for composition
- // also uses dip units. This keeps dimensions, viewports, etc in the same unit.
- // XAML Clients of the ISwapChainPanel are required to use dips to define their
- // layout sizes as well.
- ABI::Windows::Foundation::Size newSize;
- HRESULT result = sizeChangedEventArgs->get_NewSize(&newSize);
- if (SUCCEEDED(result))
- {
- host->setNewClientSize(newSize);
- }
- }
-
- return S_OK;
- }
-
- private:
- std::weak_ptr<InspectableNativeWindow> mHost;
-};
-
-HRESULT GetSwapChainPanelSize(
- const ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> &swapChainPanel,
- const ComPtr<ABI::Windows::UI::Core::ICoreDispatcher> &dispatcher,
- Size *windowSize);
-}
-#endif // LIBANGLE_RENDERER_D3D_D3D11_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp
deleted file mode 100644
index 36f2bd0db8..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp
+++ /dev/null
@@ -1,829 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Blit9.cpp: Surface copy utility class.
-
-#include "libANGLE/renderer/d3d/d3d9/Blit9.h"
-
-#include "libANGLE/renderer/d3d/TextureD3D.h"
-#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
-#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
-#include "libANGLE/renderer/d3d/d3d9/TextureStorage9.h"
-#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
-#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
-#include "libANGLE/angletypes.h"
-#include "libANGLE/Framebuffer.h"
-#include "libANGLE/FramebufferAttachment.h"
-
-namespace
-{
-// Precompiled shaders
-#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h"
-#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h"
-#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h"
-#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminancepremultps.h"
-#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceunmultps.h"
-#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h"
-#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskpremultps.h"
-#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskunmultps.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 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]);
- }
-}
-
-gl::Error Blit9::initialize()
-{
- if (mGeometryLoaded)
- {
- return gl::NoError();
- }
-
- 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);
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to create internal blit vertex shader, "
- << gl::FmtHR(result);
- }
-
- void *lockPtr = nullptr;
- result = mQuadVertexBuffer->Lock(0, 0, &lockPtr, 0);
-
- if (FAILED(result) || lockPtr == nullptr)
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- SafeRelease(mQuadVertexBuffer);
- return gl::OutOfMemory() << "Failed to lock internal blit vertex shader, "
- << gl::FmtHR(result);
- }
-
- memcpy(lockPtr, quad, sizeof(quad));
- mQuadVertexBuffer->Unlock();
-
- static const D3DVERTEXELEMENT9 elements[] =
- {
- { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
- D3DDECL_END()
- };
-
- result = device->CreateVertexDeclaration(elements, &mQuadVertexDeclaration);
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- SafeRelease(mQuadVertexBuffer);
- return gl::OutOfMemory() << "Failed to lock internal blit vertex declaration, "
- << gl::FmtHR(result);
- }
-
- mGeometryLoaded = true;
- return gl::NoError();
-}
-
-template <class D3DShaderType>
-gl::Error Blit9::setShader(ShaderId source, const char *profile,
- gl::Error (Renderer9::*createShader)(const DWORD *, size_t length, D3DShaderType **outShader),
- HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*))
-{
- IDirect3DDevice9 *device = mRenderer->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)(reinterpret_cast<const DWORD*>(shaderCode), shaderSize, &shader));
- mCompiledShaders[source] = shader;
- }
-
- HRESULT hr = (device->*setShader)(shader);
- if (FAILED(hr))
- {
- return gl::OutOfMemory() << "Failed to set shader for blit operation, " << gl::FmtHR(hr);
- }
-
- return gl::NoError();
-}
-
-gl::Error Blit9::setVertexShader(ShaderId shader)
-{
- return setShader<IDirect3DVertexShader9>(shader, "vs_2_0", &Renderer9::createVertexShader, &IDirect3DDevice9::SetVertexShader);
-}
-
-gl::Error Blit9::setPixelShader(ShaderId shader)
-{
- return setShader<IDirect3DPixelShader9>(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);
-}
-
-gl::Error Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
-{
- ANGLE_TRY(initialize());
-
- IDirect3DBaseTexture9 *texture = nullptr;
- ANGLE_TRY(copySurfaceToTexture(source, getSurfaceRect(source), &texture));
-
- IDirect3DDevice9 *device = mRenderer->getDevice();
-
- saveState();
-
- device->SetTexture(0, texture);
- device->SetRenderTarget(0, dest);
-
- ANGLE_TRY(setVertexShader(SHADER_VS_STANDARD));
- ANGLE_TRY(setPixelShader(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();
-
- SafeRelease(texture);
-
- restoreState();
-
- return gl::NoError();
-}
-
-gl::Error Blit9::copy2D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const RECT &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level)
-{
- ANGLE_TRY(initialize());
-
- const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
- ASSERT(colorbuffer);
-
- RenderTarget9 *renderTarget9 = nullptr;
- ANGLE_TRY(colorbuffer->getRenderTarget(context, &renderTarget9));
- ASSERT(renderTarget9);
-
- IDirect3DSurface9 *source = renderTarget9->getSurface();
- ASSERT(source);
-
- IDirect3DSurface9 *destSurface = nullptr;
- TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
- gl::Error error = storage9->getSurfaceLevel(context, GL_TEXTURE_2D, level, true, &destSurface);
- if (error.isError())
- {
- SafeRelease(source);
- return error;
- }
- ASSERT(destSurface);
-
- gl::Error result =
- copy(source, nullptr, sourceRect, destFormat, destOffset, destSurface, false, false, false);
-
- SafeRelease(destSurface);
- SafeRelease(source);
-
- return result;
-}
-
-gl::Error Blit9::copyCube(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const RECT &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum target,
- GLint level)
-{
- gl::Error error = initialize();
- if (error.isError())
- {
- return error;
- }
-
- const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
- ASSERT(colorbuffer);
-
- RenderTarget9 *renderTarget9 = nullptr;
- error = colorbuffer->getRenderTarget(context, &renderTarget9);
- if (error.isError())
- {
- return error;
- }
- ASSERT(renderTarget9);
-
- IDirect3DSurface9 *source = renderTarget9->getSurface();
- ASSERT(source);
-
- IDirect3DSurface9 *destSurface = nullptr;
- TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
- error = storage9->getSurfaceLevel(context, target, level, true, &destSurface);
- if (error.isError())
- {
- SafeRelease(source);
- return error;
- }
- ASSERT(destSurface);
-
- gl::Error result =
- copy(source, nullptr, sourceRect, destFormat, destOffset, destSurface, false, false, false);
-
- SafeRelease(destSurface);
- SafeRelease(source);
-
- return result;
-}
-
-gl::Error Blit9::copyTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- const RECT &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum destTarget,
- GLint destLevel,
- bool flipY,
- bool premultiplyAlpha,
- bool unmultiplyAlpha)
-{
- ANGLE_TRY(initialize());
-
- const TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
-
- TextureStorage *sourceStorage = nullptr;
- ANGLE_TRY(const_cast<TextureD3D *>(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));
-
- IDirect3DSurface9 *sourceSurface = nullptr;
- ANGLE_TRY(
- sourceStorage9->getSurfaceLevel(context, GL_TEXTURE_2D, sourceLevel, true, &sourceSurface));
-
- IDirect3DSurface9 *destSurface = nullptr;
- gl::Error error =
- destStorage9->getSurfaceLevel(context, destTarget, destLevel, true, &destSurface);
- if (error.isError())
- {
- SafeRelease(sourceSurface);
- return error;
- }
-
- error = copy(sourceSurface, sourceTexture, sourceRect, destFormat, destOffset, destSurface,
- flipY, premultiplyAlpha, unmultiplyAlpha);
-
- SafeRelease(sourceSurface);
- SafeRelease(destSurface);
-
- return error;
-}
-
-gl::Error Blit9::copy(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);
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory()
- << "Failed to blit between textures, StretchRect " << gl::FmtHR(result);
- }
-
- return gl::NoError();
- }
- else
- {
- IDirect3DBaseTexture9 *texture = sourceTexture;
- RECT adjustedSourceRect = sourceRect;
- gl::Extents sourceSize(sourceDesc.Width, sourceDesc.Height, 1);
-
- if (texture == nullptr)
- {
- ANGLE_TRY(copySurfaceToTexture(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;
- }
- else
- {
- texture->AddRef();
- }
-
- gl::Error error = formatConvert(texture, adjustedSourceRect, sourceSize, destFormat,
- destOffset, dest, flipY, premultiplyAlpha, unmultiplyAlpha);
-
- SafeRelease(texture);
-
- return error;
- }
-}
-
-gl::Error Blit9::formatConvert(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());
-
- 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();
-
- gl::Error error = setFormatConvertShaders(destFormat, flipY, premultiplyAlpha, unmultiplyAlpha);
- if (!error.isError())
- {
- render();
- }
-
- restoreState();
-
- return error;
-}
-
-gl::Error Blit9::setFormatConvertShaders(GLenum destFormat,
- bool flipY,
- bool premultiplyAlpha,
- bool unmultiplyAlpha)
-{
- ANGLE_TRY(setVertexShader(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(SHADER_PS_COMPONENTMASK));
- }
- else if (premultiplyAlpha)
- {
- ANGLE_TRY(setPixelShader(SHADER_PS_COMPONENTMASK_PREMULTIPLY_ALPHA));
- }
- else
- {
- ASSERT(unmultiplyAlpha);
- ANGLE_TRY(setPixelShader(SHADER_PS_COMPONENTMASK_UNMULTIPLY_ALPHA));
- }
- break;
-
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- if (premultiplyAlpha == unmultiplyAlpha)
- {
- ANGLE_TRY(setPixelShader(SHADER_PS_LUMINANCE));
- }
- else if (premultiplyAlpha)
- {
- ANGLE_TRY(setPixelShader(SHADER_PS_LUMINANCE_PREMULTIPLY_ALPHA));
- }
- else
- {
- ASSERT(unmultiplyAlpha);
- ANGLE_TRY(setPixelShader(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)
- {
- default: UNREACHABLE();
- case GL_RGBA:
- case GL_BGRA_EXT:
- multConst[X] = 1;
- multConst[Y] = 1;
- multConst[Z] = 1;
- multConst[W] = 1;
- addConst[X] = 0;
- addConst[Y] = 0;
- addConst[Z] = 0;
- addConst[W] = 0;
- break;
-
- case GL_RGB:
- multConst[X] = 1;
- multConst[Y] = 1;
- multConst[Z] = 1;
- multConst[W] = 0;
- addConst[X] = 0;
- addConst[Y] = 0;
- addConst[Z] = 0;
- addConst[W] = 1;
- break;
-
- case GL_RG_EXT:
- multConst[X] = 1;
- multConst[Y] = 1;
- multConst[Z] = 0;
- multConst[W] = 0;
- addConst[X] = 0;
- addConst[Y] = 0;
- addConst[Z] = 0;
- addConst[W] = 1;
- break;
-
- case GL_RED_EXT:
- multConst[X] = 1;
- multConst[Y] = 0;
- multConst[Z] = 0;
- multConst[W] = 0;
- addConst[X] = 0;
- addConst[Y] = 0;
- addConst[Z] = 0;
- addConst[W] = 1;
- break;
-
- case GL_ALPHA:
- multConst[X] = 0;
- multConst[Y] = 0;
- multConst[Z] = 0;
- multConst[W] = 1;
- addConst[X] = 0;
- addConst[Y] = 0;
- addConst[Z] = 0;
- addConst[W] = 0;
- break;
-
- case GL_LUMINANCE:
- multConst[X] = 1;
- multConst[Y] = 0;
- multConst[Z] = 0;
- multConst[W] = 0;
- addConst[X] = 0;
- addConst[Y] = 0;
- addConst[Z] = 0;
- addConst[W] = 1;
- break;
-
- case GL_LUMINANCE_ALPHA:
- multConst[X] = 1;
- multConst[Y] = 0;
- multConst[Z] = 0;
- multConst[W] = 1;
- addConst[X] = 0;
- addConst[Y] = 0;
- addConst[Z] = 0;
- addConst[W] = 0;
- break;
- }
-
- mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst, 2);
-
- return gl::NoError();
-}
-
-gl::Error Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface,
- const RECT &sourceRect,
- IDirect3DBaseTexture9 **outTexture)
-{
- ASSERT(surface);
-
- IDirect3DDevice9 *device = mRenderer->getDevice();
-
- D3DSURFACE_DESC sourceDesc;
- surface->GetDesc(&sourceDesc);
-
- // Copy the render target into a texture
- IDirect3DTexture9 *texture;
- HRESULT result = device->CreateTexture(
- sourceRect.right - sourceRect.left, sourceRect.bottom - sourceRect.top, 1,
- D3DUSAGE_RENDERTARGET, sourceDesc.Format, D3DPOOL_DEFAULT, &texture, nullptr);
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to allocate internal texture for blit, "
- << gl::FmtHR(result);
- }
-
- IDirect3DSurface9 *textureSurface;
- result = texture->GetSurfaceLevel(0, &textureSurface);
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- SafeRelease(texture);
- return gl::OutOfMemory() << "Failed to query surface of internal blit texture, "
- << gl::FmtHR(result);
- }
-
- mRenderer->endScene();
- result = device->StretchRect(surface, &sourceRect, textureSurface, nullptr, D3DTEXF_NONE);
-
- SafeRelease(textureSurface);
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- SafeRelease(texture);
- return gl::OutOfMemory() << "Failed to copy between internal blit textures, "
- << gl::FmtHR(result);
- }
-
- *outTexture = texture;
- return gl::NoError();
-}
-
-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();
- }
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.h
deleted file mode 100644
index 026874f8ae..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.h
+++ /dev/null
@@ -1,153 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Blit9.cpp: Surface copy utility class.
-
-#ifndef LIBANGLE_RENDERER_D3D_D3D9_BLIT9_H_
-#define LIBANGLE_RENDERER_D3D_D3D9_BLIT9_H_
-
-#include "common/angleutils.h"
-#include "libANGLE/Error.h"
-
-#include <GLES2/gl2.h>
-
-namespace gl
-{
-class Context;
-class Framebuffer;
-class Texture;
-struct Extents;
-struct Offset;
-}
-
-namespace rx
-{
-class Renderer9;
-class TextureStorage;
-
-class Blit9 : angle::NonCopyable
-{
- public:
- explicit Blit9(Renderer9 *renderer);
- ~Blit9();
-
- gl::Error initialize();
-
- // Copy from source surface to dest surface.
- // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
- gl::Error copy2D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const RECT &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level);
- gl::Error copyCube(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const RECT &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum target,
- GLint level);
- gl::Error copyTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- const RECT &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum 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.
- gl::Error boxFilter(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.
- gl::Error formatConvert(IDirect3DBaseTexture9 *source,
- const RECT &sourceRect,
- const gl::Extents &sourceSize,
- GLenum destFormat,
- const gl::Offset &destOffset,
- IDirect3DSurface9 *dest,
- bool flipY,
- bool premultiplyAlpha,
- bool unmultiplyAlpha);
- gl::Error setFormatConvertShaders(GLenum destFormat,
- bool flipY,
- bool premultiplyAlpha,
- bool unmultiplyAlpha);
-
- gl::Error copy(IDirect3DSurface9 *source,
- IDirect3DBaseTexture9 *sourceTexture,
- const RECT &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- IDirect3DSurface9 *dest,
- bool flipY,
- bool premultiplyAlpha,
- bool unmultiplyAlpha);
- gl::Error copySurfaceToTexture(IDirect3DSurface9 *surface,
- const RECT &sourceRect,
- 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>
- gl::Error setShader(ShaderId source, const char *profile,
- gl::Error (Renderer9::*createShader)(const DWORD *, size_t length, D3DShaderType **outShader),
- HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*));
-
- gl::Error setVertexShader(ShaderId shader);
- gl::Error setPixelShader(ShaderId shader);
- void render();
-
- void saveState();
- void restoreState();
- IDirect3DStateBlock9 *mSavedStateBlock;
- IDirect3DSurface9 *mSavedRenderTarget;
- IDirect3DSurface9 *mSavedDepthStencil;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_BLIT9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp
deleted file mode 100644
index dc308e7752..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-//
-// 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/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;
-}
-
-gl::Error Buffer9::setData(const gl::Context *context,
- gl::BufferBinding /*target*/,
- const void *data,
- size_t size,
- gl::BufferUsage usage)
-{
- if (size > mMemory.size())
- {
- if (!mMemory.resize(size))
- {
- return gl::OutOfMemory() << "Failed to resize internal buffer.";
- }
- }
-
- mSize = size;
- if (data && size > 0)
- {
- memcpy(mMemory.data(), data, size);
- }
-
- updateD3DBufferUsage(context, usage);
-
- invalidateStaticData(context);
-
- return gl::NoError();
-}
-
-gl::Error Buffer9::getData(const gl::Context *context, const uint8_t **outData)
-{
- *outData = mMemory.data();
- return gl::NoError();
-}
-
-gl::Error Buffer9::setSubData(const gl::Context *context,
- gl::BufferBinding /*target*/,
- const void *data,
- size_t size,
- size_t offset)
-{
- if (offset + size > mMemory.size())
- {
- if (!mMemory.resize(offset + size))
- {
- return gl::OutOfMemory() << "Failed to resize internal buffer.";
- }
- }
-
- mSize = std::max(mSize, offset + size);
- if (data && size > 0)
- {
- memcpy(mMemory.data() + offset, data, size);
- }
-
- invalidateStaticData(context);
-
- return gl::NoError();
-}
-
-gl::Error 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 gl::NoError();
-}
-
-// We do not support buffer mapping in D3D9
-gl::Error Buffer9::map(const gl::Context *context, GLenum access, void **mapPtr)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error Buffer9::mapRange(const gl::Context *context,
- size_t offset,
- size_t length,
- GLbitfield access,
- void **mapPtr)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error Buffer9::unmap(const gl::Context *context, GLboolean *result)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error Buffer9::markTransformFeedbackUsage(const gl::Context *context)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.h
deleted file mode 100644
index 960b2a2474..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.h
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// 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;
- gl::Error getData(const gl::Context *context, const uint8_t **outData) override;
-
- // BufferImpl implementation
- gl::Error setData(const gl::Context *context,
- gl::BufferBinding target,
- const void *data,
- size_t size,
- gl::BufferUsage usage) override;
- gl::Error setSubData(const gl::Context *context,
- gl::BufferBinding target,
- const void *data,
- size_t size,
- size_t offset) override;
- gl::Error copySubData(const gl::Context *context,
- BufferImpl *source,
- GLintptr sourceOffset,
- GLintptr destOffset,
- GLsizeiptr size) override;
- gl::Error map(const gl::Context *context, GLenum access, void **mapPtr) override;
- gl::Error mapRange(const gl::Context *context,
- size_t offset,
- size_t length,
- GLbitfield access,
- void **mapPtr) override;
- gl::Error unmap(const gl::Context *context, GLboolean *result) override;
- gl::Error 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Context9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
deleted file mode 100644
index 1b9874cc20..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
+++ /dev/null
@@ -1,303 +0,0 @@
-//
-// 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::ContextState &state, Renderer9 *renderer)
- : ContextImpl(state), mRenderer(renderer)
-{
-}
-
-Context9::~Context9()
-{
-}
-
-gl::Error Context9::initialize()
-{
- return gl::NoError();
-}
-
-CompilerImpl *Context9::createCompiler()
-{
- return new CompilerD3D(SH_HLSL_3_0_OUTPUT);
-}
-
-ShaderImpl *Context9::createShader(const gl::ShaderState &data)
-{
- return new ShaderD3D(data, mRenderer->getWorkarounds(), 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.getTarget())
- {
- case GL_TEXTURE_2D:
- return new TextureD3D_2D(state, mRenderer);
- case GL_TEXTURE_CUBE_MAP:
- return new TextureD3D_Cube(state, mRenderer);
- case GL_TEXTURE_EXTERNAL_OES:
- return new TextureD3D_External(state, mRenderer);
- default:
- UNREACHABLE();
- }
- return nullptr;
-}
-
-RenderbufferImpl *Context9::createRenderbuffer()
-{
- return new RenderbufferD3D(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(GLenum 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 *>();
-}
-
-gl::Error Context9::flush(const gl::Context *context)
-{
- return mRenderer->flush();
-}
-
-gl::Error Context9::finish(const gl::Context *context)
-{
- return mRenderer->finish();
-}
-
-gl::Error Context9::drawArrays(const gl::Context *context, GLenum mode, GLint first, GLsizei count)
-{
- return mRenderer->genericDrawArrays(context, mode, first, count, 0);
-}
-
-gl::Error Context9::drawArraysInstanced(const gl::Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei instanceCount)
-{
- return mRenderer->genericDrawArrays(context, mode, first, count, instanceCount);
-}
-
-gl::Error Context9::drawElements(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices)
-{
- return mRenderer->genericDrawElements(context, mode, count, type, indices, 0);
-}
-
-gl::Error Context9::drawElementsInstanced(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances)
-{
- return mRenderer->genericDrawElements(context, mode, count, type, indices, instances);
-}
-
-gl::Error Context9::drawRangeElements(const gl::Context *context,
- GLenum mode,
- GLuint start,
- GLuint end,
- GLsizei count,
- GLenum type,
- const void *indices)
-{
- return mRenderer->genericDrawElements(context, mode, count, type, indices, 0);
-}
-
-gl::Error Context9::drawArraysIndirect(const gl::Context *context,
- GLenum mode,
- const void *indirect)
-{
- UNREACHABLE();
- return gl::InternalError() << "D3D9 doesn't support ES 3.1 DrawArraysIndirect API";
-}
-
-gl::Error Context9::drawElementsIndirect(const gl::Context *context,
- GLenum mode,
- GLenum type,
- const void *indirect)
-{
- UNREACHABLE();
- return gl::InternalError() << "D3D9 doesn't support ES 3.1 DrawElementsIndirect API";
-}
-
-GLenum 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)
-{
- auto optionalString = angle::WidenString(static_cast<size_t>(length), marker);
- if (optionalString.valid())
- {
- mRenderer->getAnnotator()->setMarker(optionalString.value().data());
- }
-}
-
-void Context9::pushGroupMarker(GLsizei length, const char *marker)
-{
- auto optionalString = angle::WidenString(static_cast<size_t>(length), marker);
- if (optionalString.valid())
- {
- mRenderer->getAnnotator()->beginEvent(optionalString.value().data());
- }
-}
-
-void Context9::popGroupMarker()
-{
- mRenderer->getAnnotator()->endEvent();
-}
-
-void Context9::pushDebugGroup(GLenum source, GLuint id, GLsizei length, const char *message)
-{
- // Fall through to the EXT_debug_marker functions
- pushGroupMarker(length, message);
-}
-
-void Context9::popDebugGroup()
-{
- // Fall through to the EXT_debug_marker functions
- popGroupMarker();
-}
-
-void Context9::syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits)
-{
- mRenderer->getStateManager()->syncState(mState.getState(), dirtyBits);
-}
-
-GLint Context9::getGPUDisjoint()
-{
- return mRenderer->getGPUDisjoint();
-}
-
-GLint64 Context9::getTimestamp()
-{
- return mRenderer->getTimestamp();
-}
-
-void Context9::onMakeCurrent(const gl::Context *context)
-{
-}
-
-const 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();
-}
-
-gl::Error Context9::dispatchCompute(const gl::Context *context,
- GLuint numGroupsX,
- GLuint numGroupsY,
- GLuint numGroupsZ)
-{
- UNREACHABLE();
- return gl::InternalError() << "D3D9 doesn't support ES 3.1 DispatchCompute API";
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Context9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Context9.h
deleted file mode 100644
index d681bfde89..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Context9.h
+++ /dev/null
@@ -1,151 +0,0 @@
-//
-// 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 "libANGLE/renderer/ContextImpl.h"
-
-namespace rx
-{
-class Renderer9;
-
-class Context9 : public ContextImpl
-{
- public:
- Context9(const gl::ContextState &state, Renderer9 *renderer);
- ~Context9() override;
-
- gl::Error initialize() 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() 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(GLenum 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;
-
- // Flush and finish.
- gl::Error flush(const gl::Context *context) override;
- gl::Error finish(const gl::Context *context) override;
-
- // Drawing methods.
- gl::Error drawArrays(const gl::Context *context,
- GLenum mode,
- GLint first,
- GLsizei count) override;
- gl::Error drawArraysInstanced(const gl::Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei instanceCount) override;
-
- gl::Error drawElements(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices) override;
- gl::Error drawElementsInstanced(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances) override;
- gl::Error drawRangeElements(const gl::Context *context,
- GLenum mode,
- GLuint start,
- GLuint end,
- GLsizei count,
- GLenum type,
- const void *indices) override;
- gl::Error drawArraysIndirect(const gl::Context *context,
- GLenum mode,
- const void *indirect) override;
- gl::Error drawElementsIndirect(const gl::Context *context,
- GLenum mode,
- GLenum type,
- const void *indirect) override;
-
- // Device loss
- GLenum 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, GLsizei length, const char *message) override;
- void popDebugGroup() override;
-
- // State sync with dirty bits.
- void syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits) override;
-
- // Disjoint timer queries
- GLint getGPUDisjoint() override;
- GLint64 getTimestamp() override;
-
- // Context switching
- void onMakeCurrent(const gl::Context *context) override;
-
- // Caps queries
- const gl::Caps &getNativeCaps() const override;
- const gl::TextureCapsMap &getNativeTextureCaps() const override;
- const gl::Extensions &getNativeExtensions() const override;
- const gl::Limitations &getNativeLimitations() const override;
-
- gl::Error dispatchCompute(const gl::Context *context,
- GLuint numGroupsX,
- GLuint numGroupsY,
- GLuint numGroupsZ) override;
-
- Renderer9 *getRenderer() const { return mRenderer; }
-
- private:
- Renderer9 *mRenderer;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_CONTEXT9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp
deleted file mode 100644
index 6ec35e16a7..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// 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 wchar_t *eventName)
-{
- D3DPERF_BeginEvent(0, eventName);
-}
-
-void DebugAnnotator9::endEvent()
-{
- D3DPERF_EndEvent();
-}
-
-void DebugAnnotator9::setMarker(const wchar_t *markerName)
-{
- D3DPERF_SetMarker(0, markerName);
-}
-
-bool DebugAnnotator9::getStatus()
-{
- return !!D3DPERF_GetStatus();
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h
deleted file mode 100644
index b28008335f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// 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 wchar_t *eventName) override;
- void endEvent() override;
- void setMarker(const wchar_t *markerName) override;
- bool getStatus() override;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_DEBUGANNOTATOR9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp
deleted file mode 100644
index bff3881655..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// 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/renderer/d3d/d3d9/renderer9_utils.h"
-#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
-
-namespace rx
-{
-
-FenceNV9::FenceNV9(Renderer9 *renderer) : FenceNVImpl(), mRenderer(renderer), mQuery(nullptr)
-{
-}
-
-FenceNV9::~FenceNV9()
-{
- SafeRelease(mQuery);
-}
-
-gl::Error FenceNV9::set(GLenum condition)
-{
- if (!mQuery)
- {
- gl::Error error = mRenderer->allocateEventQuery(&mQuery);
- if (error.isError())
- {
- return error;
- }
- }
-
- HRESULT result = mQuery->Issue(D3DISSUE_END);
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- SafeRelease(mQuery);
- return gl::OutOfMemory() << "Failed to end event query, " << gl::FmtHR(result);
- }
-
- return gl::NoError();
-}
-
-gl::Error FenceNV9::test(GLboolean *outFinished)
-{
- return testHelper(true, outFinished);
-}
-
-gl::Error FenceNV9::finish()
-{
- GLboolean finished = GL_FALSE;
- while (finished != GL_TRUE)
- {
- gl::Error error = testHelper(true, &finished);
- if (error.isError())
- {
- return error;
- }
-
- Sleep(0);
- }
-
- return gl::NoError();
-}
-
-gl::Error FenceNV9::testHelper(bool flushCommandBuffer, GLboolean *outFinished)
-{
- ASSERT(mQuery);
-
- DWORD getDataFlags = (flushCommandBuffer ? D3DGETDATA_FLUSH : 0);
- HRESULT result = mQuery->GetData(nullptr, 0, getDataFlags);
-
- if (d3d9::isDeviceLostError(result))
- {
- mRenderer->notifyDeviceLost();
- return gl::OutOfMemory() << "Device was lost while querying result of an event query.";
- }
- else if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to get query data, " << gl::FmtHR(result);
- }
-
- ASSERT(result == S_OK || result == S_FALSE);
- *outFinished = ((result == S_OK) ? GL_TRUE : GL_FALSE);
- return gl::NoError();
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Fence9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Fence9.h
deleted file mode 100644
index de0ff20774..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Fence9.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// 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 Renderer9;
-
-class FenceNV9 : public FenceNVImpl
-{
- public:
- explicit FenceNV9(Renderer9 *renderer);
- ~FenceNV9() override;
-
- gl::Error set(GLenum condition) override;
- gl::Error test(GLboolean *outFinished) override;
- gl::Error finish() override;
-
- private:
- gl::Error testHelper(bool flushCommandBuffer, GLboolean *outFinished);
-
- Renderer9 *mRenderer;
- IDirect3DQuery9 *mQuery;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_FENCE9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
deleted file mode 100644
index dff12e03f8..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
+++ /dev/null
@@ -1,411 +0,0 @@
-//
-// 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()
-{
-}
-
-gl::Error Framebuffer9::discard(const gl::Context *context, size_t, const GLenum *)
-{
- // Extension not implemented in D3D9 renderer
- UNREACHABLE();
- return gl::NoError();
-}
-
-gl::Error Framebuffer9::invalidate(const gl::Context *context, size_t, const GLenum *)
-{
- // Shouldn't ever reach here in D3D9
- UNREACHABLE();
- return gl::NoError();
-}
-
-gl::Error Framebuffer9::invalidateSub(const gl::Context *context,
- size_t,
- const GLenum *,
- const gl::Rectangle &)
-{
- // Shouldn't ever reach here in D3D9
- UNREACHABLE();
- return gl::NoError();
-}
-
-gl::Error Framebuffer9::clearImpl(const gl::Context *context, const ClearParameters &clearParams)
-{
- const gl::FramebufferAttachment *colorAttachment = mState.getColorAttachment(0);
- const gl::FramebufferAttachment *depthStencilAttachment = mState.getDepthOrStencilAttachment();
-
- ANGLE_TRY(mRenderer->applyRenderTarget(context, colorAttachment, depthStencilAttachment));
-
- const gl::State &glState = context->getGLState();
- float nearZ = glState.getNearPlane();
- float farZ = glState.getFarPlane();
- mRenderer->setViewport(glState.getViewport(), nearZ, farZ, GL_TRIANGLES,
- glState.getRasterizerState().frontFace, true);
-
- mRenderer->setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled());
-
- return mRenderer->clear(context, clearParams, colorAttachment, depthStencilAttachment);
-}
-
-gl::Error 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);
-
- if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
- {
- UNIMPLEMENTED(); // FIXME: Requires resolve using StretchRect into non-multisampled render target
- SafeRelease(surface);
- return gl::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);
- return gl::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();
- }
-
- return gl::OutOfMemory() << "Failed to read internal render target data.";
- }
-
- if (directToPixels)
- {
- SafeRelease(systemSurface);
- return gl::NoError();
- }
-
- 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);
-
- return gl::OutOfMemory() << "Failed to lock internal render target.";
- }
-
- uint8_t *source = reinterpret_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.format = format;
- packParams.type = type;
- packParams.outputPitch = static_cast<GLuint>(outputPitch);
- packParams.pack = pack;
-
- PackPixels(packParams, d3dFormatInfo.info(), inputPitch, source, pixels);
-
- systemSurface->UnlockRect();
- SafeRelease(systemSurface);
-
- return gl::NoError();
-}
-
-gl::Error 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();
-
- if (blitRenderTarget)
- {
- const gl::FramebufferAttachment *readBuffer = sourceFramebuffer->getColorbuffer(0);
- ASSERT(readBuffer);
-
- RenderTarget9 *readRenderTarget = nullptr;
- gl::Error error = readBuffer->getRenderTarget(context, &readRenderTarget);
- if (error.isError())
- {
- return error;
- }
- ASSERT(readRenderTarget);
-
- const gl::FramebufferAttachment *drawBuffer = mState.getColorAttachment(0);
- ASSERT(drawBuffer);
-
- RenderTarget9 *drawRenderTarget = nullptr;
- error = drawBuffer->getRenderTarget(context, &drawRenderTarget);
- if (error.isError())
- {
- return error;
- }
- ASSERT(drawRenderTarget);
-
- // The getSurface calls do an AddRef so save them until after no errors are possible
- IDirect3DSurface9* readSurface = readRenderTarget->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);
-
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Internal blit failed, StretchRect " << gl::FmtHR(result);
- }
- }
-
- if (blitDepth || blitStencil)
- {
- const gl::FramebufferAttachment *readBuffer = sourceFramebuffer->getDepthOrStencilbuffer();
- ASSERT(readBuffer);
-
- RenderTarget9 *readDepthStencil = nullptr;
- gl::Error error = readBuffer->getRenderTarget(context, &readDepthStencil);
- if (error.isError())
- {
- return error;
- }
- ASSERT(readDepthStencil);
-
- const gl::FramebufferAttachment *drawBuffer = mState.getDepthOrStencilAttachment();
- ASSERT(drawBuffer);
-
- RenderTarget9 *drawDepthStencil = nullptr;
- error = drawBuffer->getRenderTarget(context, &drawDepthStencil);
- if (error.isError())
- {
- return error;
- }
- ASSERT(drawDepthStencil);
-
- // The getSurface calls do an AddRef so save them until after no errors are possible
- IDirect3DSurface9* readSurface = readDepthStencil->getSurface();
- ASSERT(readDepthStencil);
-
- IDirect3DSurface9* drawSurface = drawDepthStencil->getSurface();
- ASSERT(drawDepthStencil);
-
- HRESULT result = device->StretchRect(readSurface, nullptr, drawSurface, nullptr, D3DTEXF_NONE);
-
- SafeRelease(readSurface);
- SafeRelease(drawSurface);
-
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Internal blit failed, StretchRect " << gl::FmtHR(result);
- }
- }
-
- return gl::NoError();
-}
-
-GLenum Framebuffer9::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const
-{
- RenderTarget9 *renderTarget9 = GetAs<RenderTarget9>(renderTarget);
- const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(renderTarget9->getD3DFormat());
- return d3dFormatInfo.info().glInternalFormat;
-}
-
-gl::Error Framebuffer9::getSamplePosition(size_t index, GLfloat *xy) const
-{
- UNREACHABLE();
- return gl::InternalError() << "getSamplePosition is unsupported to d3d9.";
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h
deleted file mode 100644
index d2b46435ee..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// 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/d3d/FramebufferD3D.h"
-
-namespace rx
-{
-class Renderer9;
-
-class Framebuffer9 : public FramebufferD3D
-{
- public:
- Framebuffer9(const gl::FramebufferState &data, Renderer9 *renderer);
- ~Framebuffer9() override;
-
- gl::Error discard(const gl::Context *context, size_t count, const GLenum *attachments) override;
- gl::Error invalidate(const gl::Context *context,
- size_t count,
- const GLenum *attachments) override;
- gl::Error invalidateSub(const gl::Context *context,
- size_t count,
- const GLenum *attachments,
- const gl::Rectangle &area) override;
-
- gl::Error getSamplePosition(size_t index, GLfloat *xy) const override;
-
- private:
- gl::Error clearImpl(const gl::Context *context, const ClearParameters &clearParams) override;
-
- gl::Error readPixelsImpl(const gl::Context *context,
- const gl::Rectangle &area,
- GLenum format,
- GLenum type,
- size_t outputPitch,
- const gl::PixelPackState &pack,
- uint8_t *pixels) override;
-
- gl::Error 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;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Image9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
deleted file mode 100644
index 179629b362..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
+++ /dev/null
@@ -1,920 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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 "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
-#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
-#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
-#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
-#include "libANGLE/renderer/d3d/d3d9/TextureStorage9.h"
-#include "libANGLE/formatutils.h"
-#include "libANGLE/Framebuffer.h"
-#include "libANGLE/FramebufferAttachment.h"
-#include "libANGLE/Renderbuffer.h"
-#include "common/utilities.h"
-
-namespace rx
-{
-
-Image9::Image9(Renderer9 *renderer)
-{
- mSurface = nullptr;
- mRenderer = nullptr;
-
- mD3DPool = D3DPOOL_SYSTEMMEM;
- mD3DFormat = D3DFMT_UNKNOWN;
-
- mRenderer = renderer;
-}
-
-Image9::~Image9()
-{
- SafeRelease(mSurface);
-}
-
-gl::Error Image9::generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface)
-{
- D3DSURFACE_DESC destDesc;
- HRESULT result = destSurface->GetDesc(&destDesc);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to query the source surface description for mipmap generation, "
- << gl::FmtHR(result);
- }
-
- D3DSURFACE_DESC sourceDesc;
- result = sourceSurface->GetDesc(&sourceDesc);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to query the destination surface description for mipmap generation, "
- << gl::FmtHR(result);
- }
-
- ASSERT(sourceDesc.Format == destDesc.Format);
- ASSERT(sourceDesc.Width == 1 || sourceDesc.Width / 2 == destDesc.Width);
- ASSERT(sourceDesc.Height == 1 || sourceDesc.Height / 2 == destDesc.Height);
-
- const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(sourceDesc.Format);
- ASSERT(d3dFormatInfo.info().mipGenerationFunction != nullptr);
-
- D3DLOCKED_RECT sourceLocked = {0};
- result = sourceSurface->LockRect(&sourceLocked, nullptr, D3DLOCK_READONLY);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock the source surface for mipmap generation, "
- << gl::FmtHR(result);
- }
-
- D3DLOCKED_RECT destLocked = {0};
- result = destSurface->LockRect(&destLocked, nullptr, 0);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- sourceSurface->UnlockRect();
- return gl::OutOfMemory() << "Failed to lock the destination surface for mipmap generation, "
- << gl::FmtHR(result);
- }
-
- const uint8_t *sourceData = reinterpret_cast<const uint8_t*>(sourceLocked.pBits);
- uint8_t *destData = reinterpret_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 gl::NoError();
-}
-
-gl::Error Image9::generateMipmap(Image9 *dest, Image9 *source)
-{
- IDirect3DSurface9 *sourceSurface = nullptr;
- ANGLE_TRY(source->getSurface(&sourceSurface));
-
- IDirect3DSurface9 *destSurface = nullptr;
- ANGLE_TRY(dest->getSurface(&destSurface));
-
- ANGLE_TRY(generateMip(destSurface, sourceSurface));
-
- dest->markDirty();
-
- return gl::NoError();
-}
-
-gl::Error Image9::copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *source)
-{
- D3DLOCKED_RECT sourceLock = {0};
- D3DLOCKED_RECT destLock = {0};
-
- HRESULT result;
-
- result = source->LockRect(&sourceLock, nullptr, 0);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock source surface for copy, " << gl::FmtHR(result);
- }
-
- result = dest->LockRect(&destLock, nullptr, 0);
- if (FAILED(result))
- {
- source->UnlockRect();
- return gl::OutOfMemory() << "Failed to lock source surface for copy, " << gl::FmtHR(result);
- }
-
- 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 gl::NoError();
-}
-
-// static
-gl::Error Image9::CopyImage(const gl::Context *context,
- Image9 *dest,
- Image9 *source,
- const gl::Rectangle &sourceRect,
- const gl::Offset &destOffset,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha)
-{
- IDirect3DSurface9 *sourceSurface = nullptr;
- ANGLE_TRY(source->getSurface(&sourceSurface));
-
- IDirect3DSurface9 *destSurface = nullptr;
- ANGLE_TRY(dest->getSurface(&destSurface));
-
- D3DSURFACE_DESC destDesc;
- HRESULT result = destSurface->GetDesc(&destDesc);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to query the source surface description for mipmap generation, "
- << gl::FmtHR(result);
- }
- const d3d9::D3DFormat &destD3DFormatInfo = d3d9::GetD3DFormatInfo(destDesc.Format);
-
- D3DSURFACE_DESC sourceDesc;
- result = sourceSurface->GetDesc(&sourceDesc);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to query the destination surface description for mipmap generation, "
- << gl::FmtHR(result);
- }
- const d3d9::D3DFormat &sourceD3DFormatInfo = d3d9::GetD3DFormatInfo(sourceDesc.Format);
-
- D3DLOCKED_RECT sourceLocked = {0};
- result = sourceSurface->LockRect(&sourceLocked, nullptr, D3DLOCK_READONLY);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock the source surface for CopyImage, "
- << gl::FmtHR(result);
- }
-
- D3DLOCKED_RECT destLocked = {0};
- result = destSurface->LockRect(&destLocked, nullptr, 0);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- sourceSurface->UnlockRect();
- return gl::OutOfMemory() << "Failed to lock the destination surface for CopyImage, "
- << gl::FmtHR(result);
- }
-
- const uint8_t *sourceData = reinterpret_cast<const uint8_t *>(sourceLocked.pBits) +
- sourceRect.x * sourceD3DFormatInfo.pixelBytes +
- sourceRect.y * sourceLocked.Pitch;
- uint8_t *destData = reinterpret_cast<uint8_t *>(destLocked.pBits) +
- destOffset.x * destD3DFormatInfo.pixelBytes +
- destOffset.y * destLocked.Pitch;
- ASSERT(sourceData && destData);
-
- CopyImageCHROMIUM(sourceData, sourceLocked.Pitch, sourceD3DFormatInfo.pixelBytes,
- sourceD3DFormatInfo.info().colorReadFunction, destData, destLocked.Pitch,
- destD3DFormatInfo.pixelBytes, destD3DFormatInfo.info().colorWriteFunction,
- gl::GetUnsizedFormat(dest->getInternalFormat()),
- destD3DFormatInfo.info().componentType, sourceRect.width, sourceRect.height,
- unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
-
- destSurface->UnlockRect();
- sourceSurface->UnlockRect();
-
- return gl::NoError();
-}
-
-bool Image9::redefine(GLenum target, 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(target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP);
-
- if (mWidth != size.width ||
- mHeight != size.height ||
- mDepth != size.depth ||
- mInternalFormat != internalformat ||
- forceRelease)
- {
- mWidth = size.width;
- mHeight = size.height;
- mDepth = size.depth;
- mInternalFormat = internalformat;
-
- // compute the d3d format that will be used
- const d3d9::TextureFormat &d3d9FormatInfo = d3d9::GetTextureFormatInfo(internalformat);
- mD3DFormat = d3d9FormatInfo.texFormat;
- mRenderable = (d3d9FormatInfo.renderFormat != D3DFMT_UNKNOWN);
-
- SafeRelease(mSurface);
- mDirty = (d3d9FormatInfo.dataInitializerFunction != nullptr);
-
- return true;
- }
-
- return false;
-}
-
-gl::Error Image9::createSurface()
-{
- if (mSurface)
- {
- return gl::NoError();
- }
-
- 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);
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to create image surface, " << gl::FmtHR(result);
- }
-
- 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));
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock image surface, " << gl::FmtHR(result);
- }
-
- d3dFormatInfo.dataInitializerFunction(mWidth, mHeight, 1, reinterpret_cast<uint8_t*>(lockedRect.pBits),
- lockedRect.Pitch, 0);
-
- result = newSurface->UnlockRect();
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to unlock image surface, " << gl::FmtHR(result);
- }
- }
- }
-
- mSurface = newSurface;
- mDirty = false;
- mD3DPool = poolToUse;
-
- return gl::NoError();
-}
-
-gl::Error Image9::lock(D3DLOCKED_RECT *lockedRect, const RECT &rect)
-{
- gl::Error error = createSurface();
- if (error.isError())
- {
- return error;
- }
-
- if (mSurface)
- {
- HRESULT result = mSurface->LockRect(lockedRect, &rect, 0);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock image surface, " << gl::FmtHR(result);
- }
-
- mDirty = true;
- }
-
- return gl::NoError();
-}
-
-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;
-}
-
-gl::Error Image9::getSurface(IDirect3DSurface9 **outSurface)
-{
- gl::Error error = createSurface();
- if (error.isError())
- {
- return error;
- }
-
- *outSurface = mSurface;
- return gl::NoError();
-}
-
-gl::Error Image9::setManagedSurface2D(const gl::Context *context,
- TextureStorage *storage,
- int level)
-{
- IDirect3DSurface9 *surface = nullptr;
- TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
- gl::Error error = storage9->getSurfaceLevel(context, GL_TEXTURE_2D, level, false, &surface);
- if (error.isError())
- {
- return error;
- }
- return setManagedSurface(surface);
-}
-
-gl::Error Image9::setManagedSurfaceCube(const gl::Context *context,
- TextureStorage *storage,
- int face,
- int level)
-{
- IDirect3DSurface9 *surface = nullptr;
- TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
- gl::Error error = storage9->getSurfaceLevel(context, GL_TEXTURE_CUBE_MAP_POSITIVE_X + face,
- level, false, &surface);
- if (error.isError())
- {
- return error;
- }
- return setManagedSurface(surface);
-}
-
-gl::Error Image9::setManagedSurface(IDirect3DSurface9 *surface)
-{
- D3DSURFACE_DESC desc;
- surface->GetDesc(&desc);
- ASSERT(desc.Pool == D3DPOOL_MANAGED);
-
- if ((GLsizei)desc.Width == mWidth && (GLsizei)desc.Height == mHeight)
- {
- if (mSurface)
- {
- gl::Error error = copyLockableSurfaces(surface, mSurface);
- SafeRelease(mSurface);
- if (error.isError())
- {
- return error;
- }
- }
-
- mSurface = surface;
- mD3DPool = desc.Pool;
- }
-
- return gl::NoError();
-}
-
-gl::Error Image9::copyToStorage(const gl::Context *context,
- TextureStorage *storage,
- const gl::ImageIndex &index,
- const gl::Box &region)
-{
- gl::Error error = createSurface();
- if (error.isError())
- {
- return error;
- }
-
- TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
-
- IDirect3DSurface9 *destSurface = nullptr;
-
- if (index.type == GL_TEXTURE_2D)
- {
- error =
- storage9->getSurfaceLevel(context, GL_TEXTURE_2D, index.mipIndex, true, &destSurface);
- if (error.isError())
- {
- return error;
- }
- }
- else
- {
- ASSERT(gl::IsCubeMapTextureTarget(index.type));
- error = storage9->getSurfaceLevel(context, index.type, index.mipIndex, true, &destSurface);
- if (error.isError())
- {
- return error;
- }
- }
-
- error = copyToSurface(destSurface, region);
- SafeRelease(destSurface);
- return error;
-}
-
-gl::Error Image9::copyToSurface(IDirect3DSurface9 *destSurface, const gl::Box &area)
-{
- ASSERT(area.width > 0 && area.height > 0 && area.depth == 1);
- ASSERT(destSurface);
-
- IDirect3DSurface9 *sourceSurface = nullptr;
- gl::Error error = getSurface(&sourceSurface);
- if (error.isError())
- {
- return error;
- }
-
- 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);
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Internal CreateOffscreenPlainSurface call failed, " << gl::FmtHR(result);
- }
-
- auto err = copyLockableSurfaces(surf, sourceSurface);
- result = device->UpdateSurface(surf, &rect, destSurface, &point);
- SafeRelease(surf);
- ANGLE_TRY(err);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Internal UpdateSurface call failed, " << gl::FmtHR(result);
- }
- }
- else
- {
- // UpdateSurface: source must be SYSTEMMEM, dest must be DEFAULT pools
- HRESULT result = device->UpdateSurface(sourceSurface, &rect, destSurface, &point);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Internal UpdateSurface call failed, " << gl::FmtHR(result);
- }
- }
-
- return gl::NoError();
-}
-
-// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
-// into the target pixel rectangle.
-gl::Error Image9::loadData(const gl::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);
-
- const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
- GLuint inputRowPitch = 0;
- ANGLE_TRY_RESULT(
- 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;
- gl::Error error = lock(&locked, lockRect);
- if (error.isError())
- {
- return error;
- }
-
- d3dFormatInfo.loadFunction(area.width, area.height, area.depth,
- reinterpret_cast<const uint8_t *>(input), inputRowPitch, 0,
- reinterpret_cast<uint8_t *>(locked.pBits), locked.Pitch, 0);
-
- unlock();
-
- return gl::NoError();
-}
-
-gl::Error 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);
-
- const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
- GLsizei inputRowPitch = 0;
- ANGLE_TRY_RESULT(formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0), inputRowPitch);
- GLsizei inputDepthPitch = 0;
- ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(area.height, 0, inputDepthPitch),
- 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;
- gl::Error error = lock(&locked, lockRect);
- if (error.isError())
- {
- return error;
- }
-
- d3d9FormatInfo.loadFunction(area.width, area.height, area.depth,
- reinterpret_cast<const uint8_t*>(input), inputRowPitch, inputDepthPitch,
- reinterpret_cast<uint8_t*>(locked.pBits), locked.Pitch, 0);
-
- unlock();
-
- return gl::NoError();
-}
-
-// This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats and incomplete textures
-gl::Error Image9::copyFromRTInternal(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);
-
- IDirect3DSurface9 *surface = renderTarget->getSurface();
- ASSERT(surface);
-
- IDirect3DDevice9 *device = mRenderer->getDevice();
-
- IDirect3DSurface9 *renderTargetData = nullptr;
- D3DSURFACE_DESC description;
- surface->GetDesc(&description);
-
- HRESULT result = device->CreateOffscreenPlainSurface(description.Width, description.Height,
- description.Format, D3DPOOL_SYSTEMMEM,
- &renderTargetData, nullptr);
-
- if (FAILED(result))
- {
- SafeRelease(surface);
- return gl::OutOfMemory() << "Could not create matching destination surface, "
- << gl::FmtHR(result);
- }
-
- result = device->GetRenderTargetData(surface, renderTargetData);
-
- if (FAILED(result))
- {
- SafeRelease(renderTargetData);
- SafeRelease(surface);
- return gl::OutOfMemory() << "GetRenderTargetData unexpectedly failed, "
- << gl::FmtHR(result);
- }
-
- int width = sourceArea.width;
- int height = sourceArea.height;
-
- RECT sourceRect = { sourceArea.x, sourceArea.y, sourceArea.x + width, sourceArea.y + height };
- RECT destRect = { destOffset.x, destOffset.y, destOffset.x + width, destOffset.y + height };
-
- D3DLOCKED_RECT sourceLock = {0};
- result = renderTargetData->LockRect(&sourceLock, &sourceRect, 0);
-
- if (FAILED(result))
- {
- SafeRelease(renderTargetData);
- SafeRelease(surface);
- return gl::OutOfMemory()
- << "Failed to lock the source surface (rectangle might be invalid), "
- << gl::FmtHR(result);
- }
-
- D3DLOCKED_RECT destLock = {0};
- gl::Error error = lock(&destLock, destRect);
- if (error.isError())
- {
- renderTargetData->UnlockRect();
- SafeRelease(renderTargetData);
- SafeRelease(surface);
- return error;
- }
-
- 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();
-
- SafeRelease(renderTargetData);
- SafeRelease(surface);
-
- mDirty = true;
- return gl::NoError();
-}
-
-gl::Error Image9::copyFromTexStorage(const gl::Context *context,
- const gl::ImageIndex &imageIndex,
- TextureStorage *source)
-{
- RenderTargetD3D *renderTarget = nullptr;
- gl::Error error = source->getRenderTarget(context, imageIndex, &renderTarget);
- if (error.isError())
- {
- return error;
- }
-
- gl::Rectangle sourceArea(0, 0, mWidth, mHeight);
- return copyFromRTInternal(gl::Offset(), sourceArea, renderTarget);
-}
-
-gl::Error Image9::copyFromFramebuffer(const gl::Context *context,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source)
-{
- const gl::FramebufferAttachment *srcAttachment = source->getReadColorbuffer();
- ASSERT(srcAttachment);
-
- RenderTargetD3D *renderTarget = nullptr;
- gl::Error error = srcAttachment->getRenderTarget(context, &renderTarget);
- if (error.isError())
- {
- return error;
- }
-
- ASSERT(renderTarget);
- return copyFromRTInternal(destOffset, sourceArea, renderTarget);
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Image9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Image9.h
deleted file mode 100644
index 01c60dc4fb..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Image9.h
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// 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 "libANGLE/renderer/d3d/ImageD3D.h"
-#include "common/debug.h"
-
-namespace gl
-{
-class Framebuffer;
-}
-
-namespace rx
-{
-class Renderer9;
-
-class Image9 : public ImageD3D
-{
- public:
- Image9(Renderer9 *renderer);
- ~Image9() override;
-
- static gl::Error generateMipmap(Image9 *dest, Image9 *source);
- static gl::Error generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface);
- static gl::Error copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *source);
- static gl::Error 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(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease) override;
-
- D3DFORMAT getD3DFormat() const;
-
- bool isDirty() const override;
-
- gl::Error setManagedSurface2D(const gl::Context *context,
- TextureStorage *storage,
- int level) override;
- gl::Error setManagedSurfaceCube(const gl::Context *context,
- TextureStorage *storage,
- int face,
- int level) override;
- gl::Error copyToStorage(const gl::Context *context,
- TextureStorage *storage,
- const gl::ImageIndex &index,
- const gl::Box &region) override;
-
- gl::Error loadData(const gl::Context *context,
- const gl::Box &area,
- const gl::PixelUnpackState &unpack,
- GLenum type,
- const void *input,
- bool applySkipImages) override;
- gl::Error loadCompressedData(const gl::Context *context,
- const gl::Box &area,
- const void *input) override;
-
- gl::Error copyFromTexStorage(const gl::Context *context,
- const gl::ImageIndex &imageIndex,
- TextureStorage *source) override;
- gl::Error copyFromFramebuffer(const gl::Context *context,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source) override;
-
- private:
- gl::Error getSurface(IDirect3DSurface9 **outSurface);
-
- gl::Error createSurface();
- gl::Error setManagedSurface(IDirect3DSurface9 *surface);
- gl::Error copyToSurface(IDirect3DSurface9 *dest, const gl::Box &area);
-
- gl::Error lock(D3DLOCKED_RECT *lockedRect, const RECT &rect);
- void unlock();
-
- gl::Error copyFromRTInternal(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;
-};
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_IMAGE9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp
deleted file mode 100644
index df86331766..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-//
-// 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/renderer/d3d/d3d9/Renderer9.h"
-
-namespace rx
-{
-
-IndexBuffer9::IndexBuffer9(Renderer9 *const renderer) : mRenderer(renderer)
-{
- mIndexBuffer = nullptr;
- mBufferSize = 0;
- mIndexType = 0;
- mDynamic = false;
-}
-
-IndexBuffer9::~IndexBuffer9()
-{
- SafeRelease(mIndexBuffer);
-}
-
-gl::Error IndexBuffer9::initialize(unsigned int bufferSize, GLenum indexType, bool dynamic)
-{
- SafeRelease(mIndexBuffer);
-
- updateSerial();
-
- if (bufferSize > 0)
- {
- D3DFORMAT format = D3DFMT_UNKNOWN;
- if (indexType == GL_UNSIGNED_SHORT || indexType == GL_UNSIGNED_BYTE)
- {
- format = D3DFMT_INDEX16;
- }
- else if (indexType == GL_UNSIGNED_INT)
- {
- ASSERT(mRenderer->getNativeExtensions().elementIndexUint);
- format = D3DFMT_INDEX32;
- }
- else UNREACHABLE();
-
- DWORD usageFlags = D3DUSAGE_WRITEONLY;
- if (dynamic)
- {
- usageFlags |= D3DUSAGE_DYNAMIC;
- }
-
- HRESULT result = mRenderer->createIndexBuffer(bufferSize, usageFlags, format, &mIndexBuffer);
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to allocate internal index buffer of size " << bufferSize;
- }
- }
-
- mBufferSize = bufferSize;
- mIndexType = indexType;
- mDynamic = dynamic;
-
- return gl::NoError();
-}
-
-gl::Error IndexBuffer9::mapBuffer(unsigned int offset, unsigned int size, void** outMappedMemory)
-{
- if (!mIndexBuffer)
- {
- return gl::OutOfMemory() << "Internal index buffer is not initialized.";
- }
-
- DWORD lockFlags = mDynamic ? D3DLOCK_NOOVERWRITE : 0;
-
- void *mapPtr = nullptr;
- HRESULT result = mIndexBuffer->Lock(offset, size, &mapPtr, lockFlags);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock internal index buffer, " << gl::FmtHR(result);
- }
-
- *outMappedMemory = mapPtr;
- return gl::NoError();
-}
-
-gl::Error IndexBuffer9::unmapBuffer()
-{
- if (!mIndexBuffer)
- {
- return gl::OutOfMemory() << "Internal index buffer is not initialized.";
- }
-
- HRESULT result = mIndexBuffer->Unlock();
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to unlock internal index buffer, " << gl::FmtHR(result);
- }
-
- return gl::NoError();
-}
-
-GLenum IndexBuffer9::getIndexType() const
-{
- return mIndexType;
-}
-
-unsigned int IndexBuffer9::getBufferSize() const
-{
- return mBufferSize;
-}
-
-gl::Error IndexBuffer9::setSize(unsigned int bufferSize, GLenum indexType)
-{
- if (bufferSize > mBufferSize || indexType != mIndexType)
- {
- return initialize(bufferSize, indexType, mDynamic);
- }
- else
- {
- return gl::NoError();
- }
-}
-
-gl::Error IndexBuffer9::discard()
-{
- if (!mIndexBuffer)
- {
- return gl::OutOfMemory() << "Internal index buffer is not initialized.";
- }
-
- void *dummy;
- HRESULT result;
-
- result = mIndexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock internal index buffer, " << gl::FmtHR(result);
- }
-
- result = mIndexBuffer->Unlock();
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to unlock internal index buffer, " << gl::FmtHR(result);
- }
-
- return gl::NoError();
-}
-
-D3DFORMAT IndexBuffer9::getIndexFormat() const
-{
- switch (mIndexType)
- {
- case GL_UNSIGNED_BYTE: return D3DFMT_INDEX16;
- case GL_UNSIGNED_SHORT: return D3DFMT_INDEX16;
- case GL_UNSIGNED_INT: return D3DFMT_INDEX32;
- default: UNREACHABLE(); return D3DFMT_UNKNOWN;
- }
-}
-
-IDirect3DIndexBuffer9 * IndexBuffer9::getBuffer() const
-{
- return mIndexBuffer;
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h
deleted file mode 100644
index 5921d2a859..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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;
-
- gl::Error initialize(unsigned int bufferSize, GLenum indexType, bool dynamic) override;
-
- gl::Error mapBuffer(unsigned int offset, unsigned int size, void **outMappedMemory) override;
- gl::Error unmapBuffer() override;
-
- GLenum getIndexType() const override;
- unsigned int getBufferSize() const override;
- gl::Error setSize(unsigned int bufferSize, GLenum indexType) override;
-
- gl::Error discard() override;
-
- D3DFORMAT getIndexFormat() const;
- IDirect3DIndexBuffer9 *getBuffer() const;
-
- private:
- Renderer9 *const mRenderer;
-
- IDirect3DIndexBuffer9 *mIndexBuffer;
- unsigned int mBufferSize;
- GLenum mIndexType;
- bool mDynamic;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_INDEXBUFFER9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.cpp
deleted file mode 100644
index 388b8aa168..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.h
deleted file mode 100644
index a56b08dc81..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Query9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Query9.cpp
deleted file mode 100644
index 4ba053e6bd..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Query9.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-//
-// 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/renderer/d3d/d3d9/renderer9_utils.h"
-#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
-
-#include <GLES2/gl2ext.h>
-
-namespace rx
-{
-Query9::Query9(Renderer9 *renderer, GLenum type)
- : QueryImpl(type),
- mResult(GL_FALSE),
- mQueryFinished(false),
- mRenderer(renderer),
- mQuery(nullptr)
-{
-}
-
-Query9::~Query9()
-{
- SafeRelease(mQuery);
-}
-
-gl::Error Query9::begin()
-{
- D3DQUERYTYPE d3dQueryType = gl_d3d9::ConvertQueryType(getType());
- if (mQuery == nullptr)
- {
- HRESULT result = mRenderer->getDevice()->CreateQuery(d3dQueryType, &mQuery);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Internal query creation failed, " << gl::FmtHR(result);
- }
- }
-
- if (d3dQueryType != D3DQUERYTYPE_EVENT)
- {
- HRESULT result = mQuery->Issue(D3DISSUE_BEGIN);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to begin internal query, " << gl::FmtHR(result);
- }
- }
-
- return gl::NoError();
-}
-
-gl::Error Query9::end()
-{
- ASSERT(mQuery);
-
- HRESULT result = mQuery->Issue(D3DISSUE_END);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to end internal query, " << gl::FmtHR(result);
- }
-
- mQueryFinished = false;
- mResult = GL_FALSE;
-
- return gl::NoError();
-}
-
-gl::Error Query9::queryCounter()
-{
- UNIMPLEMENTED();
- return gl::InternalError() << "Unimplemented";
-}
-
-template <typename T>
-gl::Error Query9::getResultBase(T *params)
-{
- while (!mQueryFinished)
- {
- gl::Error error = testQuery();
- if (error.isError())
- {
- return error;
- }
-
- if (!mQueryFinished)
- {
- Sleep(0);
- }
- }
-
- ASSERT(mQueryFinished);
- *params = static_cast<T>(mResult);
- return gl::NoError();
-}
-
-gl::Error Query9::getResult(GLint *params)
-{
- return getResultBase(params);
-}
-
-gl::Error Query9::getResult(GLuint *params)
-{
- return getResultBase(params);
-}
-
-gl::Error Query9::getResult(GLint64 *params)
-{
- return getResultBase(params);
-}
-
-gl::Error Query9::getResult(GLuint64 *params)
-{
- return getResultBase(params);
-}
-
-gl::Error Query9::isResultAvailable(bool *available)
-{
- gl::Error error = testQuery();
- if (error.isError())
- {
- return error;
- }
-
- *available = mQueryFinished;
-
- return gl::NoError();
-}
-
-gl::Error Query9::testQuery()
-{
- if (!mQueryFinished)
- {
- ASSERT(mQuery);
-
- HRESULT result = S_OK;
- switch (getType())
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- {
- 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_COMMANDS_COMPLETED_CHROMIUM:
- {
- 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 (d3d9::isDeviceLostError(result))
- {
- mRenderer->notifyDeviceLost();
- return gl::OutOfMemory() << "Failed to test get query result, device is lost.";
- }
- else if (mRenderer->testDeviceLost())
- {
- mRenderer->notifyDeviceLost();
- return gl::OutOfMemory() << "Failed to test get query result, device is lost.";
- }
- }
-
- return gl::NoError();
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Query9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Query9.h
deleted file mode 100644
index 6c7c22f096..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Query9.h
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// 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 Renderer9;
-
-class Query9 : public QueryImpl
-{
- public:
- Query9(Renderer9 *renderer, GLenum type);
- ~Query9() override;
-
- gl::Error begin() override;
- gl::Error end() override;
- gl::Error queryCounter() override;
- gl::Error getResult(GLint *params) override;
- gl::Error getResult(GLuint *params) override;
- gl::Error getResult(GLint64 *params) override;
- gl::Error getResult(GLuint64 *params) override;
- gl::Error isResultAvailable(bool *available) override;
-
- private:
- gl::Error testQuery();
-
- template <typename T>
- gl::Error getResultBase(T *params);
-
- GLuint64 mResult;
- bool mQueryFinished;
-
- Renderer9 *mRenderer;
- IDirect3DQuery9 *mQuery;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_QUERY9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp
deleted file mode 100644
index 3e54c27f43..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-//
-// 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/renderer9_utils.h"
-#include "libANGLE/renderer/d3d/d3d9/SwapChain9.h"
-#include "libANGLE/renderer/d3d/d3d9/formatutils9.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;
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h
deleted file mode 100644
index bb3b5a4ee4..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h
+++ /dev/null
@@ -1,98 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_RENDERTARGET9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
deleted file mode 100644
index 75c6298868..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
+++ /dev/null
@@ -1,3310 +0,0 @@
-//
-// 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 "third_party/trace_event/trace_event.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
-{
-
-enum
-{
- MAX_VERTEX_CONSTANT_VECTORS_D3D9 = 256,
- MAX_PIXEL_CONSTANT_VECTORS_SM2 = 32,
- MAX_PIXEL_CONSTANT_VECTORS_SM3 = 224,
- MAX_VARYING_VECTORS_SM2 = 8,
- MAX_VARYING_VECTORS_SM3 = 10,
-
- MAX_TEXTURE_IMAGE_UNITS_VTF_SM3 = 4
-};
-
-Renderer9::Renderer9(egl::Display *display) : RendererD3D(display), 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_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++)
- {
- mNullColorbufferCache[i].lruCount = 0;
- mNullColorbufferCache[i].width = 0;
- mNullColorbufferCache[i].height = 0;
- mNullColorbufferCache[i].buffer = nullptr;
- }
-
- mAppliedVertexShader = nullptr;
- mAppliedPixelShader = nullptr;
- mAppliedProgramSerial = 0;
-
- gl::InitializeDebugAnnotations(&mAnnotator);
-
- mEGLDevice = nullptr;
-}
-
-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()
-{
- RendererD3D::cleanup();
-
- gl::UninitializeDebugAnnotations();
-
- mTranslatedAttribCache.clear();
-
- releaseDeviceResources();
-
- SafeDelete(mEGLDevice);
- SafeRelease(mDevice);
- SafeRelease(mDeviceEx);
- SafeRelease(mD3d9);
- SafeRelease(mD3d9Ex);
-
- mCompiler.release();
-
- if (mDeviceWindow)
- {
- DestroyWindow(mDeviceWindow);
- mDeviceWindow = nullptr;
- }
-
- mD3d9Module = nullptr;
-}
-
-egl::Error Renderer9::initialize()
-{
- TRACE_EVENT0("gpu.angle", "GetModuleHandle_d3d9");
- mD3d9Module = GetModuleHandle(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)))
- {
- TRACE_EVENT0("gpu.angle", "D3d9Ex_QueryInterface");
- ASSERT(mD3d9Ex);
- mD3d9Ex->QueryInterface(__uuidof(IDirect3D9), reinterpret_cast<void **>(&mD3d9));
- ASSERT(mD3d9);
- }
- else
- {
- 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.
- {
- 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.";
- }
-
- {
- TRACE_EVENT0("gpu.angle", "GetAdapterIdentifier");
- mD3d9->GetAdapterIdentifier(mAdapter, 0, &mAdapterIdentifier);
- }
-
- static const TCHAR windowName[] = TEXT("AngleHiddenWindow");
- static const TCHAR className[] = TEXT("STATIC");
-
- {
- 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;
-
- {
- 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))
- {
- 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)
- {
- TRACE_EVENT0("gpu.angle", "mDevice_QueryInterface");
- result = mDevice->QueryInterface(__uuidof(IDirect3DDevice9Ex), (void **)&mDeviceEx);
- ASSERT(SUCCEEDED(result));
- }
-
- {
- 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.maxVertexTextureImageUnits);
- mCurPixelSamplerStates.resize(rendererCaps.maxTextureImageUnits);
-
- mCurVertexTextures.resize(rendererCaps.maxVertexTextureImageUnits);
- mCurPixelTextures.resize(rendererCaps.maxTextureImageUnits);
-
- markAllStateDirty();
-
- mSceneStarted = false;
-
- ASSERT(!mBlit);
- mBlit = new Blit9(this);
- ANGLE_TRY(mBlit->initialize());
-
- ASSERT(!mVertexDataManager && !mIndexDataManager);
- mVertexDataManager = new VertexDataManager(this);
- mIndexDataManager = new IndexDataManager(this);
-
- if (mVertexDataManager->initialize().isError())
- {
- return egl::EglBadAlloc() << "Error initializing VertexDataManager";
- }
-
- 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.renderable)
- {
- for (size_t depthStencilIndex = 0;
- depthStencilIndex < ArraySize(depthStencilBufferFormats); depthStencilIndex++)
- {
- GLenum depthStencilBufferInternalFormat =
- depthStencilBufferFormats[depthStencilIndex];
- const gl::TextureCaps &depthStencilBufferFormatCaps =
- rendererTextureCaps.get(depthStencilBufferInternalFormat);
- if (depthStencilBufferFormatCaps.renderable ||
- 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;
- }
-}
-
-gl::Error Renderer9::flush()
-{
- IDirect3DQuery9 *query = nullptr;
- gl::Error error = allocateEventQuery(&query);
- if (error.isError())
- {
- return error;
- }
-
- HRESULT result = query->Issue(D3DISSUE_END);
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to issue event query, " << gl::FmtHR(result);
- }
-
- // Grab the query data once
- result = query->GetData(nullptr, 0, D3DGETDATA_FLUSH);
- freeEventQuery(query);
- if (FAILED(result))
- {
- if (d3d9::isDeviceLostError(result))
- {
- notifyDeviceLost();
- }
-
- return gl::OutOfMemory() << "Failed to get event query data, " << gl::FmtHR(result);
- }
-
- return gl::NoError();
-}
-
-gl::Error Renderer9::finish()
-{
- IDirect3DQuery9 *query = nullptr;
- gl::Error error = allocateEventQuery(&query);
- if (error.isError())
- {
- return error;
- }
-
- HRESULT result = query->Issue(D3DISSUE_END);
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to issue event query, " << gl::FmtHR(result);
- }
-
- // Grab the query data once
- result = query->GetData(nullptr, 0, D3DGETDATA_FLUSH);
- if (FAILED(result))
- {
- if (d3d9::isDeviceLostError(result))
- {
- notifyDeviceLost();
- }
-
- freeEventQuery(query);
- return gl::OutOfMemory() << "Failed to get event query data, " << gl::FmtHR(result);
- }
-
- // Loop until the query completes
- while (result == S_FALSE)
- {
- // Keep polling, but allow other threads to do something useful first
- ScheduleYield();
-
- result = query->GetData(nullptr, 0, D3DGETDATA_FLUSH);
-
- // explicitly check for device loss
- // some drivers seem to return S_FALSE even if the device is lost
- // instead of D3DERR_DEVICELOST like they should
- if (result == S_FALSE && testDeviceLost())
- {
- result = D3DERR_DEVICELOST;
- }
-
- if (FAILED(result))
- {
- if (d3d9::isDeviceLostError(result))
- {
- notifyDeviceLost();
- }
-
- freeEventQuery(query);
- return gl::OutOfMemory() << "Failed to get event query data, " << gl::FmtHR(result);
- }
- }
-
- freeEventQuery(query);
-
- return gl::NoError();
-}
-
-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 *config,
- IUnknown *d3dTexture,
- EGLint *width,
- EGLint *height,
- GLenum *fboFormat) 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);
- }
-
- // 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 (fboFormat)
- {
- const auto &d3dFormatInfo = d3d9::GetD3DFormatInfo(desc.Format);
- ASSERT(d3dFormatInfo.info().id != angle::Format::ID::NONE);
- *fboFormat = d3dFormatInfo.info().fboImplementationInternalFormat;
- }
-
- 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::ContextState &state)
-{
- return new Context9(state, this);
-}
-
-void *Renderer9::getD3DDevice()
-{
- return reinterpret_cast<void *>(mDevice);
-}
-
-gl::Error Renderer9::allocateEventQuery(IDirect3DQuery9 **outQuery)
-{
- if (mEventQueryPool.empty())
- {
- HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, outQuery);
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to allocate event query, " << gl::FmtHR(result);
- }
- }
- else
- {
- *outQuery = mEventQueryPool.back();
- mEventQueryPool.pop_back();
- }
-
- return gl::NoError();
-}
-
-void Renderer9::freeEventQuery(IDirect3DQuery9 *query)
-{
- if (mEventQueryPool.size() > 1000)
- {
- SafeRelease(query);
- }
- else
- {
- mEventQueryPool.push_back(query);
- }
-}
-
-gl::Error Renderer9::createVertexShader(const DWORD *function,
- size_t length,
- IDirect3DVertexShader9 **outShader)
-{
- return mVertexShaderCache.create(function, length, outShader);
-}
-
-gl::Error Renderer9::createPixelShader(const DWORD *function,
- size_t length,
- IDirect3DPixelShader9 **outShader)
-{
- return mPixelShaderCache.create(function, length, outShader);
-}
-
-HRESULT Renderer9::createVertexBuffer(UINT Length,
- DWORD Usage,
- IDirect3DVertexBuffer9 **ppVertexBuffer)
-{
- D3DPOOL Pool = getBufferPool(Usage);
- return mDevice->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)
-{
- D3DPOOL Pool = getBufferPool(Usage);
- return mDevice->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer, nullptr);
-}
-
-IndexBuffer *Renderer9::createIndexBuffer()
-{
- return new IndexBuffer9(this);
-}
-
-StreamProducerImpl *Renderer9::createStreamProducerD3DTextureNV12(
- 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;
-}
-
-gl::Error 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.
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error Renderer9::setSamplerState(const gl::Context *context,
- gl::SamplerType type,
- int index,
- gl::Texture *texture,
- const gl::SamplerState &samplerState)
-{
- CurSamplerState &appliedSampler = (type == gl::SAMPLER_PIXEL) ? 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::SAMPLER_PIXEL) ? 0 : D3DVERTEXTEXTURESAMPLER0;
- int d3dSampler = index + d3dSamplerOffset;
-
- mDevice->SetSamplerState(d3dSampler, D3DSAMP_ADDRESSU,
- gl_d3d9::ConvertTextureWrap(samplerState.wrapS));
- mDevice->SetSamplerState(d3dSampler, D3DSAMP_ADDRESSV,
- gl_d3d9::ConvertTextureWrap(samplerState.wrapT));
-
- mDevice->SetSamplerState(
- d3dSampler, D3DSAMP_MAGFILTER,
- gl_d3d9::ConvertMagFilter(samplerState.magFilter, samplerState.maxAnisotropy));
-
- D3DTEXTUREFILTERTYPE d3dMinFilter, d3dMipFilter;
- float lodBias;
- gl_d3d9::ConvertMinFilter(samplerState.minFilter, &d3dMinFilter, &d3dMipFilter, &lodBias,
- samplerState.maxAnisotropy, 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.maxAnisotropy));
- mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXANISOTROPY, maxAnisotropy);
- }
- }
-
- appliedSampler.forceSet = false;
- appliedSampler.samplerState = samplerState;
- appliedSampler.baseLevel = baseLevel;
-
- return gl::NoError();
-}
-
-gl::Error Renderer9::setTexture(const gl::Context *context,
- gl::SamplerType type,
- int index,
- gl::Texture *texture)
-{
- int d3dSamplerOffset = (type == gl::SAMPLER_PIXEL) ? 0 : D3DVERTEXTEXTURESAMPLER0;
- int d3dSampler = index + d3dSamplerOffset;
- IDirect3DBaseTexture9 *d3dTexture = nullptr;
- bool forceSetTexture = false;
-
- std::vector<uintptr_t> &appliedTextures =
- (type == gl::SAMPLER_PIXEL) ? 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 gl::NoError();
-}
-
-gl::Error Renderer9::updateState(const gl::Context *context, GLenum drawMode)
-{
- const auto &glState = context->getGLState();
-
- // 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() && framebuffer->cachedComplete());
-
- ANGLE_TRY(applyRenderTarget(context, framebuffer));
-
- // 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->getFirstColorbuffer();
- 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_POINTS);
- rasterizer.multiSample = (samples != 0);
-
- unsigned int mask = GetBlendSampleMask(glState, samples);
- ANGLE_TRY(setBlendDepthRasterStates(context, mask));
-
- mStateManager.resetDirtyBits();
-
- return gl::NoError();
-}
-
-void Renderer9::setScissorRectangle(const gl::Rectangle &scissor, bool enabled)
-{
- mStateManager.setScissorState(scissor, enabled);
-}
-
-gl::Error Renderer9::setBlendDepthRasterStates(const gl::Context *context, GLenum drawMode)
-{
- const auto &glState = context->getGLState();
- 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->getFirstColorbuffer();
- 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_POINTS);
- rasterizer.multiSample = (samples != 0);
-
- unsigned int mask = GetBlendSampleMask(glState, samples);
- return mStateManager.setBlendDepthRasterStates(glState, mask);
-}
-
-void Renderer9::setViewport(const gl::Rectangle &viewport,
- float zNear,
- float zFar,
- GLenum drawMode,
- GLenum frontFace,
- bool ignoreViewport)
-{
- mStateManager.setViewportState(viewport, zNear, zFar, drawMode, frontFace, ignoreViewport);
-}
-
-bool Renderer9::applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSize)
-{
- switch (mode)
- {
- case GL_POINTS:
- mPrimitiveType = D3DPT_POINTLIST;
- mPrimitiveCount = count;
- break;
- case GL_LINES:
- mPrimitiveType = D3DPT_LINELIST;
- mPrimitiveCount = count / 2;
- break;
- case GL_LINE_LOOP:
- mPrimitiveType = D3DPT_LINESTRIP;
- mPrimitiveCount =
- count - 1; // D3D doesn't support line loops, so we draw the last line separately
- break;
- case GL_LINE_STRIP:
- mPrimitiveType = D3DPT_LINESTRIP;
- mPrimitiveCount = count - 1;
- break;
- case GL_TRIANGLES:
- mPrimitiveType = D3DPT_TRIANGLELIST;
- mPrimitiveCount = count / 3;
- break;
- case GL_TRIANGLE_STRIP:
- mPrimitiveType = D3DPT_TRIANGLESTRIP;
- mPrimitiveCount = count - 2;
- break;
- case GL_TRIANGLE_FAN:
- mPrimitiveType = D3DPT_TRIANGLEFAN;
- mPrimitiveCount = count - 2;
- break;
- default:
- UNREACHABLE();
- return false;
- }
-
- return mPrimitiveCount > 0;
-}
-
-gl::Error Renderer9::getNullColorbuffer(const gl::Context *context,
- const gl::FramebufferAttachment *depthbuffer,
- const gl::FramebufferAttachment **outColorBuffer)
-{
- ASSERT(depthbuffer);
-
- const gl::Extents &size = depthbuffer->getSize();
-
- // search cached nullcolorbuffers
- for (int i = 0; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++)
- {
- if (mNullColorbufferCache[i].buffer != nullptr &&
- mNullColorbufferCache[i].width == size.width &&
- mNullColorbufferCache[i].height == size.height)
- {
- mNullColorbufferCache[i].lruCount = ++mMaxNullColorbufferLRU;
- *outColorBuffer = mNullColorbufferCache[i].buffer;
- return gl::NoError();
- }
- }
-
- auto *implFactory = context->getImplementation();
-
- gl::Renderbuffer *nullRenderbuffer = new gl::Renderbuffer(implFactory->createRenderbuffer(), 0);
- gl::Error error = nullRenderbuffer->setStorage(context, GL_NONE, size.width, size.height);
- if (error.isError())
- {
- SafeDelete(nullRenderbuffer);
- return error;
- }
-
- gl::FramebufferAttachment *nullbuffer = new gl::FramebufferAttachment(
- context, GL_RENDERBUFFER, GL_NONE, gl::ImageIndex::MakeInvalid(), nullRenderbuffer);
-
- // add nullbuffer to the cache
- NullColorbufferCacheEntry *oldest = &mNullColorbufferCache[0];
- for (int i = 1; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++)
- {
- if (mNullColorbufferCache[i].lruCount < oldest->lruCount)
- {
- oldest = &mNullColorbufferCache[i];
- }
- }
-
- delete oldest->buffer;
- oldest->buffer = nullbuffer;
- oldest->lruCount = ++mMaxNullColorbufferLRU;
- oldest->width = size.width;
- oldest->height = size.height;
-
- *outColorBuffer = nullbuffer;
- return gl::NoError();
-}
-
-gl::Error Renderer9::applyRenderTarget(const gl::Context *context,
- const gl::FramebufferAttachment *colorAttachment,
- const gl::FramebufferAttachment *depthStencilAttachment)
-{
- const gl::FramebufferAttachment *renderAttachment = colorAttachment;
-
- // if there is no color attachment we must synthesize a NULL colorattachment
- // to keep the D3D runtime happy. This should only be possible if depth texturing.
- if (renderAttachment == nullptr)
- {
- ANGLE_TRY(getNullColorbuffer(context, depthStencilAttachment, &renderAttachment));
- }
- ASSERT(renderAttachment != nullptr);
-
- size_t renderTargetWidth = 0;
- size_t renderTargetHeight = 0;
- D3DFORMAT renderTargetFormat = D3DFMT_UNKNOWN;
-
- RenderTarget9 *renderTarget = nullptr;
- ANGLE_TRY(renderAttachment->getRenderTarget(context, &renderTarget));
- ASSERT(renderTarget);
-
- bool renderTargetChanged = false;
- unsigned int renderTargetSerial = renderTarget->getSerial();
- if (renderTargetSerial != mAppliedRenderTargetSerial)
- {
- // Apply the render target on the device
- IDirect3DSurface9 *renderTargetSurface = renderTarget->getSurface();
- ASSERT(renderTargetSurface);
-
- mDevice->SetRenderTarget(0, renderTargetSurface);
- SafeRelease(renderTargetSurface);
-
- renderTargetWidth = renderTarget->getWidth();
- renderTargetHeight = renderTarget->getHeight();
- renderTargetFormat = renderTarget->getD3DFormat();
-
- mAppliedRenderTargetSerial = renderTargetSerial;
- renderTargetChanged = true;
- }
-
- RenderTarget9 *depthStencilRenderTarget = nullptr;
- unsigned int depthStencilSerial = 0;
-
- if (depthStencilAttachment != nullptr)
- {
- ANGLE_TRY(depthStencilAttachment->getRenderTarget(context, &depthStencilRenderTarget));
- ASSERT(depthStencilRenderTarget);
-
- 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);
-
- depthSize = depthStencilAttachment->getDepthSize();
- stencilSize = depthStencilAttachment->getStencilSize();
- }
- 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 gl::NoError();
-}
-
-gl::Error Renderer9::applyRenderTarget(const gl::Context *context,
- const gl::Framebuffer *framebuffer)
-{
- return applyRenderTarget(context, framebuffer->getColorbuffer(0),
- framebuffer->getDepthOrStencilbuffer());
-}
-
-gl::Error Renderer9::applyVertexBuffer(const gl::Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei instances,
- TranslatedIndexData * /*indexInfo*/)
-{
- const gl::State &state = context->getGLState();
- gl::Error error = mVertexDataManager->prepareVertexData(context, first, count,
- &mTranslatedAttribCache, instances);
- if (error.isError())
- {
- return error;
- }
-
- return mVertexDeclarationCache.applyDeclaration(
- mDevice, mTranslatedAttribCache, state.getProgram(), first, instances, &mRepeatDraw);
-}
-
-// Applies the indices and element array bindings to the Direct3D 9 device
-gl::Error Renderer9::applyIndexBuffer(const gl::Context *context,
- const void *indices,
- GLsizei count,
- GLenum mode,
- GLenum type,
- TranslatedIndexData *indexInfo)
-{
- gl::VertexArray *vao = context->getGLState().getVertexArray();
- gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get();
- const auto &lazyIndexRange = context->getParams<gl::HasIndexRange>();
-
- GLenum dstType = GetIndexTranslationDestType(type, lazyIndexRange, false);
-
- 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 gl::NoError();
-}
-
-gl::Error Renderer9::drawArraysImpl(const gl::Context *context,
- GLenum mode,
- GLint startVertex,
- GLsizei count,
- GLsizei instances)
-{
- ASSERT(!context->getGLState().isTransformFeedbackActiveUnpaused());
-
- startScene();
-
- if (mode == GL_LINE_LOOP)
- {
- return drawLineLoop(context, count, GL_NONE, nullptr, 0, nullptr);
- }
- else if (instances > 0)
- {
- StaticIndexBufferInterface *countingIB = nullptr;
- gl::Error error = getCountingIB(count, &countingIB);
- if (error.isError())
- {
- return error;
- }
-
- 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 gl::NoError();
- }
- else // Regular case
- {
- mDevice->DrawPrimitive(mPrimitiveType, 0, mPrimitiveCount);
- return gl::NoError();
- }
-}
-
-gl::Error Renderer9::drawElementsImpl(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances)
-{
- TranslatedIndexData indexInfo;
-
- ANGLE_TRY(applyIndexBuffer(context, indices, count, mode, type, &indexInfo));
-
- const auto &lazyIndexRange = context->getParams<gl::HasIndexRange>();
- const gl::IndexRange &indexRange = lazyIndexRange.getIndexRange().value();
- 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->getGLState().getVertexArray();
- gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get();
-
- if (mode == GL_POINTS)
- {
- return drawIndexedPoints(context, count, type, indices, minIndex, elementArrayBuffer);
- }
- else if (mode == GL_LINE_LOOP)
- {
- return drawLineLoop(context, count, type, indices, minIndex, elementArrayBuffer);
- }
- else
- {
- for (int i = 0; i < mRepeatDraw; i++)
- {
- mDevice->DrawIndexedPrimitive(mPrimitiveType, -minIndex, minIndex,
- static_cast<UINT>(vertexCount), indexInfo.startIndex,
- mPrimitiveCount);
- }
- return gl::NoError();
- }
-}
-
-gl::Error Renderer9::drawLineLoop(const gl::Context *context,
- GLsizei count,
- GLenum type,
- const void *indices,
- int minIndex,
- gl::Buffer *elementArrayBuffer)
-{
- // Get the raw indices for an indexed draw
- if (type != GL_NONE && elementArrayBuffer)
- {
- BufferD3D *storage = GetImplAs<BufferD3D>(elementArrayBuffer);
- intptr_t offset = reinterpret_cast<intptr_t>(indices);
- const uint8_t *bufferData = nullptr;
- gl::Error error = storage->getData(context, &bufferData);
- if (error.isError())
- {
- return error;
- }
- indices = bufferData + offset;
- }
-
- unsigned int startIndex = 0;
-
- if (getNativeExtensions().elementIndexUint)
- {
- if (!mLineLoopIB)
- {
- mLineLoopIB = new StreamingIndexBufferInterface(this);
- gl::Error error =
- mLineLoopIB->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
- if (error.isError())
- {
- SafeDelete(mLineLoopIB);
- return error;
- }
- }
-
- // Checked by Renderer9::applyPrimitiveType
- ASSERT(count >= 0);
-
- if (static_cast<unsigned int>(count) + 1 >
- (std::numeric_limits<unsigned int>::max() / sizeof(unsigned int)))
- {
- return gl::OutOfMemory() << "Failed to create a 32-bit looping index buffer for "
- "GL_LINE_LOOP, too many indices required.";
- }
-
- const unsigned int spaceNeeded =
- (static_cast<unsigned int>(count) + 1) * sizeof(unsigned int);
- gl::Error error = mLineLoopIB->reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT);
- if (error.isError())
- {
- return error;
- }
-
- void *mappedMemory = nullptr;
- unsigned int offset = 0;
- error = mLineLoopIB->mapBuffer(spaceNeeded, &mappedMemory, &offset);
- if (error.isError())
- {
- return error;
- }
-
- startIndex = static_cast<unsigned int>(offset) / 4;
- unsigned int *data = reinterpret_cast<unsigned int *>(mappedMemory);
-
- switch (type)
- {
- case GL_NONE: // Non-indexed draw
- for (int i = 0; i < count; i++)
- {
- data[i] = i;
- }
- data[count] = 0;
- break;
- case GL_UNSIGNED_BYTE:
- for (int i = 0; i < count; i++)
- {
- data[i] = static_cast<const GLubyte *>(indices)[i];
- }
- data[count] = static_cast<const GLubyte *>(indices)[0];
- break;
- case GL_UNSIGNED_SHORT:
- for (int i = 0; i < count; i++)
- {
- data[i] = static_cast<const GLushort *>(indices)[i];
- }
- data[count] = static_cast<const GLushort *>(indices)[0];
- break;
- case GL_UNSIGNED_INT:
- for (int i = 0; i < count; i++)
- {
- data[i] = static_cast<const GLuint *>(indices)[i];
- }
- data[count] = static_cast<const GLuint *>(indices)[0];
- break;
- default:
- UNREACHABLE();
- }
-
- error = mLineLoopIB->unmapBuffer();
- if (error.isError())
- {
- return error;
- }
- }
- else
- {
- if (!mLineLoopIB)
- {
- mLineLoopIB = new StreamingIndexBufferInterface(this);
- gl::Error error =
- mLineLoopIB->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_SHORT);
- if (error.isError())
- {
- SafeDelete(mLineLoopIB);
- return error;
- }
- }
-
- // Checked by Renderer9::applyPrimitiveType
- ASSERT(count >= 0);
-
- if (static_cast<unsigned int>(count) + 1 >
- (std::numeric_limits<unsigned short>::max() / sizeof(unsigned short)))
- {
- return gl::OutOfMemory() << "Failed to create a 16-bit looping index buffer for "
- "GL_LINE_LOOP, too many indices required.";
- }
-
- const unsigned int spaceNeeded =
- (static_cast<unsigned int>(count) + 1) * sizeof(unsigned short);
- gl::Error error = mLineLoopIB->reserveBufferSpace(spaceNeeded, GL_UNSIGNED_SHORT);
- if (error.isError())
- {
- return error;
- }
-
- void *mappedMemory = nullptr;
- unsigned int offset;
- error = mLineLoopIB->mapBuffer(spaceNeeded, &mappedMemory, &offset);
- if (error.isError())
- {
- return error;
- }
-
- startIndex = static_cast<unsigned int>(offset) / 2;
- unsigned short *data = reinterpret_cast<unsigned short *>(mappedMemory);
-
- switch (type)
- {
- case GL_NONE: // Non-indexed draw
- for (int i = 0; i < count; i++)
- {
- data[i] = static_cast<unsigned short>(i);
- }
- data[count] = 0;
- break;
- case GL_UNSIGNED_BYTE:
- for (int i = 0; i < count; i++)
- {
- data[i] = static_cast<const GLubyte *>(indices)[i];
- }
- data[count] = static_cast<const GLubyte *>(indices)[0];
- break;
- case GL_UNSIGNED_SHORT:
- for (int i = 0; i < count; i++)
- {
- data[i] = static_cast<const GLushort *>(indices)[i];
- }
- data[count] = static_cast<const GLushort *>(indices)[0];
- break;
- case GL_UNSIGNED_INT:
- for (int i = 0; i < count; i++)
- {
- data[i] = static_cast<unsigned short>(static_cast<const GLuint *>(indices)[i]);
- }
- data[count] = static_cast<unsigned short>(static_cast<const GLuint *>(indices)[0]);
- break;
- default:
- UNREACHABLE();
- }
-
- error = mLineLoopIB->unmapBuffer();
- if (error.isError())
- {
- return error;
- }
- }
-
- 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 gl::NoError();
-}
-
-template <typename T>
-static gl::Error 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);
- }
-
- return gl::NoError();
-}
-
-gl::Error Renderer9::drawIndexedPoints(const gl::Context *context,
- GLsizei count,
- GLenum 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;
- gl::Error error = storage->getData(context, &bufferData);
- if (error.isError())
- {
- return error;
- }
-
- indices = bufferData + offset;
- }
-
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- return drawPoints<GLubyte>(mDevice, count, indices, minIndex);
- case GL_UNSIGNED_SHORT:
- return drawPoints<GLushort>(mDevice, count, indices, minIndex);
- case GL_UNSIGNED_INT:
- return drawPoints<GLuint>(mDevice, count, indices, minIndex);
- default:
- UNREACHABLE();
- return gl::InternalError();
- }
-}
-
-gl::Error Renderer9::getCountingIB(size_t count, StaticIndexBufferInterface **outIB)
-{
- // Update the counting index buffer if it is not large enough or has not been created yet.
- if (count <= 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(spaceNeeded, GL_UNSIGNED_SHORT));
-
- void *mappedMemory = nullptr;
- ANGLE_TRY(mCountingIB->mapBuffer(spaceNeeded, &mappedMemory, nullptr));
-
- unsigned short *data = reinterpret_cast<unsigned short *>(mappedMemory);
- for (size_t i = 0; i < count; i++)
- {
- data[i] = static_cast<unsigned short>(i);
- }
-
- ANGLE_TRY(mCountingIB->unmapBuffer());
- }
- }
- 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(spaceNeeded, GL_UNSIGNED_INT));
-
- void *mappedMemory = nullptr;
- ANGLE_TRY(mCountingIB->mapBuffer(spaceNeeded, &mappedMemory, nullptr));
-
- unsigned int *data = reinterpret_cast<unsigned int *>(mappedMemory);
- for (unsigned int i = 0; i < count; i++)
- {
- data[i] = i;
- }
-
- ANGLE_TRY(mCountingIB->unmapBuffer());
- }
- }
- else
- {
- return gl::OutOfMemory()
- << "Could not create a counting index buffer for glDrawArraysInstanced.";
- }
-
- *outIB = mCountingIB;
- return gl::NoError();
-}
-
-gl::Error Renderer9::applyShaders(const gl::Context *context, GLenum drawMode)
-{
- const gl::State &state = context->getContextState().getState();
- // This method is called single-threaded.
- ANGLE_TRY(ensureHLSLCompilerInitialized());
-
- ProgramD3D *programD3D = GetImplAs<ProgramD3D>(state.getProgram());
- VertexArray9 *vao = GetImplAs<VertexArray9>(state.getVertexArray());
- programD3D->updateCachedInputLayout(vao->getCurrentStateSerial(), state);
-
- ShaderExecutableD3D *vertexExe = nullptr;
- ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(&vertexExe, nullptr));
-
- const gl::Framebuffer *drawFramebuffer = state.getDrawFramebuffer();
- programD3D->updateCachedOutputLayout(context, drawFramebuffer);
-
- ShaderExecutableD3D *pixelExe = nullptr;
- ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(&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;
- }
-
- ANGLE_TRY(applyUniforms(programD3D));
-
- // Driver uniforms
- mStateManager.setShaderConstants();
-
- return gl::NoError();
-}
-
-gl::Error Renderer9::applyUniforms(ProgramD3D *programD3D)
-{
- // Skip updates if we're not dirty. Note that D3D9 cannot have compute.
- if (!programD3D->areVertexUniformsDirty() && !programD3D->areFragmentUniformsDirty())
- {
- return gl::NoError();
- }
-
- const auto &uniformArray = programD3D->getD3DUniforms();
-
- for (const D3DUniform *targetUniform : uniformArray)
- {
- // Built-in uniforms must be skipped.
- if (!targetUniform->isReferencedByFragmentShader() &&
- !targetUniform->isReferencedByVertexShader())
- 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();
- return gl::NoError();
-}
-
-void Renderer9::applyUniformnfv(const D3DUniform *targetUniform, const GLfloat *v)
-{
- if (targetUniform->isReferencedByFragmentShader())
- {
- mDevice->SetPixelShaderConstantF(targetUniform->psRegisterIndex, v,
- targetUniform->registerCount);
- }
-
- if (targetUniform->isReferencedByVertexShader())
- {
- mDevice->SetVertexShaderConstantF(targetUniform->vsRegisterIndex, 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);
-}
-
-gl::Error Renderer9::clear(const gl::Context *context,
- const ClearParameters &clearParams,
- const gl::FramebufferAttachment *colorBuffer,
- const gl::FramebufferAttachment *depthStencilBuffer)
-{
- if (clearParams.colorType != GL_FLOAT)
- {
- // Clearing buffers with non-float values is not supported by Renderer9 and ES 2.0
- UNREACHABLE();
- return gl::InternalError();
- }
-
- bool clearColor = clearParams.clearColor[0];
- for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
- {
- if (clearParams.clearColor[i] != clearColor)
- {
- // Clearing individual buffers other than buffer zero is not supported by Renderer9 and
- // ES 2.0
- UNREACHABLE();
- return gl::InternalError();
- }
- }
-
- float depth = gl::clamp01(clearParams.depthValue);
- DWORD stencil = clearParams.stencilValue & 0x000000FF;
-
- unsigned int stencilUnmasked = 0x0;
- if (clearParams.clearStencil && depthStencilBuffer->getStencilSize() > 0)
- {
- ASSERT(depthStencilBuffer != nullptr);
-
- RenderTargetD3D *stencilRenderTarget = nullptr;
- gl::Error error = depthStencilBuffer->getRenderTarget(context, &stencilRenderTarget);
- if (error.isError())
- {
- return error;
- }
-
- RenderTarget9 *stencilRenderTarget9 = GetAs<RenderTarget9>(stencilRenderTarget);
- ASSERT(stencilRenderTarget9);
-
- const d3d9::D3DFormat &d3dFormatInfo =
- d3d9::GetD3DFormatInfo(stencilRenderTarget9->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(colorBuffer != nullptr);
-
- RenderTargetD3D *colorRenderTarget = nullptr;
- gl::Error error = colorBuffer->getRenderTarget(context, &colorRenderTarget);
- if (error.isError())
- {
- return error;
- }
-
- RenderTarget9 *colorRenderTarget9 = GetAs<RenderTarget9>(colorRenderTarget);
- ASSERT(colorRenderTarget9);
-
- const gl::InternalFormat &formatInfo = *colorBuffer->getFormat().info;
- const d3d9::D3DFormat &d3dFormatInfo =
- d3d9::GetD3DFormatInfo(colorRenderTarget9->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);
- }
-
- return gl::NoError();
-}
-
-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++)
- {
- if (mNullColorbufferCache[i].buffer)
- {
- mNullColorbufferCache[i].buffer->detach(mDisplay->getProxyContext());
- }
- SafeDelete(mNullColorbufferCache[i].buffer);
- }
-}
-
-// set notify to true to broadcast a message to all contexts of the device loss
-bool Renderer9::testDeviceLost()
-{
- HRESULT status = getDeviceStatusCode();
- 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
- ASSERT(UNREACHABLE());
-#endif
-
- return success;
-}
-
-bool Renderer9::resetRemovedDevice()
-{
- // From http://msdn.microsoft.com/en-us/library/windows/desktop/bb172554(v=vs.85).aspx:
- // The hardware adapter has been removed. Application must destroy the device, do enumeration of
- // adapters and create another Direct3D device. If application continues rendering without
- // calling Reset, the rendering calls will succeed. Applies to Direct3D 9Ex only.
- release();
- return !initialize().isError();
-}
-
-VendorID Renderer9::getVendorId() const
-{
- return static_cast<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;
-}
-
-gl::Error 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);
-}
-
-gl::Error Renderer9::copyImageCube(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum target,
- GLint level)
-{
- RECT rect;
- rect.left = sourceRect.x;
- rect.top = sourceRect.y;
- rect.right = sourceRect.x + sourceRect.width;
- rect.bottom = sourceRect.y + sourceRect.height;
-
- return mBlit->copyCube(context, framebuffer, rect, destFormat, destOffset, storage, target,
- level);
-}
-
-gl::Error 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.
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error 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.
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error Renderer9::copyTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum destTarget,
- GLint destLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha)
-{
- RECT rect;
- rect.left = sourceRect.x;
- rect.top = sourceRect.y;
- rect.right = sourceRect.x + sourceRect.width;
- rect.bottom = sourceRect.y + sourceRect.height;
-
- return mBlit->copyTexture(context, source, sourceLevel, rect, destFormat, destOffset, storage,
- destTarget, destLevel, unpackFlipY, unpackPremultiplyAlpha,
- unpackUnmultiplyAlpha);
-}
-
-gl::Error Renderer9::copyCompressedTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel)
-{
- UNIMPLEMENTED();
- return gl::InternalError();
-}
-
-gl::Error Renderer9::createRenderTarget(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);
- }
- }
- }
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to create render target, " << gl::FmtHR(result);
- }
-
- if (requiresInitialization)
- {
- // This format requires that the data be initialized before the render target can be
- // used Unfortunately this requires a Get call on the d3d device but it is far better
- // than having to mark the render target as lockable and copy data to the gpu.
- IDirect3DSurface9 *prevRenderTarget = 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 gl::NoError();
-}
-
-gl::Error Renderer9::createRenderTargetCopy(RenderTargetD3D *source, RenderTargetD3D **outRT)
-{
- ASSERT(source != nullptr);
-
- RenderTargetD3D *newRT = nullptr;
- gl::Error error = createRenderTarget(source->getWidth(), source->getHeight(),
- source->getInternalFormat(), source->getSamples(), &newRT);
- if (error.isError())
- {
- return error;
- }
-
- RenderTarget9 *source9 = GetAs<RenderTarget9>(source);
- RenderTarget9 *dest9 = GetAs<RenderTarget9>(newRT);
-
- HRESULT result = mDevice->StretchRect(source9->getSurface(), nullptr, dest9->getSurface(),
- nullptr, D3DTEXF_NONE);
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to copy render target, " << gl::FmtHR(result);
- }
-
- *outRT = newRT;
- return gl::NoError();
-}
-
-gl::Error Renderer9::loadExecutable(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::SHADER_VERTEX:
- {
- IDirect3DVertexShader9 *vshader = nullptr;
- gl::Error error = createVertexShader((DWORD *)function, length, &vshader);
- if (error.isError())
- {
- return error;
- }
- *outExecutable = new ShaderExecutable9(function, length, vshader);
- }
- break;
- case gl::SHADER_FRAGMENT:
- {
- IDirect3DPixelShader9 *pshader = nullptr;
- gl::Error error = createPixelShader((DWORD *)function, length, &pshader);
- if (error.isError())
- {
- return error;
- }
- *outExecutable = new ShaderExecutable9(function, length, pshader);
- }
- break;
- default:
- UNREACHABLE();
- return gl::InternalError();
- }
-
- return gl::NoError();
-}
-
-gl::Error Renderer9::compileToExecutable(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::SHADER_VERTEX:
- profileStream << "vs";
- break;
- case gl::SHADER_FRAGMENT:
- profileStream << "ps";
- break;
- default:
- UNREACHABLE();
- return gl::InternalError();
- }
-
- 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;
- gl::Error error = mCompiler.compileToBinary(infoLog, shaderHLSL, profile, configs, nullptr,
- &binary, &debugInfo);
- if (error.isError())
- {
- return error;
- }
-
- // It's possible that binary is NULL if the compiler failed in all configurations. Set the
- // executable to NULL and return GL_NO_ERROR to signify that there was a link error but the
- // internal state is still OK.
- if (!binary)
- {
- *outExectuable = nullptr;
- return gl::NoError();
- }
-
- error = loadExecutable(reinterpret_cast<const uint8_t *>(binary->GetBufferPointer()),
- binary->GetBufferSize(), type, streamOutVaryings, separatedOutputBuffers,
- outExectuable);
-
- SafeRelease(binary);
- if (error.isError())
- {
- return error;
- }
-
- if (!debugInfo.empty())
- {
- (*outExectuable)->appendDebugInfo(debugInfo);
- }
-
- return gl::NoError();
-}
-
-gl::Error Renderer9::ensureHLSLCompilerInitialized()
-{
- return mCompiler.ensureInitialized();
-}
-
-UniformStorageD3D *Renderer9::createUniformStorage(size_t storageSize)
-{
- return new UniformStorageD3D(storageSize);
-}
-
-gl::Error Renderer9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
-{
- return mBlit->boxFilter(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;
-}
-
-gl::Error Renderer9::copyToRenderTarget(IDirect3DSurface9 *dest,
- IDirect3DSurface9 *source,
- bool fromManaged)
-{
- ASSERT(source && dest);
-
- 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(surf, source));
- result = mDevice->UpdateSurface(surf, nullptr, dest, nullptr);
- SafeRelease(surf);
- }
- }
- else
- {
- endScene();
- result = mDevice->StretchRect(source, nullptr, dest, nullptr, D3DTEXF_NONE);
- }
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to blit internal texture, " << gl::FmtHR(result);
- }
-
- return gl::NoError();
-}
-
-RendererClass Renderer9::getRendererClass() const
-{
- return RENDERER_D3D9;
-}
-
-ImageD3D *Renderer9::createImage()
-{
- return new Image9(this);
-}
-
-gl::Error Renderer9::generateMipmap(const gl::Context *context, ImageD3D *dest, ImageD3D *src)
-{
- Image9 *src9 = GetAs<Image9>(src);
- Image9 *dst9 = GetAs<Image9>(dest);
- return Image9::generateMipmap(dst9, src9);
-}
-
-gl::Error Renderer9::generateMipmapUsingD3D(const gl::Context *context,
- TextureStorage *storage,
- const gl::TextureState &textureState)
-{
- UNREACHABLE();
- return gl::NoError();
-}
-
-gl::Error Renderer9::copyImage(const gl::Context *context,
- ImageD3D *dest,
- ImageD3D *source,
- const gl::Rectangle &sourceRect,
- 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, sourceRect, 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 NULL;
-}
-
-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(gl::VertexFormatType vertexFormatType) const
-{
- return d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatType).conversionType;
-}
-
-GLenum Renderer9::getVertexComponentType(gl::VertexFormatType vertexFormatType) const
-{
- return d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatType).componentType;
-}
-
-gl::ErrorOrResult<unsigned int> Renderer9::getVertexSpaceRequired(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLsizei count,
- GLsizei instances) const
-{
- if (!attrib.enabled)
- {
- return 16u;
- }
-
- gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib, GL_FLOAT);
- const d3d9::VertexFormat &d3d9VertexInfo =
- d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatType);
-
- 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);
- }
-
- if (d3d9VertexInfo.outputElementSize > std::numeric_limits<unsigned int>::max() / elementCount)
- {
- return gl::OutOfMemory() << "New vertex buffer size would result in an overflow.";
- }
-
- return static_cast<unsigned int>(d3d9VertexInfo.outputElementSize) * elementCount;
-}
-
-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);
-}
-
-angle::WorkaroundsD3D Renderer9::generateWorkarounds() const
-{
- return d3d9::GenerateWorkarounds();
-}
-
-egl::Error Renderer9::getEGLDevice(DeviceImpl **device)
-{
- if (mEGLDevice == nullptr)
- {
- ASSERT(mDevice != nullptr);
- mEGLDevice = new DeviceD3D();
- egl::Error error = mEGLDevice->initialize(reinterpret_cast<void *>(mDevice),
- EGL_D3D9_DEVICE_ANGLE, EGL_FALSE);
-
- if (error.isError())
- {
- SafeDelete(mEGLDevice);
- return error;
- }
- }
-
- *device = static_cast<DeviceImpl *>(mEGLDevice);
- return egl::NoError();
-}
-
-Renderer9::CurSamplerState::CurSamplerState()
- : forceSet(true), baseLevel(std::numeric_limits<size_t>::max()), samplerState()
-{
-}
-
-gl::Error Renderer9::genericDrawElements(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances)
-{
- const auto &data = context->getContextState();
- gl::Program *program = context->getGLState().getProgram();
- ASSERT(program != nullptr);
- ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
- bool usesPointSize = programD3D->usesPointSize();
-
- programD3D->updateSamplerMapping();
-
- if (!applyPrimitiveType(mode, count, usesPointSize))
- {
- return gl::NoError();
- }
-
- ANGLE_TRY(updateState(context, mode));
- ANGLE_TRY(applyTextures(context));
- ANGLE_TRY(applyShaders(context, mode));
-
- if (!skipDraw(data.getState(), mode))
- {
- ANGLE_TRY(drawElementsImpl(context, mode, count, type, indices, instances));
- }
-
- return gl::NoError();
-}
-
-gl::Error Renderer9::genericDrawArrays(const gl::Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei instances)
-{
- gl::Program *program = context->getGLState().getProgram();
- ASSERT(program != nullptr);
- ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
- bool usesPointSize = programD3D->usesPointSize();
-
- programD3D->updateSamplerMapping();
-
- if (!applyPrimitiveType(mode, count, usesPointSize))
- {
- return gl::NoError();
- }
-
- 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->getGLState(), mode))
- {
- ANGLE_TRY(drawArraysImpl(context, mode, first, count, instances));
- }
-
- return gl::NoError();
-}
-
-FramebufferImpl *Renderer9::createDefaultFramebuffer(const gl::FramebufferState &state)
-{
- return new Framebuffer9(state, this);
-}
-
-gl::Version Renderer9::getMaxSupportedESVersion() const
-{
- return gl::Version(2, 0);
-}
-
-gl::Error Renderer9::clearRenderTarget(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 gl::NoError();
-}
-
-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.
-gl::Error Renderer9::applyTextures(const gl::Context *context, gl::SamplerType shaderType)
-{
- const auto &glState = context->getGLState();
- const auto &caps = context->getCaps();
- ProgramD3D *programD3D = GetImplAs<ProgramD3D>(glState.getProgram());
-
- ASSERT(!programD3D->isSamplerMappingDirty());
-
- // TODO(jmadill): Use the Program's sampler bindings.
- const auto &completeTextures = glState.getCompleteTextureCache();
-
- unsigned int samplerRange = programD3D->getUsedSamplerRange(shaderType);
- for (unsigned int samplerIndex = 0; samplerIndex < samplerRange; samplerIndex++)
- {
- GLint textureUnit = programD3D->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(setTexture(context, shaderType, samplerIndex, texture));
- }
- else
- {
- GLenum 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::SAMPLER_PIXEL) ? caps.maxTextureImageUnits
- : caps.maxVertexTextureImageUnits;
-
- // TODO(jmadill): faster way?
- for (size_t samplerIndex = samplerRange; samplerIndex < samplerCount; samplerIndex++)
- {
- ANGLE_TRY(setTexture(context, shaderType, static_cast<int>(samplerIndex), nullptr));
- }
-
- return gl::NoError();
-}
-
-gl::Error Renderer9::applyTextures(const gl::Context *context)
-{
- ANGLE_TRY(applyTextures(context, gl::SAMPLER_VERTEX));
- ANGLE_TRY(applyTextures(context, gl::SAMPLER_PIXEL));
- return gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
deleted file mode 100644
index 9ddee45f0f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
+++ /dev/null
@@ -1,543 +0,0 @@
-//
-// 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 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();
-
- gl::Error flush();
- gl::Error finish();
-
- 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,
- GLenum *fboFormat) const override;
- egl::Error validateShareHandle(const egl::Config *config,
- HANDLE shareHandle,
- const egl::AttributeMap &attribs) const override;
-
- ContextImpl *createContext(const gl::ContextState &state) override;
-
- gl::Error allocateEventQuery(IDirect3DQuery9 **outQuery);
- void freeEventQuery(IDirect3DQuery9 *query);
-
- // resource creation
- gl::Error createVertexShader(const DWORD *function,
- size_t length,
- IDirect3DVertexShader9 **outShader);
- gl::Error createPixelShader(const DWORD *function,
- size_t length,
- IDirect3DPixelShader9 **outShader);
- HRESULT createVertexBuffer(UINT Length, DWORD Usage, IDirect3DVertexBuffer9 **ppVertexBuffer);
- HRESULT createIndexBuffer(UINT Length,
- DWORD Usage,
- D3DFORMAT Format,
- IDirect3DIndexBuffer9 **ppIndexBuffer);
- gl::Error setSamplerState(const gl::Context *context,
- gl::SamplerType type,
- int index,
- gl::Texture *texture,
- const gl::SamplerState &sampler);
- gl::Error setTexture(const gl::Context *context,
- gl::SamplerType type,
- int index,
- gl::Texture *texture);
-
- gl::Error updateState(const gl::Context *context, GLenum drawMode);
-
- void setScissorRectangle(const gl::Rectangle &scissor, bool enabled);
- void setViewport(const gl::Rectangle &viewport,
- float zNear,
- float zFar,
- GLenum drawMode,
- GLenum frontFace,
- bool ignoreViewport);
-
- gl::Error applyRenderTarget(const gl::Context *context, const gl::Framebuffer *frameBuffer);
- gl::Error applyRenderTarget(const gl::Context *context,
- const gl::FramebufferAttachment *colorAttachment,
- const gl::FramebufferAttachment *depthStencilAttachment);
- gl::Error applyUniforms(ProgramD3D *programD3D);
- bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount, bool usesPointSize);
- gl::Error applyVertexBuffer(const gl::Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei instances,
- TranslatedIndexData *indexInfo);
- gl::Error applyIndexBuffer(const gl::Context *context,
- const void *indices,
- GLsizei count,
- GLenum mode,
- GLenum type,
- TranslatedIndexData *indexInfo);
-
- gl::Error clear(const gl::Context *context,
- const ClearParameters &clearParams,
- const gl::FramebufferAttachment *colorBuffer,
- const gl::FramebufferAttachment *depthStencilBuffer);
-
- 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
- gl::Error copyImage2D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) override;
- gl::Error copyImageCube(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum target,
- GLint level) override;
- gl::Error copyImage3D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) override;
- gl::Error copyImage2DArray(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) override;
-
- gl::Error copyTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum destTarget,
- GLint destLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha) override;
- gl::Error copyCompressedTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel) override;
-
- // RenderTarget creation
- gl::Error createRenderTarget(int width,
- int height,
- GLenum format,
- GLsizei samples,
- RenderTargetD3D **outRT) override;
- gl::Error createRenderTargetCopy(RenderTargetD3D *source, RenderTargetD3D **outRT) override;
-
- // Shader operations
- gl::Error loadExecutable(const uint8_t *function,
- size_t length,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- ShaderExecutableD3D **outExecutable) override;
- gl::Error compileToExecutable(gl::InfoLog &infoLog,
- const std::string &shaderHLSL,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- const angle::CompilerWorkaroundsD3D &workarounds,
- ShaderExecutableD3D **outExectuable) override;
- gl::Error ensureHLSLCompilerInitialized() override;
-
- UniformStorageD3D *createUniformStorage(size_t storageSize) override;
-
- // Image operations
- ImageD3D *createImage() override;
- gl::Error generateMipmap(const gl::Context *context, ImageD3D *dest, ImageD3D *source) override;
- gl::Error generateMipmapUsingD3D(const gl::Context *context,
- TextureStorage *storage,
- const gl::TextureState &textureState) override;
- gl::Error copyImage(const gl::Context *context,
- ImageD3D *dest,
- ImageD3D *source,
- const gl::Rectangle &sourceRect,
- 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;
-
- // Buffer creation
- VertexBuffer *createVertexBuffer() override;
- IndexBuffer *createIndexBuffer() override;
-
- // Stream Creation
- StreamProducerImpl *createStreamProducerD3DTextureNV12(
- egl::Stream::ConsumerType consumerType,
- const egl::AttributeMap &attribs) override;
-
- // Buffer-to-texture and Texture-to-buffer copies
- bool supportsFastCopyBufferToTexture(GLenum internalFormat) const override;
- gl::Error 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
- gl::Error boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
-
- D3DPOOL getTexturePool(DWORD usage) const;
-
- bool getLUID(LUID *adapterLuid) const override;
- VertexConversionType getVertexConversionType(
- gl::VertexFormatType vertexFormatType) const override;
- GLenum getVertexComponentType(gl::VertexFormatType vertexFormatType) const override;
-
- // Warning: you should ensure binding really matches attrib.bindingIndex before using this
- // function.
- gl::ErrorOrResult<unsigned int> getVertexSpaceRequired(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLsizei count,
- GLsizei instances) const override;
-
- gl::Error copyToRenderTarget(IDirect3DSurface9 *dest,
- IDirect3DSurface9 *source,
- bool fromManaged);
-
- RendererClass getRendererClass() const override;
-
- D3DDEVTYPE getD3D9DeviceType() const { return mDeviceType; }
-
- egl::Error getEGLDevice(DeviceImpl **device) override;
-
- StateManager9 *getStateManager() { return &mStateManager; }
-
- gl::Error genericDrawArrays(const gl::Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei instances);
-
- gl::Error genericDrawElements(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum 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::Error clearRenderTarget(RenderTargetD3D *renderTarget,
- const gl::ColorF &clearColorValue,
- const float clearDepthValue,
- const unsigned int clearStencilValue) override;
-
- bool canSelectViewInVertexShader() const override;
-
- private:
- gl::Error drawArraysImpl(const gl::Context *context,
- GLenum mode,
- GLint startVertex,
- GLsizei count,
- GLsizei instances);
- gl::Error drawElementsImpl(const gl::Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances);
-
- gl::Error applyShaders(const gl::Context *context, GLenum drawMode);
-
- gl::Error applyTextures(const gl::Context *context);
- gl::Error applyTextures(const gl::Context *context, gl::SamplerType shaderType);
-
- void generateCaps(gl::Caps *outCaps,
- gl::TextureCapsMap *outTextureCaps,
- gl::Extensions *outExtensions,
- gl::Limitations *outLimitations) const override;
-
- angle::WorkaroundsD3D generateWorkarounds() const override;
-
- gl::Error setBlendDepthRasterStates(const gl::Context *context, GLenum 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);
-
- gl::Error drawLineLoop(const gl::Context *context,
- GLsizei count,
- GLenum type,
- const void *indices,
- int minIndex,
- gl::Buffer *elementArrayBuffer);
- gl::Error drawIndexedPoints(const gl::Context *context,
- GLsizei count,
- GLenum type,
- const void *indices,
- int minIndex,
- gl::Buffer *elementArrayBuffer);
-
- gl::Error getCountingIB(size_t count, StaticIndexBufferInterface **outIB);
-
- gl::Error getNullColorbuffer(const gl::Context *context,
- const gl::FramebufferAttachment *depthbuffer,
- const gl::FramebufferAttachment **outColorBuffer);
-
- 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 NullColorbufferCacheEntry
- {
- UINT lruCount;
- int width;
- int height;
- gl::FramebufferAttachment *buffer;
- } mNullColorbufferCache[NUM_NULL_COLORBUFFER_CACHE_ENTRIES];
- UINT mMaxNullColorbufferLRU;
-
- DeviceD3D *mEGLDevice;
- std::vector<TranslatedAttribute> mTranslatedAttribCache;
-
- DebugAnnotator9 mAnnotator;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_RENDERER9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h
deleted file mode 100644
index 399770dd8d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h
+++ /dev/null
@@ -1,106 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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 <cstddef>
-#include <unordered_map>
-#include <string>
-
-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;
- }
-
- gl::Error create(const DWORD *function, size_t length, ShaderObject **outShaderObject)
- {
- 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 gl::NoError();
- }
-
- ShaderObject *shader;
- HRESULT result = createShader(function, &shader);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to create shader, " << gl::FmtHR(result);
- }
-
- // Random eviction policy.
- if (mMap.size() >= kMaxMapSize)
- {
- SafeRelease(mMap.begin()->second);
- mMap.erase(mMap.begin());
- }
-
- shader->AddRef();
- mMap[key] = shader;
-
- *outShaderObject = shader;
- return gl::NoError();
- }
-
- void clear()
- {
- 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;
-
- IDirect3DDevice9 *mDevice;
-};
-
-typedef ShaderCache<IDirect3DVertexShader9> VertexShaderCache;
-typedef ShaderCache<IDirect3DPixelShader9> PixelShaderCache;
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_SHADERCACHE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp
deleted file mode 100644
index 362c6c60a3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// 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;
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h
deleted file mode 100644
index 0b6b87947e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// 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;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_SHADEREXECUTABLE9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
deleted file mode 100644
index a3bdc14efb..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
+++ /dev/null
@@ -1,945 +0,0 @@
-//
-// 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/renderer9_utils.h"
-#include "libANGLE/renderer/d3d/d3d9/Framebuffer9.h"
-#include "libANGLE/renderer/d3d/d3d9/Renderer9.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);
- }
- }
- 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:
- if (state.getNearPlane() != mCurNear || state.getFarPlane() != mCurFar)
- {
- mDirtyBits.set(DIRTY_BIT_VIEWPORT);
- }
- break;
- case gl::State::DIRTY_BIT_VIEWPORT:
- if (state.getViewport() != mCurViewport)
- {
- mDirtyBits.set(DIRTY_BIT_VIEWPORT);
- }
- break;
- default:
- break;
- }
- }
-}
-
-gl::Error 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);
- }
-
- return gl::NoError();
-}
-
-void StateManager9::setViewportState(const gl::Rectangle &viewport,
- float zNear,
- float zFar,
- GLenum 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->getFirstColorbuffer();
- 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.h
deleted file mode 100644
index 63ce17cb1e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.h
+++ /dev/null
@@ -1,209 +0,0 @@
-//
-// 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/angletypes.h"
-#include "libANGLE/ContextState.h"
-#include "libANGLE/State.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);
-
- gl::Error 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,
- GLenum 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 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/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp
deleted file mode 100644
index bc81aa18ec..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp
+++ /dev/null
@@ -1,467 +0,0 @@
-//
-// 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/formatutils9.h"
-#include "libANGLE/renderer/d3d/d3d9/NativeWindow9.h"
-#include "libANGLE/renderer/d3d/d3d9/Renderer9.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(const gl::Context *context, int backbufferWidth, int backbufferHeight)
-{
- // D3D9 does not support resizing swap chains without recreating them
- return reset(context, backbufferWidth, backbufferHeight, mSwapInterval);
-}
-
-EGLint SwapChain9::reset(const gl::Context *context,
- 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(const gl::Context *context,
- 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))
- {
- 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;
-}
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h
deleted file mode 100644
index 5753637c47..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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(const gl::Context *context, EGLint backbufferWidth, EGLint backbufferHeight)
- override;
- EGLint reset(const gl::Context *context,
- EGLint backbufferWidth,
- EGLint backbufferHeight,
- EGLint swapInterval) override;
- EGLint swapRect(const gl::Context *context,
- 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;
-};
-
-}
-#endif // LIBANGLE_RENDERER_D3D_D3D9_SWAPCHAIN9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
deleted file mode 100644
index 6404af6bba..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
+++ /dev/null
@@ -1,647 +0,0 @@
-//
-// 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 "libANGLE/formatutils.h"
-#include "libANGLE/Texture.h"
-#include "libANGLE/renderer/d3d/EGLImageD3D.h"
-#include "libANGLE/renderer/d3d/TextureD3D.h"
-#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
-#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
-#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
-#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
-#include "libANGLE/renderer/d3d/d3d9/SwapChain9.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;
-}
-
-gl::Error 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)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-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
-gl::Error TextureStorage9_2D::getSurfaceLevel(const gl::Context *context,
- GLenum target,
- int level,
- bool dirty,
- IDirect3DSurface9 **outSurface)
-{
- ASSERT(target == GL_TEXTURE_2D);
-
- IDirect3DBaseTexture9 *baseTexture = nullptr;
- gl::Error error = getBaseTexture(context, &baseTexture);
- if (error.isError())
- {
- return error;
- }
-
- IDirect3DTexture9 *texture = static_cast<IDirect3DTexture9*>(baseTexture);
-
- HRESULT result = texture->GetSurfaceLevel(level + mTopLevel, outSurface);
-
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to get the surface from a texture, "
- << gl::FmtHR(result);
- }
-
- // 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 gl::NoError();
-}
-
-gl::Error TextureStorage9_2D::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
-{
- ASSERT(index.mipIndex < getLevelCount());
-
- if (!mRenderTargets[index.mipIndex] && isRenderTarget())
- {
- IDirect3DBaseTexture9 *baseTexture = nullptr;
- gl::Error error = getBaseTexture(context, &baseTexture);
- if (error.isError())
- {
- return error;
- }
-
- IDirect3DSurface9 *surface = nullptr;
- error = getSurfaceLevel(context, GL_TEXTURE_2D, index.mipIndex, false, &surface);
- if (error.isError())
- {
- return error;
- }
-
- size_t textureMipLevel = mTopLevel + index.mipIndex;
- size_t mipWidth = std::max<size_t>(mTextureWidth >> textureMipLevel, 1u);
- size_t mipHeight = std::max<size_t>(mTextureHeight >> textureMipLevel, 1u);
-
- baseTexture->AddRef();
- mRenderTargets[index.mipIndex] = new TextureRenderTarget9(
- baseTexture, textureMipLevel, surface, mInternalFormat, static_cast<GLsizei>(mipWidth),
- static_cast<GLsizei>(mipHeight), 1, 0);
- }
-
- ASSERT(outRT);
- *outRT = mRenderTargets[index.mipIndex];
- return gl::NoError();
-}
-
-gl::Error TextureStorage9_2D::generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex)
-{
- IDirect3DSurface9 *upper = nullptr;
- gl::Error error = getSurfaceLevel(context, GL_TEXTURE_2D, sourceIndex.mipIndex, false, &upper);
- if (error.isError())
- {
- return error;
- }
-
- IDirect3DSurface9 *lower = nullptr;
- error = getSurfaceLevel(context, GL_TEXTURE_2D, destIndex.mipIndex, true, &lower);
- if (error.isError())
- {
- SafeRelease(upper);
- return error;
- }
-
- ASSERT(upper && lower);
- error = mRenderer->boxFilter(upper, lower);
-
- SafeRelease(upper);
- SafeRelease(lower);
-
- return error;
-}
-
-gl::Error 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);
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory()
- << "Failed to create 2D storage texture, " << gl::FmtHR(result);
- }
- }
-
- *outTexture = mTexture;
- return gl::NoError();
-}
-
-gl::Error 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)
- {
- IDirect3DSurface9 *srcSurf = nullptr;
- gl::Error error = getSurfaceLevel(context, GL_TEXTURE_2D, i, false, &srcSurf);
- if (error.isError())
- {
- return error;
- }
-
- IDirect3DSurface9 *dstSurf = nullptr;
- error = dest9->getSurfaceLevel(context, GL_TEXTURE_2D, i, true, &dstSurf);
- if (error.isError())
- {
- SafeRelease(srcSurf);
- return error;
- }
-
- error = mRenderer->copyToRenderTarget(dstSurf, srcSurf, isManaged());
-
- SafeRelease(srcSurf);
- SafeRelease(dstSurf);
-
- if (error.isError())
- {
- return error;
- }
- }
-
- return gl::NoError();
-}
-
-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()
-{
-}
-
-gl::Error TextureStorage9_EGLImage::getSurfaceLevel(const gl::Context *context,
- GLenum target,
- int level,
- bool,
- IDirect3DSurface9 **outSurface)
-{
- ASSERT(target == GL_TEXTURE_2D);
- ASSERT(level == 0);
-
- RenderTargetD3D *renderTargetD3D = nullptr;
- gl::Error error = mImage->getRenderTarget(context, &renderTargetD3D);
- if (error.isError())
- {
- return error;
- }
-
- RenderTarget9 *renderTarget9 = GetAs<RenderTarget9>(renderTargetD3D);
-
- *outSurface = renderTarget9->getSurface();
- return gl::NoError();
-}
-
-gl::Error TextureStorage9_EGLImage::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
-{
- ASSERT(!index.hasLayer());
- ASSERT(index.mipIndex == 0);
-
- return mImage->getRenderTarget(context, outRT);
-}
-
-gl::Error TextureStorage9_EGLImage::getBaseTexture(const gl::Context *context,
- IDirect3DBaseTexture9 **outTexture)
-{
- RenderTargetD3D *renderTargetD3D = nullptr;
- gl::Error error = mImage->getRenderTarget(context, &renderTargetD3D);
- if (error.isError())
- {
- return error;
- }
-
- RenderTarget9 *renderTarget9 = GetAs<RenderTarget9>(renderTargetD3D);
- *outTexture = renderTarget9->getTexture();
- ASSERT(*outTexture != nullptr);
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage9_EGLImage::generateMipmap(const gl::Context *context,
- const gl::ImageIndex &,
- const gl::ImageIndex &)
-{
- UNREACHABLE();
- return gl::InternalError();
-}
-
-gl::Error TextureStorage9_EGLImage::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
-{
- ASSERT(destStorage);
- ASSERT(getLevelCount() == 1);
-
- TextureStorage9 *dest9 = GetAs<TextureStorage9>(destStorage);
-
- IDirect3DBaseTexture9 *destBaseTexture9 = nullptr;
- gl::Error error = dest9->getBaseTexture(context, &destBaseTexture9);
- if (error.isError())
- {
- return error;
- }
-
- IDirect3DTexture9 *destTexture9 = static_cast<IDirect3DTexture9 *>(destBaseTexture9);
-
- IDirect3DSurface9 *destSurface = nullptr;
- HRESULT result = destTexture9->GetSurfaceLevel(destStorage->getTopLevel(), &destSurface);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to get the surface from a texture, "
- << gl::FmtHR(result);
- }
-
- RenderTargetD3D *sourceRenderTarget = nullptr;
- error = mImage->getRenderTarget(context, &sourceRenderTarget);
- if (error.isError())
- {
- SafeRelease(destSurface);
- return error;
- }
-
- RenderTarget9 *sourceRenderTarget9 = GetAs<RenderTarget9>(sourceRenderTarget);
- error =
- mRenderer->copyToRenderTarget(destSurface, sourceRenderTarget9->getSurface(), isManaged());
- if (error.isError())
- {
- SafeRelease(destSurface);
- return error;
- }
-
- if (destStorage->getTopLevel() != 0)
- {
- destTexture9->AddDirtyRect(nullptr);
- }
-
- SafeRelease(destSurface);
- return gl::NoError();
-}
-
-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::CUBE_FACE_COUNT; ++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::CUBE_FACE_COUNT; ++i)
- {
- SafeDelete(mRenderTarget[i]);
- }
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-gl::Error TextureStorage9_Cube::getSurfaceLevel(const gl::Context *context,
- GLenum target,
- int level,
- bool dirty,
- IDirect3DSurface9 **outSurface)
-{
- IDirect3DBaseTexture9 *baseTexture = nullptr;
- gl::Error error = getBaseTexture(context, &baseTexture);
- if (error.isError())
- {
- return error;
- }
-
- IDirect3DCubeTexture9 *texture = static_cast<IDirect3DCubeTexture9*>(baseTexture);
-
- D3DCUBEMAP_FACES face = gl_d3d9::ConvertCubeFace(target);
- HRESULT result = texture->GetCubeMapSurface(face, level, outSurface);
-
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to get the surface from a texture, "
- << gl::FmtHR(result);
- }
-
- // 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 gl::NoError();
-}
-
-gl::Error TextureStorage9_Cube::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
-{
- ASSERT(outRT);
- ASSERT(index.mipIndex == 0);
- ASSERT(index.layerIndex >= 0 && static_cast<size_t>(index.layerIndex) < gl::CUBE_FACE_COUNT);
-
- if (mRenderTarget[index.layerIndex] == nullptr && isRenderTarget())
- {
- IDirect3DBaseTexture9 *baseTexture = nullptr;
- gl::Error error = getBaseTexture(context, &baseTexture);
- if (error.isError())
- {
- return error;
- }
-
- IDirect3DSurface9 *surface = nullptr;
- error = getSurfaceLevel(context, GL_TEXTURE_CUBE_MAP_POSITIVE_X + index.layerIndex,
- mTopLevel + index.mipIndex, false, &surface);
- if (error.isError())
- {
- return error;
- }
-
- baseTexture->AddRef();
- mRenderTarget[index.layerIndex] = new TextureRenderTarget9(
- baseTexture, mTopLevel + index.mipIndex, surface, mInternalFormat,
- static_cast<GLsizei>(mTextureWidth), static_cast<GLsizei>(mTextureHeight), 1, 0);
- }
-
- *outRT = mRenderTarget[index.layerIndex];
- return gl::NoError();
-}
-
-gl::Error TextureStorage9_Cube::generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex)
-{
- IDirect3DSurface9 *upper = nullptr;
- gl::Error error =
- getSurfaceLevel(context, sourceIndex.type, sourceIndex.mipIndex, false, &upper);
- if (error.isError())
- {
- return error;
- }
-
- IDirect3DSurface9 *lower = nullptr;
- error = getSurfaceLevel(context, destIndex.type, destIndex.mipIndex, true, &lower);
- if (error.isError())
- {
- SafeRelease(upper);
- return error;
- }
-
- ASSERT(upper && lower);
- error = mRenderer->boxFilter(upper, lower);
-
- SafeRelease(upper);
- SafeRelease(lower);
-
- return error;
-}
-
-gl::Error 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);
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory()
- << "Failed to create cube storage texture, " << gl::FmtHR(result);
- }
- }
-
- *outTexture = mTexture;
- return gl::NoError();
-}
-
-gl::Error TextureStorage9_Cube::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
-{
- ASSERT(destStorage);
-
- TextureStorage9_Cube *dest9 = GetAs<TextureStorage9_Cube>(destStorage);
-
- int levels = getLevelCount();
- for (int f = 0; f < static_cast<int>(gl::CUBE_FACE_COUNT); f++)
- {
- for (int i = 0; i < levels; i++)
- {
- IDirect3DSurface9 *srcSurf = nullptr;
- gl::Error error =
- getSurfaceLevel(context, GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i, false, &srcSurf);
- if (error.isError())
- {
- return error;
- }
-
- IDirect3DSurface9 *dstSurf = nullptr;
- error = dest9->getSurfaceLevel(context, GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i, true,
- &dstSurf);
- if (error.isError())
- {
- SafeRelease(srcSurf);
- return error;
- }
-
- error = mRenderer->copyToRenderTarget(dstSurf, srcSurf, isManaged());
-
- SafeRelease(srcSurf);
- SafeRelease(dstSurf);
-
- if (error.isError())
- {
- return error;
- }
- }
- }
-
- return gl::NoError();
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h
deleted file mode 100644
index 2f51901931..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h
+++ /dev/null
@@ -1,154 +0,0 @@
-//
-// 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 "libANGLE/renderer/d3d/TextureStorage.h"
-#include "common/debug.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 gl::Error getSurfaceLevel(const gl::Context *context,
- GLenum target,
- int level,
- bool dirty,
- IDirect3DSurface9 **outSurface) = 0;
- virtual gl::Error 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;
-
- gl::Error 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;
-
- gl::Error getSurfaceLevel(const gl::Context *context,
- GLenum target,
- int level,
- bool dirty,
- IDirect3DSurface9 **outSurface) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
- gl::Error getBaseTexture(const gl::Context *context,
- IDirect3DBaseTexture9 **outTexture) override;
- gl::Error generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex) override;
- gl::Error 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;
-
- gl::Error getSurfaceLevel(const gl::Context *context,
- GLenum target,
- int level,
- bool dirty,
- IDirect3DSurface9 **outSurface) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
- gl::Error getBaseTexture(const gl::Context *context,
- IDirect3DBaseTexture9 **outTexture) override;
- gl::Error generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex) override;
- gl::Error 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;
-
- gl::Error getSurfaceLevel(const gl::Context *context,
- GLenum target,
- int level,
- bool dirty,
- IDirect3DSurface9 **outSurface) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
- gl::Error getBaseTexture(const gl::Context *context,
- IDirect3DBaseTexture9 **outTexture) override;
- gl::Error generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex) override;
- gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
-
- private:
- IDirect3DCubeTexture9 *mTexture;
- RenderTarget9 *mRenderTarget[gl::CUBE_FACE_COUNT];
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_TEXTURESTORAGE9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h
deleted file mode 100644
index 0f4410b8de..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// 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) {}
-
- void syncState(const gl::Context *context,
- const gl::VertexArray::DirtyBits &dirtyBits) override;
-
- ~VertexArray9() override {}
-
- Serial getCurrentStateSerial() const { return mCurrentStateSerial; }
-
- private:
- Serial mCurrentStateSerial;
-};
-
-inline void VertexArray9::syncState(const gl::Context *context,
- const gl::VertexArray::DirtyBits &dirtyBits)
-{
- ASSERT(dirtyBits.any());
- Renderer9 *renderer = GetImplAs<Context9>(context)->getRenderer();
- mCurrentStateSerial = renderer->generateSerial();
-}
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
deleted file mode 100644
index c0b80a847c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// VertexBuffer9.cpp: Defines the D3D9 VertexBuffer implementation.
-
-#include "libANGLE/renderer/d3d/d3d9/VertexBuffer9.h"
-#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
-#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
-#include "libANGLE/renderer/d3d/d3d9/vertexconversion.h"
-#include "libANGLE/renderer/d3d/BufferD3D.h"
-#include "libANGLE/VertexAttribute.h"
-#include "libANGLE/Buffer.h"
-
-namespace rx
-{
-
-VertexBuffer9::VertexBuffer9(Renderer9 *renderer) : mRenderer(renderer)
-{
- mVertexBuffer = nullptr;
- mBufferSize = 0;
- mDynamicUsage = false;
-}
-
-VertexBuffer9::~VertexBuffer9()
-{
- SafeRelease(mVertexBuffer);
-}
-
-gl::Error VertexBuffer9::initialize(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);
-
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to allocate internal vertex buffer of size " << size;
- }
- }
-
- mBufferSize = size;
- mDynamicUsage = dynamicUsage;
- return gl::NoError();
-}
-
-gl::Error VertexBuffer9::storeVertexAttributes(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- GLsizei count,
- GLsizei instances,
- unsigned int offset,
- const uint8_t *sourceData)
-{
- if (!mVertexBuffer)
- {
- return gl::OutOfMemory() << "Internal vertex buffer is not initialized.";
- }
-
- int inputStride = static_cast<int>(gl::ComputeVertexAttributeStride(attrib, binding));
- int elementSize = static_cast<int>(gl::ComputeVertexAttributeTypeSize(attrib));
-
- DWORD lockFlags = mDynamicUsage ? D3DLOCK_NOOVERWRITE : 0;
-
- uint8_t *mapPtr = nullptr;
-
- auto errorOrMapSize = mRenderer->getVertexSpaceRequired(attrib, binding, count, instances);
- if (errorOrMapSize.isError())
- {
- return errorOrMapSize.getError();
- }
-
- unsigned int mapSize = errorOrMapSize.getResult();
-
- HRESULT result = mVertexBuffer->Lock(offset, mapSize, reinterpret_cast<void**>(&mapPtr), lockFlags);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock internal vertex buffer, " << gl::FmtHR(result);
- }
-
- const uint8_t *input = sourceData;
-
- if (instances == 0 || binding.getDivisor() == 0)
- {
- input += inputStride * start;
- }
-
- gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib, currentValueType);
- const d3d9::VertexFormat &d3dVertexInfo = d3d9::GetVertexFormatInfo(mRenderer->getCapsDeclTypes(), vertexFormatType);
- bool needsConversion = (d3dVertexInfo.conversionType & VERTEX_CONVERT_CPU) > 0;
-
- if (!needsConversion && inputStride == elementSize)
- {
- size_t copySize = static_cast<size_t>(count) * static_cast<size_t>(inputStride);
- memcpy(mapPtr, input, copySize);
- }
- else
- {
- d3dVertexInfo.copyFunction(input, inputStride, count, mapPtr);
- }
-
- mVertexBuffer->Unlock();
-
- return gl::NoError();
-}
-
-unsigned int VertexBuffer9::getBufferSize() const
-{
- return mBufferSize;
-}
-
-gl::Error VertexBuffer9::setBufferSize(unsigned int size)
-{
- if (size > mBufferSize)
- {
- return initialize(size, mDynamicUsage);
- }
- else
- {
- return gl::NoError();
- }
-}
-
-gl::Error VertexBuffer9::discard()
-{
- if (!mVertexBuffer)
- {
- return gl::OutOfMemory() << "Internal vertex buffer is not initialized.";
- }
-
- void *dummy;
- HRESULT result;
-
- result = mVertexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock internal buffer for discarding, "
- << gl::FmtHR(result);
- }
-
- result = mVertexBuffer->Unlock();
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to unlock internal buffer for discarding, "
- << gl::FmtHR(result);
- }
-
- return gl::NoError();
-}
-
-IDirect3DVertexBuffer9 * VertexBuffer9::getBuffer() const
-{
- return mVertexBuffer;
-}
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h
deleted file mode 100644
index 983616f4e4..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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);
-
- gl::Error initialize(unsigned int size, bool dynamicUsage) override;
-
- // Warning: you should ensure binding really matches attrib.bindingIndex before using this
- // function.
- gl::Error storeVertexAttributes(const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- GLsizei count,
- GLsizei instances,
- unsigned int offset,
- const uint8_t *sourceData) override;
-
- unsigned int getBufferSize() const override;
- gl::Error setBufferSize(unsigned int size) override;
- gl::Error discard() override;
-
- IDirect3DVertexBuffer9 *getBuffer() const;
-
- private:
- ~VertexBuffer9() override;
- Renderer9 *mRenderer;
-
- IDirect3DVertexBuffer9 *mVertexBuffer;
- unsigned int mBufferSize;
- bool mDynamicUsage;
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXBUFFER9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
deleted file mode 100644
index abadf5c0b5..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// VertexDeclarationCache.cpp: Implements a helper class to construct and cache vertex declarations.
-
-#include "libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h"
-
-#include "libANGLE/VertexAttribute.h"
-#include "libANGLE/formatutils.h"
-#include "libANGLE/renderer/d3d/ProgramD3D.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);
- }
-}
-
-gl::Error VertexDeclarationCache::applyDeclaration(
- 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_RESULT(attributes[i].computeOffset(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;
- }
-
- gl::VertexFormatType vertexformatType =
- gl::GetVertexFormatType(*attributes[i].attribute, GL_FLOAT);
- const d3d9::VertexFormat &d3d9VertexInfo = d3d9::GetVertexFormatInfo(caps.DeclTypes, vertexformatType);
-
- 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 gl::NoError();
- }
- }
-
- 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);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to create internal vertex declaration, "
- << gl::FmtHR(result);
- }
-
- device->SetVertexDeclaration(lastCache->vertexDeclaration);
- mLastSetVDecl = lastCache->vertexDeclaration;
- lastCache->lruCount = ++mMaxLru;
-
- return gl::NoError();
-}
-
-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
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h
deleted file mode 100644
index 7bd7cabae4..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// 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 rx
-{
-
-class VertexDeclarationCache
-{
- public:
- VertexDeclarationCache();
- ~VertexDeclarationCache();
-
- gl::Error applyDeclaration(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];
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXDECLARATIONCACHE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp
deleted file mode 100644
index d10fa1ee87..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp
+++ /dev/null
@@ -1,652 +0,0 @@
-//
-// 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::Format::ID::NONE)
-{
-}
-
-D3DFormat::D3DFormat(GLuint bits,
- GLuint blockWidth,
- GLuint blockHeight,
- GLuint redBits,
- GLuint greenBits,
- GLuint blueBits,
- GLuint alphaBits,
- GLuint lumBits,
- GLuint depthBits,
- GLuint stencilBits,
- Format::ID 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, Format::ID::NONE);
- return info;
- }
-
- if (format == D3DFMT_INTZ)
- {
- static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 8, Format::ID::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, Format::ID::NONE);
- return info;
- }
-
- case D3DFMT_L8:
- {
- static const D3DFormat info(8, 1, 1, 0, 0, 0, 0, 8, 0, 0, Format::ID::L8_UNORM);
- return info;
- }
- case D3DFMT_A8:
- {
- static const D3DFormat info(8, 1, 1, 0, 0, 0, 8, 0, 0, 0, Format::ID::A8_UNORM);
- return info;
- }
- case D3DFMT_A8L8:
- {
- static const D3DFormat info(16, 1, 1, 0, 0, 0, 8, 8, 0, 0, Format::ID::L8A8_UNORM);
- return info;
- }
-
- case D3DFMT_A4R4G4B4:
- {
- static const D3DFormat info(16, 1, 1, 4, 4, 4, 4, 0, 0, 0, Format::ID::B4G4R4A4_UNORM);
- return info;
- }
- case D3DFMT_A1R5G5B5:
- {
- static const D3DFormat info(16, 1, 1, 5, 5, 5, 1, 0, 0, 0, Format::ID::B5G5R5A1_UNORM);
- return info;
- }
- case D3DFMT_R5G6B5:
- {
- static const D3DFormat info(16, 1, 1, 5, 6, 5, 0, 0, 0, 0, Format::ID::R5G6B5_UNORM);
- return info;
- }
- case D3DFMT_X8R8G8B8:
- {
- static const D3DFormat info(32, 1, 1, 8, 8, 8, 0, 0, 0, 0, Format::ID::B8G8R8X8_UNORM);
- return info;
- }
- case D3DFMT_A8R8G8B8:
- {
- static const D3DFormat info(32, 1, 1, 8, 8, 8, 8, 0, 0, 0, Format::ID::B8G8R8A8_UNORM);
- return info;
- }
-
- case D3DFMT_R16F:
- {
- static const D3DFormat info(16, 1, 1, 16, 0, 0, 0, 0, 0, 0, Format::ID::R16_FLOAT);
- return info;
- }
- case D3DFMT_G16R16F:
- {
- static const D3DFormat info(32, 1, 1, 16, 16, 0, 0, 0, 0, 0, Format::ID::R16G16_FLOAT);
- return info;
- }
- case D3DFMT_A16B16G16R16F:
- {
- static const D3DFormat info(64, 1, 1, 16, 16, 16, 16, 0, 0, 0,
- Format::ID::R16G16B16A16_FLOAT);
- return info;
- }
- case D3DFMT_R32F:
- {
- static const D3DFormat info(32, 1, 1, 32, 0, 0, 0, 0, 0, 0, Format::ID::R32_FLOAT);
- return info;
- }
- case D3DFMT_G32R32F:
- {
- static const D3DFormat info(64, 1, 1, 32, 32, 0, 0, 0, 0, 0, Format::ID::R32G32_FLOAT);
- return info;
- }
- case D3DFMT_A32B32G32R32F:
- {
- static const D3DFormat info(128, 1, 1, 32, 32, 32, 32, 0, 0, 0,
- Format::ID::R32G32B32A32_FLOAT);
- return info;
- }
-
- case D3DFMT_D16:
- {
- static const D3DFormat info(16, 1, 1, 0, 0, 0, 0, 0, 16, 0, Format::ID::D16_UNORM);
- return info;
- }
- case D3DFMT_D24S8:
- {
- static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 8,
- Format::ID::D24_UNORM_S8_UINT);
- return info;
- }
- case D3DFMT_D24X8:
- {
- static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 0, Format::ID::D16_UNORM);
- return info;
- }
- case D3DFMT_D32:
- {
- static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 32, 0, Format::ID::D32_UNORM);
- return info;
- }
-
- case D3DFMT_DXT1:
- {
- static const D3DFormat info(64, 4, 4, 0, 0, 0, 0, 0, 0, 0,
- Format::ID::BC1_RGBA_UNORM_BLOCK);
- return info;
- }
- case D3DFMT_DXT3:
- {
- static const D3DFormat info(128, 4, 4, 0, 0, 0, 0, 0, 0, 0,
- Format::ID::BC2_RGBA_UNORM_BLOCK);
- return info;
- }
- case D3DFMT_DXT5:
- {
- static const D3DFormat info(128, 4, 4, 0, 0, 0, 0, 0, 0, 0,
- Format::ID::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, 8> );
- InsertD3D9FormatInfo(&map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, D3DFMT_DXT1, D3DFMT_UNKNOWN, LoadCompressedToNative<4, 4, 8> );
- InsertD3D9FormatInfo(&map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, D3DFMT_DXT3, D3DFMT_UNKNOWN, LoadCompressedToNative<4, 4, 16> );
- InsertD3D9FormatInfo(&map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, D3DFMT_DXT5, D3DFMT_UNKNOWN, LoadCompressedToNative<4, 4, 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, gl::VertexFormatType vertexFormatType)
-{
- 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::GetVertexFormatFromType(vertexFormatType);
-
- // Pure integer attributes only supported in ES3.0
- ASSERT(!vertexFormat.pureInteger);
- return formatConverters[ComputeTypeIndex(vertexFormat.type)][vertexFormat.normalized][vertexFormat.components - 1];
-}
-
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.h
deleted file mode 100644
index 1bef320b53..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.h
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// 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/renderer_utils.h"
-#include "libANGLE/renderer/d3d/formatutilsD3D.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::Format::ID 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::Format::ID 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, gl::VertexFormatType vertexFormatType);
-
-struct TextureFormat
-{
- TextureFormat();
-
- D3DFORMAT texFormat;
- D3DFORMAT renderFormat;
-
- InitializeTextureDataFunction dataInitializerFunction;
-
- LoadImageFunction loadFunction;
-};
-const TextureFormat &GetTextureFormatInfo(GLenum internalFormat);
-
-}
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_FORMATUTILS9_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
deleted file mode 100644
index fd451a6e51..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
+++ /dev/null
@@ -1,671 +0,0 @@
-//
-// 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/mathutil.h"
-#include "common/debug.h"
-
-#include "libANGLE/formatutils.h"
-#include "libANGLE/Framebuffer.h"
-#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
-#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
-#include "libANGLE/renderer/d3d/FramebufferD3D.h"
-#include "libANGLE/renderer/driver_utils.h"
-#include "platform/Platform.h"
-#include "platform/WorkaroundsD3D.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_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(GLenum cubeFace)
-{
- D3DCUBEMAP_FACES face = D3DCUBEMAP_FACE_POSITIVE_X;
-
- switch (cubeFace)
- {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- face = D3DCUBEMAP_FACE_POSITIVE_X;
- break;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- face = D3DCUBEMAP_FACE_NEGATIVE_X;
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- face = D3DCUBEMAP_FACE_POSITIVE_Y;
- break;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- face = D3DCUBEMAP_FACE_NEGATIVE_Y;
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- face = D3DCUBEMAP_FACE_POSITIVE_Z;
- break;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = D3DCUBEMAP_FACE_NEGATIVE_Z;
- break;
- default: UNREACHABLE();
- }
-
- return face;
-}
-
-DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha)
-{
- return (red ? D3DCOLORWRITEENABLE_RED : 0) |
- (green ? D3DCOLORWRITEENABLE_GREEN : 0) |
- (blue ? D3DCOLORWRITEENABLE_BLUE : 0) |
- (alpha ? D3DCOLORWRITEENABLE_ALPHA : 0);
-}
-
-D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter, float maxAnisotropy)
-{
- if (maxAnisotropy > 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(GLenum queryType)
-{
- switch (queryType)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- return D3DQUERYTYPE_OCCLUSION;
- case GL_COMMANDS_COMPLETED_CHROMIUM:
- 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 d3d9_gl
-{
-
-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.renderable = SUCCEEDED(d3d9->CheckDeviceFormat(adapter, deviceType, adapterFormat, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, d3dFormatInfo.renderFormat));
-
- if ((formatInfo.depthBits > 0 || formatInfo.stencilBits > 0) && !textureCaps.renderable)
- {
- textureCaps.renderable = SUCCEEDED(d3d9->CheckDeviceFormat(adapter, deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, d3dFormatInfo.renderFormat));
- }
-
- 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->maxVertexUniformComponents = caps->maxVertexUniformVectors * 4;
-
- caps->maxVertexUniformBlocks = 0;
-
- // SM3 only supports 11 output variables, with a special 12th register for PSIZE.
- const size_t MAX_VERTEX_OUTPUT_VECTORS_SM3 = 9;
- const size_t MAX_VERTEX_OUTPUT_VECTORS_SM2 = 7;
- caps->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->maxVertexTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS_VTF_SM3;
- }
- else
- {
- caps->maxVertexTextureImageUnits = 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->maxFragmentUniformComponents = caps->maxFragmentUniformVectors * 4;
- caps->maxFragmentUniformBlocks = 0;
- caps->maxFragmentInputComponents = caps->maxVertexOutputComponents;
- caps->maxTextureImageUnits = 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->maxCombinedVertexUniformComponents = 0;
- caps->maxCombinedFragmentUniformComponents = 0;
- caps->maxVaryingComponents = 0;
-
- // Aggregate shader limits
- caps->maxVaryingVectors = caps->maxVertexOutputComponents / 4;
- caps->maxCombinedTextureImageUnits = caps->maxVertexTextureImageUnits + caps->maxTextureImageUnits;
-
- // 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;
-
- // 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->depthTextures = 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;
- extensions->framebufferBlit = true;
- extensions->framebufferMultisample = true;
- extensions->instancedArrays = deviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0);
- 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;
-
- // 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;
-}
-
-}
-
-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;
-}
-
-angle::WorkaroundsD3D GenerateWorkarounds()
-{
- angle::WorkaroundsD3D workarounds;
- workarounds.mrtPerfWorkaround = true;
- workarounds.setDataFasterThanImageUpload = false;
- workarounds.useInstancedPointSpriteEmulation = false;
-
- // TODO(jmadill): Disable workaround when we have a fixed compiler DLL.
- workarounds.expandIntegerPowExpressions = true;
-
- // Call platform hooks for testing overrides.
- auto *platform = ANGLEPlatformCurrent();
- platform->overrideWorkaroundsD3D(platform, &workarounds);
-
- return workarounds;
-}
-
-} // namespace d3d9
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h
deleted file mode 100644
index 5b65b8910a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// 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/WorkaroundsD3D.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(GLenum cubeFace);
-DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha);
-D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter, float maxAnisotropy);
-void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter,
- float *d3dLodBias, float maxAnisotropy, size_t baseLevel);
-D3DQUERYTYPE ConvertQueryType(GLenum queryType);
-
-D3DMULTISAMPLE_TYPE GetMultisampleType(GLuint samples);
-
-}
-
-namespace d3d9_gl
-{
-
-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
-{
-
-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;
- }
-}
-
-angle::WorkaroundsD3D GenerateWorkarounds();
-}
-
-} // namespace d3d9
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_RENDERER9UTILS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.ps b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.ps
deleted file mode 100644
index ecc593cc78..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.ps
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-sampler2D tex : s0;
-
-uniform float4 mult : c0;
-uniform float4 add : c1;
-
-// Passthrough Pixel Shader
-// Outputs texture 0 sampled at texcoord 0.
-float4 passthroughps(float4 texcoord : TEXCOORD0) : COLOR
-{
- return tex2D(tex, texcoord.xy);
-};
-
-// Luminance Conversion Pixel Shader
-// Performs a mad operation using the LA data from the texture with mult.xw and add.xw.
-// Returns data in the form of llla
-float4 luminanceps(float4 texcoord : TEXCOORD0) : COLOR
-{
- return (tex2D(tex, texcoord.xy).xw * mult.xw + add.xw).xxxy;
-};
-
-float4 luminancepremultps(float4 texcoord : TEXCOORD0) : COLOR
-{
- float4 luma = tex2D(tex, texcoord.xy).xxxw;
- luma.rgb *= luma.a;
- return luma * mult + add;
-};
-
-float4 luminanceunmultps(float4 texcoord : TEXCOORD0) : COLOR
-{
- float4 luma = tex2D(tex, texcoord.xy).xxxw;
- if (luma.a > 0.0f)
- {
- luma.rgb /= luma.a;
- }
- return luma * mult + add;
-};
-
-// RGB/A Component Mask Pixel Shader
-// Performs a mad operation using the texture's RGBA data with mult.xyzw and add.xyzw.
-// Returns data in the form of rgba
-float4 componentmaskps(float4 texcoord : TEXCOORD0) : COLOR
-{
- return tex2D(tex, texcoord.xy) * mult + add;
-};
-
-float4 componentmaskpremultps(float4 texcoord : TEXCOORD0) : COLOR
-{
- float4 color = tex2D(tex, texcoord.xy);
- color.rgb *= color.a;
- return color * mult + add;
-};
-
-float4 componentmaskunmultps(float4 texcoord : TEXCOORD0) : COLOR
-{
- float4 color = tex2D(tex, texcoord.xy);
- if (color.a > 0.0f)
- {
- color.rgb /= color.a;
- }
- return color * mult + add;
-};
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.vs b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.vs
deleted file mode 100644
index c68395a69c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.vs
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-struct VS_OUTPUT
-{
- float4 position : POSITION;
- float4 texcoord : TEXCOORD0;
-};
-
-uniform float4 halfPixelSize : c0;
-uniform float4 texcoordOffset : c1;
-
-// Standard Vertex Shader
-// Input 0 is the homogenous position.
-// Outputs the homogenous position as-is.
-// Outputs a tex coord with (0,0) in the upper-left corner of the screen and (1,1) in the bottom right.
-// C0.X must be negative half-pixel width, C0.Y must be half-pixel height. C0.ZW must be 0.
-VS_OUTPUT standardvs(in float4 position : POSITION)
-{
- VS_OUTPUT Out;
-
- Out.position = position + halfPixelSize;
- Out.texcoord = ((position * float4(0.5, -0.5, 1.0, 1.0) + float4(0.5, 0.5, 0, 0)) * float4(texcoordOffset.zw, 1.0, 1.0)) + float4(texcoordOffset.xy, 0, 0);
-
- return Out;
-};
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h
deleted file mode 100644
index aa05934bc8..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h
+++ /dev/null
@@ -1,200 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// vertexconversion.h: A library of vertex conversion classes that can be used to build
-// the FormatConverter objects used by the buffer conversion system.
-
-#ifndef LIBANGLE_RENDERER_D3D_D3D9_VERTEXCONVERSION_H_
-#define LIBANGLE_RENDERER_D3D_D3D9_VERTEXCONVERSION_H_
-
-#include <limits>
-#include <cstdint>
-#include <cstddef>
-
-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;
- }
- }
- }
-};
-
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXCONVERSION_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/formatutilsD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/formatutilsD3D.h
deleted file mode 100644
index a245a0432f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/formatutilsD3D.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// formatutils9.h: Queries for GL image formats and their translations to D3D
-// formats.
-
-#ifndef LIBANGLE_RENDERER_D3D_FORMATUTILSD3D_H_
-#define LIBANGLE_RENDERER_D3D_FORMATUTILSD3D_H_
-
-#include "angle_gl.h"
-
-#include <cstddef>
-#include <stdint.h>
-
-#include <map>
-
-namespace gl
-{
-struct FormatType;
-}
-
-namespace rx
-{
-typedef void (*VertexCopyFunction)(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
-
-enum VertexConversionType
-{
- VERTEX_CONVERT_NONE = 0,
- VERTEX_CONVERT_CPU = 1,
- VERTEX_CONVERT_GPU = 2,
- VERTEX_CONVERT_BOTH = 3
-};
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_FORMATUTILSD3D_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/driver_utils.cpp b/src/3rdparty/angle/src/libANGLE/renderer/driver_utils.cpp
deleted file mode 100644
index d97b8e7c22..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/driver_utils.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// 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"
-
-namespace rx
-{
-// Intel
-// Referenced from https://cgit.freedesktop.org/vaapi/intel-driver/tree/src/i965_pciids.h
-namespace
-{
-// gen7
-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 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);
-}
-
-} // namespace rx \ No newline at end of file
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/driver_utils.h b/src/3rdparty/angle/src/libANGLE/renderer/driver_utils.h
deleted file mode 100644
index 62bdc502fc..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/driver_utils.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// 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 "libANGLE/angletypes.h"
-
-namespace rx
-{
-
-enum VendorID : uint32_t
-{
- VENDOR_ID_UNKNOWN = 0x0,
- VENDOR_ID_AMD = 0x1002,
- 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,
-};
-
-inline bool IsAMD(uint32_t vendor_id)
-{
- return vendor_id == VENDOR_ID_AMD;
-}
-
-inline bool IsIntel(uint32_t vendor_id)
-{
- return vendor_id == VENDOR_ID_INTEL;
-}
-
-inline bool IsNvidia(uint32_t vendor_id)
-{
- return vendor_id == VENDOR_ID_NVIDIA;
-}
-
-inline bool IsQualcomm(uint32_t vendor_id)
-{
- return vendor_id == VENDOR_ID_QUALCOMM;
-}
-
-// 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 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);
-
-} // namespace rx
-#endif // LIBANGLE_RENDERER_DRIVER_UTILS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/load_functions_data.json b/src/3rdparty/angle/src/libANGLE/renderer/load_functions_data.json
deleted file mode 100644
index 198274998c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/load_functions_data.json
+++ /dev/null
@@ -1,602 +0,0 @@
-{
- "GL_RG8_SNORM": {
- "R8G8_SNORM": {
- "GL_BYTE": "LoadToNative<GLbyte, 2>"
- }
- },
- "GL_SRGB8": {
- "R8G8B8A8_UNORM_SRGB": {
- "GL_UNSIGNED_BYTE": "LoadToNative3To4<GLubyte, 0xFF>"
- }
- },
- "GL_RGBA8I": {
- "R8G8B8A8_SINT": {
- "GL_BYTE": "LoadToNative<GLbyte, 4>"
- }
- },
- "GL_R8_SNORM": {
- "R8_SNORM": {
- "GL_BYTE": "LoadToNative<GLbyte, 1>"
- }
- },
- "GL_RGBA8_SNORM": {
- "R8G8B8A8_SNORM": {
- "GL_BYTE": "LoadToNative<GLbyte, 4>"
- }
- },
- "GL_R16I": {
- "R16_SINT": {
- "GL_SHORT": "LoadToNative<GLshort, 1>"
- }
- },
- "GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC": {
- "R8G8B8A8_UNORM_SRGB": {
- "GL_UNSIGNED_BYTE": "LoadETC2SRGBA8ToSRGBA8"
- }
- },
- "GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2": {
- "R8G8B8A8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadETC2RGB8A1ToRGBA8"
- }
- },
- "GL_RGB32UI": {
- "R32G32B32A32_UINT": {
- "GL_UNSIGNED_INT": "LoadToNative3To4<GLuint, 0x00000001>"
- }
- },
- "GL_ALPHA32F_EXT": {
- "NONE": {
- "GL_FLOAT": "LoadA32FToRGBA32F"
- }
- },
- "GL_R16UI": {
- "R16_UINT": {
- "GL_UNSIGNED_SHORT": "LoadToNative<GLushort, 1>"
- }
- },
- "GL_RGB9_E5": {
- "R9G9B9E5_SHAREDEXP": {
- "GL_HALF_FLOAT": "LoadRGB16FToRGB9E5",
- "GL_UNSIGNED_INT_5_9_9_9_REV": "LoadToNative<GLuint, 1>",
- "GL_FLOAT": "LoadRGB32FToRGB9E5",
- "GL_HALF_FLOAT_OES": "LoadRGB16FToRGB9E5"
- }
- },
- "GL_COMPRESSED_R11_EAC": {
- "R8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadEACR11ToR8"
- }
- },
- "GL_RGBA32UI": {
- "R32G32B32A32_UINT": {
- "GL_UNSIGNED_INT": "LoadToNative<GLuint, 4>"
- }
- },
- "GL_RG8UI": {
- "R8G8_UINT": {
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 2>"
- }
- },
- "GL_LUMINANCE32F_EXT": {
- "NONE": {
- "GL_FLOAT": "LoadL32FToRGBA32F"
- }
- },
- "GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2": {
- "R8G8B8A8_UNORM_SRGB": {
- "GL_UNSIGNED_BYTE": "LoadETC2SRGB8A1ToRGBA8"
- }
- },
- "GL_R16F": {
- "R16_FLOAT": {
- "GL_HALF_FLOAT": "LoadToNative<GLhalf, 1>",
- "GL_FLOAT": "Load32FTo16F<1>",
- "GL_HALF_FLOAT_OES": "LoadToNative<GLhalf, 1>"
- }
- },
- "GL_RGBA8UI": {
- "R8G8B8A8_UINT": {
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 4>"
- }
- },
- "GL_BGRA4_ANGLEX": {
- "NONE": {
- "GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT": "LoadRGBA4ToRGBA8",
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 4>"
- }
- },
- "GL_RGBA16F": {
- "R16G16B16A16_FLOAT": {
- "GL_HALF_FLOAT": "LoadToNative<GLhalf, 4>",
- "GL_FLOAT": "Load32FTo16F<4>",
- "GL_HALF_FLOAT_OES": "LoadToNative<GLhalf, 4>"
- }
- },
- "GL_LUMINANCE8_EXT": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "LoadL8ToRGBA8"
- }
- },
- "GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "LoadCompressedToNative<4, 4, 16>"
- }
- },
- "GL_RGB": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "UnreachableLoadFunction",
- "GL_UNSIGNED_SHORT_5_6_5": "UnreachableLoadFunction"
- }
- },
- "GL_RGB5_A1": {
- "R8G8B8A8_UNORM": {
- "GL_UNSIGNED_INT_2_10_10_10_REV": "LoadRGB10A2ToRGBA8",
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 4>",
- "GL_UNSIGNED_SHORT_5_5_5_1": "LoadRGB5A1ToRGBA8"
- },
- "B5G5R5A1_UNORM": {
- "GL_UNSIGNED_INT_2_10_10_10_REV": "LoadRGB10A2ToBGR5A1",
- "GL_UNSIGNED_BYTE": "LoadRGBA8ToBGR5A1",
- "GL_UNSIGNED_SHORT_5_5_5_1": "LoadRGB5A1ToA1RGB5"
- }
- },
- "GL_RGB16UI": {
- "R16G16B16A16_UINT": {
- "GL_UNSIGNED_SHORT": "LoadToNative3To4<GLushort, 0x0001>"
- }
- },
- "GL_BGRA_EXT": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "UnreachableLoadFunction"
- }
- },
- "GL_COMPRESSED_RGB8_ETC2": {
- "R8G8B8A8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadETC2RGB8ToRGBA8"
- }
- },
- "GL_RGBA32F": {
- "R32G32B32A32_FLOAT": {
- "GL_FLOAT": "LoadToNative<GLfloat, 4>"
- }
- },
- "GL_RGBA32I": {
- "R32G32B32A32_SINT": {
- "GL_INT": "LoadToNative<GLint, 4>"
- }
- },
- "GL_LUMINANCE8_ALPHA8_EXT": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "LoadLA8ToRGBA8"
- }
- },
- "GL_RG8": {
- "R8G8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 2>"
- }
- },
- "GL_RGB10_A2": {
- "R10G10B10A2_UNORM": {
- "GL_UNSIGNED_INT_2_10_10_10_REV": "LoadToNative<GLuint, 1>"
- }
- },
- "GL_COMPRESSED_SIGNED_RG11_EAC": {
- "R8G8_SNORM": {
- "GL_UNSIGNED_BYTE": "LoadEACRG11SToRG8"
- }
- },
- "GL_DEPTH_COMPONENT16": {
- "D16_UNORM": {
- "GL_UNSIGNED_INT": "LoadR32ToR16",
- "GL_UNSIGNED_SHORT": "LoadToNative<GLushort, 1>"
- }
- },
- "GL_RGB32I": {
- "R32G32B32A32_SINT": {
- "GL_INT": "LoadToNative3To4<GLint, 0x00000001>"
- }
- },
- "GL_R8": {
- "R8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 1>"
- }
- },
- "GL_RGB32F": {
- "R32G32B32A32_FLOAT": {
- "GL_FLOAT": "LoadToNative3To4<GLfloat, gl::Float32One>"
- }
- },
- "GL_R11F_G11F_B10F": {
- "R11G11B10_FLOAT": {
- "GL_UNSIGNED_INT_10F_11F_11F_REV": "LoadToNative<GLuint, 1>",
- "GL_HALF_FLOAT": "LoadRGB16FToRG11B10F",
- "GL_FLOAT": "LoadRGB32FToRG11B10F",
- "GL_HALF_FLOAT_OES": "LoadRGB16FToRG11B10F"
- }
- },
- "GL_RGB8": {
- "R8G8B8A8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadToNative3To4<GLubyte, 0xFF>"
- }
- },
- "GL_LUMINANCE_ALPHA": {
- "R16G16B16A16_FLOAT": {
- "GL_HALF_FLOAT": "LoadLA16FToRGBA16F",
- "GL_HALF_FLOAT_OES": "LoadLA16FToRGBA16F"
- },
- "NONE": {
- "GL_UNSIGNED_BYTE": "UnreachableLoadFunction"
- },
- "R32G32B32A32_FLOAT": {
- "GL_FLOAT": "LoadLA32FToRGBA32F"
- }
- },
- "GL_RGBA16I": {
- "R16G16B16A16_SINT": {
- "GL_SHORT": "LoadToNative<GLshort, 4>"
- }
- },
- "GL_R8I": {
- "R8_SINT": {
- "GL_BYTE": "LoadToNative<GLbyte, 1>"
- }
- },
- "GL_RGB8_SNORM": {
- "R8G8B8A8_SNORM": {
- "GL_BYTE": "LoadToNative3To4<GLbyte, 0x7F>"
- }
- },
- "GL_RG32F": {
- "R32G32_FLOAT": {
- "GL_FLOAT": "LoadToNative<GLfloat, 2>"
- }
- },
- "GL_DEPTH_COMPONENT32F": {
- "D32_FLOAT": {
- "GL_FLOAT": "LoadD32FToD32F"
- }
- },
- "GL_RG32I": {
- "R32G32_SINT": {
- "GL_INT": "LoadToNative<GLint, 2>"
- }
- },
- "GL_ALPHA8_EXT": {
- "A8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 1>"
- },
- "R8G8B8A8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadA8ToRGBA8"
- }
- },
- "GL_RG32UI": {
- "R32G32_UINT": {
- "GL_UNSIGNED_INT": "LoadToNative<GLuint, 2>"
- }
- },
- "GL_RGBA16UI": {
- "R16G16B16A16_UINT": {
- "GL_UNSIGNED_SHORT": "LoadToNative<GLushort, 4>"
- }
- },
- "GL_COMPRESSED_RGBA8_ETC2_EAC": {
- "R8G8B8A8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadETC2RGBA8ToRGBA8"
- }
- },
- "GL_RGB8I": {
- "R8G8B8A8_SINT": {
- "GL_BYTE": "LoadToNative3To4<GLbyte, 0x01>"
- }
- },
- "GL_COMPRESSED_SRGB8_ETC2": {
- "R8G8B8A8_UNORM_SRGB": {
- "GL_UNSIGNED_BYTE": "LoadETC2SRGB8ToRGBA8"
- }
- },
- "GL_DEPTH32F_STENCIL8": {
- "D32_FLOAT_S8X24_UINT": {
- "GL_FLOAT_32_UNSIGNED_INT_24_8_REV": "LoadD32FS8X24ToD32FS8X24"
- }
- },
- "GL_RG8I": {
- "R8G8_SINT": {
- "GL_BYTE": "LoadToNative<GLbyte, 2>"
- }
- },
- "GL_R32UI": {
- "R32_UINT": {
- "GL_UNSIGNED_INT": "LoadToNative<GLuint, 1>"
- }
- },
- "GL_BGR5_A1_ANGLEX": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 4>",
- "GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT": "LoadRGB5A1ToRGBA8"
- }
- },
- "GL_BGR565_ANGLEX": {
- "B5G6R5_UNORM": {
- "GL_UNSIGNED_SHORT_5_6_5": "LoadRGB565ToBGR565",
- "GL_UNSIGNED_BYTE": "LoadToNative<GLushort, 1>"
- }
- },
- "GL_COMPRESSED_RG11_EAC": {
- "R8G8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadEACRG11ToRG8"
- }
- },
- "GL_SRGB8_ALPHA8": {
- "R8G8B8A8_UNORM_SRGB": {
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 4>"
- }
- },
- "GL_LUMINANCE_ALPHA16F_EXT": {
- "NONE": {
- "GL_HALF_FLOAT": "LoadLA16FToRGBA16F",
- "GL_HALF_FLOAT_OES": "LoadLA16FToRGBA16F"
- }
- },
- "GL_RGBA": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "UnreachableLoadFunction",
- "GL_UNSIGNED_SHORT_4_4_4_4": "UnreachableLoadFunction",
- "GL_UNSIGNED_SHORT_5_5_5_1": "UnreachableLoadFunction"
- }
- },
- "GL_DEPTH24_STENCIL8": {
- "D24_UNORM_S8_UINT": {
- "GL_UNSIGNED_INT_24_8": "LoadR32ToR24G8"
- }
- },
- "GL_RGB16I": {
- "R16G16B16A16_SINT": {
- "GL_SHORT": "LoadToNative3To4<GLshort, 0x0001>"
- }
- },
- "GL_R8UI": {
- "R8_UINT": {
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 1>"
- }
- },
- "GL_ALPHA": {
- "R16G16B16A16_FLOAT": {
- "GL_HALF_FLOAT": "LoadA16FToRGBA16F",
- "GL_HALF_FLOAT_OES": "LoadA16FToRGBA16F"
- },
- "NONE": {
- "GL_UNSIGNED_BYTE": "UnreachableLoadFunction"
- },
- "R32G32B32A32_FLOAT": {
- "GL_FLOAT": "LoadA32FToRGBA32F"
- }
- },
- "GL_RGB16F": {
- "R16G16B16A16_FLOAT": {
- "GL_HALF_FLOAT": "LoadToNative3To4<GLhalf, gl::Float16One>",
- "GL_FLOAT": "LoadRGB32FToRGBA16F",
- "GL_HALF_FLOAT_OES": "LoadToNative3To4<GLhalf, gl::Float16One>"
- }
- },
- "GL_COMPRESSED_SIGNED_R11_EAC": {
- "R8_SNORM": {
- "GL_UNSIGNED_BYTE": "LoadEACR11SToR8"
- }
- },
- "GL_COMPRESSED_RGB_S3TC_DXT1_EXT": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "LoadCompressedToNative<4, 4, 8>"
- }
- },
- "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "LoadCompressedToNative<4, 4, 8>"
- }
- },
- "GL_STENCIL_INDEX8": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "UnimplementedLoadFunction"
- }
- },
- "GL_LUMINANCE_ALPHA32F_EXT": {
- "NONE": {
- "GL_FLOAT": "LoadLA32FToRGBA32F"
- }
- },
- "GL_RGB8UI": {
- "R8G8B8A8_UINT": {
- "GL_UNSIGNED_BYTE": "LoadToNative3To4<GLubyte, 0x01>"
- }
- },
- "GL_DEPTH_COMPONENT24": {
- "D24_UNORM_S8_UINT": {
- "GL_UNSIGNED_INT": "LoadR32ToR24G8"
- }
- },
- "GL_R32I": {
- "R32_SINT": {
- "GL_INT": "LoadToNative<GLint, 1>"
- }
- },
- "GL_DEPTH_COMPONENT32_OES": {
- "NONE": {
- "GL_UNSIGNED_INT": "LoadR32ToR24G8"
- }
- },
- "GL_R32F": {
- "R32_FLOAT": {
- "GL_FLOAT": "LoadToNative<GLfloat, 1>"
- }
- },
- "GL_RG16F": {
- "R16G16_FLOAT": {
- "GL_HALF_FLOAT": "LoadToNative<GLhalf, 2>",
- "GL_FLOAT": "Load32FTo16F<2>",
- "GL_HALF_FLOAT_OES": "LoadToNative<GLhalf, 2>"
- }
- },
- "GL_RGB565": {
- "R8G8B8A8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadToNative3To4<GLubyte, 0xFF>",
- "GL_UNSIGNED_SHORT_5_6_5": "LoadR5G6B5ToRGBA8"
- },
- "B5G6R5_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadRGB8ToBGR565",
- "GL_UNSIGNED_SHORT_5_6_5": "LoadToNative<GLushort, 1>"
- }
- },
- "GL_LUMINANCE16F_EXT": {
- "NONE": {
- "GL_HALF_FLOAT": "LoadL16FToRGBA16F",
- "GL_HALF_FLOAT_OES": "LoadL16FToRGBA16F"
- }
- },
- "GL_RG16UI": {
- "R16G16_UINT": {
- "GL_UNSIGNED_SHORT": "LoadToNative<GLushort, 2>"
- }
- },
- "GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "LoadCompressedToNative<4, 4, 16>"
- }
- },
- "GL_RG16I": {
- "R16G16_SINT": {
- "GL_SHORT": "LoadToNative<GLshort, 2>"
- }
- },
- "GL_BGRA8_EXT": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 4>"
- }
- },
- "GL_ALPHA16F_EXT": {
- "NONE": {
- "GL_HALF_FLOAT": "LoadA16FToRGBA16F",
- "GL_HALF_FLOAT_OES": "LoadA16FToRGBA16F"
- }
- },
- "GL_RGBA4": {
- "R8G8B8A8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 4>",
- "GL_UNSIGNED_SHORT_4_4_4_4": "LoadRGBA4ToRGBA8"
- },
- "B4G4R4A4_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadRGBA8ToBGRA4",
- "GL_UNSIGNED_SHORT_4_4_4_4": "LoadRGBA4ToARGB4"
- }
- },
- "GL_RGBA8": {
- "R8G8B8A8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 4>"
- }
- },
- "GL_LUMINANCE": {
- "R16G16B16A16_FLOAT": {
- "GL_HALF_FLOAT": "LoadL16FToRGBA16F",
- "GL_HALF_FLOAT_OES": "LoadL16FToRGBA16F"
- },
- "NONE": {
- "GL_UNSIGNED_BYTE": "UnreachableLoadFunction"
- },
- "R32G32B32A32_FLOAT": {
- "GL_FLOAT": "LoadL32FToRGBA32F"
- }
- },
- "GL_RGB10_A2UI": {
- "R10G10B10A2_UINT": {
- "GL_UNSIGNED_INT_2_10_10_10_REV": "LoadToNative<GLuint, 1>"
- }
- },
- "GL_ETC1_RGB8_OES": {
- "R8G8B8A8_UNORM": {
- "GL_UNSIGNED_BYTE": "LoadETC1RGB8ToRGBA8"
- }
- },
- "GL_ETC1_RGB8_LOSSY_DECODE_ANGLE": {
- "BC1_RGB_UNORM_BLOCK": {
- "GL_UNSIGNED_BYTE": "LoadETC1RGB8ToBC1"
- }
- },
- "GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE": {
- "BC1_RGB_UNORM_BLOCK": {
- "GL_UNSIGNED_BYTE": "LoadETC2RGB8ToBC1"
- }
- },
- "GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE": {
- "BC1_RGB_UNORM_SRGB_BLOCK": {
- "GL_UNSIGNED_BYTE": "LoadETC2SRGB8ToBC1"
- }
- },
- "GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE": {
- "BC1_RGBA_UNORM_BLOCK": {
- "GL_UNSIGNED_BYTE": "LoadETC2RGB8A1ToBC1"
- }
- },
- "GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE": {
- "BC1_RGBA_UNORM_SRGB_BLOCK": {
- "GL_UNSIGNED_BYTE": "LoadETC2SRGB8A1ToBC1"
- }
- },
- "GL_R16_EXT": {
- "R16_UNORM": {
- "GL_UNSIGNED_SHORT": "LoadToNative<GLushort, 1>"
- }
- },
- "GL_RG16_EXT": {
- "R16G16_UNORM": {
- "GL_UNSIGNED_SHORT": "LoadToNative<GLushort, 2>"
- }
- },
- "GL_RGB16_EXT": {
- "R16G16B16A16_UNORM": {
- "GL_UNSIGNED_SHORT": "LoadToNative3To4<GLushort, 0xFFFF>"
- }
- },
- "GL_RGBA16_EXT": {
- "R16G16B16A16_UNORM": {
- "GL_UNSIGNED_SHORT": "LoadToNative<GLushort, 4>"
- }
- },
- "GL_R16_SNORM_EXT": {
- "R16_SNORM": {
- "GL_SHORT": "LoadToNative<GLushort, 1>"
- }
- },
- "GL_RG16_SNORM_EXT": {
- "R16G16_SNORM": {
- "GL_SHORT": "LoadToNative<GLushort, 2>"
- }
- },
- "GL_RGB16_SNORM_EXT": {
- "R16G16B16A16_SNORM": {
- "GL_SHORT": "LoadToNative3To4<GLushort, 0x7FFF>"
- }
- },
- "GL_RGBA16_SNORM_EXT": {
- "R16G16B16A16_SNORM": {
- "GL_SHORT": "LoadToNative<GLushort, 4>"
- }
- },
- "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "LoadCompressedToNative<4, 4, 16>"
- }
- },
- "GL_COMPRESSED_SRGB_S3TC_DXT1_EXT": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "LoadCompressedToNative<4, 4, 8>"
- }
- },
- "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "LoadCompressedToNative<4, 4, 8>"
- }
- },
- "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT": {
- "NONE": {
- "GL_UNSIGNED_BYTE": "LoadCompressedToNative<4, 4, 16>"
- }
- }
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/load_functions_table.h b/src/3rdparty/angle/src/libANGLE/renderer/load_functions_table.h
deleted file mode 100644
index f3da31c100..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/load_functions_table.h
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// 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, Format::ID angleFormat);
-
-} // namespace angle
-
-#endif // LIBANGLE_RENDERER_LOADFUNCTIONSTABLE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/load_functions_table_autogen.cpp b/src/3rdparty/angle/src/libANGLE/renderer/load_functions_table_autogen.cpp
deleted file mode 100644
index ed9fe2864c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/load_functions_table_autogen.cpp
+++ /dev/null
@@ -1,2459 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by gen_load_functions_table.py using data from load_functions_data.json
-//
-// 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.
-//
-// 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 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 BGR565_ANGLEX_to_B5G6R5_UNORM(GLenum type)
-{
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- return LoadImageFunctionInfo(LoadToNative<GLushort, 1>, false);
- 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(LoadToNative<GLubyte, 4>, false);
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
- return LoadImageFunctionInfo(LoadRGB5A1ToRGBA8, true);
- 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 BGRA_EXT_to_default(GLenum type)
-{
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- return LoadImageFunctionInfo(UnreachableLoadFunction, true);
- default:
- UNREACHABLE();
- return LoadImageFunctionInfo(UnreachableLoadFunction, true);
- }
-}
-
-LoadImageFunctionInfo COMPRESSED_R11_EAC_to_R8_UNORM(GLenum type)
-{
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- return LoadImageFunctionInfo(LoadEACR11ToR8, true);
- default:
- UNREACHABLE();
- return LoadImageFunctionInfo(UnreachableLoadFunction, true);
- }
-}
-
-LoadImageFunctionInfo COMPRESSED_RG11_EAC_to_R8G8_UNORM(GLenum type)
-{
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- return LoadImageFunctionInfo(LoadEACRG11ToRG8, 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_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_R8G8B8A8_UNORM(GLenum type)
-{
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- return LoadImageFunctionInfo(LoadETC2RGBA8ToRGBA8, 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, 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, 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, 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, 8>, true);
- default:
- UNREACHABLE();
- return LoadImageFunctionInfo(UnreachableLoadFunction, true);
- }
-}
-
-LoadImageFunctionInfo COMPRESSED_SIGNED_R11_EAC_to_R8_SNORM(GLenum type)
-{
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- return LoadImageFunctionInfo(LoadEACR11SToR8, true);
- default:
- UNREACHABLE();
- return LoadImageFunctionInfo(UnreachableLoadFunction, true);
- }
-}
-
-LoadImageFunctionInfo COMPRESSED_SIGNED_RG11_EAC_to_R8G8_SNORM(GLenum type)
-{
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- return LoadImageFunctionInfo(LoadEACRG11SToRG8, 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_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_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_S3TC_DXT1_EXT_to_default(GLenum type)
-{
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 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, 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, 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, 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 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_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_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_default(GLenum type)
-{
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- return LoadImageFunctionInfo(LoadLA8ToRGBA8, true);
- default:
- UNREACHABLE();
- return LoadImageFunctionInfo(UnreachableLoadFunction, true);
- }
-}
-
-LoadImageFunctionInfo LUMINANCE8_EXT_to_default(GLenum type)
-{
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- return LoadImageFunctionInfo(LoadL8ToRGBA8, true);
- 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 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 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 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 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 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 RGB16I_to_R16G16B16A16_SINT(GLenum type)
-{
- switch (type)
- {
- case GL_SHORT:
- return LoadImageFunctionInfo(LoadToNative3To4<GLshort, 0x0001>, true);
- 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 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_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 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 RGB32I_to_R32G32B32A32_SINT(GLenum type)
-{
- switch (type)
- {
- case GL_INT:
- return LoadImageFunctionInfo(LoadToNative3To4<GLint, 0x00000001>, true);
- 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 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_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_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 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 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 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 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 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, Format::ID angleFormat)
-{
- // clang-format off
- switch (internalFormat)
- {
- case GL_ALPHA:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_FLOAT:
- return ALPHA_to_R16G16B16A16_FLOAT;
- case Format::ID::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 Format::ID::A8_UNORM:
- return ALPHA8_EXT_to_A8_UNORM;
- case Format::ID::R8G8B8A8_UNORM:
- return ALPHA8_EXT_to_R8G8B8A8_UNORM;
- default:
- break;
- }
- }
- case GL_BGR565_ANGLEX:
- {
- switch (angleFormat)
- {
- case Format::ID::B5G6R5_UNORM:
- return BGR565_ANGLEX_to_B5G6R5_UNORM;
- default:
- 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_BGRA_EXT:
- return BGRA_EXT_to_default;
- case GL_COMPRESSED_R11_EAC:
- {
- switch (angleFormat)
- {
- case Format::ID::R8_UNORM:
- return COMPRESSED_R11_EAC_to_R8_UNORM;
- default:
- break;
- }
- }
- case GL_COMPRESSED_RG11_EAC:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8_UNORM:
- return COMPRESSED_RG11_EAC_to_R8G8_UNORM;
- default:
- break;
- }
- }
- case GL_COMPRESSED_RGB8_ETC2:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UNORM:
- return COMPRESSED_RGB8_ETC2_to_R8G8B8A8_UNORM;
- default:
- break;
- }
- }
- case GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE:
- {
- switch (angleFormat)
- {
- case Format::ID::BC1_RGB_UNORM_BLOCK:
- return COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE_to_BC1_RGB_UNORM_BLOCK;
- default:
- break;
- }
- }
- case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UNORM:
- return COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2_to_R8G8B8A8_UNORM;
- default:
- break;
- }
- }
- case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
- {
- switch (angleFormat)
- {
- case Format::ID::BC1_RGBA_UNORM_BLOCK:
- return COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE_to_BC1_RGBA_UNORM_BLOCK;
- default:
- break;
- }
- }
- case GL_COMPRESSED_RGBA8_ETC2_EAC:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UNORM:
- return COMPRESSED_RGBA8_ETC2_EAC_to_R8G8B8A8_UNORM;
- default:
- break;
- }
- }
- 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_S3TC_DXT1_EXT:
- return COMPRESSED_RGB_S3TC_DXT1_EXT_to_default;
- case GL_COMPRESSED_SIGNED_R11_EAC:
- {
- switch (angleFormat)
- {
- case Format::ID::R8_SNORM:
- return COMPRESSED_SIGNED_R11_EAC_to_R8_SNORM;
- default:
- break;
- }
- }
- case GL_COMPRESSED_SIGNED_RG11_EAC:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8_SNORM:
- return COMPRESSED_SIGNED_RG11_EAC_to_R8G8_SNORM;
- default:
- break;
- }
- }
- case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UNORM_SRGB:
- return COMPRESSED_SRGB8_ALPHA8_ETC2_EAC_to_R8G8B8A8_UNORM_SRGB;
- default:
- break;
- }
- }
- case GL_COMPRESSED_SRGB8_ETC2:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UNORM_SRGB:
- return COMPRESSED_SRGB8_ETC2_to_R8G8B8A8_UNORM_SRGB;
- default:
- break;
- }
- }
- case GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE:
- {
- switch (angleFormat)
- {
- case Format::ID::BC1_RGB_UNORM_SRGB_BLOCK:
- return COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE_to_BC1_RGB_UNORM_SRGB_BLOCK;
- default:
- break;
- }
- }
- case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UNORM_SRGB:
- return COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2_to_R8G8B8A8_UNORM_SRGB;
- default:
- break;
- }
- }
- case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
- {
- switch (angleFormat)
- {
- case Format::ID::BC1_RGBA_UNORM_SRGB_BLOCK:
- return COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE_to_BC1_RGBA_UNORM_SRGB_BLOCK;
- default:
- break;
- }
- }
- 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 Format::ID::D24_UNORM_S8_UINT:
- return DEPTH24_STENCIL8_to_D24_UNORM_S8_UINT;
- default:
- break;
- }
- }
- case GL_DEPTH32F_STENCIL8:
- {
- switch (angleFormat)
- {
- case Format::ID::D32_FLOAT_S8X24_UINT:
- return DEPTH32F_STENCIL8_to_D32_FLOAT_S8X24_UINT;
- default:
- break;
- }
- }
- case GL_DEPTH_COMPONENT16:
- {
- switch (angleFormat)
- {
- case Format::ID::D16_UNORM:
- return DEPTH_COMPONENT16_to_D16_UNORM;
- default:
- break;
- }
- }
- case GL_DEPTH_COMPONENT24:
- {
- switch (angleFormat)
- {
- case Format::ID::D24_UNORM_S8_UINT:
- return DEPTH_COMPONENT24_to_D24_UNORM_S8_UINT;
- default:
- break;
- }
- }
- case GL_DEPTH_COMPONENT32F:
- {
- switch (angleFormat)
- {
- case Format::ID::D32_FLOAT:
- return DEPTH_COMPONENT32F_to_D32_FLOAT;
- default:
- break;
- }
- }
- case GL_DEPTH_COMPONENT32_OES:
- return DEPTH_COMPONENT32_OES_to_default;
- case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
- {
- switch (angleFormat)
- {
- case Format::ID::BC1_RGB_UNORM_BLOCK:
- return ETC1_RGB8_LOSSY_DECODE_ANGLE_to_BC1_RGB_UNORM_BLOCK;
- default:
- break;
- }
- }
- case GL_ETC1_RGB8_OES:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UNORM:
- return ETC1_RGB8_OES_to_R8G8B8A8_UNORM;
- default:
- break;
- }
- }
- case GL_LUMINANCE:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_FLOAT:
- return LUMINANCE_to_R16G16B16A16_FLOAT;
- case Format::ID::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:
- return LUMINANCE8_ALPHA8_EXT_to_default;
- case GL_LUMINANCE8_EXT:
- return LUMINANCE8_EXT_to_default;
- case GL_LUMINANCE_ALPHA:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_FLOAT:
- return LUMINANCE_ALPHA_to_R16G16B16A16_FLOAT;
- case Format::ID::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 Format::ID::R11G11B10_FLOAT:
- return R11F_G11F_B10F_to_R11G11B10_FLOAT;
- default:
- break;
- }
- }
- case GL_R16F:
- {
- switch (angleFormat)
- {
- case Format::ID::R16_FLOAT:
- return R16F_to_R16_FLOAT;
- default:
- break;
- }
- }
- case GL_R16I:
- {
- switch (angleFormat)
- {
- case Format::ID::R16_SINT:
- return R16I_to_R16_SINT;
- default:
- break;
- }
- }
- case GL_R16UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R16_UINT:
- return R16UI_to_R16_UINT;
- default:
- break;
- }
- }
- case GL_R16_EXT:
- {
- switch (angleFormat)
- {
- case Format::ID::R16_UNORM:
- return R16_EXT_to_R16_UNORM;
- default:
- break;
- }
- }
- case GL_R16_SNORM_EXT:
- {
- switch (angleFormat)
- {
- case Format::ID::R16_SNORM:
- return R16_SNORM_EXT_to_R16_SNORM;
- default:
- break;
- }
- }
- case GL_R32F:
- {
- switch (angleFormat)
- {
- case Format::ID::R32_FLOAT:
- return R32F_to_R32_FLOAT;
- default:
- break;
- }
- }
- case GL_R32I:
- {
- switch (angleFormat)
- {
- case Format::ID::R32_SINT:
- return R32I_to_R32_SINT;
- default:
- break;
- }
- }
- case GL_R32UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R32_UINT:
- return R32UI_to_R32_UINT;
- default:
- break;
- }
- }
- case GL_R8:
- {
- switch (angleFormat)
- {
- case Format::ID::R8_UNORM:
- return R8_to_R8_UNORM;
- default:
- break;
- }
- }
- case GL_R8I:
- {
- switch (angleFormat)
- {
- case Format::ID::R8_SINT:
- return R8I_to_R8_SINT;
- default:
- break;
- }
- }
- case GL_R8UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R8_UINT:
- return R8UI_to_R8_UINT;
- default:
- break;
- }
- }
- case GL_R8_SNORM:
- {
- switch (angleFormat)
- {
- case Format::ID::R8_SNORM:
- return R8_SNORM_to_R8_SNORM;
- default:
- break;
- }
- }
- case GL_RG16F:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16_FLOAT:
- return RG16F_to_R16G16_FLOAT;
- default:
- break;
- }
- }
- case GL_RG16I:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16_SINT:
- return RG16I_to_R16G16_SINT;
- default:
- break;
- }
- }
- case GL_RG16UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16_UINT:
- return RG16UI_to_R16G16_UINT;
- default:
- break;
- }
- }
- case GL_RG16_EXT:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16_UNORM:
- return RG16_EXT_to_R16G16_UNORM;
- default:
- break;
- }
- }
- case GL_RG16_SNORM_EXT:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16_SNORM:
- return RG16_SNORM_EXT_to_R16G16_SNORM;
- default:
- break;
- }
- }
- case GL_RG32F:
- {
- switch (angleFormat)
- {
- case Format::ID::R32G32_FLOAT:
- return RG32F_to_R32G32_FLOAT;
- default:
- break;
- }
- }
- case GL_RG32I:
- {
- switch (angleFormat)
- {
- case Format::ID::R32G32_SINT:
- return RG32I_to_R32G32_SINT;
- default:
- break;
- }
- }
- case GL_RG32UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R32G32_UINT:
- return RG32UI_to_R32G32_UINT;
- default:
- break;
- }
- }
- case GL_RG8:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8_UNORM:
- return RG8_to_R8G8_UNORM;
- default:
- break;
- }
- }
- case GL_RG8I:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8_SINT:
- return RG8I_to_R8G8_SINT;
- default:
- break;
- }
- }
- case GL_RG8UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8_UINT:
- return RG8UI_to_R8G8_UINT;
- default:
- break;
- }
- }
- case GL_RG8_SNORM:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8_SNORM:
- return RG8_SNORM_to_R8G8_SNORM;
- default:
- break;
- }
- }
- case GL_RGB:
- return RGB_to_default;
- case GL_RGB10_A2:
- {
- switch (angleFormat)
- {
- case Format::ID::R10G10B10A2_UNORM:
- return RGB10_A2_to_R10G10B10A2_UNORM;
- default:
- break;
- }
- }
- case GL_RGB10_A2UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R10G10B10A2_UINT:
- return RGB10_A2UI_to_R10G10B10A2_UINT;
- default:
- break;
- }
- }
- case GL_RGB16F:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_FLOAT:
- return RGB16F_to_R16G16B16A16_FLOAT;
- default:
- break;
- }
- }
- case GL_RGB16I:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_SINT:
- return RGB16I_to_R16G16B16A16_SINT;
- default:
- break;
- }
- }
- case GL_RGB16UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_UINT:
- return RGB16UI_to_R16G16B16A16_UINT;
- default:
- break;
- }
- }
- case GL_RGB16_EXT:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_UNORM:
- return RGB16_EXT_to_R16G16B16A16_UNORM;
- default:
- break;
- }
- }
- case GL_RGB16_SNORM_EXT:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_SNORM:
- return RGB16_SNORM_EXT_to_R16G16B16A16_SNORM;
- default:
- break;
- }
- }
- case GL_RGB32F:
- {
- switch (angleFormat)
- {
- case Format::ID::R32G32B32A32_FLOAT:
- return RGB32F_to_R32G32B32A32_FLOAT;
- default:
- break;
- }
- }
- case GL_RGB32I:
- {
- switch (angleFormat)
- {
- case Format::ID::R32G32B32A32_SINT:
- return RGB32I_to_R32G32B32A32_SINT;
- default:
- break;
- }
- }
- case GL_RGB32UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R32G32B32A32_UINT:
- return RGB32UI_to_R32G32B32A32_UINT;
- default:
- break;
- }
- }
- case GL_RGB565:
- {
- switch (angleFormat)
- {
- case Format::ID::B5G6R5_UNORM:
- return RGB565_to_B5G6R5_UNORM;
- case Format::ID::R8G8B8A8_UNORM:
- return RGB565_to_R8G8B8A8_UNORM;
- default:
- break;
- }
- }
- case GL_RGB5_A1:
- {
- switch (angleFormat)
- {
- case Format::ID::B5G5R5A1_UNORM:
- return RGB5_A1_to_B5G5R5A1_UNORM;
- case Format::ID::R8G8B8A8_UNORM:
- return RGB5_A1_to_R8G8B8A8_UNORM;
- default:
- break;
- }
- }
- case GL_RGB8:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UNORM:
- return RGB8_to_R8G8B8A8_UNORM;
- default:
- break;
- }
- }
- case GL_RGB8I:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_SINT:
- return RGB8I_to_R8G8B8A8_SINT;
- default:
- break;
- }
- }
- case GL_RGB8UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UINT:
- return RGB8UI_to_R8G8B8A8_UINT;
- default:
- break;
- }
- }
- case GL_RGB8_SNORM:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_SNORM:
- return RGB8_SNORM_to_R8G8B8A8_SNORM;
- default:
- break;
- }
- }
- case GL_RGB9_E5:
- {
- switch (angleFormat)
- {
- case Format::ID::R9G9B9E5_SHAREDEXP:
- return RGB9_E5_to_R9G9B9E5_SHAREDEXP;
- default:
- break;
- }
- }
- case GL_RGBA:
- return RGBA_to_default;
- case GL_RGBA16F:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_FLOAT:
- return RGBA16F_to_R16G16B16A16_FLOAT;
- default:
- break;
- }
- }
- case GL_RGBA16I:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_SINT:
- return RGBA16I_to_R16G16B16A16_SINT;
- default:
- break;
- }
- }
- case GL_RGBA16UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_UINT:
- return RGBA16UI_to_R16G16B16A16_UINT;
- default:
- break;
- }
- }
- case GL_RGBA16_EXT:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_UNORM:
- return RGBA16_EXT_to_R16G16B16A16_UNORM;
- default:
- break;
- }
- }
- case GL_RGBA16_SNORM_EXT:
- {
- switch (angleFormat)
- {
- case Format::ID::R16G16B16A16_SNORM:
- return RGBA16_SNORM_EXT_to_R16G16B16A16_SNORM;
- default:
- break;
- }
- }
- case GL_RGBA32F:
- {
- switch (angleFormat)
- {
- case Format::ID::R32G32B32A32_FLOAT:
- return RGBA32F_to_R32G32B32A32_FLOAT;
- default:
- break;
- }
- }
- case GL_RGBA32I:
- {
- switch (angleFormat)
- {
- case Format::ID::R32G32B32A32_SINT:
- return RGBA32I_to_R32G32B32A32_SINT;
- default:
- break;
- }
- }
- case GL_RGBA32UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R32G32B32A32_UINT:
- return RGBA32UI_to_R32G32B32A32_UINT;
- default:
- break;
- }
- }
- case GL_RGBA4:
- {
- switch (angleFormat)
- {
- case Format::ID::B4G4R4A4_UNORM:
- return RGBA4_to_B4G4R4A4_UNORM;
- case Format::ID::R8G8B8A8_UNORM:
- return RGBA4_to_R8G8B8A8_UNORM;
- default:
- break;
- }
- }
- case GL_RGBA8:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UNORM:
- return RGBA8_to_R8G8B8A8_UNORM;
- default:
- break;
- }
- }
- case GL_RGBA8I:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_SINT:
- return RGBA8I_to_R8G8B8A8_SINT;
- default:
- break;
- }
- }
- case GL_RGBA8UI:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UINT:
- return RGBA8UI_to_R8G8B8A8_UINT;
- default:
- break;
- }
- }
- case GL_RGBA8_SNORM:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_SNORM:
- return RGBA8_SNORM_to_R8G8B8A8_SNORM;
- default:
- break;
- }
- }
- case GL_SRGB8:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UNORM_SRGB:
- return SRGB8_to_R8G8B8A8_UNORM_SRGB;
- default:
- break;
- }
- }
- case GL_SRGB8_ALPHA8:
- {
- switch (angleFormat)
- {
- case Format::ID::R8G8B8A8_UNORM_SRGB:
- return SRGB8_ALPHA8_to_R8G8B8A8_UNORM_SRGB;
- default:
- break;
- }
- }
- case GL_STENCIL_INDEX8:
- return STENCIL_INDEX8_to_default;
-
- default:
- {
- static LoadFunctionMap emptyLoadFunctionsMap;
- return emptyLoadFunctionsMap;
- }
- }
- // clang-format on
-
-} // GetLoadFunctionsMap
-
-} // namespace angle
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/renderer_utils.cpp b/src/3rdparty/angle/src/libANGLE/renderer/renderer_utils.cpp
deleted file mode 100644
index 55471c1d20..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/renderer_utils.cpp
+++ /dev/null
@@ -1,549 +0,0 @@
-//
-// 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/formatutils.h"
-#include "libANGLE/renderer/ContextImpl.h"
-#include "libANGLE/renderer/Format.h"
-
-#include <string.h>
-
-namespace rx
-{
-
-namespace
-{
-typedef std::pair<gl::FormatType, ColorWriteFunction> FormatWriteFunctionPair;
-typedef std::map<gl::FormatType, ColorWriteFunction> FormatWriteFunctionMap;
-
-static inline void InsertFormatWriteFunctionMapping(FormatWriteFunctionMap *map,
- GLenum format,
- GLenum type,
- ColorWriteFunction writeFunc)
-{
- map->insert(FormatWriteFunctionPair(gl::FormatType(format, type), writeFunc));
-}
-
-static FormatWriteFunctionMap BuildFormatWriteFunctionMap()
-{
- using namespace angle; // For image writing functions
-
- FormatWriteFunctionMap map;
-
- // clang-format off
- // | Format | Type | Color write function |
- InsertFormatWriteFunctionMapping(&map, GL_RGBA, GL_UNSIGNED_BYTE, WriteColor<R8G8B8A8, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGBA, GL_BYTE, WriteColor<R8G8B8A8S, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, WriteColor<R4G4B4A4, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, WriteColor<R5G5B5A1, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, WriteColor<R10G10B10A2, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGBA, GL_FLOAT, WriteColor<R32G32B32A32F, GLfloat>);
- InsertFormatWriteFunctionMapping(&map, GL_RGBA, GL_HALF_FLOAT, WriteColor<R16G16B16A16F, GLfloat>);
- InsertFormatWriteFunctionMapping(&map, GL_RGBA, GL_HALF_FLOAT_OES, WriteColor<R16G16B16A16F, GLfloat>);
- InsertFormatWriteFunctionMapping(&map, GL_RGBA, GL_UNSIGNED_SHORT,
- WriteColor<R16G16B16A16, GLfloat>);
- InsertFormatWriteFunctionMapping(&map, GL_RGBA, GL_SHORT, WriteColor<R16G16B16A16S, GLfloat>);
-
- InsertFormatWriteFunctionMapping(&map, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, WriteColor<R8G8B8A8, GLuint> );
- InsertFormatWriteFunctionMapping(&map, GL_RGBA_INTEGER, GL_BYTE, WriteColor<R8G8B8A8S, GLint> );
- InsertFormatWriteFunctionMapping(&map, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, WriteColor<R16G16B16A16, GLuint> );
- InsertFormatWriteFunctionMapping(&map, GL_RGBA_INTEGER, GL_SHORT, WriteColor<R16G16B16A16S, GLint> );
- InsertFormatWriteFunctionMapping(&map, GL_RGBA_INTEGER, GL_UNSIGNED_INT, WriteColor<R32G32B32A32, GLuint> );
- InsertFormatWriteFunctionMapping(&map, GL_RGBA_INTEGER, GL_INT, WriteColor<R32G32B32A32S, GLint> );
- InsertFormatWriteFunctionMapping(&map, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, WriteColor<R10G10B10A2, GLuint> );
-
- InsertFormatWriteFunctionMapping(&map, GL_RGB, GL_UNSIGNED_BYTE, WriteColor<R8G8B8, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB, GL_BYTE, WriteColor<R8G8B8S, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, WriteColor<R5G6B5, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, WriteColor<R11G11B10F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, WriteColor<R9G9B9E5, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB, GL_FLOAT, WriteColor<R32G32B32F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB, GL_HALF_FLOAT, WriteColor<R16G16B16F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB, GL_HALF_FLOAT_OES, WriteColor<R16G16B16F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB, GL_UNSIGNED_SHORT,
- WriteColor<R16G16B16, GLfloat>);
- InsertFormatWriteFunctionMapping(&map, GL_RGB, GL_SHORT, WriteColor<R16G16B16S, GLfloat>);
-
- InsertFormatWriteFunctionMapping(&map, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, WriteColor<R8G8B8, GLuint> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB_INTEGER, GL_BYTE, WriteColor<R8G8B8S, GLint> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB_INTEGER, GL_UNSIGNED_SHORT, WriteColor<R16G16B16, GLuint> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB_INTEGER, GL_SHORT, WriteColor<R16G16B16S, GLint> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB_INTEGER, GL_UNSIGNED_INT, WriteColor<R32G32B32, GLuint> );
- InsertFormatWriteFunctionMapping(&map, GL_RGB_INTEGER, GL_INT, WriteColor<R32G32B32S, GLint> );
-
- InsertFormatWriteFunctionMapping(&map, GL_RG, GL_UNSIGNED_BYTE, WriteColor<R8G8, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RG, GL_BYTE, WriteColor<R8G8S, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RG, GL_FLOAT, WriteColor<R32G32F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RG, GL_HALF_FLOAT, WriteColor<R16G16F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RG, GL_HALF_FLOAT_OES, WriteColor<R16G16F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RG, GL_UNSIGNED_SHORT, WriteColor<R16G16, GLfloat>);
- InsertFormatWriteFunctionMapping(&map, GL_RG, GL_SHORT, WriteColor<R16G16S, GLfloat>);
-
- InsertFormatWriteFunctionMapping(&map, GL_RG_INTEGER, GL_UNSIGNED_BYTE, WriteColor<R8G8, GLuint> );
- InsertFormatWriteFunctionMapping(&map, GL_RG_INTEGER, GL_BYTE, WriteColor<R8G8S, GLint> );
- InsertFormatWriteFunctionMapping(&map, GL_RG_INTEGER, GL_UNSIGNED_SHORT, WriteColor<R16G16, GLuint> );
- InsertFormatWriteFunctionMapping(&map, GL_RG_INTEGER, GL_SHORT, WriteColor<R16G16S, GLint> );
- InsertFormatWriteFunctionMapping(&map, GL_RG_INTEGER, GL_UNSIGNED_INT, WriteColor<R32G32, GLuint> );
- InsertFormatWriteFunctionMapping(&map, GL_RG_INTEGER, GL_INT, WriteColor<R32G32S, GLint> );
-
- InsertFormatWriteFunctionMapping(&map, GL_RED, GL_UNSIGNED_BYTE, WriteColor<R8, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RED, GL_BYTE, WriteColor<R8S, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RED, GL_FLOAT, WriteColor<R32F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RED, GL_HALF_FLOAT, WriteColor<R16F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RED, GL_HALF_FLOAT_OES, WriteColor<R16F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_RED, GL_UNSIGNED_SHORT, WriteColor<R16, GLfloat>);
- InsertFormatWriteFunctionMapping(&map, GL_RED, GL_SHORT, WriteColor<R16S, GLfloat>);
-
- InsertFormatWriteFunctionMapping(&map, GL_RED_INTEGER, GL_UNSIGNED_BYTE, WriteColor<R8, GLuint> );
- InsertFormatWriteFunctionMapping(&map, GL_RED_INTEGER, GL_BYTE, WriteColor<R8S, GLint> );
- InsertFormatWriteFunctionMapping(&map, GL_RED_INTEGER, GL_UNSIGNED_SHORT, WriteColor<R16, GLuint> );
- InsertFormatWriteFunctionMapping(&map, GL_RED_INTEGER, GL_SHORT, WriteColor<R16S, GLint> );
- InsertFormatWriteFunctionMapping(&map, GL_RED_INTEGER, GL_UNSIGNED_INT, WriteColor<R32, GLuint> );
- InsertFormatWriteFunctionMapping(&map, GL_RED_INTEGER, GL_INT, WriteColor<R32S, GLint> );
-
- InsertFormatWriteFunctionMapping(&map, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, WriteColor<L8A8, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_LUMINANCE, GL_UNSIGNED_BYTE, WriteColor<L8, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_ALPHA, GL_UNSIGNED_BYTE, WriteColor<A8, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_LUMINANCE_ALPHA, GL_FLOAT, WriteColor<L32A32F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_LUMINANCE, GL_FLOAT, WriteColor<L32F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_ALPHA, GL_FLOAT, WriteColor<A32F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT, WriteColor<L16A16F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, WriteColor<L16A16F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_LUMINANCE, GL_HALF_FLOAT, WriteColor<L16F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_LUMINANCE, GL_HALF_FLOAT_OES, WriteColor<L16F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_ALPHA, GL_HALF_FLOAT, WriteColor<A16F, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_ALPHA, GL_HALF_FLOAT_OES, WriteColor<A16F, GLfloat> );
-
- InsertFormatWriteFunctionMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_BYTE, WriteColor<B8G8R8A8, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, WriteColor<A4R4G4B4, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, WriteColor<A1R5G5B5, GLfloat> );
-
- InsertFormatWriteFunctionMapping(&map, GL_SRGB_EXT, GL_UNSIGNED_BYTE, WriteColor<R8G8B8, GLfloat> );
- InsertFormatWriteFunctionMapping(&map, GL_SRGB_ALPHA_EXT, GL_UNSIGNED_BYTE, WriteColor<R8G8B8A8, GLfloat> );
-
- InsertFormatWriteFunctionMapping(&map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE, nullptr );
- InsertFormatWriteFunctionMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE, nullptr );
- InsertFormatWriteFunctionMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE, nullptr );
- InsertFormatWriteFunctionMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE, nullptr );
-
- InsertFormatWriteFunctionMapping(&map, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, nullptr );
- InsertFormatWriteFunctionMapping(&map, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr );
- InsertFormatWriteFunctionMapping(&map, GL_DEPTH_COMPONENT, GL_FLOAT, nullptr );
-
- InsertFormatWriteFunctionMapping(&map, GL_STENCIL, GL_UNSIGNED_BYTE, nullptr );
-
- InsertFormatWriteFunctionMapping(&map, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, nullptr );
- InsertFormatWriteFunctionMapping(&map, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, nullptr );
- // clang-format on
-
- return map;
-}
-
-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,
- ColorWriteFunction 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,
- ColorWriteFunction colorWriteFunction,
- uint8_t *destPixelData)
-{
- colorWriteFunction(reinterpret_cast<const uint8_t *>(&color), destPixelData);
-}
-
-} // anonymous namespace
-
-PackPixelsParams::PackPixelsParams()
- : format(GL_NONE), type(GL_NONE), outputPitch(0), packBuffer(nullptr), offset(0)
-{
-}
-
-PackPixelsParams::PackPixelsParams(const gl::Rectangle &areaIn,
- GLenum formatIn,
- GLenum typeIn,
- GLuint outputPitchIn,
- const gl::PixelPackState &packIn,
- gl::Buffer *packBufferIn,
- ptrdiff_t offsetIn)
- : area(areaIn),
- format(formatIn),
- type(typeIn),
- outputPitch(outputPitchIn),
- packBuffer(packBufferIn),
- pack(),
- offset(offsetIn)
-{
- pack.alignment = packIn.alignment;
- pack.reverseRowOrder = packIn.reverseRowOrder;
-}
-
-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.pack.reverseRowOrder)
- {
- source += inputPitch * (params.area.height - 1);
- inputPitch = -inputPitch;
- }
-
- const auto &sourceGLInfo = gl::GetSizedInternalFormatInfo(sourceFormat.glInternalFormat);
-
- if (sourceGLInfo.format == params.format && sourceGLInfo.type == params.type)
- {
- // Direct copy possible
- for (int y = 0; y < params.area.height; ++y)
- {
- memcpy(destWithOffset + y * params.outputPitch, source + y * inputPitch,
- params.area.width * sourceGLInfo.pixelBytes);
- }
- return;
- }
-
- ASSERT(sourceGLInfo.sized);
-
- gl::FormatType formatType(params.format, params.type);
- ColorCopyFunction fastCopyFunc =
- GetFastCopyFunction(sourceFormat.fastCopyFunctions, formatType);
- const auto &destFormatInfo = gl::GetInternalFormatInfo(formatType.format, formatType.type);
-
- 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 * destFormatInfo.pixelBytes;
- const uint8_t *src = source + y * inputPitch + x * sourceGLInfo.pixelBytes;
-
- fastCopyFunc(src, dest);
- }
- }
- return;
- }
-
- ColorWriteFunction colorWriteFunction = GetColorWriteFunction(formatType);
-
- // 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),
- "Unexpected size of gl::Color struct.");
-
- const auto &colorReadFunction = sourceFormat.colorReadFunction;
-
- 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 * destFormatInfo.pixelBytes;
- const uint8_t *src = source + y * inputPitch + x * sourceGLInfo.pixelBytes;
-
- // readFunc and writeFunc will be using the same type of color, CopyTexImage
- // will not allow the copy otherwise.
- colorReadFunction(src, temp);
- colorWriteFunction(temp, dest);
- }
- }
-}
-
-ColorWriteFunction GetColorWriteFunction(const gl::FormatType &formatType)
-{
- static const FormatWriteFunctionMap formatTypeMap = BuildFormatWriteFunctionMap();
- auto iter = formatTypeMap.find(formatType);
- ASSERT(iter != formatTypeMap.end());
- if (iter != formatTypeMap.end())
- {
- return iter->second;
- }
- else
- {
- return nullptr;
- }
-}
-
-ColorCopyFunction GetFastCopyFunction(const FastCopyFunctionMap &fastCopyFunctions,
- const gl::FormatType &formatType)
-{
- return fastCopyFunctions.get(formatType);
-}
-
-bool FastCopyFunctionMap::has(const gl::FormatType &formatType) const
-{
- return (get(formatType) != nullptr);
-}
-
-ColorCopyFunction FastCopyFunctionMap::get(const gl::FormatType &formatType) const
-{
- for (size_t index = 0; index < mSize; ++index)
- {
- if (mData[index].format == formatType.format && mData[index].type == formatType.type)
- {
- return mData[index].func;
- }
- }
-
- return nullptr;
-}
-
-bool ShouldUseDebugLayers(const egl::AttributeMap &attribs)
-{
- 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(NDEBUG)
- return (debugSetting != EGL_FALSE);
-#else
- return (debugSetting == EGL_TRUE);
-#endif // !defined(NDEBUG)
-}
-
-void CopyImageCHROMIUM(const uint8_t *sourceData,
- size_t sourceRowPitch,
- size_t sourcePixelBytes,
- ColorReadFunction colorReadFunction,
- uint8_t *destData,
- size_t destRowPitch,
- size_t destPixelBytes,
- ColorWriteFunction colorWriteFunction,
- GLenum destUnsizedFormat,
- GLenum destComponentType,
- size_t width,
- size_t height,
- 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 y = 0; y < height; y++)
- {
- for (size_t x = 0; x < width; x++)
- {
- const uint8_t *sourcePixelData = sourceData + y * sourceRowPitch + x * sourcePixelBytes;
-
- gl::ColorF sourceColor;
- colorReadFunction(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;
- writeFunction(sourceColor, colorWriteFunction, destPixelData);
- }
- }
-}
-
-// IncompleteTextureSet implementation.
-IncompleteTextureSet::IncompleteTextureSet()
-{
-}
-
-IncompleteTextureSet::~IncompleteTextureSet()
-{
-}
-
-void IncompleteTextureSet::onDestroy(const gl::Context *context)
-{
- // Clear incomplete textures.
- for (auto &incompleteTexture : mIncompleteTextures)
- {
- ANGLE_SWALLOW_ERR(incompleteTexture.second->onDestroy(context));
- incompleteTexture.second.set(context, nullptr);
- }
- mIncompleteTextures.clear();
-}
-
-gl::Error IncompleteTextureSet::getIncompleteTexture(
- const gl::Context *context,
- GLenum type,
- MultisampleTextureInitializer *multisampleInitializer,
- gl::Texture **textureOut)
-{
- auto iter = mIncompleteTextures.find(type);
- if (iter != mIncompleteTextures.end())
- {
- *textureOut = iter->second.get();
- return gl::NoError();
- }
-
- 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
- GLenum createType = (type == GL_TEXTURE_EXTERNAL_OES) ? GL_TEXTURE_2D : type;
-
- gl::Texture *tex = new gl::Texture(implFactory, std::numeric_limits<GLuint>::max(), createType);
- angle::UniqueObjectPointer<gl::Texture, gl::Context> t(tex, context);
-
- if (createType == GL_TEXTURE_2D_MULTISAMPLE)
- {
- ANGLE_TRY(t->setStorageMultisample(context, createType, 1, GL_RGBA8, colorSize, true));
- }
- else
- {
- ANGLE_TRY(t->setStorage(context, createType, 1, GL_RGBA8, colorSize));
- }
-
- if (type == GL_TEXTURE_CUBE_MAP)
- {
- for (GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X; face <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
- face++)
- {
- ANGLE_TRY(
- t->setSubImage(context, unpack, face, 0, area, GL_RGBA, GL_UNSIGNED_BYTE, color));
- }
- }
- else if (type == GL_TEXTURE_2D_MULTISAMPLE)
- {
- // Call a specialized clear function to init a multisample texture.
- ANGLE_TRY(multisampleInitializer->initializeMultisampleTextureToBlack(context, t.get()));
- }
- else
- {
- ANGLE_TRY(
- t->setSubImage(context, unpack, createType, 0, area, GL_RGBA, GL_UNSIGNED_BYTE, color));
- }
-
- t->syncState();
-
- mIncompleteTextures[type].set(context, t.release());
- *textureOut = mIncompleteTextures[type].get();
- return gl::NoError();
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/renderer_utils.h b/src/3rdparty/angle/src/libANGLE/renderer/renderer_utils.h
deleted file mode 100644
index 5a1cb38a6a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/renderer_utils.h
+++ /dev/null
@@ -1,254 +0,0 @@
-//
-// 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 <limits>
-#include <map>
-
-#include "common/angleutils.h"
-#include "libANGLE/angletypes.h"
-
-namespace angle
-{
-struct Format;
-} // namespace angle
-
-namespace gl
-{
-struct FormatType;
-struct InternalFormat;
-} // namespace gl
-
-namespace egl
-{
-class AttributeMap;
-} // namespace egl
-
-namespace rx
-{
-
-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 SerialFactory;
-
-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!=(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; }
-
- private:
- friend class SerialFactory;
- constexpr explicit Serial(uint64_t value) : mValue(value) {}
- uint64_t mValue;
- static constexpr uint64_t kInvalid = 0;
-};
-
-class SerialFactory final : angle::NonCopyable
-{
- public:
- SerialFactory() : mSerial(1) {}
-
- Serial generate()
- {
- ASSERT(mSerial != std::numeric_limits<uint64_t>::max());
- return Serial(mSerial++);
- }
-
- private:
- uint64_t mSerial;
-};
-
-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 (*ColorReadFunction)(const uint8_t *source, uint8_t *dest);
-typedef void (*ColorWriteFunction)(const uint8_t *source, uint8_t *dest);
-typedef void (*ColorCopyFunction)(const uint8_t *source, uint8_t *dest);
-
-class FastCopyFunctionMap
-{
- public:
- struct Entry
- {
- GLenum format;
- GLenum type;
- ColorCopyFunction func;
- };
-
- constexpr FastCopyFunctionMap() : FastCopyFunctionMap(nullptr, 0) {}
-
- constexpr FastCopyFunctionMap(const Entry *data, size_t size) : mSize(size), mData(data) {}
-
- bool has(const gl::FormatType &formatType) const;
- ColorCopyFunction get(const gl::FormatType &formatType) const;
-
- private:
- size_t mSize;
- const Entry *mData;
-};
-
-struct PackPixelsParams
-{
- PackPixelsParams();
- PackPixelsParams(const gl::Rectangle &area,
- GLenum format,
- GLenum type,
- GLuint outputPitch,
- const gl::PixelPackState &pack,
- gl::Buffer *packBufferIn,
- ptrdiff_t offset);
-
- gl::Rectangle area;
- GLenum format;
- GLenum type;
- GLuint outputPitch;
- gl::Buffer *packBuffer;
- gl::PixelPackState pack;
- ptrdiff_t offset;
-};
-
-void PackPixels(const PackPixelsParams &params,
- const angle::Format &sourceFormat,
- int inputPitch,
- const uint8_t *source,
- uint8_t *destination);
-
-ColorWriteFunction GetColorWriteFunction(const gl::FormatType &formatType);
-ColorCopyFunction GetFastCopyFunction(const FastCopyFunctionMap &fastCopyFunctions,
- const gl::FormatType &formatType);
-
-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);
-
-void CopyImageCHROMIUM(const uint8_t *sourceData,
- size_t sourceRowPitch,
- size_t sourcePixelBytes,
- ColorReadFunction readFunction,
- uint8_t *destData,
- size_t destRowPitch,
- size_t destPixelBytes,
- ColorWriteFunction colorWriteFunction,
- GLenum destUnsizedFormat,
- GLenum destComponentType,
- size_t width,
- size_t height,
- 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 gl::Error initializeMultisampleTextureToBlack(const gl::Context *context,
- gl::Texture *glTexture) = 0;
-};
-
-class IncompleteTextureSet final : angle::NonCopyable
-{
- public:
- IncompleteTextureSet();
- ~IncompleteTextureSet();
-
- void onDestroy(const gl::Context *context);
-
- gl::Error getIncompleteTexture(const gl::Context *context,
- GLenum type,
- MultisampleTextureInitializer *multisampleInitializer,
- gl::Texture **textureOut);
-
- private:
- gl::TextureMap mIncompleteTextures;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_RENDERER_UTILS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/signal_utils.h b/src/3rdparty/angle/src/libANGLE/signal_utils.h
deleted file mode 100644
index 3dd1332013..0000000000
--- a/src/3rdparty/angle/src/libANGLE/signal_utils.h
+++ /dev/null
@@ -1,187 +0,0 @@
-//
-// 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.
-//
-// signal_utils:
-// Helper classes for tracking dependent state changes between objects.
-// These changes are signaled to the dependent class via channels.
-// See design document:
-// https://docs.google.com/document/d/15Edfotqg6_l1skTEL8ADQudF_oIdNa7i8Po43k6jMd4/
-
-#ifndef LIBANGLE_SIGNAL_UTILS_H_
-#define LIBANGLE_SIGNAL_UTILS_H_
-
-#include <set>
-
-#include "common/angleutils.h"
-#include "common/debug.h"
-
-namespace angle
-{
-
-// Interface that the depending class inherits from.
-template <typename ChannelID = uint32_t, typename... MessageT>
-class SignalReceiver
-{
- public:
- virtual ~SignalReceiver() = default;
- virtual void signal(ChannelID channelID, MessageT... message) = 0;
-};
-
-template <typename ChannelID, typename... MessageT>
-class ChannelBinding;
-
-// The host class owns the channel. It uses the channel to fire signals to the receiver.
-template <typename ChannelID = uint32_t, typename... MessageT>
-class BroadcastChannel final : NonCopyable
-{
- public:
- BroadcastChannel();
- ~BroadcastChannel();
-
- void signal(MessageT... message) const;
-
- void reset();
-
- bool empty() const;
-
- private:
- // Only the ChannelBinding class should add or remove receivers.
- friend class ChannelBinding<ChannelID, MessageT...>;
- void addReceiver(ChannelBinding<ChannelID, MessageT...> *receiver);
- void removeReceiver(ChannelBinding<ChannelID, MessageT...> *receiver);
-
- std::vector<ChannelBinding<ChannelID, MessageT...> *> mReceivers;
-};
-
-template <typename ChannelID, typename... MessageT>
-BroadcastChannel<ChannelID, MessageT...>::BroadcastChannel()
-{
-}
-
-template <typename ChannelID, typename... MessageT>
-BroadcastChannel<ChannelID, MessageT...>::~BroadcastChannel()
-{
- reset();
-}
-
-template <typename ChannelID, typename... MessageT>
-void BroadcastChannel<ChannelID, MessageT...>::addReceiver(
- ChannelBinding<ChannelID, MessageT...> *receiver)
-{
- ASSERT(std::find(mReceivers.begin(), mReceivers.end(), receiver) == mReceivers.end());
- mReceivers.push_back(receiver);
-}
-
-template <typename ChannelID, typename... MessageT>
-void BroadcastChannel<ChannelID, MessageT...>::removeReceiver(
- ChannelBinding<ChannelID, MessageT...> *receiver)
-{
- auto iter = std::find(mReceivers.begin(), mReceivers.end(), receiver);
- ASSERT(iter != mReceivers.end());
- mReceivers.erase(iter);
-}
-
-template <typename ChannelID, typename... MessageT>
-void BroadcastChannel<ChannelID, MessageT...>::signal(MessageT... message) const
-{
- if (mReceivers.empty())
- return;
-
- for (const auto *receiver : mReceivers)
- {
- receiver->signal(message...);
- }
-}
-
-template <typename ChannelID, typename... MessageT>
-void BroadcastChannel<ChannelID, MessageT...>::reset()
-{
- for (auto receiver : mReceivers)
- {
- receiver->onChannelClosed();
- }
- mReceivers.clear();
-}
-
-template <typename ChannelID, typename... MessageT>
-bool BroadcastChannel<ChannelID, MessageT...>::empty() const
-{
- return mReceivers.empty();
-}
-
-// The dependent class keeps bindings to the host's BroadcastChannel.
-template <typename ChannelID = uint32_t, typename... MessageT>
-class ChannelBinding final
-{
- public:
- ChannelBinding(SignalReceiver<ChannelID, MessageT...> *receiver, ChannelID channelID);
- ~ChannelBinding();
- ChannelBinding(const ChannelBinding &other) = default;
- ChannelBinding &operator=(const ChannelBinding &other) = default;
-
- void bind(BroadcastChannel<ChannelID, MessageT...> *channel);
- void reset();
- void signal(MessageT... message) const;
- void onChannelClosed();
-
- private:
- BroadcastChannel<ChannelID, MessageT...> *mChannel;
- SignalReceiver<ChannelID, MessageT...> *mReceiver;
- ChannelID mChannelID;
-};
-
-template <typename ChannelID, typename... MessageT>
-ChannelBinding<ChannelID, MessageT...>::ChannelBinding(
- SignalReceiver<ChannelID, MessageT...> *receiver,
- ChannelID channelID)
- : mChannel(nullptr), mReceiver(receiver), mChannelID(channelID)
-{
- ASSERT(receiver);
-}
-
-template <typename ChannelID, typename... MessageT>
-ChannelBinding<ChannelID, MessageT...>::~ChannelBinding()
-{
- reset();
-}
-
-template <typename ChannelID, typename... MessageT>
-void ChannelBinding<ChannelID, MessageT...>::bind(BroadcastChannel<ChannelID, MessageT...> *channel)
-{
- ASSERT(mReceiver);
- if (mChannel)
- {
- mChannel->removeReceiver(this);
- }
-
- mChannel = channel;
-
- if (mChannel)
- {
- mChannel->addReceiver(this);
- }
-}
-
-template <typename ChannelID, typename... MessageT>
-void ChannelBinding<ChannelID, MessageT...>::reset()
-{
- bind(nullptr);
-}
-
-template <typename ChannelID, typename... MessageT>
-void ChannelBinding<ChannelID, MessageT...>::signal(MessageT... message) const
-{
- mReceiver->signal(mChannelID, message...);
-}
-
-template <typename ChannelID, typename... MessageT>
-void ChannelBinding<ChannelID, MessageT...>::onChannelClosed()
-{
- mChannel = nullptr;
-}
-
-} // namespace angle
-
-#endif // LIBANGLE_SIGNAL_UTILS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/validationEGL.cpp b/src/3rdparty/angle/src/libANGLE/validationEGL.cpp
deleted file mode 100644
index 13a3a9e280..0000000000
--- a/src/3rdparty/angle/src/libANGLE/validationEGL.cpp
+++ /dev/null
@@ -1,2501 +0,0 @@
-//
-// 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/Image.h"
-#include "libANGLE/Stream.h"
-#include "libANGLE/Surface.h"
-#include "libANGLE/Texture.h"
-#include "libANGLE/formatutils.h"
-
-#include <EGL/eglext.h>
-
-namespace egl
-{
-namespace
-{
-size_t GetMaximumMipLevel(const gl::Context *context, GLenum target)
-{
- const gl::Caps &caps = context->getCaps();
-
- size_t maxDimension = 0;
- switch (target)
- {
- case GL_TEXTURE_2D:
- maxDimension = caps.max2DTextureSize;
- break;
- case GL_TEXTURE_RECTANGLE_ANGLE:
- maxDimension = caps.maxRectangleTextureSize;
- break;
- case GL_TEXTURE_CUBE_MAP:
- maxDimension = caps.maxCubeMapTextureSize;
- break;
- case GL_TEXTURE_3D:
- maxDimension = caps.max3DTextureSize;
- break;
- case GL_TEXTURE_2D_ARRAY:
- maxDimension = caps.max2DTextureSize;
- 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->getTarget());
- for (size_t level = 1; level < maxMip; level++)
- {
- if (texture->getTarget() == GL_TEXTURE_CUBE_MAP)
- {
- for (GLenum face = gl::FirstCubeMapTextureTarget; face <= gl::LastCubeMapTextureTarget;
- face++)
- {
- if (texture->getFormat(face, level).valid())
- {
- return true;
- }
- }
- }
- else
- {
- if (texture->getFormat(texture->getTarget(), level).valid())
- {
- return true;
- }
- }
- }
-
- return false;
-}
-
-bool CubeTextureHasUnspecifiedLevel0Face(const gl::Texture *texture)
-{
- ASSERT(texture->getTarget() == GL_TEXTURE_CUBE_MAP);
- for (GLenum face = gl::FirstCubeMapTextureTarget; face <= gl::LastCubeMapTextureTarget; face++)
- {
- 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 ValidateCreateImageKHRMipLevelCommon(gl::Context *context,
- const gl::Texture *texture,
- EGLAttrib level)
-{
- // Note that the spec EGL_KHR_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;
-
- default:
- return EglBadAttribute() << "Unknown attribute.";
- }
-
- return NoError();
-}
-
-Error ValidateConfigAttributes(const Display *display, const AttributeMap &attributes)
-{
- for (const auto &attrib : attributes)
- {
- ANGLE_TRY(ValidateConfigAttribute(display, attrib.first));
- }
-
- 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;
- EGLAttrib deviceType = EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE;
- bool enableAutoTrimSpecified = false;
- bool deviceTypeSpecified = false;
- bool presentPathSpecified = false;
-
- Optional<EGLAttrib> majorVersion;
- Optional<EGLAttrib> minorVersion;
-
- 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_WARP_ANGLE:
- case EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE:
- deviceTypeSpecified = true;
- break;
-
- case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE:
- // This is a hidden option, accepted by the OpenGL back-end.
- 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;
-
- 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_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 (deviceTypeSpecified && platformType != EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE &&
- platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
- {
- return EglBadAttribute() << "EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE requires a "
- "device type of EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE or "
- "EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE.";
- }
-
- 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.";
- }
- }
- }
- else if (platform == EGL_PLATFORM_DEVICE_EXT)
- {
- Device *eglDevice = reinterpret_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();
- }
-
- return NoError();
-}
-
-} // namespace
-
-Error ValidateDisplay(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.";
- }
-
- 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 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 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;
-
- default:
- return EglBadAttribute() << "Unknown attribute.";
- }
- }
-
- switch (clientMajorVersion)
- {
- case 2:
- if (clientMinorVersion != 0)
- {
- return EglBadConfig();
- }
- break;
- case 3:
- if (clientMinorVersion != 0 && clientMinorVersion != 1)
- {
- return EglBadConfig();
- }
- if (!(configuration->conformant & 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();
- }
-
- if (shareContext->getClientMajorVersion() != clientMajorVersion ||
- shareContext->getClientMinorVersion() != clientMinorVersion)
- {
- return EglBadContext();
- }
- }
-
- 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;
-
- 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 (!displayExtensions.d3dShareHandleClientBuffer)
- {
- return EglBadParameter();
- }
- if (value < 0)
- {
- return EglBadParameter();
- }
- 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_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;
-
- default:
- return EglBadAttribute();
- }
- }
-
- 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))
- {
- 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();
- }
- }
-
- ANGLE_TRY(display->validateClientBuffer(config, buftype, buffer, attributes));
-
- return NoError();
-}
-
-Error ValidateMakeCurrent(Display *display, EGLSurface draw, EGLSurface 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->testDeviceLost())
- {
- return EglContextLost();
- }
-
- Surface *drawSurface = static_cast<Surface *>(draw);
- if (draw != EGL_NO_SURFACE)
- {
- ANGLE_TRY(ValidateSurface(display, drawSurface));
- }
-
- Surface *readSurface = static_cast<Surface *>(read);
- if (read != EGL_NO_SURFACE)
- {
- ANGLE_TRY(ValidateSurface(display, readSurface));
- }
-
- if (readSurface)
- {
- ANGLE_TRY(ValidateCompatibleConfigs(display, readSurface->getConfig(), readSurface,
- context->getConfig(), readSurface->getType()));
- }
-
- if (draw != read)
- {
- UNIMPLEMENTED(); // FIXME
-
- if (drawSurface)
- {
- ANGLE_TRY(ValidateCompatibleConfigs(display, drawSurface->getConfig(), drawSurface,
- context->getConfig(), drawSurface->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 ValidateCreateImageKHR(const Display *display,
- gl::Context *context,
- EGLenum target,
- EGLClientBuffer buffer,
- const AttributeMap &attributes)
-{
- ANGLE_TRY(ValidateContext(display, context));
-
- const DisplayExtensions &displayExtensions = display->getExtensions();
-
- if (!displayExtensions.imageBase && !displayExtensions.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.";
- }
-
- // 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_KHR:
- switch (value)
- {
- case EGL_TRUE:
- case EGL_FALSE:
- break;
-
- default:
- return EglBadParameter()
- << "EGL_IMAGE_PRESERVED_KHR must be EGL_TRUE or EGL_FALSE.";
- }
- break;
-
- case EGL_GL_TEXTURE_LEVEL_KHR:
- if (!displayExtensions.glTexture2DImage &&
- !displayExtensions.glTextureCubemapImage && !displayExtensions.glTexture3DImage)
- {
- return EglBadParameter() << "EGL_GL_TEXTURE_LEVEL_KHR cannot be used "
- "without KHR_gl_texture_*_image support.";
- }
-
- if (value < 0)
- {
- return EglBadParameter() << "EGL_GL_TEXTURE_LEVEL_KHR cannot be negative.";
- }
- break;
-
- case EGL_GL_TEXTURE_ZOFFSET_KHR:
- if (!displayExtensions.glTexture3DImage)
- {
- return EglBadParameter() << "EGL_GL_TEXTURE_ZOFFSET_KHR 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_KHR:
- {
- 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.";
- }
-
- const gl::Texture *texture =
- context->getTexture(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
- if (texture == nullptr || texture->getTarget() != GL_TEXTURE_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_KHR, 0);
- if (texture->getWidth(GL_TEXTURE_2D, static_cast<size_t>(level)) == 0 ||
- texture->getHeight(GL_TEXTURE_2D, static_cast<size_t>(level)) == 0)
- {
- return EglBadParameter()
- << "target 2D texture does not have a valid size at specified level.";
- }
-
- ANGLE_TRY(ValidateCreateImageKHRMipLevelCommon(context, texture, level));
- }
- break;
-
- 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:
- {
- 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.";
- }
-
- const gl::Texture *texture =
- context->getTexture(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
- if (texture == nullptr || texture->getTarget() != GL_TEXTURE_CUBE_MAP)
- {
- 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_KHR, 0);
- GLenum cubeMapFace = egl_gl::EGLCubeMapTargetToGLCubeMapTarget(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(ValidateCreateImageKHRMipLevelCommon(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_KHR:
- {
- 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.";
- }
-
- const gl::Texture *texture =
- context->getTexture(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
- if (texture == nullptr || texture->getTarget() != GL_TEXTURE_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_KHR, 0);
- EGLAttrib zOffset = attributes.get(EGL_GL_TEXTURE_ZOFFSET_KHR, 0);
- if (texture->getWidth(GL_TEXTURE_3D, static_cast<size_t>(level)) == 0 ||
- texture->getHeight(GL_TEXTURE_3D, static_cast<size_t>(level)) == 0 ||
- texture->getDepth(GL_TEXTURE_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_TEXTURE_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(ValidateCreateImageKHRMipLevelCommon(context, texture, level));
- }
- break;
-
- case EGL_GL_RENDERBUFFER_KHR:
- {
- if (!displayExtensions.glRenderbufferImage)
- {
- return EglBadParameter() << "KHR_gl_renderbuffer_image not supported.";
- }
-
- if (attributes.contains(EGL_GL_TEXTURE_LEVEL_KHR))
- {
- return EglBadParameter() << "EGL_GL_TEXTURE_LEVEL_KHR cannot be used in "
- "conjunction with a renderbuffer target.";
- }
-
- if (buffer == 0)
- {
- return EglBadParameter()
- << "buffer cannot reference a renderbuffer with the name 0.";
- }
-
- 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;
-
- default:
- return EglBadParameter()
- << "invalid target: 0x" << std::hex << std::uppercase << target;
- }
-
- return NoError();
-}
-
-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 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(ValidateDisplay(display));
- 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->getGLState().getTargetTexture(GL_TEXTURE_EXTERNAL_OES);
- 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";
- }
-
- // 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 (!context)
- {
- return EglBadAccess() << "No GL context current to calling thread.";
- }
-
- ANGLE_TRY(ValidateContext(display, context));
-
- 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->getGLState().getTargetTexture(GL_TEXTURE_EXTERNAL_OES);
- 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->getGLState().getSamplerTexture(
- static_cast<unsigned int>(plane[i]), GL_TEXTURE_EXTERNAL_OES);
- 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 ValidateCreateStreamProducerD3DTextureNV12ANGLE(const Display *display,
- const Stream *stream,
- const AttributeMap &attribs)
-{
- ANGLE_TRY(ValidateDisplay(display));
-
- const DisplayExtensions &displayExtensions = display->getExtensions();
- if (!displayExtensions.streamProducerD3DTextureNV12)
- {
- 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";
- }
-
- if (stream->getConsumerType() != Stream::ConsumerType::GLTextureYUV ||
- stream->getPlaneCount() != 2)
- {
- return EglBadMatch() << "Incompatible stream consumer type";
- }
-
- return NoError();
-}
-
-Error ValidateStreamPostD3DTextureNV12ANGLE(const Display *display,
- const Stream *stream,
- void *texture,
- const AttributeMap &attribs)
-{
- ANGLE_TRY(ValidateDisplay(display));
-
- const DisplayExtensions &displayExtensions = display->getExtensions();
- if (!displayExtensions.streamProducerD3DTextureNV12)
- {
- 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;
- 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::D3D11TextureNV12)
- {
- return EglBadMatch() << "Incompatible stream producer";
- }
-
- if (texture == nullptr)
- {
- return EglBadParameter() << "Texture is null";
- }
-
- return stream->validateD3D11NV12Texture(texture);
-}
-
-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 ValidateSwapBuffersWithDamageEXT(const Display *display,
- const Surface *surface,
- EGLint *rects,
- EGLint n_rects)
-{
- Error error = ValidateSurface(display, surface);
- if (error.isError())
- {
- return error;
- }
-
- 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_EXT_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 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 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>(gl::kProgramHashLength))
- {
- 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>(gl::kProgramHashLength))
- {
- 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.";
- }
-
- 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.";
- }
-
- 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;
-
- default:
- return EglBadAttribute() << "Invalid surface attribute.";
- }
-
- return NoError();
-}
-
-Error ValidateQueryContext(const Display *display,
- const gl::Context *context,
- EGLint attribute,
- EGLint *value)
-{
- ANGLE_TRY(ValidateDisplay(display));
- 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();
-}
-
-} // namespace egl
diff --git a/src/3rdparty/angle/src/libANGLE/validationEGL.h b/src/3rdparty/angle/src/libANGLE/validationEGL.h
deleted file mode 100644
index 3ab8232c7f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/validationEGL.h
+++ /dev/null
@@ -1,182 +0,0 @@
-//
-// 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 "libANGLE/Error.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;
-
-// 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);
-
-// Entry point validation
-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, EGLSurface draw, EGLSurface read, gl::Context *context);
-
-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 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 ValidateCreateStreamProducerD3DTextureNV12ANGLE(const Display *display,
- const Stream *stream,
- const AttributeMap &attribs);
-Error ValidateStreamPostD3DTextureNV12ANGLE(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 ValidateSwapBuffersWithDamageEXT(const Display *display,
- const Surface *surface,
- EGLint *rects,
- EGLint n_rects);
-
-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 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);
-
-} // namespace egl
-
-#define ANGLE_EGL_TRY(THREAD, EXPR) \
- { \
- auto ANGLE_LOCAL_VAR = (EXPR); \
- if (ANGLE_LOCAL_VAR.isError()) \
- return THREAD->setError(ANGLE_LOCAL_VAR); \
- }
-
-#define ANGLE_EGL_TRY_RETURN(THREAD, EXPR, RETVAL) \
- { \
- auto ANGLE_LOCAL_VAR = (EXPR); \
- if (ANGLE_LOCAL_VAR.isError()) \
- { \
- THREAD->setError(ANGLE_LOCAL_VAR); \
- return RETVAL; \
- } \
- }
-
-#endif // LIBANGLE_VALIDATIONEGL_H_
diff --git a/src/3rdparty/angle/src/libANGLE/validationES.cpp b/src/3rdparty/angle/src/libANGLE/validationES.cpp
deleted file mode 100644
index 069ca045f8..0000000000
--- a/src/3rdparty/angle/src/libANGLE/validationES.cpp
+++ /dev/null
@@ -1,5828 +0,0 @@
-//
-// 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/VertexArray.h"
-#include "libANGLE/formatutils.h"
-#include "libANGLE/queryconversions.h"
-#include "libANGLE/validationES2.h"
-#include "libANGLE/validationES3.h"
-
-#include "common/mathutil.h"
-#include "common/utilities.h"
-
-using namespace angle;
-
-namespace gl
-{
-namespace
-{
-
-bool ValidateDrawAttribs(ValidationContext *context,
- GLint primcount,
- GLint maxVertex,
- GLint vertexCount)
-{
- const gl::State &state = context->getGLState();
- const gl::Program *program = state.getProgram();
-
- bool webglCompatibility = context->getExtensions().webglCompatibility;
-
- const VertexArray *vao = state.getVertexArray();
- const auto &vertexAttribs = vao->getVertexAttributes();
- const auto &vertexBindings = vao->getVertexBindings();
- size_t maxEnabledAttrib = vao->getMaxEnabledAttribute();
- for (size_t attributeIndex = 0; attributeIndex < maxEnabledAttrib; ++attributeIndex)
- {
- const VertexAttribute &attrib = vertexAttribs[attributeIndex];
-
- // No need to range check for disabled attribs.
- if (!attrib.enabled)
- {
- continue;
- }
-
- // If we have no buffer, then we either get an error, or there are no more checks to be
- // done.
- const VertexBinding &binding = vertexBindings[attrib.bindingIndex];
- gl::Buffer *buffer = binding.getBuffer().get();
- if (!buffer)
- {
- if (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.
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), VertexArrayNoBuffer);
- return false;
- }
- else if (attrib.pointer == nullptr)
- {
- // This is an application error that would normally result in a crash,
- // but we catch it and return an error
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), VertexArrayNoBufferPointer);
- return false;
- }
- continue;
- }
-
- // This needs to come after the check for client arrays as even unused attributes cannot use
- // client-side arrays
- if (!program->isAttribLocationActive(attributeIndex))
- {
- continue;
- }
-
- // If we're drawing zero vertices, we have enough data.
- if (vertexCount <= 0 || primcount <= 0)
- {
- continue;
- }
-
- GLint maxVertexElement = 0;
- GLuint divisor = binding.getDivisor();
- if (divisor == 0)
- {
- maxVertexElement = maxVertex;
- }
- else
- {
- maxVertexElement = (primcount - 1) / divisor;
- }
-
- // We do manual overflow checks here instead of using safe_math.h because it was
- // a bottleneck. Thanks to some properties of GL we know inequalities that can
- // help us make the overflow checks faster.
-
- // The max possible attribSize is 16 for a vector of 4 32 bit values.
- constexpr uint64_t kMaxAttribSize = 16;
- constexpr uint64_t kIntMax = std::numeric_limits<int>::max();
- constexpr uint64_t kUint64Max = std::numeric_limits<uint64_t>::max();
-
- // We know attribStride is given as a GLsizei which is typedefed to int.
- // We also know an upper bound for attribSize.
- static_assert(std::is_same<int, GLsizei>::value, "");
- uint64_t attribStride = ComputeVertexAttributeStride(attrib, binding);
- uint64_t attribSize = ComputeVertexAttributeTypeSize(attrib);
- ASSERT(attribStride <= kIntMax && attribSize <= kMaxAttribSize);
-
- // Computing the max offset using uint64_t without attrib.offset is overflow
- // safe. Note: Last vertex element does not take the full stride!
- static_assert(kIntMax * kIntMax < kUint64Max - kMaxAttribSize, "");
- uint64_t attribDataSizeNoOffset = maxVertexElement * attribStride + attribSize;
-
- // An overflow can happen when adding the offset, check for it.
- uint64_t attribOffset = ComputeVertexAttributeOffset(attrib, binding);
- if (attribDataSizeNoOffset > kUint64Max - attribOffset)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), IntegerOverflow);
- return false;
- }
- uint64_t attribDataSizeWithOffset = attribDataSizeNoOffset + attribOffset;
-
- // [OpenGL ES 3.0.2] section 2.9.4 page 40:
- // We can return INVALID_OPERATION if our vertex attribute does not have
- // enough backing data.
- if (attribDataSizeWithOffset > static_cast<uint64_t>(buffer->getSize()))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InsufficientVertexBufferSize);
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidReadPixelsTypeEnum(ValidationContext *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(ValidationContext *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(ValidationContext *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, ParamType *params, bool restrictedWrapModes)
-{
- switch (ConvertToGLenum(params[0]))
- {
- case GL_CLAMP_TO_EDGE:
- break;
-
- case GL_REPEAT:
- case GL_MIRRORED_REPEAT:
- if (restrictedWrapModes)
- {
- // OES_EGL_image_external and ANGLE_texture_rectangle specifies this error.
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidWrapModeTexture);
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureWrap);
- return false;
- }
-
- return true;
-}
-
-template <typename ParamType>
-bool ValidateTextureMinFilterValue(Context *context, 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.
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFilterTexture);
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureFilterParam);
- return false;
- }
-
- return true;
-}
-
-template <typename ParamType>
-bool ValidateTextureMagFilterValue(Context *context, ParamType *params)
-{
- switch (ConvertToGLenum(params[0]))
- {
- case GL_NEAREST:
- case GL_LINEAR:
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureFilterParam);
- return false;
- }
-
- return true;
-}
-
-template <typename ParamType>
-bool ValidateTextureCompareModeValue(Context *context, 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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), UnknownParameter);
- return false;
- }
-
- return true;
-}
-
-template <typename ParamType>
-bool ValidateTextureCompareFuncValue(Context *context, 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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), UnknownParameter);
- return false;
- }
-
- return true;
-}
-
-template <typename ParamType>
-bool ValidateTextureSRGBDecodeValue(Context *context, ParamType *params)
-{
- if (!context->getExtensions().textureSRGBDecode)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), ExtensionNotEnabled);
- return false;
- }
-
- switch (ConvertToGLenum(params[0]))
- {
- case GL_DECODE_EXT:
- case GL_SKIP_DECODE_EXT:
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), UnknownParameter);
- return false;
- }
-
- return true;
-}
-
-bool ValidateFragmentShaderColorBufferTypeMatch(ValidationContext *context)
-{
- const Program *program = context->getGLState().getProgram();
- const Framebuffer *framebuffer = context->getGLState().getDrawFramebuffer();
-
- const auto &programOutputTypes = program->getOutputVariableTypes();
- for (size_t drawBufferIdx = 0; drawBufferIdx < programOutputTypes.size(); drawBufferIdx++)
- {
- GLenum outputType = programOutputTypes[drawBufferIdx];
- GLenum inputType = framebuffer->getDrawbufferWriteType(drawBufferIdx);
- if (outputType != GL_NONE && inputType != GL_NONE && inputType != outputType)
- {
- context->handleError(InvalidOperation() << "Fragment shader output type does not "
- "match the bound framebuffer attachment "
- "type.");
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateVertexShaderAttributeTypeMatch(ValidationContext *context)
-{
- const auto &glState = context->getGLState();
- const Program *program = context->getGLState().getProgram();
- const VertexArray *vao = context->getGLState().getVertexArray();
- const auto &vertexAttribs = vao->getVertexAttributes();
- const auto &currentValues = glState.getVertexAttribCurrentValues();
-
- for (const sh::Attribute &shaderAttribute : program->getAttributes())
- {
- // gl_VertexID and gl_InstanceID are active attributes but don't have a bound attribute.
- if (shaderAttribute.isBuiltIn())
- {
- continue;
- }
-
- GLenum shaderInputType = VariableComponentType(shaderAttribute.type);
-
- const auto &attrib = vertexAttribs[shaderAttribute.location];
- GLenum vertexType = attrib.enabled ? GetVertexAttributeBaseType(attrib)
- : currentValues[shaderAttribute.location].Type;
-
- if (shaderInputType != GL_NONE && vertexType != GL_NONE && shaderInputType != vertexType)
- {
- context->handleError(InvalidOperation() << "Vertex shader input type does not "
- "match the type of the bound vertex "
- "attribute.");
- return false;
- }
- }
-
- return true;
-}
-
-} // anonymous namespace
-
-bool ValidTextureTarget(const ValidationContext *context, GLenum target)
-{
- switch (target)
- {
- case GL_TEXTURE_2D:
- case GL_TEXTURE_CUBE_MAP:
- return true;
-
- case GL_TEXTURE_RECTANGLE_ANGLE:
- return context->getExtensions().textureRectangle;
-
- case GL_TEXTURE_3D:
- case GL_TEXTURE_2D_ARRAY:
- return (context->getClientMajorVersion() >= 3);
-
- case GL_TEXTURE_2D_MULTISAMPLE:
- return (context->getClientVersion() >= Version(3, 1));
-
- default:
- return false;
- }
-}
-
-bool ValidTexture2DTarget(const ValidationContext *context, GLenum target)
-{
- switch (target)
- {
- case GL_TEXTURE_2D:
- case GL_TEXTURE_CUBE_MAP:
- return true;
-
- case GL_TEXTURE_RECTANGLE_ANGLE:
- return context->getExtensions().textureRectangle;
-
- default:
- return false;
- }
-}
-
-bool ValidTexture3DTarget(const ValidationContext *context, GLenum target)
-{
- switch (target)
- {
- case GL_TEXTURE_3D:
- case GL_TEXTURE_2D_ARRAY:
- 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 ValidationContext *context, GLenum target)
-{
- return (target == GL_TEXTURE_EXTERNAL_OES) &&
- (context->getExtensions().eglImageExternal ||
- context->getExtensions().eglStreamConsumerExternal);
-}
-
-// 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 ValidationContext *context, GLenum target)
-{
- switch (target)
- {
- case GL_TEXTURE_2D:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- return true;
- case GL_TEXTURE_RECTANGLE_ANGLE:
- return context->getExtensions().textureRectangle;
- default:
- return false;
- }
-}
-
-bool ValidateDrawElementsInstancedBase(ValidationContext *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const GLvoid *indices,
- GLsizei primcount)
-{
- if (primcount < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativePrimcount);
- return false;
- }
-
- if (!ValidateDrawElementsCommon(context, mode, count, type, indices, primcount))
- {
- return false;
- }
-
- // No-op zero primitive count
- return (primcount > 0);
-}
-
-bool ValidateDrawArraysInstancedBase(Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei primcount)
-{
- if (primcount < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativePrimcount);
- return false;
- }
-
- if (!ValidateDrawArraysCommon(context, mode, first, count, primcount))
- {
- return false;
- }
-
- // No-op if zero primitive count
- return (primcount > 0);
-}
-
-bool ValidateDrawInstancedANGLE(ValidationContext *context)
-{
- // Verify there is at least one active attribute with a divisor of zero
- const State &state = context->getGLState();
-
- Program *program = state.getProgram();
-
- 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;
- }
- }
-
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoZeroDivisor);
- return false;
-}
-
-bool ValidTexture3DDestinationTarget(const ValidationContext *context, GLenum target)
-{
- switch (target)
- {
- case GL_TEXTURE_3D:
- case GL_TEXTURE_2D_ARRAY:
- return true;
- default:
- return false;
- }
-}
-
-bool ValidTexLevelDestinationTarget(const ValidationContext *context, GLenum target)
-{
- switch (target)
- {
- case GL_TEXTURE_2D:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- case GL_TEXTURE_3D:
- case GL_TEXTURE_2D_ARRAY:
- case GL_TEXTURE_2D_MULTISAMPLE:
- return true;
- case GL_TEXTURE_RECTANGLE_ANGLE:
- return context->getExtensions().textureRectangle;
- default:
- return false;
- }
-}
-
-bool ValidFramebufferTarget(const ValidationContext *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 ValidBufferType(const ValidationContext *context, BufferBinding target)
-{
- switch (target)
- {
- case BufferBinding::ElementArray:
- case BufferBinding::Array:
- return true;
-
- case BufferBinding::PixelPack:
- case BufferBinding::PixelUnpack:
- return (context->getExtensions().pixelBufferObject ||
- context->getClientMajorVersion() >= 3);
-
- case BufferBinding::CopyRead:
- case BufferBinding::CopyWrite:
- case BufferBinding::TransformFeedback:
- case BufferBinding::Uniform:
- return (context->getClientMajorVersion() >= 3);
-
- case BufferBinding::AtomicCounter:
- case BufferBinding::ShaderStorage:
- case BufferBinding::DrawIndirect:
- case BufferBinding::DispatchIndirect:
- return context->getClientVersion() >= Version(3, 1);
-
- default:
- return false;
- }
-}
-
-bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level)
-{
- const auto &caps = context->getCaps();
- size_t maxDimension = 0;
- switch (target)
- {
- case GL_TEXTURE_2D:
- maxDimension = caps.max2DTextureSize;
- break;
- case GL_TEXTURE_CUBE_MAP:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- maxDimension = caps.maxCubeMapTextureSize;
- break;
- case GL_TEXTURE_RECTANGLE_ANGLE:
- return level == 0;
- case GL_TEXTURE_3D:
- maxDimension = caps.max3DTextureSize;
- break;
- case GL_TEXTURE_2D_ARRAY:
- maxDimension = caps.max2DTextureSize;
- break;
- case GL_TEXTURE_2D_MULTISAMPLE:
- maxDimension = caps.max2DTextureSize;
- break;
- default:
- UNREACHABLE();
- }
-
- return level <= gl::log2(static_cast<int>(maxDimension)) && level >= 0;
-}
-
-bool ValidImageSizeParameters(ValidationContext *context,
- GLenum target,
- GLint level,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- bool isSubImage)
-{
- if (width < 0 || height < 0 || depth < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize);
- 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 && (!gl::isPow2(width) || !gl::isPow2(height) || !gl::isPow2(depth))))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), TextureNotPow2);
- return false;
- }
-
- if (!ValidMipLevel(context, target, level))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel);
- return false;
- }
-
- return true;
-}
-
-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:
- return true;
-
- default:
- return false;
- }
-}
-
-bool ValidCompressedDimension(GLsizei size, GLuint blockSize, bool smallerThanBlockSizeAllowed)
-{
- return (smallerThanBlockSizeAllowed && (size > 0) && (blockSize % size == 0)) ||
- (size % blockSize == 0);
-}
-
-bool ValidCompressedImageSize(const ValidationContext *context,
- GLenum internalFormat,
- GLint level,
- GLsizei width,
- GLsizei height)
-{
- const gl::InternalFormat &formatInfo = gl::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))
- {
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidCompressedSubImageSize(const ValidationContext *context,
- GLenum internalFormat,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- size_t textureWidth,
- size_t textureHeight)
-{
- const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalFormat);
- if (!formatInfo.compressed)
- {
- return false;
- }
-
- if (xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
- {
- return false;
- }
-
- if (CompressedTextureFormatRequiresExactSize(internalFormat))
- {
- if (xoffset % formatInfo.compressedBlockWidth != 0 ||
- yoffset % formatInfo.compressedBlockHeight != 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;
- bool sizeMultipleOfBlockSize = (width % formatInfo.compressedBlockWidth) == 0 &&
- (height % formatInfo.compressedBlockHeight) == 0;
- if (!sizeMultipleOfBlockSize && !fillsEntireMip)
- {
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidImageDataSize(ValidationContext *context,
- GLenum textureTarget,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLenum type,
- const void *pixels,
- GLsizei imageSize)
-{
- gl::Buffer *pixelUnpackBuffer =
- context->getGLState().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 gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format, type);
- ASSERT(formatInfo.internalFormat != GL_NONE);
- const gl::Extents size(width, height, depth);
- const auto &unpack = context->getGLState().getUnpackState();
-
- bool targetIs3D = textureTarget == GL_TEXTURE_3D || textureTarget == GL_TEXTURE_2D_ARRAY;
- auto endByteOrErr = formatInfo.computePackUnpackEndByte(type, size, unpack, targetIs3D);
- if (endByteOrErr.isError())
- {
- context->handleError(endByteOrErr.getError());
- return false;
- }
-
- GLuint endByte = endByteOrErr.getResult();
-
- if (pixelUnpackBuffer)
- {
- CheckedNumeric<size_t> checkedEndByte(endByteOrErr.getResult());
- 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->handleError(InvalidOperation());
- return false;
- }
- }
- else
- {
- ASSERT(imageSize >= 0);
- if (pixels == nullptr && imageSize != 0)
- {
- context->handleError(InvalidOperation()
- << "imageSize must be 0 if no texture data is provided.");
- return false;
- }
-
- if (pixels != nullptr && endByte > static_cast<GLuint>(imageSize))
- {
- context->handleError(InvalidOperation() << "imageSize must be at least " << endByte);
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidQueryType(const Context *context, GLenum queryType)
-{
- static_assert(GL_ANY_SAMPLES_PASSED == GL_ANY_SAMPLES_PASSED_EXT,
- "GL extension enums not equal.");
- static_assert(GL_ANY_SAMPLES_PASSED_CONSERVATIVE == GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT,
- "GL extension enums not equal.");
-
- switch (queryType)
- {
- case GL_ANY_SAMPLES_PASSED:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
- return context->getClientMajorVersion() >= 3 ||
- context->getExtensions().occlusionQueryBoolean;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- return (context->getClientMajorVersion() >= 3);
- case GL_TIME_ELAPSED_EXT:
- return context->getExtensions().disjointTimerQuery;
- case GL_COMMANDS_COMPLETED_CHROMIUM:
- return context->getExtensions().syncQuery;
- default:
- return false;
- }
-}
-
-bool ValidateWebGLVertexAttribPointer(ValidationContext *context,
- GLenum 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->handleError(InvalidValue()
- << "Stride is over the maximum stride allowed by WebGL.");
- 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.
- VertexFormatType internalType = GetVertexFormatType(type, normalized, 1, pureInteger);
- size_t typeSize = GetVertexFormatTypeSize(internalType);
-
- ASSERT(isPow2(typeSize) && typeSize > 0);
- size_t sizeMask = (typeSize - 1);
- if ((reinterpret_cast<intptr_t>(ptr) & sizeMask) != 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), OffsetMustBeMultipleOfType);
- return false;
- }
-
- if ((stride & sizeMask) != 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), StrideMustBeMultipleOfType);
- return false;
- }
-
- return true;
-}
-
-Program *GetValidProgram(ValidationContext *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->getProgram(id);
-
- if (!validProgram)
- {
- if (context->getShader(id))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExpectedProgramName);
- }
- else
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProgramName);
- }
- }
-
- return validProgram;
-}
-
-Shader *GetValidShader(ValidationContext *context, GLuint id)
-{
- // See ValidProgram for spec details.
-
- Shader *validShader = context->getShader(id);
-
- if (!validShader)
- {
- if (context->getProgram(id))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExpectedShaderName);
- }
- else
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidShaderName);
- }
- }
-
- return validShader;
-}
-
-bool ValidateAttachmentTarget(gl::Context *context, GLenum attachment)
-{
- if (attachment >= GL_COLOR_ATTACHMENT1_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
- {
- if (context->getClientMajorVersion() < 3 && !context->getExtensions().drawBuffers)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidAttachment);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidAttachment);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidAttachment);
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidAttachment);
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateRenderbufferStorageParametersBase(ValidationContext *context,
- GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height)
-{
- switch (target)
- {
- case GL_RENDERBUFFER:
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidRenderbufferTarget);
- return false;
- }
-
- if (width < 0 || height < 0 || samples < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidRenderbufferWidthHeight);
- 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.renderable)
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- // ANGLE_framebuffer_multisample does not explicitly state that the internal format must be
- // sized but it does state that the format must be in the ES2.0 spec table 4.5 which contains
- // only sized internal formats.
- const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(convertedInternalFormat);
- if (formatInfo.internalFormat == GL_NONE)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidRenderbufferInternalFormat);
- return false;
- }
-
- if (static_cast<GLuint>(std::max(width, height)) > context->getCaps().maxRenderbufferSize)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- GLuint handle = context->getGLState().getRenderbufferId();
- if (handle == 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidRenderbufferTarget);
- return false;
- }
-
- return true;
-}
-
-bool ValidateFramebufferRenderbufferParameters(gl::Context *context,
- GLenum target,
- GLenum attachment,
- GLenum renderbuffertarget,
- GLuint renderbuffer)
-{
- if (!ValidFramebufferTarget(context, target))
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- gl::Framebuffer *framebuffer = context->getGLState().getTargetFramebuffer(target);
-
- ASSERT(framebuffer);
- if (framebuffer->id() == 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), DefaultFramebufferTarget);
- 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))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidRenderbufferTarget);
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateBlitFramebufferParameters(ValidationContext *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->handleError(InvalidEnum());
- return false;
- }
-
- if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (mask == 0)
- {
- // ES3.0 spec, section 4.3.2 specifies that a mask of zero is valid and no
- // buffers are copied.
- return false;
- }
-
- // 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->handleError(InvalidOperation());
- return false;
- }
-
- const auto &glState = context->getGLState();
- gl::Framebuffer *readFramebuffer = glState.getReadFramebuffer();
- gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer();
-
- if (!readFramebuffer || !drawFramebuffer)
- {
- context->handleError(InvalidFramebufferOperation());
- return false;
- }
-
- if (readFramebuffer->id() == drawFramebuffer->id())
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (readFramebuffer->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE)
- {
- context->handleError(InvalidFramebufferOperation());
- return false;
- }
-
- if (drawFramebuffer->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE)
- {
- context->handleError(InvalidFramebufferOperation());
- return false;
- }
-
- if (drawFramebuffer->getSamples(context) != 0)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- bool sameBounds = srcX0 == dstX0 && srcY0 == dstY0 && srcX1 == dstX1 && srcY1 == dstY1;
-
- if (mask & GL_COLOR_BUFFER_BIT)
- {
- const gl::FramebufferAttachment *readColorBuffer = readFramebuffer->getReadColorbuffer();
- 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->handleError(InvalidOperation()
- << "If the read buffer contains fixed-point or "
- "floating-point values, the draw buffer must "
- "as well.");
- return false;
- }
- }
- else if (readFixedPoint != drawFixedPoint)
- {
- context->handleError(InvalidOperation()
- << "If the read buffer contains fixed-point values, "
- "the draw buffer must as well.");
- return false;
- }
-
- if (readComponentType == GL_UNSIGNED_INT &&
- drawComponentType != GL_UNSIGNED_INT)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (readComponentType == GL_INT && drawComponentType != GL_INT)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (readColorBuffer->getSamples() > 0 &&
- (!Format::EquivalentForBlit(readFormat, drawFormat) || !sameBounds))
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (context->getExtensions().webglCompatibility &&
- *readColorBuffer == *attachment)
- {
- context->handleError(
- InvalidOperation()
- << "Read and write color attachments cannot be the same image.");
- return false;
- }
- }
- }
-
- if ((readFormat.info->componentType == GL_INT ||
- readFormat.info->componentType == GL_UNSIGNED_INT) &&
- filter == GL_LINEAR)
- {
- context->handleError(InvalidOperation());
- 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->handleError(
- InvalidOperation()
- << "Attempt to read from a missing color attachment of a complete framebuffer.");
- 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 gl::FramebufferAttachment *readBuffer =
- readFramebuffer->getAttachment(attachments[i]);
- const gl::FramebufferAttachment *drawBuffer =
- drawFramebuffer->getAttachment(attachments[i]);
-
- if (readBuffer && drawBuffer)
- {
- if (!Format::EquivalentForBlit(readBuffer->getFormat(), drawBuffer->getFormat()))
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (readBuffer->getSamples() > 0 && !sameBounds)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (context->getExtensions().webglCompatibility && *readBuffer == *drawBuffer)
- {
- context->handleError(
- InvalidOperation()
- << "Read and write depth stencil attachments cannot be the same image.");
- return false;
- }
- }
- // WebGL 2.0 BlitFramebuffer when blitting from a missing attachment
- else if (drawBuffer)
- {
- context->handleError(InvalidOperation() << "Attempt to read from a missing "
- "depth/stencil attachment of a "
- "complete framebuffer.");
- return false;
- }
- }
- }
-
- // ANGLE_multiview, Revision 1:
- // Calling BlitFramebuffer will result in an INVALID_FRAMEBUFFER_OPERATION error if the
- // multi-view layout of the current draw framebuffer or read framebuffer is not NONE.
- if (readFramebuffer->getMultiviewLayout() != GL_NONE)
- {
- context->handleError(InvalidFramebufferOperation()
- << "Attempt to read from a multi-view framebuffer.");
- return false;
- }
- if (drawFramebuffer->getMultiviewLayout() != GL_NONE)
- {
- context->handleError(InvalidFramebufferOperation()
- << "Attempt to write to a multi-view framebuffer.");
- 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;
- }
-
- if (!ValidateReadPixelsBase(context, x, y, width, height, format, type, bufSize, length,
- columns, rows, pixels))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- 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)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateReadPixelsBase(context, x, y, width, height, format, type, bufSize, length,
- columns, rows, data))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGenQueriesEXT(gl::Context *context, GLsizei n, GLuint *ids)
-{
- if (!context->getExtensions().occlusionQueryBoolean &&
- !context->getExtensions().disjointTimerQuery)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), QueryExtensionNotEnabled);
- return false;
- }
-
- return ValidateGenOrDelete(context, n);
-}
-
-bool ValidateDeleteQueriesEXT(gl::Context *context, GLsizei n, const GLuint *ids)
-{
- if (!context->getExtensions().occlusionQueryBoolean &&
- !context->getExtensions().disjointTimerQuery)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), QueryExtensionNotEnabled);
- return false;
- }
-
- return ValidateGenOrDelete(context, n);
-}
-
-bool ValidateIsQueryEXT(gl::Context *context, GLuint id)
-{
- if (!context->getExtensions().occlusionQueryBoolean &&
- !context->getExtensions().disjointTimerQuery)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), QueryExtensionNotEnabled);
- return false;
- }
-
- return true;
-}
-
-bool ValidateBeginQueryBase(gl::Context *context, GLenum target, GLuint id)
-{
- if (!ValidQueryType(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidQueryType);
- return false;
- }
-
- if (id == 0)
- {
- context->handleError(InvalidOperation() << "Query id is 0");
- 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->getGLState().isQueryActive(target))
- {
- context->handleError(InvalidOperation() << "Other query is active");
- return false;
- }
-
- Query *queryObject = context->getQuery(id, true, target);
-
- // check that name was obtained with glGenQueries
- if (!queryObject)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidQueryId);
- return false;
- }
-
- // check for type mismatch
- if (queryObject->getType() != target)
- {
- context->handleError(InvalidOperation() << "Query type does not match target");
- return false;
- }
-
- return true;
-}
-
-bool ValidateBeginQueryEXT(gl::Context *context, GLenum target, GLuint id)
-{
- if (!context->getExtensions().occlusionQueryBoolean &&
- !context->getExtensions().disjointTimerQuery && !context->getExtensions().syncQuery)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), QueryExtensionNotEnabled);
- return false;
- }
-
- return ValidateBeginQueryBase(context, target, id);
-}
-
-bool ValidateEndQueryBase(gl::Context *context, GLenum target)
-{
- if (!ValidQueryType(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidQueryType);
- return false;
- }
-
- const Query *queryObject = context->getGLState().getActiveQuery(target);
-
- if (queryObject == nullptr)
- {
- context->handleError(InvalidOperation() << "Query target not active");
- return false;
- }
-
- return true;
-}
-
-bool ValidateEndQueryEXT(gl::Context *context, GLenum target)
-{
- if (!context->getExtensions().occlusionQueryBoolean &&
- !context->getExtensions().disjointTimerQuery && !context->getExtensions().syncQuery)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), QueryExtensionNotEnabled);
- return false;
- }
-
- return ValidateEndQueryBase(context, target);
-}
-
-bool ValidateQueryCounterEXT(Context *context, GLuint id, GLenum target)
-{
- if (!context->getExtensions().disjointTimerQuery)
- {
- context->handleError(InvalidOperation() << "Disjoint timer query not enabled");
- return false;
- }
-
- if (target != GL_TIMESTAMP_EXT)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidQueryTarget);
- return false;
- }
-
- Query *queryObject = context->getQuery(id, true, target);
- if (queryObject == nullptr)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidQueryId);
- return false;
- }
-
- if (context->getGLState().isQueryActive(queryObject))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), QueryActive);
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetQueryivBase(Context *context, GLenum target, GLenum pname, GLsizei *numParams)
-{
- if (numParams)
- {
- *numParams = 0;
- }
-
- if (!ValidQueryType(context, target) && target != GL_TIMESTAMP_EXT)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidQueryType);
- return false;
- }
-
- switch (pname)
- {
- case GL_CURRENT_QUERY_EXT:
- if (target == GL_TIMESTAMP_EXT)
- {
- context->handleError(InvalidEnum() << "Cannot use current query for timestamp");
- return false;
- }
- break;
- case GL_QUERY_COUNTER_BITS_EXT:
- if (!context->getExtensions().disjointTimerQuery ||
- (target != GL_TIMESTAMP_EXT && target != GL_TIME_ELAPSED_EXT))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
- return false;
- }
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
- return false;
- }
-
- if (numParams)
- {
- // All queries return only one value
- *numParams = 1;
- }
-
- return true;
-}
-
-bool ValidateGetQueryivEXT(Context *context, GLenum target, GLenum pname, GLint *params)
-{
- if (!context->getExtensions().occlusionQueryBoolean &&
- !context->getExtensions().disjointTimerQuery && !context->getExtensions().syncQuery)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- return ValidateGetQueryivBase(context, target, pname, nullptr);
-}
-
-bool ValidateGetQueryivRobustANGLE(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetQueryivBase(context, target, pname, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetQueryObjectValueBase(Context *context, GLuint id, GLenum pname, GLsizei *numParams)
-{
- if (numParams)
- {
- *numParams = 0;
- }
-
- Query *queryObject = context->getQuery(id, false, GL_NONE);
-
- if (!queryObject)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidQueryId);
- return false;
- }
-
- if (context->getGLState().isQueryActive(queryObject))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), QueryActive);
- return false;
- }
-
- switch (pname)
- {
- case GL_QUERY_RESULT_EXT:
- case GL_QUERY_RESULT_AVAILABLE_EXT:
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- if (numParams)
- {
- *numParams = 1;
- }
-
- return true;
-}
-
-bool ValidateGetQueryObjectivEXT(Context *context, GLuint id, GLenum pname, GLint *params)
-{
- if (!context->getExtensions().disjointTimerQuery)
- {
- context->handleError(InvalidOperation() << "Timer query extension not enabled");
- 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->handleError(InvalidOperation() << "Timer query extension not enabled");
- return false;
- }
-
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetQueryObjectValueBase(context, id, pname, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetQueryObjectuivEXT(Context *context, GLuint id, GLenum pname, GLuint *params)
-{
- if (!context->getExtensions().disjointTimerQuery &&
- !context->getExtensions().occlusionQueryBoolean && !context->getExtensions().syncQuery)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetQueryObjectValueBase(context, id, pname, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetQueryObjecti64vEXT(Context *context, GLuint id, GLenum pname, GLint64 *params)
-{
- if (!context->getExtensions().disjointTimerQuery)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetQueryObjectValueBase(context, id, pname, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetQueryObjectui64vEXT(Context *context, GLuint id, GLenum pname, GLuint64 *params)
-{
- if (!context->getExtensions().disjointTimerQuery)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetQueryObjectValueBase(context, id, pname, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateUniformCommonBase(ValidationContext *context,
- gl::Program *program,
- GLint location,
- GLsizei count,
- const LinkedUniform **uniformOut)
-{
- // TODO(Jiajia): Add image uniform check in future.
- if (count < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeCount);
- return false;
- }
-
- if (!program)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidProgramName);
- return false;
- }
-
- if (!program->isLinked())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
- 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->handleError(InvalidOperation() << "Invalid uniform location");
- return false;
- }
-
- const auto &uniformLocation = uniformLocations[castedLocation];
- if (uniformLocation.ignored)
- {
- // Silently ignore the uniform command
- return false;
- }
-
- if (!uniformLocation.used())
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- const auto &uniform = program->getUniformByIndex(uniformLocation.index);
-
- // attempting to write an array to a non-array uniform is an INVALID_OPERATION
- if (!uniform.isArray() && count > 1)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- *uniformOut = &uniform;
- return true;
-}
-
-bool ValidateUniform1ivValue(ValidationContext *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->handleError(InvalidValue() << "sampler uniform value out of range");
- return false;
- }
- }
- return true;
- }
-
- context->handleError(InvalidOperation() << "wrong type of value for uniform");
- return false;
-}
-
-bool ValidateUniformValue(ValidationContext *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)
- {
- return true;
- }
-
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), UniformSizeMismatch);
- return false;
-}
-
-bool ValidateUniformMatrixValue(ValidationContext *context, GLenum valueType, GLenum uniformType)
-{
- // Check that the value type is compatible with uniform type.
- if (valueType == uniformType)
- {
- return true;
- }
-
- context->handleError(InvalidOperation() << "wrong type of value for uniform");
- return false;
-}
-
-bool ValidateUniform(ValidationContext *context, GLenum valueType, GLint location, GLsizei count)
-{
- const LinkedUniform *uniform = nullptr;
- gl::Program *programObject = context->getGLState().getProgram();
- return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
- ValidateUniformValue(context, valueType, uniform->type);
-}
-
-bool ValidateUniform1iv(ValidationContext *context,
- GLint location,
- GLsizei count,
- const GLint *value)
-{
- const LinkedUniform *uniform = nullptr;
- gl::Program *programObject = context->getGLState().getProgram();
- return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
- ValidateUniform1ivValue(context, uniform->type, count, value);
-}
-
-bool ValidateUniformMatrix(ValidationContext *context,
- GLenum valueType,
- GLint location,
- GLsizei count,
- GLboolean transpose)
-{
- if (ConvertToBool(transpose) && context->getClientMajorVersion() < 3)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- const LinkedUniform *uniform = nullptr;
- gl::Program *programObject = context->getGLState().getProgram();
- return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
- ValidateUniformMatrixValue(context, valueType, uniform->type);
-}
-
-bool ValidateStateQuery(ValidationContext *context,
- GLenum pname,
- GLenum *nativeType,
- unsigned int *numParams)
-{
- if (!context->getQueryParameterInfo(pname, nativeType, numParams))
- {
- context->handleError(InvalidEnum());
- 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->handleError(InvalidOperation());
- 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_RECTANGLE_ANGLE:
- if (!context->getExtensions().textureRectangle)
- {
- context->handleError(InvalidEnum()
- << "ANGLE_texture_rectangle extension not present");
- return false;
- }
- break;
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- if (!context->getExtensions().eglStreamConsumerExternal &&
- !context->getExtensions().eglImageExternal)
- {
- context->handleError(InvalidEnum() << "Neither NV_EGL_stream_consumer_external "
- "nor GL_OES_EGL_image_external "
- "extensions enabled");
- return false;
- }
- break;
-
- case GL_IMPLEMENTATION_COLOR_READ_TYPE:
- case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
- {
- if (context->getGLState().getReadFramebuffer()->checkStatus(context) !=
- GL_FRAMEBUFFER_COMPLETE)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer();
- ASSERT(framebuffer);
-
- if (framebuffer->getReadBufferState() == GL_NONE)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ReadBufferNone);
- return false;
- }
-
- const FramebufferAttachment *attachment = framebuffer->getReadColorbuffer();
- if (!attachment)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- }
- break;
-
- default:
- break;
- }
-
- // pname is valid, but there are no parameters to return
- if (*numParams == 0)
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateRobustStateQuery(ValidationContext *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(ValidationContext *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border,
- Format *textureFormatOut)
-{
- if (xoffset < 0 || yoffset < 0 || zoffset < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset);
- return false;
- }
-
- if (width < 0 || height < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize);
- return false;
- }
-
- if (std::numeric_limits<GLsizei>::max() - xoffset < width ||
- std::numeric_limits<GLsizei>::max() - yoffset < height)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (border != 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidBorder);
- return false;
- }
-
- if (!ValidMipLevel(context, target, level))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel);
- return false;
- }
-
- const auto &state = context->getGLState();
- Framebuffer *readFramebuffer = state.getReadFramebuffer();
- if (readFramebuffer->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE)
- {
- context->handleError(InvalidFramebufferOperation());
- return false;
- }
-
- if (readFramebuffer->id() != 0 && readFramebuffer->getSamples(context) != 0)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (readFramebuffer->getReadBufferState() == GL_NONE)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ReadBufferNone);
- 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->getReadColorbuffer();
- if (source == nullptr)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MissingReadAttachment);
- 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 not NONE.
- if (source->getMultiviewLayout() != GL_NONE)
- {
- context->handleError(InvalidFramebufferOperation()
- << "The active read framebuffer object has multiview attachments.");
- return false;
- }
-
- const gl::Caps &caps = context->getCaps();
-
- GLuint maxDimension = 0;
- switch (target)
- {
- case GL_TEXTURE_2D:
- maxDimension = caps.max2DTextureSize;
- break;
-
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- maxDimension = caps.maxCubeMapTextureSize;
- break;
-
- case GL_TEXTURE_RECTANGLE_ANGLE:
- maxDimension = caps.maxRectangleTextureSize;
- break;
-
- case GL_TEXTURE_2D_ARRAY:
- maxDimension = caps.max2DTextureSize;
- break;
-
- case GL_TEXTURE_3D:
- maxDimension = caps.max3DTextureSize;
- break;
-
- default:
- context->handleError(InvalidEnum());
- return false;
- }
-
- gl::Texture *texture =
- state.getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- if (!texture)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), TextureNotBound);
- return false;
- }
-
- if (texture->getImmutableFormat() && !isSubImage)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- const gl::InternalFormat &formatInfo =
- isSubImage ? *texture->getFormat(target, level).info
- : gl::GetInternalFormatInfo(internalformat, GL_UNSIGNED_BYTE);
-
- if (formatInfo.depthBits > 0 || formatInfo.compressed)
- {
- context->handleError(InvalidOperation());
- 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->handleError(InvalidValue());
- return false;
- }
- }
- else
- {
- if (IsCubeMapTextureTarget(target) && width != height)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), CubemapIncomplete);
- return false;
- }
-
- if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- int maxLevelDimension = (maxDimension >> level);
- if (static_cast<int>(width) > maxLevelDimension ||
- static_cast<int>(height) > maxLevelDimension)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), ResourceMaxTextureSize);
- 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))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), FeedbackLoop);
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count)
-{
- switch (mode)
- {
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- case GL_TRIANGLES:
- case GL_TRIANGLE_STRIP:
- case GL_TRIANGLE_FAN:
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidDrawMode);
- return false;
- }
-
- if (count < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeCount);
- return false;
- }
-
- const State &state = context->getGLState();
-
- const Extensions &extensions = context->getExtensions();
-
- // 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
- if (!extensions.webglCompatibility)
- {
- // Check for mapped buffers
- // TODO(jmadill): Optimize this check for non - WebGL contexts.
- if (state.hasMappedBuffer(BufferBinding::Array))
- {
- context->handleError(InvalidOperation());
- return false;
- }
- }
-
- // 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();
- if (context->getLimitations().noSeparateStencilRefsAndMasks || extensions.webglCompatibility)
- {
- const FramebufferAttachment *dsAttachment =
- framebuffer->getStencilOrDepthStencilAttachment();
- GLuint stencilBits = dsAttachment ? dsAttachment->getStencilSize() : 0;
- GLuint minimumRequiredStencilMask = (1 << stencilBits) - 1;
- const DepthStencilState &depthStencilState = state.getDepthStencilState();
-
- bool differentRefs = state.getStencilRef() != state.getStencilBackRef();
- bool differentWritemasks =
- (depthStencilState.stencilWritemask & minimumRequiredStencilMask) !=
- (depthStencilState.stencilBackWritemask & minimumRequiredStencilMask);
- bool differentMasks = (depthStencilState.stencilMask & minimumRequiredStencilMask) !=
- (depthStencilState.stencilBackMask & minimumRequiredStencilMask);
-
- if (differentRefs || differentWritemasks || differentMasks)
- {
- if (!extensions.webglCompatibility)
- {
- ERR() << "This ANGLE implementation does not support separate front/back stencil "
- "writemasks, reference values, or stencil mask values.";
- }
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), StencilReferenceMaskOrMismatch);
- return false;
- }
- }
-
- if (framebuffer->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE)
- {
- context->handleError(InvalidFramebufferOperation());
- return false;
- }
-
- gl::Program *program = state.getProgram();
- if (!program)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotBound);
- return false;
- }
-
- // 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->isLinked() &&
- (!program->hasLinkedVertexShader() || !program->hasLinkedFragmentShader()))
- {
- context->handleError(InvalidOperation() << "It is a undefined behaviour to render without "
- "vertex shader stage or fragment shader stage.");
- return false;
- }
-
- if (!program->validateSamplers(nullptr, context->getCaps()))
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (extensions.multiview)
- {
- const int programNumViews = program->usesMultiview() ? program->getNumViews() : 1;
- const int framebufferNumViews = framebuffer->getNumViews();
- if (framebufferNumViews != programNumViews)
- {
- context->handleError(InvalidOperation() << "The number of views in the active program "
- "and draw framebuffer does not match.");
- return false;
- }
-
- const TransformFeedback *transformFeedbackObject = state.getCurrentTransformFeedback();
- if (transformFeedbackObject != nullptr && transformFeedbackObject->isActive() &&
- framebufferNumViews > 1)
- {
- context->handleError(InvalidOperation()
- << "There is an active transform feedback object "
- "when the number of views in the active draw "
- "framebuffer is greater than 1.");
- return false;
- }
-
- if (extensions.disjointTimerQuery && framebufferNumViews > 1 &&
- state.isQueryActive(GL_TIME_ELAPSED_EXT))
- {
- context->handleError(InvalidOperation() << "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.");
- return false;
- }
- }
-
- // Uniform buffer validation
- for (unsigned int uniformBlockIndex = 0;
- uniformBlockIndex < program->getActiveUniformBlockCount(); uniformBlockIndex++)
- {
- const gl::InterfaceBlock &uniformBlock = program->getUniformBlockByIndex(uniformBlockIndex);
- GLuint blockBinding = program->getUniformBlockBinding(uniformBlockIndex);
- const OffsetBindingPointer<Buffer> &uniformBuffer =
- state.getIndexedUniformBuffer(blockBinding);
-
- if (uniformBuffer.get() == nullptr)
- {
- // undefined behaviour
- context->handleError(
- InvalidOperation()
- << "It is undefined behaviour to have a used but unbound uniform buffer.");
- return false;
- }
-
- size_t uniformBufferSize = uniformBuffer.getSize();
- if (uniformBufferSize == 0)
- {
- // Bind the whole buffer.
- uniformBufferSize = static_cast<size_t>(uniformBuffer->getSize());
- }
-
- if (uniformBufferSize < uniformBlock.dataSize)
- {
- // undefined behaviour
- context->handleError(
- InvalidOperation()
- << "It is undefined behaviour to use a uniform buffer that is too small.");
- return false;
- }
- }
-
- // Do some additonal WebGL-specific validation
- if (extensions.webglCompatibility)
- {
- // Detect rendering feedback loops for WebGL.
- if (framebuffer->formsRenderingFeedbackLoopWith(state))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), FeedbackLoop);
- return false;
- }
-
- // Detect that the vertex shader input types match the attribute types
- if (!ValidateVertexShaderAttributeTypeMatch(context))
- {
- return false;
- }
-
- // Detect that the color buffer types match the fragment shader output types
- if (!ValidateFragmentShaderColorBufferTypeMatch(context))
- {
- return false;
- }
- }
-
- // No-op if zero count
- return (count > 0);
-}
-
-bool ValidateDrawArraysCommon(ValidationContext *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei primcount)
-{
- if (first < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeStart);
- return false;
- }
-
- const State &state = context->getGLState();
- gl::TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
- if (curTransformFeedback && curTransformFeedback->isActive() &&
- !curTransformFeedback->isPaused() && curTransformFeedback->getPrimitiveMode() != mode)
- {
- // It is an invalid operation to call DrawArrays or DrawArraysInstanced with a draw mode
- // that does not match the current transform feedback object's draw mode (if transform
- // feedback
- // is active), (3.0.2, section 2.14, pg 86)
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidDrawModeTransformFeedback);
- return false;
- }
-
- if (!ValidateDrawBase(context, mode, count))
- {
- return false;
- }
-
- // Check the computation of maxVertex doesn't overflow.
- // - first < 0 or count < 0 have been checked as an error condition
- // - count > 0 has been checked in ValidateDrawBase as it makes the call a noop
- // From this we know maxVertex will be positive, and only need to check if it overflows GLint.
- ASSERT(count > 0 && first >= 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()))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), IntegerOverflow);
- return false;
- }
-
- if (!ValidateDrawAttribs(context, primcount, static_cast<GLint>(maxVertex), count))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateDrawArraysInstancedANGLE(Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei primcount)
-{
- if (!context->getExtensions().instancedArrays)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- if (!ValidateDrawArraysInstancedBase(context, mode, first, count, primcount))
- {
- return false;
- }
-
- return ValidateDrawInstancedANGLE(context);
-}
-
-bool ValidateDrawElementsBase(ValidationContext *context, GLenum type)
-{
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT:
- break;
- case GL_UNSIGNED_INT:
- if (context->getClientMajorVersion() < 3 && !context->getExtensions().elementIndexUint)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), TypeNotUnsignedShortByte);
- return false;
- }
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), TypeNotUnsignedShortByte);
- return false;
- }
-
- const State &state = context->getGLState();
-
- gl::TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
- if (curTransformFeedback && curTransformFeedback->isActive() &&
- !curTransformFeedback->isPaused())
- {
- // It is an invalid operation to call DrawElements, DrawRangeElements or
- // DrawElementsInstanced
- // while transform feedback is active, (3.0.2, section 2.14, pg 86)
- context->handleError(InvalidOperation());
- return false;
- }
-
- return true;
-}
-
-bool ValidateDrawElementsCommon(ValidationContext *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei primcount)
-{
- if (!ValidateDrawElementsBase(context, type))
- return false;
-
- const State &state = context->getGLState();
-
- if (!ValidateDrawBase(context, mode, count))
- {
- return false;
- }
-
- // 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
- if (!context->getExtensions().webglCompatibility)
- {
- // Check for mapped buffers
- // TODO(jmadill): Optimize this check for non - WebGL contexts.
- if (state.hasMappedBuffer(gl::BufferBinding::ElementArray))
- {
- context->handleError(InvalidOperation() << "Index buffer is mapped.");
- return false;
- }
- }
-
- const gl::VertexArray *vao = state.getVertexArray();
- gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get();
-
- GLuint typeBytes = gl::GetTypeInfo(type).bytes;
-
- if (context->getExtensions().webglCompatibility)
- {
- ASSERT(isPow2(typeBytes) && typeBytes > 0);
- 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.
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), OffsetMustBeMultipleOfType);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset);
- return false;
- }
- }
-
- if (context->getExtensions().webglCompatibility ||
- !context->getGLState().areClientArraysEnabled())
- {
- if (!elementArrayBuffer && count > 0)
- {
- // [WebGL 1.0] Section 6.2 No Client Side Arrays
- // If drawElements is called with a count greater than zero, and no WebGLBuffer is bound
- // to the ELEMENT_ARRAY_BUFFER binding point, an INVALID_OPERATION error is generated.
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MustHaveElementArrayBinding);
- return false;
- }
- }
-
- if (count > 0)
- {
- if (elementArrayBuffer)
- {
- // 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 typeSize = typeBytes;
- uint64_t elementCount = static_cast<uint64_t>(count);
- ASSERT(elementCount > 0 && typeSize <= kMaxTypeSize);
-
- // Doing the multiplication here is overflow-safe
- uint64_t elementDataSizeNoOffset = typeSize * elementCount;
-
- // The offset can be any value, check for overflows
- uint64_t offset = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(indices));
- if (elementDataSizeNoOffset > kUint64Max - offset)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), IntegerOverflow);
- return false;
- }
-
- uint64_t elementDataSizeWithOffset = elementDataSizeNoOffset + offset;
- if (elementDataSizeWithOffset > static_cast<uint64_t>(elementArrayBuffer->getSize()))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InsufficientBufferSize);
- return false;
- }
-
- ASSERT(isPow2(typeSize) && typeSize > 0);
- if ((elementArrayBuffer->getSize() & (typeSize - 1)) != 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedByteCountType);
- return false;
- }
- }
- else if (!indices)
- {
- // This is an application error that would normally result in a crash,
- // but we catch it and return an error
- context->handleError(InvalidOperation() << "No element array buffer and no pointer.");
- return false;
- }
- }
-
- if (context->getExtensions().robustBufferAccessBehavior)
- {
- // Here we use maxVertex = 0 and vertexCount = 1 to avoid retrieving IndexRange when robust
- // access is enabled.
- if (!ValidateDrawAttribs(context, primcount, 0, 1))
- {
- return false;
- }
- }
- else
- {
- // Use the parameter buffer to retrieve and cache the index range.
- const auto &params = context->getParams<HasIndexRange>();
- const auto &indexRangeOpt = params.getIndexRange();
- if (!indexRangeOpt.valid())
- {
- // Unexpected error.
- return false;
- }
-
- // 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>(indexRangeOpt.value().end) >= context->getCaps().maxElementIndex)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExceedsMaxElement);
- return false;
- }
-
- if (!ValidateDrawAttribs(context, primcount, static_cast<GLint>(indexRangeOpt.value().end),
- static_cast<GLint>(indexRangeOpt.value().vertexCount())))
- {
- return false;
- }
-
- // No op if there are no real indices in the index data (all are primitive restart).
- return (indexRangeOpt.value().vertexIndexCount > 0);
- }
-
- return true;
-}
-
-bool ValidateDrawElementsInstancedCommon(ValidationContext *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei primcount)
-{
- return ValidateDrawElementsInstancedBase(context, mode, count, type, indices, primcount);
-}
-
-bool ValidateDrawElementsInstancedANGLE(Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei primcount)
-{
- if (!context->getExtensions().instancedArrays)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- if (!ValidateDrawElementsInstancedBase(context, mode, count, type, indices, primcount))
- {
- return false;
- }
-
- return ValidateDrawInstancedANGLE(context);
-}
-
-bool ValidateFramebufferTextureBase(Context *context,
- GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level)
-{
- if (!ValidFramebufferTarget(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget);
- return false;
- }
-
- if (!ValidateAttachmentTarget(context, attachment))
- {
- return false;
- }
-
- if (texture != 0)
- {
- gl::Texture *tex = context->getTexture(texture);
-
- if (tex == NULL)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (level < 0)
- {
- context->handleError(InvalidValue());
- return false;
- }
- }
-
- const gl::Framebuffer *framebuffer = context->getGLState().getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (framebuffer->id() == 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), DefaultFramebufferTarget);
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetUniformBase(Context *context, GLuint program, GLint location)
-{
- if (program == 0)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- gl::Program *programObject = GetValidProgram(context, program);
- if (!programObject)
- {
- return false;
- }
-
- if (!programObject || !programObject->isLinked())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
- return false;
- }
-
- if (!programObject->isValidUniformLocation(location))
- {
- context->handleError(InvalidOperation());
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- return false;
- }
-
- gl::Program *programObject = context->getProgram(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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InsufficientBufferSize);
- 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 ValidateGetnUniformivEXT(Context *context,
- GLuint program,
- GLint location,
- GLsizei bufSize,
- GLint *params)
-{
- return ValidateSizedGetUniform(context, program, location, bufSize, nullptr);
-}
-
-bool ValidateGetUniformfvRobustANGLE(Context *context,
- GLuint program,
- GLint location,
- GLsizei bufSize,
- GLsizei *length,
- GLfloat *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- // bufSize is validated in ValidateSizedGetUniform
- return ValidateSizedGetUniform(context, program, location, bufSize, length);
-}
-
-bool ValidateGetUniformivRobustANGLE(Context *context,
- GLuint program,
- GLint location,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- // bufSize is validated in ValidateSizedGetUniform
- return ValidateSizedGetUniform(context, program, location, bufSize, length);
-}
-
-bool ValidateGetUniformuivRobustANGLE(Context *context,
- GLuint program,
- GLint location,
- GLsizei bufSize,
- GLsizei *length,
- GLuint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- // bufSize is validated in ValidateSizedGetUniform
- return ValidateSizedGetUniform(context, program, location, bufSize, length);
-}
-
-bool ValidateDiscardFramebufferBase(Context *context,
- GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments,
- bool defaultFramebuffer)
-{
- if (numAttachments < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeAttachments);
- return false;
- }
-
- for (GLsizei i = 0; i < numAttachments; ++i)
- {
- if (attachments[i] >= GL_COLOR_ATTACHMENT0 && attachments[i] <= GL_COLOR_ATTACHMENT31)
- {
- if (defaultFramebuffer)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), DefaultFramebufferInvalidAttachment);
- return false;
- }
-
- if (attachments[i] >= GL_COLOR_ATTACHMENT0 + context->getCaps().maxColorAttachments)
- {
- context->handleError(InvalidOperation() << "Requested color attachment is "
- "greater than the maximum supported "
- "color attachments");
- return false;
- }
- }
- else
- {
- switch (attachments[i])
- {
- case GL_DEPTH_ATTACHMENT:
- case GL_STENCIL_ATTACHMENT:
- case GL_DEPTH_STENCIL_ATTACHMENT:
- if (defaultFramebuffer)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(),
- DefaultFramebufferInvalidAttachment);
- return false;
- }
- break;
- case GL_COLOR:
- case GL_DEPTH:
- case GL_STENCIL:
- if (!defaultFramebuffer)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(),
- DefaultFramebufferInvalidAttachment);
- return false;
- }
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidAttachment);
- return false;
- }
- }
- }
-
- return true;
-}
-
-bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *marker)
-{
- // 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)
-{
- // 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,
- GLenum target,
- egl::Image *image)
-{
- if (!context->getExtensions().eglImage && !context->getExtensions().eglImageExternal)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- if (!context->getExtensions().eglImage)
- {
- context->handleError(InvalidEnum()
- << "GL_TEXTURE_2D texture target requires GL_OES_EGL_image.");
- }
- break;
-
- case GL_TEXTURE_EXTERNAL_OES:
- if (!context->getExtensions().eglImageExternal)
- {
- context->handleError(InvalidEnum() << "GL_TEXTURE_EXTERNAL_OES texture target "
- "requires GL_OES_EGL_image_external.");
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
- return false;
- }
-
- ASSERT(context->getCurrentDisplay());
- if (!context->getCurrentDisplay()->isValidImage(image))
- {
- context->handleError(InvalidValue() << "EGL image is not valid.");
- return false;
- }
-
- if (image->getSamples() > 0)
- {
- context->handleError(InvalidOperation()
- << "cannot create a 2D texture from a multisampled EGL image.");
- return false;
- }
-
- const TextureCaps &textureCaps =
- context->getTextureCaps().get(image->getFormat().info->sizedInternalFormat);
- if (!textureCaps.texturable)
- {
- context->handleError(InvalidOperation()
- << "EGL image internal format is not supported as a texture.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
- GLenum target,
- egl::Image *image)
-{
- if (!context->getExtensions().eglImage)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- switch (target)
- {
- case GL_RENDERBUFFER:
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidRenderbufferTarget);
- return false;
- }
-
- ASSERT(context->getCurrentDisplay());
- if (!context->getCurrentDisplay()->isValidImage(image))
- {
- context->handleError(InvalidValue() << "EGL image is not valid.");
- return false;
- }
-
- const TextureCaps &textureCaps =
- context->getTextureCaps().get(image->getFormat().info->sizedInternalFormat);
- if (!textureCaps.renderable)
- {
- context->handleError(InvalidOperation()
- << "EGL image internal format is not supported as a renderbuffer.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateBindVertexArrayBase(Context *context, GLuint array)
-{
- if (!context->isVertexArrayGenerated(array))
- {
- // The default VAO should always exist
- ASSERT(array != 0);
- context->handleError(InvalidOperation());
- 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->handleError(InvalidEnum() << "Program binary format is not valid.");
- return false;
- }
-
- if (context->hasActiveTransformFeedback(program))
- {
- // ES 3.0.4 section 2.15 page 91
- context->handleError(InvalidOperation() << "Cannot change program binary while program "
- "is associated with an active transform "
- "feedback object.");
- 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())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
- return false;
- }
-
- if (context->getCaps().programBinaryFormats.empty())
- {
- context->handleError(InvalidOperation() << "No program binary formats supported.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateDrawBuffersBase(ValidationContext *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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeCount);
- return false;
- }
- if (static_cast<GLuint>(n) > context->getCaps().maxDrawBuffers)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxDrawBuffer);
- return false;
- }
-
- ASSERT(context->getGLState().getDrawFramebuffer());
- GLuint frameBufferId = context->getGLState().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->handleError(InvalidEnum() << "Invalid buffer value");
- return false;
- }
- else if (bufs[colorAttachment] >= maxColorAttachment)
- {
- context->handleError(InvalidOperation()
- << "Buffer value is greater than MAX_DRAW_BUFFERS");
- 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->handleError(InvalidOperation()
- << "Ith value does not match COLOR_ATTACHMENTi or NONE");
- 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->handleError(InvalidOperation()
- << "n must be 1 when GL is bound to the default framebuffer");
- return false;
- }
-
- if (bufs[0] != GL_NONE && bufs[0] != GL_BACK)
- {
- context->handleError(
- InvalidOperation()
- << "Only NONE or BACK are valid values when drawing to the default framebuffer");
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateGetBufferPointervBase(Context *context,
- BufferBinding target,
- GLenum pname,
- GLsizei *length,
- void **params)
-{
- if (length)
- {
- *length = 0;
- }
-
- if (context->getClientMajorVersion() < 3 && !context->getExtensions().mapBuffer)
- {
- context->handleError(
- InvalidOperation()
- << "Context does not support OpenGL ES 3.0 or GL_OES_mapbuffer is not enabled.");
- return false;
- }
-
- if (!ValidBufferType(context, target))
- {
- context->handleError(InvalidEnum() << "Buffer target not valid");
- return false;
- }
-
- switch (pname)
- {
- case GL_BUFFER_MAP_POINTER:
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- 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->getGLState().getTargetBuffer(target) == nullptr)
- {
- context->handleError(InvalidOperation()
- << "Cannot get pointer for reserved buffer name zero.");
- return false;
- }
-
- if (length)
- {
- *length = 1;
- }
-
- return true;
-}
-
-bool ValidateUnmapBufferBase(Context *context, BufferBinding target)
-{
- if (!ValidBufferType(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
- return false;
- }
-
- Buffer *buffer = context->getGLState().getTargetBuffer(target);
-
- if (buffer == nullptr || !buffer->isMapped())
- {
- context->handleError(InvalidOperation() << "Buffer not mapped.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateMapBufferRangeBase(Context *context,
- BufferBinding target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access)
-{
- if (!ValidBufferType(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
- return false;
- }
-
- if (offset < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset);
- return false;
- }
-
- if (length < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeLength);
- return false;
- }
-
- Buffer *buffer = context->getGLState().getTargetBuffer(target);
-
- if (!buffer)
- {
- context->handleError(InvalidOperation() << "Attempted to map buffer object zero.");
- 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->handleError(InvalidValue() << "Mapped range does not fit into buffer dimensions.");
- 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->handleError(InvalidValue()
- << "Invalid access bits: 0x" << std::hex << std::uppercase << access);
- return false;
- }
-
- if (length == 0)
- {
- context->handleError(InvalidOperation() << "Buffer mapping length is zero.");
- return false;
- }
-
- if (buffer->isMapped())
- {
- context->handleError(InvalidOperation() << "Buffer is already mapped.");
- return false;
- }
-
- // Check for invalid bit combinations
- if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0)
- {
- context->handleError(InvalidOperation()
- << "Need to map buffer for either reading or writing.");
- 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->handleError(InvalidOperation()
- << "Invalid access bits when mapping buffer for reading: 0x"
- << std::hex << std::uppercase << access);
- return false;
- }
-
- if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0)
- {
- context->handleError(
- InvalidOperation()
- << "The explicit flushing bit may only be set if the buffer is mapped for writing.");
- return false;
- }
-
- return ValidateMapBufferBase(context, target);
-}
-
-bool ValidateFlushMappedBufferRangeBase(Context *context,
- BufferBinding target,
- GLintptr offset,
- GLsizeiptr length)
-{
- if (offset < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset);
- return false;
- }
-
- if (length < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeLength);
- return false;
- }
-
- if (!ValidBufferType(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
- return false;
- }
-
- Buffer *buffer = context->getGLState().getTargetBuffer(target);
-
- if (buffer == nullptr)
- {
- context->handleError(InvalidOperation() << "Attempted to flush buffer object zero.");
- return false;
- }
-
- if (!buffer->isMapped() || (buffer->getAccessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0)
- {
- context->handleError(InvalidOperation()
- << "Attempted to flush a buffer not mapped for explicit flushing.");
- 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->handleError(InvalidValue()
- << "Flushed range does not fit into buffer mapping dimensions.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateGenOrDelete(Context *context, GLint n)
-{
- if (n < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeCount);
- return false;
- }
- return true;
-}
-
-bool ValidateRobustEntryPoint(ValidationContext *context, GLsizei bufSize)
-{
- if (!context->getExtensions().robustClientMemory)
- {
- context->handleError(InvalidOperation()
- << "GL_ANGLE_robust_client_memory is not available.");
- return false;
- }
-
- if (bufSize < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- return false;
- }
-
- return true;
-}
-
-bool ValidateRobustBufferSize(ValidationContext *context, GLsizei bufSize, GLsizei numParams)
-{
- if (bufSize < numParams)
- {
- context->handleError(InvalidOperation() << numParams << " parameters are required but "
- << bufSize << " were provided.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetFramebufferAttachmentParameterivBase(ValidationContext *context,
- GLenum target,
- GLenum attachment,
- GLenum pname,
- GLsizei *numParams)
-{
- if (!ValidFramebufferTarget(context, target))
- {
- context->handleError(InvalidEnum());
- 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_ANGLE:
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_MULTIVIEW_LAYOUT_ANGLE:
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_ANGLE:
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_VIEWPORT_OFFSETS_ANGLE:
- if (clientVersion < 3 || !context->getExtensions().multiview)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
- if (clientVersion < 3 && !context->getExtensions().sRGB)
- {
- context->handleError(InvalidEnum());
- 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->handleError(InvalidEnum());
- return false;
- }
- break;
-
- default:
- context->handleError(InvalidEnum());
- return false;
- }
-
- // Determine if the attachment is a valid enum
- switch (attachment)
- {
- case GL_BACK:
- case GL_DEPTH:
- case GL_STENCIL:
- if (clientVersion < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidAttachment);
- return false;
- }
- break;
-
- case GL_DEPTH_STENCIL_ATTACHMENT:
- if (clientVersion < 3 && !context->isWebGL1())
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidAttachment);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidAttachment);
- return false;
- }
- break;
- }
-
- const Framebuffer *framebuffer = context->getGLState().getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (framebuffer->id() == 0)
- {
- if (clientVersion < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), DefaultFramebufferTarget);
- return false;
- }
-
- switch (attachment)
- {
- case GL_BACK:
- case GL_DEPTH:
- case GL_STENCIL:
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidAttachment);
- 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->handleError(InvalidOperation());
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidAttachment);
- return false;
- }
- }
- }
-
- const FramebufferAttachment *attachmentObject = framebuffer->getAttachment(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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), FramebufferIncompleteAttachment);
- return false;
- }
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
- if (attachmentObject->type() != GL_TEXTURE)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), FramebufferIncompleteAttachment);
- return false;
- }
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
- if (attachmentObject->type() != GL_TEXTURE)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), FramebufferIncompleteAttachment);
- return false;
- }
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
- if (attachment == GL_DEPTH_STENCIL_ATTACHMENT)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidAttachment);
- return false;
- }
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
- if (attachmentObject->type() != GL_TEXTURE)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), FramebufferIncompleteAttachment);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(),
- InvalidFramebufferAttachmentParameter);
- return false;
- }
- break;
-
- default:
- if (clientVersion < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(),
- InvalidFramebufferAttachmentParameter);
- return false;
- }
- else
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(),
- InvalidFramebufferAttachmentParameter);
- return false;
- }
- }
- }
-
- if (numParams)
- {
- if (pname == GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_VIEWPORT_OFFSETS_ANGLE)
- {
- // Only when the viewport offsets are queried we can have a varying number of output
- // parameters.
- const int numViews = attachmentObject ? attachmentObject->getNumViews() : 1;
- *numParams = numViews * 2;
- }
- else
- {
- // For all other queries we can have only one output parameter.
- *numParams = 1;
- }
- }
-
- return true;
-}
-
-bool ValidateGetFramebufferAttachmentParameterivRobustANGLE(ValidationContext *context,
- GLenum target,
- GLenum attachment,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *numParams)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetFramebufferAttachmentParameterivBase(context, target, attachment, pname,
- numParams))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *numParams))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetBufferParameterivRobustANGLE(ValidationContext *context,
- BufferBinding target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetBufferParameterBase(context, target, pname, false, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetBufferParameteri64vRobustANGLE(ValidationContext *context,
- BufferBinding target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint64 *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetBufferParameterBase(context, target, pname, false, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetProgramivBase(ValidationContext *context,
- GLuint program,
- GLenum pname,
- GLsizei *numParams)
-{
- // Currently, all GetProgramiv queries return 1 parameter
- if (numParams)
- {
- *numParams = 1;
- }
-
- Program *programObject = 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->handleError(InvalidEnum() << "Querying GL_PROGRAM_BINARY_LENGTH "
- "requires GL_OES_get_program_binary or "
- "ES 3.0.");
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), ES3Required);
- return false;
- }
- break;
-
- case GL_PROGRAM_SEPARABLE:
- case GL_COMPUTE_WORK_GROUP_SIZE:
- case GL_ACTIVE_ATOMIC_COUNTER_BUFFERS:
- if (context->getClientVersion() < Version(3, 1))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), ES31Required);
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetProgramivRobustANGLE(Context *context,
- GLuint program,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *numParams)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetProgramivBase(context, program, pname, numParams))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *numParams))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetRenderbufferParameterivRobustANGLE(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetRenderbufferParameterivBase(context, target, pname, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetShaderivRobustANGLE(Context *context,
- GLuint shader,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetShaderivBase(context, shader, pname, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetTexParameterfvRobustANGLE(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLfloat *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetTexParameterBase(context, target, pname, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetTexParameterivRobustANGLE(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetTexParameterBase(context, target, pname, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateTexParameterfvRobustANGLE(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- const GLfloat *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- return ValidateTexParameterBase(context, target, pname, bufSize, params);
-}
-
-bool ValidateTexParameterivRobustANGLE(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- const GLint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- return ValidateTexParameterBase(context, target, pname, bufSize, params);
-}
-
-bool ValidateGetSamplerParameterfvRobustANGLE(Context *context,
- GLuint sampler,
- GLenum pname,
- GLuint bufSize,
- GLsizei *length,
- GLfloat *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetSamplerParameterBase(context, sampler, pname, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetSamplerParameterivRobustANGLE(Context *context,
- GLuint sampler,
- GLenum pname,
- GLuint bufSize,
- GLsizei *length,
- GLint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetSamplerParameterBase(context, sampler, pname, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-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, 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, params);
-}
-
-bool ValidateGetVertexAttribfvRobustANGLE(Context *context,
- GLuint index,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLfloat *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetVertexAttribBase(context, index, pname, length, false, false))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetVertexAttribivRobustANGLE(Context *context,
- GLuint index,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetVertexAttribBase(context, index, pname, length, false, false))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetVertexAttribPointervRobustANGLE(Context *context,
- GLuint index,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- void **pointer)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetVertexAttribBase(context, index, pname, length, true, false))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetVertexAttribIivRobustANGLE(Context *context,
- GLuint index,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetVertexAttribBase(context, index, pname, length, false, true))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetVertexAttribIuivRobustANGLE(Context *context,
- GLuint index,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLuint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetVertexAttribBase(context, index, pname, length, false, true))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetActiveUniformBlockivRobustANGLE(Context *context,
- GLuint program,
- GLuint uniformBlockIndex,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetActiveUniformBlockivBase(context, program, uniformBlockIndex, pname, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetInternalFormativRobustANGLE(Context *context,
- GLenum target,
- GLenum internalformat,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateGetInternalFormativBase(context, target, internalformat, pname, bufSize, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateVertexFormatBase(ValidationContext *context,
- GLuint attribIndex,
- GLint size,
- GLenum type,
- GLboolean pureInteger)
-{
- const Caps &caps = context->getCaps();
- if (attribIndex >= caps.maxVertexAttributes)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxVertexAttribute);
- return false;
- }
-
- if (size < 1 || size > 4)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidVertexAttrSize);
- return false;
- }
-
- switch (type)
- {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- break;
-
- case GL_INT:
- case GL_UNSIGNED_INT:
- if (context->getClientMajorVersion() < 3)
- {
- context->handleError(InvalidEnum()
- << "Vertex type not supported before OpenGL ES 3.0.");
- return false;
- }
- break;
-
- case GL_FIXED:
- case GL_FLOAT:
- if (pureInteger)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTypePureInt);
- return false;
- }
- break;
-
- case GL_HALF_FLOAT:
- if (context->getClientMajorVersion() < 3)
- {
- context->handleError(InvalidEnum()
- << "Vertex type not supported before OpenGL ES 3.0.");
- return false;
- }
- if (pureInteger)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTypePureInt);
- return false;
- }
- break;
-
- case GL_INT_2_10_10_10_REV:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- if (context->getClientMajorVersion() < 3)
- {
- context->handleError(InvalidEnum()
- << "Vertex type not supported before OpenGL ES 3.0.");
- return false;
- }
- if (pureInteger)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTypePureInt);
- return false;
- }
- if (size != 4)
- {
- context->handleError(InvalidOperation() << "Type is INT_2_10_10_10_REV or "
- "UNSIGNED_INT_2_10_10_10_REV and "
- "size is not 4.");
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidType);
- return false;
- }
-
- 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(ValidationContext *context,
- GLint drawbuffer,
- const GLenum *validComponentTypes,
- size_t validComponentTypeCount)
-{
- const FramebufferAttachment *attachment =
- context->getGLState().getDrawFramebuffer()->getDrawBuffer(drawbuffer);
- if (attachment)
- {
- GLenum componentType = attachment->getFormat().info->componentType;
- const GLenum *end = validComponentTypes + validComponentTypeCount;
- if (std::find(validComponentTypes, end, componentType) == end)
- {
- context->handleError(
- InvalidOperation()
- << "No defined conversion between clear value and attachment format.");
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateRobustCompressedTexImageBase(ValidationContext *context,
- GLsizei imageSize,
- GLsizei dataSize)
-{
- if (!ValidateRobustEntryPoint(context, dataSize))
- {
- return false;
- }
-
- gl::Buffer *pixelUnpackBuffer =
- context->getGLState().getTargetBuffer(BufferBinding::PixelUnpack);
- if (pixelUnpackBuffer == nullptr)
- {
- if (dataSize < imageSize)
- {
- context->handleError(InvalidOperation() << "dataSize must be at least " << imageSize);
- }
- }
- return true;
-}
-
-bool ValidateGetBufferParameterBase(ValidationContext *context,
- BufferBinding target,
- GLenum pname,
- bool pointerVersion,
- GLsizei *numParams)
-{
- if (numParams)
- {
- *numParams = 0;
- }
-
- if (!ValidBufferType(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
- return false;
- }
-
- const Buffer *buffer = context->getGLState().getTargetBuffer(target);
- if (!buffer)
- {
- // A null buffer means that "0" is bound to the requested buffer target
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferNotBound);
- 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->handleError(InvalidEnum()
- << "pname requires OpenGL ES 3.0 or GL_OES_mapbuffer.");
- 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->handleError(InvalidEnum() << "pname requires OpenGL ES 3.0, "
- "GL_OES_mapbuffer or "
- "GL_EXT_map_buffer_range.");
- return false;
- }
- break;
-
- case GL_BUFFER_MAP_POINTER:
- if (!pointerVersion)
- {
- context->handleError(
- InvalidEnum()
- << "GL_BUFFER_MAP_POINTER can only be queried with GetBufferPointerv.");
- 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->handleError(InvalidEnum()
- << "pname requires OpenGL ES 3.0 or GL_EXT_map_buffer_range.");
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidRenderbufferTarget);
- return false;
- }
-
- Renderbuffer *renderbuffer = context->getGLState().getCurrentRenderbuffer();
- if (renderbuffer == nullptr)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), RenderbufferNotBound);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), ExtensionNotEnabled);
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- if (length)
- {
- *length = 1;
- }
- return true;
-}
-
-bool ValidateGetShaderivBase(Context *context, GLuint shader, GLenum pname, GLsizei *length)
-{
- if (length)
- {
- *length = 0;
- }
-
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), ExtensionNotEnabled);
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- if (length)
- {
- *length = 1;
- }
- return true;
-}
-
-bool ValidateGetTexParameterBase(Context *context, GLenum target, GLenum pname, GLsizei *length)
-{
- if (length)
- {
- *length = 0;
- }
-
- if (!ValidTextureTarget(context, target) && !ValidTextureExternalTarget(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
- return false;
- }
-
- if (context->getTargetTexture(target) == nullptr)
- {
- // Should only be possible for external textures
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), TextureNotBound);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), ExtensionNotEnabled);
- return false;
- }
- break;
-
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (!context->getExtensions().textureFilterAnisotropic)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), ExtensionNotEnabled);
- return false;
- }
- break;
-
- case GL_TEXTURE_IMMUTABLE_FORMAT:
- if (context->getClientMajorVersion() < 3 && !context->getExtensions().textureStorage)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), ExtensionNotEnabled);
- 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->handleError(InvalidEnum() << "pname requires OpenGL ES 3.0.");
- return false;
- }
- break;
-
- case GL_TEXTURE_SRGB_DECODE_EXT:
- if (!context->getExtensions().textureSRGBDecode)
- {
- context->handleError(InvalidEnum() << "GL_EXT_texture_sRGB_decode is not enabled.");
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- if (length)
- {
- *length = 1;
- }
- 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->handleError(InvalidOperation() << "Context does not support OpenGL ES 3.0.");
- return false;
- }
-
- if (index >= context->getCaps().maxVertexAttributes)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxVertexAttribute);
- return false;
- }
-
- if (pointer)
- {
- if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- 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().instancedArrays)
- {
- context->handleError(InvalidEnum() << "GL_VERTEX_ATTRIB_ARRAY_DIVISOR "
- "requires OpenGL ES 3.0 or "
- "GL_ANGLE_instanced_arrays.");
- return false;
- }
- break;
-
- case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
- if (context->getClientMajorVersion() < 3)
- {
- context->handleError(
- InvalidEnum() << "GL_VERTEX_ATTRIB_ARRAY_INTEGER requires OpenGL ES 3.0.");
- return false;
- }
- break;
-
- case GL_VERTEX_ATTRIB_BINDING:
- case GL_VERTEX_ATTRIB_RELATIVE_OFFSET:
- if (context->getClientVersion() < ES_3_1)
- {
- context->handleError(InvalidEnum()
- << "Vertex Attrib Bindings require OpenGL ES 3.1.");
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize);
- return false;
- }
-
- Framebuffer *readFramebuffer = context->getGLState().getReadFramebuffer();
-
- if (readFramebuffer->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE)
- {
- context->handleError(InvalidFramebufferOperation());
- return false;
- }
-
- if (readFramebuffer->id() != 0 && readFramebuffer->getSamples(context) != 0)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer();
- ASSERT(framebuffer);
-
- if (framebuffer->getReadBufferState() == GL_NONE)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ReadBufferNone);
- return false;
- }
-
- const FramebufferAttachment *readBuffer = framebuffer->getReadColorbuffer();
- // 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MissingReadAttachment);
- return false;
- }
-
- // ANGLE_multiview, Revision 1:
- // ReadPixels generates an INVALID_FRAMEBUFFER_OPERATION error if the multi-view layout of the
- // current read framebuffer is not NONE.
- if (readBuffer->getMultiviewLayout() != GL_NONE)
- {
- context->handleError(InvalidFramebufferOperation()
- << "Attempting to read from a multi-view framebuffer.");
- 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))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFormat);
- return false;
- }
-
- if (!ValidReadPixelsTypeEnum(context, type))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidType);
- return false;
- }
- }
-
- GLenum currentFormat = framebuffer->getImplementationColorReadFormat(context);
- GLenum currentType = framebuffer->getImplementationColorReadType(context);
- GLenum currentComponentType = readBuffer->getFormat().info->componentType;
-
- bool validFormatTypeCombination =
- ValidReadPixelsFormatType(context, currentComponentType, format, type);
-
- if (!(currentFormat == format && currentType == type) && !validFormatTypeCombination)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- return false;
- }
-
- // Check for pixel pack buffer related API errors
- gl::Buffer *pixelPackBuffer = context->getGLState().getTargetBuffer(BufferBinding::PixelPack);
- if (pixelPackBuffer != nullptr && pixelPackBuffer->isMapped())
- {
- // ...the buffer object's data store is currently mapped.
- context->handleError(InvalidOperation() << "Pixel pack buffer is mapped.");
- 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 gl::Extents size(width, height, 1);
- const auto &pack = context->getGLState().getPackState();
-
- auto endByteOrErr = formatInfo.computePackUnpackEndByte(type, size, pack, false);
- if (endByteOrErr.isError())
- {
- context->handleError(endByteOrErr.getError());
- return false;
- }
-
- size_t endByte = endByteOrErr.getResult();
- if (bufSize >= 0)
- {
- if (pixelPackBuffer == nullptr && static_cast<size_t>(bufSize) < endByte)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InsufficientBufferSize);
- 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
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ParamOverflow);
- return false;
- }
- }
-
- if (pixelPackBuffer == nullptr && length != nullptr)
- {
- if (endByte > static_cast<size_t>(std::numeric_limits<GLsizei>::max()))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), IntegerOverflow);
- return false;
- }
-
- *length = static_cast<GLsizei>(endByte);
- }
-
- auto getClippedExtent = [](GLint start, GLsizei length, int bufferSize) {
- angle::CheckedNumeric<int> clippedExtent(length);
- if (start < 0)
- {
- // "subtract" the area that is less than 0
- clippedExtent += start;
- }
-
- const int readExtent = start + length;
- if (readExtent > bufferSize)
- {
- // Subtract the region to the right of the read buffer
- clippedExtent -= (readExtent - bufferSize);
- }
-
- if (!clippedExtent.IsValid())
- {
- return 0;
- }
-
- return std::max(clippedExtent.ValueOrDie(), 0);
- };
-
- if (columns != nullptr)
- {
- *columns = getClippedExtent(x, width, readBuffer->getSize().width);
- }
-
- if (rows != nullptr)
- {
- *rows = getClippedExtent(y, height, readBuffer->getSize().height);
- }
-
- return true;
-}
-
-template <typename ParamType>
-bool ValidateTexParameterBase(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- const ParamType *params)
-{
- if (!ValidTextureTarget(context, target) && !ValidTextureExternalTarget(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
- return false;
- }
-
- if (context->getTargetTexture(target) == nullptr)
- {
- // Should only be possible for external textures
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), TextureNotBound);
- return false;
- }
-
- const GLsizei minBufSize = 1;
- if (bufSize >= 0 && bufSize < minBufSize)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InsufficientBufferSize);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), ES3Required);
- return false;
- }
- if (target == GL_TEXTURE_EXTERNAL_OES &&
- !context->getExtensions().eglImageExternalEssl3)
- {
- context->handleError(InvalidEnum() << "ES3 texture parameters are not "
- "available without "
- "GL_OES_EGL_image_external_essl3.");
- return false;
- }
- break;
-
- default:
- break;
- }
-
- if (target == GL_TEXTURE_2D_MULTISAMPLE)
- {
- 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:
- context->handleError(InvalidEnum()
- << "Invalid parameter for 2D multisampled textures.");
- return false;
- }
- }
-
- switch (pname)
- {
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_TEXTURE_WRAP_R:
- {
- bool restrictedWrapModes =
- target == GL_TEXTURE_EXTERNAL_OES || target == GL_TEXTURE_RECTANGLE_ANGLE;
- if (!ValidateTextureWrapModeValue(context, params, restrictedWrapModes))
- {
- return false;
- }
- }
- break;
-
- case GL_TEXTURE_MIN_FILTER:
- {
- bool restrictedMinFilter =
- target == GL_TEXTURE_EXTERNAL_OES || target == GL_TEXTURE_RECTANGLE_ANGLE;
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- switch (ConvertToGLenum(params[0]))
- {
- case GL_NONE:
- case GL_FRAMEBUFFER_ATTACHMENT_ANGLE:
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
- break;
-
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (!context->getExtensions().textureFilterAnisotropic)
- {
- context->handleError(InvalidEnum() << "GL_EXT_texture_anisotropic is not enabled.");
- return false;
- }
-
- // we assume the parameter passed to this validation method is truncated, not rounded
- if (params[0] < 1)
- {
- context->handleError(InvalidValue() << "Max anisotropy must be at least 1.");
- 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_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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- if (ConvertToGLint(params[0]) < 0)
- {
- context->handleError(InvalidValue() << "Base level must be at least 0.");
- return false;
- }
- if (target == GL_TEXTURE_EXTERNAL_OES && static_cast<GLuint>(params[0]) != 0)
- {
- context->handleError(InvalidOperation()
- << "Base level must be 0 for external textures.");
- return false;
- }
- if (target == GL_TEXTURE_2D_MULTISAMPLE && static_cast<GLuint>(params[0]) != 0)
- {
- context->handleError(InvalidOperation()
- << "Base level must be 0 for multisampled textures.");
- return false;
- }
- if (target == GL_TEXTURE_RECTANGLE_ANGLE && static_cast<GLuint>(params[0]) != 0)
- {
- context->handleError(InvalidOperation()
- << "Base level must be 0 for rectangle textures.");
- return false;
- }
- break;
-
- case GL_TEXTURE_MAX_LEVEL:
- if (ConvertToGLint(params[0]) < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel);
- return false;
- }
- break;
-
- case GL_DEPTH_STENCIL_TEXTURE_MODE:
- if (context->getClientVersion() < Version(3, 1))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumRequiresGLES31);
- return false;
- }
- switch (ConvertToGLenum(params[0]))
- {
- case GL_DEPTH_COMPONENT:
- case GL_STENCIL_INDEX:
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
- break;
-
- case GL_TEXTURE_SRGB_DECODE_EXT:
- if (!ValidateTextureSRGBDecodeValue(context, params))
- {
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- return true;
-}
-
-template bool ValidateTexParameterBase(Context *, GLenum, GLenum, GLsizei, const GLfloat *);
-template bool ValidateTexParameterBase(Context *, GLenum, GLenum, GLsizei, const GLint *);
-
-bool ValidateVertexAttribIndex(ValidationContext *context, GLuint index)
-{
- if (index >= MAX_VERTEX_ATTRIBS)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxVertexAttribute);
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetActiveUniformBlockivBase(Context *context,
- GLuint program,
- GLuint uniformBlockIndex,
- GLenum pname,
- GLsizei *length)
-{
- if (length)
- {
- *length = 0;
- }
-
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
- if (!programObject)
- {
- return false;
- }
-
- if (uniformBlockIndex >= programObject->getActiveUniformBlockCount())
- {
- context->handleError(InvalidValue()
- << "uniformBlockIndex exceeds active uniform block count.");
- 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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- 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,
- ParamType *params)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (!context->isSampler(sampler))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidSampler);
- return false;
- }
-
- const GLsizei minBufSize = 1;
- if (bufSize >= 0 && bufSize < minBufSize)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InsufficientBufferSize);
- 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;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- return true;
-}
-
-template bool ValidateSamplerParameterBase(Context *, GLuint, GLenum, GLsizei, GLfloat *);
-template bool ValidateSamplerParameterBase(Context *, GLuint, GLenum, GLsizei, GLint *);
-
-bool ValidateGetSamplerParameterBase(Context *context,
- GLuint sampler,
- GLenum pname,
- GLsizei *length)
-{
- if (length)
- {
- *length = 0;
- }
-
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (!context->isSampler(sampler))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidSampler);
- 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_SRGB_DECODE_EXT:
- if (!context->getExtensions().textureSRGBDecode)
- {
- context->handleError(InvalidEnum() << "GL_EXT_texture_sRGB_decode is not enabled.");
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- if (length)
- {
- *length = 1;
- }
- return true;
-}
-
-bool ValidateGetInternalFormativBase(Context *context,
- GLenum target,
- GLenum internalformat,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *numParams)
-{
- if (numParams)
- {
- *numParams = 0;
- }
-
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
- if (!formatCaps.renderable)
- {
- context->handleError(InvalidEnum() << "Internal format is not renderable.");
- return false;
- }
-
- switch (target)
- {
- case GL_RENDERBUFFER:
- break;
-
- case GL_TEXTURE_2D_MULTISAMPLE:
- if (context->getClientVersion() < ES_3_1)
- {
- context->handleError(InvalidOperation()
- << "Texture target requires at least OpenGL ES 3.1.");
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTarget);
- return false;
- }
-
- if (bufSize < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InsufficientBufferSize);
- 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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- if (numParams)
- {
- // glGetInternalFormativ will not overflow bufSize
- *numParams = std::min(bufSize, maxWriteParams);
- }
-
- return true;
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/validationES.h b/src/3rdparty/angle/src/libANGLE/validationES.h
deleted file mode 100644
index e29432b8c3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/validationES.h
+++ /dev/null
@@ -1,601 +0,0 @@
-//
-// 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/mathutil.h"
-#include "libANGLE/PackedGLEnums.h"
-
-#include <GLES2/gl2.h>
-#include <GLES3/gl3.h>
-#include <GLES3/gl31.h>
-
-namespace egl
-{
-class Display;
-class Image;
-}
-
-namespace gl
-{
-class Context;
-struct Format;
-struct LinkedUniform;
-class Program;
-class Shader;
-class ValidationContext;
-
-bool ValidTextureTarget(const ValidationContext *context, GLenum target);
-bool ValidTexture2DTarget(const ValidationContext *context, GLenum target);
-bool ValidTexture3DTarget(const ValidationContext *context, GLenum target);
-bool ValidTextureExternalTarget(const ValidationContext *context, GLenum target);
-bool ValidTexture2DDestinationTarget(const ValidationContext *context, GLenum target);
-bool ValidTexture3DDestinationTarget(const ValidationContext *context, GLenum target);
-bool ValidTexLevelDestinationTarget(const ValidationContext *context, GLenum target);
-bool ValidFramebufferTarget(const ValidationContext *context, GLenum target);
-bool ValidBufferType(const ValidationContext *context, BufferBinding target);
-bool ValidBufferParameter(const ValidationContext *context, GLenum pname, GLsizei *numParams);
-bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level);
-bool ValidImageSizeParameters(ValidationContext *context,
- GLenum target,
- GLint level,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- bool isSubImage);
-bool ValidCompressedImageSize(const ValidationContext *context,
- GLenum internalFormat,
- GLint level,
- GLsizei width,
- GLsizei height);
-bool ValidCompressedSubImageSize(const ValidationContext *context,
- GLenum internalFormat,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- size_t textureWidth,
- size_t textureHeight);
-bool ValidImageDataSize(ValidationContext *context,
- GLenum textureTarget,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLenum type,
- const void *pixels,
- GLsizei imageSize);
-
-bool ValidQueryType(const Context *context, GLenum queryType);
-
-bool ValidateWebGLVertexAttribPointer(ValidationContext *context,
- GLenum 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(ValidationContext *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(ValidationContext *context, GLuint id);
-
-bool ValidateAttachmentTarget(Context *context, GLenum attachment);
-bool ValidateRenderbufferStorageParametersBase(ValidationContext *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(ValidationContext *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, GLenum target, GLuint id);
-bool ValidateBeginQueryEXT(Context *context, GLenum target, GLuint id);
-bool ValidateEndQueryBase(Context *context, GLenum target);
-bool ValidateEndQueryEXT(Context *context, GLenum target);
-bool ValidateQueryCounterEXT(Context *context, GLuint id, GLenum target);
-bool ValidateGetQueryivBase(Context *context, GLenum target, GLenum pname, GLsizei *numParams);
-bool ValidateGetQueryivEXT(Context *context, GLenum target, GLenum pname, GLint *params);
-bool ValidateGetQueryivRobustANGLE(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params);
-bool ValidateGetQueryObjectValueBase(Context *context,
- GLenum target,
- 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(ValidationContext *context,
- gl::Program *program,
- GLint location,
- GLsizei count,
- const LinkedUniform **uniformOut);
-bool ValidateUniform1ivValue(ValidationContext *context,
- GLenum uniformType,
- GLsizei count,
- const GLint *value);
-bool ValidateUniformValue(ValidationContext *context, GLenum valueType, GLenum uniformType);
-bool ValidateUniformMatrixValue(ValidationContext *context, GLenum valueType, GLenum uniformType);
-bool ValidateUniform(ValidationContext *context, GLenum uniformType, GLint location, GLsizei count);
-bool ValidateUniformMatrix(ValidationContext *context,
- GLenum matrixType,
- GLint location,
- GLsizei count,
- GLboolean transpose);
-
-bool ValidateStateQuery(ValidationContext *context,
- GLenum pname,
- GLenum *nativeType,
- unsigned int *numParams);
-
-bool ValidateRobustStateQuery(ValidationContext *context,
- GLenum pname,
- GLsizei bufSize,
- GLenum *nativeType,
- unsigned int *numParams);
-
-bool ValidateCopyTexImageParametersBase(ValidationContext *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border,
- Format *textureFormatOut);
-
-bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count);
-bool ValidateDrawArraysCommon(ValidationContext *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei primcount);
-bool ValidateDrawArraysInstancedBase(Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei primcount);
-bool ValidateDrawArraysInstancedANGLE(Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei primcount);
-
-bool ValidateDrawElementsBase(ValidationContext *context, GLenum type);
-bool ValidateDrawElementsCommon(ValidationContext *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei primcount);
-
-bool ValidateDrawElementsInstancedCommon(ValidationContext *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei primcount);
-bool ValidateDrawElementsInstancedANGLE(Context *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei primcount);
-
-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 ValidateGetnUniformivEXT(Context *context,
- GLuint program,
- GLint location,
- GLsizei bufSize,
- 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 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,
- GLenum target,
- egl::Image *image);
-bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
- GLenum target,
- egl::Image *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(ValidationContext *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(ValidationContext *context, GLsizei bufSize);
-bool ValidateRobustBufferSize(ValidationContext *context, GLsizei bufSize, GLsizei numParams);
-
-bool ValidateGetFramebufferAttachmentParameterivBase(ValidationContext *context,
- GLenum target,
- GLenum attachment,
- GLenum pname,
- GLsizei *numParams);
-bool ValidateGetFramebufferAttachmentParameterivRobustANGLE(ValidationContext *context,
- GLenum target,
- GLenum attachment,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *numParams);
-
-bool ValidateGetBufferParameterBase(ValidationContext *context,
- BufferBinding target,
- GLenum pname,
- bool pointerVersion,
- GLsizei *numParams);
-bool ValidateGetBufferParameterivRobustANGLE(ValidationContext *context,
- BufferBinding target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params);
-
-bool ValidateGetBufferParameteri64vRobustANGLE(ValidationContext *context,
- BufferBinding target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint64 *params);
-
-bool ValidateGetProgramivBase(ValidationContext *context,
- GLuint program,
- GLenum pname,
- GLsizei *numParams);
-bool ValidateGetProgramivRobustANGLE(Context *context,
- GLuint program,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *numParams);
-
-bool ValidateGetRenderbufferParameterivBase(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei *length);
-bool ValidateGetRenderbufferParameterivRobustANGLE(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params);
-
-bool ValidateGetShaderivBase(Context *context, GLuint shader, GLenum pname, GLsizei *length);
-bool ValidateGetShaderivRobustANGLE(Context *context,
- GLuint shader,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params);
-
-bool ValidateGetTexParameterBase(Context *context, GLenum target, GLenum pname, GLsizei *length);
-bool ValidateGetTexParameterfvRobustANGLE(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLfloat *params);
-bool ValidateGetTexParameterivRobustANGLE(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params);
-
-template <typename ParamType>
-bool ValidateTexParameterBase(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- const ParamType *params);
-bool ValidateTexParameterfvRobustANGLE(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- const GLfloat *params);
-bool ValidateTexParameterivRobustANGLE(Context *context,
- GLenum target,
- GLenum pname,
- GLsizei bufSize,
- const GLint *params);
-
-bool ValidateGetSamplerParameterfvRobustANGLE(Context *context,
- GLuint sampler,
- GLenum pname,
- GLuint bufSize,
- GLsizei *length,
- GLfloat *params);
-bool ValidateGetSamplerParameterivRobustANGLE(Context *context,
- GLuint sampler,
- GLenum pname,
- GLuint bufSize,
- GLsizei *length,
- GLint *params);
-
-bool ValidateSamplerParameterfvRobustANGLE(Context *context,
- GLuint sampler,
- GLenum pname,
- GLsizei bufSize,
- const GLfloat *params);
-bool ValidateSamplerParameterivRobustANGLE(Context *context,
- GLuint sampler,
- GLenum pname,
- GLsizei bufSize,
- const GLint *params);
-
-bool ValidateGetVertexAttribBase(Context *context,
- GLuint index,
- GLenum pname,
- GLsizei *length,
- bool pointer,
- bool pureIntegerEntryPoint);
-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 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 ValidateGetActiveUniformBlockivRobustANGLE(Context *context,
- GLuint program,
- GLuint uniformBlockIndex,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params);
-
-bool ValidateGetInternalFormativRobustANGLE(Context *context,
- GLenum target,
- GLenum internalformat,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params);
-
-bool ValidateVertexFormatBase(ValidationContext *context,
- GLuint attribIndex,
- GLint size,
- GLenum type,
- GLboolean pureInteger);
-
-bool ValidateWebGLFramebufferAttachmentClearType(ValidationContext *context,
- GLint drawbuffer,
- const GLenum *validComponentTypes,
- size_t validComponentTypeCount);
-
-bool ValidateRobustCompressedTexImageBase(ValidationContext *context,
- GLsizei imageSize,
- GLsizei dataSize);
-
-bool ValidateVertexAttribIndex(ValidationContext *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,
- ParamType *params);
-
-bool ValidateGetInternalFormativBase(Context *context,
- GLenum target,
- GLenum internalformat,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *numParams);
-
-} // namespace gl
-
-#endif // LIBANGLE_VALIDATION_ES_H_
diff --git a/src/3rdparty/angle/src/libANGLE/validationES2.cpp b/src/3rdparty/angle/src/libANGLE/validationES2.cpp
deleted file mode 100644
index 5e505aa607..0000000000
--- a/src/3rdparty/angle/src/libANGLE/validationES2.cpp
+++ /dev/null
@@ -1,6351 +0,0 @@
-//
-// 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.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/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/validationES3.h"
-
-namespace gl
-{
-
-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->getGLState().isScissorTestEnabled())
- {
- const Rectangle &scissor = context->getGLState().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->hasPath(pathName) && !context->hasPathData(pathName))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoSuchPath);
- 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->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- return false;
- }
-
- if (paths == nullptr)
- {
- context->handleError(InvalidValue() << "No path name array.");
- return false;
- }
-
- if (numPaths < 0)
- {
- context->handleError(InvalidValue() << "Invalid (negative) numPaths.");
- return false;
- }
-
- if (!angle::IsValueInRangeForNumericType<std::uint32_t>(numPaths))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), IntegerOverflow);
- 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->handleError(InvalidEnum() << "Invalid path name type.");
- 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->handleError(InvalidEnum() << "Invalid transformation.");
- return false;
- }
- if (componentCount != 0 && transformValues == nullptr)
- {
- context->handleError(InvalidValue() << "No transform array given.");
- return false;
- }
-
- angle::CheckedNumeric<std::uint32_t> checkedSize(0);
- checkedSize += (numPaths * pathNameTypeSize);
- checkedSize += (numPaths * sizeof(GLfloat) * componentCount);
- if (!checkedSize.IsValid())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), IntegerOverflow);
- 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))
- {
- return false;
- }
-
- if (!ValidES3FormatCombination(GetUnsizedFormat(internalFormat), type, internalFormat))
- {
- context->handleError(InvalidOperation()
- << "Invalid combination of type and internalFormat.");
- return false;
- }
-
- const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat, type);
- if (!internalFormatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
- {
- return false;
- }
-
- return true;
-}
-
-bool IsValidCopyTextureDestinationTargetEnum(Context *context, GLenum target)
-{
- switch (target)
- {
- case GL_TEXTURE_2D:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- return true;
-
- case GL_TEXTURE_RECTANGLE_ANGLE:
- return context->getExtensions().textureRectangle;
-
- default:
- return false;
- }
-}
-
-bool IsValidCopyTextureDestinationTarget(Context *context, GLenum textureType, GLenum target)
-{
- if (IsCubeMapTextureTarget(target))
- {
- return textureType == GL_TEXTURE_CUBE_MAP;
- }
- else
- {
- return textureType == target;
- }
-}
-
-bool IsValidCopyTextureSourceTarget(Context *context, GLenum target)
-{
- switch (target)
- {
- case GL_TEXTURE_2D:
- return true;
- case GL_TEXTURE_RECTANGLE_ANGLE:
- return context->getExtensions().textureRectangle;
-
- // TODO(geofflang): accept GL_TEXTURE_EXTERNAL_OES if the texture_external extension is
- // supported
-
- default:
- return false;
- }
-}
-
-bool IsValidCopyTextureSourceLevel(Context *context, GLenum target, GLint level)
-{
- if (!ValidMipLevel(context, target, level))
- {
- return false;
- }
-
- if (level > 0 && context->getClientVersion() < ES_3_0)
- {
- return false;
- }
-
- return true;
-}
-
-bool IsValidCopyTextureDestinationLevel(Context *context,
- GLenum target,
- GLint level,
- GLsizei width,
- GLsizei height)
-{
- if (!ValidMipLevel(context, target, level))
- {
- return false;
- }
-
- const Caps &caps = context->getCaps();
- if (target == GL_TEXTURE_2D)
- {
- if (static_cast<GLuint>(width) > (caps.max2DTextureSize >> level) ||
- static_cast<GLuint>(height) > (caps.max2DTextureSize >> level))
- {
- return false;
- }
- }
- else if (target == GL_TEXTURE_RECTANGLE_ANGLE)
- {
- ASSERT(level == 0);
- if (static_cast<GLuint>(width) > caps.maxRectangleTextureSize ||
- static_cast<GLuint>(height) > caps.maxRectangleTextureSize)
- {
- return false;
- }
- }
- else if (IsCubeMapTextureTarget(target))
- {
- if (static_cast<GLuint>(width) > (caps.maxCubeMapTextureSize >> level) ||
- static_cast<GLuint>(height) > (caps.maxCubeMapTextureSize >> level))
- {
- return false;
- }
- }
-
- 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(ValidationContext *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- if (!ValidTexture2DDestinationTarget(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
- return false;
- }
-
- if (!ValidImageSizeParameters(context, target, level, width, height, 1, isSubImage))
- {
- context->handleError(InvalidValue() << "Invalid texture dimensions.");
- 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->getGLState().getReadFramebuffer();
- GLenum colorbufferFormat =
- framebuffer->getReadColorbuffer()->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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- 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:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- return false;
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL_OES:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- return false;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- return false;
- }
-
- if (formatInfo.type == GL_FLOAT && !context->getExtensions().textureFloat)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- return false;
- }
- break;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (context->getExtensions().textureCompressionDXT1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- return false;
- }
- else
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (context->getExtensions().textureCompressionDXT3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- return false;
- }
- else
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (context->getExtensions().textureCompressionDXT5)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- return false;
- }
- else
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
- break;
- case GL_ETC1_RGB8_OES:
- if (context->getExtensions().compressedETC1RGB8Texture)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- else
- {
- context->handleError(InvalidEnum());
- 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->handleError(InvalidOperation()
- << "ETC lossy decode formats can't be copied to.");
- return false;
- }
- else
- {
- context->handleError(InvalidEnum()
- << "ANGLE_lossy_etc_decode extension is not supported.");
- return false;
- }
- break;
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH_STENCIL_OES:
- case GL_DEPTH24_STENCIL8_OES:
- if (context->getExtensions().depthTextures)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- else
- {
- context->handleError(InvalidEnum());
- return false;
- }
- default:
- context->handleError(InvalidEnum());
- 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;
-
- 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(ValidationContext *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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), WebglBindAttribLocationReservedPrefix);
- return false;
- }
-
- return true;
-}
-
-bool ValidateWebGLNameLength(ValidationContext *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.
- ANGLE_VALIDATION_ERR(context, InvalidValue(), WebglNameLengthLimitExceeded);
-
- 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.
- ANGLE_VALIDATION_ERR(context, InvalidValue(), Webgl2NameLengthLimitExceeded);
- return false;
- }
-
- return true;
-}
-
-} // anonymous namespace
-
-bool ValidateES2TexImageParameters(Context *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isCompressed,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLenum format,
- GLenum type,
- GLsizei imageSize,
- const void *pixels)
-{
- if (!ValidTexture2DDestinationTarget(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
- return false;
- }
-
- if (!ValidImageSizeParameters(context, target, level, width, height, 1, isSubImage))
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (!ValidMipLevel(context, target, level))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel);
- return false;
- }
-
- if (xoffset < 0 || std::numeric_limits<GLsizei>::max() - xoffset < width ||
- std::numeric_limits<GLsizei>::max() - yoffset < height)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), ResourceMaxTextureSize);
- 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.
- bool nonEqualFormatsAllowed =
- (internalformat == GL_RGB32F && context->getExtensions().colorBufferFloatRGB) ||
- (internalformat == GL_RGBA32F && context->getExtensions().colorBufferFloatRGBA);
-
- if (!isSubImage && !isCompressed && internalformat != format && !nonEqualFormatsAllowed)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- const gl::Caps &caps = context->getCaps();
-
- if (target == GL_TEXTURE_2D)
- {
- if (static_cast<GLuint>(width) > (caps.max2DTextureSize >> level) ||
- static_cast<GLuint>(height) > (caps.max2DTextureSize >> level))
- {
- context->handleError(InvalidValue());
- return false;
- }
- }
- else if (target == GL_TEXTURE_RECTANGLE_ANGLE)
- {
- ASSERT(level == 0);
- if (static_cast<GLuint>(width) > caps.maxRectangleTextureSize ||
- static_cast<GLuint>(height) > caps.maxRectangleTextureSize)
- {
- context->handleError(InvalidValue());
- return false;
- }
- if (isCompressed)
- {
- context->handleError(InvalidEnum()
- << "Rectangle texture cannot have a compressed format.");
- return false;
- }
- }
- else if (IsCubeMapTextureTarget(target))
- {
- if (!isSubImage && width != height)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), CubemapFacesEqualDimensions);
- return false;
- }
-
- if (static_cast<GLuint>(width) > (caps.maxCubeMapTextureSize >> level) ||
- static_cast<GLuint>(height) > (caps.maxCubeMapTextureSize >> level))
- {
- context->handleError(InvalidValue());
- return false;
- }
- }
- else
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- gl::Texture *texture =
- context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- if (!texture)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferNotBound);
- return false;
- }
-
- if (isSubImage)
- {
- const InternalFormat &textureInternalFormat = *texture->getFormat(target, level).info;
- if (textureInternalFormat.internalFormat == GL_NONE)
- {
- context->handleError(InvalidOperation() << "Texture level does not exist.");
- return false;
- }
-
- if (format != GL_NONE)
- {
- if (GetInternalFormatInfo(format, type).sizedInternalFormat !=
- textureInternalFormat.sizedInternalFormat)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), TypeMismatch);
- return false;
- }
- }
-
- if (static_cast<size_t>(xoffset + width) > texture->getWidth(target, level) ||
- static_cast<size_t>(yoffset + height) > texture->getHeight(target, level))
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (width > 0 && height > 0 && pixels == nullptr &&
- context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack) == nullptr)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), PixelDataNull);
- return false;
- }
- }
- else
- {
- if (texture->getImmutableFormat())
- {
- context->handleError(InvalidOperation());
- return false;
- }
- }
-
- // Verify zero border
- if (border != 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidBorder);
- return false;
- }
-
- if (isCompressed)
- {
- GLenum actualInternalFormat =
- isSubImage ? texture->getFormat(target, level).info->sizedInternalFormat
- : internalformat;
- switch (actualInternalFormat)
- {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (!context->getExtensions().textureCompressionDXT1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
- return false;
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (!context->getExtensions().textureCompressionDXT3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
- return false;
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (!context->getExtensions().textureCompressionDXT5)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
- return false;
- }
- break;
- 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:
- if (!context->getExtensions().textureCompressionS3TCsRGB)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
- return false;
- }
- break;
- case GL_ETC1_RGB8_OES:
- if (!context->getExtensions().compressedETC1RGB8Texture)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
- return false;
- }
- if (isSubImage)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidInternalFormat);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
- return false;
- }
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidInternalFormat);
- return false;
- }
-
- if (isSubImage)
- {
- if (!ValidCompressedSubImageSize(context, actualInternalFormat, xoffset, yoffset, width,
- height, texture->getWidth(target, level),
- texture->getHeight(target, level)))
- {
- context->handleError(InvalidOperation() << "Invalid compressed format dimension.");
- return false;
- }
-
- if (format != actualInternalFormat)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidFormat);
- return false;
- }
- }
- else
- {
- if (!ValidCompressedImageSize(context, actualInternalFormat, level, width, height))
- {
- context->handleError(InvalidOperation() << "Invalid compressed format dimension.");
- 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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidType);
- 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:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- return false;
- }
- break;
- case GL_RED:
- case GL_RG:
- if (!context->getExtensions().textureRG)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- break;
- case GL_FLOAT:
- case GL_HALF_FLOAT_OES:
- if (!context->getExtensions().textureFloat)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- 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:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- 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:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- return false;
- }
- break;
- case GL_BGRA_EXT:
- if (!context->getExtensions().textureFormatBGRA8888)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- return false;
- }
- break;
- case GL_SRGB_EXT:
- case GL_SRGB_ALPHA_EXT:
- if (!context->getExtensions().sRGB)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- 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:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- return false;
- }
- break;
- case GL_DEPTH_STENCIL_OES:
- switch (type)
- {
- case GL_UNSIGNED_INT_24_8_OES:
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- return false;
- }
- break;
- default:
- context->handleError(InvalidEnum());
- return false;
- }
-
- switch (format)
- {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (context->getExtensions().textureCompressionDXT1)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- else
- {
- context->handleError(InvalidEnum());
- return false;
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (context->getExtensions().textureCompressionDXT3)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- else
- {
- context->handleError(InvalidEnum());
- return false;
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (context->getExtensions().textureCompressionDXT5)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- else
- {
- context->handleError(InvalidEnum());
- return false;
- }
- break;
- case GL_ETC1_RGB8_OES:
- if (context->getExtensions().compressedETC1RGB8Texture)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- else
- {
- context->handleError(InvalidEnum());
- 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->handleError(InvalidOperation()
- << "ETC lossy decode formats can't work with this type.");
- return false;
- }
- else
- {
- context->handleError(InvalidEnum()
- << "ANGLE_lossy_etc_decode extension is not supported.");
- return false;
- }
- break;
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL_OES:
- if (!context->getExtensions().depthTextures)
- {
- context->handleError(InvalidValue());
- return false;
- }
- if (target != GL_TEXTURE_2D)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTargetAndFormat);
- return false;
- }
- // OES_depth_texture supports loading depth data and multiple levels,
- // but ANGLE_depth_texture does not
- if (pixels != nullptr)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), PixelDataNotNull);
- return false;
- }
- if (level != 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), LevelNotZero);
- return false;
- }
- break;
- default:
- break;
- }
-
- if (!isSubImage)
- {
- switch (internalformat)
- {
- case GL_RGBA32F:
- if (!context->getExtensions().colorBufferFloatRGBA)
- {
- context->handleError(InvalidValue()
- << "Sized GL_RGBA32F internal format requires "
- "GL_CHROMIUM_color_buffer_float_rgba");
- return false;
- }
- if (type != GL_FLOAT)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- return false;
- }
- if (format != GL_RGBA)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- return false;
- }
- break;
-
- case GL_RGB32F:
- if (!context->getExtensions().colorBufferFloatRGB)
- {
- context->handleError(InvalidValue()
- << "Sized GL_RGB32F internal format requires "
- "GL_CHROMIUM_color_buffer_float_rgb");
- return false;
- }
- if (type != GL_FLOAT)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- return false;
- }
- if (format != GL_RGB)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- return false;
- }
- break;
-
- default:
- break;
- }
- }
-
- if (type == GL_FLOAT)
- {
- if (!context->getExtensions().textureFloat)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- }
- else if (type == GL_HALF_FLOAT_OES)
- {
- if (!context->getExtensions().textureHalfFloat)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- }
- }
-
- GLenum sizeCheckFormat = isSubImage ? format : internalformat;
- if (!ValidImageDataSize(context, target, width, height, 1, sizeCheckFormat, type, pixels,
- imageSize))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateES2TexStorageParameters(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height)
-{
- if (target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP &&
- target != GL_TEXTURE_RECTANGLE_ANGLE)
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- if (width < 1 || height < 1 || levels < 1)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (target == GL_TEXTURE_CUBE_MAP && width != height)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (levels != 1 && levels != gl::log2(std::max(width, height)) + 1)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalformat);
- if (formatInfo.format == GL_NONE || formatInfo.type == GL_NONE)
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- const gl::Caps &caps = context->getCaps();
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
- static_cast<GLuint>(height) > caps.max2DTextureSize)
- {
- context->handleError(InvalidValue());
- return false;
- }
- break;
- case GL_TEXTURE_RECTANGLE_ANGLE:
- if (static_cast<GLuint>(width) > caps.maxRectangleTextureSize ||
- static_cast<GLuint>(height) > caps.maxRectangleTextureSize || levels != 1)
- {
- context->handleError(InvalidValue());
- return false;
- }
- if (formatInfo.compressed)
- {
- context->handleError(InvalidEnum()
- << "Rectangle texture cannot have a compressed format.");
- return false;
- }
- break;
- case GL_TEXTURE_CUBE_MAP:
- if (static_cast<GLuint>(width) > caps.maxCubeMapTextureSize ||
- static_cast<GLuint>(height) > caps.maxCubeMapTextureSize)
- {
- context->handleError(InvalidValue());
- return false;
- }
- break;
- default:
- context->handleError(InvalidEnum());
- return false;
- }
-
- if (levels != 1 && !context->getExtensions().textureNPOT)
- {
- if (!gl::isPow2(width) || !gl::isPow2(height))
- {
- context->handleError(InvalidOperation());
- return false;
- }
- }
-
- switch (internalformat)
- {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (!context->getExtensions().textureCompressionDXT1)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (!context->getExtensions().textureCompressionDXT3)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (!context->getExtensions().textureCompressionDXT5)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- break;
- case GL_ETC1_RGB8_OES:
- if (!context->getExtensions().compressedETC1RGB8Texture)
- {
- context->handleError(InvalidEnum());
- 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->handleError(InvalidEnum()
- << "ANGLE_lossy_etc_decode extension is not supported.");
- 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->handleError(InvalidEnum());
- 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->handleError(InvalidEnum());
- return false;
- }
- break;
- case GL_R8_EXT:
- case GL_RG8_EXT:
- if (!context->getExtensions().textureRG)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- break;
- case GL_R16F_EXT:
- case GL_RG16F_EXT:
- if (!context->getExtensions().textureRG || !context->getExtensions().textureHalfFloat)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- break;
- case GL_R32F_EXT:
- case GL_RG32F_EXT:
- if (!context->getExtensions().textureRG || !context->getExtensions().textureFloat)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- break;
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH24_STENCIL8_OES:
- if (!context->getExtensions().depthTextures)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- if (target != GL_TEXTURE_2D)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- // ANGLE_depth_texture only supports 1-level textures
- if (levels != 1)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- break;
- default:
- break;
- }
-
- gl::Texture *texture = context->getTargetTexture(target);
- if (!texture || texture->id() == 0)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (texture->getImmutableFormat())
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- return true;
-}
-
-bool ValidateDiscardFramebufferEXT(Context *context,
- GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments)
-{
- if (!context->getExtensions().discardFramebuffer)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- bool defaultFramebuffer = false;
-
- switch (target)
- {
- case GL_FRAMEBUFFER:
- defaultFramebuffer =
- (context->getGLState().getTargetFramebuffer(GL_FRAMEBUFFER)->id() == 0);
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget);
- return false;
- }
-
- return ValidateDiscardFramebufferBase(context, target, numAttachments, attachments,
- defaultFramebuffer);
-}
-
-bool ValidateBindVertexArrayOES(Context *context, GLuint array)
-{
- if (!context->getExtensions().vertexArrayObject)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- return ValidateBindVertexArrayBase(context, array);
-}
-
-bool ValidateDeleteVertexArraysOES(Context *context, GLsizei n, const GLuint *arrays)
-{
- if (!context->getExtensions().vertexArrayObject)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- return ValidateGenOrDelete(context, n);
-}
-
-bool ValidateGenVertexArraysOES(Context *context, GLsizei n, GLuint *arrays)
-{
- if (!context->getExtensions().vertexArrayObject)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- return ValidateGenOrDelete(context, n);
-}
-
-bool ValidateIsVertexArrayOES(Context *context, GLuint array)
-{
- if (!context->getExtensions().vertexArrayObject)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- return true;
-}
-
-bool ValidateProgramBinaryOES(Context *context,
- GLuint program,
- GLenum binaryFormat,
- const void *binary,
- GLint length)
-{
- if (!context->getExtensions().getProgramBinary)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- if (!ValidDebugSource(source, false) && source != GL_DONT_CARE)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidDebugSource);
- return false;
- }
-
- if (!ValidDebugType(type) && type != GL_DONT_CARE)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidDebugType);
- return false;
- }
-
- if (!ValidDebugSeverity(severity) && severity != GL_DONT_CARE)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidDebugSeverity);
- return false;
- }
-
- if (count > 0)
- {
- if (source == GL_DONT_CARE || type == GL_DONT_CARE)
- {
- context->handleError(
- InvalidOperation()
- << "If count is greater than zero, source and severity cannot be GL_DONT_CARE.");
- return false;
- }
-
- if (severity != GL_DONT_CARE)
- {
- context->handleError(
- InvalidOperation()
- << "If count is greater than zero, severity must be GL_DONT_CARE.");
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- if (!context->getGLState().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))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidDebugSource);
- return false;
- }
-
- if (!ValidDebugType(type))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidDebugType);
- return false;
- }
-
- if (!ValidDebugSource(source, true))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidDebugSource);
- return false;
- }
-
- size_t messageLength = (length < 0) ? strlen(buf) : length;
- if (messageLength > context->getExtensions().maxDebugMessageLength)
- {
- context->handleError(InvalidValue()
- << "Message length is larger than GL_MAX_DEBUG_MESSAGE_LENGTH.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateDebugMessageCallbackKHR(Context *context,
- GLDEBUGPROCKHR callback,
- const void *userParam)
-{
- if (!context->getExtensions().debug)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- if (bufSize < 0 && messageLog != nullptr)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- return false;
- }
-
- return true;
-}
-
-bool ValidatePushDebugGroupKHR(Context *context,
- GLenum source,
- GLuint id,
- GLsizei length,
- const GLchar *message)
-{
- if (!context->getExtensions().debug)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- if (!ValidDebugSource(source, true))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidDebugSource);
- return false;
- }
-
- size_t messageLength = (length < 0) ? strlen(message) : length;
- if (messageLength > context->getExtensions().maxDebugMessageLength)
- {
- context->handleError(InvalidValue()
- << "Message length is larger than GL_MAX_DEBUG_MESSAGE_LENGTH.");
- return false;
- }
-
- size_t currentStackSize = context->getGLState().getDebug().getGroupStackDepth();
- if (currentStackSize >= context->getExtensions().maxDebugGroupStackDepth)
- {
- context
- ->handleError(StackOverflow()
- << "Cannot push more than GL_MAX_DEBUG_GROUP_STACK_DEPTH debug groups.");
- return false;
- }
-
- return true;
-}
-
-bool ValidatePopDebugGroupKHR(Context *context)
-{
- if (!context->getExtensions().debug)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- size_t currentStackSize = context->getGLState().getDebug().getGroupStackDepth();
- if (currentStackSize <= 1)
- {
- context->handleError(StackUnderflow() << "Cannot pop the default debug group.");
- return false;
- }
-
- return true;
-}
-
-static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier, GLuint name)
-{
- switch (identifier)
- {
- case GL_BUFFER:
- if (context->getBuffer(name) == nullptr)
- {
- context->handleError(InvalidValue() << "name is not a valid buffer.");
- return false;
- }
- return true;
-
- case GL_SHADER:
- if (context->getShader(name) == nullptr)
- {
- context->handleError(InvalidValue() << "name is not a valid shader.");
- return false;
- }
- return true;
-
- case GL_PROGRAM:
- if (context->getProgram(name) == nullptr)
- {
- context->handleError(InvalidValue() << "name is not a valid program.");
- return false;
- }
- return true;
-
- case GL_VERTEX_ARRAY:
- if (context->getVertexArray(name) == nullptr)
- {
- context->handleError(InvalidValue() << "name is not a valid vertex array.");
- return false;
- }
- return true;
-
- case GL_QUERY:
- if (context->getQuery(name) == nullptr)
- {
- context->handleError(InvalidValue() << "name is not a valid query.");
- return false;
- }
- return true;
-
- case GL_TRANSFORM_FEEDBACK:
- if (context->getTransformFeedback(name) == nullptr)
- {
- context->handleError(InvalidValue() << "name is not a valid transform feedback.");
- return false;
- }
- return true;
-
- case GL_SAMPLER:
- if (context->getSampler(name) == nullptr)
- {
- context->handleError(InvalidValue() << "name is not a valid sampler.");
- return false;
- }
- return true;
-
- case GL_TEXTURE:
- if (context->getTexture(name) == nullptr)
- {
- context->handleError(InvalidValue() << "name is not a valid texture.");
- return false;
- }
- return true;
-
- case GL_RENDERBUFFER:
- if (context->getRenderbuffer(name) == nullptr)
- {
- context->handleError(InvalidValue() << "name is not a valid renderbuffer.");
- return false;
- }
- return true;
-
- case GL_FRAMEBUFFER:
- if (context->getFramebuffer(name) == nullptr)
- {
- context->handleError(InvalidValue() << "name is not a valid framebuffer.");
- return false;
- }
- return true;
-
- default:
- context->handleError(InvalidEnum() << "Invalid identifier.");
- 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->handleError(InvalidValue() << "Label length is larger than GL_MAX_LABEL_LENGTH.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateObjectLabelKHR(Context *context,
- GLenum identifier,
- GLuint name,
- GLsizei length,
- const GLchar *label)
-{
- if (!context->getExtensions().debug)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- if (bufSize < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- 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->handleError(InvalidValue() << "name is not a valid sync.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateObjectPtrLabelKHR(Context *context,
- const void *ptr,
- GLsizei length,
- const GLchar *label)
-{
- if (!context->getExtensions().debug)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- if (bufSize < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- return false;
- }
-
- if (!ValidateObjectPtrName(context, ptr))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetPointervKHR(Context *context, GLenum pname, void **params)
-{
- if (!context->getExtensions().debug)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return false;
- }
-
- // TODO: represent this in Context::getQueryParameterInfo.
- switch (pname)
- {
- case GL_DEBUG_CALLBACK_FUNCTION:
- case GL_DEBUG_CALLBACK_USER_PARAM:
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- return true;
-}
-
-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->handleError(InvalidOperation() << "Blit extension not available.");
- return false;
- }
-
- if (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0)
- {
- // TODO(jmadill): Determine if this should be available on other implementations.
- context->handleError(InvalidOperation() << "Scaling and flipping in "
- "BlitFramebufferANGLE not supported by this "
- "implementation.");
- return false;
- }
-
- if (filter == GL_LINEAR)
- {
- context->handleError(InvalidEnum() << "Linear blit not supported in this extension");
- return false;
- }
-
- Framebuffer *readFramebuffer = context->getGLState().getReadFramebuffer();
- Framebuffer *drawFramebuffer = context->getGLState().getDrawFramebuffer();
-
- if (mask & GL_COLOR_BUFFER_BIT)
- {
- const FramebufferAttachment *readColorAttachment = readFramebuffer->getReadColorbuffer();
- const FramebufferAttachment *drawColorAttachment = drawFramebuffer->getFirstColorbuffer();
-
- if (readColorAttachment && drawColorAttachment)
- {
- if (!(readColorAttachment->type() == GL_TEXTURE &&
- readColorAttachment->getTextureImageIndex().type == GL_TEXTURE_2D) &&
- readColorAttachment->type() != GL_RENDERBUFFER &&
- readColorAttachment->type() != GL_FRAMEBUFFER_DEFAULT)
- {
- context->handleError(InvalidOperation());
- 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().type == GL_TEXTURE_2D) &&
- attachment->type() != GL_RENDERBUFFER &&
- attachment->type() != GL_FRAMEBUFFER_DEFAULT)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- // Return an error if the destination formats do not match
- if (!Format::EquivalentForBlit(attachment->getFormat(),
- readColorAttachment->getFormat()))
- {
- context->handleError(InvalidOperation());
- return false;
- }
- }
- }
-
- if (readFramebuffer->getSamples(context) != 0 &&
- IsPartialBlit(context, readColorAttachment, drawColorAttachment, srcX0, srcY0,
- srcX1, srcY1, dstX0, dstY0, dstX1, dstY1))
- {
- context->handleError(InvalidOperation());
- 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(attachments[i]);
- const FramebufferAttachment *drawBuffer =
- drawFramebuffer->getAttachment(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->handleError(InvalidOperation() << "Only whole-buffer depth and "
- "stencil blits are supported by "
- "this extension.");
- return false;
- }
-
- if (readBuffer->getSamples() != 0 || drawBuffer->getSamples() != 0)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- }
- }
- }
-
- return ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
- dstX1, dstY1, mask, filter);
-}
-
-bool ValidateClear(ValidationContext *context, GLbitfield mask)
-{
- Framebuffer *fbo = context->getGLState().getDrawFramebuffer();
- if (fbo->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE)
- {
- context->handleError(InvalidFramebufferOperation());
- return false;
- }
-
- if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidClearMask);
- return false;
- }
-
- if (context->getExtensions().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;
- }
- }
- }
-
- return true;
-}
-
-bool ValidateDrawBuffersEXT(ValidationContext *context, GLsizei n, const GLenum *bufs)
-{
- if (!context->getExtensions().drawBuffers)
- {
- context->handleError(InvalidOperation() << "Extension not supported.");
- return false;
- }
-
- return ValidateDrawBuffersBase(context, n, bufs);
-}
-
-bool ValidateTexImage2D(Context *context,
- GLenum 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 ValidateTexImage2DRobust(Context *context,
- GLenum 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,
- GLenum 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,
- GLenum 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 ValidateCompressedTexImage2D(Context *context,
- GLenum 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);
- auto blockSizeOrErr = formatInfo.computeCompressedImageSize(gl::Extents(width, height, 1));
- if (blockSizeOrErr.isError())
- {
- context->handleError(blockSizeOrErr.getError());
- return false;
- }
-
- if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSizeOrErr.getResult())
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), CompressedTextureDimensionsMustMatchData);
- return false;
- }
-
- if (target == GL_TEXTURE_RECTANGLE_ANGLE)
- {
- context->handleError(InvalidEnum() << "Rectangle texture cannot have a compressed format.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateCompressedTexImage2DRobustANGLE(Context *context,
- GLenum 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 ValidateCompressedTexSubImage2DRobustANGLE(Context *context,
- GLenum 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,
- GLenum 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);
- auto blockSizeOrErr = formatInfo.computeCompressedImageSize(gl::Extents(width, height, 1));
- if (blockSizeOrErr.isError())
- {
- context->handleError(blockSizeOrErr.getError());
- return false;
- }
-
- if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSizeOrErr.getResult())
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetBufferPointervOES(Context *context,
- BufferBinding target,
- GLenum pname,
- void **params)
-{
- return ValidateGetBufferPointervBase(context, target, pname, nullptr, params);
-}
-
-bool ValidateMapBufferOES(Context *context, BufferBinding target, GLenum access)
-{
- if (!context->getExtensions().mapBuffer)
- {
- context->handleError(InvalidOperation() << "Map buffer extension not available.");
- return false;
- }
-
- if (!ValidBufferType(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
- return false;
- }
-
- Buffer *buffer = context->getGLState().getTargetBuffer(target);
-
- if (buffer == nullptr)
- {
- context->handleError(InvalidOperation() << "Attempted to map buffer object zero.");
- return false;
- }
-
- if (access != GL_WRITE_ONLY_OES)
- {
- context->handleError(InvalidEnum() << "Non-write buffer mapping not supported.");
- return false;
- }
-
- if (buffer->isMapped())
- {
- context->handleError(InvalidOperation() << "Buffer is already mapped.");
- return false;
- }
-
- return ValidateMapBufferBase(context, target);
-}
-
-bool ValidateUnmapBufferOES(Context *context, BufferBinding target)
-{
- if (!context->getExtensions().mapBuffer)
- {
- context->handleError(InvalidOperation() << "Map buffer extension not available.");
- return false;
- }
-
- return ValidateUnmapBufferBase(context, target);
-}
-
-bool ValidateMapBufferRangeEXT(Context *context,
- BufferBinding target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access)
-{
- if (!context->getExtensions().mapBufferRange)
- {
- context->handleError(InvalidOperation() << "Map buffer range extension not available.");
- return false;
- }
-
- return ValidateMapBufferRangeBase(context, target, offset, length, access);
-}
-
-bool ValidateMapBufferBase(Context *context, BufferBinding target)
-{
- Buffer *buffer = context->getGLState().getTargetBuffer(target);
- ASSERT(buffer != nullptr);
-
- // Check if this buffer is currently being used as a transform feedback output buffer
- TransformFeedback *transformFeedback = context->getGLState().getCurrentTransformFeedback();
- if (transformFeedback != nullptr && transformFeedback->isActive())
- {
- for (size_t i = 0; i < transformFeedback->getIndexedBufferCount(); i++)
- {
- const auto &transformFeedbackBuffer = transformFeedback->getIndexedBuffer(i);
- if (transformFeedbackBuffer.get() == buffer)
- {
- context->handleError(InvalidOperation()
- << "Buffer is currently bound for transform feedback.");
- return false;
- }
- }
- }
-
- return true;
-}
-
-bool ValidateFlushMappedBufferRangeEXT(Context *context,
- BufferBinding target,
- GLintptr offset,
- GLsizeiptr length)
-{
- if (!context->getExtensions().mapBufferRange)
- {
- context->handleError(InvalidOperation() << "Map buffer range extension not available.");
- return false;
- }
-
- return ValidateFlushMappedBufferRangeBase(context, target, offset, length);
-}
-
-bool ValidateBindTexture(Context *context, GLenum target, GLuint texture)
-{
- Texture *textureObject = context->getTexture(texture);
- if (textureObject && textureObject->getTarget() != target && texture != 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), TypeMismatch);
- return false;
- }
-
- if (!context->getGLState().isBindGeneratesResourceEnabled() &&
- !context->isTextureGenerated(texture))
- {
- context->handleError(InvalidOperation() << "Texture was not generated");
- return false;
- }
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- case GL_TEXTURE_CUBE_MAP:
- break;
-
- case GL_TEXTURE_RECTANGLE_ANGLE:
- if (!context->getExtensions().textureRectangle)
- {
- context->handleError(InvalidEnum()
- << "Context does not support GL_ANGLE_texture_rectangle");
- return false;
- }
- break;
-
- case GL_TEXTURE_3D:
- case GL_TEXTURE_2D_ARRAY:
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), ES3Required);
- return false;
- }
- break;
-
- case GL_TEXTURE_2D_MULTISAMPLE:
- if (context->getClientVersion() < Version(3, 1))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), ES31Required);
- return false;
- }
- break;
-
- case GL_TEXTURE_EXTERNAL_OES:
- if (!context->getExtensions().eglImageExternal &&
- !context->getExtensions().eglStreamConsumerExternal)
- {
- context->handleError(InvalidEnum() << "External texture extension not enabled");
- return false;
- }
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
- return false;
- }
-
- return true;
-}
-
-bool ValidateBindUniformLocationCHROMIUM(Context *context,
- GLuint program,
- GLint location,
- const GLchar *name)
-{
- if (!context->getExtensions().bindUniformLocation)
- {
- context->handleError(InvalidOperation()
- << "GL_CHROMIUM_bind_uniform_location is not available.");
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
- if (!programObject)
- {
- return false;
- }
-
- if (location < 0)
- {
- context->handleError(InvalidValue() << "Location cannot be less than 0.");
- return false;
- }
-
- const Caps &caps = context->getCaps();
- if (static_cast<size_t>(location) >=
- (caps.maxVertexUniformVectors + caps.maxFragmentUniformVectors) * 4)
- {
- context->handleError(InvalidValue() << "Location must be less than "
- "(MAX_VERTEX_UNIFORM_VECTORS + "
- "MAX_FRAGMENT_UNIFORM_VECTORS) * 4");
- 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)))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidNameCharacters);
- return false;
- }
-
- if (strncmp(name, "gl_", 3) == 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NameBeginsWithGL);
- return false;
- }
-
- return true;
-}
-
-bool ValidateCoverageModulationCHROMIUM(Context *context, GLenum components)
-{
- if (!context->getExtensions().framebufferMixedSamples)
- {
- context->handleError(InvalidOperation()
- << "GL_CHROMIUM_framebuffer_mixed_samples is not available.");
- return false;
- }
- switch (components)
- {
- case GL_RGB:
- case GL_RGBA:
- case GL_ALPHA:
- case GL_NONE:
- break;
- default:
- context->handleError(
- InvalidEnum()
- << "GLenum components is not one of GL_RGB, GL_RGBA, GL_ALPHA or GL_NONE.");
- return false;
- }
-
- return true;
-}
-
-// CHROMIUM_path_rendering
-
-bool ValidateMatrix(Context *context, GLenum matrixMode, const GLfloat *matrix)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- return false;
- }
- if (matrixMode != GL_PATH_MODELVIEW_CHROMIUM && matrixMode != GL_PATH_PROJECTION_CHROMIUM)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMatrixMode);
- return false;
- }
- if (matrix == nullptr)
- {
- context->handleError(InvalidOperation() << "Invalid matrix.");
- return false;
- }
- return true;
-}
-
-bool ValidateMatrixMode(Context *context, GLenum matrixMode)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- return false;
- }
- if (matrixMode != GL_PATH_MODELVIEW_CHROMIUM && matrixMode != GL_PATH_PROJECTION_CHROMIUM)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMatrixMode);
- return false;
- }
- return true;
-}
-
-bool ValidateGenPaths(Context *context, GLsizei range)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidRange);
- return false;
- }
-
- if (!angle::IsValueInRangeForNumericType<std::uint32_t>(range))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), IntegerOverflow);
- return false;
- }
-
- return true;
-}
-
-bool ValidateDeletePaths(Context *context, GLuint path, GLsizei range)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidRange);
- return false;
- }
-
- angle::CheckedNumeric<std::uint32_t> checkedRange(path);
- checkedRange += range;
-
- if (!angle::IsValueInRangeForNumericType<std::uint32_t>(range) || !checkedRange.IsValid())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), IntegerOverflow);
- return false;
- }
- return true;
-}
-
-bool ValidatePathCommands(Context *context,
- GLuint path,
- GLsizei numCommands,
- const GLubyte *commands,
- GLsizei numCoords,
- GLenum coordType,
- const void *coords)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- return false;
- }
- if (!context->hasPath(path))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoSuchPath);
- return false;
- }
-
- if (numCommands < 0)
- {
- context->handleError(InvalidValue() << "Invalid number of commands.");
- return false;
- }
- else if (numCommands > 0)
- {
- if (!commands)
- {
- context->handleError(InvalidValue() << "No commands array given.");
- return false;
- }
- }
-
- if (numCoords < 0)
- {
- context->handleError(InvalidValue() << "Invalid number of coordinates.");
- return false;
- }
- else if (numCoords > 0)
- {
- if (!coords)
- {
- context->handleError(InvalidValue() << "No coordinate array given.");
- 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->handleError(InvalidEnum() << "Invalid coordinate type.");
- return false;
- }
-
- angle::CheckedNumeric<std::uint32_t> checkedSize(numCommands);
- checkedSize += (coordTypeSize * numCoords);
- if (!checkedSize.IsValid())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), IntegerOverflow);
- 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->handleError(InvalidEnum() << "Invalid command.");
- return false;
- }
- }
- if (expectedNumCoords != numCoords)
- {
- context->handleError(InvalidValue() << "Invalid number of coordinates.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateSetPathParameter(Context *context, GLuint path, GLenum pname, GLfloat value)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- return false;
- }
- if (!context->hasPath(path))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoSuchPath);
- return false;
- }
-
- switch (pname)
- {
- case GL_PATH_STROKE_WIDTH_CHROMIUM:
- if (value < 0.0f)
- {
- context->handleError(InvalidValue() << "Invalid stroke width.");
- 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->handleError(InvalidEnum() << "Invalid end caps.");
- 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->handleError(InvalidEnum() << "Invalid join style.");
- return false;
- }
- case GL_PATH_MITER_LIMIT_CHROMIUM:
- if (value < 0.0f)
- {
- context->handleError(InvalidValue() << "Invalid miter limit.");
- return false;
- }
- break;
-
- case GL_PATH_STROKE_BOUND_CHROMIUM:
- // no errors, only clamping.
- break;
-
- default:
- context->handleError(InvalidEnum() << "Invalid path parameter.");
- return false;
- }
- return true;
-}
-
-bool ValidateGetPathParameter(Context *context, GLuint path, GLenum pname, GLfloat *value)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- return false;
- }
-
- if (!context->hasPath(path))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoSuchPath);
- return false;
- }
- if (!value)
- {
- context->handleError(InvalidValue() << "No value array.");
- 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->handleError(InvalidEnum() << "Invalid path parameter.");
- return false;
- }
-
- return true;
-}
-
-bool ValidatePathStencilFunc(Context *context, GLenum func, GLint ref, GLuint mask)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- 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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidStencil);
- 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 ValidateStencilFillPath(Context *context, GLuint path, GLenum fillMode, GLuint mask)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- return false;
- }
- if (context->hasPath(path) && !context->hasPathData(path))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoSuchPath);
- return false;
- }
-
- switch (fillMode)
- {
- case GL_COUNT_UP_CHROMIUM:
- case GL_COUNT_DOWN_CHROMIUM:
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFillMode);
- return false;
- }
-
- if (!isPow2(mask + 1))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidStencilBitMask);
- return false;
- }
-
- return true;
-}
-
-bool ValidateStencilStrokePath(Context *context, GLuint path, GLint reference, GLuint mask)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- return false;
- }
- if (context->hasPath(path) && !context->hasPathData(path))
- {
- context->handleError(InvalidOperation() << "No such path or path has no data.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateCoverPath(Context *context, GLuint path, GLenum coverMode)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- return false;
- }
- if (context->hasPath(path) && !context->hasPathData(path))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoSuchPath);
- return false;
- }
-
- switch (coverMode)
- {
- case GL_CONVEX_HULL_CHROMIUM:
- case GL_BOUNDING_BOX_CHROMIUM:
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidCoverMode);
- return false;
- }
- return true;
-}
-
-bool ValidateStencilThenCoverFillPath(Context *context,
- GLuint path,
- GLenum fillMode,
- GLuint mask,
- GLenum coverMode)
-{
- return ValidateStencilFillPath(context, path, fillMode, mask) &&
- ValidateCoverPath(context, path, coverMode);
-}
-
-bool ValidateStencilThenCoverStrokePath(Context *context,
- GLuint path,
- GLint reference,
- GLuint mask,
- GLenum coverMode)
-{
- return ValidateStencilStrokePath(context, path, reference, mask) &&
- ValidateCoverPath(context, path, coverMode);
-}
-
-bool ValidateIsPath(Context *context)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- return false;
- }
- return true;
-}
-
-bool ValidateCoverFillPathInstanced(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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidCoverMode);
- return false;
- }
-
- return true;
-}
-
-bool ValidateCoverStrokePathInstanced(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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidCoverMode);
- return false;
- }
-
- return true;
-}
-
-bool ValidateStencilFillPathInstanced(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_COUNT_UP_CHROMIUM:
- case GL_COUNT_DOWN_CHROMIUM:
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFillMode);
- return false;
- }
- if (!isPow2(mask + 1))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidStencilBitMask);
- return false;
- }
- return true;
-}
-
-bool ValidateStencilStrokePathInstanced(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 ValidateStencilThenCoverFillPathInstanced(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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidCoverMode);
- return false;
- }
-
- switch (fillMode)
- {
- case GL_COUNT_UP_CHROMIUM:
- case GL_COUNT_DOWN_CHROMIUM:
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFillMode);
- return false;
- }
- if (!isPow2(mask + 1))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidStencilBitMask);
- return false;
- }
-
- return true;
-}
-
-bool ValidateStencilThenCoverStrokePathInstanced(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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidCoverMode);
- return false;
- }
-
- return true;
-}
-
-bool ValidateBindFragmentInputLocation(Context *context,
- GLuint program,
- GLint location,
- const GLchar *name)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- return false;
- }
-
- const GLint MaxLocation = context->getCaps().maxVaryingVectors * 4;
- if (location >= MaxLocation)
- {
- context->handleError(InvalidValue() << "Location exceeds max varying.");
- return false;
- }
-
- const auto *programObject = context->getProgram(program);
- if (!programObject)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotBound);
- return false;
- }
-
- if (!name)
- {
- context->handleError(InvalidValue() << "No name given.");
- return false;
- }
-
- if (angle::BeginsWith(name, "gl_"))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), NameBeginsWithGL);
- return false;
- }
-
- return true;
-}
-
-bool ValidateProgramPathFragmentInputGen(Context *context,
- GLuint program,
- GLint location,
- GLenum genMode,
- GLint components,
- const GLfloat *coeffs)
-{
- if (!context->getExtensions().pathRendering)
- {
- context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
- return false;
- }
-
- const auto *programObject = context->getProgram(program);
- if (!programObject || programObject->isFlaggedForDeletion())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramDoesNotExist);
- return false;
- }
-
- if (!programObject->isLinked())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
- return false;
- }
-
- switch (genMode)
- {
- case GL_NONE:
- if (components != 0)
- {
- context->handleError(InvalidValue() << "Invalid components.");
- return false;
- }
- break;
-
- case GL_OBJECT_LINEAR_CHROMIUM:
- case GL_EYE_LINEAR_CHROMIUM:
- case GL_CONSTANT_CHROMIUM:
- if (components < 1 || components > 4)
- {
- context->handleError(InvalidValue() << "Invalid components.");
- return false;
- }
- if (!coeffs)
- {
- context->handleError(InvalidValue() << "No coefficients array given.");
- return false;
- }
- break;
-
- default:
- context->handleError(InvalidEnum() << "Invalid gen mode.");
- 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(context, location);
-
- if (!binding.valid)
- {
- context->handleError(InvalidOperation() << "No such binding.");
- 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->handleError(
- InvalidOperation()
- << "Fragment input type is not a floating point scalar or vector.");
- return false;
- }
- if (expectedComponents != components && genMode != GL_NONE)
- {
- context->handleError(InvalidOperation() << "Unexpected number of components");
- return false;
- }
- }
- return true;
-}
-
-bool ValidateCopyTextureCHROMIUM(Context *context,
- GLuint sourceId,
- GLint sourceLevel,
- GLenum destTarget,
- GLuint destId,
- GLint destLevel,
- GLint internalFormat,
- GLenum destType,
- GLboolean unpackFlipY,
- GLboolean unpackPremultiplyAlpha,
- GLboolean unpackUnmultiplyAlpha)
-{
- if (!context->getExtensions().copyTexture)
- {
- context->handleError(InvalidOperation()
- << "GL_CHROMIUM_copy_texture extension not available.");
- return false;
- }
-
- const Texture *source = context->getTexture(sourceId);
- if (source == nullptr)
- {
- context->handleError(InvalidValue() << "Source texture is not a valid texture object.");
- return false;
- }
-
- if (!IsValidCopyTextureSourceTarget(context, source->getTarget()))
- {
- context->handleError(InvalidValue() << "Source texture a valid texture type.");
- return false;
- }
-
- GLenum sourceTarget = source->getTarget();
- ASSERT(sourceTarget != GL_TEXTURE_CUBE_MAP);
-
- if (!IsValidCopyTextureSourceLevel(context, source->getTarget(), sourceLevel))
- {
- context->handleError(InvalidValue() << "Source texture level is not valid.");
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidInternalFormat);
- return false;
- }
-
- const InternalFormat &sourceFormat = *source->getFormat(sourceTarget, sourceLevel).info;
- if (!IsValidCopyTextureSourceInternalFormatEnum(sourceFormat.internalFormat))
- {
- context->handleError(InvalidOperation() << "Source texture internal format is invalid.");
- return false;
- }
-
- if (!IsValidCopyTextureDestinationTargetEnum(context, destTarget))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
- return false;
- }
-
- const Texture *dest = context->getTexture(destId);
- if (dest == nullptr)
- {
- context->handleError(InvalidValue()
- << "Destination texture is not a valid texture object.");
- return false;
- }
-
- if (!IsValidCopyTextureDestinationTarget(context, dest->getTarget(), destTarget))
- {
- context->handleError(InvalidValue() << "Destination texture a valid texture type.");
- return false;
- }
-
- if (!IsValidCopyTextureDestinationLevel(context, destTarget, destLevel, sourceWidth,
- sourceHeight))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel);
- return false;
- }
-
- if (!IsValidCopyTextureDestinationFormatType(context, internalFormat, destType))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTypeAndFormat);
- return false;
- }
-
- if (IsCubeMapTextureTarget(destTarget) && sourceWidth != sourceHeight)
- {
- context->handleError(
- InvalidValue() << "Destination width and height must be equal for cube map textures.");
- return false;
- }
-
- if (dest->getImmutableFormat())
- {
- context->handleError(InvalidOperation() << "Destination texture is immutable.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateCopySubTextureCHROMIUM(Context *context,
- 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)
-{
- if (!context->getExtensions().copyTexture)
- {
- context->handleError(InvalidOperation()
- << "GL_CHROMIUM_copy_texture extension not available.");
- return false;
- }
-
- const Texture *source = context->getTexture(sourceId);
- if (source == nullptr)
- {
- context->handleError(InvalidValue() << "Source texture is not a valid texture object.");
- return false;
- }
-
- if (!IsValidCopyTextureSourceTarget(context, source->getTarget()))
- {
- context->handleError(InvalidValue() << "Source texture a valid texture type.");
- return false;
- }
-
- GLenum sourceTarget = source->getTarget();
- ASSERT(sourceTarget != GL_TEXTURE_CUBE_MAP);
-
- if (!IsValidCopyTextureSourceLevel(context, source->getTarget(), sourceLevel))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel);
- return false;
- }
-
- if (source->getWidth(sourceTarget, sourceLevel) == 0 ||
- source->getHeight(sourceTarget, sourceLevel) == 0)
- {
- context->handleError(InvalidValue()
- << "The source level of the source texture must be defined.");
- return false;
- }
-
- if (x < 0 || y < 0)
- {
- context->handleError(InvalidValue() << "x and y cannot be negative.");
- return false;
- }
-
- if (width < 0 || height < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize);
- return false;
- }
-
- if (static_cast<size_t>(x + width) > source->getWidth(sourceTarget, sourceLevel) ||
- static_cast<size_t>(y + height) > source->getHeight(sourceTarget, sourceLevel))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), SourceTextureTooSmall);
- return false;
- }
-
- const Format &sourceFormat = source->getFormat(sourceTarget, sourceLevel);
- if (!IsValidCopySubTextureSourceInternalFormat(sourceFormat.info->internalFormat))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidInternalFormat);
- return false;
- }
-
- if (!IsValidCopyTextureDestinationTargetEnum(context, destTarget))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
- return false;
- }
-
- const Texture *dest = context->getTexture(destId);
- if (dest == nullptr)
- {
- context->handleError(InvalidValue()
- << "Destination texture is not a valid texture object.");
- return false;
- }
-
- if (!IsValidCopyTextureDestinationTarget(context, dest->getTarget(), destTarget))
- {
- context->handleError(InvalidValue() << "Destination texture a valid texture type.");
- return false;
- }
-
- if (!IsValidCopyTextureDestinationLevel(context, destTarget, destLevel, width, height))
- {
- context->handleError(InvalidValue() << "Destination texture level is not valid.");
- return false;
- }
-
- if (dest->getWidth(destTarget, destLevel) == 0 || dest->getHeight(destTarget, destLevel) == 0)
- {
- context
- ->handleError(InvalidOperation()
- << "The destination level of the destination texture must be defined.");
- return false;
- }
-
- const InternalFormat &destFormat = *dest->getFormat(destTarget, destLevel).info;
- if (!IsValidCopySubTextureDestionationInternalFormat(destFormat.internalFormat))
- {
- context->handleError(InvalidOperation()
- << "Destination internal format and type combination is not valid.");
- return false;
- }
-
- if (xoffset < 0 || yoffset < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset);
- return false;
- }
-
- if (static_cast<size_t>(xoffset + width) > dest->getWidth(destTarget, destLevel) ||
- static_cast<size_t>(yoffset + height) > dest->getHeight(destTarget, destLevel))
- {
- context->handleError(InvalidValue() << "Destination texture not large enough to copy to.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateCompressedCopyTextureCHROMIUM(Context *context, GLuint sourceId, GLuint destId)
-{
- if (!context->getExtensions().copyCompressedTexture)
- {
- context->handleError(InvalidOperation()
- << "GL_CHROMIUM_copy_compressed_texture extension not available.");
- return false;
- }
-
- const gl::Texture *source = context->getTexture(sourceId);
- if (source == nullptr)
- {
- context->handleError(InvalidValue() << "Source texture is not a valid texture object.");
- return false;
- }
-
- if (source->getTarget() != GL_TEXTURE_2D)
- {
- context->handleError(InvalidValue() << "Source texture must be of type GL_TEXTURE_2D.");
- return false;
- }
-
- if (source->getWidth(GL_TEXTURE_2D, 0) == 0 || source->getHeight(GL_TEXTURE_2D, 0) == 0)
- {
- context->handleError(InvalidValue() << "Source texture must level 0 defined.");
- return false;
- }
-
- const gl::Format &sourceFormat = source->getFormat(GL_TEXTURE_2D, 0);
- if (!sourceFormat.info->compressed)
- {
- context->handleError(InvalidOperation()
- << "Source texture must have a compressed internal format.");
- return false;
- }
-
- const gl::Texture *dest = context->getTexture(destId);
- if (dest == nullptr)
- {
- context->handleError(InvalidValue()
- << "Destination texture is not a valid texture object.");
- return false;
- }
-
- if (dest->getTarget() != GL_TEXTURE_2D)
- {
- context->handleError(InvalidValue()
- << "Destination texture must be of type GL_TEXTURE_2D.");
- return false;
- }
-
- if (dest->getImmutableFormat())
- {
- context->handleError(InvalidOperation() << "Destination cannot be immutable.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateCreateShader(Context *context, GLenum type)
-{
- switch (type)
- {
- case GL_VERTEX_SHADER:
- case GL_FRAGMENT_SHADER:
- break;
-
- case GL_COMPUTE_SHADER:
- if (context->getClientVersion() < Version(3, 1))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), ES31Required);
- return false;
- }
- break;
-
- case GL_GEOMETRY_SHADER_EXT:
- if (!context->getExtensions().geometryShader)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidShaderType);
- return false;
- }
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidShaderType);
- return false;
- }
-
- return true;
-}
-
-bool ValidateBufferData(ValidationContext *context,
- BufferBinding target,
- GLsizeiptr size,
- const void *data,
- BufferUsage usage)
-{
- if (size < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferUsage);
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferUsage);
- return false;
- }
-
- if (!ValidBufferType(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
- return false;
- }
-
- Buffer *buffer = context->getGLState().getTargetBuffer(target);
-
- if (!buffer)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferNotBound);
- return false;
- }
-
- return true;
-}
-
-bool ValidateBufferSubData(ValidationContext *context,
- BufferBinding target,
- GLintptr offset,
- GLsizeiptr size,
- const void *data)
-{
- if (size < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize);
- return false;
- }
-
- if (offset < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset);
- return false;
- }
-
- if (!ValidBufferType(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
- return false;
- }
-
- Buffer *buffer = context->getGLState().getTargetBuffer(target);
-
- if (!buffer)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferNotBound);
- return false;
- }
-
- if (buffer->isMapped())
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- // Check for possible overflow of size + offset
- angle::CheckedNumeric<size_t> checkedSize(size);
- checkedSize += offset;
- if (!checkedSize.IsValid())
- {
- context->handleError(OutOfMemory());
- return false;
- }
-
- if (size + offset > buffer->getSize())
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InsufficientBufferSize);
- return false;
- }
-
- return true;
-}
-
-bool ValidateRequestExtensionANGLE(Context *context, const GLchar *name)
-{
- if (!context->getExtensions().requestExtension)
- {
- context->handleError(InvalidOperation() << "GL_ANGLE_request_extension is not available.");
- return false;
- }
-
- if (!context->isExtensionRequestable(name))
- {
- context->handleError(InvalidOperation() << "Extension " << name << " is not requestable.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateActiveTexture(ValidationContext *context, GLenum texture)
-{
- if (texture < GL_TEXTURE0 ||
- texture > GL_TEXTURE0 + context->getCaps().maxCombinedTextureImageUnits - 1)
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- return true;
-}
-
-bool ValidateAttachShader(ValidationContext *context, GLuint program, GLuint shader)
-{
- Program *programObject = GetValidProgram(context, program);
- if (!programObject)
- {
- return false;
- }
-
- Shader *shaderObject = GetValidShader(context, shader);
- if (!shaderObject)
- {
- return false;
- }
-
- switch (shaderObject->getType())
- {
- case GL_VERTEX_SHADER:
- {
- if (programObject->getAttachedVertexShader())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ShaderAttachmentHasShader);
- return false;
- }
- break;
- }
- case GL_FRAGMENT_SHADER:
- {
- if (programObject->getAttachedFragmentShader())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ShaderAttachmentHasShader);
- return false;
- }
- break;
- }
- case GL_COMPUTE_SHADER:
- {
- if (programObject->getAttachedComputeShader())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ShaderAttachmentHasShader);
- return false;
- }
- break;
- }
- case GL_GEOMETRY_SHADER_EXT:
- {
- if (programObject->getAttachedGeometryShader())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ShaderAttachmentHasShader);
- return false;
- }
- break;
- }
- default:
- UNREACHABLE();
- break;
- }
-
- return true;
-}
-
-bool ValidateBindAttribLocation(ValidationContext *context,
- GLuint program,
- GLuint index,
- const GLchar *name)
-{
- if (index >= MAX_VERTEX_ATTRIBS)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxVertexAttribute);
- return false;
- }
-
- if (strncmp(name, "gl_", 3) == 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), NameBeginsWithGL);
- 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
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidNameCharacters);
- return false;
- }
-
- if (!ValidateWebGLNameLength(context, length) || !ValidateWebGLNamePrefix(context, name))
- {
- return false;
- }
- }
-
- return GetValidProgram(context, program) != nullptr;
-}
-
-bool ValidateBindBuffer(ValidationContext *context, BufferBinding target, GLuint buffer)
-{
- if (!ValidBufferType(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
- return false;
- }
-
- if (!context->getGLState().isBindGeneratesResourceEnabled() &&
- !context->isBufferGenerated(buffer))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ObjectNotGenerated);
- return false;
- }
-
- return true;
-}
-
-bool ValidateBindFramebuffer(ValidationContext *context, GLenum target, GLuint framebuffer)
-{
- if (!ValidFramebufferTarget(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget);
- return false;
- }
-
- if (!context->getGLState().isBindGeneratesResourceEnabled() &&
- !context->isFramebufferGenerated(framebuffer))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ObjectNotGenerated);
- return false;
- }
-
- return true;
-}
-
-bool ValidateBindRenderbuffer(ValidationContext *context, GLenum target, GLuint renderbuffer)
-{
- if (target != GL_RENDERBUFFER)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidRenderbufferTarget);
- return false;
- }
-
- if (!context->getGLState().isBindGeneratesResourceEnabled() &&
- !context->isRenderbufferGenerated(renderbuffer))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ObjectNotGenerated);
- return false;
- }
-
- return true;
-}
-
-static bool ValidBlendEquationMode(const ValidationContext *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(ValidationContext *context,
- GLfloat red,
- GLfloat green,
- GLfloat blue,
- GLfloat alpha)
-{
- return true;
-}
-
-bool ValidateBlendEquation(ValidationContext *context, GLenum mode)
-{
- if (!ValidBlendEquationMode(context, mode))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBlendEquation);
- return false;
- }
-
- return true;
-}
-
-bool ValidateBlendEquationSeparate(ValidationContext *context, GLenum modeRGB, GLenum modeAlpha)
-{
- if (!ValidBlendEquationMode(context, modeRGB))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBlendEquation);
- return false;
- }
-
- if (!ValidBlendEquationMode(context, modeAlpha))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBlendEquation);
- return false;
- }
-
- return true;
-}
-
-bool ValidateBlendFunc(ValidationContext *context, GLenum sfactor, GLenum dfactor)
-{
- return ValidateBlendFuncSeparate(context, sfactor, dfactor, sfactor, dfactor);
-}
-
-static bool ValidSrcBlendFunc(GLenum srcBlend)
-{
- switch (srcBlend)
- {
- case GL_ZERO:
- case GL_ONE:
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_DST_COLOR:
- case GL_ONE_MINUS_DST_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- case GL_DST_ALPHA:
- case GL_ONE_MINUS_DST_ALPHA:
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- case GL_SRC_ALPHA_SATURATE:
- return true;
-
- default:
- return false;
- }
-}
-
-static bool ValidDstBlendFunc(GLenum dstBlend, GLint contextMajorVersion)
-{
- switch (dstBlend)
- {
- 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;
-
- case GL_SRC_ALPHA_SATURATE:
- return (contextMajorVersion >= 3);
-
- default:
- return false;
- }
-}
-
-bool ValidateBlendFuncSeparate(ValidationContext *context,
- GLenum srcRGB,
- GLenum dstRGB,
- GLenum srcAlpha,
- GLenum dstAlpha)
-{
- if (!ValidSrcBlendFunc(srcRGB))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBlendFunction);
- return false;
- }
-
- if (!ValidDstBlendFunc(dstRGB, context->getClientMajorVersion()))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBlendFunction);
- return false;
- }
-
- if (!ValidSrcBlendFunc(srcAlpha))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBlendFunction);
- return false;
- }
-
- if (!ValidDstBlendFunc(dstAlpha, context->getClientMajorVersion()))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBlendFunction);
- 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)
- {
- const char *msg;
- if (context->getExtensions().webglCompatibility)
- {
- msg = kErrorInvalidConstantColor;
- }
- else
- {
- msg =
- "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.";
- ERR() << msg;
- }
- context->handleError(InvalidOperation() << msg);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidName);
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidName);
- return false;
- }
-
- return true;
-}
-
-bool ValidateLineWidth(ValidationContext *context, GLfloat width)
-{
- if (width <= 0.0f || isNaN(width))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidWidth);
- return false;
- }
-
- return true;
-}
-
-bool ValidateVertexAttribPointer(ValidationContext *context,
- GLuint index,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLsizei stride,
- const void *ptr)
-{
- if (!ValidateVertexFormatBase(context, index, size, type, false))
- {
- return false;
- }
-
- if (stride < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeStride);
- return false;
- }
-
- const Caps &caps = context->getCaps();
- if (context->getClientVersion() >= ES_3_1)
- {
- if (stride > caps.maxVertexAttribStride)
- {
- context->handleError(InvalidValue()
- << "stride cannot be greater than MAX_VERTEX_ATTRIB_STRIDE.");
- return false;
- }
-
- if (index >= caps.maxVertexAttribBindings)
- {
- context->handleError(InvalidValue()
- << "index must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
- 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->getGLState().areClientArraysEnabled() &&
- context->getGLState().getVertexArray()->id() == 0;
- if (!nullBufferAllowed && context->getGLState().getTargetBuffer(BufferBinding::Array) == 0 &&
- ptr != nullptr)
- {
- context
- ->handleError(InvalidOperation()
- << "Client data cannot be used with a non-default vertex array object.");
- 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 == GL_FIXED)
- {
- context->handleError(InvalidEnum() << "GL_FIXED is not supported in WebGL.");
- return false;
- }
-
- if (!ValidateWebGLVertexAttribPointer(context, type, normalized, stride, ptr, false))
- {
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateDepthRangef(ValidationContext *context, GLfloat zNear, GLfloat zFar)
-{
- if (context->getExtensions().webglCompatibility && zNear > zFar)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidDepthRange);
- return false;
- }
-
- return true;
-}
-
-bool ValidateRenderbufferStorage(ValidationContext *context,
- GLenum target,
- GLenum internalformat,
- GLsizei width,
- GLsizei height)
-{
- return ValidateRenderbufferStorageParametersBase(context, target, 0, internalformat, width,
- height);
-}
-
-bool ValidateRenderbufferStorageMultisampleANGLE(ValidationContext *context,
- GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height)
-{
- if (!context->getExtensions().framebufferMultisample)
- {
- context->handleError(InvalidOperation()
- << "GL_ANGLE_framebuffer_multisample not available");
- 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_OPERATION is
- // generated.
- if (static_cast<GLuint>(samples) > context->getCaps().maxSamples)
- {
- context->handleError(InvalidValue());
- 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->handleError(OutOfMemory());
- return false;
- }
- }
-
- return ValidateRenderbufferStorageParametersBase(context, target, samples, internalformat,
- width, height);
-}
-
-bool ValidateCheckFramebufferStatus(ValidationContext *context, GLenum target)
-{
- if (!ValidFramebufferTarget(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget);
- return false;
- }
-
- return true;
-}
-
-bool ValidateClearColor(ValidationContext *context,
- GLfloat red,
- GLfloat green,
- GLfloat blue,
- GLfloat alpha)
-{
- return true;
-}
-
-bool ValidateClearDepthf(ValidationContext *context, GLfloat depth)
-{
- return true;
-}
-
-bool ValidateClearStencil(ValidationContext *context, GLint s)
-{
- return true;
-}
-
-bool ValidateColorMask(ValidationContext *context,
- GLboolean red,
- GLboolean green,
- GLboolean blue,
- GLboolean alpha)
-{
- return true;
-}
-
-bool ValidateCompileShader(ValidationContext *context, GLuint shader)
-{
- return true;
-}
-
-bool ValidateCreateProgram(ValidationContext *context)
-{
- return true;
-}
-
-bool ValidateCullFace(ValidationContext *context, CullFaceMode mode)
-{
- switch (mode)
- {
- case CullFaceMode::Front:
- case CullFaceMode::Back:
- case CullFaceMode::FrontAndBack:
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidCullMode);
- return false;
- }
-
- return true;
-}
-
-bool ValidateDeleteProgram(ValidationContext *context, GLuint program)
-{
- if (program == 0)
- {
- return false;
- }
-
- if (!context->getProgram(program))
- {
- if (context->getShader(program))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExpectedProgramName);
- return false;
- }
- else
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProgramName);
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateDeleteShader(ValidationContext *context, GLuint shader)
-{
- if (shader == 0)
- {
- return false;
- }
-
- if (!context->getShader(shader))
- {
- if (context->getProgram(shader))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidShaderName);
- return false;
- }
- else
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), ExpectedShaderName);
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateDepthFunc(ValidationContext *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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- return true;
-}
-
-bool ValidateDepthMask(ValidationContext *context, GLboolean flag)
-{
- return true;
-}
-
-bool ValidateDetachShader(ValidationContext *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 = nullptr;
-
- switch (shaderObject->getType())
- {
- case GL_VERTEX_SHADER:
- {
- attachedShader = programObject->getAttachedVertexShader();
- break;
- }
- case GL_FRAGMENT_SHADER:
- {
- attachedShader = programObject->getAttachedFragmentShader();
- break;
- }
- case GL_COMPUTE_SHADER:
- {
- attachedShader = programObject->getAttachedComputeShader();
- break;
- }
- case GL_GEOMETRY_SHADER_EXT:
- {
- attachedShader = programObject->getAttachedGeometryShader();
- break;
- }
- default:
- UNREACHABLE();
- return false;
- }
-
- if (attachedShader != shaderObject)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ShaderToDetachMustBeAttached);
- return false;
- }
-
- return true;
-}
-
-bool ValidateDisableVertexAttribArray(ValidationContext *context, GLuint index)
-{
- if (index >= MAX_VERTEX_ATTRIBS)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxVertexAttribute);
- return false;
- }
-
- return true;
-}
-
-bool ValidateEnableVertexAttribArray(ValidationContext *context, GLuint index)
-{
- if (index >= MAX_VERTEX_ATTRIBS)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxVertexAttribute);
- return false;
- }
-
- return true;
-}
-
-bool ValidateFinish(ValidationContext *context)
-{
- return true;
-}
-
-bool ValidateFlush(ValidationContext *context)
-{
- return true;
-}
-
-bool ValidateFrontFace(ValidationContext *context, GLenum mode)
-{
- switch (mode)
- {
- case GL_CW:
- case GL_CCW:
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetActiveAttrib(ValidationContext *context,
- GLuint program,
- GLuint index,
- GLsizei bufsize,
- GLsizei *length,
- GLint *size,
- GLenum *type,
- GLchar *name)
-{
- if (bufsize < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
-
- if (!programObject)
- {
- return false;
- }
-
- if (index >= static_cast<GLuint>(programObject->getActiveAttributeCount()))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxActiveUniform);
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetActiveUniform(ValidationContext *context,
- GLuint program,
- GLuint index,
- GLsizei bufsize,
- GLsizei *length,
- GLint *size,
- GLenum *type,
- GLchar *name)
-{
- if (bufsize < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
-
- if (!programObject)
- {
- return false;
- }
-
- if (index >= static_cast<GLuint>(programObject->getActiveUniformCount()))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxActiveUniform);
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetAttachedShaders(ValidationContext *context,
- GLuint program,
- GLsizei maxcount,
- GLsizei *count,
- GLuint *shaders)
-{
- if (maxcount < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeMaxCount);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
-
- if (!programObject)
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetAttribLocation(ValidationContext *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)))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidNameCharacters);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
-
- if (!programObject)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotBound);
- return false;
- }
-
- if (!programObject->isLinked())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetBooleanv(ValidationContext *context, GLenum pname, GLboolean *params)
-{
- GLenum nativeType;
- unsigned int numParams = 0;
- return ValidateStateQuery(context, pname, &nativeType, &numParams);
-}
-
-bool ValidateGetError(ValidationContext *context)
-{
- return true;
-}
-
-bool ValidateGetFloatv(ValidationContext *context, GLenum pname, GLfloat *params)
-{
- GLenum nativeType;
- unsigned int numParams = 0;
- return ValidateStateQuery(context, pname, &nativeType, &numParams);
-}
-
-bool ValidateGetIntegerv(ValidationContext *context, GLenum pname, GLint *params)
-{
- GLenum nativeType;
- unsigned int numParams = 0;
- return ValidateStateQuery(context, pname, &nativeType, &numParams);
-}
-
-bool ValidateGetProgramInfoLog(ValidationContext *context,
- GLuint program,
- GLsizei bufsize,
- GLsizei *length,
- GLchar *infolog)
-{
- if (bufsize < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
- if (!programObject)
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetShaderInfoLog(ValidationContext *context,
- GLuint shader,
- GLsizei bufsize,
- GLsizei *length,
- GLchar *infolog)
-{
- if (bufsize < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- return false;
- }
-
- Shader *shaderObject = GetValidShader(context, shader);
- if (!shaderObject)
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetShaderPrecisionFormat(ValidationContext *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->handleError(InvalidOperation()
- << "compute shader precision not yet implemented.");
- return false;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidShaderType);
- 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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPrecision);
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetShaderSource(ValidationContext *context,
- GLuint shader,
- GLsizei bufsize,
- GLsizei *length,
- GLchar *source)
-{
- if (bufsize < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- return false;
- }
-
- Shader *shaderObject = GetValidShader(context, shader);
- if (!shaderObject)
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetUniformLocation(ValidationContext *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)))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidNameCharacters);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
-
- if (!programObject)
- {
- return false;
- }
-
- if (!programObject->isLinked())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
- return false;
- }
-
- return true;
-}
-
-bool ValidateHint(ValidationContext *context, GLenum target, GLenum mode)
-{
- switch (mode)
- {
- case GL_FASTEST:
- case GL_NICEST:
- case GL_DONT_CARE:
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- 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->handleError(InvalidEnum() << "hint requires OES_standard_derivatives.");
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- return true;
-}
-
-bool ValidateIsBuffer(ValidationContext *context, GLuint buffer)
-{
- return true;
-}
-
-bool ValidateIsFramebuffer(ValidationContext *context, GLuint framebuffer)
-{
- return true;
-}
-
-bool ValidateIsProgram(ValidationContext *context, GLuint program)
-{
- return true;
-}
-
-bool ValidateIsRenderbuffer(ValidationContext *context, GLuint renderbuffer)
-{
- return true;
-}
-
-bool ValidateIsShader(ValidationContext *context, GLuint shader)
-{
- return true;
-}
-
-bool ValidateIsTexture(ValidationContext *context, GLuint texture)
-{
- return true;
-}
-
-bool ValidatePixelStorei(ValidationContext *context, GLenum pname, GLint param)
-{
- if (context->getClientMajorVersion() < 3)
- {
- switch (pname)
- {
- case GL_UNPACK_IMAGE_HEIGHT:
- case GL_UNPACK_SKIP_IMAGES:
- context->handleError(InvalidEnum());
- return false;
-
- case GL_UNPACK_ROW_LENGTH:
- case GL_UNPACK_SKIP_ROWS:
- case GL_UNPACK_SKIP_PIXELS:
- if (!context->getExtensions().unpackSubimage)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- break;
-
- case GL_PACK_ROW_LENGTH:
- case GL_PACK_SKIP_ROWS:
- case GL_PACK_SKIP_PIXELS:
- if (!context->getExtensions().packSubimage)
- {
- context->handleError(InvalidEnum());
- return false;
- }
- break;
- }
- }
-
- if (param < 0)
- {
- context->handleError(InvalidValue() << "Cannot use negative values in PixelStorei");
- return false;
- }
-
- switch (pname)
- {
- case GL_UNPACK_ALIGNMENT:
- if (param != 1 && param != 2 && param != 4 && param != 8)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidUnpackAlignment);
- return false;
- }
- break;
-
- case GL_PACK_ALIGNMENT:
- if (param != 1 && param != 2 && param != 4 && param != 8)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidUnpackAlignment);
- return false;
- }
- break;
-
- case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
- if (!context->getExtensions().packReverseRowOrder)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- }
- 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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- return true;
-}
-
-bool ValidatePolygonOffset(ValidationContext *context, GLfloat factor, GLfloat units)
-{
- return true;
-}
-
-bool ValidateReleaseShaderCompiler(ValidationContext *context)
-{
- return true;
-}
-
-bool ValidateSampleCoverage(ValidationContext *context, GLfloat value, GLboolean invert)
-{
- return true;
-}
-
-bool ValidateScissor(ValidationContext *context, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- if (width < 0 || height < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize);
- return false;
- }
-
- return true;
-}
-
-bool ValidateShaderBinary(ValidationContext *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->handleError(InvalidEnum() << "Invalid shader binary format.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateShaderSource(ValidationContext *context,
- GLuint shader,
- GLsizei count,
- const GLchar *const *string,
- const GLint *length)
-{
- if (count < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeCount);
- 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))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), ShaderSourceInvalidCharacters);
- return false;
- }
- }
- }
-
- Shader *shaderObject = GetValidShader(context, shader);
- if (!shaderObject)
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateStencilFunc(ValidationContext *context, GLenum func, GLint ref, GLuint mask)
-{
- if (!IsValidStencilFunc(func))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidStencil);
- return false;
- }
-
- return true;
-}
-
-bool ValidateStencilFuncSeparate(ValidationContext *context,
- GLenum face,
- GLenum func,
- GLint ref,
- GLuint mask)
-{
- if (!IsValidStencilFace(face))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidStencil);
- return false;
- }
-
- if (!IsValidStencilFunc(func))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidStencil);
- return false;
- }
-
- return true;
-}
-
-bool ValidateStencilMask(ValidationContext *context, GLuint mask)
-{
- return true;
-}
-
-bool ValidateStencilMaskSeparate(ValidationContext *context, GLenum face, GLuint mask)
-{
- if (!IsValidStencilFace(face))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidStencil);
- return false;
- }
-
- return true;
-}
-
-bool ValidateStencilOp(ValidationContext *context, GLenum fail, GLenum zfail, GLenum zpass)
-{
- if (!IsValidStencilOp(fail))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidStencil);
- return false;
- }
-
- if (!IsValidStencilOp(zfail))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidStencil);
- return false;
- }
-
- if (!IsValidStencilOp(zpass))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidStencil);
- return false;
- }
-
- return true;
-}
-
-bool ValidateStencilOpSeparate(ValidationContext *context,
- GLenum face,
- GLenum fail,
- GLenum zfail,
- GLenum zpass)
-{
- if (!IsValidStencilFace(face))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidStencil);
- return false;
- }
-
- return ValidateStencilOp(context, fail, zfail, zpass);
-}
-
-bool ValidateUniform1f(ValidationContext *context, GLint location, GLfloat x)
-{
- return ValidateUniform(context, GL_FLOAT, location, 1);
-}
-
-bool ValidateUniform1fv(ValidationContext *context, GLint location, GLsizei count, const GLfloat *v)
-{
- return ValidateUniform(context, GL_FLOAT, location, count);
-}
-
-bool ValidateUniform1i(ValidationContext *context, GLint location, GLint x)
-{
- return ValidateUniform1iv(context, location, 1, &x);
-}
-
-bool ValidateUniform2f(ValidationContext *context, GLint location, GLfloat x, GLfloat y)
-{
- return ValidateUniform(context, GL_FLOAT_VEC2, location, 1);
-}
-
-bool ValidateUniform2fv(ValidationContext *context, GLint location, GLsizei count, const GLfloat *v)
-{
- return ValidateUniform(context, GL_FLOAT_VEC2, location, count);
-}
-
-bool ValidateUniform2i(ValidationContext *context, GLint location, GLint x, GLint y)
-{
- return ValidateUniform(context, GL_INT_VEC2, location, 1);
-}
-
-bool ValidateUniform2iv(ValidationContext *context, GLint location, GLsizei count, const GLint *v)
-{
- return ValidateUniform(context, GL_INT_VEC2, location, count);
-}
-
-bool ValidateUniform3f(ValidationContext *context, GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
- return ValidateUniform(context, GL_FLOAT_VEC3, location, 1);
-}
-
-bool ValidateUniform3fv(ValidationContext *context, GLint location, GLsizei count, const GLfloat *v)
-{
- return ValidateUniform(context, GL_FLOAT_VEC3, location, count);
-}
-
-bool ValidateUniform3i(ValidationContext *context, GLint location, GLint x, GLint y, GLint z)
-{
- return ValidateUniform(context, GL_INT_VEC3, location, 1);
-}
-
-bool ValidateUniform3iv(ValidationContext *context, GLint location, GLsizei count, const GLint *v)
-{
- return ValidateUniform(context, GL_INT_VEC3, location, count);
-}
-
-bool ValidateUniform4f(ValidationContext *context,
- GLint location,
- GLfloat x,
- GLfloat y,
- GLfloat z,
- GLfloat w)
-{
- return ValidateUniform(context, GL_FLOAT_VEC4, location, 1);
-}
-
-bool ValidateUniform4fv(ValidationContext *context, GLint location, GLsizei count, const GLfloat *v)
-{
- return ValidateUniform(context, GL_FLOAT_VEC4, location, count);
-}
-
-bool ValidateUniform4i(ValidationContext *context,
- GLint location,
- GLint x,
- GLint y,
- GLint z,
- GLint w)
-{
- return ValidateUniform(context, GL_INT_VEC4, location, 1);
-}
-
-bool ValidateUniform4iv(ValidationContext *context, GLint location, GLsizei count, const GLint *v)
-{
- return ValidateUniform(context, GL_INT_VEC4, location, count);
-}
-
-bool ValidateUniformMatrix2fv(ValidationContext *context,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- return ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose);
-}
-
-bool ValidateUniformMatrix3fv(ValidationContext *context,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- return ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose);
-}
-
-bool ValidateUniformMatrix4fv(ValidationContext *context,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- return ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose);
-}
-
-bool ValidateValidateProgram(ValidationContext *context, GLuint program)
-{
- Program *programObject = GetValidProgram(context, program);
-
- if (!programObject)
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateVertexAttrib1f(ValidationContext *context, GLuint index, GLfloat x)
-{
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateVertexAttrib1fv(ValidationContext *context, GLuint index, const GLfloat *values)
-{
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateVertexAttrib2f(ValidationContext *context, GLuint index, GLfloat x, GLfloat y)
-{
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateVertexAttrib2fv(ValidationContext *context, GLuint index, const GLfloat *values)
-{
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateVertexAttrib3f(ValidationContext *context,
- GLuint index,
- GLfloat x,
- GLfloat y,
- GLfloat z)
-{
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateVertexAttrib3fv(ValidationContext *context, GLuint index, const GLfloat *values)
-{
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateVertexAttrib4f(ValidationContext *context,
- GLuint index,
- GLfloat x,
- GLfloat y,
- GLfloat z,
- GLfloat w)
-{
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateVertexAttrib4fv(ValidationContext *context, GLuint index, const GLfloat *values)
-{
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateViewport(ValidationContext *context, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- if (width < 0 || height < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), ViewportNegativeSize);
- return false;
- }
-
- return true;
-}
-
-bool ValidateDrawArrays(ValidationContext *context, GLenum mode, GLint first, GLsizei count)
-{
- return ValidateDrawArraysCommon(context, mode, first, count, 1);
-}
-
-bool ValidateDrawElements(ValidationContext *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices)
-{
- return ValidateDrawElementsCommon(context, mode, count, type, indices, 1);
-}
-
-bool ValidateGetFramebufferAttachmentParameteriv(ValidationContext *context,
- GLenum target,
- GLenum attachment,
- GLenum pname,
- GLint *params)
-{
- return ValidateGetFramebufferAttachmentParameterivBase(context, target, attachment, pname,
- nullptr);
-}
-
-bool ValidateGetProgramiv(ValidationContext *context, GLuint program, GLenum pname, GLint *params)
-{
- return ValidateGetProgramivBase(context, program, pname, nullptr);
-}
-
-bool ValidateCopyTexImage2D(ValidationContext *context,
- GLenum 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,
- GLenum 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 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))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- return true;
-}
-
-bool ValidateEnable(Context *context, GLenum cap)
-{
- if (!ValidCap(context, cap, false))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- if (context->getLimitations().noSampleAlphaToCoverageSupport &&
- cap == GL_SAMPLE_ALPHA_TO_COVERAGE)
- {
- const char *errorMessage = "Current renderer doesn't support alpha-to-coverage";
- context->handleError(InvalidOperation() << errorMessage);
-
- // We also output an error message to the debugger window if tracing is active, so that
- // developers can see the error message.
- ERR() << errorMessage;
- return false;
- }
-
- return true;
-}
-
-bool ValidateFramebufferRenderbuffer(Context *context,
- GLenum target,
- GLenum attachment,
- GLenum renderbuffertarget,
- GLuint renderbuffer)
-{
- if (!ValidFramebufferTarget(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget);
- return false;
- }
-
- if (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidRenderbufferTarget);
- return false;
- }
-
- return ValidateFramebufferRenderbufferParameters(context, target, attachment,
- renderbuffertarget, renderbuffer);
-}
-
-bool ValidateFramebufferTexture2D(Context *context,
- GLenum target,
- GLenum attachment,
- GLenum textarget,
- GLuint texture,
- GLint level)
-{
- // Attachments are required to be bound to level 0 without ES3 or the GL_OES_fbo_render_mipmap
- // extension
- if (context->getClientMajorVersion() < 3 && !context->getExtensions().fboRenderMipmap &&
- level != 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidFramebufferTextureLevel);
- 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 GL_TEXTURE_2D:
- {
- if (level > gl::log2(caps.max2DTextureSize))
- {
- context->handleError(InvalidValue());
- return false;
- }
- if (tex->getTarget() != GL_TEXTURE_2D)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidTextureTarget);
- return false;
- }
- }
- break;
-
- case GL_TEXTURE_RECTANGLE_ANGLE:
- {
- if (level != 0)
- {
- context->handleError(InvalidValue());
- return false;
- }
- if (tex->getTarget() != GL_TEXTURE_RECTANGLE_ANGLE)
- {
- context->handleError(InvalidOperation()
- << "Textarget must match the texture target type.");
- return false;
- }
- }
- break;
-
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- {
- if (level > gl::log2(caps.maxCubeMapTextureSize))
- {
- context->handleError(InvalidValue());
- return false;
- }
- if (tex->getTarget() != GL_TEXTURE_CUBE_MAP)
- {
- context->handleError(InvalidOperation()
- << "Textarget must match the texture target type.");
- return false;
- }
- }
- break;
-
- case GL_TEXTURE_2D_MULTISAMPLE:
- {
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- if (level != 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), LevelNotZero);
- return false;
- }
- if (tex->getTarget() != GL_TEXTURE_2D_MULTISAMPLE)
- {
- context->handleError(InvalidOperation()
- << "Textarget must match the texture target type.");
- return false;
- }
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
- return false;
- }
-
- const Format &format = tex->getFormat(textarget, level);
- if (format.info->compressed)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- }
-
- return true;
-}
-
-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, GLenum target)
-{
- if (!ValidTextureTarget(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
- return false;
- }
-
- Texture *texture = context->getTargetTexture(target);
-
- if (texture == nullptr)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), TextureNotBound);
- 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->handleError(InvalidOperation());
- return false;
- }
-
- GLenum baseTarget = (target == GL_TEXTURE_CUBE_MAP) ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : target;
- const auto &format = *(texture->getFormat(baseTarget, effectiveBaseLevel).info);
- if (format.sizedInternalFormat == GL_NONE || format.compressed || format.depthBits > 0 ||
- format.stencilBits > 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), GenerateMipmapNotAllowed);
- 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.renderSupport(context->getClientVersion(), context->getExtensions());
- if (!formatUnsized && !formatColorRenderableAndFilterable)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), GenerateMipmapNotAllowed);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), GenerateMipmapNotAllowed);
- return false;
- }
-
- // ES3 and WebGL grant mipmap generation for sRGBA (with alpha) textures but GL_EXT_sRGB does
- // not.
- bool supportsSRGBMipmapGeneration =
- context->getClientVersion() >= ES_3_0 || context->getExtensions().webglCompatibility;
- if (!supportsSRGBMipmapGeneration && format.colorEncoding == GL_SRGB)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), GenerateMipmapNotAllowed);
- 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 == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ANGLE ||
- target == GL_TEXTURE_CUBE_MAP);
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), TextureNotPow2);
- return false;
- }
-
- // Cube completeness check
- if (target == GL_TEXTURE_CUBE_MAP && !texture->getTextureState().isCubeComplete())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), CubemapIncomplete);
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetBufferParameteriv(ValidationContext *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, GLenum target, GLenum pname, GLfloat *params)
-{
- return ValidateGetTexParameterBase(context, target, pname, nullptr);
-}
-
-bool ValidateGetTexParameteriv(Context *context, GLenum target, GLenum pname, GLint *params)
-{
- 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))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
- return false;
- }
-
- return true;
-}
-
-bool ValidateLinkProgram(Context *context, GLuint program)
-{
- if (context->hasActiveTransformFeedback(program))
- {
- // ES 3.0.4 section 2.15 page 91
- context->handleError(InvalidOperation() << "Cannot link program while program is "
- "associated with an active transform "
- "feedback object.");
- 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, GLenum target, GLenum pname, GLfloat param)
-{
- return ValidateTexParameterBase(context, target, pname, -1, &param);
-}
-
-bool ValidateTexParameterfv(Context *context, GLenum target, GLenum pname, const GLfloat *params)
-{
- return ValidateTexParameterBase(context, target, pname, -1, params);
-}
-
-bool ValidateTexParameteri(Context *context, GLenum target, GLenum pname, GLint param)
-{
- return ValidateTexParameterBase(context, target, pname, -1, &param);
-}
-
-bool ValidateTexParameteriv(Context *context, GLenum target, GLenum pname, const GLint *params)
-{
- return ValidateTexParameterBase(context, target, pname, -1, params);
-}
-
-bool ValidateUseProgram(Context *context, GLuint program)
-{
- if (program != 0)
- {
- Program *programObject = context->getProgram(program);
- if (!programObject)
- {
- // ES 3.1.0 section 7.3 page 72
- if (context->getShader(program))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExpectedProgramName);
- return false;
- }
- else
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProgramName);
- return false;
- }
- }
- if (!programObject->isLinked())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
- return false;
- }
- }
- if (context->getGLState().isTransformFeedbackActiveUnpaused())
- {
- // ES 3.0.4 section 2.15 page 91
- context
- ->handleError(InvalidOperation()
- << "Cannot change active program while transform feedback is unpaused.");
- return false;
- }
-
- return true;
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/validationES2.h b/src/3rdparty/angle/src/libANGLE/validationES2.h
deleted file mode 100644
index 5dc09176a1..0000000000
--- a/src/3rdparty/angle/src/libANGLE/validationES2.h
+++ /dev/null
@@ -1,687 +0,0 @@
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// validationES2.h: Validation functions for OpenGL ES 2.0 entry point parameters
-
-#ifndef LIBANGLE_VALIDATION_ES2_H_
-#define LIBANGLE_VALIDATION_ES2_H_
-
-#include "libANGLE/PackedGLEnums.h"
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-namespace gl
-{
-class Context;
-class ValidationContext;
-
-bool ValidateES2TexStorageParameters(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height);
-
-bool ValidateDiscardFramebufferEXT(Context *context,
- GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments);
-
-bool ValidateDrawBuffersEXT(ValidationContext *context, GLsizei n, const GLenum *bufs);
-
-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);
-
-bool ValidateProgramBinaryOES(Context *context,
- GLuint program,
- GLenum binaryFormat,
- const void *binary,
- GLint length);
-bool ValidateGetProgramBinaryOES(Context *context,
- GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- GLenum *binaryFormat,
- void *binary);
-
-// GL_KHR_debug
-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 ValidateDebugMessageCallbackKHR(Context *context,
- GLDEBUGPROCKHR callback,
- const void *userParam);
-bool ValidateGetDebugMessageLogKHR(Context *context,
- GLuint count,
- GLsizei bufSize,
- GLenum *sources,
- GLenum *types,
- GLuint *ids,
- GLenum *severities,
- GLsizei *lengths,
- GLchar *messageLog);
-bool ValidatePushDebugGroupKHR(Context *context,
- GLenum source,
- GLuint id,
- GLsizei length,
- const GLchar *message);
-bool ValidatePopDebugGroupKHR(Context *context);
-bool ValidateObjectLabelKHR(Context *context,
- GLenum identifier,
- GLuint name,
- GLsizei length,
- const GLchar *label);
-bool ValidateGetObjectLabelKHR(Context *context,
- GLenum identifier,
- GLuint name,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *label);
-bool ValidateObjectPtrLabelKHR(Context *context,
- const void *ptr,
- GLsizei length,
- const GLchar *label);
-bool ValidateGetObjectPtrLabelKHR(Context *context,
- const void *ptr,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *label);
-bool ValidateGetPointervKHR(Context *context, GLenum pname, void **params);
-bool ValidateBlitFramebufferANGLE(Context *context,
- GLint srcX0,
- GLint srcY0,
- GLint srcX1,
- GLint srcY1,
- GLint dstX0,
- GLint dstY0,
- GLint dstX1,
- GLint dstY1,
- GLbitfield mask,
- GLenum filter);
-
-bool ValidateClear(ValidationContext *context, GLbitfield mask);
-bool ValidateTexImage2D(Context *context,
- GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels);
-bool ValidateTexImage2DRobust(Context *context,
- GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLenum format,
- GLenum type,
- GLsizei bufSize,
- const void *pixels);
-bool ValidateTexSubImage2D(Context *context,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- const void *pixels);
-bool ValidateTexSubImage2DRobustANGLE(Context *context,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- GLsizei bufSize,
- const void *pixels);
-bool ValidateCompressedTexImage2D(Context *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLsizei imageSize,
- const void *data);
-bool ValidateCompressedTexSubImage2D(Context *context,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLsizei imageSize,
- const void *data);
-bool ValidateCompressedTexImage2DRobustANGLE(Context *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLsizei imageSize,
- GLsizei dataSize,
- const void *data);
-bool ValidateCompressedTexSubImage2DRobustANGLE(Context *context,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLsizei imageSize,
- GLsizei dataSize,
- const void *data);
-
-bool ValidateBindTexture(Context *context, GLenum target, GLuint texture);
-
-bool ValidateGetBufferPointervOES(Context *context,
- BufferBinding target,
- GLenum pname,
- void **params);
-bool ValidateMapBufferOES(Context *context, BufferBinding target, GLenum access);
-bool ValidateUnmapBufferOES(Context *context, BufferBinding target);
-bool ValidateMapBufferRangeEXT(Context *context,
- BufferBinding target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access);
-bool ValidateMapBufferBase(Context *context, BufferBinding target);
-bool ValidateFlushMappedBufferRangeEXT(Context *context,
- BufferBinding target,
- GLintptr offset,
- GLsizeiptr length);
-
-bool ValidateBindUniformLocationCHROMIUM(Context *context,
- GLuint program,
- GLint location,
- const GLchar *name);
-
-bool ValidateCoverageModulationCHROMIUM(Context *context, GLenum components);
-
-// CHROMIUM_path_rendering
-bool ValidateMatrix(Context *context, GLenum matrixMode, const GLfloat *matrix);
-bool ValidateMatrixMode(Context *context, GLenum matrixMode);
-bool ValidateGenPaths(Context *context, GLsizei range);
-bool ValidateDeletePaths(Context *context, GLuint first, GLsizei range);
-bool ValidatePathCommands(Context *context,
- GLuint path,
- GLsizei numCommands,
- const GLubyte *commands,
- GLsizei numCoords,
- GLenum coordType,
- const void *coords);
-bool ValidateSetPathParameter(Context *context, GLuint path, GLenum pname, GLfloat value);
-bool ValidateGetPathParameter(Context *context, GLuint path, GLenum pname, GLfloat *value);
-bool ValidatePathStencilFunc(Context *context, GLenum func, GLint ref, GLuint mask);
-bool ValidateStencilFillPath(Context *context, GLuint path, GLenum fillMode, GLuint mask);
-bool ValidateStencilStrokePath(Context *context, GLuint path, GLint reference, GLuint mask);
-bool ValidateCoverPath(Context *context, GLuint path, GLenum coverMode);
-bool ValidateStencilThenCoverFillPath(Context *context,
- GLuint path,
- GLenum fillMode,
- GLuint mask,
- GLenum coverMode);
-bool ValidateStencilThenCoverStrokePath(Context *context,
- GLuint path,
- GLint reference,
- GLuint mask,
- GLenum coverMode);
-bool ValidateIsPath(Context *context);
-bool ValidateCoverFillPathInstanced(Context *context,
- GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues);
-bool ValidateCoverStrokePathInstanced(Context *context,
- GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues);
-bool ValidateStencilFillPathInstanced(Context *context,
- GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBAse,
- GLenum fillMode,
- GLuint mask,
- GLenum transformType,
- const GLfloat *transformValues);
-bool ValidateStencilStrokePathInstanced(Context *context,
- GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLint reference,
- GLuint mask,
- GLenum transformType,
- const GLfloat *transformValues);
-bool ValidateStencilThenCoverFillPathInstanced(Context *context,
- GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum fillMode,
- GLuint mask,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues);
-bool ValidateStencilThenCoverStrokePathInstanced(Context *context,
- GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLint reference,
- GLuint mask,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues);
-bool ValidateBindFragmentInputLocation(Context *context,
- GLuint program,
- GLint location,
- const GLchar *name);
-bool ValidateProgramPathFragmentInputGen(Context *context,
- GLuint program,
- GLint location,
- GLenum genMode,
- GLint components,
- const GLfloat *coeffs);
-
-bool ValidateCopyTextureCHROMIUM(Context *context,
- GLuint sourceId,
- GLint sourceLevel,
- GLenum destTarget,
- GLuint destId,
- GLint destLevel,
- GLint internalFormat,
- GLenum destType,
- GLboolean unpackFlipY,
- GLboolean unpackPremultiplyAlpha,
- GLboolean unpackUnmultiplyAlpha);
-bool ValidateCopySubTextureCHROMIUM(Context *context,
- 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);
-bool ValidateCompressedCopyTextureCHROMIUM(Context *context, GLuint sourceId, GLuint destId);
-
-bool ValidateCreateShader(Context *context, GLenum type);
-bool ValidateBufferData(ValidationContext *context,
- BufferBinding target,
- GLsizeiptr size,
- const void *data,
- BufferUsage usage);
-bool ValidateBufferSubData(ValidationContext *context,
- BufferBinding target,
- GLintptr offset,
- GLsizeiptr size,
- const void *data);
-
-bool ValidateRequestExtensionANGLE(Context *context, const GLchar *name);
-
-bool ValidateActiveTexture(ValidationContext *context, GLenum texture);
-bool ValidateAttachShader(ValidationContext *context, GLuint program, GLuint shader);
-bool ValidateBindAttribLocation(ValidationContext *context,
- GLuint program,
- GLuint index,
- const GLchar *name);
-bool ValidateBindBuffer(ValidationContext *context, BufferBinding target, GLuint buffer);
-bool ValidateBindFramebuffer(ValidationContext *context, GLenum target, GLuint framebuffer);
-bool ValidateBindRenderbuffer(ValidationContext *context, GLenum target, GLuint renderbuffer);
-bool ValidateBlendColor(ValidationContext *context,
- GLclampf red,
- GLclampf green,
- GLclampf blue,
- GLclampf alpha);
-bool ValidateBlendEquation(ValidationContext *context, GLenum mode);
-bool ValidateBlendEquationSeparate(ValidationContext *context, GLenum modeRGB, GLenum modeAlpha);
-bool ValidateBlendFunc(ValidationContext *context, GLenum sfactor, GLenum dfactor);
-bool ValidateBlendFuncSeparate(ValidationContext *context,
- GLenum srcRGB,
- GLenum dstRGB,
- GLenum srcAlpha,
- GLenum dstAlpha);
-
-bool ValidateGetString(Context *context, GLenum name);
-bool ValidateLineWidth(ValidationContext *context, GLfloat width);
-bool ValidateVertexAttribPointer(ValidationContext *context,
- GLuint index,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLsizei stride,
- const void *ptr);
-
-bool ValidateDepthRangef(ValidationContext *context, GLclampf zNear, GLclampf zFar);
-bool ValidateRenderbufferStorage(ValidationContext *context,
- GLenum target,
- GLenum internalformat,
- GLsizei width,
- GLsizei height);
-bool ValidateRenderbufferStorageMultisampleANGLE(ValidationContext *context,
- GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height);
-
-bool ValidateCheckFramebufferStatus(ValidationContext *context, GLenum target);
-bool ValidateClearColor(ValidationContext *context,
- GLclampf red,
- GLclampf green,
- GLclampf blue,
- GLclampf alpha);
-bool ValidateClearDepthf(ValidationContext *context, GLclampf depth);
-bool ValidateClearStencil(ValidationContext *context, GLint s);
-bool ValidateColorMask(ValidationContext *context,
- GLboolean red,
- GLboolean green,
- GLboolean blue,
- GLboolean alpha);
-bool ValidateCompileShader(ValidationContext *context, GLuint shader);
-bool ValidateCreateProgram(ValidationContext *context);
-bool ValidateCullFace(ValidationContext *context, CullFaceMode mode);
-bool ValidateDeleteProgram(ValidationContext *context, GLuint program);
-bool ValidateDeleteShader(ValidationContext *context, GLuint shader);
-bool ValidateDepthFunc(ValidationContext *context, GLenum func);
-bool ValidateDepthMask(ValidationContext *context, GLboolean flag);
-bool ValidateDetachShader(ValidationContext *context, GLuint program, GLuint shader);
-bool ValidateDisableVertexAttribArray(ValidationContext *context, GLuint index);
-bool ValidateEnableVertexAttribArray(ValidationContext *context, GLuint index);
-bool ValidateFinish(ValidationContext *context);
-bool ValidateFlush(ValidationContext *context);
-bool ValidateFrontFace(ValidationContext *context, GLenum mode);
-bool ValidateGetActiveAttrib(ValidationContext *context,
- GLuint program,
- GLuint index,
- GLsizei bufsize,
- GLsizei *length,
- GLint *size,
- GLenum *type,
- GLchar *name);
-bool ValidateGetActiveUniform(ValidationContext *context,
- GLuint program,
- GLuint index,
- GLsizei bufsize,
- GLsizei *length,
- GLint *size,
- GLenum *type,
- GLchar *name);
-bool ValidateGetAttachedShaders(ValidationContext *context,
- GLuint program,
- GLsizei maxcount,
- GLsizei *count,
- GLuint *shaders);
-bool ValidateGetAttribLocation(ValidationContext *context, GLuint program, const GLchar *name);
-bool ValidateGetBooleanv(ValidationContext *context, GLenum pname, GLboolean *params);
-bool ValidateGetError(ValidationContext *context);
-bool ValidateGetFloatv(ValidationContext *context, GLenum pname, GLfloat *params);
-bool ValidateGetIntegerv(ValidationContext *context, GLenum pname, GLint *params);
-bool ValidateGetProgramInfoLog(ValidationContext *context,
- GLuint program,
- GLsizei bufsize,
- GLsizei *length,
- GLchar *infolog);
-bool ValidateGetShaderInfoLog(ValidationContext *context,
- GLuint shader,
- GLsizei bufsize,
- GLsizei *length,
- GLchar *infolog);
-bool ValidateGetShaderPrecisionFormat(ValidationContext *context,
- GLenum shadertype,
- GLenum precisiontype,
- GLint *range,
- GLint *precision);
-bool ValidateGetShaderSource(ValidationContext *context,
- GLuint shader,
- GLsizei bufsize,
- GLsizei *length,
- GLchar *source);
-bool ValidateGetUniformLocation(ValidationContext *context, GLuint program, const GLchar *name);
-bool ValidateHint(ValidationContext *context, GLenum target, GLenum mode);
-bool ValidateIsBuffer(ValidationContext *context, GLuint buffer);
-bool ValidateIsFramebuffer(ValidationContext *context, GLuint framebuffer);
-bool ValidateIsProgram(ValidationContext *context, GLuint program);
-bool ValidateIsRenderbuffer(ValidationContext *context, GLuint renderbuffer);
-bool ValidateIsShader(ValidationContext *context, GLuint shader);
-bool ValidateIsTexture(ValidationContext *context, GLuint texture);
-bool ValidatePixelStorei(ValidationContext *context, GLenum pname, GLint param);
-bool ValidatePolygonOffset(ValidationContext *context, GLfloat factor, GLfloat units);
-bool ValidateReleaseShaderCompiler(ValidationContext *context);
-bool ValidateSampleCoverage(ValidationContext *context, GLclampf value, GLboolean invert);
-bool ValidateScissor(ValidationContext *context, GLint x, GLint y, GLsizei width, GLsizei height);
-bool ValidateShaderBinary(ValidationContext *context,
- GLsizei n,
- const GLuint *shaders,
- GLenum binaryformat,
- const void *binary,
- GLsizei length);
-bool ValidateShaderSource(ValidationContext *context,
- GLuint shader,
- GLsizei count,
- const GLchar *const *string,
- const GLint *length);
-bool ValidateStencilFunc(ValidationContext *context, GLenum func, GLint ref, GLuint mask);
-bool ValidateStencilFuncSeparate(ValidationContext *context,
- GLenum face,
- GLenum func,
- GLint ref,
- GLuint mask);
-bool ValidateStencilMask(ValidationContext *context, GLuint mask);
-bool ValidateStencilMaskSeparate(ValidationContext *context, GLenum face, GLuint mask);
-bool ValidateStencilOp(ValidationContext *context, GLenum fail, GLenum zfail, GLenum zpass);
-bool ValidateStencilOpSeparate(ValidationContext *context,
- GLenum face,
- GLenum fail,
- GLenum zfail,
- GLenum zpass);
-bool ValidateUniform1f(ValidationContext *context, GLint location, GLfloat x);
-bool ValidateUniform1fv(ValidationContext *context,
- GLint location,
- GLsizei count,
- const GLfloat *v);
-bool ValidateUniform1i(ValidationContext *context, GLint location, GLint x);
-bool ValidateUniform2f(ValidationContext *context, GLint location, GLfloat x, GLfloat y);
-bool ValidateUniform2fv(ValidationContext *context,
- GLint location,
- GLsizei count,
- const GLfloat *v);
-bool ValidateUniform2i(ValidationContext *context, GLint location, GLint x, GLint y);
-bool ValidateUniform2iv(ValidationContext *context, GLint location, GLsizei count, const GLint *v);
-bool ValidateUniform3f(ValidationContext *context, GLint location, GLfloat x, GLfloat y, GLfloat z);
-bool ValidateUniform3fv(ValidationContext *context,
- GLint location,
- GLsizei count,
- const GLfloat *v);
-bool ValidateUniform3i(ValidationContext *context, GLint location, GLint x, GLint y, GLint z);
-bool ValidateUniform3iv(ValidationContext *context, GLint location, GLsizei count, const GLint *v);
-bool ValidateUniform4f(ValidationContext *context,
- GLint location,
- GLfloat x,
- GLfloat y,
- GLfloat z,
- GLfloat w);
-bool ValidateUniform4fv(ValidationContext *context,
- GLint location,
- GLsizei count,
- const GLfloat *v);
-bool ValidateUniform4i(ValidationContext *context,
- GLint location,
- GLint x,
- GLint y,
- GLint z,
- GLint w);
-bool ValidateUniform4iv(ValidationContext *context, GLint location, GLsizei count, const GLint *v);
-bool ValidateUniformMatrix2fv(ValidationContext *context,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-bool ValidateUniformMatrix3fv(ValidationContext *context,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-bool ValidateUniformMatrix4fv(ValidationContext *context,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-bool ValidateValidateProgram(ValidationContext *context, GLuint program);
-bool ValidateVertexAttrib1f(ValidationContext *context, GLuint index, GLfloat x);
-bool ValidateVertexAttrib1fv(ValidationContext *context, GLuint index, const GLfloat *values);
-bool ValidateVertexAttrib2f(ValidationContext *context, GLuint index, GLfloat x, GLfloat y);
-bool ValidateVertexAttrib2fv(ValidationContext *context, GLuint index, const GLfloat *values);
-bool ValidateVertexAttrib3f(ValidationContext *context,
- GLuint index,
- GLfloat x,
- GLfloat y,
- GLfloat z);
-bool ValidateVertexAttrib3fv(ValidationContext *context, GLuint index, const GLfloat *values);
-bool ValidateVertexAttrib4f(ValidationContext *context,
- GLuint index,
- GLfloat x,
- GLfloat y,
- GLfloat z,
- GLfloat w);
-bool ValidateVertexAttrib4fv(ValidationContext *context, GLuint index, const GLfloat *values);
-bool ValidateViewport(ValidationContext *context, GLint x, GLint y, GLsizei width, GLsizei height);
-bool ValidateDrawElements(ValidationContext *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices);
-
-bool ValidateDrawArrays(ValidationContext *context, GLenum mode, GLint first, GLsizei count);
-
-bool ValidateGetFramebufferAttachmentParameteriv(ValidationContext *context,
- GLenum target,
- GLenum attachment,
- GLenum pname,
- GLint *params);
-bool ValidateGetProgramiv(ValidationContext *context, GLuint program, GLenum pname, GLint *params);
-
-bool ValidateCopyTexImage2D(ValidationContext *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border);
-
-bool ValidateCopyTexSubImage2D(Context *context,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height);
-
-bool ValidateDeleteBuffers(Context *context, GLint n, const GLuint *buffers);
-bool ValidateDeleteFramebuffers(Context *context, GLint n, const GLuint *framebuffers);
-bool ValidateDeleteRenderbuffers(Context *context, GLint n, const GLuint *renderbuffers);
-bool ValidateDeleteTextures(Context *context, GLint n, const GLuint *textures);
-bool ValidateDisable(Context *context, GLenum cap);
-bool ValidateEnable(Context *context, GLenum cap);
-bool ValidateFramebufferRenderbuffer(Context *context,
- GLenum target,
- GLenum attachment,
- GLenum renderbuffertarget,
- GLuint renderbuffer);
-bool ValidateFramebufferTexture2D(Context *context,
- GLenum target,
- GLenum attachment,
- GLenum textarget,
- GLuint texture,
- GLint level);
-bool ValidateGenBuffers(Context *context, GLint n, GLuint *buffers);
-bool ValidateGenerateMipmap(Context *context, GLenum target);
-bool ValidateGenFramebuffers(Context *context, GLint n, GLuint *framebuffers);
-bool ValidateGenRenderbuffers(Context *context, GLint n, GLuint *renderbuffers);
-bool ValidateGenTextures(Context *context, GLint n, GLuint *textures);
-bool ValidateGetBufferParameteriv(ValidationContext *context,
- BufferBinding target,
- GLenum pname,
- GLint *params);
-bool ValidateGetRenderbufferParameteriv(Context *context,
- GLenum target,
- GLenum pname,
- GLint *params);
-bool ValidateGetShaderiv(Context *context, GLuint shader, GLenum pname, GLint *params);
-bool ValidateGetTexParameterfv(Context *context, GLenum target, GLenum pname, GLfloat *params);
-bool ValidateGetTexParameteriv(Context *context, GLenum target, GLenum pname, GLint *params);
-bool ValidateGetUniformfv(Context *context, GLuint program, GLint location, GLfloat *params);
-bool ValidateGetUniformiv(Context *context, GLuint program, GLint location, GLint *params);
-bool ValidateGetVertexAttribfv(Context *context, GLuint index, GLenum pname, GLfloat *params);
-bool ValidateGetVertexAttribiv(Context *context, GLuint index, GLenum pname, GLint *params);
-bool ValidateGetVertexAttribPointerv(Context *context, GLuint index, GLenum pname, void **pointer);
-bool ValidateIsEnabled(Context *context, GLenum cap);
-bool ValidateLinkProgram(Context *context, GLuint program);
-bool ValidateReadPixels(Context *context,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- void *pixels);
-bool ValidateTexParameterf(Context *context, GLenum target, GLenum pname, GLfloat param);
-bool ValidateTexParameterfv(Context *context, GLenum target, GLenum pname, const GLfloat *params);
-bool ValidateTexParameteri(Context *context, GLenum target, GLenum pname, GLint param);
-bool ValidateTexParameteriv(Context *context, GLenum target, GLenum pname, const GLint *params);
-bool ValidateUniform1iv(ValidationContext *context,
- GLint location,
- GLsizei count,
- const GLint *value);
-bool ValidateUseProgram(Context *context, GLuint program);
-
-} // namespace gl
-
-#endif // LIBANGLE_VALIDATION_ES2_H_
diff --git a/src/3rdparty/angle/src/libANGLE/validationES3.cpp b/src/3rdparty/angle/src/libANGLE/validationES3.cpp
deleted file mode 100644
index 1aadfc876e..0000000000
--- a/src/3rdparty/angle/src/libANGLE/validationES3.cpp
+++ /dev/null
@@ -1,3702 +0,0 @@
-//
-// 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.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/formatutils.h"
-#include "libANGLE/validationES.h"
-
-using namespace angle;
-
-namespace gl
-{
-
-namespace
-{
-bool ValidateFramebufferTextureMultiviewBaseANGLE(Context *context,
- GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLsizei numViews)
-{
- if (!context->getExtensions().multiview)
- {
- context->handleError(InvalidOperation() << "ANGLE_multiview is not available.");
- return false;
- }
-
- if (!ValidateFramebufferTextureBase(context, target, attachment, texture, level))
- {
- return false;
- }
-
- if (texture != 0 && numViews < 1)
- {
- context->handleError(InvalidValue() << "numViews cannot be less than 1.");
- return false;
- }
-
- const Extensions &extensions = context->getExtensions();
- if (static_cast<GLuint>(numViews) > extensions.maxViews)
- {
- context->handleError(InvalidValue()
- << "numViews cannot be greater than GL_MAX_VIEWS_ANGLE.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateFramebufferTextureMultiviewLevelAndFormat(Context *context,
- Texture *texture,
- GLint level)
-{
- GLenum texTarget = texture->getTarget();
- if (!ValidMipLevel(context, texTarget, level))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel);
- return false;
- }
-
- const auto &format = texture->getFormat(texTarget, level);
- if (format.info->compressed)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), CompressedTexturesNotAttachable);
- return false;
- }
- return true;
-}
-
-bool ValidateUniformES3(Context *context, GLenum uniformType, GLint location, GLint count)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateUniformMatrix(context, valueType, location, count, transpose);
-}
-
-bool ValidateGenOrDeleteES3(Context *context, GLint n)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
- return ValidateGenOrDelete(context, n);
-}
-
-bool ValidateGenOrDeleteCountES3(Context *context, GLint count)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
- if (count < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeCount);
- return false;
- }
- return true;
-}
-
-} // anonymous namespace
-
-static bool ValidateTexImageFormatCombination(gl::Context *context,
- GLenum 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))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFormat);
- return false;
- }
-
- if (!ValidES3Type(type))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidType);
- 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))
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidInternalFormat);
- 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 == GL_TEXTURE_3D && (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL))
- {
- context->handleError(InvalidOperation() << "Format cannot be GL_DEPTH_COMPONENT or "
- "GL_DEPTH_STENCIL if target is "
- "GL_TEXTURE_3D");
- return false;
- }
-
- // Check if this is a valid format combination to load texture data
- if (!ValidES3FormatCombination(format, type, internalFormat))
- {
- context->handleError(InvalidOperation()
- << "Invalid combination of format, type and internalFormat.");
- return false;
- }
-
- const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat, type);
- if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
- {
- context->handleError(InvalidOperation() << "Unsupported internal format.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateES3TexImageParametersBase(Context *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isCompressed,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- GLsizei imageSize,
- const void *pixels)
-{
- // Validate image size
- if (!ValidImageSizeParameters(context, target, level, width, height, depth, isSubImage))
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- // Verify zero border
- if (border != 0)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (xoffset < 0 || yoffset < 0 || zoffset < 0 ||
- std::numeric_limits<GLsizei>::max() - xoffset < width ||
- std::numeric_limits<GLsizei>::max() - yoffset < height ||
- std::numeric_limits<GLsizei>::max() - zoffset < depth)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- const gl::Caps &caps = context->getCaps();
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- if (static_cast<GLuint>(width) > (caps.max2DTextureSize >> level) ||
- static_cast<GLuint>(height) > (caps.max2DTextureSize >> level))
- {
- context->handleError(InvalidValue());
- return false;
- }
- break;
-
- case GL_TEXTURE_RECTANGLE_ANGLE:
- ASSERT(level == 0);
- if (static_cast<GLuint>(width) > caps.maxRectangleTextureSize ||
- static_cast<GLuint>(height) > caps.maxRectangleTextureSize)
- {
- context->handleError(InvalidValue());
- return false;
- }
- if (isCompressed)
- {
- context->handleError(InvalidEnum()
- << "Rectangle texture cannot have a compressed format.");
- return false;
- }
- break;
-
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- if (!isSubImage && width != height)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (static_cast<GLuint>(width) > (caps.maxCubeMapTextureSize >> level))
- {
- context->handleError(InvalidValue());
- return false;
- }
- break;
-
- case GL_TEXTURE_3D:
- if (static_cast<GLuint>(width) > (caps.max3DTextureSize >> level) ||
- static_cast<GLuint>(height) > (caps.max3DTextureSize >> level) ||
- static_cast<GLuint>(depth) > (caps.max3DTextureSize >> level))
- {
- context->handleError(InvalidValue());
- return false;
- }
- break;
-
- case GL_TEXTURE_2D_ARRAY:
- if (static_cast<GLuint>(width) > (caps.max2DTextureSize >> level) ||
- static_cast<GLuint>(height) > (caps.max2DTextureSize >> level) ||
- static_cast<GLuint>(depth) > caps.maxArrayTextureLayers)
- {
- context->handleError(InvalidValue());
- return false;
- }
- break;
-
- default:
- context->handleError(InvalidEnum());
- return false;
- }
-
- gl::Texture *texture =
- context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- if (!texture)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (texture->getImmutableFormat() && !isSubImage)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- // Validate texture formats
- GLenum actualInternalFormat =
- isSubImage ? texture->getFormat(target, level).info->internalFormat : internalformat;
- if (isSubImage && actualInternalFormat == GL_NONE)
- {
- context->handleError(InvalidOperation() << "Texture level does not exist.");
- return false;
- }
-
- const gl::InternalFormat &actualFormatInfo = isSubImage
- ? *texture->getFormat(target, level).info
- : GetInternalFormatInfo(internalformat, type);
- if (isCompressed)
- {
- if (!actualFormatInfo.compressed)
- {
- context->handleError(
- InvalidEnum() << "internalformat is not a supported compressed internal format.");
- return false;
- }
-
- if (isSubImage)
- {
- if (!ValidCompressedSubImageSize(
- context, actualFormatInfo.internalFormat, xoffset, yoffset, width, height,
- texture->getWidth(target, level), texture->getHeight(target, level)))
- {
- context->handleError(InvalidOperation() << "Invalid compressed format dimension.");
- return false;
- }
-
- if (format != actualInternalFormat)
- {
- context->handleError(InvalidOperation()
- << "Format must match the internal format of the texture.");
- return false;
- }
-
- if (actualInternalFormat == GL_ETC1_RGB8_OES)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidInternalFormat);
- return false;
- }
- }
- else
- {
- if (!ValidCompressedImageSize(context, actualInternalFormat, level, width, height))
- {
- context->handleError(InvalidOperation() << "Invalid compressed format dimension.");
- return false;
- }
- }
-
- if (!actualFormatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- if (target == GL_TEXTURE_3D)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- }
- else
- {
- if (!ValidateTexImageFormatCombination(context, target, actualInternalFormat, format, type))
- {
- return false;
- }
- }
-
- // Validate sub image parameters
- if (isSubImage)
- {
- if (isCompressed != actualFormatInfo.compressed)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (xoffset < 0 || yoffset < 0 || zoffset < 0)
- {
- context->handleError(InvalidValue());
- 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->handleError(InvalidValue());
- 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->handleError(InvalidValue());
- return false;
- }
-
- if (width > 0 && height > 0 && depth > 0 && pixels == nullptr &&
- context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack) == nullptr)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), PixelDataNull);
- return false;
- }
- }
-
- GLenum sizeCheckFormat = isSubImage ? format : internalformat;
- if (!ValidImageDataSize(context, target, width, height, depth, sizeCheckFormat, type, pixels,
- imageSize))
- {
- return false;
- }
-
- // Check for pixel unpack buffer related API errors
- gl::Buffer *pixelUnpackBuffer =
- context->getGLState().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->handleError(InvalidOperation()
- << "Reads would overflow the pixel unpack buffer.");
- return false;
- }
- }
-
- // ...the buffer object's data store is currently mapped.
- if (pixelUnpackBuffer->isMapped())
- {
- context->handleError(InvalidOperation() << "Pixel unpack buffer is mapped.");
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateES3TexImage2DParameters(Context *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isCompressed,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- GLsizei imageSize,
- const void *pixels)
-{
- if (!ValidTexture2DDestinationTarget(context, target))
- {
- context->handleError(InvalidEnum());
- 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,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isCompressed,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- GLsizei bufSize,
- const void *pixels)
-{
- if (!ValidTexture3DDestinationTarget(context, target))
- {
- context->handleError(InvalidEnum());
- 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 ||
- textureFormatInfo.componentType == GL_FLOAT) &&
- !(framebufferFormatInfo.componentType == GL_UNSIGNED_NORMALIZED ||
- framebufferFormatInfo.componentType == GL_SIGNED_NORMALIZED ||
- framebufferFormatInfo.componentType == GL_FLOAT))
- {
- return false;
- }
-
- // GLES specification 3.0.3, sec 3.8.5, pg 139-140:
- // The effective internal format of the source buffer is determined with the following rules
- // applied in order:
- // * If the source buffer is a texture or renderbuffer that was created with a sized internal
- // format then the effective internal format is the source buffer's sized internal format.
- // * If the source buffer is a texture that was created with an unsized base internal format,
- // then the effective internal format is the source image array's effective internal
- // format, as specified by table 3.12, which is determined from the <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(ValidationContext *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- 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->getGLState();
- gl::Framebuffer *framebuffer = state.getReadFramebuffer();
- GLuint readFramebufferID = framebuffer->id();
-
- if (framebuffer->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE)
- {
- context->handleError(InvalidFramebufferOperation());
- return false;
- }
-
- if (readFramebufferID != 0 && framebuffer->getSamples(context) != 0)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- const FramebufferAttachment *source = framebuffer->getReadColorbuffer();
-
- if (isSubImage)
- {
- if (!IsValidES3CopyTexImageCombination(*textureFormat.info, *source->getFormat().info,
- readFramebufferID))
- {
- context->handleError(InvalidOperation());
- 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->handleError(InvalidOperation());
- 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(ValidationContext *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- if (!ValidTexture2DDestinationTarget(context, target))
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- return ValidateES3CopyTexImageParametersBase(context, target, level, internalformat, isSubImage,
- xoffset, yoffset, zoffset, x, y, width, height,
- border);
-}
-
-bool ValidateES3CopyTexImage3DParameters(ValidationContext *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- if (!ValidTexture3DDestinationTarget(context, target))
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- return ValidateES3CopyTexImageParametersBase(context, target, level, internalformat, isSubImage,
- xoffset, yoffset, zoffset, x, y, width, height,
- border);
-}
-
-bool ValidateES3TexStorageParametersBase(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth)
-{
- if (width < 1 || height < 1 || depth < 1 || levels < 1)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- GLsizei maxDim = std::max(width, height);
- if (target != GL_TEXTURE_2D_ARRAY)
- {
- maxDim = std::max(maxDim, depth);
- }
-
- if (levels > gl::log2(maxDim) + 1)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- const gl::Caps &caps = context->getCaps();
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- {
- if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
- static_cast<GLuint>(height) > caps.max2DTextureSize)
- {
- context->handleError(InvalidValue());
- return false;
- }
- }
- break;
-
- case GL_TEXTURE_RECTANGLE_ANGLE:
- {
- if (static_cast<GLuint>(width) > caps.maxRectangleTextureSize ||
- static_cast<GLuint>(height) > caps.maxRectangleTextureSize || levels != 1)
- {
- context->handleError(InvalidValue());
- return false;
- }
- }
- break;
-
- case GL_TEXTURE_CUBE_MAP:
- {
- if (width != height)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (static_cast<GLuint>(width) > caps.maxCubeMapTextureSize)
- {
- context->handleError(InvalidValue());
- return false;
- }
- }
- break;
-
- case GL_TEXTURE_3D:
- {
- if (static_cast<GLuint>(width) > caps.max3DTextureSize ||
- static_cast<GLuint>(height) > caps.max3DTextureSize ||
- static_cast<GLuint>(depth) > caps.max3DTextureSize)
- {
- context->handleError(InvalidValue());
- return false;
- }
- }
- break;
-
- case GL_TEXTURE_2D_ARRAY:
- {
- if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
- static_cast<GLuint>(height) > caps.max2DTextureSize ||
- static_cast<GLuint>(depth) > caps.maxArrayTextureLayers)
- {
- context->handleError(InvalidValue());
- return false;
- }
- }
- break;
-
- default:
- UNREACHABLE();
- return false;
- }
-
- gl::Texture *texture = context->getTargetTexture(target);
- if (!texture || texture->id() == 0)
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (texture->getImmutableFormat())
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalformat);
- if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- if (!formatInfo.sized)
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- if (formatInfo.compressed && target == GL_TEXTURE_RECTANGLE_ANGLE)
- {
- context->handleError(InvalidEnum() << "Rectangle texture cannot have a compressed format.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateES3TexStorage2DParameters(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth)
-{
- if (!ValidTexture2DTarget(context, target))
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- return ValidateES3TexStorageParametersBase(context, target, levels, internalformat, width,
- height, depth);
-}
-
-bool ValidateES3TexStorage3DParameters(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth)
-{
- if (!ValidTexture3DTarget(context, target))
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- return ValidateES3TexStorageParametersBase(context, target, levels, internalformat, width,
- height, depth);
-}
-
-bool ValidateBeginQuery(gl::Context *context, GLenum target, GLuint id)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateBeginQueryBase(context, target, id);
-}
-
-bool ValidateEndQuery(gl::Context *context, GLenum target)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateEndQueryBase(context, target);
-}
-
-bool ValidateGetQueryiv(Context *context, GLenum target, GLenum pname, GLint *params)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateGetQueryivBase(context, target, pname, nullptr);
-}
-
-bool ValidateGetQueryObjectuiv(Context *context, GLuint id, GLenum pname, GLuint *params)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (!ValidateFramebufferTextureBase(context, target, attachment, texture, level))
- {
- return false;
- }
-
- const gl::Caps &caps = context->getCaps();
- if (texture != 0)
- {
- if (layer < 0)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- gl::Texture *tex = context->getTexture(texture);
- ASSERT(tex);
-
- switch (tex->getTarget())
- {
- case GL_TEXTURE_2D_ARRAY:
- {
- if (level > gl::log2(caps.max2DTextureSize))
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (static_cast<GLuint>(layer) >= caps.maxArrayTextureLayers)
- {
- context->handleError(InvalidValue());
- return false;
- }
- }
- break;
-
- case GL_TEXTURE_3D:
- {
- if (level > gl::log2(caps.max3DTextureSize))
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (static_cast<GLuint>(layer) >= caps.max3DTextureSize)
- {
- context->handleError(InvalidValue());
- return false;
- }
- }
- break;
-
- default:
- context->handleError(InvalidOperation());
- return false;
- }
-
- const auto &format = tex->getFormat(tex->getTarget(), level);
- if (format.info->compressed)
- {
- context->handleError(InvalidOperation());
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateInvalidateFramebuffer(Context *context,
- GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- bool defaultFramebuffer = false;
-
- switch (target)
- {
- case GL_DRAW_FRAMEBUFFER:
- case GL_FRAMEBUFFER:
- defaultFramebuffer = context->getGLState().getDrawFramebuffer()->id() == 0;
- break;
- case GL_READ_FRAMEBUFFER:
- defaultFramebuffer = context->getGLState().getReadFramebuffer()->id() == 0;
- break;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget);
- 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)
-{
- return ValidateInvalidateFramebuffer(context, target, numAttachments, attachments);
-}
-
-bool ValidateClearBuffer(ValidationContext *context)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (context->getGLState().getDrawFramebuffer()->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE)
- {
- context->handleError(InvalidFramebufferOperation());
- return false;
- }
-
- return true;
-}
-
-bool ValidateDrawRangeElements(Context *context,
- GLenum mode,
- GLuint start,
- GLuint end,
- GLsizei count,
- GLenum type,
- const void *indices)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (end < start)
- {
- context->handleError(InvalidValue() << "end < start");
- return false;
- }
-
- if (!ValidateDrawElementsCommon(context, mode, count, type, indices, 0))
- {
- return false;
- }
-
- // Use the parameter buffer to retrieve and cache the index range.
- const auto &params = context->getParams<HasIndexRange>();
- const auto &indexRangeOpt = params.getIndexRange();
- if (!indexRangeOpt.valid())
- {
- // Unexpected error.
- return false;
- }
-
- if (indexRangeOpt.value().end > end || indexRangeOpt.value().start < start)
- {
- // GL spec says that behavior in this case is undefined - generating an error is fine.
- context->handleError(InvalidOperation() << "Indices are out of the start, end range.");
- return false;
- }
- return true;
-}
-
-bool ValidateGetUniformuiv(Context *context, GLuint program, GLint location, GLuint *params)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateGetUniformBase(context, program, location);
-}
-
-bool ValidateReadBuffer(Context *context, GLenum src)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- const Framebuffer *readFBO = context->getGLState().getReadFramebuffer();
-
- if (readFBO == nullptr)
- {
- context->handleError(InvalidOperation() << "No active read framebuffer.");
- return false;
- }
-
- if (src == GL_NONE)
- {
- return true;
- }
-
- if (src != GL_BACK && (src < GL_COLOR_ATTACHMENT0 || src > GL_COLOR_ATTACHMENT31))
- {
- context->handleError(InvalidEnum() << "Unknown enum for 'src' in ReadBuffer");
- return false;
- }
-
- if (readFBO->id() == 0)
- {
- if (src != GL_BACK)
- {
- context->handleError(
- InvalidOperation()
- << "'src' must be GL_NONE or GL_BACK when reading from the default framebuffer.");
- return false;
- }
- }
- else
- {
- GLuint drawBuffer = static_cast<GLuint>(src - GL_COLOR_ATTACHMENT0);
-
- if (drawBuffer >= context->getCaps().maxDrawBuffers)
- {
- context->handleError(InvalidOperation() << "'src' is greater than MAX_DRAW_BUFFERS.");
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateCompressedTexImage3D(Context *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLsizei imageSize,
- const void *data)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (!ValidTextureTarget(context, target))
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- // Validate image size
- if (!ValidImageSizeParameters(context, target, level, width, height, depth, false))
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- const InternalFormat &formatInfo = GetSizedInternalFormatInfo(internalformat);
- if (!formatInfo.compressed)
- {
- context->handleError(InvalidEnum() << "Not a valid compressed texture format");
- return false;
- }
-
- auto blockSizeOrErr = formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth));
- if (blockSizeOrErr.isError())
- {
- context->handleError(InvalidValue());
- return false;
- }
- if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSizeOrErr.getResult())
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- // 3D texture target validation
- if (target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY)
- {
- context->handleError(InvalidEnum() << "Must specify a valid 3D texture destination target");
- 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,
- GLenum 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateBindVertexArrayBase(context, array);
-}
-
-bool ValidateIsVertexArray(Context *context, GLuint array)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return true;
-}
-
-static bool ValidateBindBufferCommon(Context *context,
- BufferBinding target,
- GLuint index,
- GLuint buffer,
- GLintptr offset,
- GLsizeiptr size)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (buffer != 0 && offset < 0)
- {
- context->handleError(InvalidValue() << "buffer is non-zero and offset is negative.");
- return false;
- }
-
- if (!context->getGLState().isBindGeneratesResourceEnabled() &&
- !context->isBufferGenerated(buffer))
- {
- context->handleError(InvalidOperation() << "Buffer was not generated.");
- return false;
- }
-
- const Caps &caps = context->getCaps();
- switch (target)
- {
- case BufferBinding::TransformFeedback:
- {
- if (index >= caps.maxTransformFeedbackSeparateAttributes)
- {
- context->handleError(InvalidValue() << "index is greater than or equal to the "
- "number of TRANSFORM_FEEDBACK_BUFFER "
- "indexed binding points.");
- return false;
- }
- if (buffer != 0 && ((offset % 4) != 0 || (size % 4) != 0))
- {
- context->handleError(InvalidValue() << "offset and size must be multiple of 4.");
- return false;
- }
-
- TransformFeedback *curTransformFeedback =
- context->getGLState().getCurrentTransformFeedback();
- if (curTransformFeedback && curTransformFeedback->isActive())
- {
- context->handleError(InvalidOperation()
- << "target is TRANSFORM_FEEDBACK_BUFFER and transform "
- "feedback is currently active.");
- return false;
- }
- break;
- }
- case BufferBinding::Uniform:
- {
- if (index >= caps.maxUniformBufferBindings)
- {
- context->handleError(InvalidValue() << "index is greater than or equal to the "
- "number of UNIFORM_BUFFER indexed "
- "binding points.");
- return false;
- }
-
- if (buffer != 0 && (offset % caps.uniformBufferOffsetAlignment) != 0)
- {
- context->handleError(
- InvalidValue()
- << "offset must be multiple of value of UNIFORM_BUFFER_OFFSET_ALIGNMENT.");
- return false;
- }
- break;
- }
- case BufferBinding::AtomicCounter:
- {
- if (context->getClientVersion() < ES_3_1)
- {
- context->handleError(InvalidEnum()
- << "ATOMIC_COUNTER_BUFFER is not supported before GLES 3.1");
- return false;
- }
- if (index >= caps.maxAtomicCounterBufferBindings)
- {
- context->handleError(InvalidValue() << "index is greater than or equal to the "
- "number of ATOMIC_COUNTER_BUFFER "
- "indexed binding points.");
- return false;
- }
- if (buffer != 0 && (offset % 4) != 0)
- {
- context->handleError(InvalidValue() << "offset must be a multiple of 4.");
- return false;
- }
- break;
- }
- case BufferBinding::ShaderStorage:
- {
- if (context->getClientVersion() < ES_3_1)
- {
- context->handleError(InvalidEnum()
- << "SHADER_STORAGE_BUFFER is not supported in GLES3.");
- return false;
- }
- if (index >= caps.maxShaderStorageBufferBindings)
- {
- context->handleError(InvalidValue() << "index is greater than or equal to the "
- "number of SHADER_STORAGE_BUFFER "
- "indexed binding points.");
- return false;
- }
- if (buffer != 0 && (offset % caps.shaderStorageBufferOffsetAlignment) != 0)
- {
- context->handleError(InvalidValue() << "offset must be multiple of value of "
- "SHADER_STORAGE_BUFFER_OFFSET_"
- "ALIGNMENT.");
- return false;
- }
- break;
- }
- default:
- context->handleError(InvalidEnum() << "the target is not supported.");
- 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->handleError(InvalidValue()
- << "buffer is non-zero and size is less than or equal to zero.");
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateGetProgramBinaryBase(context, program, bufSize, length, binaryFormat, binary);
-}
-
-bool ValidateProgramParameteri(Context *context, GLuint program, GLenum pname, GLint value)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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->handleError(InvalidValue()
- << "Invalid value, expected GL_FALSE or GL_TRUE: " << value);
- return false;
- }
- break;
-
- case GL_PROGRAM_SEPARABLE:
- if (context->getClientVersion() < ES_3_1)
- {
- context->handleError(InvalidEnum()
- << "PROGRAM_SEPARABLE is not supported before GLES 3.1");
- return false;
- }
-
- if (value != GL_FALSE && value != GL_TRUE)
- {
- context->handleError(InvalidValue()
- << "Invalid value, expected GL_FALSE or GL_TRUE: " << value);
- return false;
- }
- break;
-
- default:
- context->handleError(InvalidEnum()
- << "Invalid pname: 0x" << std::hex << std::uppercase << pname);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
- dstX1, dstY1, mask, filter);
-}
-
-bool ValidateClearBufferiv(ValidationContext *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLint *value)
-{
- switch (buffer)
- {
- case GL_COLOR:
- if (drawbuffer < 0 ||
- static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
- {
- context->handleError(InvalidValue());
- 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->handleError(InvalidValue());
- return false;
- }
- break;
-
- default:
- context->handleError(InvalidEnum());
- return false;
- }
-
- return ValidateClearBuffer(context);
-}
-
-bool ValidateClearBufferuiv(ValidationContext *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLuint *value)
-{
- switch (buffer)
- {
- case GL_COLOR:
- if (drawbuffer < 0 ||
- static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
- {
- context->handleError(InvalidValue());
- return false;
- }
- if (context->getExtensions().webglCompatibility)
- {
- constexpr GLenum validComponentTypes[] = {GL_UNSIGNED_INT};
- if (!ValidateWebGLFramebufferAttachmentClearType(
- context, drawbuffer, validComponentTypes, ArraySize(validComponentTypes)))
- {
- return false;
- }
- }
- break;
-
- default:
- context->handleError(InvalidEnum());
- return false;
- }
-
- return ValidateClearBuffer(context);
-}
-
-bool ValidateClearBufferfv(ValidationContext *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLfloat *value)
-{
- switch (buffer)
- {
- case GL_COLOR:
- if (drawbuffer < 0 ||
- static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
- {
- context->handleError(InvalidValue());
- 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->handleError(InvalidValue());
- return false;
- }
- break;
-
- default:
- context->handleError(InvalidEnum());
- return false;
- }
-
- return ValidateClearBuffer(context);
-}
-
-bool ValidateClearBufferfi(ValidationContext *context,
- GLenum buffer,
- GLint drawbuffer,
- GLfloat depth,
- GLint stencil)
-{
- switch (buffer)
- {
- case GL_DEPTH_STENCIL:
- if (drawbuffer != 0)
- {
- context->handleError(InvalidValue());
- return false;
- }
- break;
-
- default:
- context->handleError(InvalidEnum());
- return false;
- }
-
- return ValidateClearBuffer(context);
-}
-
-bool ValidateDrawBuffers(ValidationContext *context, GLsizei n, const GLenum *bufs)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateDrawBuffersBase(context, n, bufs);
-}
-
-bool ValidateCopyTexSubImage3D(Context *context,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateES3CopyTexImage3DParameters(context, target, level, GL_NONE, true, xoffset,
- yoffset, zoffset, x, y, width, height, 0);
-}
-
-bool ValidateTexImage3D(Context *context,
- GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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,
- GLenum 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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,
- GLenum 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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,
- 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)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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,
- GLenum 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- const InternalFormat &formatInfo = GetSizedInternalFormatInfo(format);
- if (!formatInfo.compressed)
- {
- context->handleError(InvalidEnum() << "Not a valid compressed texture format");
- return false;
- }
-
- auto blockSizeOrErr = formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth));
- if (blockSizeOrErr.isError())
- {
- context->handleError(blockSizeOrErr.getError());
- return false;
- }
- if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSizeOrErr.getResult())
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (!data)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- return ValidateES3TexImage3DParameters(context, target, level, GL_NONE, true, true, xoffset,
- yoffset, zoffset, width, height, depth, 0, format,
- GL_NONE, -1, data);
-}
-bool ValidateCompressedTexSubImage3DRobustANGLE(Context *context,
- GLenum 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->handleError(InvalidOperation()
- << "Attempt to delete active transform feedback.");
- 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, GLenum primitiveMode)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
- switch (primitiveMode)
- {
- case GL_TRIANGLES:
- case GL_LINES:
- case GL_POINTS:
- break;
-
- default:
- context->handleError(InvalidEnum() << "Invalid primitive mode.");
- return false;
- }
-
- TransformFeedback *transformFeedback = context->getGLState().getCurrentTransformFeedback();
- ASSERT(transformFeedback != nullptr);
-
- if (transformFeedback->isActive())
- {
- context->handleError(InvalidOperation() << "Transform feedback is already active.");
- return false;
- }
-
- for (size_t i = 0; i < transformFeedback->getIndexedBufferCount(); i++)
- {
- const auto &buffer = transformFeedback->getIndexedBuffer(i);
- if (buffer.get() && buffer->isMapped())
- {
- context->handleError(InvalidOperation() << "Transform feedback has a mapped buffer.");
- return false;
- }
- }
-
- Program *program = context->getGLState().getProgram();
-
- if (!program)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotBound);
- return false;
- }
-
- if (program->getTransformFeedbackVaryingCount() == 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoTransformFeedbackOutputVariables);
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetBufferPointerv(Context *context, BufferBinding target, GLenum pname, void **params)
-{
- 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;
- }
-
- if (!ValidateGetBufferPointervBase(context, target, pname, length, params))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateUnmapBuffer(Context *context, BufferBinding target)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateUnmapBufferBase(context, target);
-}
-
-bool ValidateMapBufferRange(Context *context,
- BufferBinding target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateMapBufferRangeBase(context, target, offset, length, access);
-}
-
-bool ValidateFlushMappedBufferRange(Context *context,
- BufferBinding target,
- GLintptr offset,
- GLsizeiptr length)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateFlushMappedBufferRangeBase(context, target, offset, length);
-}
-
-bool ValidateIndexedStateQuery(ValidationContext *context,
- GLenum pname,
- GLuint index,
- GLsizei *length)
-{
- if (length)
- {
- *length = 0;
- }
-
- GLenum nativeType;
- unsigned int numParams;
- if (!context->getIndexedQueryParameterInfo(pname, &nativeType, &numParams))
- {
- context->handleError(InvalidEnum());
- 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->handleError(InvalidValue());
- return false;
- }
- break;
-
- case GL_UNIFORM_BUFFER_START:
- case GL_UNIFORM_BUFFER_SIZE:
- case GL_UNIFORM_BUFFER_BINDING:
- if (index >= caps.maxUniformBufferBindings)
- {
- context->handleError(InvalidValue());
- return false;
- }
- break;
-
- case GL_MAX_COMPUTE_WORK_GROUP_SIZE:
- case GL_MAX_COMPUTE_WORK_GROUP_COUNT:
- if (index >= 3u)
- {
- context->handleError(InvalidValue());
- 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->handleError(
- InvalidEnum()
- << "Atomic Counter buffers are not supported in this version of GL");
- return false;
- }
- if (index >= caps.maxAtomicCounterBufferBindings)
- {
- context->handleError(
- InvalidValue()
- << "index is outside the valid range for GL_ATOMIC_COUNTER_BUFFER_BINDING");
- 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->handleError(
- InvalidEnum()
- << "Shader storage buffers are not supported in this version of GL");
- return false;
- }
- if (index >= caps.maxShaderStorageBufferBindings)
- {
- context->handleError(
- InvalidValue()
- << "index is outside the valid range for GL_SHADER_STORAGE_BUFFER_BINDING");
- 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->handleError(
- InvalidEnum()
- << "Vertex Attrib Bindings are not supported in this version of GL");
- return false;
- }
- if (index >= caps.maxVertexAttribBindings)
- {
- context->handleError(
- InvalidValue()
- << "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
- return false;
- }
- break;
- case GL_SAMPLE_MASK_VALUE:
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumRequiresGLES31);
- return false;
- }
- if (index >= caps.maxSampleMaskWords)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidSampleMaskNumber);
- return false;
- }
- break;
- default:
- context->handleError(InvalidEnum());
- return false;
- }
-
- if (length)
- {
- *length = 1;
- }
-
- return true;
-}
-
-bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint index, GLint *data)
-{
- if (context->getClientVersion() < ES_3_0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
- return ValidateIndexedStateQuery(context, target, index, nullptr);
-}
-
-bool ValidateGetIntegeri_vRobustANGLE(ValidationContext *context,
- GLenum target,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLint *data)
-{
- if (context->getClientVersion() < ES_3_0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateIndexedStateQuery(context, target, index, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetInteger64i_v(ValidationContext *context, GLenum target, GLuint index, GLint64 *data)
-{
- if (context->getClientVersion() < ES_3_0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
- return ValidateIndexedStateQuery(context, target, index, nullptr);
-}
-
-bool ValidateGetInteger64i_vRobustANGLE(ValidationContext *context,
- GLenum target,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLint64 *data)
-{
- if (context->getClientVersion() < ES_3_0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateIndexedStateQuery(context, target, index, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateCopyBufferSubData(ValidationContext *context,
- BufferBinding readTarget,
- BufferBinding writeTarget,
- GLintptr readOffset,
- GLintptr writeOffset,
- GLsizeiptr size)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (!ValidBufferType(context, readTarget) || !ValidBufferType(context, writeTarget))
- {
- context->handleError(InvalidEnum() << "Invalid buffer target");
- return false;
- }
-
- Buffer *readBuffer = context->getGLState().getTargetBuffer(readTarget);
- Buffer *writeBuffer = context->getGLState().getTargetBuffer(writeTarget);
-
- if (!readBuffer || !writeBuffer)
- {
- context->handleError(InvalidOperation() << "No buffer bound to target");
- return false;
- }
-
- // Verify that readBuffer and writeBuffer are not currently mapped
- if (readBuffer->isMapped() || writeBuffer->isMapped())
- {
- context->handleError(InvalidOperation()
- << "Cannot call CopyBufferSubData on a mapped buffer");
- 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->handleError(InvalidValue() << "Integer overflow when validating copy offsets.");
- return false;
- }
-
- if (readOffset < 0 || writeOffset < 0 || size < 0)
- {
- context->handleError(InvalidValue()
- << "readOffset, writeOffset and size must all be non-negative");
- return false;
- }
-
- if (checkedReadSum.ValueOrDie() > readBuffer->getSize() ||
- checkedWriteSum.ValueOrDie() > writeBuffer->getSize())
- {
- context->handleError(InvalidValue() << "Buffer offset overflow in CopyBufferSubData");
- return false;
- }
-
- if (readBuffer == writeBuffer)
- {
- auto checkedOffsetDiff = (checkedReadOffset - checkedWriteOffset).Abs();
- if (!checkedOffsetDiff.IsValid())
- {
- // This shold not be possible.
- UNREACHABLE();
- context->handleError(InvalidValue()
- << "Integer overflow when validating same buffer copy.");
- return false;
- }
-
- if (checkedOffsetDiff.ValueOrDie() < size)
- {
- context->handleError(InvalidValue());
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateGetStringi(Context *context, GLenum name, GLuint index)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- switch (name)
- {
- case GL_EXTENSIONS:
- if (index >= context->getExtensionStringCount())
- {
- context->handleError(InvalidValue()
- << "index must be less than the number of extension strings.");
- return false;
- }
- break;
-
- case GL_REQUESTABLE_EXTENSIONS_ANGLE:
- if (!context->getExtensions().requestExtension)
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidName);
- return false;
- }
- if (index >= context->getRequestableExtensionStringCount())
- {
- context->handleError(
- InvalidValue()
- << "index must be less than the number of requestable extension strings.");
- return false;
- }
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidName);
- return false;
- }
-
- return true;
-}
-
-bool ValidateRenderbufferStorageMultisample(ValidationContext *context,
- GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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.
- const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalformat);
- if ((formatInfo.componentType == GL_UNSIGNED_INT || formatInfo.componentType == GL_INT) &&
- samples > 0)
- {
- context->handleError(InvalidOperation());
- 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->handleError(
- InvalidOperation()
- << "Samples must not be greater than maximum supported value for the format.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateVertexAttribIPointer(ValidationContext *context,
- GLuint index,
- GLint size,
- GLenum type,
- GLsizei stride,
- const void *pointer)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (!ValidateVertexFormatBase(context, index, size, type, true))
- {
- return false;
- }
-
- if (stride < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeStride);
- return false;
- }
-
- const Caps &caps = context->getCaps();
- if (context->getClientVersion() >= ES_3_1)
- {
- if (stride > caps.maxVertexAttribStride)
- {
- context->handleError(InvalidValue()
- << "stride cannot be greater than MAX_VERTEX_ATTRIB_STRIDE.");
- 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->handleError(InvalidValue()
- << "index must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
- 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->getGLState().getVertexArrayId() != 0 &&
- context->getGLState().getTargetBuffer(BufferBinding::Array) == 0 && pointer != nullptr)
- {
- context
- ->handleError(InvalidOperation()
- << "Client data cannot be used with a non-default vertex array object.");
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (bufSize < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- return false;
- }
-
- Sync *syncObject = context->getSync(sync);
- if (!syncObject)
- {
- context->handleError(InvalidValue() << "Invalid sync object.");
- return false;
- }
-
- switch (pname)
- {
- case GL_OBJECT_TYPE:
- case GL_SYNC_CONDITION:
- case GL_SYNC_FLAGS:
- case GL_SYNC_STATUS:
- break;
-
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
- return false;
- }
-
- return true;
-}
-
-bool ValidateDrawElementsInstanced(ValidationContext *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instanceCount)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateDrawElementsInstancedCommon(context, mode, count, type, indices, instanceCount);
-}
-
-bool ValidateFramebufferTextureMultiviewLayeredANGLE(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->handleError(InvalidValue() << "baseViewIndex cannot be less than 0.");
- return false;
- }
-
- Texture *tex = context->getTexture(texture);
- ASSERT(tex);
-
- switch (tex->getTarget())
- {
- case GL_TEXTURE_2D_ARRAY:
- {
- const Caps &caps = context->getCaps();
- if (static_cast<GLuint>(baseViewIndex + numViews) > caps.maxArrayTextureLayers)
- {
- context->handleError(InvalidValue() << "baseViewIndex+numViews cannot be "
- "greater than "
- "GL_MAX_ARRAY_TEXTURE_LAYERS.");
- return false;
- }
- }
- break;
- default:
- context->handleError(InvalidOperation()
- << "Texture's target must be GL_TEXTURE_2D_ARRAY.");
- return false;
- }
-
- if (!ValidateFramebufferTextureMultiviewLevelAndFormat(context, tex, level))
- {
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateFramebufferTextureMultiviewSideBySideANGLE(Context *context,
- GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLsizei numViews,
- const GLint *viewportOffsets)
-{
- if (!ValidateFramebufferTextureMultiviewBaseANGLE(context, target, attachment, texture, level,
- numViews))
- {
- return false;
- }
-
- if (texture != 0)
- {
- const GLsizei numViewportOffsetValues = numViews * 2;
- for (GLsizei i = 0; i < numViewportOffsetValues; ++i)
- {
- if (viewportOffsets[i] < 0)
- {
- context->handleError(InvalidValue()
- << "viewportOffsets cannot contain negative values.");
- return false;
- }
- }
-
- Texture *tex = context->getTexture(texture);
- ASSERT(tex);
-
- switch (tex->getTarget())
- {
- case GL_TEXTURE_2D:
- break;
- default:
- context->handleError(InvalidOperation()
- << "Texture's target must be GL_TEXTURE_2D.");
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- TransformFeedback *transformFeedback = context->getGLState().getCurrentTransformFeedback();
- ASSERT(transformFeedback != nullptr);
-
- if (!transformFeedback->isActive())
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- return true;
-}
-
-bool ValidateTransformFeedbackVaryings(Context *context,
- GLuint program,
- GLsizei count,
- const GLchar *const *varyings,
- GLenum bufferMode)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (count < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeCount);
- 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->handleError(InvalidValue());
- return false;
- }
- break;
- }
- default:
- context->handleError(InvalidEnum());
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (bufSize < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
- if (!programObject)
- {
- return false;
- }
-
- if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount()))
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- return true;
-}
-
-bool ValidateBindTransformFeedback(Context *context, GLenum target, GLuint id)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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)
- TransformFeedback *curTransformFeedback =
- context->getGLState().getCurrentTransformFeedback();
- if (curTransformFeedback && curTransformFeedback->isActive() &&
- !curTransformFeedback->isPaused())
- {
- context->handleError(InvalidOperation());
- 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))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), TransformFeedbackDoesNotExist);
- return false;
- }
- }
- break;
-
- default:
- context->handleError(InvalidEnum());
- return false;
- }
-
- return true;
-}
-
-bool ValidateIsTransformFeedback(Context *context, GLuint id)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return true;
-}
-
-bool ValidatePauseTransformFeedback(Context *context)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- TransformFeedback *transformFeedback = context->getGLState().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() || transformFeedback->isPaused())
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- return true;
-}
-
-bool ValidateResumeTransformFeedback(Context *context)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- TransformFeedback *transformFeedback = context->getGLState().getCurrentTransformFeedback();
- ASSERT(transformFeedback != nullptr);
-
- // Current transform feedback must be active and paused in order to resume (3.0.2 pg 86)
- if (!transformFeedback->isActive() || !transformFeedback->isPaused())
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- return true;
-}
-
-bool ValidateVertexAttribI4i(Context *context, GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateVertexAttribI4ui(Context *context,
- GLuint index,
- GLuint x,
- GLuint y,
- GLuint z,
- GLuint w)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateVertexAttribI4iv(Context *context, GLuint index, const GLint *v)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateVertexAttribI4uiv(Context *context, GLuint index, const GLuint *v)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateGetFragDataLocation(Context *context, GLuint program, const GLchar *name)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
- if (!programObject)
- {
- return false;
- }
-
- if (!programObject->isLinked())
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetUniformIndices(Context *context,
- GLuint program,
- GLsizei uniformCount,
- const GLchar *const *uniformNames,
- GLuint *uniformIndices)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (uniformCount < 0)
- {
- context->handleError(InvalidValue());
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (uniformCount < 0)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
- if (!programObject)
- {
- return false;
- }
-
- switch (pname)
- {
- case GL_UNIFORM_TYPE:
- case GL_UNIFORM_SIZE:
- case GL_UNIFORM_NAME_LENGTH:
- case GL_UNIFORM_BLOCK_INDEX:
- case GL_UNIFORM_OFFSET:
- case GL_UNIFORM_ARRAY_STRIDE:
- case GL_UNIFORM_MATRIX_STRIDE:
- case GL_UNIFORM_IS_ROW_MAJOR:
- break;
-
- default:
- context->handleError(InvalidEnum());
- return false;
- }
-
- if (uniformCount > programObject->getActiveUniformCount())
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- for (int uniformId = 0; uniformId < uniformCount; uniformId++)
- {
- const GLuint index = uniformIndices[uniformId];
-
- if (index >= static_cast<GLuint>(programObject->getActiveUniformCount()))
- {
- context->handleError(InvalidValue());
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateGetUniformBlockIndex(Context *context, GLuint program, const GLchar *uniformBlockName)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
- if (!programObject)
- {
- return false;
- }
-
- if (uniformBlockIndex >= programObject->getActiveUniformBlockCount())
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- return true;
-}
-
-bool ValidateUniformBlockBinding(Context *context,
- GLuint program,
- GLuint uniformBlockIndex,
- GLuint uniformBlockBinding)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (uniformBlockBinding >= context->getCaps().maxUniformBufferBindings)
- {
- context->handleError(InvalidValue());
- 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->handleError(InvalidValue());
- return false;
- }
-
- return true;
-}
-
-bool ValidateDrawArraysInstanced(Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei primcount)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateDrawArraysInstancedBase(context, mode, first, count, primcount);
-}
-
-bool ValidateFenceSync(Context *context, GLenum condition, GLbitfield flags)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE)
- {
- context->handleError(InvalidEnum());
- return false;
- }
-
- if (flags != 0)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- return true;
-}
-
-bool ValidateIsSync(Context *context, GLsync sync)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return true;
-}
-
-bool ValidateDeleteSync(Context *context, GLsync sync)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (sync != static_cast<GLsync>(0) && !context->getSync(sync))
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- return true;
-}
-
-bool ValidateClientWaitSync(Context *context, GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- Sync *clientWaitSync = context->getSync(sync);
- if (!clientWaitSync)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- return true;
-}
-
-bool ValidateWaitSync(Context *context, GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (flags != 0)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- if (timeout != GL_TIMEOUT_IGNORED)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- Sync *waitSync = context->getSync(sync);
- if (!waitSync)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetInteger64v(Context *context, GLenum pname, GLint64 *params)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return true;
-}
-
-bool ValidateBindSampler(Context *context, GLuint unit, GLuint sampler)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (sampler != 0 && !context->isSampler(sampler))
- {
- context->handleError(InvalidOperation());
- return false;
- }
-
- if (unit >= context->getCaps().maxCombinedTextureImageUnits)
- {
- context->handleError(InvalidValue());
- return false;
- }
-
- return true;
-}
-
-bool ValidateVertexAttribDivisor(Context *context, GLuint index, GLuint divisor)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- return ValidateVertexAttribIndex(context, index);
-}
-
-bool ValidateTexStorage2D(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (!ValidateES3TexStorage2DParameters(context, target, levels, internalformat, width, height,
- 1))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateTexStorage3D(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth)
-{
- if (context->getClientMajorVersion() < 3)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
- return false;
- }
-
- if (!ValidateES3TexStorage3DParameters(context, target, levels, internalformat, width, height,
- depth))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetBufferParameteri64v(ValidationContext *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 ValidateSamplerParameterf(Context *context, GLuint sampler, GLenum pname, GLfloat param)
-{
- return ValidateSamplerParameterBase(context, sampler, pname, -1, &param);
-}
-
-bool ValidateSamplerParameterfv(Context *context,
- GLuint sampler,
- GLenum pname,
- const GLfloat *params)
-{
- return ValidateSamplerParameterBase(context, sampler, pname, -1, params);
-}
-
-bool ValidateSamplerParameteri(Context *context, GLuint sampler, GLenum pname, GLint param)
-{
- return ValidateSamplerParameterBase(context, sampler, pname, -1, &param);
-}
-
-bool ValidateSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, const GLint *params)
-{
- return ValidateSamplerParameterBase(context, sampler, pname, -1, 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);
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/validationES3.h b/src/3rdparty/angle/src/libANGLE/validationES3.h
deleted file mode 100644
index 631b1ca43a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/validationES3.h
+++ /dev/null
@@ -1,614 +0,0 @@
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// validationES3.h: Validation functions for OpenGL ES 3.0 entry point parameters
-
-#ifndef LIBANGLE_VALIDATION_ES3_H_
-#define LIBANGLE_VALIDATION_ES3_H_
-
-#include "libANGLE/PackedGLEnums.h"
-
-#include <GLES3/gl3.h>
-
-namespace gl
-{
-class Context;
-struct IndexRange;
-class ValidationContext;
-
-bool ValidateES3TexImageParametersBase(ValidationContext *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isCompressed,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- GLsizei imageSize,
- const void *pixels);
-
-bool ValidateES3TexStorageParameters(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth);
-
-bool ValidateES3TexImage2DParameters(Context *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isCompressed,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- GLsizei imageSize,
- const void *pixels);
-
-bool ValidateES3TexImage3DParameters(Context *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isCompressed,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- GLsizei bufSize,
- const void *pixels);
-
-bool ValidateES3CopyTexImageParametersBase(ValidationContext *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border);
-
-bool ValidateES3CopyTexImage2DParameters(ValidationContext *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border);
-
-bool ValidateES3CopyTexImage3DParameters(ValidationContext *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- bool isSubImage,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border);
-
-bool ValidateES3TexStorageParametersBase(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth);
-
-bool ValidateES3TexStorage2DParameters(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth);
-
-bool ValidateES3TexStorage3DParameters(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth);
-
-bool ValidateBeginQuery(Context *context, GLenum target, GLuint id);
-
-bool ValidateEndQuery(Context *context, GLenum target);
-
-bool ValidateGetQueryiv(Context *context, GLenum target, GLenum pname, GLint *params);
-
-bool ValidateGetQueryObjectuiv(Context *context, GLuint id, GLenum pname, GLuint *params);
-
-bool ValidateFramebufferTextureLayer(Context *context,
- GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLint layer);
-
-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 ValidateClearBuffer(ValidationContext *context);
-
-bool ValidateDrawRangeElements(Context *context,
- GLenum mode,
- GLuint start,
- GLuint end,
- GLsizei count,
- GLenum type,
- const void *indices);
-
-bool ValidateGetUniformuiv(Context *context, GLuint program, GLint location, GLuint *params);
-
-bool ValidateReadBuffer(Context *context, GLenum mode);
-
-bool ValidateCompressedTexImage3D(Context *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLsizei imageSize,
- const void *data);
-bool ValidateCompressedTexImage3DRobustANGLE(Context *context,
- GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLsizei imageSize,
- GLsizei dataSize,
- const void *data);
-
-bool ValidateBindVertexArray(Context *context, GLuint array);
-bool ValidateIsVertexArray(Context *context, GLuint array);
-
-bool ValidateBindBufferBase(Context *context, BufferBinding target, GLuint index, GLuint buffer);
-bool ValidateBindBufferRange(Context *context,
- BufferBinding target,
- GLuint index,
- GLuint buffer,
- GLintptr offset,
- GLsizeiptr size);
-
-bool ValidateProgramBinary(Context *context,
- GLuint program,
- GLenum binaryFormat,
- const void *binary,
- GLint length);
-bool ValidateGetProgramBinary(Context *context,
- GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- GLenum *binaryFormat,
- void *binary);
-bool ValidateProgramParameteri(Context *context, GLuint program, GLenum pname, GLint value);
-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 ValidateClearBufferiv(ValidationContext *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLint *value);
-bool ValidateClearBufferuiv(ValidationContext *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLuint *value);
-bool ValidateClearBufferfv(ValidationContext *context,
- GLenum buffer,
- GLint drawbuffer,
- const GLfloat *value);
-bool ValidateClearBufferfi(ValidationContext *context,
- GLenum buffer,
- GLint drawbuffer,
- GLfloat depth,
- GLint stencil);
-bool ValidateDrawBuffers(ValidationContext *context, GLsizei n, const GLenum *bufs);
-bool ValidateCopyTexSubImage3D(Context *context,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height);
-bool ValidateTexImage3D(Context *context,
- GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels);
-bool ValidateTexImage3DRobustANGLE(Context *context,
- GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- GLsizei bufSize,
- const void *pixels);
-bool ValidateTexSubImage3D(Context *context,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLenum type,
- const void *pixels);
-bool ValidateTexSubImage3DRobustANGLE(Context *context,
- 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);
-bool ValidateCompressedTexSubImage3D(Context *context,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLsizei imageSize,
- const void *data);
-bool ValidateCompressedTexSubImage3DRobustANGLE(Context *context,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLsizei imageSize,
- GLsizei dataSize,
- const void *data);
-
-bool ValidateGenQueries(Context *context, GLint n, GLuint *ids);
-bool ValidateDeleteQueries(Context *context, GLint n, const GLuint *ids);
-bool ValidateGenSamplers(Context *context, GLint count, GLuint *samplers);
-bool ValidateDeleteSamplers(Context *context, GLint count, const GLuint *samplers);
-bool ValidateGenTransformFeedbacks(Context *context, GLint n, GLuint *ids);
-bool ValidateDeleteTransformFeedbacks(Context *context, GLint n, const GLuint *ids);
-bool ValidateGenVertexArrays(Context *context, GLint n, GLuint *arrays);
-bool ValidateDeleteVertexArrays(Context *context, GLint n, const GLuint *arrays);
-
-bool ValidateBeginTransformFeedback(Context *context, GLenum primitiveMode);
-
-bool ValidateGetBufferPointerv(Context *context, BufferBinding target, GLenum pname, void **params);
-bool ValidateGetBufferPointervRobustANGLE(Context *context,
- BufferBinding target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- void **params);
-bool ValidateUnmapBuffer(Context *context, BufferBinding target);
-bool ValidateMapBufferRange(Context *context,
- BufferBinding target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access);
-bool ValidateFlushMappedBufferRange(Context *context,
- BufferBinding target,
- GLintptr offset,
- GLsizeiptr length);
-
-bool ValidateIndexedStateQuery(ValidationContext *context,
- GLenum pname,
- GLuint index,
- GLsizei *length);
-bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint index, GLint *data);
-bool ValidateGetIntegeri_vRobustANGLE(ValidationContext *context,
- GLenum target,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLint *data);
-bool ValidateGetInteger64i_v(ValidationContext *context,
- GLenum target,
- GLuint index,
- GLint64 *data);
-bool ValidateGetInteger64i_vRobustANGLE(ValidationContext *context,
- GLenum target,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLint64 *data);
-
-bool ValidateCopyBufferSubData(ValidationContext *context,
- BufferBinding readTarget,
- BufferBinding writeTarget,
- GLintptr readOffset,
- GLintptr writeOffset,
- GLsizeiptr size);
-
-bool ValidateGetStringi(Context *context, GLenum name, GLuint index);
-bool ValidateRenderbufferStorageMultisample(ValidationContext *context,
- GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height);
-
-bool ValidateVertexAttribIPointer(ValidationContext *context,
- GLuint index,
- GLint size,
- GLenum type,
- GLsizei stride,
- const void *pointer);
-
-bool ValidateGetSynciv(Context *context,
- GLsync sync,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *values);
-
-bool ValidateDrawElementsInstanced(ValidationContext *context,
- GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instanceCount);
-
-bool ValidateFramebufferTextureMultiviewLayeredANGLE(Context *context,
- GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLint baseViewIndex,
- GLsizei numViews);
-
-bool ValidateFramebufferTextureMultiviewSideBySideANGLE(Context *context,
- GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLsizei numViews,
- const GLint *viewportOffsets);
-
-bool ValidateIsQuery(Context *context, GLuint id);
-
-bool ValidateUniform1ui(Context *context, GLint location, GLuint v0);
-bool ValidateUniform2ui(Context *context, GLint location, GLuint v0, GLuint v1);
-bool ValidateUniform3ui(Context *context, GLint location, GLuint v0, GLuint v1, GLuint v2);
-bool ValidateUniform4ui(Context *context,
- GLint location,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3);
-
-bool ValidateUniform1uiv(Context *context, GLint location, GLsizei count, const GLuint *value);
-bool ValidateUniform2uiv(Context *context, GLint location, GLsizei count, const GLuint *value);
-bool ValidateUniform3uiv(Context *context, GLint location, GLsizei count, const GLuint *value);
-bool ValidateUniform4uiv(Context *context, GLint location, GLsizei count, const GLuint *value);
-
-bool ValidateUniformMatrix2x3fv(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 ValidateUniformMatrix2x4fv(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 ValidateUniformMatrix3x4fv(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 ValidateEndTransformFeedback(Context *context);
-bool ValidateTransformFeedbackVaryings(Context *context,
- GLuint program,
- GLsizei count,
- const GLchar *const *varyings,
- GLenum bufferMode);
-bool ValidateGetTransformFeedbackVarying(Context *context,
- GLuint program,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLsizei *size,
- GLenum *type,
- GLchar *name);
-bool ValidateBindTransformFeedback(Context *context, GLenum target, GLuint id);
-bool ValidateIsTransformFeedback(Context *context, GLuint id);
-bool ValidatePauseTransformFeedback(Context *context);
-bool ValidateResumeTransformFeedback(Context *context);
-bool ValidateVertexAttribI4i(Context *context, GLuint index, GLint x, GLint y, GLint z, GLint w);
-bool ValidateVertexAttribI4ui(Context *context,
- GLuint index,
- GLuint x,
- GLuint y,
- GLuint z,
- GLuint w);
-bool ValidateVertexAttribI4iv(Context *context, GLuint index, const GLint *v);
-bool ValidateVertexAttribI4uiv(Context *context, GLuint index, const GLuint *v);
-bool ValidateGetFragDataLocation(Context *context, GLuint program, const GLchar *name);
-bool ValidateGetUniformIndices(Context *context,
- GLuint program,
- GLsizei uniformCount,
- const GLchar *const *uniformNames,
- GLuint *uniformIndices);
-bool ValidateGetActiveUniformsiv(Context *context,
- GLuint program,
- GLsizei uniformCount,
- const GLuint *uniformIndices,
- GLenum pname,
- GLint *params);
-bool ValidateGetUniformBlockIndex(Context *context, GLuint program, const GLchar *uniformBlockName);
-bool ValidateGetActiveUniformBlockiv(Context *context,
- GLuint program,
- GLuint uniformBlockIndex,
- GLenum pname,
- GLint *params);
-bool ValidateGetActiveUniformBlockName(Context *context,
- GLuint program,
- GLuint uniformBlockIndex,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *uniformBlockName);
-bool ValidateUniformBlockBinding(Context *context,
- GLuint program,
- GLuint uniformBlockIndex,
- GLuint uniformBlockBinding);
-bool ValidateDrawArraysInstanced(Context *context,
- GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei primcount);
-
-bool ValidateFenceSync(Context *context, GLenum condition, GLbitfield flags);
-bool ValidateIsSync(Context *context, GLsync sync);
-bool ValidateDeleteSync(Context *context, GLsync sync);
-bool ValidateClientWaitSync(Context *context, GLsync sync, GLbitfield flags, GLuint64 timeout);
-bool ValidateWaitSync(Context *context, GLsync sync, GLbitfield flags, GLuint64 timeout);
-bool ValidateGetInteger64v(Context *context, GLenum pname, GLint64 *params);
-
-bool ValidateIsSampler(Context *context, GLuint sampler);
-bool ValidateBindSampler(Context *context, GLuint unit, GLuint sampler);
-bool ValidateVertexAttribDivisor(Context *context, GLuint index, GLuint divisor);
-bool ValidateTexStorage2D(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height);
-bool ValidateTexStorage3D(Context *context,
- GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth);
-
-bool ValidateGetVertexAttribIiv(Context *context, GLuint index, GLenum pname, GLint *params);
-bool ValidateGetVertexAttribIuiv(Context *context, GLuint index, GLenum pname, GLuint *params);
-bool ValidateGetBufferParameteri64v(ValidationContext *context,
- BufferBinding target,
- GLenum pname,
- GLint64 *params);
-bool ValidateSamplerParameteri(Context *context, GLuint sampler, GLenum pname, GLint param);
-bool ValidateSamplerParameteriv(Context *context,
- GLuint sampler,
- GLenum pname,
- const GLint *params);
-bool ValidateSamplerParameterf(Context *context, GLuint sampler, GLenum pname, GLfloat param);
-bool ValidateSamplerParameterfv(Context *context,
- GLuint sampler,
- GLenum pname,
- const GLfloat *params);
-bool ValidateGetSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, GLint *params);
-bool ValidateGetSamplerParameterfv(Context *context, GLuint sampler, GLenum pname, GLfloat *params);
-bool ValidateGetInternalformativ(Context *context,
- GLenum target,
- GLenum internalformat,
- GLenum pname,
- GLsizei bufSize,
- GLint *params);
-
-} // namespace gl
-
-#endif // LIBANGLE_VALIDATION_ES3_H_
diff --git a/src/3rdparty/angle/src/libANGLE/validationES31.cpp b/src/3rdparty/angle/src/libANGLE/validationES31.cpp
deleted file mode 100644
index b1bdccacf7..0000000000
--- a/src/3rdparty/angle/src/libANGLE/validationES31.cpp
+++ /dev/null
@@ -1,1786 +0,0 @@
-//
-// 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.h"
-
-#include "libANGLE/Context.h"
-#include "libANGLE/ErrorStrings.h"
-#include "libANGLE/Framebuffer.h"
-#include "libANGLE/VertexArray.h"
-#include "libANGLE/validationES.h"
-#include "libANGLE/validationES2.h"
-#include "libANGLE/validationES3.h"
-
-#include "common/utilities.h"
-
-using namespace angle;
-
-namespace gl
-{
-
-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(GLenum prop)
-{
- 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;
-
- 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_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:
- {
- 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());
-
- // TODO(jie.a.chen@intel.com): more interfaces.
- case GL_TRANSFORM_FEEDBACK_VARYING:
- UNIMPLEMENTED();
- return false;
-
- default:
- UNREACHABLE();
- return false;
- }
-}
-
-bool ValidateProgramUniform(gl::Context *context,
- GLenum valueType,
- GLuint program,
- GLint location,
- GLsizei count)
-{
- // Check for ES31 program uniform entry points
- if (context->getClientVersion() < Version(3, 1))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- const LinkedUniform *uniform = nullptr;
- gl::Program *programObject = GetValidProgram(context, program);
- return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
- ValidateUniformValue(context, valueType, uniform->type);
-}
-
-bool ValidateProgramUniformMatrix(gl::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))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- const LinkedUniform *uniform = nullptr;
- gl::Program *programObject = GetValidProgram(context, program);
- return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
- ValidateUniformMatrixValue(context, valueType, uniform->type);
-}
-
-bool ValidateVertexAttribFormatCommon(ValidationContext *context,
- GLuint attribIndex,
- GLint size,
- GLenum type,
- GLuint relativeOffset,
- GLboolean pureInteger)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- const Caps &caps = context->getCaps();
- if (relativeOffset > static_cast<GLuint>(caps.maxVertexAttribRelativeOffset))
- {
- context->handleError(
- InvalidValue()
- << "relativeOffset cannot be greater than MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.");
- 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->getGLState().getVertexArrayId() == 0)
- {
- context->handleError(InvalidOperation() << "Default vertex array object is bound.");
- return false;
- }
-
- return ValidateVertexFormatBase(context, attribIndex, size, type, pureInteger);
-}
-
-} // anonymous namespace
-
-bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLboolean *data)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- if (!ValidateRobustEntryPoint(context, bufSize))
- {
- return false;
- }
-
- if (!ValidateIndexedStateQuery(context, target, index, length))
- {
- return false;
- }
-
- if (!ValidateRobustBufferSize(context, bufSize, *length))
- {
- return false;
- }
-
- return true;
-}
-
-bool ValidateDrawIndirectBase(Context *context, GLenum mode, const void *indirect)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- // Here the third parameter 1 is only to pass the count validation.
- if (!ValidateDrawBase(context, mode, 1))
- {
- return false;
- }
-
- const State &state = context->getGLState();
-
- // 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->handleError(InvalidOperation() << "zero is bound to VERTEX_ARRAY_BINDING");
- return false;
- }
-
- gl::Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect);
- if (!drawIndirectBuffer)
- {
- context->handleError(InvalidOperation() << "zero is bound to DRAW_INDIRECT_BUFFER");
- 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->handleError(
- InvalidValue()
- << "indirect is not a multiple of the size, in basic machine units, of uint");
- return false;
- }
-
- // ANGLE_multiview spec, revision 1:
- // An INVALID_OPERATION is generated by DrawArraysIndirect and DrawElementsIndirect if the
- // number of views in the draw framebuffer is greater than 1.
- const Framebuffer *drawFramebuffer = context->getGLState().getDrawFramebuffer();
- ASSERT(drawFramebuffer != nullptr);
- if (drawFramebuffer->getNumViews() > 1)
- {
- context->handleError(
- InvalidOperation()
- << "The number of views in the active draw framebuffer is greater than 1.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateDrawArraysIndirect(Context *context, GLenum mode, const void *indirect)
-{
- const State &state = context->getGLState();
- gl::TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
- if (curTransformFeedback && curTransformFeedback->isActive() &&
- !curTransformFeedback->isPaused())
- {
- // An INVALID_OPERATION error is generated if transform feedback is active and not paused.
- context->handleError(InvalidOperation() << "transform feedback is active and not paused.");
- return false;
- }
-
- if (!ValidateDrawIndirectBase(context, mode, indirect))
- return false;
-
- gl::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->handleError(
- InvalidOperation()
- << "the command would source data beyond the end of the buffer object.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateDrawElementsIndirect(Context *context, GLenum mode, GLenum type, const void *indirect)
-{
- if (!ValidateDrawElementsBase(context, type))
- return false;
-
- const State &state = context->getGLState();
- const VertexArray *vao = state.getVertexArray();
- gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get();
- if (!elementArrayBuffer)
- {
- context->handleError(InvalidOperation() << "zero is bound to ELEMENT_ARRAY_BUFFER");
- return false;
- }
-
- if (!ValidateDrawIndirectBase(context, mode, indirect))
- return false;
-
- gl::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->handleError(
- InvalidOperation()
- << "the command would source data beyond the end of the buffer object.");
- 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))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- const LinkedUniform *uniform = nullptr;
- gl::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 ValidateGetTexLevelParameterBase(Context *context,
- GLenum target,
- GLint level,
- GLenum pname,
- GLsizei *length)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- if (length)
- {
- *length = 0;
- }
-
- if (!ValidTexLevelDestinationTarget(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
- return false;
- }
-
- if (context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target) ==
- nullptr)
- {
- context->handleError(InvalidEnum() << "No texture bound.");
- return false;
- }
-
- if (!ValidMipLevel(context, target, level))
- {
- context->handleError(InvalidValue());
- 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:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
- return false;
- }
-
- if (length)
- {
- *length = 1;
- }
- return true;
-}
-
-bool ValidateGetTexLevelParameterfv(Context *context,
- GLenum target,
- GLint level,
- GLenum pname,
- GLfloat *params)
-{
- return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr);
-}
-
-bool ValidateGetTexLevelParameteriv(Context *context,
- GLenum target,
- GLint level,
- GLenum pname,
- GLint *params)
-{
- return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr);
-}
-
-bool ValidateTexStorage2DMultisample(Context *context,
- GLenum target,
- GLsizei samples,
- GLint internalFormat,
- GLsizei width,
- GLsizei height,
- GLboolean fixedSampleLocations)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- if (target != GL_TEXTURE_2D_MULTISAMPLE)
- {
- context->handleError(InvalidEnum() << "Target must be TEXTURE_2D_MULTISAMPLE.");
- return false;
- }
-
- if (width < 1 || height < 1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize);
- return false;
- }
-
- const Caps &caps = context->getCaps();
- if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
- static_cast<GLuint>(height) > caps.max2DTextureSize)
- {
- context
- ->handleError(InvalidValue()
- << "Width and height must be less than or equal to GL_MAX_TEXTURE_SIZE.");
- return false;
- }
-
- if (samples == 0)
- {
- context->handleError(InvalidValue() << "Samples may not be zero.");
- return false;
- }
-
- const TextureCaps &formatCaps = context->getTextureCaps().get(internalFormat);
- if (!formatCaps.renderable)
- {
- context->handleError(InvalidEnum() << "SizedInternalformat must be color-renderable, "
- "depth-renderable, or stencil-renderable.");
- 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->handleError(
- InvalidEnum()
- << "Internalformat is one of the unsupported unsized base internalformats.");
- return false;
- }
-
- if (static_cast<GLuint>(samples) > formatCaps.getMaxSamples())
- {
- context->handleError(
- InvalidOperation()
- << "Samples must not be greater than maximum supported value for the format.");
- return false;
- }
-
- Texture *texture = context->getTargetTexture(target);
- if (!texture || texture->id() == 0)
- {
- context->handleError(InvalidOperation() << "Zero is bound to target.");
- return false;
- }
-
- if (texture->getImmutableFormat())
- {
- context->handleError(InvalidOperation() << "The value of TEXTURE_IMMUTABLE_FORMAT for "
- "the texture currently bound to target on "
- "the active texture unit is true.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfloat *val)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- if (pname != GL_SAMPLE_POSITION)
- {
- context->handleError(InvalidEnum() << "Pname must be SAMPLE_POSITION.");
- return false;
- }
-
- Framebuffer *framebuffer = context->getGLState().getDrawFramebuffer();
-
- if (index >= static_cast<GLuint>(framebuffer->getSamples(context)))
- {
- context->handleError(InvalidValue() << "Index must be less than the value of SAMPLES.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname, GLint param)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- if (!ValidFramebufferTarget(context, target))
- {
- context->handleError(InvalidEnum() << "Invalid framebuffer target.");
- return false;
- }
-
- switch (pname)
- {
- case GL_FRAMEBUFFER_DEFAULT_WIDTH:
- {
- GLint maxWidth = context->getCaps().maxFramebufferWidth;
- if (param < 0 || param > maxWidth)
- {
- context->handleError(
- InvalidValue()
- << "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_WIDTH.");
- return false;
- }
- break;
- }
- case GL_FRAMEBUFFER_DEFAULT_HEIGHT:
- {
- GLint maxHeight = context->getCaps().maxFramebufferHeight;
- if (param < 0 || param > maxHeight)
- {
- context->handleError(
- InvalidValue()
- << "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_HEIGHT.");
- return false;
- }
- break;
- }
- case GL_FRAMEBUFFER_DEFAULT_SAMPLES:
- {
- GLint maxSamples = context->getCaps().maxFramebufferSamples;
- if (param < 0 || param > maxSamples)
- {
- context->handleError(
- InvalidValue()
- << "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_SAMPLES.");
- return false;
- }
- break;
- }
- case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
- {
- break;
- }
- default:
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
- return false;
- }
- }
-
- const Framebuffer *framebuffer = context->getGLState().getTargetFramebuffer(target);
- ASSERT(framebuffer);
- if (framebuffer->id() == 0)
- {
- context->handleError(InvalidOperation() << "Default framebuffer is bound to target.");
- return false;
- }
- return true;
-}
-
-bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum pname, GLint *params)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- if (!ValidFramebufferTarget(context, target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget);
- 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;
- default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
- return false;
- }
-
- const Framebuffer *framebuffer = context->getGLState().getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (framebuffer->id() == 0)
- {
- context->handleError(InvalidOperation() << "Default framebuffer is bound to target.");
- return false;
- }
- return true;
-}
-
-bool ValidateGetProgramResourceIndex(Context *context,
- GLuint program,
- GLenum programInterface,
- const GLchar *name)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
- if (programObject == nullptr)
- {
- return false;
- }
-
- if (!ValidateNamedProgramInterface(programInterface))
- {
- context->handleError(InvalidEnum() << "Invalid program interface: 0x" << std::hex
- << std::uppercase << programInterface);
- return false;
- }
-
- return true;
-}
-
-bool ValidateBindVertexBuffer(ValidationContext *context,
- GLuint bindingIndex,
- GLuint buffer,
- GLintptr offset,
- GLsizei stride)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- if (!context->isBufferGenerated(buffer))
- {
- context->handleError(InvalidOperation() << "Buffer is not generated.");
- return false;
- }
-
- const Caps &caps = context->getCaps();
- if (bindingIndex >= caps.maxVertexAttribBindings)
- {
- context->handleError(InvalidValue()
- << "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
- return false;
- }
-
- if (offset < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset);
- return false;
- }
-
- if (stride < 0 || stride > caps.maxVertexAttribStride)
- {
- context->handleError(InvalidValue()
- << "stride must be between 0 and MAX_VERTEX_ATTRIB_STRIDE.");
- 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->getGLState().getVertexArrayId() == 0)
- {
- context->handleError(InvalidOperation() << "Default vertex array buffer is bound.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateVertexBindingDivisor(ValidationContext *context, GLuint bindingIndex, GLuint divisor)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- const Caps &caps = context->getCaps();
- if (bindingIndex >= caps.maxVertexAttribBindings)
- {
- context->handleError(InvalidValue()
- << "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
- 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->getGLState().getVertexArrayId() == 0)
- {
- context->handleError(InvalidOperation() << "Default vertex array object is bound.");
- return false;
- }
-
- return true;
-}
-
-bool ValidateVertexAttribFormat(ValidationContext *context,
- GLuint attribindex,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLuint relativeoffset)
-{
- return ValidateVertexAttribFormatCommon(context, attribindex, size, type, relativeoffset,
- false);
-}
-
-bool ValidateVertexAttribIFormat(ValidationContext *context,
- GLuint attribindex,
- GLint size,
- GLenum type,
- GLuint relativeoffset)
-{
- return ValidateVertexAttribFormatCommon(context, attribindex, size, type, relativeoffset, true);
-}
-
-bool ValidateVertexAttribBinding(ValidationContext *context,
- GLuint attribIndex,
- GLuint bindingIndex)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- 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->getGLState().getVertexArrayId() == 0)
- {
- context->handleError(InvalidOperation() << "Default vertex array object is bound.");
- return false;
- }
-
- const Caps &caps = context->getCaps();
- if (attribIndex >= caps.maxVertexAttributes)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxVertexAttribute);
- return false;
- }
-
- if (bindingIndex >= caps.maxVertexAttribBindings)
- {
- context->handleError(InvalidValue()
- << "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS");
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
- if (programObject == nullptr)
- {
- return false;
- }
-
- if (!ValidateNamedProgramInterface(programInterface))
- {
- context->handleError(InvalidEnum() << "Invalid program interface: 0x" << std::hex
- << std::uppercase << programInterface);
- return false;
- }
-
- if (!ValidateProgramResourceIndex(programObject, programInterface, index))
- {
- context->handleError(InvalidValue() << "Invalid index: " << index);
- return false;
- }
-
- if (bufSize < 0)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
- return false;
- }
-
- return true;
-}
-
-bool ValidateDispatchCompute(Context *context,
- GLuint numGroupsX,
- GLuint numGroupsY,
- GLuint numGroupsZ)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- const State &state = context->getGLState();
- Program *program = state.getProgram();
-
- if (program == nullptr)
- {
- context->handleError(InvalidOperation()
- << "No active program object for the compute shader stage.");
- return false;
- }
-
- if (!program->isLinked() || !program->hasLinkedComputeShader())
- {
- context->handleError(
- InvalidOperation()
- << "Program has not been successfully linked, or program contains no compute shaders.");
- return false;
- }
-
- const Caps &caps = context->getCaps();
- if (numGroupsX > caps.maxComputeWorkGroupCount[0])
- {
- context->handleError(
- InvalidValue() << "num_groups_x cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[0]="
- << caps.maxComputeWorkGroupCount[0]);
- return false;
- }
- if (numGroupsY > caps.maxComputeWorkGroupCount[1])
- {
- context->handleError(
- InvalidValue() << "num_groups_y cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[1]="
- << caps.maxComputeWorkGroupCount[1]);
- return false;
- }
- if (numGroupsZ > caps.maxComputeWorkGroupCount[2])
- {
- context->handleError(
- InvalidValue() << "num_groups_z cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[2]="
- << caps.maxComputeWorkGroupCount[2]);
- return false;
- }
-
- return true;
-}
-
-bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect)
-{
- UNIMPLEMENTED();
- return false;
-}
-
-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->handleError(InvalidValue()
- << "unit cannot be greater than or equal than MAX_IMAGE_UNITS = "
- << maxImageUnits);
- return false;
- }
-
- if (level < 0)
- {
- context->handleError(InvalidValue() << "level is negative.");
- return false;
- }
-
- if (layer < 0)
- {
- context->handleError(InvalidValue() << "layer is negative.");
- return false;
- }
-
- if (access != GL_READ_ONLY && access != GL_WRITE_ONLY && access != GL_READ_WRITE)
- {
- context->handleError(InvalidEnum() << "access is not one of the supported tokens.");
- 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->handleError(InvalidValue()
- << "format is not one of supported image unit formats.");
- return false;
- }
-
- if (texture != 0)
- {
- Texture *tex = context->getTexture(texture);
-
- if (tex == nullptr)
- {
- context->handleError(InvalidValue()
- << "texture is not the name of an existing texture object.");
- return false;
- }
-
- if (!tex->getImmutableFormat())
- {
- context->handleError(InvalidOperation()
- << "texture is not the name of an immutable texture object.");
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateGetProgramResourceLocation(Context *context,
- GLuint program,
- GLenum programInterface,
- const GLchar *name)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
- if (programObject == nullptr)
- {
- return false;
- }
-
- if (!programObject->isLinked())
- {
- context->handleError(InvalidOperation() << "Program is not successfully linked.");
- return false;
- }
-
- if (!ValidateLocationProgramInterface(programInterface))
- {
- context->handleError(InvalidEnum() << "Invalid program interface.");
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
- if (programObject == nullptr)
- {
- return false;
- }
- if (!ValidateProgramInterface(programInterface))
- {
- context->handleError(InvalidEnum() << "Invalid program interface.");
- return false;
- }
- if (propCount <= 0)
- {
- context->handleError(InvalidValue() << "Invalid propCount.");
- return false;
- }
- if (bufSize < 0)
- {
- context->handleError(InvalidValue() << "Invalid bufSize.");
- return false;
- }
- if (!ValidateProgramResourceIndex(programObject, programInterface, index))
- {
- context->handleError(InvalidValue() << "Invalid index: " << index);
- return false;
- }
- for (GLsizei i = 0; i < propCount; i++)
- {
- if (!ValidateProgramResourceProperty(props[i]))
- {
- context->handleError(InvalidEnum() << "Invalid prop.");
- return false;
- }
- if (!ValidateProgramResourcePropertyByInterface(props[i], programInterface))
- {
- context->handleError(InvalidOperation() << "Not an allowed prop for interface");
- return false;
- }
- }
- return true;
-}
-
-bool ValidateGetProgramInterfaceiv(Context *context,
- GLuint program,
- GLenum programInterface,
- GLenum pname,
- GLint *params)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- Program *programObject = GetValidProgram(context, program);
- if (programObject == nullptr)
- {
- return false;
- }
-
- if (!ValidateProgramInterface(programInterface))
- {
- context->handleError(InvalidEnum() << "Invalid program interface.");
- return false;
- }
-
- switch (pname)
- {
- case GL_ACTIVE_RESOURCES:
- case GL_MAX_NAME_LENGTH:
- case GL_MAX_NUM_ACTIVE_VARIABLES:
- break;
-
- default:
- context->handleError(InvalidEnum() << "Unknown property of program interface.");
- return false;
- }
-
- if (pname == GL_MAX_NAME_LENGTH && programInterface == GL_ATOMIC_COUNTER_BUFFER)
- {
- context->handleError(InvalidOperation()
- << "Active atomic counter resources are not assigned name strings.");
- 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->handleError(
- InvalidOperation()
- << "MAX_NUM_ACTIVE_VARIABLES requires a buffer or block interface.");
- return false;
- }
- }
-
- return true;
-}
-
-static bool ValidateGenOrDeleteES31(Context *context, GLint n)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- 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)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- if (!context->isProgramPipelineGenerated(pipeline))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ObjectNotGenerated);
- return false;
- }
-
- return true;
-}
-
-bool ValidateIsProgramPipeline(Context *context, GLuint pipeline)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- 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,
- GLenum 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)
-{
- UNIMPLEMENTED();
- return false;
-}
-
-bool ValidateMemoryBarrierByRegion(Context *context, GLbitfield barriers)
-{
- UNIMPLEMENTED();
- return false;
-}
-
-bool ValidateSampleMaski(Context *context, GLuint maskNumber, GLbitfield mask)
-{
- if (context->getClientVersion() < ES_3_1)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
- return false;
- }
-
- if (maskNumber >= context->getCaps().maxSampleMaskWords)
- {
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidSampleMaskNumber);
- return false;
- }
-
- return true;
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/validationES31.h b/src/3rdparty/angle/src/libANGLE/validationES31.h
deleted file mode 100644
index a0b76a5bcb..0000000000
--- a/src/3rdparty/angle/src/libANGLE/validationES31.h
+++ /dev/null
@@ -1,325 +0,0 @@
-//
-// 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.h: Validation functions for OpenGL ES 3.1 entry point parameters
-
-#ifndef LIBANGLE_VALIDATION_ES31_H_
-#define LIBANGLE_VALIDATION_ES31_H_
-
-#include <GLES3/gl31.h>
-
-namespace gl
-{
-class Context;
-class ValidationContext;
-
-bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLboolean *data);
-bool ValidateGetBooleani_vRobustANGLE(Context *context,
- GLenum target,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLboolean *data);
-
-bool ValidateGetTexLevelParameterfv(Context *context,
- GLenum target,
- GLint level,
- GLenum pname,
- GLfloat *params);
-bool ValidateGetTexLevelParameteriv(Context *context,
- GLenum target,
- GLint level,
- GLenum pname,
- GLint *param);
-
-bool ValidateTexStorage2DMultisample(Context *context,
- GLenum target,
- GLsizei samples,
- GLint internalFormat,
- GLsizei width,
- GLsizei height,
- GLboolean fixedSampleLocations);
-bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfloat *val);
-
-bool ValidateDrawIndirectBase(Context *context, GLenum mode, const void *indirect);
-bool ValidateDrawArraysIndirect(Context *context, GLenum mode, const void *indirect);
-bool ValidateDrawElementsIndirect(Context *context, GLenum mode, GLenum type, const void *indirect);
-
-bool ValidateProgramUniform1i(Context *context, GLuint program, GLint location, GLint v0);
-bool ValidateProgramUniform2i(Context *context, GLuint program, GLint location, GLint v0, GLint v1);
-bool ValidateProgramUniform3i(Context *context,
- GLuint program,
- GLint location,
- GLint v0,
- GLint v1,
- GLint v2);
-bool ValidateProgramUniform4i(Context *context,
- GLuint program,
- GLint location,
- GLint v0,
- GLint v1,
- GLint v2,
- GLint v3);
-bool ValidateProgramUniform1ui(Context *context, GLuint program, GLint location, GLuint v0);
-bool ValidateProgramUniform2ui(Context *context,
- GLuint program,
- GLint location,
- GLuint v0,
- GLuint v1);
-bool ValidateProgramUniform3ui(Context *context,
- GLuint program,
- GLint location,
- GLuint v0,
- GLuint v1,
- GLuint v2);
-bool ValidateProgramUniform4ui(Context *context,
- GLuint program,
- GLint location,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3);
-bool ValidateProgramUniform1f(Context *context, GLuint program, GLint location, GLfloat v0);
-bool ValidateProgramUniform2f(Context *context,
- GLuint program,
- GLint location,
- GLfloat v0,
- GLfloat v1);
-bool ValidateProgramUniform3f(Context *context,
- GLuint program,
- GLint location,
- GLfloat v0,
- GLfloat v1,
- GLfloat v2);
-bool ValidateProgramUniform4f(Context *context,
- GLuint program,
- GLint location,
- GLfloat v0,
- GLfloat v1,
- GLfloat v2,
- GLfloat v3);
-
-bool ValidateProgramUniform1iv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value);
-bool ValidateProgramUniform2iv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value);
-bool ValidateProgramUniform3iv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value);
-bool ValidateProgramUniform4iv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value);
-bool ValidateProgramUniform1uiv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- const GLuint *value);
-bool ValidateProgramUniform2uiv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- const GLuint *value);
-bool ValidateProgramUniform3uiv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- const GLuint *value);
-bool ValidateProgramUniform4uiv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- const GLuint *value);
-bool ValidateProgramUniform1fv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- const GLfloat *value);
-bool ValidateProgramUniform2fv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- const GLfloat *value);
-bool ValidateProgramUniform3fv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- const GLfloat *value);
-bool ValidateProgramUniform4fv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- const GLfloat *value);
-bool ValidateProgramUniformMatrix2fv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-bool ValidateProgramUniformMatrix2fv(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 ValidateProgramUniformMatrix4fv(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 ValidateProgramUniformMatrix3x2fv(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 ValidateProgramUniformMatrix4x2fv(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 ValidateProgramUniformMatrix4x3fv(Context *context,
- GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
-bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname, GLint param);
-bool ValidateGetFramebufferParameteriv(Context *context,
- GLenum target,
- GLenum pname,
- GLint *params);
-
-bool ValidateGetProgramResourceIndex(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 ValidateGetProgramResourceLocation(Context *context,
- GLuint program,
- GLenum programInterface,
- const GLchar *name);
-
-bool ValidateGetProgramResourceiv(Context *context,
- GLuint program,
- GLenum programInterface,
- GLuint index,
- GLsizei propCount,
- const GLenum *props,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params);
-
-bool ValidateGetProgramInterfaceiv(Context *context,
- GLuint program,
- GLenum programInterface,
- GLenum pname,
- GLint *params);
-
-bool ValidateBindVertexBuffer(ValidationContext *context,
- GLuint bindingIndex,
- GLuint buffer,
- GLintptr offset,
- GLsizei stride);
-bool ValidateVertexAttribFormat(ValidationContext *context,
- GLuint attribindex,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLuint relativeoffset);
-bool ValidateVertexAttribIFormat(ValidationContext *context,
- GLuint attribindex,
- GLint size,
- GLenum type,
- GLuint relativeoffset);
-bool ValidateVertexAttribBinding(ValidationContext *context,
- GLuint attribIndex,
- GLuint bindingIndex);
-bool ValidateVertexBindingDivisor(ValidationContext *context, GLuint bindingIndex, GLuint divisor);
-
-bool ValidateDispatchCompute(Context *context,
- GLuint numGroupsX,
- GLuint numGroupsY,
- GLuint numGroupsZ);
-bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect);
-
-bool ValidateBindImageTexture(Context *context,
- GLuint unit,
- GLuint texture,
- GLint level,
- GLboolean layered,
- GLint layer,
- GLenum access,
- GLenum format);
-
-bool ValidateGenProgramPipelines(Context *context, GLint n, GLuint *pipelines);
-bool ValidateDeleteProgramPipelines(Context *context, GLint n, const GLuint *pipelines);
-bool ValidateBindProgramPipeline(Context *context, GLuint pipeline);
-bool ValidateIsProgramPipeline(Context *context, GLuint pipeline);
-bool ValidateUseProgramStages(Context *context, GLuint pipeline, GLbitfield stages, GLuint program);
-bool ValidateActiveShaderProgram(Context *context, GLuint pipeline, GLuint program);
-bool ValidateCreateShaderProgramv(Context *context,
- GLenum type,
- GLsizei count,
- const GLchar *const *strings);
-bool ValidateGetProgramPipelineiv(Context *context, GLuint pipeline, GLenum pname, GLint *params);
-bool ValidateValidateProgramPipeline(Context *context, GLuint pipeline);
-bool ValidateGetProgramPipelineInfoLog(Context *context,
- GLuint pipeline,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *infoLog);
-
-bool ValidateMemoryBarrier(Context *context, GLbitfield barriers);
-bool ValidateMemoryBarrierByRegion(Context *context, GLbitfield barriers);
-
-bool ValidateSampleMaski(Context *context, GLuint maskNumber, GLbitfield mask);
-
-} // namespace gl
-
-#endif // LIBANGLE_VALIDATION_ES31_H_
diff --git a/src/3rdparty/angle/src/libEGL/libEGL.cpp b/src/3rdparty/angle/src/libEGL/libEGL.cpp
deleted file mode 100644
index efe0b0c124..0000000000
--- a/src/3rdparty/angle/src/libEGL/libEGL.cpp
+++ /dev/null
@@ -1,408 +0,0 @@
-//
-// 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 "libGLESv2/entry_points_egl.h"
-#include "libGLESv2/entry_points_egl_ext.h"
-
-extern "C"
-{
-
-EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
- return egl::ChooseConfig(dpy, attrib_list, configs, config_size, num_config);
-}
-
-EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
-{
- return egl::CopyBuffers(dpy, surface, target);
-}
-
-EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
-{
- return egl::CreateContext(dpy, config, share_context, attrib_list);
-}
-
-EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
-{
- return egl::CreatePbufferSurface(dpy, config, attrib_list);
-}
-
-EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
-{
- return egl::CreatePixmapSurface(dpy, config, pixmap, attrib_list);
-}
-
-EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
-{
- return egl::CreateWindowSurface(dpy, config, win, attrib_list);
-}
-
-EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
-{
- return egl::DestroyContext(dpy, ctx);
-}
-
-EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
-{
- return egl::DestroySurface(dpy, surface);
-}
-
-EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
-{
- return egl::GetConfigAttrib(dpy, config, attribute, value);
-}
-
-EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
- return egl::GetConfigs(dpy, configs, config_size, num_config);
-}
-
-EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void)
-{
- return egl::GetCurrentDisplay();
-}
-
-EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw)
-{
- return egl::GetCurrentSurface(readdraw);
-}
-
-EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id)
-{
- return egl::GetDisplay(display_id);
-}
-
-EGLint EGLAPIENTRY eglGetError(void)
-{
- return egl::GetError();
-}
-
-EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- return egl::Initialize(dpy, major, minor);
-}
-
-EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
-{
- return egl::MakeCurrent(dpy, draw, read, ctx);
-}
-
-EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
-{
- return egl::QueryContext(dpy, ctx, attribute, value);
-}
-
-const char* EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name)
-{
- return egl::QueryString(dpy, name);
-}
-
-EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
-{
- return egl::QuerySurface(dpy, surface, attribute, value);
-}
-
-EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
-{
- return egl::SwapBuffers(dpy, surface);
-}
-
-EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy)
-{
- return egl::Terminate(dpy);
-}
-
-EGLBoolean EGLAPIENTRY eglWaitGL(void)
-{
- return egl::WaitGL();
-}
-
-EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine)
-{
- return egl::WaitNative(engine);
-}
-
-EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- return egl::BindTexImage(dpy, surface, buffer);
-}
-
-EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- return egl::ReleaseTexImage(dpy, surface, buffer);
-}
-
-EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
-{
- return egl::SurfaceAttrib(dpy, surface, attribute, value);
-}
-
-EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval)
-{
- return egl::SwapInterval(dpy, interval);
-}
-
-EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api)
-{
- return egl::BindAPI(api);
-}
-
-EGLenum EGLAPIENTRY eglQueryAPI(void)
-{
- return egl::QueryAPI();
-}
-
-EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
-{
- return egl::CreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
-}
-
-EGLBoolean EGLAPIENTRY eglReleaseThread(void)
-{
- return egl::ReleaseThread();
-}
-
-EGLBoolean EGLAPIENTRY eglWaitClient(void)
-{
- return egl::WaitClient();
-}
-
-EGLContext EGLAPIENTRY eglGetCurrentContext(void)
-{
- return egl::GetCurrentContext();
-}
-
-EGLSync EGLAPIENTRY eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
-{
- return egl::CreateSync(dpy, type, attrib_list);
-}
-
-EGLBoolean EGLAPIENTRY eglDestroySync(EGLDisplay dpy, EGLSync sync)
-{
- return egl::DestroySync(dpy, sync);
-}
-
-EGLint EGLAPIENTRY eglClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
-{
- return egl::ClientWaitSync(dpy, sync, flags, timeout);
-}
-
-EGLBoolean EGLAPIENTRY eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value)
-{
- return egl::GetSyncAttrib(dpy, sync, attribute, value);
-}
-
-EGLImage EGLAPIENTRY eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list)
-{
- return egl::CreateImage(dpy, ctx, target, buffer, attrib_list);
-}
-
-EGLBoolean EGLAPIENTRY eglDestroyImage(EGLDisplay dpy, EGLImage image)
-{
- return egl::DestroyImage(dpy, image);
-}
-
-EGLDisplay EGLAPIENTRY eglGetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list)
-{
- return egl::GetPlatformDisplay(platform, native_display, attrib_list);
-}
-
-EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list)
-{
- return egl::CreatePlatformWindowSurface(dpy, config, native_window, attrib_list);
-}
-
-EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list)
-{
- return egl::CreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list);
-}
-
-EGLBoolean EGLAPIENTRY eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
-{
- return egl::WaitSync(dpy, sync, flags);
-}
-
-EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value)
-{
- return egl::QuerySurfacePointerANGLE(dpy, surface, attribute, value);
-}
-
-EGLBoolean EGLAPIENTRY eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height)
-{
- return egl::PostSubBufferNV(dpy, surface, x, y, width, height);
-}
-
-EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
-{
- return egl::GetPlatformDisplayEXT(platform, native_display, attrib_list);
-}
-
-EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
-{
- return egl::QueryDisplayAttribEXT(dpy, attribute, value);
-}
-
-EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribute, EGLAttrib *value)
-{
- return egl::QueryDeviceAttribEXT(device, attribute, value);
-}
-
-const char * EGLAPIENTRY eglQueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
-{
- return egl::QueryDeviceStringEXT(device, name);
-}
-
-EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay dpy,
- EGLContext ctx,
- EGLenum target,
- EGLClientBuffer buffer,
- const EGLint *attrib_list)
-{
- return egl::CreateImageKHR(dpy, ctx, target, buffer, attrib_list);
-}
-
-EGLBoolean EGLAPIENTRY eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
-{
- return egl::DestroyImageKHR(dpy, image);
-}
-
-EGLDeviceEXT EGLAPIENTRY eglCreateDeviceANGLE(EGLint device_type,
- void *native_device,
- const EGLAttrib *attrib_list)
-{
- return egl::CreateDeviceANGLE(device_type, native_device, attrib_list);
-}
-
-EGLBoolean EGLAPIENTRY eglReleaseDeviceANGLE(EGLDeviceEXT device)
-{
- return egl::ReleaseDeviceANGLE(device);
-}
-
-__eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname)
-{
- return egl::GetProcAddress(procname);
-}
-
-EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list)
-{
- return egl::CreateStreamKHR(dpy, attrib_list);
-}
-
-EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream)
-{
- return egl::DestroyStreamKHR(dpy, stream);
-}
-
-EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy,
- EGLStreamKHR stream,
- EGLenum attribute,
- EGLint value)
-{
- return egl::StreamAttribKHR(dpy, stream, attribute, value);
-}
-
-EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy,
- EGLStreamKHR stream,
- EGLenum attribute,
- EGLint *value)
-{
- return egl::QueryStreamKHR(dpy, stream, attribute, value);
-}
-
-EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy,
- EGLStreamKHR stream,
- EGLenum attribute,
- EGLuint64KHR *value)
-{
- return egl::QueryStreamu64KHR(dpy, stream, attribute, value);
-}
-
-EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream)
-{
- return egl::StreamConsumerGLTextureExternalKHR(dpy, stream);
-}
-
-EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream)
-{
- return egl::StreamConsumerAcquireKHR(dpy, stream);
-}
-
-EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream)
-{
- return egl::StreamConsumerReleaseKHR(dpy, stream);
-}
-
-EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy,
- EGLStreamKHR stream,
- EGLAttrib *attrib_list)
-{
- return egl::StreamConsumerGLTextureExternalAttribsNV(dpy, stream, attrib_list);
-}
-
-EGLBoolean EGLAPIENTRY eglCreateStreamProducerD3DTextureNV12ANGLE(EGLDisplay dpy,
- EGLStreamKHR stream,
- const EGLAttrib *attrib_list)
-{
- return egl::CreateStreamProducerD3DTextureNV12ANGLE(dpy, stream, attrib_list);
-}
-
-EGLBoolean EGLAPIENTRY eglStreamPostD3DTextureNV12ANGLE(EGLDisplay dpy,
- EGLStreamKHR stream,
- void *texture,
- const EGLAttrib *attrib_list)
-{
- return egl::StreamPostD3DTextureNV12ANGLE(dpy, stream, texture, attrib_list);
-}
-
-EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy,
- EGLSurface surface,
- EGLuint64KHR *ust,
- EGLuint64KHR *msc,
- EGLuint64KHR *sbc)
-{
- return egl::GetSyncValuesCHROMIUM(dpy, surface, ust, msc, sbc);
-}
-
-EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT(EGLDisplay dpy,
- EGLSurface surface,
- EGLint *rects,
- EGLint n_rects)
-{
- return egl::SwapBuffersWithDamageEXT(dpy, surface, rects, n_rects);
-}
-
-EGLint EGLAPIENTRY eglProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib)
-{
- 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)
-{
- return egl::ProgramCacheResizeANGLE(dpy, limit, mode);
-}
-
-} // extern "C"
diff --git a/src/3rdparty/angle/src/libEGL/libEGL.def b/src/3rdparty/angle/src/libEGL/libEGL.def
deleted file mode 100644
index e68d27295e..0000000000
--- a/src/3rdparty/angle/src/libEGL/libEGL.def
+++ /dev/null
@@ -1,77 +0,0 @@
-LIBRARY libEGL
-EXPORTS
- eglBindAPI @14
- eglBindTexImage @20
- eglChooseConfig @7
- eglCopyBuffers @33
- eglCreateContext @23
- eglCreatePbufferFromClientBuffer @18
- eglCreatePbufferSurface @10
- eglCreatePixmapSurface @11
- eglCreateWindowSurface @9
- eglDestroyContext @24
- eglDestroySurface @12
- eglGetConfigAttrib @8
- eglGetConfigs @6
- eglGetCurrentContext @26
- eglGetCurrentDisplay @28
- eglGetCurrentSurface @27
- eglGetDisplay @2
- eglGetError @1
- eglGetProcAddress @34
- eglInitialize @3
- eglMakeCurrent @25
- eglQueryAPI @15
- eglQueryContext @29
- eglQueryString @5
- eglQuerySurface @13
- eglReleaseTexImage @21
- eglReleaseThread @17
- eglSurfaceAttrib @19
- eglSwapBuffers @32
- eglSwapInterval @22
- eglTerminate @4
- eglWaitClient @16
- eglWaitGL @30
- eglWaitNative @31
-
- ; 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
- eglCreateStreamProducerD3DTextureNV12ANGLE @64
- eglStreamPostD3DTextureNV12ANGLE @65
- eglGetSyncValuesCHROMIUM @66
- eglSwapBuffersWithDamageEXT @67
- eglProgramCacheGetAttribANGLE @68
- eglProgramCachePopulateANGLE @69
- eglProgramCacheQueryANGLE @70
- eglProgramCacheResizeANGLE @71
-
- ; 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/src/3rdparty/angle/src/libEGL/libEGL_mingw32.def b/src/3rdparty/angle/src/libEGL/libEGL_mingw32.def
deleted file mode 100644
index 14eb331b3a..0000000000
--- a/src/3rdparty/angle/src/libEGL/libEGL_mingw32.def
+++ /dev/null
@@ -1,77 +0,0 @@
-LIBRARY libEGL
-EXPORTS
- eglBindAPI@4 @14
- eglBindTexImage@12 @20
- eglChooseConfig@20 @7
- eglCopyBuffers@12 @33
- eglCreateContext@16 @23
- eglCreatePbufferFromClientBuffer@20 @18
- eglCreatePbufferSurface@12 @10
- eglCreatePixmapSurface@16 @11
- eglCreateWindowSurface@16 @9
- eglDestroyContext@8 @24
- eglDestroySurface@8 @12
- eglGetConfigAttrib@16 @8
- eglGetConfigs@16 @6
- eglGetCurrentContext@0 @26
- eglGetCurrentDisplay@0 @28
- eglGetCurrentSurface@4 @27
- eglGetDisplay@4 @2
- eglGetError@0 @1
- eglGetProcAddress@4 @34
- eglInitialize@12 @3
- eglMakeCurrent@16 @25
- eglQueryAPI@0 @15
- eglQueryContext@16 @29
- eglQueryString@8 @5
- eglQuerySurface@16 @13
- eglReleaseTexImage@12 @21
- eglReleaseThread@0 @17
- eglSurfaceAttrib@16 @19
- eglSwapBuffers@8 @32
- eglSwapInterval@8 @22
- eglTerminate@4 @4
- eglWaitClient@0 @16
- eglWaitGL@0 @30
- eglWaitNative@4 @31
-
- ; Extensions
- eglGetPlatformDisplayEXT@12 @35
- eglQuerySurfacePointerANGLE@16 @36
- eglPostSubBufferNV@24 @37
- eglQueryDisplayAttribEXT@12 @48
- eglQueryDeviceAttribEXT@12 @49
- eglQueryDeviceStringEXT@8 @50
- eglCreateImageKHR@20 @51
- eglDestroyImageKHR@8 @52
- eglCreateDeviceANGLE@12 @53
- eglReleaseDeviceANGLE@4 @54
- eglCreateStreamKHR@8 @55
- eglDestroyStreamKHR@8 @56
- eglStreamAttribKHR@16 @57
- eglQueryStreamKHR@16 @58
- eglQueryStreamu64KHR@16 @59
- eglStreamConsumerGLTextureExternalKHR@8 @60
- eglStreamConsumerAcquireKHR@8 @61
- eglStreamConsumerReleaseKHR@8 @62
- eglStreamConsumerGLTextureExternalAttribsNV@12 @63
- eglCreateStreamProducerD3DTextureNV12ANGLE@12 @64
- eglStreamPostD3DTextureNV12ANGLE@16 @65
- eglGetSyncValuesCHROMIUM@20 @66
- eglSwapBuffersWithDamageEXT@16 @67
- eglProgramCacheGetAttribANGLE@8 @68
- eglProgramCachePopulateANGLE@20 @69
- eglProgramCacheQueryANGLE@24 @70
- eglProgramCacheResizeANGLE@12 @71
-
- ; 1.5 entry points
- eglCreateSync@12 @38
- eglDestroySync@8 @39
- eglClientWaitSync@20 @40
- eglGetSyncAttrib@16 @41
- eglCreateImage@20 @42
- eglDestroyImage@8 @43
- eglGetPlatformDisplay@12 @44
- eglCreatePlatformWindowSurface@16 @45
- eglCreatePlatformPixmapSurface@16 @46
- eglWaitSync@12 @47
diff --git a/src/3rdparty/angle/src/libEGL/libEGLd.def b/src/3rdparty/angle/src/libEGL/libEGLd.def
deleted file mode 100644
index e6a8b1bac7..0000000000
--- a/src/3rdparty/angle/src/libEGL/libEGLd.def
+++ /dev/null
@@ -1,77 +0,0 @@
-LIBRARY libEGLd
-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
- eglCreateStreamProducerD3DTextureNV12ANGLE @64
- eglStreamPostD3DTextureNV12ANGLE @65
- eglGetSyncValuesCHROMIUM @66
- eglSwapBuffersWithDamageEXT @67
- eglProgramCacheGetAttribANGLE @68
- eglProgramCachePopulateANGLE @69
- eglProgramCacheQueryANGLE @70
- eglProgramCacheResizeANGLE @71
-
- ; 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/src/3rdparty/angle/src/libEGL/libEGLd_mingw32.def b/src/3rdparty/angle/src/libEGL/libEGLd_mingw32.def
deleted file mode 100644
index 14eb331b3a..0000000000
--- a/src/3rdparty/angle/src/libEGL/libEGLd_mingw32.def
+++ /dev/null
@@ -1,77 +0,0 @@
-LIBRARY libEGL
-EXPORTS
- eglBindAPI@4 @14
- eglBindTexImage@12 @20
- eglChooseConfig@20 @7
- eglCopyBuffers@12 @33
- eglCreateContext@16 @23
- eglCreatePbufferFromClientBuffer@20 @18
- eglCreatePbufferSurface@12 @10
- eglCreatePixmapSurface@16 @11
- eglCreateWindowSurface@16 @9
- eglDestroyContext@8 @24
- eglDestroySurface@8 @12
- eglGetConfigAttrib@16 @8
- eglGetConfigs@16 @6
- eglGetCurrentContext@0 @26
- eglGetCurrentDisplay@0 @28
- eglGetCurrentSurface@4 @27
- eglGetDisplay@4 @2
- eglGetError@0 @1
- eglGetProcAddress@4 @34
- eglInitialize@12 @3
- eglMakeCurrent@16 @25
- eglQueryAPI@0 @15
- eglQueryContext@16 @29
- eglQueryString@8 @5
- eglQuerySurface@16 @13
- eglReleaseTexImage@12 @21
- eglReleaseThread@0 @17
- eglSurfaceAttrib@16 @19
- eglSwapBuffers@8 @32
- eglSwapInterval@8 @22
- eglTerminate@4 @4
- eglWaitClient@0 @16
- eglWaitGL@0 @30
- eglWaitNative@4 @31
-
- ; Extensions
- eglGetPlatformDisplayEXT@12 @35
- eglQuerySurfacePointerANGLE@16 @36
- eglPostSubBufferNV@24 @37
- eglQueryDisplayAttribEXT@12 @48
- eglQueryDeviceAttribEXT@12 @49
- eglQueryDeviceStringEXT@8 @50
- eglCreateImageKHR@20 @51
- eglDestroyImageKHR@8 @52
- eglCreateDeviceANGLE@12 @53
- eglReleaseDeviceANGLE@4 @54
- eglCreateStreamKHR@8 @55
- eglDestroyStreamKHR@8 @56
- eglStreamAttribKHR@16 @57
- eglQueryStreamKHR@16 @58
- eglQueryStreamu64KHR@16 @59
- eglStreamConsumerGLTextureExternalKHR@8 @60
- eglStreamConsumerAcquireKHR@8 @61
- eglStreamConsumerReleaseKHR@8 @62
- eglStreamConsumerGLTextureExternalAttribsNV@12 @63
- eglCreateStreamProducerD3DTextureNV12ANGLE@12 @64
- eglStreamPostD3DTextureNV12ANGLE@16 @65
- eglGetSyncValuesCHROMIUM@20 @66
- eglSwapBuffersWithDamageEXT@16 @67
- eglProgramCacheGetAttribANGLE@8 @68
- eglProgramCachePopulateANGLE@20 @69
- eglProgramCacheQueryANGLE@24 @70
- eglProgramCacheResizeANGLE@12 @71
-
- ; 1.5 entry points
- eglCreateSync@12 @38
- eglDestroySync@8 @39
- eglClientWaitSync@20 @40
- eglGetSyncAttrib@16 @41
- eglCreateImage@20 @42
- eglDestroyImage@8 @43
- eglGetPlatformDisplay@12 @44
- eglCreatePlatformWindowSurface@16 @45
- eglCreatePlatformPixmapSurface@16 @46
- eglWaitSync@12 @47
diff --git a/src/3rdparty/angle/src/libEGL/resource.h b/src/3rdparty/angle/src/libEGL/resource.h
deleted file mode 100644
index 3921f4c077..0000000000
--- a/src/3rdparty/angle/src/libEGL/resource.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by libEGL.rc
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_egl.cpp b/src/3rdparty/angle/src/libGLESv2/entry_points_egl.cpp
deleted file mode 100644
index 97546ee900..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_egl.cpp
+++ /dev/null
@@ -1,1186 +0,0 @@
-//
-// 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/version.h"
-#include "libANGLE/Context.h"
-#include "libANGLE/Display.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.h"
-
-#include <EGL/eglext.h>
-
-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
-
-// EGL 1.0
-EGLint EGLAPIENTRY GetError(void)
-{
- EVENT("()");
- Thread *thread = GetCurrentThread();
-
- EGLint error = thread->getError();
- thread->setError(NoError());
- return error;
-}
-
-EGLDisplay EGLAPIENTRY GetDisplay(EGLNativeDisplayType display_id)
-{
- EVENT("(EGLNativeDisplayType display_id = 0x%0.8p)", display_id);
-
- return Display::GetDisplayFromNativeDisplay(display_id, AttributeMap());
-}
-
-EGLBoolean EGLAPIENTRY Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint *major = 0x%0.8p, EGLint *minor = 0x%0.8p)", dpy,
- major, minor);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- if (dpy == EGL_NO_DISPLAY || !Display::isValidDisplay(display))
- {
- thread->setError(EglBadDisplay());
- return EGL_FALSE;
- }
-
- Error error = display->initialize();
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- if (major)
- *major = 1;
- if (minor)
- *minor = 4;
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY Terminate(EGLDisplay dpy)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p)", dpy);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- if (dpy == EGL_NO_DISPLAY || !Display::isValidDisplay(display))
- {
- thread->setError(EglBadDisplay());
- return EGL_FALSE;
- }
-
- if (display->isValidContext(thread->getContext()))
- {
- thread->setCurrent(nullptr);
- }
-
- Error error = display->terminate();
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-const char *EGLAPIENTRY QueryString(EGLDisplay dpy, EGLint name)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint name = %d)", dpy, name);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- if (!(display == EGL_NO_DISPLAY && name == EGL_EXTENSIONS))
- {
- Error error = ValidateDisplay(display);
- if (error.isError())
- {
- thread->setError(error);
- return nullptr;
- }
- }
-
- const char *result;
- switch (name)
- {
- case EGL_CLIENT_APIS:
- result = "OpenGL_ES";
- break;
- case EGL_EXTENSIONS:
- if (display == EGL_NO_DISPLAY)
- {
- result = 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());
- return nullptr;
- }
-
- thread->setError(NoError());
- return result;
-}
-
-EGLBoolean EGLAPIENTRY GetConfigs(EGLDisplay dpy,
- EGLConfig *configs,
- EGLint config_size,
- EGLint *num_config)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLConfig *configs = 0x%0.8p, "
- "EGLint config_size = %d, EGLint *num_config = 0x%0.8p)",
- dpy, configs, config_size, num_config);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
-
- Error error = ValidateGetConfigs(display, config_size, num_config);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- ClipConfigs(display->getConfigs(AttributeMap()), configs, config_size, num_config);
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY ChooseConfig(EGLDisplay dpy,
- const EGLint *attrib_list,
- EGLConfig *configs,
- EGLint config_size,
- EGLint *num_config)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p, "
- "EGLConfig *configs = 0x%0.8p, EGLint config_size = %d, EGLint *num_config = 0x%0.8p)",
- dpy, attrib_list, configs, config_size, num_config);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- AttributeMap attribMap = AttributeMap::CreateFromIntArray(attrib_list);
-
- Error error = ValidateChooseConfig(display, attribMap, config_size, num_config);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- ClipConfigs(display->getConfigs(attribMap), configs, config_size, num_config);
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY GetConfigAttrib(EGLDisplay dpy,
- EGLConfig config,
- EGLint attribute,
- EGLint *value)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLint attribute = %d, EGLint "
- "*value = 0x%0.8p)",
- dpy, config, attribute, value);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Config *configuration = static_cast<Config *>(config);
-
- Error error = ValidateGetConfigAttrib(display, configuration, attribute);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- QueryConfigAttrib(configuration, attribute, value);
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLSurface EGLAPIENTRY CreateWindowSurface(EGLDisplay dpy,
- EGLConfig config,
- EGLNativeWindowType win,
- const EGLint *attrib_list)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativeWindowType win = 0x%0.8p, "
- "const EGLint *attrib_list = 0x%0.8p)",
- dpy, config, win, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Config *configuration = static_cast<Config *>(config);
- AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
-
- Error error = ValidateCreateWindowSurface(display, configuration, win, attributes);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_SURFACE;
- }
-
- egl::Surface *surface = nullptr;
- error = display->createWindowSurface(configuration, win, attributes, &surface);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_SURFACE;
- }
-
- return static_cast<EGLSurface>(surface);
-}
-
-EGLSurface EGLAPIENTRY CreatePbufferSurface(EGLDisplay dpy,
- EGLConfig config,
- const EGLint *attrib_list)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, const EGLint *attrib_list = "
- "0x%0.8p)",
- dpy, config, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Config *configuration = static_cast<Config *>(config);
- AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
-
- Error error = ValidateCreatePbufferSurface(display, configuration, attributes);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_SURFACE;
- }
-
- egl::Surface *surface = nullptr;
- error = display->createPbufferSurface(configuration, attributes, &surface);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_SURFACE;
- }
-
- return static_cast<EGLSurface>(surface);
-}
-
-EGLSurface EGLAPIENTRY CreatePixmapSurface(EGLDisplay dpy,
- EGLConfig config,
- EGLNativePixmapType pixmap,
- const EGLint *attrib_list)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativePixmapType pixmap = "
- "0x%0.8p, "
- "const EGLint *attrib_list = 0x%0.8p)",
- dpy, config, pixmap, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Config *configuration = static_cast<Config *>(config);
-
- Error error = ValidateConfig(display, configuration);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_SURFACE;
- }
-
- UNIMPLEMENTED(); // FIXME
-
- thread->setError(NoError());
- return EGL_NO_SURFACE;
-}
-
-EGLBoolean EGLAPIENTRY DestroySurface(EGLDisplay dpy, EGLSurface surface)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Surface *eglSurface = static_cast<Surface *>(surface);
-
- Error error = ValidateSurface(display, eglSurface);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- if (surface == EGL_NO_SURFACE)
- {
- thread->setError(EglBadSurface());
- return EGL_FALSE;
- }
-
- error = display->destroySurface(reinterpret_cast<Surface *>(surface));
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy,
- EGLSurface surface,
- EGLint attribute,
- EGLint *value)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint "
- "*value = 0x%0.8p)",
- dpy, surface, attribute, value);
- Thread *thread = GetCurrentThread();
-
- const Display *display = static_cast<const Display *>(dpy);
- const Surface *eglSurface = static_cast<const Surface *>(surface);
-
- Error error = ValidateQuerySurface(display, eglSurface, attribute, value);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- QuerySurfaceAttrib(eglSurface, attribute, value);
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy,
- EGLConfig config,
- EGLContext share_context,
- const EGLint *attrib_list)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLContext share_context = "
- "0x%0.8p, "
- "const EGLint *attrib_list = 0x%0.8p)",
- dpy, config, share_context, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Config *configuration = static_cast<Config *>(config);
- gl::Context *sharedGLContext = static_cast<gl::Context *>(share_context);
- AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
-
- Error error = ValidateCreateContext(display, configuration, sharedGLContext, attributes);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_CONTEXT;
- }
-
- gl::Context *context = nullptr;
- error = display->createContext(configuration, sharedGLContext, attributes, &context);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_CONTEXT;
- }
-
- thread->setError(NoError());
- return static_cast<EGLContext>(context);
-}
-
-EGLBoolean EGLAPIENTRY DestroyContext(EGLDisplay dpy, EGLContext ctx)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p)", dpy, ctx);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- gl::Context *context = static_cast<gl::Context *>(ctx);
-
- Error error = ValidateContext(display, context);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- if (ctx == EGL_NO_CONTEXT)
- {
- thread->setError(EglBadContext());
- return EGL_FALSE;
- }
-
- if (context == thread->getContext())
- {
- thread->setCurrent(nullptr);
- }
-
- error = display->destroyContext(context);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLSurface draw = 0x%0.8p, EGLSurface read = 0x%0.8p, "
- "EGLContext ctx = 0x%0.8p)",
- dpy, draw, read, ctx);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- gl::Context *context = static_cast<gl::Context *>(ctx);
-
- Error error = ValidateMakeCurrent(display, draw, read, context);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- Surface *readSurface = static_cast<Surface *>(read);
- Surface *drawSurface = static_cast<Surface *>(draw);
- Error makeCurrentError = display->makeCurrent(drawSurface, readSurface, context);
- if (makeCurrentError.isError())
- {
- thread->setError(makeCurrentError);
- return EGL_FALSE;
- }
-
- gl::Context *previousContext = thread->getContext();
- thread->setCurrent(context);
-
- // Release the surface from the previously-current context, to allow
- // destroyed surfaces to delete themselves.
- if (previousContext != nullptr && context != previousContext)
- {
- auto err = previousContext->releaseSurface(display);
- if (err.isError())
- {
- thread->setError(err);
- return EGL_FALSE;
- }
- }
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLSurface EGLAPIENTRY GetCurrentSurface(EGLint readdraw)
-{
- EVENT("(EGLint readdraw = %d)", readdraw);
- Thread *thread = GetCurrentThread();
-
- if (readdraw == EGL_READ)
- {
- thread->setError(NoError());
- return thread->getCurrentReadSurface();
- }
- else if (readdraw == EGL_DRAW)
- {
- thread->setError(NoError());
- return thread->getCurrentDrawSurface();
- }
- else
- {
- thread->setError(EglBadParameter());
- return EGL_NO_SURFACE;
- }
-}
-
-EGLDisplay EGLAPIENTRY GetCurrentDisplay(void)
-{
- EVENT("()");
- Thread *thread = GetCurrentThread();
-
- thread->setError(NoError());
- if (thread->getContext() != nullptr)
- {
- return thread->getContext()->getCurrentDisplay();
- }
- return EGL_NO_DISPLAY;
-}
-
-EGLBoolean EGLAPIENTRY QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p, EGLint attribute = %d, EGLint *value "
- "= 0x%0.8p)",
- dpy, ctx, attribute, value);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- gl::Context *context = static_cast<gl::Context *>(ctx);
-
- Error error = ValidateQueryContext(display, context, attribute, value);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- QueryContextAttrib(context, attribute, value);
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY WaitGL(void)
-{
- EVENT("()");
- Thread *thread = GetCurrentThread();
-
- Display *display = thread->getCurrentDisplay();
-
- Error error = ValidateDisplay(display);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- // eglWaitGL like calling eglWaitClient with the OpenGL ES API bound. Since we only implement
- // OpenGL ES we can do the call directly.
- error = display->waitClient(thread->getContext());
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY WaitNative(EGLint engine)
-{
- EVENT("(EGLint engine = %d)", engine);
- Thread *thread = GetCurrentThread();
-
- Display *display = thread->getCurrentDisplay();
-
- Error error = ValidateDisplay(display);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- if (engine != EGL_CORE_NATIVE_ENGINE)
- {
- thread->setError(EglBadParameter() << "the 'engine' parameter has an unrecognized value");
- }
-
- error = display->waitNative(thread->getContext(), engine);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY SwapBuffers(EGLDisplay dpy, EGLSurface surface)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Surface *eglSurface = (Surface *)surface;
-
- Error error = ValidateSurface(display, eglSurface);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- if (display->testDeviceLost())
- {
- thread->setError(EglContextLost());
- return EGL_FALSE;
- }
-
- if (surface == EGL_NO_SURFACE)
- {
- thread->setError(EglBadSurface());
- return EGL_FALSE;
- }
-
- if (!thread->getContext() || thread->getCurrentDrawSurface() != eglSurface)
- {
- thread->setError(EglBadSurface());
- return EGL_FALSE;
- }
-
- error = eglSurface->swap(thread->getContext());
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLNativePixmapType target = "
- "0x%0.8p)",
- dpy, surface, target);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Surface *eglSurface = static_cast<Surface *>(surface);
-
- Error error = ValidateSurface(display, eglSurface);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- if (display->testDeviceLost())
- {
- thread->setError(EglContextLost());
- return EGL_FALSE;
- }
-
- UNIMPLEMENTED(); // FIXME
-
- thread->setError(NoError());
- return 0;
-}
-
-// EGL 1.1
-EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)", dpy,
- surface, buffer);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Surface *eglSurface = static_cast<Surface *>(surface);
-
- Error error = ValidateSurface(display, eglSurface);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- if (buffer != EGL_BACK_BUFFER)
- {
- thread->setError(EglBadParameter());
- return EGL_FALSE;
- }
-
- if (surface == EGL_NO_SURFACE || eglSurface->getType() == EGL_WINDOW_BIT)
- {
- thread->setError(EglBadSurface());
- return EGL_FALSE;
- }
-
- if (eglSurface->getBoundTexture())
- {
- thread->setError(EglBadAccess());
- return EGL_FALSE;
- }
-
- if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE)
- {
- thread->setError(EglBadMatch());
- return EGL_FALSE;
- }
-
- gl::Context *context = thread->getContext();
- if (context)
- {
- gl::Texture *textureObject = context->getTargetTexture(GL_TEXTURE_2D);
- ASSERT(textureObject != nullptr);
-
- if (textureObject->getImmutableFormat())
- {
- thread->setError(EglBadMatch());
- return EGL_FALSE;
- }
-
- error = eglSurface->bindTexImage(context, textureObject, buffer);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
- }
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY SurfaceAttrib(EGLDisplay dpy,
- EGLSurface surface,
- EGLint attribute,
- EGLint value)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint "
- "value = %d)",
- dpy, surface, attribute, value);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Surface *eglSurface = static_cast<Surface *>(surface);
-
- Error error = ValidateSurfaceAttrib(display, eglSurface, attribute, value);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- SetSurfaceAttrib(eglSurface, attribute, value);
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)", dpy,
- surface, buffer);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Surface *eglSurface = static_cast<Surface *>(surface);
-
- Error error = ValidateSurface(display, eglSurface);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- if (buffer != EGL_BACK_BUFFER)
- {
- thread->setError(EglBadParameter());
- return EGL_FALSE;
- }
-
- if (surface == EGL_NO_SURFACE || eglSurface->getType() == EGL_WINDOW_BIT)
- {
- thread->setError(EglBadSurface());
- return EGL_FALSE;
- }
-
- if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE)
- {
- thread->setError(EglBadMatch());
- return EGL_FALSE;
- }
-
- gl::Texture *texture = eglSurface->getBoundTexture();
-
- if (texture)
- {
- error = eglSurface->releaseTexImage(thread->getContext(), buffer);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
- }
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY SwapInterval(EGLDisplay dpy, EGLint interval)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint interval = %d)", dpy, interval);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
-
- Error error = ValidateDisplay(display);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- Surface *draw_surface = static_cast<Surface *>(thread->getCurrentDrawSurface());
-
- if (draw_surface == nullptr)
- {
- thread->setError(EglBadSurface());
- return 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->setError(NoError());
- return EGL_TRUE;
-}
-
-// EGL 1.2
-EGLBoolean EGLAPIENTRY BindAPI(EGLenum api)
-{
- EVENT("(EGLenum api = 0x%X)", api);
- Thread *thread = GetCurrentThread();
-
- switch (api)
- {
- case EGL_OPENGL_API:
- case EGL_OPENVG_API:
- thread->setError(EglBadParameter());
- return EGL_FALSE; // Not supported by this implementation
- case EGL_OPENGL_ES_API:
- break;
- default:
- thread->setError(EglBadParameter());
- return EGL_FALSE;
- }
-
- thread->setAPI(api);
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLenum EGLAPIENTRY QueryAPI(void)
-{
- EVENT("()");
- Thread *thread = GetCurrentThread();
-
- EGLenum API = thread->getAPI();
-
- thread->setError(NoError());
- return API;
-}
-
-EGLSurface EGLAPIENTRY CreatePbufferFromClientBuffer(EGLDisplay dpy,
- EGLenum buftype,
- EGLClientBuffer buffer,
- EGLConfig config,
- const EGLint *attrib_list)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLenum buftype = 0x%X, EGLClientBuffer buffer = 0x%0.8p, "
- "EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)",
- dpy, buftype, buffer, config, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Config *configuration = static_cast<Config *>(config);
- AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
-
- Error error =
- ValidateCreatePbufferFromClientBuffer(display, buftype, buffer, configuration, attributes);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_SURFACE;
- }
-
- egl::Surface *surface = nullptr;
- error = display->createPbufferFromClientBuffer(configuration, buftype, buffer, attributes,
- &surface);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_SURFACE;
- }
-
- return static_cast<EGLSurface>(surface);
-}
-
-EGLBoolean EGLAPIENTRY ReleaseThread(void)
-{
- EVENT("()");
- Thread *thread = GetCurrentThread();
-
- MakeCurrent(EGL_NO_DISPLAY, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY WaitClient(void)
-{
- EVENT("()");
- Thread *thread = GetCurrentThread();
-
- Display *display = thread->getCurrentDisplay();
-
- Error error = ValidateDisplay(display);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- error = display->waitClient(thread->getContext());
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-// EGL 1.4
-EGLContext EGLAPIENTRY GetCurrentContext(void)
-{
- EVENT("()");
- Thread *thread = GetCurrentThread();
-
- gl::Context *context = thread->getContext();
-
- thread->setError(NoError());
- return static_cast<EGLContext>(context);
-}
-
-// EGL 1.5
-EGLSync EGLAPIENTRY CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLenum type = 0x%X, const EGLint* attrib_list = 0x%0.8p)",
- dpy, type, attrib_list);
- Thread *thread = GetCurrentThread();
-
- UNIMPLEMENTED();
- thread->setError(EglBadDisplay() << "eglCreateSync unimplemented.");
- return EGL_NO_SYNC;
-}
-
-EGLBoolean EGLAPIENTRY DestroySync(EGLDisplay dpy, EGLSync sync)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSync sync = 0x%0.8p)", dpy, sync);
- Thread *thread = GetCurrentThread();
-
- UNIMPLEMENTED();
- thread->setError(EglBadDisplay() << "eglDestroySync unimplemented.");
- return EGL_FALSE;
-}
-
-EGLint EGLAPIENTRY ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLSync sync = 0x%0.8p, EGLint flags = 0x%X, EGLTime timeout = "
- "%d)",
- dpy, sync, flags, timeout);
- Thread *thread = GetCurrentThread();
-
- UNIMPLEMENTED();
- thread->setError(EglBadDisplay() << "eglClientWaitSync unimplemented.");
- return 0;
-}
-
-EGLBoolean EGLAPIENTRY GetSyncAttrib(EGLDisplay dpy,
- EGLSync sync,
- EGLint attribute,
- EGLAttrib *value)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLSync sync = 0x%0.8p, EGLint attribute = 0x%X, EGLAttrib "
- "*value = 0x%0.8p)",
- dpy, sync, attribute, value);
- Thread *thread = GetCurrentThread();
-
- UNIMPLEMENTED();
- thread->setError(EglBadDisplay() << "eglSyncAttrib unimplemented.");
- return EGL_FALSE;
-}
-
-EGLImage EGLAPIENTRY CreateImage(EGLDisplay dpy,
- EGLContext ctx,
- EGLenum target,
- EGLClientBuffer buffer,
- const EGLAttrib *attrib_list)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p, EGLenum target = 0x%X, "
- "EGLClientBuffer buffer = 0x%0.8p, const EGLAttrib *attrib_list = 0x%0.8p)",
- dpy, ctx, target, buffer, attrib_list);
- Thread *thread = GetCurrentThread();
-
- UNIMPLEMENTED();
- thread->setError(EglBadDisplay() << "eglCreateImage unimplemented.");
- return EGL_NO_IMAGE;
-}
-
-EGLBoolean EGLAPIENTRY DestroyImage(EGLDisplay dpy, EGLImage image)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLImage image = 0x%0.8p)", dpy, image);
- Thread *thread = GetCurrentThread();
-
- UNIMPLEMENTED();
- thread->setError(EglBadDisplay() << "eglDestroyImage unimplemented.");
- return EGL_FALSE;
-}
-
-EGLDisplay EGLAPIENTRY GetPlatformDisplay(EGLenum platform,
- void *native_display,
- const EGLAttrib *attrib_list)
-{
- EVENT(
- "(EGLenum platform = %d, void* native_display = 0x%0.8p, const EGLint* attrib_list = "
- "0x%0.8p)",
- platform, native_display, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Error err = ValidateGetPlatformDisplay(platform, native_display, attrib_list);
- thread->setError(err);
- if (err.isError())
- {
- return EGL_NO_DISPLAY;
- }
-
- const auto &attribMap = AttributeMap::CreateFromAttribArray(attrib_list);
- if (platform == EGL_PLATFORM_ANGLE_ANGLE)
- {
- return Display::GetDisplayFromNativeDisplay(
- gl::bitCast<EGLNativeDisplayType>(native_display), attribMap);
- }
- else if (platform == EGL_PLATFORM_DEVICE_EXT)
- {
- Device *eglDevice = reinterpret_cast<Device *>(native_display);
- return Display::GetDisplayFromDevice(eglDevice, attribMap);
- }
- else
- {
- UNREACHABLE();
- return EGL_NO_DISPLAY;
- }
-}
-
-EGLSurface EGLAPIENTRY CreatePlatformWindowSurface(EGLDisplay dpy,
- EGLConfig config,
- void *native_window,
- const EGLAttrib *attrib_list)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, void* native_window = 0x%0.8p, "
- "const EGLint* attrib_list = 0x%0.8p)",
- dpy, config, native_window, attrib_list);
- Thread *thread = GetCurrentThread();
-
- UNIMPLEMENTED();
- thread->setError(EglBadDisplay() << "eglCreatePlatformWindowSurface unimplemented.");
- return EGL_NO_SURFACE;
-}
-
-EGLSurface EGLAPIENTRY CreatePlatformPixmapSurface(EGLDisplay dpy,
- EGLConfig config,
- void *native_pixmap,
- const EGLAttrib *attrib_list)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, void* native_pixmap = 0x%0.8p, "
- "const EGLint* attrib_list = 0x%0.8p)",
- dpy, config, native_pixmap, attrib_list);
- Thread *thread = GetCurrentThread();
-
- UNIMPLEMENTED();
- thread->setError(EglBadDisplay() << "eglCreatePlatformPixmapSurface unimplemented.");
- return EGL_NO_SURFACE;
-}
-
-EGLBoolean EGLAPIENTRY WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSync sync = 0x%0.8p, EGLint flags = 0x%X)", dpy, sync,
- flags);
- Thread *thread = GetCurrentThread();
-
- UNIMPLEMENTED();
- thread->setError(EglBadDisplay() << "eglWaitSync unimplemented.");
- return EGL_FALSE;
-}
-
-__eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *procname)
-{
- EVENT("(const char *procname = \"%s\")", procname);
- Thread *thread = GetCurrentThread();
-
- ProcEntry *entry =
- std::lower_bound(&g_procTable[0], &g_procTable[g_numProcs], procname, CompareProc);
-
- thread->setError(NoError());
-
- if (entry == &g_procTable[g_numProcs] || strcmp(entry->first, procname) != 0)
- {
- return nullptr;
- }
-
- return entry->second;
-}
-}
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_egl.h b/src/3rdparty/angle/src/libGLESv2/entry_points_egl.h
deleted file mode 100644
index 259a209684..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_egl.h
+++ /dev/null
@@ -1,74 +0,0 @@
-//
-// 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>
-
-namespace egl
-{
-
-// EGL 1.0
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY ChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
-ANGLE_EXPORT EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
-ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
-ANGLE_EXPORT EGLSurface EGLAPIENTRY CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroyContext(EGLDisplay dpy, EGLContext ctx);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroySurface(EGLDisplay dpy, EGLSurface surface);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetCurrentDisplay(void);
-ANGLE_EXPORT EGLSurface EGLAPIENTRY GetCurrentSurface(EGLint readdraw);
-ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetDisplay(EGLNativeDisplayType display_id);
-ANGLE_EXPORT EGLint EGLAPIENTRY GetError(void);
-ANGLE_EXPORT __eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *procname);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
-ANGLE_EXPORT const char *EGLAPIENTRY QueryString(EGLDisplay dpy, EGLint name);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY SwapBuffers(EGLDisplay dpy, EGLSurface surface);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY Terminate(EGLDisplay dpy);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitGL(void);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitNative(EGLint engine);
-
-// EGL 1.1
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY SwapInterval(EGLDisplay dpy, EGLint interval);
-
-// EGL 1.2
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY BindAPI(EGLenum api);
-ANGLE_EXPORT EGLenum EGLAPIENTRY QueryAPI(void);
-ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY ReleaseThread(void);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitClient(void);
-
-// EGL 1.4
-ANGLE_EXPORT EGLContext EGLAPIENTRY GetCurrentContext(void);
-
-// EGL 1.5
-ANGLE_EXPORT EGLSync EGLAPIENTRY CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroySync(EGLDisplay dpy, EGLSync sync);
-ANGLE_EXPORT EGLint EGLAPIENTRY ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
-ANGLE_EXPORT EGLImage EGLAPIENTRY CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroyImage(EGLDisplay dpy, EGLImage image);
-ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
-ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
-ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags);
-
-}
-
-#endif // LIBGLESV2_ENTRYPOINTSEGL_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp b/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
deleted file mode 100644
index ee8cdb94dc..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
+++ /dev/null
@@ -1,856 +0,0 @@
-//
-// 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 "libGLESv2/global_state.h"
-
-#include "libANGLE/Context.h"
-#include "libANGLE/Display.h"
-#include "libANGLE/Device.h"
-#include "libANGLE/Surface.h"
-#include "libANGLE/Stream.h"
-#include "libANGLE/Thread.h"
-#include "libANGLE/validationEGL.h"
-
-#include "common/debug.h"
-
-namespace egl
-{
-
-// EGL_ANGLE_query_surface_pointer
-EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, void **value = 0x%0.8p)",
- dpy, surface, attribute, value);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display*>(dpy);
- Surface *eglSurface = static_cast<Surface*>(surface);
-
- Error error = ValidateSurface(display, eglSurface);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- if (!display->getExtensions().querySurfacePointer)
- {
- thread->setError(NoError());
- return EGL_FALSE;
- }
-
- if (surface == EGL_NO_SURFACE)
- {
- thread->setError(EglBadSurface());
- return EGL_FALSE;
- }
-
- // validate the attribute parameter
- switch (attribute)
- {
- case EGL_DEVICE_EXT:
- break;
- case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
- if (!display->getExtensions().surfaceD3DTexture2DShareHandle)
- {
- thread->setError(EglBadAttribute());
- return EGL_FALSE;
- }
- break;
- case EGL_DXGI_KEYED_MUTEX_ANGLE:
- if (!display->getExtensions().keyedMutex)
- {
- thread->setError(EglBadAttribute());
- return EGL_FALSE;
- }
- break;
- default:
- thread->setError(EglBadAttribute());
- return EGL_FALSE;
- }
-
- error = eglSurface->querySurfacePointerANGLE(attribute, value);
- thread->setError(error);
- return (error.isError() ? EGL_FALSE : EGL_TRUE);
-}
-
-
-// EGL_NV_post_sub_buffer
-EGLBoolean EGLAPIENTRY PostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint x = %d, EGLint y = %d, EGLint width = %d, EGLint height = %d)", dpy, surface, x, y, width, height);
- Thread *thread = GetCurrentThread();
-
- if (x < 0 || y < 0 || width < 0 || height < 0)
- {
- thread->setError(EglBadParameter());
- return EGL_FALSE;
- }
-
- Display *display = static_cast<Display*>(dpy);
- Surface *eglSurface = static_cast<Surface*>(surface);
-
- Error error = ValidateSurface(display, eglSurface);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- if (display->testDeviceLost())
- {
- thread->setError(EglContextLost());
- return EGL_FALSE;
- }
-
- if (surface == EGL_NO_SURFACE)
- {
- thread->setError(EglBadSurface());
- return EGL_FALSE;
- }
-
- if (!display->getExtensions().postSubBuffer)
- {
- // Spec is not clear about how this should be handled.
- thread->setError(NoError());
- 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);
- return EGL_FALSE;
- }
-
- thread->setError(NoError());
- return EGL_TRUE;
-}
-
-// EGL_EXT_platform_base
-EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
-{
- EVENT("(EGLenum platform = %d, void* native_display = 0x%0.8p, const EGLint* attrib_list = 0x%0.8p)",
- platform, native_display, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Error err = ValidateGetPlatformDisplayEXT(platform, native_display, attrib_list);
- thread->setError(err);
- if (err.isError())
- {
- return EGL_NO_DISPLAY;
- }
-
- const auto &attribMap = AttributeMap::CreateFromIntArray(attrib_list);
- if (platform == EGL_PLATFORM_ANGLE_ANGLE)
- {
- return Display::GetDisplayFromNativeDisplay(
- gl::bitCast<EGLNativeDisplayType>(native_display), attribMap);
- }
- else if (platform == EGL_PLATFORM_DEVICE_EXT)
- {
- Device *eglDevice = reinterpret_cast<Device *>(native_display);
- return Display::GetDisplayFromDevice(eglDevice, attribMap);
- }
- else
- {
- UNREACHABLE();
- return EGL_NO_DISPLAY;
- }
-}
-
-// EGL_EXT_device_query
-EGLBoolean EGLAPIENTRY QueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribute, EGLAttrib *value)
-{
- EVENT("(EGLDeviceEXT device = 0x%0.8p, EGLint attribute = %d, EGLAttrib *value = 0x%0.8p)",
- device, attribute, value);
- Thread *thread = GetCurrentThread();
-
- Device *dev = static_cast<Device*>(device);
- if (dev == EGL_NO_DEVICE_EXT || !Device::IsValidDevice(dev))
- {
- thread->setError(EglBadAccess());
- 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
- Display *owningDisplay = dev->getOwningDisplay();
- if (owningDisplay != nullptr && !owningDisplay->getExtensions().deviceQuery)
- {
- thread->setError(EglBadAccess() << "Device wasn't created using eglCreateDeviceANGLE, "
- "and the Display that created it doesn't support "
- "device querying");
- return EGL_FALSE;
- }
-
- Error error(NoError());
-
- // 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());
- return EGL_FALSE;
- }
- error = dev->getDevice(value);
- break;
- default:
- thread->setError(EglBadAttribute());
- return EGL_FALSE;
- }
-
- thread->setError(error);
- return (error.isError() ? EGL_FALSE : EGL_TRUE);
-}
-
-// EGL_EXT_device_query
-const char * EGLAPIENTRY QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
-{
- EVENT("(EGLDeviceEXT device = 0x%0.8p, EGLint name = %d)",
- device, name);
- Thread *thread = GetCurrentThread();
-
- Device *dev = static_cast<Device*>(device);
- if (dev == EGL_NO_DEVICE_EXT || !Device::IsValidDevice(dev))
- {
- thread->setError(EglBadDevice());
- return nullptr;
- }
-
- const char *result;
- switch (name)
- {
- case EGL_EXTENSIONS:
- result = dev->getExtensionString().c_str();
- break;
- default:
- thread->setError(EglBadDevice());
- return nullptr;
- }
-
- thread->setError(NoError());
- return result;
-}
-
-// EGL_EXT_device_query
-EGLBoolean EGLAPIENTRY QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint attribute = %d, EGLAttrib *value = 0x%0.8p)",
- dpy, attribute, value);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display*>(dpy);
-
- Error error = ValidateDisplay(display);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- if (!display->getExtensions().deviceQuery)
- {
- thread->setError(EglBadAccess());
- return EGL_FALSE;
- }
-
- // validate the attribute parameter
- switch (attribute)
- {
- case EGL_DEVICE_EXT:
- *value = reinterpret_cast<EGLAttrib>(display->getDevice());
- break;
-
- default:
- thread->setError(EglBadAttribute());
- return EGL_FALSE;
- }
-
- thread->setError(error);
- return (error.isError() ? EGL_FALSE : EGL_TRUE);
-}
-
-ANGLE_EXPORT EGLImageKHR EGLAPIENTRY CreateImageKHR(EGLDisplay dpy,
- EGLContext ctx,
- EGLenum target,
- EGLClientBuffer buffer,
- const EGLint *attrib_list)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p, EGLenum target = 0x%X, "
- "EGLClientBuffer buffer = 0x%0.8p, const EGLAttrib *attrib_list = 0x%0.8p)",
- dpy, ctx, target, buffer, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<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);
- return EGL_NO_IMAGE;
- }
-
- Image *image = nullptr;
- error = display->createImage(context, target, buffer, attributes, &image);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_IMAGE;
- }
-
- return static_cast<EGLImage>(image);
-}
-
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLImage image = 0x%0.8p)", dpy, image);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Image *img = static_cast<Image *>(image);
-
- Error error = ValidateDestroyImageKHR(display, img);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- display->destroyImage(img);
-
- return EGL_TRUE;
-}
-
-ANGLE_EXPORT EGLDeviceEXT EGLAPIENTRY CreateDeviceANGLE(EGLint device_type,
- void *native_device,
- const EGLAttrib *attrib_list)
-{
- EVENT(
- "(EGLint device_type = %d, void* native_device = 0x%0.8p, const EGLAttrib* attrib_list = "
- "0x%0.8p)",
- device_type, native_device, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Error error = ValidateCreateDeviceANGLE(device_type, native_device, attrib_list);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_DEVICE_EXT;
- }
-
- Device *device = nullptr;
- error = Device::CreateDevice(native_device, device_type, &device);
- if (error.isError())
- {
- ASSERT(device == nullptr);
- thread->setError(error);
- return EGL_NO_DEVICE_EXT;
- }
-
- return device;
-}
-
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY ReleaseDeviceANGLE(EGLDeviceEXT device)
-{
- EVENT("(EGLDeviceEXT device = 0x%0.8p)", device);
- Thread *thread = GetCurrentThread();
-
- Device *dev = static_cast<Device *>(device);
-
- Error error = ValidateReleaseDeviceANGLE(dev);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- SafeDelete(dev);
-
- return EGL_TRUE;
-}
-
-// EGL_KHR_stream
-EGLStreamKHR EGLAPIENTRY CreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, const EGLAttrib* attrib_list = 0x%0.8p)", dpy, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
-
- Error error = ValidateCreateStreamKHR(display, attributes);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_STREAM_KHR;
- }
-
- Stream *stream;
- error = display->createStream(attributes, &stream);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_NO_STREAM_KHR;
- }
-
- thread->setError(error);
- return static_cast<EGLStreamKHR>(stream);
-}
-
-EGLBoolean EGLAPIENTRY DestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR = 0x%0.8p)", dpy, stream);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Stream *streamObject = static_cast<Stream *>(stream);
-
- Error error = ValidateDestroyStreamKHR(display, streamObject);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- display->destroyStream(streamObject);
- thread->setError(error);
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY StreamAttribKHR(EGLDisplay dpy,
- EGLStreamKHR stream,
- EGLenum attribute,
- EGLint value)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR stream = 0x%0.8p, EGLenum attribute = 0x%X, "
- "EGLint value = 0x%X)",
- dpy, stream, attribute, value);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Stream *streamObject = static_cast<Stream *>(stream);
-
- Error error = ValidateStreamAttribKHR(display, streamObject, attribute, value);
- if (error.isError())
- {
- thread->setError(error);
- 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->setError(error);
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY QueryStreamKHR(EGLDisplay dpy,
- EGLStreamKHR stream,
- EGLenum attribute,
- EGLint *value)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR stream = 0x%0.8p, EGLenum attribute = 0x%X, "
- "EGLint value = 0x%0.8p)",
- dpy, stream, attribute, value);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Stream *streamObject = static_cast<Stream *>(stream);
-
- Error error = ValidateQueryStreamKHR(display, streamObject, attribute, value);
- if (error.isError())
- {
- thread->setError(error);
- 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->setError(error);
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY QueryStreamu64KHR(EGLDisplay dpy,
- EGLStreamKHR stream,
- EGLenum attribute,
- EGLuint64KHR *value)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR stream = 0x%0.8p, EGLenum attribute = 0x%X, "
- "EGLuint64KHR value = 0x%0.8p)",
- dpy, stream, attribute, value);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Stream *streamObject = static_cast<Stream *>(stream);
-
- Error error = ValidateQueryStreamu64KHR(display, streamObject, attribute, value);
- if (error.isError())
- {
- thread->setError(error);
- 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->setError(error);
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY StreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR = 0x%0.8p)", dpy, stream);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<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);
- return EGL_FALSE;
- }
-
- error = streamObject->createConsumerGLTextureExternal(AttributeMap(), context);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(error);
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY StreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR = 0x%0.8p)", dpy, stream);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<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);
- return EGL_FALSE;
- }
-
- error = streamObject->consumerAcquire(context);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(error);
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY StreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR = 0x%0.8p)", dpy, stream);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<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);
- return EGL_FALSE;
- }
-
- error = streamObject->consumerRelease(context);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(error);
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY StreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy,
- EGLStreamKHR stream,
- const EGLAttrib *attrib_list)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR stream = 0x%0.8p, EGLAttrib attrib_list = 0x%0.8p",
- dpy, stream, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<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);
- return EGL_FALSE;
- }
-
- error = streamObject->createConsumerGLTextureExternal(attributes, context);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(error);
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY CreateStreamProducerD3DTextureNV12ANGLE(EGLDisplay dpy,
- EGLStreamKHR stream,
- const EGLAttrib *attrib_list)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR stream = 0x%0.8p, EGLAttrib attrib_list = 0x%0.8p",
- dpy, stream, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Stream *streamObject = static_cast<Stream *>(stream);
- AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
-
- Error error =
- ValidateCreateStreamProducerD3DTextureNV12ANGLE(display, streamObject, attributes);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- error = streamObject->createProducerD3D11TextureNV12(attributes);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(error);
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY StreamPostD3DTextureNV12ANGLE(EGLDisplay dpy,
- EGLStreamKHR stream,
- void *texture,
- const EGLAttrib *attrib_list)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR stream = 0x%0.8p, void* texture = 0x%0.8p, "
- "EGLAttrib attrib_list = 0x%0.8p",
- dpy, stream, texture, attrib_list);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Stream *streamObject = static_cast<Stream *>(stream);
- AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
-
- Error error = ValidateStreamPostD3DTextureNV12ANGLE(display, streamObject, texture, attributes);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- error = streamObject->postD3D11NV12Texture(texture, attributes);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(error);
- return EGL_TRUE;
-}
-
-EGLBoolean EGLAPIENTRY GetSyncValuesCHROMIUM(EGLDisplay dpy,
- EGLSurface surface,
- EGLuint64KHR *ust,
- EGLuint64KHR *msc,
- EGLuint64KHR *sbc)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLuint64KHR* ust = 0x%0.8p, "
- "EGLuint64KHR* msc = 0x%0.8p, EGLuint64KHR* sbc = 0x%0.8p",
- dpy, surface, ust, msc, sbc);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Surface *eglSurface = static_cast<Surface *>(surface);
-
- Error error = ValidateGetSyncValuesCHROMIUM(display, eglSurface, ust, msc, sbc);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- error = eglSurface->getSyncValues(ust, msc, sbc);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- thread->setError(error);
- return EGL_TRUE;
-}
-
-ANGLE_EXPORT EGLBoolean SwapBuffersWithDamageEXT(EGLDisplay dpy,
- EGLSurface surface,
- EGLint *rects,
- EGLint n_rects)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint *rects = 0x%0.8p, EGLint "
- "n_rects = %d)",
- dpy, surface, rects, n_rects);
- Thread *thread = GetCurrentThread();
-
- Display *display = static_cast<Display *>(dpy);
- Surface *eglSurface = static_cast<Surface *>(surface);
-
- Error error = ValidateSwapBuffersWithDamageEXT(display, eglSurface, rects, n_rects);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- error = eglSurface->swapWithDamage(thread->getContext(), rects, n_rects);
- if (error.isError())
- {
- thread->setError(error);
- return EGL_FALSE;
- }
-
- return EGL_TRUE;
-}
-
-EGLint EGLAPIENTRY ProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLenum attrib = 0x%X)", dpy, attrib);
-
- Display *display = static_cast<Display *>(dpy);
- Thread *thread = GetCurrentThread();
-
- ANGLE_EGL_TRY_RETURN(thread, ValidateProgramCacheGetAttribANGLE(display, attrib), 0);
-
- return display->programCacheGetAttrib(attrib);
-}
-
-void EGLAPIENTRY ProgramCacheQueryANGLE(EGLDisplay dpy,
- EGLint index,
- void *key,
- EGLint *keysize,
- void *binary,
- EGLint *binarysize)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLint index = %d, void *key = 0x%0.8p, EGLint *keysize = "
- "0x%0.8p, void *binary = 0x%0.8p, EGLint *size = 0x%0.8p)",
- dpy, index, key, keysize, binary, binarysize);
-
- Display *display = static_cast<Display *>(dpy);
- Thread *thread = GetCurrentThread();
-
- ANGLE_EGL_TRY(thread,
- ValidateProgramCacheQueryANGLE(display, index, key, keysize, binary, binarysize));
-
- ANGLE_EGL_TRY(thread, display->programCacheQuery(index, key, keysize, binary, binarysize));
-}
-
-void EGLAPIENTRY ProgramCachePopulateANGLE(EGLDisplay dpy,
- const void *key,
- EGLint keysize,
- const void *binary,
- EGLint binarysize)
-{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, void *key = 0x%0.8p, EGLint keysize = %d, void *binary = "
- "0x%0.8p, EGLint *size = 0x%0.8p)",
- dpy, key, keysize, binary, binarysize);
-
- Display *display = static_cast<Display *>(dpy);
- Thread *thread = GetCurrentThread();
-
- ANGLE_EGL_TRY(thread,
- ValidateProgramCachePopulateANGLE(display, key, keysize, binary, binarysize));
-
- ANGLE_EGL_TRY(thread, display->programCachePopulate(key, keysize, binary, binarysize));
-}
-
-EGLint EGLAPIENTRY ProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limit, EGLenum mode)
-{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint limit = %d, EGLenum mode = 0x%X)", dpy, limit, mode);
-
- Display *display = static_cast<Display *>(dpy);
- Thread *thread = GetCurrentThread();
-
- ANGLE_EGL_TRY_RETURN(thread, ValidateProgramCacheResizeANGLE(display, limit, mode), 0);
-
- return display->programCacheResize(limit, mode);
-}
-
-} // namespace egl
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.h b/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.h
deleted file mode 100644
index 3cde6ec9c6..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.h
+++ /dev/null
@@ -1,113 +0,0 @@
-//
-// 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>
-
-namespace egl
-{
-
-// EGL_ANGLE_query_surface_pointer
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
-
-// EGL_NV_post_sub_buffer
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY PostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
-
-// EGL_EXT_platform_base
-ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list);
-
-// EGL_EXT_device_query
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
-ANGLE_EXPORT const char * EGLAPIENTRY QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name);
-
-// EGL_KHR_image_base/EGL_KHR_image
-ANGLE_EXPORT EGLImageKHR EGLAPIENTRY CreateImageKHR(EGLDisplay dpy,
- EGLContext ctx,
- EGLenum target,
- EGLClientBuffer buffer,
- const EGLint *attrib_list);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image);
-
-// EGL_EXT_device_creation
-ANGLE_EXPORT EGLDeviceEXT EGLAPIENTRY CreateDeviceANGLE(EGLint device_type,
- void *native_device,
- const EGLAttrib *attrib_list);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY ReleaseDeviceANGLE(EGLDeviceEXT device);
-
-// EGL_KHR_stream
-ANGLE_EXPORT EGLStreamKHR EGLAPIENTRY CreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY StreamAttribKHR(EGLDisplay dpy,
- EGLStreamKHR stream,
- EGLenum attribute,
- EGLint value);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryStreamKHR(EGLDisplay dpy,
- EGLStreamKHR stream,
- EGLenum attribute,
- EGLint *value);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryStreamu64KHR(EGLDisplay dpy,
- EGLStreamKHR stream,
- EGLenum attribute,
- EGLuint64KHR *value);
-
-// EGL_KHR_stream_consumer_gltexture
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY StreamConsumerGLTextureExternalKHR(EGLDisplay dpy,
- EGLStreamKHR stream);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY StreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY StreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY
-StreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy,
- EGLStreamKHR stream,
- const EGLAttrib *attrib_list);
-
-// EGL_ANGLE_stream_producer_d3d_texture_nv12
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY
-CreateStreamProducerD3DTextureNV12ANGLE(EGLDisplay dpy,
- EGLStreamKHR stream,
- const EGLAttrib *attrib_list);
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY StreamPostD3DTextureNV12ANGLE(EGLDisplay dpy,
- EGLStreamKHR stream,
- void *texture,
- const EGLAttrib *attrib_list);
-
-// EGL_CHROMIUM_get_sync_values
-ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetSyncValuesCHROMIUM(EGLDisplay dpy,
- EGLSurface surface,
- EGLuint64KHR *ust,
- EGLuint64KHR *msc,
- EGLuint64KHR *sbc);
-
-// EGL_EXT_swap_buffers_with_damage
-ANGLE_EXPORT EGLBoolean SwapBuffersWithDamageEXT(EGLDisplay dpy,
- EGLSurface surface,
- EGLint *rects,
- EGLint n_rects);
-
-//
-ANGLE_EXPORT EGLint EGLAPIENTRY ProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib);
-ANGLE_EXPORT void EGLAPIENTRY ProgramCacheQueryANGLE(EGLDisplay dpy,
- EGLint index,
- void *key,
- EGLint *keysize,
- void *binary,
- EGLint *binarysize);
-ANGLE_EXPORT void EGLAPIENTRY ProgramCachePopulateANGLE(EGLDisplay dpy,
- const void *key,
- EGLint keysize,
- const void *binary,
- EGLint binarysize);
-ANGLE_EXPORT EGLint EGLAPIENTRY ProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limit, EGLenum mode);
-
-} // namespace egl
-
-#endif // LIBGLESV2_ENTRYPOINTSEGLEXT_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_autogen.cpp b/src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_autogen.cpp
deleted file mode 100644
index ae0e944406..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_autogen.cpp
+++ /dev/null
@@ -1,2612 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by generate_entry_points.py using data from gl.xml.
-//
-// 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.
-//
-// entry_points_gles_2_0_autogen.cpp:
-// Defines the GLES 2.0 entry points.
-
-#include "libANGLE/Context.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)
- {
- context->gatherParams<EntryPoint::ActiveTexture>(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)
- {
- context->gatherParams<EntryPoint::AttachShader>(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%0.8p)", program, index,
- name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::BindAttribLocation>(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);
- context->gatherParams<EntryPoint::BindBuffer>(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)
- {
- context->gatherParams<EntryPoint::BindFramebuffer>(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)
- {
- context->gatherParams<EntryPoint::BindRenderbuffer>(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)
- {
- context->gatherParams<EntryPoint::BindTexture>(target, texture);
-
- if (context->skipValidation() || ValidateBindTexture(context, target, texture))
- {
- context->bindTexture(target, 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)
- {
- context->gatherParams<EntryPoint::BlendColor>(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)
- {
- context->gatherParams<EntryPoint::BlendEquation>(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)
- {
- context->gatherParams<EntryPoint::BlendEquationSeparate>(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)
- {
- context->gatherParams<EntryPoint::BlendFunc>(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)
- {
- context->gatherParams<EntryPoint::BlendFuncSeparate>(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 = %d, const void *data = 0x%0.8p, GLenum usage = "
- "0x%X)",
- target, size, data, usage);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
- BufferUsage usagePacked = FromGLenum<BufferUsage>(usage);
- context->gatherParams<EntryPoint::BufferData>(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 = %d, GLsizeiptr size = %d, const void *data = "
- "0x%0.8p)",
- target, offset, size, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
- context->gatherParams<EntryPoint::BufferSubData>(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)
- {
- context->gatherParams<EntryPoint::CheckFramebufferStatus>(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)
- {
- context->gatherParams<EntryPoint::Clear>(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)
- {
- context->gatherParams<EntryPoint::ClearColor>(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)
- {
- context->gatherParams<EntryPoint::ClearDepthf>(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)
- {
- context->gatherParams<EntryPoint::ClearStencil>(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)
- {
- context->gatherParams<EntryPoint::ColorMask>(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)
- {
- context->gatherParams<EntryPoint::CompileShader>(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%0.8p)",
- target, level, internalformat, width, height, border, imageSize, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::CompressedTexImage2D>(
- target, level, internalformat, width, height, border, imageSize, data);
-
- if (context->skipValidation() ||
- ValidateCompressedTexImage2D(context, target, level, internalformat, width, height,
- border, imageSize, data))
- {
- context->compressedTexImage2D(target, 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%0.8p)",
- target, level, xoffset, yoffset, width, height, format, imageSize, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::CompressedTexSubImage2D>(
- target, level, xoffset, yoffset, width, height, format, imageSize, data);
-
- if (context->skipValidation() ||
- ValidateCompressedTexSubImage2D(context, target, level, xoffset, yoffset, width, height,
- format, imageSize, data))
- {
- context->compressedTexSubImage2D(target, 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)
- {
- context->gatherParams<EntryPoint::CopyTexImage2D>(target, level, internalformat, x, y,
- width, height, border);
-
- if (context->skipValidation() ||
- ValidateCopyTexImage2D(context, target, level, internalformat, x, y, width, height,
- border))
- {
- context->copyTexImage2D(target, 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)
- {
- context->gatherParams<EntryPoint::CopyTexSubImage2D>(target, level, xoffset, yoffset, x, y,
- width, height);
-
- if (context->skipValidation() || ValidateCopyTexSubImage2D(context, target, level, xoffset,
- yoffset, x, y, width, height))
- {
- context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
- }
- }
-}
-
-GLuint GL_APIENTRY CreateProgram()
-{
- EVENT("()");
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::CreateProgram>();
-
- 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)
- {
- context->gatherParams<EntryPoint::CreateShader>(type);
-
- if (context->skipValidation() || ValidateCreateShader(context, type))
- {
- return context->createShader(type);
- }
- }
-
- 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);
- context->gatherParams<EntryPoint::CullFace>(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%0.8p)", n, buffers);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DeleteBuffers>(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%0.8p)", n, framebuffers);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DeleteFramebuffers>(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)
- {
- context->gatherParams<EntryPoint::DeleteProgram>(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%0.8p)", n, renderbuffers);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DeleteRenderbuffers>(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)
- {
- context->gatherParams<EntryPoint::DeleteShader>(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%0.8p)", n, textures);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DeleteTextures>(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)
- {
- context->gatherParams<EntryPoint::DepthFunc>(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)
- {
- context->gatherParams<EntryPoint::DepthMask>(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)
- {
- context->gatherParams<EntryPoint::DepthRangef>(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)
- {
- context->gatherParams<EntryPoint::DetachShader>(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)
- {
- context->gatherParams<EntryPoint::Disable>(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)
- {
- context->gatherParams<EntryPoint::DisableVertexAttribArray>(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)
- {
- context->gatherParams<EntryPoint::DrawArrays>(mode, first, count);
-
- if (context->skipValidation() || ValidateDrawArrays(context, mode, first, count))
- {
- context->drawArrays(mode, 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%0.8p)",
- mode, count, type, indices);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DrawElements>(mode, count, type, indices);
-
- if (context->skipValidation() || ValidateDrawElements(context, mode, count, type, indices))
- {
- context->drawElements(mode, count, type, indices);
- }
- }
-}
-
-void GL_APIENTRY Enable(GLenum cap)
-{
- EVENT("(GLenum cap = 0x%X)", cap);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Enable>(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)
- {
- context->gatherParams<EntryPoint::EnableVertexAttribArray>(index);
-
- if (context->skipValidation() || ValidateEnableVertexAttribArray(context, index))
- {
- context->enableVertexAttribArray(index);
- }
- }
-}
-
-void GL_APIENTRY Finish()
-{
- EVENT("()");
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Finish>();
-
- if (context->skipValidation() || ValidateFinish(context))
- {
- context->finish();
- }
- }
-}
-
-void GL_APIENTRY Flush()
-{
- EVENT("()");
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Flush>();
-
- 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)
- {
- context->gatherParams<EntryPoint::FramebufferRenderbuffer>(
- 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)
- {
- context->gatherParams<EntryPoint::FramebufferTexture2D>(target, attachment, textarget,
- texture, level);
-
- if (context->skipValidation() ||
- ValidateFramebufferTexture2D(context, target, attachment, textarget, texture, level))
- {
- context->framebufferTexture2D(target, attachment, textarget, texture, level);
- }
- }
-}
-
-void GL_APIENTRY FrontFace(GLenum mode)
-{
- EVENT("(GLenum mode = 0x%X)", mode);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::FrontFace>(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%0.8p)", n, buffers);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GenBuffers>(n, buffers);
-
- if (context->skipValidation() || ValidateGenBuffers(context, n, buffers))
- {
- context->genBuffers(n, buffers);
- }
- }
-}
-
-void GL_APIENTRY GenerateMipmap(GLenum target)
-{
- EVENT("(GLenum target = 0x%X)", target);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GenerateMipmap>(target);
-
- if (context->skipValidation() || ValidateGenerateMipmap(context, target))
- {
- context->generateMipmap(target);
- }
- }
-}
-
-void GL_APIENTRY GenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- EVENT("(GLsizei n = %d, GLuint *framebuffers = 0x%0.8p)", n, framebuffers);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GenFramebuffers>(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%0.8p)", n, renderbuffers);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GenRenderbuffers>(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%0.8p)", n, textures);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GenTextures>(n, textures);
-
- if (context->skipValidation() || ValidateGenTextures(context, n, textures))
- {
- context->genTextures(n, textures);
- }
- }
-}
-
-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%0.8p, "
- "GLint *size = 0x%0.8p, GLenum *type = 0x%0.8p, GLchar *name = 0x%0.8p)",
- program, index, bufSize, length, size, type, name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetActiveAttrib>(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%0.8p, "
- "GLint *size = 0x%0.8p, GLenum *type = 0x%0.8p, GLchar *name = 0x%0.8p)",
- program, index, bufSize, length, size, type, name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetActiveUniform>(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%0.8p, GLuint *shaders = "
- "0x%0.8p)",
- program, maxCount, count, shaders);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetAttachedShaders>(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%0.8p)", program, name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetAttribLocation>(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%0.8p)", pname, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetBooleanv>(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%0.8p)", target, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
- context->gatherParams<EntryPoint::GetBufferParameteriv>(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)
- {
- context->gatherParams<EntryPoint::GetError>();
-
- 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%0.8p)", pname, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetFloatv>(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%0.8p)",
- target, attachment, pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetFramebufferAttachmentParameteriv>(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%0.8p)", pname, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetIntegerv>(pname, data);
-
- if (context->skipValidation() || ValidateGetIntegerv(context, pname, data))
- {
- context->getIntegerv(pname, data);
- }
- }
-}
-
-void GL_APIENTRY GetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", program, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetProgramiv>(program, pname, params);
-
- if (context->skipValidation() || ValidateGetProgramiv(context, program, pname, params))
- {
- context->getProgramiv(program, pname, params);
- }
- }
-}
-
-void GL_APIENTRY GetProgramInfoLog(GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *infoLog)
-{
- EVENT(
- "(GLuint program = %u, GLsizei bufSize = %d, GLsizei *length = 0x%0.8p, GLchar *infoLog = "
- "0x%0.8p)",
- program, bufSize, length, infoLog);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetProgramInfoLog>(program, bufSize, length, infoLog);
-
- if (context->skipValidation() ||
- ValidateGetProgramInfoLog(context, program, bufSize, length, infoLog))
- {
- context->getProgramInfoLog(program, bufSize, length, infoLog);
- }
- }
-}
-
-void GL_APIENTRY GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetRenderbufferParameteriv>(target, pname, params);
-
- if (context->skipValidation() ||
- ValidateGetRenderbufferParameteriv(context, target, pname, params))
- {
- context->getRenderbufferParameteriv(target, pname, params);
- }
- }
-}
-
-void GL_APIENTRY GetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- EVENT("(GLuint shader = %u, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", shader, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetShaderiv>(shader, pname, params);
-
- if (context->skipValidation() || ValidateGetShaderiv(context, shader, pname, params))
- {
- context->getShaderiv(shader, pname, params);
- }
- }
-}
-
-void GL_APIENTRY GetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- EVENT(
- "(GLuint shader = %u, GLsizei bufSize = %d, GLsizei *length = 0x%0.8p, GLchar *infoLog = "
- "0x%0.8p)",
- shader, bufSize, length, infoLog);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetShaderInfoLog>(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%0.8p, GLint "
- "*precision = 0x%0.8p)",
- shadertype, precisiontype, range, precision);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetShaderPrecisionFormat>(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%0.8p, GLchar *source = "
- "0x%0.8p)",
- shader, bufSize, length, source);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetShaderSource>(shader, bufSize, length, source);
-
- if (context->skipValidation() ||
- ValidateGetShaderSource(context, shader, bufSize, length, source))
- {
- context->getShaderSource(shader, bufSize, length, source);
- }
- }
-}
-
-const GLubyte *GL_APIENTRY GetString(GLenum name)
-{
- EVENT("(GLenum name = 0x%X)", name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetString>(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%0.8p)", target, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetTexParameterfv>(target, pname, params);
-
- if (context->skipValidation() || ValidateGetTexParameterfv(context, target, pname, params))
- {
- context->getTexParameterfv(target, pname, params);
- }
- }
-}
-
-void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetTexParameteriv>(target, pname, params);
-
- if (context->skipValidation() || ValidateGetTexParameteriv(context, target, pname, params))
- {
- context->getTexParameteriv(target, pname, params);
- }
- }
-}
-
-void GL_APIENTRY GetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- EVENT("(GLuint program = %u, GLint location = %d, GLfloat *params = 0x%0.8p)", program,
- location, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetUniformfv>(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%0.8p)", program, location,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetUniformiv>(program, location, params);
-
- if (context->skipValidation() || ValidateGetUniformiv(context, program, location, params))
- {
- context->getUniformiv(program, location, params);
- }
- }
-}
-
-GLint GL_APIENTRY GetUniformLocation(GLuint program, const GLchar *name)
-{
- EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)", program, name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetUniformLocation>(program, name);
-
- if (context->skipValidation() || ValidateGetUniformLocation(context, program, name))
- {
- return context->getUniformLocation(program, name);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::GetUniformLocation, GLint>();
-}
-
-void GL_APIENTRY GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLfloat *params = 0x%0.8p)", index, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetVertexAttribfv>(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%0.8p)", index, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetVertexAttribiv>(index, pname, params);
-
- if (context->skipValidation() || ValidateGetVertexAttribiv(context, index, pname, params))
- {
- context->getVertexAttribiv(index, pname, params);
- }
- }
-}
-
-void GL_APIENTRY GetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer)
-{
- EVENT("(GLuint index = %u, GLenum pname = 0x%X, void **pointer = 0x%0.8p)", index, pname,
- pointer);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetVertexAttribPointerv>(index, pname, pointer);
-
- if (context->skipValidation() ||
- ValidateGetVertexAttribPointerv(context, index, pname, pointer))
- {
- context->getVertexAttribPointerv(index, pname, pointer);
- }
- }
-}
-
-void GL_APIENTRY Hint(GLenum target, GLenum mode)
-{
- EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Hint>(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)
- {
- context->gatherParams<EntryPoint::IsBuffer>(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)
- {
- context->gatherParams<EntryPoint::IsEnabled>(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)
- {
- context->gatherParams<EntryPoint::IsFramebuffer>(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)
- {
- context->gatherParams<EntryPoint::IsProgram>(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)
- {
- context->gatherParams<EntryPoint::IsRenderbuffer>(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)
- {
- context->gatherParams<EntryPoint::IsShader>(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)
- {
- context->gatherParams<EntryPoint::IsTexture>(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)
- {
- context->gatherParams<EntryPoint::LineWidth>(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)
- {
- context->gatherParams<EntryPoint::LinkProgram>(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)
- {
- context->gatherParams<EntryPoint::PixelStorei>(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)
- {
- context->gatherParams<EntryPoint::PolygonOffset>(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%0.8p)",
- x, y, width, height, format, type, pixels);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ReadPixels>(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)
- {
- context->gatherParams<EntryPoint::ReleaseShaderCompiler>();
-
- 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)
- {
- context->gatherParams<EntryPoint::RenderbufferStorage>(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)
- {
- context->gatherParams<EntryPoint::SampleCoverage>(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)
- {
- context->gatherParams<EntryPoint::Scissor>(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%0.8p, GLenum binaryformat = 0x%X, const "
- "void *binary = 0x%0.8p, GLsizei length = %d)",
- count, shaders, binaryformat, binary, length);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ShaderBinary>(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%0.8p, const "
- "GLint *length = 0x%0.8p)",
- shader, count, string, length);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ShaderSource>(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)
- {
- context->gatherParams<EntryPoint::StencilFunc>(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)
- {
- context->gatherParams<EntryPoint::StencilFuncSeparate>(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)
- {
- context->gatherParams<EntryPoint::StencilMask>(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)
- {
- context->gatherParams<EntryPoint::StencilMaskSeparate>(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)
- {
- context->gatherParams<EntryPoint::StencilOp>(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)
- {
- context->gatherParams<EntryPoint::StencilOpSeparate>(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%0.8p)",
- target, level, internalformat, width, height, border, format, type, pixels);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::TexImage2D>(target, level, internalformat, width, height,
- border, format, type, pixels);
-
- if (context->skipValidation() ||
- ValidateTexImage2D(context, target, level, internalformat, width, height, border,
- format, type, pixels))
- {
- context->texImage2D(target, 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)
- {
- context->gatherParams<EntryPoint::TexParameterf>(target, pname, param);
-
- if (context->skipValidation() || ValidateTexParameterf(context, target, pname, param))
- {
- context->texParameterf(target, 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%0.8p)", target,
- pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::TexParameterfv>(target, pname, params);
-
- if (context->skipValidation() || ValidateTexParameterfv(context, target, pname, params))
- {
- context->texParameterfv(target, 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)
- {
- context->gatherParams<EntryPoint::TexParameteri>(target, pname, param);
-
- if (context->skipValidation() || ValidateTexParameteri(context, target, pname, param))
- {
- context->texParameteri(target, 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%0.8p)", target,
- pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::TexParameteriv>(target, pname, params);
-
- if (context->skipValidation() || ValidateTexParameteriv(context, target, pname, params))
- {
- context->texParameteriv(target, 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%0.8p)",
- target, level, xoffset, yoffset, width, height, format, type, pixels);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::TexSubImage2D>(target, level, xoffset, yoffset, width,
- height, format, type, pixels);
-
- if (context->skipValidation() ||
- ValidateTexSubImage2D(context, target, level, xoffset, yoffset, width, height, format,
- type, pixels))
- {
- context->texSubImage2D(target, 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)
- {
- context->gatherParams<EntryPoint::Uniform1f>(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%0.8p)", location,
- count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform1fv>(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)
- {
- context->gatherParams<EntryPoint::Uniform1i>(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%0.8p)", location,
- count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform1iv>(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)
- {
- context->gatherParams<EntryPoint::Uniform2f>(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%0.8p)", location,
- count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform2fv>(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)
- {
- context->gatherParams<EntryPoint::Uniform2i>(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%0.8p)", location,
- count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform2iv>(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)
- {
- context->gatherParams<EntryPoint::Uniform3f>(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%0.8p)", location,
- count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform3fv>(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)
- {
- context->gatherParams<EntryPoint::Uniform3i>(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%0.8p)", location,
- count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform3iv>(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)
- {
- context->gatherParams<EntryPoint::Uniform4f>(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%0.8p)", location,
- count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform4fv>(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)
- {
- context->gatherParams<EntryPoint::Uniform4i>(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%0.8p)", location,
- count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform4iv>(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%0.8p)",
- location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::UniformMatrix2fv>(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%0.8p)",
- location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::UniformMatrix3fv>(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%0.8p)",
- location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::UniformMatrix4fv>(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)
- {
- context->gatherParams<EntryPoint::UseProgram>(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)
- {
- context->gatherParams<EntryPoint::ValidateProgram>(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)
- {
- context->gatherParams<EntryPoint::VertexAttrib1f>(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%0.8p)", index, v);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::VertexAttrib1fv>(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)
- {
- context->gatherParams<EntryPoint::VertexAttrib2f>(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%0.8p)", index, v);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::VertexAttrib2fv>(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)
- {
- context->gatherParams<EntryPoint::VertexAttrib3f>(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%0.8p)", index, v);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::VertexAttrib3fv>(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)
- {
- context->gatherParams<EntryPoint::VertexAttrib4f>(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%0.8p)", index, v);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::VertexAttrib4fv>(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%0.8p)",
- index, size, type, normalized, stride, pointer);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::VertexAttribPointer>(index, size, type, normalized,
- stride, pointer);
-
- if (context->skipValidation() ||
- ValidateVertexAttribPointer(context, index, size, type, normalized, stride, pointer))
- {
- context->vertexAttribPointer(index, size, type, 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)
- {
- context->gatherParams<EntryPoint::Viewport>(x, y, width, height);
-
- if (context->skipValidation() || ValidateViewport(context, x, y, width, height))
- {
- context->viewport(x, y, width, height);
- }
- }
-}
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_autogen.h b/src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_autogen.h
deleted file mode 100644
index 7735b46fa4..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_autogen.h
+++ /dev/null
@@ -1,297 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by generate_entry_points.py using data from gl.xml.
-//
-// 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.
-//
-// entry_points_gles_2_0_autogen.h:
-// Defines the GLES 2.0 entry points.
-
-#ifndef LIBGLESV2_ENTRYPOINTSGLES20_AUTOGEN_H_
-#define LIBGLESV2_ENTRYPOINTSGLES20_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 GenerateMipmap(GLenum target);
-ANGLE_EXPORT void GL_APIENTRY GenFramebuffers(GLsizei n, GLuint *framebuffers);
-ANGLE_EXPORT void GL_APIENTRY GenRenderbuffers(GLsizei n, GLuint *renderbuffers);
-ANGLE_EXPORT void GL_APIENTRY GenTextures(GLsizei n, GLuint *textures);
-ANGLE_EXPORT void GL_APIENTRY GetActiveAttrib(GLuint program,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLint *size,
- GLenum *type,
- GLchar *name);
-ANGLE_EXPORT void GL_APIENTRY GetActiveUniform(GLuint program,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLint *size,
- GLenum *type,
- GLchar *name);
-ANGLE_EXPORT void GL_APIENTRY GetAttachedShaders(GLuint program,
- GLsizei maxCount,
- GLsizei *count,
- GLuint *shaders);
-ANGLE_EXPORT GLint GL_APIENTRY GetAttribLocation(GLuint program, const GLchar *name);
-ANGLE_EXPORT void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean *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 GetProgramiv(GLuint program, GLenum pname, GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetProgramInfoLog(GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *infoLog);
-ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameteriv(GLenum target,
- GLenum pname,
- GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetShaderiv(GLuint shader, GLenum pname, GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetShaderInfoLog(GLuint shader,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *infoLog);
-ANGLE_EXPORT void GL_APIENTRY GetShaderPrecisionFormat(GLenum shadertype,
- GLenum precisiontype,
- GLint *range,
- GLint *precision);
-ANGLE_EXPORT void GL_APIENTRY GetShaderSource(GLuint shader,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *source);
-ANGLE_EXPORT const GLubyte *GL_APIENTRY GetString(GLenum name);
-ANGLE_EXPORT void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
-ANGLE_EXPORT void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetUniformfv(GLuint program, GLint location, GLfloat *params);
-ANGLE_EXPORT void GL_APIENTRY GetUniformiv(GLuint program, GLint location, GLint *params);
-ANGLE_EXPORT GLint GL_APIENTRY GetUniformLocation(GLuint program, const GLchar *name);
-ANGLE_EXPORT void GL_APIENTRY GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
-ANGLE_EXPORT void GL_APIENTRY GetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer);
-ANGLE_EXPORT void GL_APIENTRY Hint(GLenum target, GLenum mode);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsBuffer(GLuint buffer);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsEnabled(GLenum cap);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsFramebuffer(GLuint framebuffer);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsProgram(GLuint program);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsRenderbuffer(GLuint renderbuffer);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsShader(GLuint shader);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsTexture(GLuint texture);
-ANGLE_EXPORT void GL_APIENTRY LineWidth(GLfloat width);
-ANGLE_EXPORT void GL_APIENTRY LinkProgram(GLuint program);
-ANGLE_EXPORT void GL_APIENTRY PixelStorei(GLenum pname, GLint param);
-ANGLE_EXPORT void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units);
-ANGLE_EXPORT void GL_APIENTRY ReadPixels(GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- 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_ENTRYPOINTSGLES20_AUTOGEN_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_ext.cpp b/src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_ext.cpp
deleted file mode 100644
index d4459ec287..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_ext.cpp
+++ /dev/null
@@ -1,3558 +0,0 @@
-//
-// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// entry_points_gles_2_0_ext.cpp : Implements the GLES 2.0 extension entry points.
-
-#include "libGLESv2/entry_points_gles_2_0_ext.h"
-#include "libGLESv2/global_state.h"
-
-#include "libANGLE/Buffer.h"
-#include "libANGLE/Context.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/ErrorStrings.h"
-#include "libANGLE/Fence.h"
-#include "libANGLE/Framebuffer.h"
-#include "libANGLE/Query.h"
-#include "libANGLE/Shader.h"
-#include "libANGLE/Thread.h"
-#include "libANGLE/VertexArray.h"
-#include "libANGLE/queryconversions.h"
-#include "libANGLE/queryutils.h"
-
-#include "libANGLE/validationES.h"
-#include "libANGLE/validationES2.h"
-#include "libANGLE/validationES3.h"
-#include "libANGLE/validationES31.h"
-
-#include "common/debug.h"
-#include "common/utilities.h"
-
-namespace gl
-{
-
-namespace
-{
-
-void SetRobustLengthParam(GLsizei *length, GLsizei value)
-{
- if (length)
- {
- *length = value;
- }
-}
-
-} // anonymous namespace
-
-void GL_APIENTRY GenQueriesEXT(GLsizei n, GLuint *ids)
-{
- EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateGenQueriesEXT(context, n, ids))
- {
- return;
- }
-
- context->genQueries(n, ids);
- }
-}
-
-void GL_APIENTRY DeleteQueriesEXT(GLsizei n, const GLuint *ids)
-{
- EVENT("(GLsizei n = %d, const GLuint *ids = 0x%0.8p)", n, ids);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateDeleteQueriesEXT(context, n, ids))
- {
- return;
- }
-
- context->deleteQueries(n, ids);
- }
-}
-
-GLboolean GL_APIENTRY IsQueryEXT(GLuint id)
-{
- EVENT("(GLuint id = %d)", id);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateIsQueryEXT(context, id))
- {
- return GL_FALSE;
- }
-
- return context->isQuery(id);
- }
-
- return GL_FALSE;
-}
-
-void GL_APIENTRY BeginQueryEXT(GLenum target, GLuint id)
-{
- EVENT("(GLenum target = 0x%X, GLuint %d)", target, id);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateBeginQueryEXT(context, target, id))
- {
- return;
- }
-
- context->beginQuery(target, id);
- }
-}
-
-void GL_APIENTRY EndQueryEXT(GLenum target)
-{
- EVENT("GLenum target = 0x%X)", target);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateEndQueryEXT(context, target))
- {
- return;
- }
-
- context->endQuery(target);
- }
-}
-
-void GL_APIENTRY QueryCounterEXT(GLuint id, GLenum target)
-{
- EVENT("GLuint id = %d, GLenum target = 0x%X)", id, target);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateQueryCounterEXT(context, id, target))
- {
- return;
- }
-
- context->queryCounter(id, target);
- }
-}
-
-void GL_APIENTRY GetQueryivEXT(GLenum target, GLenum pname, GLint *params)
-{
- EVENT("GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateGetQueryivEXT(context, target, pname, params))
- {
- return;
- }
-
- context->getQueryiv(target, pname, params);
- }
-}
-
-void GL_APIENTRY GetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params)
-{
- EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateGetQueryObjectivEXT(context, id, pname, params))
- {
- return;
- }
-
- context->getQueryObjectiv(id, pname, params);
- }
-}
-
-void GL_APIENTRY GetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
-{
- EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateGetQueryObjectuivEXT(context, id, pname, params))
- {
- return;
- }
-
- context->getQueryObjectuiv(id, pname, params);
- }
-}
-
-void GL_APIENTRY GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params)
-{
- EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.16p)", id, pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateGetQueryObjecti64vEXT(context, id, pname, params))
- {
- return;
- }
-
- context->getQueryObjecti64v(id, pname, params);
- }
-}
-
-void GL_APIENTRY GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params)
-{
- EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.16p)", id, pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateGetQueryObjectui64vEXT(context, id, pname, params))
- {
- return;
- }
-
- context->getQueryObjectui64v(id, pname, params);
- }
-}
-
-void GL_APIENTRY DeleteFencesNV(GLsizei n, const GLuint *fences)
-{
- EVENT("(GLsizei n = %d, const GLuint* fences = 0x%0.8p)", n, fences);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (n < 0)
- {
- context->handleError(InvalidValue());
- return;
- }
-
- for (int i = 0; i < n; i++)
- {
- context->deleteFenceNV(fences[i]);
- }
- }
-}
-
-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)
- {
- if (!ValidateDrawArraysInstancedANGLE(context, mode, first, count, primcount))
- {
- return;
- }
-
- context->drawArraysInstanced(mode, 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%0.8p, GLsizei primcount = %d)",
- mode, count, type, indices, primcount);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DrawElementsInstancedANGLE>(mode, count, type, indices,
- primcount);
-
- if (!context->skipValidation() &&
- !ValidateDrawElementsInstancedANGLE(context, mode, count, type, indices, primcount))
- {
- return;
- }
-
- context->drawElementsInstanced(mode, count, type, indices, primcount);
- }
-}
-
-void GL_APIENTRY FinishFenceNV(GLuint fence)
-{
- EVENT("(GLuint fence = %d)", fence);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- FenceNV *fenceObject = context->getFenceNV(fence);
-
- if (fenceObject == nullptr)
- {
- context->handleError(InvalidOperation());
- return;
- }
-
- if (fenceObject->isSet() != GL_TRUE)
- {
- context->handleError(InvalidOperation());
- return;
- }
-
- context->handleError(fenceObject->finish());
- }
-}
-
-void GL_APIENTRY GenFencesNV(GLsizei n, GLuint *fences)
-{
- EVENT("(GLsizei n = %d, GLuint* fences = 0x%0.8p)", n, fences);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (n < 0)
- {
- context->handleError(InvalidValue());
- return;
- }
-
- for (int i = 0; i < n; i++)
- {
- fences[i] = context->createFenceNV();
- }
- }
-}
-
-void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params)
-{
- EVENT("(GLuint fence = %d, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", fence, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- FenceNV *fenceObject = context->getFenceNV(fence);
-
- if (fenceObject == nullptr)
- {
- context->handleError(InvalidOperation());
- return;
- }
-
- if (fenceObject->isSet() != GL_TRUE)
- {
- context->handleError(InvalidOperation());
- return;
- }
-
- switch (pname)
- {
- case GL_FENCE_STATUS_NV:
- {
- // GL_NV_fence spec:
- // Once the status of a fence has been finished (via FinishFenceNV) or tested and
- // the returned status is TRUE (via either TestFenceNV or GetFenceivNV querying the
- // FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence.
- GLboolean status = GL_TRUE;
- if (fenceObject->getStatus() != GL_TRUE)
- {
- Error error = fenceObject->test(&status);
- if (error.isError())
- {
- context->handleError(error);
- return;
- }
- }
- *params = status;
- break;
- }
-
- case GL_FENCE_CONDITION_NV:
- {
- *params = static_cast<GLint>(fenceObject->getCondition());
- break;
- }
-
- default:
- {
- context->handleError(InvalidEnum());
- return;
- }
- }
- }
-}
-
-GLenum GL_APIENTRY GetGraphicsResetStatusEXT(void)
-{
- EVENT("()");
-
- Context *context = GetGlobalContext();
-
- if (context)
- {
- return context->getResetStatus();
- }
-
- return GL_NO_ERROR;
-}
-
-void GL_APIENTRY GetTranslatedShaderSourceANGLE(GLuint shader,
- GLsizei bufsize,
- GLsizei *length,
- GLchar *source)
-{
- EVENT(
- "(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = "
- "0x%0.8p)",
- shader, bufsize, length, source);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (bufsize < 0)
- {
- context->handleError(InvalidValue());
- return;
- }
-
- Shader *shaderObject = context->getShader(shader);
-
- if (!shaderObject)
- {
- context->handleError(InvalidOperation());
- return;
- }
-
- shaderObject->getTranslatedSourceWithDebugInfo(context, bufsize, length, source);
- }
-}
-
-void GL_APIENTRY GetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat *params)
-{
- EVENT(
- "(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = "
- "0x%0.8p)",
- program, location, bufSize, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateGetnUniformfvEXT(context, program, location, bufSize, params))
- {
- return;
- }
-
- Program *programObject = context->getProgram(program);
- ASSERT(programObject);
-
- programObject->getUniformfv(context, location, params);
- }
-}
-
-void GL_APIENTRY GetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params)
-{
- EVENT(
- "(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLint* params = 0x%0.8p)",
- program, location, bufSize, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateGetnUniformivEXT(context, program, location, bufSize, params))
- {
- return;
- }
-
- Program *programObject = context->getProgram(program);
- ASSERT(programObject);
-
- programObject->getUniformiv(context, location, params);
- }
-}
-
-GLboolean GL_APIENTRY IsFenceNV(GLuint fence)
-{
- EVENT("(GLuint fence = %d)", fence);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- FenceNV *fenceObject = context->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();
- }
-
- return GL_FALSE;
-}
-
-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 = 0x%d, void *data = 0x%0.8p)",
- x, y, width, height, format, type, bufSize, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateReadnPixelsEXT(context, x, y, width, height, format, type, bufSize, data))
- {
- return;
- }
-
- context->readPixels(x, y, width, height, format, type, data);
- }
-}
-
-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)
- {
- if (!context->skipValidation() &&
- !ValidateRenderbufferStorageMultisampleANGLE(context, target, samples, internalformat,
- width, height))
- {
- return;
- }
-
- context->renderbufferStorageMultisample(target, samples, internalformat, width, height);
- }
-}
-
-void GL_APIENTRY SetFenceNV(GLuint fence, GLenum condition)
-{
- EVENT("(GLuint fence = %d, GLenum condition = 0x%X)", fence, condition);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (condition != GL_ALL_COMPLETED_NV)
- {
- context->handleError(InvalidEnum());
- return;
- }
-
- FenceNV *fenceObject = context->getFenceNV(fence);
-
- if (fenceObject == nullptr)
- {
- context->handleError(InvalidOperation());
- return;
- }
-
- Error error = fenceObject->set(condition);
- if (error.isError())
- {
- context->handleError(error);
- return;
- }
- }
-}
-
-GLboolean GL_APIENTRY TestFenceNV(GLuint fence)
-{
- EVENT("(GLuint fence = %d)", fence);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- FenceNV *fenceObject = context->getFenceNV(fence);
-
- if (fenceObject == nullptr)
- {
- context->handleError(InvalidOperation());
- return GL_TRUE;
- }
-
- if (fenceObject->isSet() != GL_TRUE)
- {
- context->handleError(InvalidOperation());
- return GL_TRUE;
- }
-
- GLboolean result;
- Error error = fenceObject->test(&result);
- if (error.isError())
- {
- context->handleError(error);
- return GL_TRUE;
- }
-
- return result;
- }
-
- return GL_TRUE;
-}
-
-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)
- {
- if (!context->getExtensions().textureStorage)
- {
- context->handleError(InvalidOperation());
- return;
- }
-
- if (context->getClientMajorVersion() < 3 &&
- !ValidateES2TexStorageParameters(context, target, levels, internalformat, width,
- height))
- {
- return;
- }
-
- if (context->getClientMajorVersion() >= 3 &&
- !ValidateES3TexStorage2DParameters(context, target, levels, internalformat, width,
- height, 1))
- {
- return;
- }
-
- context->texStorage2D(target, levels, internalformat, width, height);
- }
-}
-
-void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor)
-{
- EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->getExtensions().instancedArrays)
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
- return;
- }
-
- if (index >= MAX_VERTEX_ATTRIBS)
- {
- context->handleError(InvalidValue());
- return;
- }
-
- if (context->getLimitations().attributeZeroRequiresZeroDivisorInEXT)
- {
- if (index == 0 && divisor != 0)
- {
- const char *errorMessage =
- "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.";
- context->handleError(InvalidOperation() << errorMessage);
-
- // We also output an error message to the debugger window if tracing is active, so
- // that developers can see the error message.
- ERR() << errorMessage;
-
- return;
- }
- }
-
- context->vertexAttribDivisor(index, divisor);
- }
-}
-
-void GL_APIENTRY BlitFramebufferANGLE(GLint srcX0,
- GLint srcY0,
- GLint srcX1,
- GLint srcY1,
- GLint dstX0,
- GLint dstY0,
- GLint dstX1,
- GLint dstY1,
- GLbitfield mask,
- GLenum filter)
-{
- EVENT(
- "(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, "
- "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, "
- "GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
- srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateBlitFramebufferANGLE(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1,
- dstY1, mask, filter))
- {
- return;
- }
-
- context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
- filter);
- }
-}
-
-void GL_APIENTRY DiscardFramebufferEXT(GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments)
-{
- EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, attachments = 0x%0.8p)", target,
- numAttachments, attachments);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateDiscardFramebufferEXT(context, target, numAttachments, attachments))
- {
- return;
- }
-
- context->discardFramebuffer(target, numAttachments, attachments);
- }
-}
-
-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%0.8p)",
- target, level, internalformat, width, height, depth, border, format, type, pixels);
-
- UNIMPLEMENTED(); // FIXME
-}
-
-void GL_APIENTRY GetProgramBinaryOES(GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- GLenum *binaryFormat,
- void *binary)
-{
- EVENT(
- "(GLenum program = 0x%X, bufSize = %d, length = 0x%0.8p, binaryFormat = 0x%0.8p, binary = "
- "0x%0.8p)",
- program, bufSize, length, binaryFormat, binary);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateGetProgramBinaryOES(context, program, bufSize, length, binaryFormat, binary))
- {
- return;
- }
-
- context->getProgramBinary(program, bufSize, length, binaryFormat, binary);
- }
-}
-
-void GL_APIENTRY ProgramBinaryOES(GLuint program,
- GLenum binaryFormat,
- const void *binary,
- GLint length)
-{
- EVENT("(GLenum program = 0x%X, binaryFormat = 0x%x, binary = 0x%0.8p, length = %d)", program,
- binaryFormat, binary, length);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateProgramBinaryOES(context, program, binaryFormat, binary, length))
- {
- return;
- }
-
- context->programBinary(program, binaryFormat, binary, length);
- }
-}
-
-void GL_APIENTRY DrawBuffersEXT(GLsizei n, const GLenum *bufs)
-{
- EVENT("(GLenum n = %d, bufs = 0x%0.8p)", n, bufs);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateDrawBuffersEXT(context, n, bufs))
- {
- return;
- }
-
- context->drawBuffers(n, bufs);
- }
-}
-
-void GL_APIENTRY GetBufferPointervOES(GLenum target, GLenum pname, void **params)
-{
- EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, void** params = 0x%0.8p)", target, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
-
- if (!context->skipValidation() &&
- !ValidateGetBufferPointervOES(context, targetPacked, pname, params))
- {
- return;
- }
-
- context->getBufferPointerv(targetPacked, pname, params);
- }
-}
-
-void *GL_APIENTRY MapBufferOES(GLenum target, GLenum access)
-{
- EVENT("(GLenum target = 0x%X, GLbitfield access = 0x%X)", target, access);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
-
- if (!context->skipValidation() && !ValidateMapBufferOES(context, targetPacked, access))
- {
- return nullptr;
- }
-
- return context->mapBuffer(targetPacked, access);
- }
-
- return nullptr;
-}
-
-GLboolean GL_APIENTRY UnmapBufferOES(GLenum target)
-{
- EVENT("(GLenum target = 0x%X)", target);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
-
- if (!context->skipValidation() && !ValidateUnmapBufferOES(context, targetPacked))
- {
- return GL_FALSE;
- }
-
- return context->unmapBuffer(targetPacked);
- }
-
- return GL_FALSE;
-}
-
-void *GL_APIENTRY MapBufferRangeEXT(GLenum target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access)
-{
- EVENT(
- "(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = "
- "0x%X)",
- target, offset, length, access);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
-
- if (!context->skipValidation() &&
- !ValidateMapBufferRangeEXT(context, targetPacked, offset, length, access))
- {
- return nullptr;
- }
-
- return context->mapBufferRange(targetPacked, offset, length, access);
- }
-
- return nullptr;
-}
-
-void GL_APIENTRY FlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset,
- length);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
-
- if (!context->skipValidation() &&
- !ValidateFlushMappedBufferRangeEXT(context, targetPacked, offset, length))
- {
- return;
- }
-
- context->flushMappedBufferRange(targetPacked, offset, length);
- }
-}
-
-void GL_APIENTRY InsertEventMarkerEXT(GLsizei length, const char *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.
-
- Context *context = GetValidGlobalContext();
- if (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->handleError(InvalidOperation() << "Extension not enabled");
- return;
- }
-
- if (!ValidateInsertEventMarkerEXT(context, length, marker))
- {
- return;
- }
-
- context->insertEventMarker(length, marker);
- }
-}
-
-void GL_APIENTRY PushGroupMarkerEXT(GLsizei length, const char *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.
-
- Context *context = GetValidGlobalContext();
- if (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->handleError(InvalidOperation() << "Extension not enabled");
- return;
- }
-
- if (!ValidatePushGroupMarkerEXT(context, length, marker))
- {
- return;
- }
-
- if (marker == nullptr)
- {
- // From the EXT_debug_marker spec,
- // "If <marker> is null then an empty string is pushed on the stack."
- context->pushGroupMarker(length, "");
- }
- else
- {
- context->pushGroupMarker(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.
-
- Context *context = GetValidGlobalContext();
- if (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->handleError(InvalidOperation() << "Extension not enabled");
- return;
- }
-
- context->popGroupMarker();
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
-{
- EVENT("(GLenum target = 0x%X, GLeglImageOES image = 0x%0.8p)", target, image);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- egl::Image *imageObject = reinterpret_cast<egl::Image *>(image);
- if (!ValidateEGLImageTargetTexture2DOES(context, target, imageObject))
- {
- return;
- }
-
- Texture *texture = context->getTargetTexture(target);
- Error error = texture->setEGLImageTarget(context, target, imageObject);
- if (error.isError())
- {
- context->handleError(error);
- return;
- }
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY EGLImageTargetRenderbufferStorageOES(GLenum target,
- GLeglImageOES image)
-{
- EVENT("(GLenum target = 0x%X, GLeglImageOES image = 0x%0.8p)", target, image);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- egl::Image *imageObject = reinterpret_cast<egl::Image *>(image);
- if (!ValidateEGLImageTargetRenderbufferStorageOES(context, target, imageObject))
- {
- return;
- }
-
- Renderbuffer *renderbuffer = context->getGLState().getCurrentRenderbuffer();
- Error error = renderbuffer->setStorageEGLImageTarget(context, imageObject);
- if (error.isError())
- {
- context->handleError(error);
- return;
- }
- }
-}
-
-void GL_APIENTRY BindVertexArrayOES(GLuint array)
-{
- EVENT("(GLuint array = %u)", array);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateBindVertexArrayOES(context, array))
- {
- return;
- }
-
- context->bindVertexArray(array);
- }
-}
-
-void GL_APIENTRY DeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
-{
- EVENT("(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)", n, arrays);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateDeleteVertexArraysOES(context, n, arrays))
- {
- return;
- }
-
- context->deleteVertexArrays(n, arrays);
- }
-}
-
-void GL_APIENTRY GenVertexArraysOES(GLsizei n, GLuint *arrays)
-{
- EVENT("(GLsizei n = %d, GLuint* arrays = 0x%0.8p)", n, arrays);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateGenVertexArraysOES(context, n, arrays))
- {
- return;
- }
-
- context->genVertexArrays(n, arrays);
- }
-}
-
-GLboolean GL_APIENTRY IsVertexArrayOES(GLuint array)
-{
- EVENT("(GLuint array = %u)", array);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateIsVertexArrayOES(context, array))
- {
- return GL_FALSE;
- }
-
- return context->isVertexArray(array);
- }
-
- return GL_FALSE;
-}
-
-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, "
- "GLint *ids = 0x%0.8p, GLboolean enabled = %d)",
- source, type, severity, count, ids, enabled);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateDebugMessageControlKHR(context, source, type, severity, count, ids, enabled))
- {
- return;
- }
-
- 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, GLint id = %d, GLenum severity = 0x%X, GLsizei "
- "length = %d, const GLchar *buf = 0x%0.8p)",
- source, type, id, severity, length, buf);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateDebugMessageInsertKHR(context, source, type, id, severity, length, buf))
- {
- return;
- }
-
- context->debugMessageInsert(source, type, id, severity, length, buf);
- }
-}
-
-void GL_APIENTRY DebugMessageCallbackKHR(GLDEBUGPROCKHR callback, const void *userParam)
-{
- EVENT("(GLDEBUGPROCKHR callback = 0x%0.8p, const void *userParam = 0x%0.8p)", callback,
- userParam);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateDebugMessageCallbackKHR(context, callback, userParam))
- {
- return;
- }
-
- context->debugMessageCallback(callback, userParam);
- }
-}
-
-GLuint GL_APIENTRY GetDebugMessageLogKHR(GLuint count,
- GLsizei bufSize,
- GLenum *sources,
- GLenum *types,
- GLuint *ids,
- GLenum *severities,
- GLsizei *lengths,
- GLchar *messageLog)
-{
- EVENT(
- "(GLsizei count = %d, GLsizei bufSize = %d, GLenum *sources, GLenum *types = 0x%0.8p, "
- "GLuint *ids = 0x%0.8p, GLenum *severities = 0x%0.8p, GLsizei *lengths = 0x%0.8p, GLchar "
- "*messageLog = 0x%0.8p)",
- count, bufSize, sources, types, ids, severities, lengths, messageLog);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateGetDebugMessageLogKHR(context, count, bufSize, sources, types, ids, severities,
- lengths, messageLog))
- {
- return 0;
- }
-
- return context->getDebugMessageLog(count, bufSize, sources, types, ids, severities, lengths,
- messageLog);
- }
-
- return 0;
-}
-
-void GL_APIENTRY PushDebugGroupKHR(GLenum source, GLuint id, GLsizei length, const GLchar *message)
-{
- EVENT(
- "(GLenum source = 0x%X, GLuint id = 0x%X, GLsizei length = %d, const GLchar *message = "
- "0x%0.8p)",
- source, id, length, message);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidatePushDebugGroupKHR(context, source, id, length, message))
- {
- return;
- }
-
- std::string msg(message, (length > 0) ? static_cast<size_t>(length) : strlen(message));
- context->pushDebugGroup(source, id, length, message);
- }
-}
-
-void GL_APIENTRY PopDebugGroupKHR(void)
-{
- EVENT("()");
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidatePopDebugGroupKHR(context))
- {
- return;
- }
-
- context->popDebugGroup();
- }
-}
-
-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%0.8p)",
- identifier, name, length, label);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateObjectLabelKHR(context, identifier, name, length, label))
- {
- return;
- }
-
- context->objectLabel(identifier, name, length, label);
- }
-}
-
-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%0.8p, GLchar *label = 0x%0.8p)",
- identifier, name, bufSize, length, label);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateGetObjectLabelKHR(context, identifier, name, bufSize, length, label))
- {
- return;
- }
-
- context->getObjectLabel(identifier, name, bufSize, length, label);
- }
-}
-
-void GL_APIENTRY ObjectPtrLabelKHR(const void *ptr, GLsizei length, const GLchar *label)
-{
- EVENT("(const void *ptr = 0x%0.8p, GLsizei length = %d, const GLchar *label = 0x%0.8p)", ptr,
- length, label);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateObjectPtrLabelKHR(context, ptr, length, label))
- {
- return;
- }
-
- context->objectPtrLabel(ptr, length, label);
- }
-}
-
-void GL_APIENTRY GetObjectPtrLabelKHR(const void *ptr,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *label)
-{
- EVENT(
- "(const void *ptr = 0x%0.8p, GLsizei bufSize = %d, GLsizei *length = 0x%0.8p, GLchar "
- "*label = 0x%0.8p)",
- ptr, bufSize, length, label);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateGetObjectPtrLabelKHR(context, ptr, bufSize, length, label))
- {
- return;
- }
-
- context->getObjectPtrLabel(ptr, bufSize, length, label);
- }
-}
-
-void GL_APIENTRY GetPointervKHR(GLenum pname, void **params)
-{
- EVENT("(GLenum pname = 0x%X, void **params = 0x%0.8p)", pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateGetPointervKHR(context, pname, params))
- {
- return;
- }
-
- context->getPointerv(pname, params);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY BindUniformLocationCHROMIUM(GLuint program,
- GLint location,
- const GLchar *name)
-{
- EVENT("(GLuint program = %u, GLint location = %d, const GLchar *name = 0x%0.8p)", program,
- location, name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateBindUniformLocationCHROMIUM(context, program, location, name))
- {
- return;
- }
-
- context->bindUniformLocation(program, location, name);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY CoverageModulationCHROMIUM(GLenum components)
-{
- EVENT("(GLenum components = %u)", components);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateCoverageModulationCHROMIUM(context, components))
- {
- return;
- }
- context->setCoverageModulation(components);
- }
-}
-
-// CHROMIUM_path_rendering
-ANGLE_EXPORT void GL_APIENTRY MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat *matrix)
-{
- EVENT("(GLenum matrixMode = %u)", matrixMode);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateMatrix(context, matrixMode, matrix))
- {
- return;
- }
- context->loadPathRenderingMatrix(matrixMode, matrix);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY MatrixLoadIdentityCHROMIUM(GLenum matrixMode)
-{
- EVENT("(GLenum matrixMode = %u)", matrixMode);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateMatrixMode(context, matrixMode))
- {
- return;
- }
- context->loadPathRenderingIdentityMatrix(matrixMode);
- }
-}
-
-ANGLE_EXPORT GLuint GL_APIENTRY GenPathsCHROMIUM(GLsizei range)
-{
- EVENT("(GLsizei range = %d)", range);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateGenPaths(context, range))
- {
- return 0;
- }
- return context->createPaths(range);
- }
- return 0;
-}
-
-ANGLE_EXPORT void GL_APIENTRY DeletePathsCHROMIUM(GLuint first, GLsizei range)
-{
- EVENT("(GLuint first = %u, GLsizei range = %d)", first, range);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateDeletePaths(context, first, range))
- {
- return;
- }
- context->deletePaths(first, range);
- }
-}
-
-ANGLE_EXPORT GLboolean GL_APIENTRY IsPathCHROMIUM(GLuint path)
-{
- EVENT("(GLuint path = %u)", path);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateIsPath(context))
- {
- return GL_FALSE;
- }
- return context->hasPathData(path);
- }
- return GL_FALSE;
-}
-
-ANGLE_EXPORT 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, commands = %p, "
- "GLsizei numCoords = %d, GLenum coordType = %u, void* coords = %p)",
- path, numCommands, commands, numCoords, coordType, coords);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation())
- {
- if (!ValidatePathCommands(context, path, numCommands, commands, numCoords, coordType,
- coords))
- {
- return;
- }
- }
- context->setPathCommands(path, numCommands, commands, numCoords, coordType, coords);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY PathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat value)
-{
- EVENT("(GLuint path = %u, GLenum pname = %u, GLfloat value = %f)", path, pname, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateSetPathParameter(context, path, pname, value))
- {
- return;
- }
- context->setPathParameterf(path, pname, value);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY PathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value)
-{
- PathParameterfCHROMIUM(path, pname, static_cast<GLfloat>(value));
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetPathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat *value)
-{
- EVENT("(GLuint path = %u, GLenum pname = %u)", path, pname);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateGetPathParameter(context, path, pname, value))
- {
- return;
- }
- context->getPathParameterfv(path, pname, value);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetPathParameteriCHROMIUM(GLuint path, GLenum pname, GLint *value)
-{
- GLfloat val = 0.0f;
- GetPathParameterfCHROMIUM(path, pname, value != nullptr ? &val : nullptr);
- if (value)
- *value = static_cast<GLint>(val);
-}
-
-ANGLE_EXPORT void GL_APIENTRY PathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask)
-{
- EVENT("(GLenum func = %u, GLint ref = %d, GLuint mask = %u)", func, ref, mask);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidatePathStencilFunc(context, func, ref, mask))
- {
- return;
- }
- context->setPathStencilFunc(func, ref, mask);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY StencilFillPathCHROMIUM(GLuint path, GLenum fillMode, GLuint mask)
-{
- EVENT("(GLuint path = %u, GLenum fillMode = %u, GLuint mask = %u)", path, fillMode, mask);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateStencilFillPath(context, path, fillMode, mask))
- {
- return;
- }
- context->stencilFillPath(path, fillMode, mask);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY StencilStrokePathCHROMIUM(GLuint path, GLint reference, GLuint mask)
-{
- EVENT("(GLuint path = %u, GLint ference = %d, GLuint mask = %u)", path, reference, mask);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateStencilStrokePath(context, path, reference, mask))
- {
- return;
- }
- context->stencilStrokePath(path, reference, mask);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY CoverFillPathCHROMIUM(GLuint path, GLenum coverMode)
-{
- EVENT("(GLuint path = %u, GLenum coverMode = %u)", path, coverMode);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateCoverPath(context, path, coverMode))
- {
- return;
- }
- context->coverFillPath(path, coverMode);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY CoverStrokePathCHROMIUM(GLuint path, GLenum coverMode)
-{
- EVENT("(GLuint path = %u, GLenum coverMode = %u)", path, coverMode);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateCoverPath(context, path, coverMode))
- {
- return;
- }
- context->coverStrokePath(path, coverMode);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY StencilThenCoverFillPathCHROMIUM(GLuint path,
- GLenum fillMode,
- GLuint mask,
- GLenum coverMode)
-{
- EVENT("(GLuint path = %u, GLenum fillMode = %u, GLuint mask = %u, GLenum coverMode = %u)", path,
- fillMode, mask, coverMode);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateStencilThenCoverFillPath(context, path, fillMode, mask, coverMode))
- {
- return;
- }
- context->stencilThenCoverFillPath(path, fillMode, mask, coverMode);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY StencilThenCoverStrokePathCHROMIUM(GLuint path,
- GLint reference,
- GLuint mask,
- GLenum coverMode)
-{
- EVENT("(GLuint path = %u, GLint reference = %d, GLuint mask = %u, GLenum coverMode = %u)", path,
- reference, mask, coverMode);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateStencilThenCoverStrokePath(context, path, reference, mask, coverMode))
- {
- return;
- }
- context->stencilThenCoverStrokePath(path, reference, mask, coverMode);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY CoverFillPathInstancedCHROMIUM(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- EVENT(
- "(GLsizei numPaths = %d, GLenum pathNameType = %u, const void *paths = %p "
- "GLuint pathBase = %u, GLenum coverMode = %u, GLenum transformType = %u "
- "const GLfloat *transformValues = %p)",
- numPaths, pathNameType, paths, pathBase, coverMode, transformType, transformValues);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateCoverFillPathInstanced(context, numPaths, pathNameType, paths, pathBase,
- coverMode, transformType, transformValues))
- {
- return;
- }
- context->coverFillPathInstanced(numPaths, pathNameType, paths, pathBase, coverMode,
- transformType, transformValues);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY CoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- EVENT(
- "(GLsizei numPaths = %d, GLenum pathNameType = %u, const void *paths = %p "
- "GLuint pathBase = %u, GLenum coverMode = %u, GLenum transformType = %u "
- "const GLfloat *transformValues = %p)",
- numPaths, pathNameType, paths, pathBase, coverMode, transformType, transformValues);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateCoverStrokePathInstanced(context, numPaths, pathNameType, paths, pathBase,
- coverMode, transformType, transformValues))
- {
- return;
- }
- context->coverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, coverMode,
- transformType, transformValues);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY StencilStrokePathInstancedCHROMIUM(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLint reference,
- GLuint mask,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- EVENT(
- "(GLsizei numPaths = %u, GLenum pathNameType = %u, const void *paths = %p "
- "GLuint pathBase = %u, GLint reference = %d GLuint mask = %u GLenum transformType = %u "
- "const GLfloat *transformValues = %p)",
- numPaths, pathNameType, paths, pathBase, reference, mask, transformType, transformValues);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateStencilStrokePathInstanced(context, numPaths, pathNameType, paths, pathBase,
- reference, mask, transformType, transformValues))
- {
- return;
- }
- context->stencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, reference,
- mask, transformType, 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)
-{
- EVENT(
- "(GLsizei numPaths = %u, GLenum pathNameType = %u const void *paths = %p "
- "GLuint pathBase = %u, GLenum fillMode = %u, GLuint mask = %u, GLenum transformType = %u "
- "const GLfloat *transformValues = %p)",
- numPaths, pathNameType, paths, pathBase, fillMode, mask, transformType, transformValues);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateStencilFillPathInstanced(context, numPaths, pathNameType, paths, pathBase,
- fillMode, mask, transformType, transformValues))
- {
- return;
- }
- context->stencilFillPathInstanced(numPaths, pathNameType, paths, pathBase, fillMode, mask,
- transformType, 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)
-{
- EVENT(
- "(GLsizei numPaths = %u, GLenum pathNameType = %u const void *paths = %p "
- "GLuint pathBase = %u, GLenum coverMode = %u, GLuint mask = %u, GLenum transformType = %u "
- "const GLfloat *transformValues = %p)",
- numPaths, pathNameType, paths, pathBase, coverMode, mask, transformType, transformValues);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateStencilThenCoverFillPathInstanced(context, numPaths, pathNameType, paths,
- pathBase, fillMode, mask, coverMode,
- transformType, transformValues))
- {
- return;
- }
- context->stencilThenCoverFillPathInstanced(numPaths, pathNameType, paths, pathBase,
- fillMode, mask, coverMode, transformType,
- 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)
-{
- EVENT(
- "(GLsizei numPaths = %u, GLenum pathNameType = %u, const void *paths = %p "
- "GLuint pathBase = %u GLenum coverMode = %u GLint reference = %d GLuint mask = %u GLenum "
- "transformType = %u "
- "const GLfloat *transformValues = %p)",
- numPaths, pathNameType, paths, pathBase, coverMode, reference, mask, transformType,
- transformValues);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateStencilThenCoverStrokePathInstanced(context, numPaths, pathNameType, paths,
- pathBase, reference, mask, coverMode,
- transformType, transformValues))
- {
- return;
- }
- context->stencilThenCoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
- reference, mask, coverMode, transformType,
- transformValues);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY BindFragmentInputLocationCHROMIUM(GLuint program,
- GLint location,
- const GLchar *name)
-{
- EVENT("(GLuint program = %u, GLint location = %d, const GLchar *name = %p)", program, location,
- name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateBindFragmentInputLocation(context, program, location, name))
- {
- return;
- }
- context->bindFragmentInputLocation(program, location, name);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUM(GLuint program,
- GLint location,
- GLenum genMode,
- GLint components,
- const GLfloat *coeffs)
-{
- EVENT(
- "(GLuint program = %u, GLint location %d, GLenum genMode = %u, GLint components = %d, "
- "const GLfloat * coeffs = %p)",
- program, location, genMode, components, coeffs);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateProgramPathFragmentInputGen(context, program, location, genMode, components,
- coeffs))
- {
- return;
- }
- context->programPathFragmentInputGen(program, location, genMode, components, coeffs);
- }
-}
-
-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)
-{
- EVENT(
- "(GLuint sourceId = %u, GLint sourceLevel = %d, GLenum destTarget = 0x%X, GLuint destId = "
- "%u, GLint destLevel = %d, GLint internalFormat = 0x%X, 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)
- {
- if (!context->skipValidation() &&
- !ValidateCopyTextureCHROMIUM(context, sourceId, sourceLevel, destTarget, destId,
- destLevel, internalFormat, destType, unpackFlipY,
- unpackPremultiplyAlpha, unpackUnmultiplyAlpha))
- {
- return;
- }
-
- context->copyTextureCHROMIUM(sourceId, sourceLevel, destTarget, destId, destLevel,
- internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
- 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,
- GLsizei width,
- GLsizei 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, GLsizei width = %d, GLsizei height = "
- "%d, 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)
- {
- if (!context->skipValidation() &&
- !ValidateCopySubTextureCHROMIUM(
- context, sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, yoffset, x,
- y, width, height, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha))
- {
- return;
- }
-
- context->copySubTextureCHROMIUM(sourceId, sourceLevel, destTarget, destId, destLevel,
- xoffset, yoffset, x, y, width, height, unpackFlipY,
- unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY CompressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId)
-{
- EVENT("(GLuint sourceId = %u, GLuint destId = %u)", sourceId, destId);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateCompressedCopyTextureCHROMIUM(context, sourceId, destId))
- {
- return;
- }
-
- context->compressedCopyTextureCHROMIUM(sourceId, destId);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY RequestExtensionANGLE(const GLchar *name)
-{
- EVENT("(const GLchar *name = %p)", name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateRequestExtensionANGLE(context, name))
- {
- return;
- }
-
- context->requestExtension(name);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetBooleanvRobustANGLE(GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLboolean *params)
-{
- EVENT(
- "(GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLboolean* params "
- "= 0x%0.8p)",
- pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams))
- {
- return;
- }
-
- context->getBooleanv(pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetBufferParameterivRobustANGLE(GLenum target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
-
- GLsizei numParams = 0;
- if (!ValidateGetBufferParameterivRobustANGLE(context, targetPacked, pname, bufSize,
- &numParams, params))
- {
- return;
- }
-
- Buffer *buffer = context->getGLState().getTargetBuffer(targetPacked);
- QueryBufferParameteriv(buffer, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetFloatvRobustANGLE(GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLfloat *params)
-{
- EVENT(
- "(GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLfloat* params = "
- "0x%0.8p)",
- pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams))
- {
- return;
- }
-
- context->getFloatv(pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, GLint* params = 0x%0.8p)",
- target, attachment, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetFramebufferAttachmentParameterivRobustANGLE(context, target, attachment,
- pname, bufSize, &numParams))
- {
- return;
- }
-
- const Framebuffer *framebuffer = context->getGLState().getTargetFramebuffer(target);
- QueryFramebufferAttachmentParameteriv(framebuffer, attachment, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetIntegervRobustANGLE(GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *data)
-{
- EVENT(
- "(GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLint* params = "
- "0x%0.8p)",
- pname, bufSize, length, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams))
- {
- return;
- }
-
- context->getIntegerv(pname, data);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetProgramivRobustANGLE(GLuint program,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- EVENT(
- "(GLuint program = %d, GLenum pname = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, "
- "GLint* params = 0x%0.8p)",
- program, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetProgramivRobustANGLE(context, program, pname, bufSize, &numParams))
- {
- return;
- }
-
- Program *programObject = context->getProgram(program);
- QueryProgramiv(context, programObject, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, GLint* params = 0x%0.8p)",
- target, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetRenderbufferParameterivRobustANGLE(context, target, pname, bufSize,
- &numParams, params))
- {
- return;
- }
-
- Renderbuffer *renderbuffer = context->getGLState().getCurrentRenderbuffer();
- QueryRenderbufferiv(context, renderbuffer, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY
-GetShaderivRobustANGLE(GLuint shader, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params)
-{
- EVENT(
- "(GLuint shader = %d, GLenum pname = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, "
- "GLint* params = 0x%0.8p)",
- shader, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetShaderivRobustANGLE(context, shader, pname, bufSize, &numParams, params))
- {
- return;
- }
-
- Shader *shaderObject = context->getShader(shader);
- QueryShaderiv(context, shaderObject, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, GLfloat* params = 0x%0.8p)",
- target, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetTexParameterfvRobustANGLE(context, target, pname, bufSize, &numParams,
- params))
- {
- return;
- }
-
- Texture *texture = context->getTargetTexture(target);
- QueryTexParameterfv(texture, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, GLfloat* params = 0x%0.8p)",
- target, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetTexParameterivRobustANGLE(context, target, pname, bufSize, &numParams,
- params))
- {
- return;
- }
-
- Texture *texture = context->getTargetTexture(target);
- QueryTexParameteriv(texture, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetUniformfvRobustANGLE(GLuint program,
- GLint location,
- GLsizei bufSize,
- GLsizei *length,
- GLfloat *params)
-{
- EVENT(
- "(GLuint program = %d, GLint location = %d, GLsizei bufsize = %d, GLsizei* length = "
- "0x%0.8p, GLfloat* params = 0x%0.8p)",
- program, location, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei writeLength = 0;
- if (!ValidateGetUniformfvRobustANGLE(context, program, location, bufSize, &writeLength,
- params))
- {
- return;
- }
-
- Program *programObject = context->getProgram(program);
- ASSERT(programObject);
-
- programObject->getUniformfv(context, location, params);
- SetRobustLengthParam(length, writeLength);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetUniformivRobustANGLE(GLuint program,
- GLint location,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- EVENT(
- "(GLuint program = %d, GLint location = %d, GLsizei bufsize = %d, GLsizei* length = "
- "0x%0.8p, GLint* params = 0x%0.8p)",
- program, location, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei writeLength = 0;
- if (!ValidateGetUniformivRobustANGLE(context, program, location, bufSize, &writeLength,
- params))
- {
- return;
- }
-
- Program *programObject = context->getProgram(program);
- ASSERT(programObject);
-
- programObject->getUniformiv(context, location, params);
- SetRobustLengthParam(length, writeLength);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetVertexAttribfvRobustANGLE(GLuint index,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLfloat *params)
-{
- EVENT(
- "(GLuint index = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, "
- "GLfloat* params = 0x%0.8p)",
- index, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei writeLength = 0;
- if (!ValidateGetVertexAttribfvRobustANGLE(context, index, pname, bufSize, &writeLength,
- params))
- {
- return;
- }
-
- context->getVertexAttribfv(index, pname, params);
- SetRobustLengthParam(length, writeLength);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetVertexAttribivRobustANGLE(GLuint index,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- EVENT(
- "(GLuint index = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, "
- "GLint* params = 0x%0.8p)",
- index, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei writeLength = 0;
- if (!ValidateGetVertexAttribivRobustANGLE(context, index, pname, bufSize, &writeLength,
- params))
- {
- return;
- }
-
- context->getVertexAttribiv(index, pname, params);
- SetRobustLengthParam(length, writeLength);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetVertexAttribPointervRobustANGLE(GLuint index,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- void **pointer)
-{
- EVENT(
- "(GLuint index = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, "
- "void** pointer = 0x%0.8p)",
- index, pname, bufSize, length, pointer);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei writeLength = 0;
- if (!ValidateGetVertexAttribPointervRobustANGLE(context, index, pname, bufSize,
- &writeLength, pointer))
- {
- return;
- }
-
- context->getVertexAttribPointerv(index, pname, pointer);
- SetRobustLengthParam(length, writeLength);
- }
-}
-
-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)
-{
- 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%0.8p, GLsizei* columns = 0x%0.8p, GLsizei* rows = 0x%0.8p, void* pixels = 0x%0.8p)",
- x, y, width, height, format, type, bufSize, length, columns, rows, pixels);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei writeLength = 0;
- GLsizei writeColumns = 0;
- GLsizei writeRows = 0;
- if (!ValidateReadPixelsRobustANGLE(context, x, y, width, height, format, type, bufSize,
- &writeLength, &writeColumns, &writeRows, pixels))
- {
- return;
- }
-
- context->readPixels(x, y, width, height, format, type, pixels);
-
- SetRobustLengthParam(length, writeLength);
- SetRobustLengthParam(columns, writeColumns);
- SetRobustLengthParam(rows, writeRows);
- }
-}
-
-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)
-{
- 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%0.8p)",
- target, level, internalformat, width, height, border, format, type, bufSize, pixels);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateTexImage2DRobust(context, target, level, internalformat, width, height, border,
- format, type, bufSize, pixels))
- {
- return;
- }
-
- context->texImage2D(target, level, internalformat, width, height, border, format, type,
- pixels);
- }
-}
-
-ANGLE_EXPORT 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, GLfloat* params = "
- "0x%0.8p)",
- target, pname, bufSize, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateTexParameterfvRobustANGLE(context, target, pname, bufSize, params))
- {
- return;
- }
-
- Texture *texture = context->getTargetTexture(target);
- SetTexParameterfv(context, texture, pname, params);
- }
-}
-
-ANGLE_EXPORT 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, GLfloat* params = "
- "0x%0.8p)",
- target, pname, bufSize, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateTexParameterivRobustANGLE(context, target, pname, bufSize, params))
- {
- return;
- }
-
- Texture *texture = context->getTargetTexture(target);
- SetTexParameteriv(context, texture, pname, 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)
-{
- 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%0.8p)",
- target, level, xoffset, yoffset, width, height, format, type, bufSize, pixels);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateTexSubImage2DRobustANGLE(context, target, level, xoffset, yoffset, width,
- height, format, type, bufSize, pixels))
- {
- return;
- }
-
- context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
- 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)
-{
- 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%0.8p)",
- target, level, internalformat, width, height, depth, border, format, type, bufSize, pixels);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateTexImage3DRobustANGLE(context, target, level, internalformat, width, height,
- depth, border, format, type, bufSize, pixels))
- {
- return;
- }
-
- context->texImage3D(target, level, internalformat, width, height, depth, border, format,
- type, 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)
-{
- 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%0.8p)",
- target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize,
- pixels);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateTexSubImage3DRobustANGLE(context, target, level, xoffset, yoffset, zoffset,
- width, height, depth, format, type, bufSize, pixels))
- {
- return;
- }
-
- context->texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth,
- format, type, 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%0.8p)",
- target, level, internalformat, width, height, border, imageSize, dataSize, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateCompressedTexImage2DRobustANGLE(context, target, level, internalformat, width,
- height, border, imageSize, dataSize, data))
- {
- return;
- }
-
- context->compressedTexImage2D(target, level, internalformat, width, height, border,
- imageSize, data);
- }
-}
-
-void GL_APIENTRY CompressedTexSubImage2DRobustANGLE(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLsizei imageSize,
- GLsizei dataSize,
- const GLvoid *data)
-{
- EVENT(
- "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
- "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, "
- "GLsizei imageSize = %d, GLsizei dataSize = %d, const GLvoid* data = 0x%0.8p)",
- target, level, xoffset, yoffset, width, height, format, imageSize, dataSize, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateCompressedTexSubImage2DRobustANGLE(
- context, target, level, xoffset, yoffset, width,
- height, format, imageSize, dataSize, data))
- {
- return;
- }
-
- context->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format,
- imageSize, 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%0.8p)",
- target, level, internalformat, width, height, depth, border, imageSize, dataSize, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() && !ValidateCompressedTexImage3DRobustANGLE(
- context, target, level, internalformat, width, height,
- depth, border, imageSize, dataSize, data))
- {
- return;
- }
-
- context->compressedTexImage3D(target, level, internalformat, width, height, depth, border,
- imageSize, 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%0.8p)",
- target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, dataSize,
- data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateCompressedTexSubImage3DRobustANGLE(context, target, level, xoffset, yoffset,
- zoffset, width, height, depth, format,
- imageSize, dataSize, data))
- {
- return;
- }
-
- context->compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height,
- depth, format, imageSize, data);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, GLint* params = 0x%0.8p)",
- target, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetQueryivRobustANGLE(context, target, pname, bufSize, &numParams, params))
- {
- return;
- }
-
- context->getQueryiv(target, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, "
- "GLint* params = 0x%0.8p)",
- id, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetQueryObjectuivRobustANGLE(context, id, pname, bufSize, &numParams, params))
- {
- return;
- }
-
- context->getQueryObjectuiv(id, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, void** params = 0x%0.8p)",
- target, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
-
- GLsizei numParams = 0;
- if (!ValidateGetBufferPointervRobustANGLE(context, targetPacked, pname, bufSize, &numParams,
- params))
- {
- return;
- }
-
- context->getBufferPointerv(targetPacked, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, GLint* data = 0x%0.8p)",
- target, index, bufSize, length, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetIntegeri_vRobustANGLE(context, target, index, bufSize, &numParams, data))
- {
- return;
- }
-
- context->getIntegeri_v(target, index, data);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, GLint* params = 0x%0.8p)",
- target, internalformat, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetInternalFormativRobustANGLE(context, target, internalformat, pname, bufSize,
- &numParams, params))
- {
- return;
- }
-
- const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
- QueryInternalFormativ(formatCaps, pname, bufSize, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, "
- "GLint* params = 0x%0.8p)",
- index, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei writeLength = 0;
- if (!ValidateGetVertexAttribIivRobustANGLE(context, index, pname, bufSize, &writeLength,
- params))
- {
- return;
- }
-
- context->getVertexAttribIiv(index, pname, params);
- SetRobustLengthParam(length, writeLength);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, "
- "GLuint* params = 0x%0.8p)",
- index, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei writeLength = 0;
- if (!ValidateGetVertexAttribIuivRobustANGLE(context, index, pname, bufSize, &writeLength,
- params))
- {
- return;
- }
-
- context->getVertexAttribIuiv(index, pname, params);
- SetRobustLengthParam(length, writeLength);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, GLuint* params = 0x%0.8p)",
- program, location, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei writeLength = 0;
- if (!ValidateGetUniformuivRobustANGLE(context, program, location, bufSize, &writeLength,
- params))
- {
- return;
- }
-
- Program *programObject = context->getProgram(program);
- ASSERT(programObject);
-
- programObject->getUniformuiv(context, location, params);
- SetRobustLengthParam(length, writeLength);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, GLint* params = 0x%0.8p)",
- program, uniformBlockIndex, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei writeLength = 0;
- if (!ValidateGetActiveUniformBlockivRobustANGLE(context, program, uniformBlockIndex, pname,
- bufSize, &writeLength, params))
- {
- return;
- }
-
- const Program *programObject = context->getProgram(program);
- QueryActiveUniformBlockiv(programObject, uniformBlockIndex, pname, params);
- SetRobustLengthParam(length, writeLength);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetInteger64vRobustANGLE(GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint64 *data)
-{
- EVENT(
- "(GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLint64* params = "
- "0x%0.8p)",
- pname, bufSize, length, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams))
- {
- return;
- }
-
- if (nativeType == GL_INT_64_ANGLEX)
- {
- context->getInteger64v(pname, data);
- }
- else
- {
- CastStateValues(context, nativeType, pname, numParams, data);
- }
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, GLint64* data = 0x%0.8p)",
- target, index, bufSize, length, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetInteger64i_vRobustANGLE(context, target, index, bufSize, &numParams, data))
- {
- return;
- }
-
- context->getInteger64i_v(target, index, data);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64vRobustANGLE(GLenum target,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint64 *params)
-{
- EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", target, pname,
- bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
-
- GLsizei numParams = 0;
- if (!ValidateGetBufferParameteri64vRobustANGLE(context, targetPacked, pname, bufSize,
- &numParams, params))
- {
- return;
- }
-
- Buffer *buffer = context->getGLState().getTargetBuffer(targetPacked);
- QueryBufferParameteri64v(buffer, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY SamplerParameterivRobustANGLE(GLuint sampler,
- GLenum pname,
- GLsizei bufSize,
- const GLint *param)
-{
- EVENT(
- "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLint* params = "
- "0x%0.8p)",
- sampler, pname, bufSize, param);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateSamplerParameterivRobustANGLE(context, sampler, pname, bufSize, param))
- {
- return;
- }
-
- context->samplerParameteriv(sampler, pname, param);
- }
-}
-
-ANGLE_EXPORT 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* params = "
- "0x%0.8p)",
- sampler, pname, bufSize, param);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!ValidateSamplerParameterfvRobustANGLE(context, sampler, pname, bufSize, param))
- {
- return;
- }
-
- context->samplerParameterfv(sampler, pname, param);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, GLint* params = 0x%0.8p)",
- sampler, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetSamplerParameterivRobustANGLE(context, sampler, pname, bufSize, &numParams,
- params))
- {
- return;
- }
-
- context->getSamplerParameteriv(sampler, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfvRobustANGLE(GLuint sampler,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLfloat *params)
-{
- EVENT(
- "(GLuint sample = %ur, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = "
- "0x%0.8p, GLfloat* params = 0x%0.8p)",
- sampler, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetSamplerParameterfvRobustANGLE(context, sampler, pname, bufSize, &numParams,
- params))
- {
- return;
- }
-
- context->getSamplerParameterfv(sampler, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetFramebufferParameterivRobustANGLE(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%0.8p, GLint* params = 0x%0.8p)",
- target, pname, bufSize, length, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT 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%0.8p, GLint* params = 0x%0.8p)",
- program, programInterface, pname, bufSize, length, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT 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%0.8p, GLboolean* data = 0x%0.8p)",
- target, index, bufSize, length, data);
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetBooleani_vRobustANGLE(context, target, index, bufSize, &numParams, data))
- {
- return;
- }
-
- context->getBooleani_v(target, index, data);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT 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%0.8p, "
- "GLfloat* val = 0x%0.8p)",
- pname, index, bufSize, length, val);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT 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%0.8p, GLint* params = 0x%0.8p)",
- target, level, pname, bufSize, length, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT 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%0.8p, GLfloat* params = 0x%0.8p)",
- target, level, pname, bufSize, length, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetPointervRobustANGLERobustANGLE(GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- void **params)
-{
- EVENT(
- "(GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, void **params = "
- "0x%0.8p)",
- pname, bufSize, length, params);
- UNIMPLEMENTED();
-}
-
-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)
-{
- 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%0.8p, GLsizei* columns = 0x%0.8p, GLsizei* rows = 0x%0.8p, void *data = 0x%0.8p)",
- x, y, width, height, format, type, bufSize, length, columns, rows, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei writeLength = 0;
- GLsizei writeColumns = 0;
- GLsizei writeRows = 0;
- if (!ValidateReadnPixelsRobustANGLE(context, x, y, width, height, format, type, bufSize,
- &writeLength, &writeColumns, &writeRows, data))
- {
- return;
- }
-
- context->readPixels(x, y, width, height, format, type, data);
-
- SetRobustLengthParam(length, writeLength);
- SetRobustLengthParam(columns, writeColumns);
- SetRobustLengthParam(rows, writeRows);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetnUniformfvRobustANGLE(GLuint program,
- GLint location,
- GLsizei bufSize,
- GLsizei *length,
- GLfloat *params)
-{
- EVENT(
- "(GLuint program = %d, GLint location = %d, GLsizei bufsize = %d, GLsizei* length = "
- "0x%0.8p, GLfloat* params = 0x%0.8p)",
- program, location, bufSize, length, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetnUniformivRobustANGLE(GLuint program,
- GLint location,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- EVENT(
- "(GLuint program = %d, GLint location = %d, GLsizei bufsize = %d, GLsizei* length = "
- "0x%0.8p, GLint* params = 0x%0.8p)",
- program, location, bufSize, length, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT 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%0.8p, GLuint* params = 0x%0.8p)",
- program, location, bufSize, length, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT 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%0.8p)",
- target, pname, bufSize, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT 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%0.8p)",
- target, pname, bufSize, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT 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%0.8p, GLint *params = 0x%0.8p)",
- target, pname, bufSize, length, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT 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%0.8p, GLuint *params = 0x%0.8p)",
- target, pname, bufSize, length, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT void GL_APIENTRY SamplerParameterIivRobustANGLE(GLuint sampler,
- GLenum pname,
- GLsizei bufSize,
- const GLint *param)
-{
- EVENT(
- "(GLuint sampler = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLint *param = "
- "0x%0.8p)",
- sampler, pname, bufSize, param);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT void GL_APIENTRY SamplerParameterIuivRobustANGLE(GLuint sampler,
- GLenum pname,
- GLsizei bufSize,
- const GLuint *param)
-{
- EVENT(
- "(GLuint sampler = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLuint *param = "
- "0x%0.8p)",
- sampler, pname, bufSize, param);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIivRobustANGLE(GLuint sampler,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- EVENT(
- "(GLuint sampler = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = "
- "0x%0.8p, GLint *params = 0x%0.8p)",
- sampler, pname, bufSize, length, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIuivRobustANGLE(GLuint sampler,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLuint *params)
-{
- EVENT(
- "(GLuint sampler = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = "
- "0x%0.8p, GLuint *params = 0x%0.8p)",
- sampler, pname, bufSize, length, params);
- UNIMPLEMENTED();
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetQueryObjectivRobustANGLE(GLuint id,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- EVENT(
- "(GLuint id = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, "
- "GLuint *params = 0x%0.8p)",
- id, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetQueryObjectivRobustANGLE(context, id, pname, bufSize, &numParams, params))
- {
- return;
- }
-
- context->getQueryObjectiv(id, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetQueryObjecti64vRobustANGLE(GLuint id,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLint64 *params)
-{
- EVENT(
- "(GLuint id = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, "
- "GLint64 *params = 0x%0.8p)",
- id, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetQueryObjecti64vRobustANGLE(context, id, pname, bufSize, &numParams, params))
- {
- return;
- }
-
- context->getQueryObjecti64v(id, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-ANGLE_EXPORT void GL_APIENTRY GetQueryObjectui64vRobustANGLE(GLuint id,
- GLenum pname,
- GLsizei bufSize,
- GLsizei *length,
- GLuint64 *params)
-{
- EVENT(
- "(GLuint id = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, "
- "GLuint64 *params = 0x%0.8p)",
- id, pname, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- GLsizei numParams = 0;
- if (!ValidateGetQueryObjectui64vRobustANGLE(context, id, pname, bufSize, &numParams,
- params))
- {
- return;
- }
-
- context->getQueryObjectui64v(id, pname, params);
- SetRobustLengthParam(length, numParams);
- }
-}
-
-GL_APICALL void GL_APIENTRY FramebufferTextureMultiviewLayeredANGLE(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)
- {
- if (!context->skipValidation() &&
- !ValidateFramebufferTextureMultiviewLayeredANGLE(context, target, attachment, texture,
- level, baseViewIndex, numViews))
- {
- return;
- }
- context->framebufferTextureMultiviewLayeredANGLE(target, attachment, texture, level,
- baseViewIndex, numViews);
- }
-}
-
-GL_APICALL void GL_APIENTRY FramebufferTextureMultiviewSideBySideANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLsizei numViews,
- const GLint *viewportOffsets)
-{
- EVENT(
- "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, "
- "GLsizei numViews = %d, GLsizei* viewportOffsets = 0x%0.8p)",
- target, attachment, texture, level, numViews, viewportOffsets);
- Context *context = GetValidGlobalContext();
- if (context)
- {
- if (!context->skipValidation() &&
- !ValidateFramebufferTextureMultiviewSideBySideANGLE(
- context, target, attachment, texture, level, numViews, viewportOffsets))
- {
- return;
- }
- context->framebufferTextureMultiviewSideBySideANGLE(target, attachment, texture, level,
- numViews, viewportOffsets);
- }
-}
-
-} // gl
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_ext.h b/src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_ext.h
deleted file mode 100644
index 2a3fa607cf..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_2_0_ext.h
+++ /dev/null
@@ -1,717 +0,0 @@
-//
-// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// entry_points_gles_2_0_ext.h : Defines the GLES 2.0 extension entry points.
-
-#ifndef LIBGLESV2_ENTRYPOINTGLES20EXT_H_
-#define LIBGLESV2_ENTRYPOINTGLES20EXT_H_
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <export.h>
-
-namespace gl
-{
-
-// GL_ANGLE_framebuffer_blit
-ANGLE_EXPORT void GL_APIENTRY BlitFramebufferANGLE(GLint srcX0,
- GLint srcY0,
- GLint srcX1,
- GLint srcY1,
- GLint dstX0,
- GLint dstY0,
- GLint dstX1,
- GLint dstY1,
- GLbitfield mask,
- GLenum filter);
-
-// GL_ANGLE_framebuffer_multisample
-ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageMultisampleANGLE(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height);
-
-// GL_EXT_discard_framebuffer
-ANGLE_EXPORT void GL_APIENTRY DiscardFramebufferEXT(GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments);
-
-// GL_NV_fence
-ANGLE_EXPORT void GL_APIENTRY DeleteFencesNV(GLsizei n, const GLuint *fences);
-ANGLE_EXPORT void GL_APIENTRY GenFencesNV(GLsizei n, GLuint *fences);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsFenceNV(GLuint fence);
-ANGLE_EXPORT GLboolean GL_APIENTRY TestFenceNV(GLuint fence);
-ANGLE_EXPORT void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params);
-ANGLE_EXPORT void GL_APIENTRY FinishFenceNV(GLuint fence);
-ANGLE_EXPORT void GL_APIENTRY SetFenceNV(GLuint fence, GLenum condition);
-
-// GL_ANGLE_translated_shader_source
-ANGLE_EXPORT void GL_APIENTRY GetTranslatedShaderSourceANGLE(GLuint shader,
- GLsizei bufsize,
- GLsizei *length,
- GLchar *source);
-
-// GL_EXT_texture_storage
-ANGLE_EXPORT void GL_APIENTRY TexStorage2DEXT(GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height);
-
-// GL_EXT_robustness
-ANGLE_EXPORT GLenum GL_APIENTRY GetGraphicsResetStatusEXT(void);
-ANGLE_EXPORT void GL_APIENTRY ReadnPixelsEXT(GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- GLsizei bufSize,
- void *data);
-ANGLE_EXPORT void GL_APIENTRY GetnUniformfvEXT(GLuint program,
- GLint location,
- GLsizei bufSize,
- float *params);
-ANGLE_EXPORT void GL_APIENTRY GetnUniformivEXT(GLuint program,
- GLint location,
- GLsizei bufSize,
- GLint *params);
-
-// GL_EXT_occlusion_query_boolean
-ANGLE_EXPORT void GL_APIENTRY GenQueriesEXT(GLsizei n, GLuint *ids);
-ANGLE_EXPORT void GL_APIENTRY DeleteQueriesEXT(GLsizei n, const GLuint *ids);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsQueryEXT(GLuint id);
-ANGLE_EXPORT void GL_APIENTRY BeginQueryEXT(GLenum target, GLuint id);
-ANGLE_EXPORT void GL_APIENTRY EndQueryEXT(GLenum target);
-ANGLE_EXPORT void GL_APIENTRY GetQueryivEXT(GLenum target, GLenum pname, GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params);
-
-// GL_EXT_disjoint_timer_query
-ANGLE_EXPORT void GL_APIENTRY QueryCounterEXT(GLuint id, GLenum target);
-ANGLE_EXPORT void GL_APIENTRY GetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params);
-ANGLE_EXPORT void GL_APIENTRY GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params);
-
-// GL_EXT_draw_buffers
-ANGLE_EXPORT void GL_APIENTRY DrawBuffersEXT(GLsizei n, const GLenum *bufs);
-
-// GL_ANGLE_instanced_arrays
-ANGLE_EXPORT void GL_APIENTRY DrawArraysInstancedANGLE(GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei primcount);
-ANGLE_EXPORT void GL_APIENTRY DrawElementsInstancedANGLE(GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei primcount);
-ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor);
-
-// GL_OES_get_program_binary
-ANGLE_EXPORT void GL_APIENTRY GetProgramBinaryOES(GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- GLenum *binaryFormat,
- 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 MapBufferOES(GLenum target, GLenum access);
-ANGLE_EXPORT GLboolean GL_APIENTRY UnmapBufferOES(GLenum target);
-ANGLE_EXPORT void GL_APIENTRY GetBufferPointervOES(GLenum target, GLenum pname, void **params);
-
-// GL_EXT_map_buffer_range
-ANGLE_EXPORT void *GL_APIENTRY MapBufferRangeEXT(GLenum target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access);
-ANGLE_EXPORT void GL_APIENTRY FlushMappedBufferRangeEXT(GLenum target,
- GLintptr offset,
- GLsizeiptr length);
-
-// GL_EXT_debug_marker
-ANGLE_EXPORT void GL_APIENTRY InsertEventMarkerEXT(GLsizei length, const char *marker);
-ANGLE_EXPORT void GL_APIENTRY PushGroupMarkerEXT(GLsizei length, const char *marker);
-ANGLE_EXPORT void GL_APIENTRY PopGroupMarkerEXT();
-
-// GL_OES_EGL_image
-ANGLE_EXPORT void GL_APIENTRY EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
-ANGLE_EXPORT void GL_APIENTRY EGLImageTargetRenderbufferStorageOES(GLenum target,
- GLeglImageOES image);
-
-// 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_KHR_debug
-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 void GL_APIENTRY DebugMessageCallbackKHR(GLDEBUGPROCKHR callback,
- const void *userParam);
-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 PushDebugGroupKHR(GLenum source,
- GLuint id,
- GLsizei length,
- const GLchar *message);
-ANGLE_EXPORT void GL_APIENTRY PopDebugGroupKHR(void);
-ANGLE_EXPORT void GL_APIENTRY ObjectLabelKHR(GLenum identifier,
- GLuint name,
- GLsizei length,
- const GLchar *label);
-ANGLE_EXPORT void GL_APIENTRY
-GetObjectLabelKHR(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
-ANGLE_EXPORT void GL_APIENTRY ObjectPtrLabelKHR(const void *ptr,
- GLsizei length,
- const 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);
-
-// GL_CHROMIUM_bind_uniform_location
-ANGLE_EXPORT void GL_APIENTRY BindUniformLocationCHROMIUM(GLuint program,
- GLint location,
- const GLchar *name);
-
-// GL_CHROMIUM_framebuffer_mixed_samples
-ANGLE_EXPORT void GL_APIENTRY MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat *matrix);
-ANGLE_EXPORT void GL_APIENTRY MatrixLoadIdentityCHROMIUM(GLenum matrixMode);
-
-ANGLE_EXPORT void GL_APIENTRY CoverageModulationCHROMIUM(GLenum components);
-
-// GL_CHROMIUM_path_rendering
-ANGLE_EXPORT GLuint GL_APIENTRY GenPathsCHROMIUM(GLsizei chromium);
-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 GetPathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY GetPathParameteriCHROMIUM(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 numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues);
-ANGLE_EXPORT void GL_APIENTRY CoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- 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 StencilStrokePathInstancedCHROMIUM(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLint reference,
- 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 program,
- GLint location,
- const GLchar *name);
-ANGLE_EXPORT void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUM(GLuint program,
- GLint location,
- GLenum genMode,
- GLint components,
- const GLfloat *coeffs);
-
-// 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,
- GLsizei width,
- GLsizei height,
- GLboolean unpackFlipY,
- GLboolean unpackPremultiplyAlpha,
- GLboolean unpackUnmultiplyAlpha);
-
-// GL_CHROMIUM_copy_compressed_texture
-ANGLE_EXPORT void GL_APIENTRY CompressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId);
-
-// 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 *data);
-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 *data);
-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,
- GLint xoffset,
- GLint 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,
- GLenum 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(GLenum target,
- 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_multiview
-ANGLE_EXPORT void GL_APIENTRY FramebufferTextureMultiviewLayeredANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLint baseViewIndex,
- GLsizei numViews);
-ANGLE_EXPORT void GL_APIENTRY
-FramebufferTextureMultiviewSideBySideANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLsizei numViews,
- const GLint *viewportOffsets);
-} // namespace gl
-
-#endif // LIBGLESV2_ENTRYPOINTGLES20EXT_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_0_autogen.cpp b/src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_0_autogen.cpp
deleted file mode 100644
index 439f920bab..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_0_autogen.cpp
+++ /dev/null
@@ -1,2084 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by generate_entry_points.py using data from gl.xml.
-//
-// 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.
-//
-// entry_points_gles_3_0_autogen.cpp:
-// Defines the GLES 3.0 entry points.
-
-#include "libANGLE/Context.h"
-#include "libANGLE/validationES3.h"
-#include "libGLESv2/global_state.h"
-
-namespace gl
-{
-void GL_APIENTRY ReadBuffer(GLenum src)
-{
- EVENT("(GLenum src = 0x%X)", src);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ReadBuffer>(src);
-
- if (context->skipValidation() || ValidateReadBuffer(context, src))
- {
- context->readBuffer(src);
- }
- }
-}
-
-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%0.8p)",
- mode, start, end, count, type, indices);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DrawRangeElements>(mode, start, end, count, type,
- indices);
-
- if (context->skipValidation() ||
- ValidateDrawRangeElements(context, mode, start, end, count, type, indices))
- {
- context->drawRangeElements(mode, start, end, count, type, indices);
- }
- }
-}
-
-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%0.8p)",
- target, level, internalformat, width, height, depth, border, format, type, pixels);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::TexImage3D>(target, level, internalformat, width, height,
- depth, border, format, type, pixels);
-
- if (context->skipValidation() ||
- ValidateTexImage3D(context, target, level, internalformat, width, height, depth, border,
- format, type, pixels))
- {
- context->texImage3D(target, level, internalformat, width, height, depth, border, format,
- type, pixels);
- }
- }
-}
-
-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%0.8p)",
- target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::TexSubImage3D>(
- target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-
- if (context->skipValidation() ||
- ValidateTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, width, height,
- depth, format, type, pixels))
- {
- context->texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth,
- format, type, pixels);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::CopyTexSubImage3D>(target, level, xoffset, yoffset,
- zoffset, x, y, width, height);
-
- if (context->skipValidation() ||
- ValidateCopyTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, x, y,
- width, height))
- {
- context->copyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width,
- height);
- }
- }
-}
-
-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%0.8p)",
- target, level, internalformat, width, height, depth, border, imageSize, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::CompressedTexImage3D>(
- target, level, internalformat, width, height, depth, border, imageSize, data);
-
- if (context->skipValidation() ||
- ValidateCompressedTexImage3D(context, target, level, internalformat, width, height,
- depth, border, imageSize, data))
- {
- context->compressedTexImage3D(target, 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%0.8p)",
- target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::CompressedTexSubImage3D>(target, level, xoffset, yoffset,
- zoffset, width, height, depth,
- format, imageSize, data);
-
- if (context->skipValidation() ||
- ValidateCompressedTexSubImage3D(context, target, level, xoffset, yoffset, zoffset,
- width, height, depth, format, imageSize, data))
- {
- context->compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width,
- height, depth, format, imageSize, data);
- }
- }
-}
-
-void GL_APIENTRY GenQueries(GLsizei n, GLuint *ids)
-{
- EVENT("(GLsizei n = %d, GLuint *ids = 0x%0.8p)", n, ids);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GenQueries>(n, ids);
-
- if (context->skipValidation() || ValidateGenQueries(context, n, ids))
- {
- context->genQueries(n, ids);
- }
- }
-}
-
-void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint *ids)
-{
- EVENT("(GLsizei n = %d, const GLuint *ids = 0x%0.8p)", n, ids);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DeleteQueries>(n, ids);
-
- if (context->skipValidation() || ValidateDeleteQueries(context, n, ids))
- {
- context->deleteQueries(n, ids);
- }
- }
-}
-
-GLboolean GL_APIENTRY IsQuery(GLuint id)
-{
- EVENT("(GLuint id = %u)", id);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::IsQuery>(id);
-
- if (context->skipValidation() || ValidateIsQuery(context, id))
- {
- return context->isQuery(id);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::IsQuery, GLboolean>();
-}
-
-void GL_APIENTRY BeginQuery(GLenum target, GLuint id)
-{
- EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::BeginQuery>(target, id);
-
- if (context->skipValidation() || ValidateBeginQuery(context, target, id))
- {
- context->beginQuery(target, id);
- }
- }
-}
-
-void GL_APIENTRY EndQuery(GLenum target)
-{
- EVENT("(GLenum target = 0x%X)", target);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::EndQuery>(target);
-
- if (context->skipValidation() || ValidateEndQuery(context, target))
- {
- context->endQuery(target);
- }
- }
-}
-
-void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetQueryiv>(target, pname, params);
-
- if (context->skipValidation() || ValidateGetQueryiv(context, target, pname, params))
- {
- context->getQueryiv(target, pname, params);
- }
- }
-}
-
-void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetQueryObjectuiv>(id, pname, params);
-
- if (context->skipValidation() || ValidateGetQueryObjectuiv(context, id, pname, params))
- {
- context->getQueryObjectuiv(id, pname, params);
- }
- }
-}
-
-GLboolean GL_APIENTRY UnmapBuffer(GLenum target)
-{
- EVENT("(GLenum target = 0x%X)", target);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
- context->gatherParams<EntryPoint::UnmapBuffer>(targetPacked);
-
- if (context->skipValidation() || ValidateUnmapBuffer(context, targetPacked))
- {
- return context->unmapBuffer(targetPacked);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::UnmapBuffer, GLboolean>();
-}
-
-void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, void **params)
-{
- EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, void **params = 0x%0.8p)", target, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
- context->gatherParams<EntryPoint::GetBufferPointerv>(targetPacked, pname, params);
-
- if (context->skipValidation() ||
- ValidateGetBufferPointerv(context, targetPacked, pname, params))
- {
- context->getBufferPointerv(targetPacked, pname, params);
- }
- }
-}
-
-void GL_APIENTRY DrawBuffers(GLsizei n, const GLenum *bufs)
-{
- EVENT("(GLsizei n = %d, const GLenum *bufs = 0x%0.8p)", n, bufs);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DrawBuffers>(n, bufs);
-
- if (context->skipValidation() || ValidateDrawBuffers(context, n, bufs))
- {
- context->drawBuffers(n, bufs);
- }
- }
-}
-
-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%0.8p)",
- location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::UniformMatrix2x3fv>(location, count, transpose, value);
-
- if (context->skipValidation() ||
- ValidateUniformMatrix2x3fv(context, location, count, transpose, value))
- {
- context->uniformMatrix2x3fv(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%0.8p)",
- location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::UniformMatrix3x2fv>(location, count, transpose, value);
-
- if (context->skipValidation() ||
- ValidateUniformMatrix3x2fv(context, location, count, transpose, value))
- {
- context->uniformMatrix3x2fv(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%0.8p)",
- location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::UniformMatrix2x4fv>(location, count, transpose, value);
-
- if (context->skipValidation() ||
- ValidateUniformMatrix2x4fv(context, location, count, transpose, value))
- {
- context->uniformMatrix2x4fv(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%0.8p)",
- location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::UniformMatrix4x2fv>(location, count, transpose, value);
-
- if (context->skipValidation() ||
- ValidateUniformMatrix4x2fv(context, location, count, transpose, value))
- {
- context->uniformMatrix4x2fv(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%0.8p)",
- location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::UniformMatrix3x4fv>(location, count, transpose, value);
-
- if (context->skipValidation() ||
- ValidateUniformMatrix3x4fv(context, location, count, transpose, value))
- {
- context->uniformMatrix3x4fv(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%0.8p)",
- location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::UniformMatrix4x3fv>(location, count, transpose, value);
-
- if (context->skipValidation() ||
- ValidateUniformMatrix4x3fv(context, location, count, transpose, value))
- {
- context->uniformMatrix4x3fv(location, count, transpose, value);
- }
- }
-}
-
-void GL_APIENTRY BlitFramebuffer(GLint srcX0,
- GLint srcY0,
- GLint srcX1,
- GLint srcY1,
- GLint dstX0,
- GLint dstY0,
- GLint dstX1,
- GLint dstY1,
- GLbitfield mask,
- GLenum filter)
-{
- EVENT(
- "(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)
- {
- context->gatherParams<EntryPoint::BlitFramebuffer>(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 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)
- {
- context->gatherParams<EntryPoint::RenderbufferStorageMultisample>(
- 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
-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)
- {
- context->gatherParams<EntryPoint::FramebufferTextureLayer>(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 MapBufferRange(GLenum target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access)
-{
- EVENT(
- "(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = "
- "0x%X)",
- target, offset, length, access);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
- context->gatherParams<EntryPoint::MapBufferRange>(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 FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset,
- length);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
- context->gatherParams<EntryPoint::FlushMappedBufferRange>(targetPacked, offset, length);
-
- if (context->skipValidation() ||
- ValidateFlushMappedBufferRange(context, targetPacked, offset, length))
- {
- context->flushMappedBufferRange(targetPacked, offset, length);
- }
- }
-}
-
-void GL_APIENTRY BindVertexArray(GLuint array)
-{
- EVENT("(GLuint array = %u)", array);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::BindVertexArray>(array);
-
- if (context->skipValidation() || ValidateBindVertexArray(context, array))
- {
- context->bindVertexArray(array);
- }
- }
-}
-
-void GL_APIENTRY DeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- EVENT("(GLsizei n = %d, const GLuint *arrays = 0x%0.8p)", n, arrays);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DeleteVertexArrays>(n, arrays);
-
- if (context->skipValidation() || ValidateDeleteVertexArrays(context, n, arrays))
- {
- context->deleteVertexArrays(n, arrays);
- }
- }
-}
-
-void GL_APIENTRY GenVertexArrays(GLsizei n, GLuint *arrays)
-{
- EVENT("(GLsizei n = %d, GLuint *arrays = 0x%0.8p)", n, arrays);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GenVertexArrays>(n, arrays);
-
- if (context->skipValidation() || ValidateGenVertexArrays(context, n, arrays))
- {
- context->genVertexArrays(n, arrays);
- }
- }
-}
-
-GLboolean GL_APIENTRY IsVertexArray(GLuint array)
-{
- EVENT("(GLuint array = %u)", array);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::IsVertexArray>(array);
-
- if (context->skipValidation() || ValidateIsVertexArray(context, array))
- {
- return context->isVertexArray(array);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::IsVertexArray, GLboolean>();
-}
-
-void GL_APIENTRY GetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint *data = 0x%0.8p)", target, index, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetIntegeri_v>(target, index, data);
-
- if (context->skipValidation() || ValidateGetIntegeri_v(context, target, index, data))
- {
- context->getIntegeri_v(target, index, data);
- }
- }
-}
-
-void GL_APIENTRY BeginTransformFeedback(GLenum primitiveMode)
-{
- EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::BeginTransformFeedback>(primitiveMode);
-
- if (context->skipValidation() || ValidateBeginTransformFeedback(context, primitiveMode))
- {
- context->beginTransformFeedback(primitiveMode);
- }
- }
-}
-
-void GL_APIENTRY EndTransformFeedback()
-{
- EVENT("()");
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::EndTransformFeedback>();
-
- if (context->skipValidation() || ValidateEndTransformFeedback(context))
- {
- context->endTransformFeedback();
- }
- }
-}
-
-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 = %d, "
- "GLsizeiptr size = %d)",
- target, index, buffer, offset, size);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
- context->gatherParams<EntryPoint::BindBufferRange>(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 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);
- context->gatherParams<EntryPoint::BindBufferBase>(targetPacked, index, buffer);
-
- if (context->skipValidation() ||
- ValidateBindBufferBase(context, targetPacked, index, buffer))
- {
- context->bindBufferBase(targetPacked, index, buffer);
- }
- }
-}
-
-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%0.8p, GLenum "
- "bufferMode = 0x%X)",
- program, count, varyings, bufferMode);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::TransformFeedbackVaryings>(program, count, varyings,
- bufferMode);
-
- if (context->skipValidation() ||
- ValidateTransformFeedbackVaryings(context, program, count, varyings, bufferMode))
- {
- context->transformFeedbackVaryings(program, count, varyings, bufferMode);
- }
- }
-}
-
-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%0.8p, "
- "GLsizei *size = 0x%0.8p, GLenum *type = 0x%0.8p, GLchar *name = 0x%0.8p)",
- program, index, bufSize, length, size, type, name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetTransformFeedbackVarying>(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
-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%0.8p)",
- index, size, type, stride, pointer);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::VertexAttribIPointer>(index, size, type, stride, pointer);
-
- if (context->skipValidation() ||
- ValidateVertexAttribIPointer(context, index, size, type, stride, pointer))
- {
- context->vertexAttribIPointer(index, size, type, stride, pointer);
- }
- }
-}
-
-void GL_APIENTRY GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", index, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetVertexAttribIiv>(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%0.8p)", index, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetVertexAttribIuiv>(index, pname, params);
-
- if (context->skipValidation() || ValidateGetVertexAttribIuiv(context, index, pname, params))
- {
- context->getVertexAttribIuiv(index, pname, params);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::VertexAttribI4i>(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 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)
- {
- context->gatherParams<EntryPoint::VertexAttribI4ui>(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 VertexAttribI4iv(GLuint index, const GLint *v)
-{
- EVENT("(GLuint index = %u, const GLint *v = 0x%0.8p)", index, v);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::VertexAttribI4iv>(index, v);
-
- if (context->skipValidation() || ValidateVertexAttribI4iv(context, index, v))
- {
- context->vertexAttribI4iv(index, v);
- }
- }
-}
-
-void GL_APIENTRY VertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- EVENT("(GLuint index = %u, const GLuint *v = 0x%0.8p)", index, v);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::VertexAttribI4uiv>(index, v);
-
- if (context->skipValidation() || ValidateVertexAttribI4uiv(context, index, v))
- {
- context->vertexAttribI4uiv(index, v);
- }
- }
-}
-
-void GL_APIENTRY GetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- EVENT("(GLuint program = %u, GLint location = %d, GLuint *params = 0x%0.8p)", program, location,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetUniformuiv>(program, location, params);
-
- if (context->skipValidation() || ValidateGetUniformuiv(context, program, location, params))
- {
- context->getUniformuiv(program, location, params);
- }
- }
-}
-
-GLint GL_APIENTRY GetFragDataLocation(GLuint program, const GLchar *name)
-{
- EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)", program, name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetFragDataLocation>(program, name);
-
- if (context->skipValidation() || ValidateGetFragDataLocation(context, program, name))
- {
- return context->getFragDataLocation(program, name);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::GetFragDataLocation, GLint>();
-}
-
-void GL_APIENTRY Uniform1ui(GLint location, GLuint v0)
-{
- EVENT("(GLint location = %d, GLuint v0 = %u)", location, v0);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform1ui>(location, v0);
-
- if (context->skipValidation() || ValidateUniform1ui(context, location, v0))
- {
- context->uniform1ui(location, v0);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::Uniform2ui>(location, v0, v1);
-
- if (context->skipValidation() || ValidateUniform2ui(context, location, v0, v1))
- {
- context->uniform2ui(location, v0, v1);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::Uniform3ui>(location, v0, v1, v2);
-
- if (context->skipValidation() || ValidateUniform3ui(context, location, v0, v1, v2))
- {
- context->uniform3ui(location, v0, v1, v2);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::Uniform4ui>(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 Uniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- EVENT("(GLint location = %d, GLsizei count = %d, const GLuint *value = 0x%0.8p)", location,
- count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform1uiv>(location, count, value);
-
- if (context->skipValidation() || ValidateUniform1uiv(context, location, count, value))
- {
- context->uniform1uiv(location, count, value);
- }
- }
-}
-
-void GL_APIENTRY Uniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- EVENT("(GLint location = %d, GLsizei count = %d, const GLuint *value = 0x%0.8p)", location,
- count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform2uiv>(location, count, value);
-
- if (context->skipValidation() || ValidateUniform2uiv(context, location, count, value))
- {
- context->uniform2uiv(location, count, value);
- }
- }
-}
-
-void GL_APIENTRY Uniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- EVENT("(GLint location = %d, GLsizei count = %d, const GLuint *value = 0x%0.8p)", location,
- count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform3uiv>(location, count, value);
-
- if (context->skipValidation() || ValidateUniform3uiv(context, location, count, value))
- {
- context->uniform3uiv(location, count, value);
- }
- }
-}
-
-void GL_APIENTRY Uniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- EVENT("(GLint location = %d, GLsizei count = %d, const GLuint *value = 0x%0.8p)", location,
- count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::Uniform4uiv>(location, count, value);
-
- if (context->skipValidation() || ValidateUniform4uiv(context, location, count, value))
- {
- context->uniform4uiv(location, count, value);
- }
- }
-}
-
-void GL_APIENTRY ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint *value = 0x%0.8p)", buffer,
- drawbuffer, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ClearBufferiv>(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%0.8p)", buffer,
- drawbuffer, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ClearBufferuiv>(buffer, drawbuffer, value);
-
- if (context->skipValidation() || ValidateClearBufferuiv(context, buffer, drawbuffer, value))
- {
- context->clearBufferuiv(buffer, drawbuffer, value);
- }
- }
-}
-
-void GL_APIENTRY ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat *value = 0x%0.8p)", buffer,
- drawbuffer, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ClearBufferfv>(buffer, drawbuffer, value);
-
- if (context->skipValidation() || ValidateClearBufferfv(context, buffer, drawbuffer, value))
- {
- context->clearBufferfv(buffer, drawbuffer, value);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::ClearBufferfi>(buffer, drawbuffer, depth, stencil);
-
- if (context->skipValidation() ||
- ValidateClearBufferfi(context, buffer, drawbuffer, depth, stencil))
- {
- context->clearBufferfi(buffer, drawbuffer, depth, stencil);
- }
- }
-}
-
-const GLubyte *GL_APIENTRY GetStringi(GLenum name, GLuint index)
-{
- EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetStringi>(name, index);
-
- if (context->skipValidation() || ValidateGetStringi(context, name, index))
- {
- return context->getStringi(name, index);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::GetStringi, const GLubyte *>();
-}
-
-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 = %d, GLintptr "
- "writeOffset = %d, GLsizeiptr size = %d)",
- readTarget, writeTarget, readOffset, writeOffset, size);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding readTargetPacked = FromGLenum<BufferBinding>(readTarget);
- BufferBinding writeTargetPacked = FromGLenum<BufferBinding>(writeTarget);
- context->gatherParams<EntryPoint::CopyBufferSubData>(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 GetUniformIndices(GLuint program,
- GLsizei uniformCount,
- const GLchar *const *uniformNames,
- GLuint *uniformIndices)
-{
- EVENT(
- "(GLuint program = %u, GLsizei uniformCount = %d, const GLchar *const*uniformNames = "
- "0x%0.8p, GLuint *uniformIndices = 0x%0.8p)",
- program, uniformCount, uniformNames, uniformIndices);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetUniformIndices>(program, uniformCount, uniformNames,
- uniformIndices);
-
- if (context->skipValidation() ||
- ValidateGetUniformIndices(context, program, uniformCount, uniformNames, uniformIndices))
- {
- context->getUniformIndices(program, uniformCount, uniformNames, uniformIndices);
- }
- }
-}
-
-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%0.8p, "
- "GLenum pname = 0x%X, GLint *params = 0x%0.8p)",
- program, uniformCount, uniformIndices, pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetActiveUniformsiv>(program, uniformCount,
- uniformIndices, pname, params);
-
- if (context->skipValidation() || ValidateGetActiveUniformsiv(context, program, uniformCount,
- uniformIndices, pname, params))
- {
- context->getActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
- }
- }
-}
-
-GLuint GL_APIENTRY GetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- EVENT("(GLuint program = %u, const GLchar *uniformBlockName = 0x%0.8p)", program,
- uniformBlockName);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetUniformBlockIndex>(program, uniformBlockName);
-
- if (context->skipValidation() ||
- ValidateGetUniformBlockIndex(context, program, uniformBlockName))
- {
- return context->getUniformBlockIndex(program, uniformBlockName);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::GetUniformBlockIndex, GLuint>();
-}
-
-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%0.8p)",
- program, uniformBlockIndex, pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetActiveUniformBlockiv>(program, uniformBlockIndex,
- pname, params);
-
- if (context->skipValidation() ||
- ValidateGetActiveUniformBlockiv(context, program, uniformBlockIndex, pname, params))
- {
- context->getActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
- }
- }
-}
-
-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%0.8p, GLchar *uniformBlockName = 0x%0.8p)",
- program, uniformBlockIndex, bufSize, length, uniformBlockName);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetActiveUniformBlockName>(
- 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 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)
- {
- context->gatherParams<EntryPoint::UniformBlockBinding>(program, uniformBlockIndex,
- uniformBlockBinding);
-
- if (context->skipValidation() ||
- ValidateUniformBlockBinding(context, program, uniformBlockIndex, uniformBlockBinding))
- {
- context->uniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::DrawArraysInstanced>(mode, first, count, instancecount);
-
- if (context->skipValidation() ||
- ValidateDrawArraysInstanced(context, mode, first, count, instancecount))
- {
- context->drawArraysInstanced(mode, first, count, instancecount);
- }
- }
-}
-
-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%0.8p, GLsizei instancecount = %d)",
- mode, count, type, indices, instancecount);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DrawElementsInstanced>(mode, count, type, indices,
- instancecount);
-
- if (context->skipValidation() ||
- ValidateDrawElementsInstanced(context, mode, count, type, indices, instancecount))
- {
- context->drawElementsInstanced(mode, count, type, indices, instancecount);
- }
- }
-}
-
-GLsync GL_APIENTRY FenceSync(GLenum condition, GLbitfield flags)
-{
- EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::FenceSync>(condition, flags);
-
- if (context->skipValidation() || ValidateFenceSync(context, condition, flags))
- {
- return context->fenceSync(condition, flags);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::FenceSync, GLsync>();
-}
-
-GLboolean GL_APIENTRY IsSync(GLsync sync)
-{
- EVENT("(GLsync sync = 0x%0.8p)", sync);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::IsSync>(sync);
-
- if (context->skipValidation() || ValidateIsSync(context, sync))
- {
- return context->isSync(sync);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::IsSync, GLboolean>();
-}
-
-void GL_APIENTRY DeleteSync(GLsync sync)
-{
- EVENT("(GLsync sync = 0x%0.8p)", sync);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DeleteSync>(sync);
-
- if (context->skipValidation() || ValidateDeleteSync(context, sync))
- {
- context->deleteSync(sync);
- }
- }
-}
-
-GLenum GL_APIENTRY ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", sync, flags,
- timeout);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ClientWaitSync>(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 WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", sync, flags,
- timeout);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::WaitSync>(sync, flags, timeout);
-
- if (context->skipValidation() || ValidateWaitSync(context, sync, flags, timeout))
- {
- context->waitSync(sync, flags, timeout);
- }
- }
-}
-
-void GL_APIENTRY GetInteger64v(GLenum pname, GLint64 *data)
-{
- EVENT("(GLenum pname = 0x%X, GLint64 *data = 0x%0.8p)", pname, data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetInteger64v>(pname, data);
-
- if (context->skipValidation() || ValidateGetInteger64v(context, pname, data))
- {
- context->getInteger64v(pname, data);
- }
- }
-}
-
-void GL_APIENTRY
-GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- EVENT(
- "(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei *length = "
- "0x%0.8p, GLint *values = 0x%0.8p)",
- sync, pname, bufSize, length, values);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetSynciv>(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 GetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64 *data = 0x%0.8p)", target, index,
- data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetInteger64i_v>(target, index, data);
-
- if (context->skipValidation() || ValidateGetInteger64i_v(context, target, index, data))
- {
- context->getInteger64i_v(target, index, data);
- }
- }
-}
-
-void GL_APIENTRY GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64 *params = 0x%0.8p)", target, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
- context->gatherParams<EntryPoint::GetBufferParameteri64v>(targetPacked, pname, params);
-
- if (context->skipValidation() ||
- ValidateGetBufferParameteri64v(context, targetPacked, pname, params))
- {
- context->getBufferParameteri64v(targetPacked, pname, params);
- }
- }
-}
-
-void GL_APIENTRY GenSamplers(GLsizei count, GLuint *samplers)
-{
- EVENT("(GLsizei count = %d, GLuint *samplers = 0x%0.8p)", count, samplers);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GenSamplers>(count, samplers);
-
- if (context->skipValidation() || ValidateGenSamplers(context, count, samplers))
- {
- context->genSamplers(count, samplers);
- }
- }
-}
-
-void GL_APIENTRY DeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- EVENT("(GLsizei count = %d, const GLuint *samplers = 0x%0.8p)", count, samplers);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DeleteSamplers>(count, samplers);
-
- if (context->skipValidation() || ValidateDeleteSamplers(context, count, samplers))
- {
- context->deleteSamplers(count, samplers);
- }
- }
-}
-
-GLboolean GL_APIENTRY IsSampler(GLuint sampler)
-{
- EVENT("(GLuint sampler = %u)", sampler);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::IsSampler>(sampler);
-
- if (context->skipValidation() || ValidateIsSampler(context, sampler))
- {
- return context->isSampler(sampler);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::IsSampler, GLboolean>();
-}
-
-void GL_APIENTRY BindSampler(GLuint unit, GLuint sampler)
-{
- EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::BindSampler>(unit, sampler);
-
- if (context->skipValidation() || ValidateBindSampler(context, unit, sampler))
- {
- context->bindSampler(unit, sampler);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::SamplerParameteri>(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%0.8p)", sampler,
- pname, param);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::SamplerParameteriv>(sampler, pname, param);
-
- if (context->skipValidation() || ValidateSamplerParameteriv(context, sampler, pname, param))
- {
- context->samplerParameteriv(sampler, pname, param);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::SamplerParameterf>(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%0.8p)", sampler,
- pname, param);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::SamplerParameterfv>(sampler, pname, param);
-
- if (context->skipValidation() || ValidateSamplerParameterfv(context, sampler, pname, param))
- {
- context->samplerParameterfv(sampler, pname, param);
- }
- }
-}
-
-void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", sampler, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetSamplerParameteriv>(sampler, pname, params);
-
- if (context->skipValidation() ||
- ValidateGetSamplerParameteriv(context, sampler, pname, params))
- {
- context->getSamplerParameteriv(sampler, pname, params);
- }
- }
-}
-
-void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat *params = 0x%0.8p)", sampler, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetSamplerParameterfv>(sampler, pname, params);
-
- if (context->skipValidation() ||
- ValidateGetSamplerParameterfv(context, sampler, pname, params))
- {
- context->getSamplerParameterfv(sampler, pname, params);
- }
- }
-}
-
-void GL_APIENTRY VertexAttribDivisor(GLuint index, GLuint divisor)
-{
- EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::VertexAttribDivisor>(index, divisor);
-
- if (context->skipValidation() || ValidateVertexAttribDivisor(context, index, divisor))
- {
- context->vertexAttribDivisor(index, divisor);
- }
- }
-}
-
-void GL_APIENTRY BindTransformFeedback(GLenum target, GLuint id)
-{
- EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::BindTransformFeedback>(target, id);
-
- if (context->skipValidation() || ValidateBindTransformFeedback(context, target, id))
- {
- context->bindTransformFeedback(target, id);
- }
- }
-}
-
-void GL_APIENTRY DeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- EVENT("(GLsizei n = %d, const GLuint *ids = 0x%0.8p)", n, ids);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DeleteTransformFeedbacks>(n, ids);
-
- if (context->skipValidation() || ValidateDeleteTransformFeedbacks(context, n, ids))
- {
- context->deleteTransformFeedbacks(n, ids);
- }
- }
-}
-
-void GL_APIENTRY GenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- EVENT("(GLsizei n = %d, GLuint *ids = 0x%0.8p)", n, ids);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GenTransformFeedbacks>(n, ids);
-
- if (context->skipValidation() || ValidateGenTransformFeedbacks(context, n, ids))
- {
- context->genTransformFeedbacks(n, ids);
- }
- }
-}
-
-GLboolean GL_APIENTRY IsTransformFeedback(GLuint id)
-{
- EVENT("(GLuint id = %u)", id);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::IsTransformFeedback>(id);
-
- if (context->skipValidation() || ValidateIsTransformFeedback(context, id))
- {
- return context->isTransformFeedback(id);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::IsTransformFeedback, GLboolean>();
-}
-
-void GL_APIENTRY PauseTransformFeedback()
-{
- EVENT("()");
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::PauseTransformFeedback>();
-
- if (context->skipValidation() || ValidatePauseTransformFeedback(context))
- {
- context->pauseTransformFeedback();
- }
- }
-}
-
-void GL_APIENTRY ResumeTransformFeedback()
-{
- EVENT("()");
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ResumeTransformFeedback>();
-
- if (context->skipValidation() || ValidateResumeTransformFeedback(context))
- {
- context->resumeTransformFeedback();
- }
- }
-}
-
-void GL_APIENTRY GetProgramBinary(GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- GLenum *binaryFormat,
- void *binary)
-{
- EVENT(
- "(GLuint program = %u, GLsizei bufSize = %d, GLsizei *length = 0x%0.8p, GLenum "
- "*binaryFormat = 0x%0.8p, void *binary = 0x%0.8p)",
- program, bufSize, length, binaryFormat, binary);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetProgramBinary>(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 ProgramBinary(GLuint program,
- GLenum binaryFormat,
- const void *binary,
- GLsizei length)
-{
- EVENT(
- "(GLuint program = %u, GLenum binaryFormat = 0x%X, const void *binary = 0x%0.8p, GLsizei "
- "length = %d)",
- program, binaryFormat, binary, length);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramBinary>(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)
- {
- context->gatherParams<EntryPoint::ProgramParameteri>(program, pname, value);
-
- if (context->skipValidation() || ValidateProgramParameteri(context, program, pname, value))
- {
- context->programParameteri(program, pname, value);
- }
- }
-}
-
-void GL_APIENTRY InvalidateFramebuffer(GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments)
-{
- EVENT(
- "(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = 0x%0.8p)",
- target, numAttachments, attachments);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::InvalidateFramebuffer>(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%0.8p, "
- "GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
- target, numAttachments, attachments, x, y, width, height);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::InvalidateSubFramebuffer>(
- 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);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::TexStorage2D>(target, levels, internalformat, width,
- height);
-
- if (context->skipValidation() ||
- ValidateTexStorage2D(context, target, levels, internalformat, width, height))
- {
- context->texStorage2D(target, 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)
- {
- context->gatherParams<EntryPoint::TexStorage3D>(target, levels, internalformat, width,
- height, depth);
-
- if (context->skipValidation() ||
- ValidateTexStorage3D(context, target, levels, internalformat, width, height, depth))
- {
- context->texStorage3D(target, levels, internalformat, width, height, depth);
- }
- }
-}
-
-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%0.8p)",
- target, internalformat, pname, bufSize, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetInternalformativ>(target, internalformat, pname,
- bufSize, params);
-
- if (context->skipValidation() ||
- ValidateGetInternalformativ(context, target, internalformat, pname, bufSize, params))
- {
- context->getInternalformativ(target, internalformat, pname, bufSize, params);
- }
- }
-}
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_0_autogen.h b/src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_0_autogen.h
deleted file mode 100644
index e93dde96ed..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_0_autogen.h
+++ /dev/null
@@ -1,284 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by generate_entry_points.py using data from gl.xml.
-//
-// 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.
-//
-// entry_points_gles_3_0_autogen.h:
-// Defines the GLES 3.0 entry points.
-
-#ifndef LIBGLESV2_ENTRYPOINTSGLES30_AUTOGEN_H_
-#define LIBGLESV2_ENTRYPOINTSGLES30_AUTOGEN_H_
-
-#include <GLES3/gl3.h>
-#include <export.h>
-
-namespace gl
-{
-ANGLE_EXPORT void GL_APIENTRY ReadBuffer(GLenum src);
-ANGLE_EXPORT void GL_APIENTRY DrawRangeElements(GLenum mode,
- GLuint start,
- GLuint end,
- GLsizei count,
- GLenum type,
- const void *indices);
-ANGLE_EXPORT void GL_APIENTRY TexImage3D(GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels);
-ANGLE_EXPORT void GL_APIENTRY TexSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLenum type,
- const void *pixels);
-ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height);
-ANGLE_EXPORT void GL_APIENTRY CompressedTexImage3D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLsizei imageSize,
- const 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 GenQueries(GLsizei n, GLuint *ids);
-ANGLE_EXPORT void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint *ids);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsQuery(GLuint id);
-ANGLE_EXPORT void GL_APIENTRY BeginQuery(GLenum target, GLuint id);
-ANGLE_EXPORT void GL_APIENTRY EndQuery(GLenum target);
-ANGLE_EXPORT void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
-ANGLE_EXPORT GLboolean GL_APIENTRY UnmapBuffer(GLenum target);
-ANGLE_EXPORT void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, void **params);
-ANGLE_EXPORT void GL_APIENTRY DrawBuffers(GLsizei n, const GLenum *bufs);
-ANGLE_EXPORT void GL_APIENTRY UniformMatrix2x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY UniformMatrix3x2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY UniformMatrix2x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY UniformMatrix4x2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY UniformMatrix3x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY UniformMatrix4x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY BlitFramebuffer(GLint srcX0,
- GLint srcY0,
- GLint srcX1,
- GLint srcY1,
- GLint dstX0,
- GLint dstY0,
- GLint dstX1,
- GLint dstY1,
- GLbitfield mask,
- GLenum filter);
-ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageMultisample(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height);
-ANGLE_EXPORT void GL_APIENTRY
-FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-ANGLE_EXPORT void *GL_APIENTRY MapBufferRange(GLenum target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access);
-ANGLE_EXPORT void GL_APIENTRY FlushMappedBufferRange(GLenum target,
- GLintptr offset,
- GLsizeiptr length);
-ANGLE_EXPORT void GL_APIENTRY BindVertexArray(GLuint array);
-ANGLE_EXPORT void GL_APIENTRY DeleteVertexArrays(GLsizei n, const GLuint *arrays);
-ANGLE_EXPORT void GL_APIENTRY GenVertexArrays(GLsizei n, GLuint *arrays);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsVertexArray(GLuint array);
-ANGLE_EXPORT void GL_APIENTRY GetIntegeri_v(GLenum target, GLuint index, GLint *data);
-ANGLE_EXPORT void GL_APIENTRY BeginTransformFeedback(GLenum primitiveMode);
-ANGLE_EXPORT void GL_APIENTRY EndTransformFeedback();
-ANGLE_EXPORT void GL_APIENTRY
-BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-ANGLE_EXPORT void GL_APIENTRY BindBufferBase(GLenum target, GLuint index, GLuint buffer);
-ANGLE_EXPORT void GL_APIENTRY TransformFeedbackVaryings(GLuint program,
- GLsizei count,
- const GLchar *const *varyings,
- GLenum bufferMode);
-ANGLE_EXPORT void GL_APIENTRY GetTransformFeedbackVarying(GLuint program,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLsizei *size,
- GLenum *type,
- GLchar *name);
-ANGLE_EXPORT void GL_APIENTRY
-VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
-ANGLE_EXPORT void GL_APIENTRY VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
-ANGLE_EXPORT void GL_APIENTRY
-VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-ANGLE_EXPORT void GL_APIENTRY VertexAttribI4iv(GLuint index, const GLint *v);
-ANGLE_EXPORT void GL_APIENTRY VertexAttribI4uiv(GLuint index, const GLuint *v);
-ANGLE_EXPORT void GL_APIENTRY GetUniformuiv(GLuint program, GLint location, GLuint *params);
-ANGLE_EXPORT GLint GL_APIENTRY GetFragDataLocation(GLuint program, const GLchar *name);
-ANGLE_EXPORT void GL_APIENTRY Uniform1ui(GLint location, GLuint v0);
-ANGLE_EXPORT void GL_APIENTRY Uniform2ui(GLint location, GLuint v0, GLuint v1);
-ANGLE_EXPORT void GL_APIENTRY Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
-ANGLE_EXPORT void GL_APIENTRY
-Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-ANGLE_EXPORT void GL_APIENTRY Uniform1uiv(GLint location, GLsizei count, const GLuint *value);
-ANGLE_EXPORT void GL_APIENTRY Uniform2uiv(GLint location, GLsizei count, const GLuint *value);
-ANGLE_EXPORT void GL_APIENTRY Uniform3uiv(GLint location, GLsizei count, const GLuint *value);
-ANGLE_EXPORT void GL_APIENTRY Uniform4uiv(GLint location, GLsizei count, const GLuint *value);
-ANGLE_EXPORT void GL_APIENTRY ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
-ANGLE_EXPORT void GL_APIENTRY ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
-ANGLE_EXPORT void GL_APIENTRY ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY ClearBufferfi(GLenum buffer,
- GLint drawbuffer,
- GLfloat depth,
- GLint stencil);
-ANGLE_EXPORT const GLubyte *GL_APIENTRY GetStringi(GLenum name, GLuint index);
-ANGLE_EXPORT void GL_APIENTRY CopyBufferSubData(GLenum readTarget,
- GLenum writeTarget,
- GLintptr readOffset,
- GLintptr writeOffset,
- GLsizeiptr size);
-ANGLE_EXPORT void GL_APIENTRY GetUniformIndices(GLuint program,
- GLsizei uniformCount,
- const GLchar *const *uniformNames,
- GLuint *uniformIndices);
-ANGLE_EXPORT void GL_APIENTRY GetActiveUniformsiv(GLuint program,
- GLsizei uniformCount,
- const GLuint *uniformIndices,
- GLenum pname,
- GLint *params);
-ANGLE_EXPORT GLuint GL_APIENTRY GetUniformBlockIndex(GLuint program,
- const GLchar *uniformBlockName);
-ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockiv(GLuint program,
- GLuint uniformBlockIndex,
- GLenum pname,
- GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockName(GLuint program,
- GLuint uniformBlockIndex,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *uniformBlockName);
-ANGLE_EXPORT void GL_APIENTRY UniformBlockBinding(GLuint program,
- GLuint uniformBlockIndex,
- GLuint uniformBlockBinding);
-ANGLE_EXPORT void GL_APIENTRY DrawArraysInstanced(GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei instancecount);
-ANGLE_EXPORT void GL_APIENTRY DrawElementsInstanced(GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instancecount);
-ANGLE_EXPORT GLsync GL_APIENTRY FenceSync(GLenum condition, GLbitfield flags);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsSync(GLsync sync);
-ANGLE_EXPORT void GL_APIENTRY DeleteSync(GLsync sync);
-ANGLE_EXPORT GLenum GL_APIENTRY ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
-ANGLE_EXPORT void GL_APIENTRY WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
-ANGLE_EXPORT void GL_APIENTRY GetInteger64v(GLenum pname, GLint64 *data);
-ANGLE_EXPORT void GL_APIENTRY
-GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-ANGLE_EXPORT void GL_APIENTRY GetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
-ANGLE_EXPORT void GL_APIENTRY GenSamplers(GLsizei count, GLuint *samplers);
-ANGLE_EXPORT void GL_APIENTRY DeleteSamplers(GLsizei count, const GLuint *samplers);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsSampler(GLuint sampler);
-ANGLE_EXPORT void GL_APIENTRY BindSampler(GLuint unit, GLuint sampler);
-ANGLE_EXPORT void GL_APIENTRY SamplerParameteri(GLuint sampler, GLenum pname, GLint param);
-ANGLE_EXPORT void GL_APIENTRY SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
-ANGLE_EXPORT void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
-ANGLE_EXPORT void GL_APIENTRY SamplerParameterfv(GLuint sampler,
- GLenum pname,
- const GLfloat *param);
-ANGLE_EXPORT void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
-ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisor(GLuint index, GLuint divisor);
-ANGLE_EXPORT void GL_APIENTRY BindTransformFeedback(GLenum target, GLuint id);
-ANGLE_EXPORT void GL_APIENTRY DeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
-ANGLE_EXPORT void GL_APIENTRY GenTransformFeedbacks(GLsizei n, GLuint *ids);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsTransformFeedback(GLuint id);
-ANGLE_EXPORT void GL_APIENTRY PauseTransformFeedback();
-ANGLE_EXPORT void GL_APIENTRY ResumeTransformFeedback();
-ANGLE_EXPORT void GL_APIENTRY GetProgramBinary(GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- GLenum *binaryFormat,
- void *binary);
-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 InvalidateFramebuffer(GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments);
-ANGLE_EXPORT void GL_APIENTRY InvalidateSubFramebuffer(GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height);
-ANGLE_EXPORT void GL_APIENTRY
-TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-ANGLE_EXPORT void GL_APIENTRY TexStorage3D(GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth);
-ANGLE_EXPORT void GL_APIENTRY GetInternalformativ(GLenum target,
- GLenum internalformat,
- GLenum pname,
- GLsizei bufSize,
- GLint *params);
-} // namespace gl
-
-#endif // LIBGLESV2_ENTRYPOINTSGLES30_AUTOGEN_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_1_autogen.cpp b/src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_1_autogen.cpp
deleted file mode 100644
index 5d836872d6..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_1_autogen.cpp
+++ /dev/null
@@ -1,1430 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by generate_entry_points.py using data from gl.xml.
-//
-// 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.
-//
-// entry_points_gles_3_1_autogen.cpp:
-// Defines the GLES 3.1 entry points.
-
-#include "libANGLE/Context.h"
-#include "libANGLE/validationES31.h"
-#include "libGLESv2/global_state.h"
-
-namespace gl
-{
-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)
- {
- context->gatherParams<EntryPoint::DispatchCompute>(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 = %d)", indirect);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DispatchComputeIndirect>(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%0.8p)", mode, indirect);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DrawArraysIndirect>(mode, indirect);
-
- if (context->skipValidation() || ValidateDrawArraysIndirect(context, mode, indirect))
- {
- context->drawArraysIndirect(mode, 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%0.8p)", mode, type,
- indirect);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DrawElementsIndirect>(mode, type, indirect);
-
- if (context->skipValidation() ||
- ValidateDrawElementsIndirect(context, mode, type, indirect))
- {
- context->drawElementsIndirect(mode, type, 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)
- {
- context->gatherParams<EntryPoint::FramebufferParameteri>(target, pname, param);
-
- if (context->skipValidation() ||
- ValidateFramebufferParameteri(context, target, pname, param))
- {
- context->framebufferParameteri(target, pname, param);
- }
- }
-}
-
-void GL_APIENTRY GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetFramebufferParameteriv>(target, pname, params);
-
- if (context->skipValidation() ||
- ValidateGetFramebufferParameteriv(context, target, pname, params))
- {
- context->getFramebufferParameteriv(target, pname, params);
- }
- }
-}
-
-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%0.8p)",
- program, programInterface, pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetProgramInterfaceiv>(program, programInterface, pname,
- params);
-
- if (context->skipValidation() ||
- ValidateGetProgramInterfaceiv(context, program, programInterface, pname, params))
- {
- context->getProgramInterfaceiv(program, programInterface, 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%0.8p)",
- program, programInterface, name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetProgramResourceIndex>(program, programInterface, name);
-
- if (context->skipValidation() ||
- ValidateGetProgramResourceIndex(context, program, programInterface, name))
- {
- return context->getProgramResourceIndex(program, programInterface, name);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::GetProgramResourceIndex, GLuint>();
-}
-
-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%0.8p, GLchar *name = 0x%0.8p)",
- program, programInterface, index, bufSize, length, name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetProgramResourceName>(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%0.8p, GLsizei bufSize = %d, GLsizei *length = "
- "0x%0.8p, GLint *params = 0x%0.8p)",
- program, programInterface, index, propCount, props, bufSize, length, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetProgramResourceiv>(
- 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);
- }
- }
-}
-
-GLint GL_APIENTRY GetProgramResourceLocation(GLuint program,
- GLenum programInterface,
- const GLchar *name)
-{
- EVENT("(GLuint program = %u, GLenum programInterface = 0x%X, const GLchar *name = 0x%0.8p)",
- program, programInterface, name);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetProgramResourceLocation>(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 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)
- {
- context->gatherParams<EntryPoint::UseProgramStages>(pipeline, stages, program);
-
- if (context->skipValidation() ||
- ValidateUseProgramStages(context, pipeline, stages, program))
- {
- context->useProgramStages(pipeline, stages, program);
- }
- }
-}
-
-void GL_APIENTRY ActiveShaderProgram(GLuint pipeline, GLuint program)
-{
- EVENT("(GLuint pipeline = %u, GLuint program = %u)", pipeline, program);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ActiveShaderProgram>(pipeline, program);
-
- if (context->skipValidation() || ValidateActiveShaderProgram(context, pipeline, program))
- {
- context->activeShaderProgram(pipeline, program);
- }
- }
-}
-
-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%0.8p)", type,
- count, strings);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::CreateShaderProgramv>(type, count, strings);
-
- if (context->skipValidation() ||
- ValidateCreateShaderProgramv(context, type, count, strings))
- {
- return context->createShaderProgramv(type, count, strings);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::CreateShaderProgramv, GLuint>();
-}
-
-void GL_APIENTRY BindProgramPipeline(GLuint pipeline)
-{
- EVENT("(GLuint pipeline = %u)", pipeline);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::BindProgramPipeline>(pipeline);
-
- if (context->skipValidation() || ValidateBindProgramPipeline(context, pipeline))
- {
- context->bindProgramPipeline(pipeline);
- }
- }
-}
-
-void GL_APIENTRY DeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
-{
- EVENT("(GLsizei n = %d, const GLuint *pipelines = 0x%0.8p)", n, pipelines);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::DeleteProgramPipelines>(n, pipelines);
-
- if (context->skipValidation() || ValidateDeleteProgramPipelines(context, n, pipelines))
- {
- context->deleteProgramPipelines(n, pipelines);
- }
- }
-}
-
-void GL_APIENTRY GenProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- EVENT("(GLsizei n = %d, GLuint *pipelines = 0x%0.8p)", n, pipelines);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GenProgramPipelines>(n, pipelines);
-
- if (context->skipValidation() || ValidateGenProgramPipelines(context, n, pipelines))
- {
- context->genProgramPipelines(n, pipelines);
- }
- }
-}
-
-GLboolean GL_APIENTRY IsProgramPipeline(GLuint pipeline)
-{
- EVENT("(GLuint pipeline = %u)", pipeline);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::IsProgramPipeline>(pipeline);
-
- if (context->skipValidation() || ValidateIsProgramPipeline(context, pipeline))
- {
- return context->isProgramPipeline(pipeline);
- }
- }
-
- return GetDefaultReturnValue<EntryPoint::IsProgramPipeline, GLboolean>();
-}
-
-void GL_APIENTRY GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- EVENT("(GLuint pipeline = %u, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", pipeline, pname,
- params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetProgramPipelineiv>(pipeline, pname, params);
-
- if (context->skipValidation() ||
- ValidateGetProgramPipelineiv(context, pipeline, pname, params))
- {
- context->getProgramPipelineiv(pipeline, pname, params);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::ProgramUniform1i>(program, location, v0);
-
- if (context->skipValidation() || ValidateProgramUniform1i(context, program, location, v0))
- {
- context->programUniform1i(program, location, v0);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::ProgramUniform2i>(program, location, v0, v1);
-
- if (context->skipValidation() ||
- ValidateProgramUniform2i(context, program, location, v0, v1))
- {
- context->programUniform2i(program, location, v0, v1);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::ProgramUniform3i>(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
-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)
- {
- context->gatherParams<EntryPoint::ProgramUniform4i>(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 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)
- {
- context->gatherParams<EntryPoint::ProgramUniform1ui>(program, location, v0);
-
- if (context->skipValidation() || ValidateProgramUniform1ui(context, program, location, v0))
- {
- context->programUniform1ui(program, location, v0);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::ProgramUniform2ui>(program, location, v0, v1);
-
- if (context->skipValidation() ||
- ValidateProgramUniform2ui(context, program, location, v0, v1))
- {
- context->programUniform2ui(program, location, v0, v1);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::ProgramUniform3ui>(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
-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)
- {
- context->gatherParams<EntryPoint::ProgramUniform4ui>(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 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)
- {
- context->gatherParams<EntryPoint::ProgramUniform1f>(program, location, v0);
-
- if (context->skipValidation() || ValidateProgramUniform1f(context, program, location, v0))
- {
- context->programUniform1f(program, location, v0);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::ProgramUniform2f>(program, location, v0, v1);
-
- if (context->skipValidation() ||
- ValidateProgramUniform2f(context, program, location, v0, v1))
- {
- context->programUniform2f(program, location, v0, v1);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::ProgramUniform3f>(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
-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)
- {
- context->gatherParams<EntryPoint::ProgramUniform4f>(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 ProgramUniform1iv(GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value)
-{
- EVENT(
- "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint *value = "
- "0x%0.8p)",
- program, location, count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniform1iv>(program, location, count, value);
-
- if (context->skipValidation() ||
- ValidateProgramUniform1iv(context, program, location, count, value))
- {
- context->programUniform1iv(program, location, count, value);
- }
- }
-}
-
-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%0.8p)",
- program, location, count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniform2iv>(program, location, count, value);
-
- if (context->skipValidation() ||
- ValidateProgramUniform2iv(context, program, location, count, value))
- {
- context->programUniform2iv(program, location, count, value);
- }
- }
-}
-
-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%0.8p)",
- program, location, count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniform3iv>(program, location, count, value);
-
- if (context->skipValidation() ||
- ValidateProgramUniform3iv(context, program, location, count, value))
- {
- context->programUniform3iv(program, location, count, value);
- }
- }
-}
-
-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%0.8p)",
- program, location, count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniform4iv>(program, location, count, value);
-
- if (context->skipValidation() ||
- ValidateProgramUniform4iv(context, program, location, count, value))
- {
- context->programUniform4iv(program, location, count, value);
- }
- }
-}
-
-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%0.8p)",
- program, location, count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniform1uiv>(program, location, count, value);
-
- if (context->skipValidation() ||
- ValidateProgramUniform1uiv(context, program, location, count, value))
- {
- context->programUniform1uiv(program, location, count, value);
- }
- }
-}
-
-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%0.8p)",
- program, location, count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniform2uiv>(program, location, count, value);
-
- if (context->skipValidation() ||
- ValidateProgramUniform2uiv(context, program, location, count, value))
- {
- context->programUniform2uiv(program, location, count, value);
- }
- }
-}
-
-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%0.8p)",
- program, location, count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniform3uiv>(program, location, count, value);
-
- if (context->skipValidation() ||
- ValidateProgramUniform3uiv(context, program, location, count, value))
- {
- context->programUniform3uiv(program, location, count, value);
- }
- }
-}
-
-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%0.8p)",
- program, location, count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniform4uiv>(program, location, count, value);
-
- if (context->skipValidation() ||
- ValidateProgramUniform4uiv(context, program, location, count, value))
- {
- context->programUniform4uiv(program, location, count, value);
- }
- }
-}
-
-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%0.8p)",
- program, location, count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniform1fv>(program, location, count, value);
-
- if (context->skipValidation() ||
- ValidateProgramUniform1fv(context, program, location, count, value))
- {
- context->programUniform1fv(program, location, count, value);
- }
- }
-}
-
-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%0.8p)",
- program, location, count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniform2fv>(program, location, count, value);
-
- if (context->skipValidation() ||
- ValidateProgramUniform2fv(context, program, location, count, value))
- {
- context->programUniform2fv(program, location, count, value);
- }
- }
-}
-
-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%0.8p)",
- program, location, count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniform3fv>(program, location, count, value);
-
- if (context->skipValidation() ||
- ValidateProgramUniform3fv(context, program, location, count, value))
- {
- context->programUniform3fv(program, location, count, value);
- }
- }
-}
-
-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%0.8p)",
- program, location, count, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniform4fv>(program, location, count, value);
-
- if (context->skipValidation() ||
- ValidateProgramUniform4fv(context, program, location, count, value))
- {
- context->programUniform4fv(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%0.8p)",
- program, location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniformMatrix2fv>(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 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%0.8p)",
- program, location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniformMatrix3fv>(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 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%0.8p)",
- program, location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniformMatrix4fv>(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 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%0.8p)",
- program, location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniformMatrix2x3fv>(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 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%0.8p)",
- program, location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniformMatrix3x2fv>(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 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%0.8p)",
- program, location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniformMatrix2x4fv>(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 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%0.8p)",
- program, location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniformMatrix4x2fv>(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 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%0.8p)",
- program, location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniformMatrix3x4fv>(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 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%0.8p)",
- program, location, count, transpose, value);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ProgramUniformMatrix4x3fv>(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 ValidateProgramPipeline(GLuint pipeline)
-{
- EVENT("(GLuint pipeline = %u)", pipeline);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::ValidateProgramPipeline>(pipeline);
-
- if (context->skipValidation() || ValidateValidateProgramPipeline(context, pipeline))
- {
- context->validateProgramPipeline(pipeline);
- }
- }
-}
-
-void GL_APIENTRY GetProgramPipelineInfoLog(GLuint pipeline,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *infoLog)
-{
- EVENT(
- "(GLuint pipeline = %u, GLsizei bufSize = %d, GLsizei *length = 0x%0.8p, GLchar *infoLog = "
- "0x%0.8p)",
- pipeline, bufSize, length, infoLog);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetProgramPipelineInfoLog>(pipeline, bufSize, length,
- infoLog);
-
- if (context->skipValidation() ||
- ValidateGetProgramPipelineInfoLog(context, pipeline, bufSize, length, infoLog))
- {
- context->getProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::BindImageTexture>(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 GetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- EVENT("(GLenum target = 0x%X, GLuint index = %u, GLboolean *data = 0x%0.8p)", target, index,
- data);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetBooleani_v>(target, index, data);
-
- if (context->skipValidation() || ValidateGetBooleani_v(context, target, index, data))
- {
- context->getBooleani_v(target, index, data);
- }
- }
-}
-
-void GL_APIENTRY MemoryBarrier(GLbitfield barriers)
-{
- EVENT("(GLbitfield barriers = 0x%X)", barriers);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::MemoryBarrier>(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)
- {
- context->gatherParams<EntryPoint::MemoryBarrierByRegion>(barriers);
-
- if (context->skipValidation() || ValidateMemoryBarrierByRegion(context, barriers))
- {
- context->memoryBarrierByRegion(barriers);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::TexStorage2DMultisample>(
- target, samples, internalformat, width, height, fixedsamplelocations);
-
- if (context->skipValidation() ||
- ValidateTexStorage2DMultisample(context, target, samples, internalformat, width, height,
- fixedsamplelocations))
- {
- context->texStorage2DMultisample(target, samples, internalformat, width, height,
- fixedsamplelocations);
- }
- }
-}
-
-void GL_APIENTRY GetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- EVENT("(GLenum pname = 0x%X, GLuint index = %u, GLfloat *val = 0x%0.8p)", pname, index, val);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetMultisamplefv>(pname, index, val);
-
- if (context->skipValidation() || ValidateGetMultisamplefv(context, pname, index, val))
- {
- context->getMultisamplefv(pname, index, val);
- }
- }
-}
-
-void GL_APIENTRY SampleMaski(GLuint maskNumber, GLbitfield mask)
-{
- EVENT("(GLuint maskNumber = %u, GLbitfield mask = 0x%X)", maskNumber, mask);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::SampleMaski>(maskNumber, mask);
-
- if (context->skipValidation() || ValidateSampleMaski(context, maskNumber, mask))
- {
- context->sampleMaski(maskNumber, mask);
- }
- }
-}
-
-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%0.8p)",
- target, level, pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetTexLevelParameteriv>(target, level, pname, params);
-
- if (context->skipValidation() ||
- ValidateGetTexLevelParameteriv(context, target, level, pname, params))
- {
- context->getTexLevelParameteriv(target, level, pname, 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%0.8p)",
- target, level, pname, params);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::GetTexLevelParameterfv>(target, level, pname, params);
-
- if (context->skipValidation() ||
- ValidateGetTexLevelParameterfv(context, target, level, pname, params))
- {
- context->getTexLevelParameterfv(target, level, pname, params);
- }
- }
-}
-
-void GL_APIENTRY BindVertexBuffer(GLuint bindingindex,
- GLuint buffer,
- GLintptr offset,
- GLsizei stride)
-{
- EVENT(
- "(GLuint bindingindex = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizei stride = %d)",
- bindingindex, buffer, offset, stride);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::BindVertexBuffer>(bindingindex, buffer, offset, stride);
-
- if (context->skipValidation() ||
- ValidateBindVertexBuffer(context, bindingindex, buffer, offset, stride))
- {
- context->bindVertexBuffer(bindingindex, buffer, offset, stride);
- }
- }
-}
-
-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)
- {
- context->gatherParams<EntryPoint::VertexAttribFormat>(attribindex, size, type, normalized,
- relativeoffset);
-
- if (context->skipValidation() ||
- ValidateVertexAttribFormat(context, attribindex, size, type, normalized,
- relativeoffset))
- {
- context->vertexAttribFormat(attribindex, size, type, 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)
- {
- context->gatherParams<EntryPoint::VertexAttribIFormat>(attribindex, size, type,
- relativeoffset);
-
- if (context->skipValidation() ||
- ValidateVertexAttribIFormat(context, attribindex, size, type, relativeoffset))
- {
- context->vertexAttribIFormat(attribindex, size, type, relativeoffset);
- }
- }
-}
-
-void GL_APIENTRY VertexAttribBinding(GLuint attribindex, GLuint bindingindex)
-{
- EVENT("(GLuint attribindex = %u, GLuint bindingindex = %u)", attribindex, bindingindex);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::VertexAttribBinding>(attribindex, bindingindex);
-
- if (context->skipValidation() ||
- ValidateVertexAttribBinding(context, attribindex, bindingindex))
- {
- context->vertexAttribBinding(attribindex, bindingindex);
- }
- }
-}
-
-void GL_APIENTRY VertexBindingDivisor(GLuint bindingindex, GLuint divisor)
-{
- EVENT("(GLuint bindingindex = %u, GLuint divisor = %u)", bindingindex, divisor);
-
- Context *context = GetValidGlobalContext();
- if (context)
- {
- context->gatherParams<EntryPoint::VertexBindingDivisor>(bindingindex, divisor);
-
- if (context->skipValidation() ||
- ValidateVertexBindingDivisor(context, bindingindex, divisor))
- {
- context->vertexBindingDivisor(bindingindex, divisor);
- }
- }
-}
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_1_autogen.h b/src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_1_autogen.h
deleted file mode 100644
index e11d5a10bf..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_gles_3_1_autogen.h
+++ /dev/null
@@ -1,228 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by generate_entry_points.py using data from gl.xml.
-//
-// 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.
-//
-// entry_points_gles_3_1_autogen.h:
-// Defines the GLES 3.1 entry points.
-
-#ifndef LIBGLESV2_ENTRYPOINTSGLES31_AUTOGEN_H_
-#define LIBGLESV2_ENTRYPOINTSGLES31_AUTOGEN_H_
-
-#include <GLES3/gl31.h>
-#include <export.h>
-
-#include "common/platform.h"
-
-namespace gl
-{
-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 GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetProgramInterfaceiv(GLuint program,
- GLenum programInterface,
- GLenum pname,
- GLint *params);
-ANGLE_EXPORT GLuint GL_APIENTRY GetProgramResourceIndex(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 GLint GL_APIENTRY GetProgramResourceLocation(GLuint program,
- GLenum programInterface,
- const GLchar *name);
-ANGLE_EXPORT void GL_APIENTRY UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
-ANGLE_EXPORT void GL_APIENTRY ActiveShaderProgram(GLuint pipeline, GLuint program);
-ANGLE_EXPORT GLuint GL_APIENTRY CreateShaderProgramv(GLenum type,
- GLsizei count,
- const GLchar *const *strings);
-ANGLE_EXPORT void GL_APIENTRY BindProgramPipeline(GLuint pipeline);
-ANGLE_EXPORT void GL_APIENTRY DeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
-ANGLE_EXPORT void GL_APIENTRY GenProgramPipelines(GLsizei n, GLuint *pipelines);
-ANGLE_EXPORT GLboolean GL_APIENTRY IsProgramPipeline(GLuint pipeline);
-ANGLE_EXPORT void GL_APIENTRY GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform1i(GLuint program, GLint location, GLint v0);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
-ANGLE_EXPORT void GL_APIENTRY
-ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-ANGLE_EXPORT void GL_APIENTRY
-ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform1ui(GLuint program, GLint location, GLuint v0);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform2ui(GLuint program,
- GLint location,
- GLuint v0,
- GLuint v1);
-ANGLE_EXPORT void GL_APIENTRY
-ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-ANGLE_EXPORT void GL_APIENTRY
-ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform1f(GLuint program, GLint location, GLfloat v0);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform2f(GLuint program,
- GLint location,
- GLfloat v0,
- GLfloat v1);
-ANGLE_EXPORT void GL_APIENTRY
-ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-ANGLE_EXPORT void GL_APIENTRY
-ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform1iv(GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform2iv(GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform3iv(GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform4iv(GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform1uiv(GLuint program,
- GLint location,
- GLsizei count,
- const GLuint *value);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform2uiv(GLuint program,
- GLint location,
- GLsizei count,
- const GLuint *value);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform3uiv(GLuint program,
- GLint location,
- GLsizei count,
- const GLuint *value);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform4uiv(GLuint program,
- GLint location,
- GLsizei count,
- const GLuint *value);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform1fv(GLuint program,
- GLint location,
- GLsizei count,
- const GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform2fv(GLuint program,
- GLint location,
- GLsizei count,
- const GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform3fv(GLuint program,
- GLint location,
- GLsizei count,
- const GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniform4fv(GLuint program,
- GLint location,
- GLsizei count,
- const GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix2fv(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 ProgramUniformMatrix4fv(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 ProgramUniformMatrix3x2fv(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 ProgramUniformMatrix4x2fv(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 ProgramUniformMatrix4x3fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-ANGLE_EXPORT void GL_APIENTRY ValidateProgramPipeline(GLuint pipeline);
-ANGLE_EXPORT void GL_APIENTRY GetProgramPipelineInfoLog(GLuint pipeline,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *infoLog);
-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 GetBooleani_v(GLenum target, GLuint index, GLboolean *data);
-ANGLE_EXPORT void GL_APIENTRY MemoryBarrier(GLbitfield barriers);
-ANGLE_EXPORT void GL_APIENTRY MemoryBarrierByRegion(GLbitfield barriers);
-ANGLE_EXPORT void GL_APIENTRY TexStorage2DMultisample(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLboolean fixedsamplelocations);
-ANGLE_EXPORT void GL_APIENTRY GetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
-ANGLE_EXPORT void GL_APIENTRY SampleMaski(GLuint maskNumber, GLbitfield mask);
-ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameteriv(GLenum target,
- GLint level,
- GLenum pname,
- GLint *params);
-ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterfv(GLenum target,
- GLint level,
- GLenum pname,
- GLfloat *params);
-ANGLE_EXPORT void GL_APIENTRY BindVertexBuffer(GLuint bindingindex,
- GLuint buffer,
- GLintptr offset,
- GLsizei stride);
-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 VertexAttribBinding(GLuint attribindex, GLuint bindingindex);
-ANGLE_EXPORT void GL_APIENTRY VertexBindingDivisor(GLuint bindingindex, GLuint divisor);
-} // namespace gl
-
-#endif // LIBGLESV2_ENTRYPOINTSGLES31_AUTOGEN_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/global_state.cpp b/src/3rdparty/angle/src/libGLESv2/global_state.cpp
deleted file mode 100644
index 26045bf5b2..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/global_state.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-//
-// 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"
-
-#include "libANGLE/Thread.h"
-#include "libANGLE/Display.h"
-
-namespace gl
-{
-
-Context *GetGlobalContext()
-{
- egl::Thread *thread = egl::GetCurrentThread();
- return thread->getContext();
-}
-
-Context *GetValidGlobalContext()
-{
- egl::Thread *thread = egl::GetCurrentThread();
- return thread->getValidContext();
-}
-
-} // namespace gl
-
-namespace egl
-{
-
-namespace
-{
-
-static TLSIndex threadTLS = TLS_INVALID_INDEX;
-
-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;
-}
-
-} // anonymous namespace
-
-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());
-}
-
-} // namespace egl
-
-#ifdef ANGLE_PLATFORM_WINDOWS
-namespace egl
-{
-
-namespace
-{
-
-bool DeallocateCurrentThread()
-{
- Thread *thread = static_cast<Thread *>(GetTLSValue(threadTLS));
- SafeDelete(thread);
- return SetTLSValue(threadTLS, nullptr);
-}
-
-bool InitializeProcess()
-{
- threadTLS = CreateTLSIndex();
- if (threadTLS == TLS_INVALID_INDEX)
- {
- return false;
- }
-
- return AllocateCurrentThread() != nullptr;
-}
-
-bool TerminateProcess()
-{
- 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:
- egl::Display::CleanupDisplays();
- return static_cast<BOOL>(egl::TerminateProcess());
- }
-
- return TRUE;
-}
-#endif // ANGLE_PLATFORM_WINDOWS
diff --git a/src/3rdparty/angle/src/libGLESv2/global_state.h b/src/3rdparty/angle/src/libGLESv2/global_state.h
deleted file mode 100644
index 3e3740c90e..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/global_state.h
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// 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_
-
-namespace gl
-{
-class Context;
-
-Context *GetGlobalContext();
-Context *GetValidGlobalContext();
-
-} // namespace gl
-
-namespace egl
-{
-class Thread;
-
-Thread *GetCurrentThread();
-
-} // namespace egl
-
-#endif // LIBGLESV2_GLOBALSTATE_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp b/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
deleted file mode 100644
index ffd78a2ac0..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
+++ /dev/null
@@ -1,2575 +0,0 @@
-//
-// 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.
-//
-
-// libGLESv2.cpp: Implements the exported OpenGL ES 2.0 functions.
-
-#include "libGLESv2/entry_points_gles_2_0_autogen.h"
-#include "libGLESv2/entry_points_gles_2_0_ext.h"
-#include "libGLESv2/entry_points_gles_3_0_autogen.h"
-#include "libGLESv2/entry_points_gles_3_1_autogen.h"
-
-#include "common/event_tracer.h"
-
-extern "C" {
-
-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 srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- return gl::BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-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 depth)
-{
- return gl::ClearDepthf(depth);
-}
-
-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(void)
-{
- 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(void)
-{
- return gl::Finish();
-}
-
-void GL_APIENTRY glFlush(void)
-{
- 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 glGenerateMipmap(GLenum target)
-{
- return gl::GenerateMipmap(target);
-}
-
-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 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 *params)
-{
- return gl::GetBooleanv(pname, params);
-}
-
-void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- return gl::GetBufferParameteriv(target, pname, params);
-}
-
-GLenum GL_APIENTRY glGetError(void)
-{
- return gl::GetError();
-}
-
-void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat *params)
-{
- return gl::GetFloatv(pname, params);
-}
-
-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 *params)
-{
- return gl::GetIntegerv(pname, params);
-}
-
-void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- return gl::GetProgramiv(program, pname, params);
-}
-
-void GL_APIENTRY glGetProgramInfoLog(GLuint program,
- GLsizei bufsize,
- GLsizei *length,
- GLchar *infolog)
-{
- return gl::GetProgramInfoLog(program, bufsize, length, infolog);
-}
-
-void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- return gl::GetRenderbufferParameteriv(target, pname, params);
-}
-
-void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- return gl::GetShaderiv(shader, 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);
-}
-
-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);
-}
-
-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);
-}
-
-GLint GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return gl::GetUniformLocation(program, name);
-}
-
-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 glGetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer)
-{
- return gl::GetVertexAttribPointerv(index, pname, pointer);
-}
-
-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(void)
-{
- 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 n,
- const GLuint *shaders,
- GLenum binaryformat,
- const void *binary,
- GLsizei length)
-{
- return gl::ShaderBinary(n, 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 fail, GLenum zfail, GLenum zpass)
-{
- return gl::StencilOpSeparate(face, fail, zfail, zpass);
-}
-
-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 x)
-{
- return gl::Uniform1f(location, x);
-}
-
-void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat *v)
-{
- return gl::Uniform1fv(location, count, v);
-}
-
-void GL_APIENTRY glUniform1i(GLint location, GLint x)
-{
- return gl::Uniform1i(location, x);
-}
-
-void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint *v)
-{
- return gl::Uniform1iv(location, count, v);
-}
-
-void GL_APIENTRY glUniform2f(GLint location, GLfloat x, GLfloat y)
-{
- return gl::Uniform2f(location, x, y);
-}
-
-void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat *v)
-{
- return gl::Uniform2fv(location, count, v);
-}
-
-void GL_APIENTRY glUniform2i(GLint location, GLint x, GLint y)
-{
- return gl::Uniform2i(location, x, y);
-}
-
-void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint *v)
-{
- return gl::Uniform2iv(location, count, v);
-}
-
-void GL_APIENTRY glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
- return gl::Uniform3f(location, x, y, z);
-}
-
-void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat *v)
-{
- return gl::Uniform3fv(location, count, v);
-}
-
-void GL_APIENTRY glUniform3i(GLint location, GLint x, GLint y, GLint z)
-{
- return gl::Uniform3i(location, x, y, z);
-}
-
-void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint *v)
-{
- return gl::Uniform3iv(location, count, v);
-}
-
-void GL_APIENTRY glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- return gl::Uniform4f(location, x, y, z, w);
-}
-
-void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat *v)
-{
- return gl::Uniform4fv(location, count, v);
-}
-
-void GL_APIENTRY glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
-{
- return gl::Uniform4i(location, x, y, z, w);
-}
-
-void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint *v)
-{
- return gl::Uniform4iv(location, count, v);
-}
-
-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 indx, GLfloat x)
-{
- return gl::VertexAttrib1f(indx, x);
-}
-
-void GL_APIENTRY glVertexAttrib1fv(GLuint indx, const GLfloat *values)
-{
- return gl::VertexAttrib1fv(indx, values);
-}
-
-void GL_APIENTRY glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
-{
- return gl::VertexAttrib2f(indx, x, y);
-}
-
-void GL_APIENTRY glVertexAttrib2fv(GLuint indx, const GLfloat *values)
-{
- return gl::VertexAttrib2fv(indx, values);
-}
-
-void GL_APIENTRY glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
-{
- return gl::VertexAttrib3f(indx, x, y, z);
-}
-
-void GL_APIENTRY glVertexAttrib3fv(GLuint indx, const GLfloat *values)
-{
- return gl::VertexAttrib3fv(indx, values);
-}
-
-void GL_APIENTRY glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- return gl::VertexAttrib4f(indx, x, y, z, w);
-}
-
-void GL_APIENTRY glVertexAttrib4fv(GLuint indx, const GLfloat *values)
-{
- return gl::VertexAttrib4fv(indx, values);
-}
-
-void GL_APIENTRY glVertexAttribPointer(GLuint indx,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLsizei stride,
- const void *ptr)
-{
- return gl::VertexAttribPointer(indx, size, type, normalized, stride, ptr);
-}
-
-void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- return gl::Viewport(x, y, width, height);
-}
-
-void GL_APIENTRY glReadBuffer(GLenum mode)
-{
- return gl::ReadBuffer(mode);
-}
-
-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 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 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 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 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 glGenQueries(GLsizei n, GLuint *ids)
-{
- return gl::GenQueries(n, ids);
-}
-
-void GL_APIENTRY glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- return gl::DeleteQueries(n, ids);
-}
-
-GLboolean GL_APIENTRY glIsQuery(GLuint id)
-{
- return gl::IsQuery(id);
-}
-
-void GL_APIENTRY glBeginQuery(GLenum target, GLuint id)
-{
- return gl::BeginQuery(target, id);
-}
-
-void GL_APIENTRY glEndQuery(GLenum target)
-{
- return gl::EndQuery(target);
-}
-
-void GL_APIENTRY glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- return gl::GetQueryiv(target, pname, params);
-}
-
-void GL_APIENTRY glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- return gl::GetQueryObjectuiv(id, pname, params);
-}
-
-GLboolean GL_APIENTRY glUnmapBuffer(GLenum target)
-{
- return gl::UnmapBuffer(target);
-}
-
-void GL_APIENTRY glGetBufferPointerv(GLenum target, GLenum pname, void **params)
-{
- return gl::GetBufferPointerv(target, pname, params);
-}
-
-void GL_APIENTRY glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- return gl::DrawBuffers(n, bufs);
-}
-
-void GL_APIENTRY glUniformMatrix2x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- return gl::UniformMatrix2x3fv(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 glUniformMatrix2x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- return gl::UniformMatrix2x4fv(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 glUniformMatrix3x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- return gl::UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-void GL_APIENTRY glUniformMatrix4x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- return gl::UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-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 glRenderbufferStorageMultisample(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height)
-{
- return gl::RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-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 glMapBufferRange(GLenum target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access)
-{
- return gl::MapBufferRange(target, offset, length, access);
-}
-
-void GL_APIENTRY glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- return gl::FlushMappedBufferRange(target, offset, length);
-}
-
-void GL_APIENTRY glBindVertexArray(GLuint array)
-{
- return gl::BindVertexArray(array);
-}
-
-void GL_APIENTRY glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- return gl::DeleteVertexArrays(n, arrays);
-}
-
-void GL_APIENTRY glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- return gl::GenVertexArrays(n, arrays);
-}
-
-GLboolean GL_APIENTRY glIsVertexArray(GLuint array)
-{
- return gl::IsVertexArray(array);
-}
-
-void GL_APIENTRY glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- return gl::GetIntegeri_v(target, index, data);
-}
-
-void GL_APIENTRY glBeginTransformFeedback(GLenum primitiveMode)
-{
- return gl::BeginTransformFeedback(primitiveMode);
-}
-
-void GL_APIENTRY glEndTransformFeedback(void)
-{
- return gl::EndTransformFeedback();
-}
-
-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 glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- return gl::BindBufferBase(target, index, buffer);
-}
-
-void GL_APIENTRY glTransformFeedbackVaryings(GLuint program,
- GLsizei count,
- const GLchar *const *varyings,
- GLenum bufferMode)
-{
- return gl::TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-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);
-}
-
-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 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 glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- return gl::VertexAttribI4i(index, x, y, z, w);
-}
-
-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 glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- return gl::VertexAttribI4iv(index, v);
-}
-
-void GL_APIENTRY glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- return gl::VertexAttribI4uiv(index, v);
-}
-
-void GL_APIENTRY glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- return gl::GetUniformuiv(program, location, params);
-}
-
-GLint GL_APIENTRY glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return gl::GetFragDataLocation(program, name);
-}
-
-void GL_APIENTRY glUniform1ui(GLint location, GLuint v0)
-{
- return gl::Uniform1ui(location, v0);
-}
-
-void GL_APIENTRY glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- return gl::Uniform2ui(location, v0, v1);
-}
-
-void GL_APIENTRY glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- return gl::Uniform3ui(location, v0, v1, v2);
-}
-
-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 glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- return gl::Uniform1uiv(location, count, value);
-}
-
-void GL_APIENTRY glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- return gl::Uniform2uiv(location, count, value);
-}
-
-void GL_APIENTRY glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- return gl::Uniform3uiv(location, count, value);
-}
-
-void GL_APIENTRY glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- return gl::Uniform4uiv(location, count, 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);
-}
-
-void GL_APIENTRY glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- return gl::ClearBufferfv(buffer, drawbuffer, value);
-}
-
-void GL_APIENTRY glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- return gl::ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-const GLubyte *GL_APIENTRY glGetStringi(GLenum name, GLuint index)
-{
- return gl::GetStringi(name, index);
-}
-
-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 glGetUniformIndices(GLuint program,
- GLsizei uniformCount,
- const GLchar *const *uniformNames,
- GLuint *uniformIndices)
-{
- return gl::GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-void GL_APIENTRY glGetActiveUniformsiv(GLuint program,
- GLsizei uniformCount,
- const GLuint *uniformIndices,
- GLenum pname,
- GLint *params)
-{
- return gl::GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-GLuint GL_APIENTRY glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return gl::GetUniformBlockIndex(program, uniformBlockName);
-}
-
-void GL_APIENTRY glGetActiveUniformBlockiv(GLuint program,
- GLuint uniformBlockIndex,
- GLenum pname,
- GLint *params)
-{
- return gl::GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-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 glUniformBlockBinding(GLuint program,
- GLuint uniformBlockIndex,
- GLuint uniformBlockBinding)
-{
- return gl::UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-void GL_APIENTRY glDrawArraysInstanced(GLenum mode,
- GLint first,
- GLsizei count,
- GLsizei instanceCount)
-{
- return gl::DrawArraysInstanced(mode, first, count, instanceCount);
-}
-
-void GL_APIENTRY glDrawElementsInstanced(GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instanceCount)
-{
- return gl::DrawElementsInstanced(mode, count, type, indices, instanceCount);
-}
-
-GLsync GL_APIENTRY glFenceSync(GLenum condition, GLbitfield flags)
-{
- return gl::FenceSync(condition, flags);
-}
-
-GLboolean GL_APIENTRY glIsSync(GLsync sync)
-{
- return gl::IsSync(sync);
-}
-
-void GL_APIENTRY glDeleteSync(GLsync sync)
-{
- return gl::DeleteSync(sync);
-}
-
-GLenum GL_APIENTRY glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return gl::ClientWaitSync(sync, flags, timeout);
-}
-
-void GL_APIENTRY glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return gl::WaitSync(sync, flags, timeout);
-}
-
-void GL_APIENTRY glGetInteger64v(GLenum pname, GLint64 *params)
-{
- return gl::GetInteger64v(pname, params);
-}
-
-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 glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- return gl::GetInteger64i_v(target, index, data);
-}
-
-void GL_APIENTRY glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- return gl::GetBufferParameteri64v(target, pname, params);
-}
-
-void GL_APIENTRY glGenSamplers(GLsizei count, GLuint *samplers)
-{
- return gl::GenSamplers(count, samplers);
-}
-
-void GL_APIENTRY glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- return gl::DeleteSamplers(count, samplers);
-}
-
-GLboolean GL_APIENTRY glIsSampler(GLuint sampler)
-{
- return gl::IsSampler(sampler);
-}
-
-void GL_APIENTRY glBindSampler(GLuint unit, GLuint sampler)
-{
- return gl::BindSampler(unit, sampler);
-}
-
-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 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 glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- return gl::GetSamplerParameteriv(sampler, pname, params);
-}
-
-void GL_APIENTRY glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- return gl::GetSamplerParameterfv(sampler, pname, params);
-}
-
-void GL_APIENTRY glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- return gl::VertexAttribDivisor(index, divisor);
-}
-
-void GL_APIENTRY glBindTransformFeedback(GLenum target, GLuint id)
-{
- return gl::BindTransformFeedback(target, id);
-}
-
-void GL_APIENTRY glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- return gl::DeleteTransformFeedbacks(n, ids);
-}
-
-void GL_APIENTRY glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- return gl::GenTransformFeedbacks(n, ids);
-}
-
-GLboolean GL_APIENTRY glIsTransformFeedback(GLuint id)
-{
- return gl::IsTransformFeedback(id);
-}
-
-void GL_APIENTRY glPauseTransformFeedback(void)
-{
- return gl::PauseTransformFeedback();
-}
-
-void GL_APIENTRY glResumeTransformFeedback(void)
-{
- return gl::ResumeTransformFeedback();
-}
-
-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 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 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);
-}
-
-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 glGetInternalformativ(GLenum target,
- GLenum internalformat,
- GLenum pname,
- GLsizei bufSize,
- GLint *params)
-{
- return gl::GetInternalformativ(target, internalformat, pname, bufSize, params);
-}
-
-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);
-}
-
-void GL_APIENTRY glRenderbufferStorageMultisampleANGLE(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height)
-{
- return gl::RenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height);
-}
-
-void GL_APIENTRY glDiscardFramebufferEXT(GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments)
-{
- return gl::DiscardFramebufferEXT(target, numAttachments, attachments);
-}
-
-void GL_APIENTRY glDeleteFencesNV(GLsizei n, const GLuint *fences)
-{
- return gl::DeleteFencesNV(n, fences);
-}
-
-void GL_APIENTRY glGenFencesNV(GLsizei n, GLuint *fences)
-{
- return gl::GenFencesNV(n, fences);
-}
-
-GLboolean GL_APIENTRY glIsFenceNV(GLuint fence)
-{
- return gl::IsFenceNV(fence);
-}
-
-GLboolean GL_APIENTRY glTestFenceNV(GLuint fence)
-{
- return gl::TestFenceNV(fence);
-}
-
-void GL_APIENTRY glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
-{
- return gl::GetFenceivNV(fence, pname, params);
-}
-
-void GL_APIENTRY glFinishFenceNV(GLuint fence)
-{
- return gl::FinishFenceNV(fence);
-}
-
-void GL_APIENTRY glSetFenceNV(GLuint fence, GLenum condition)
-{
- return gl::SetFenceNV(fence, condition);
-}
-
-void GL_APIENTRY glGetTranslatedShaderSourceANGLE(GLuint shader,
- GLsizei bufsize,
- GLsizei *length,
- GLchar *source)
-{
- return gl::GetTranslatedShaderSourceANGLE(shader, bufsize, length, source);
-}
-
-void GL_APIENTRY glTexStorage2DEXT(GLenum target,
- GLsizei levels,
- GLenum internalformat,
- GLsizei width,
- GLsizei height)
-{
- return gl::TexStorage2DEXT(target, levels, internalformat, width, height);
-}
-
-GLenum GL_APIENTRY glGetGraphicsResetStatusEXT(void)
-{
- return gl::GetGraphicsResetStatusEXT();
-}
-
-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);
-}
-
-void GL_APIENTRY glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, float *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 glGenQueriesEXT(GLsizei n, GLuint *ids)
-{
- return gl::GenQueriesEXT(n, ids);
-}
-
-void GL_APIENTRY glDeleteQueriesEXT(GLsizei n, const GLuint *ids)
-{
- return gl::DeleteQueriesEXT(n, ids);
-}
-
-GLboolean GL_APIENTRY glIsQueryEXT(GLuint id)
-{
- return gl::IsQueryEXT(id);
-}
-
-void GL_APIENTRY glBeginQueryEXT(GLenum target, GLuint id)
-{
- return gl::BeginQueryEXT(target, id);
-}
-
-void GL_APIENTRY glEndQueryEXT(GLenum target)
-{
- return gl::EndQueryEXT(target);
-}
-
-void GL_APIENTRY glQueryCounterEXT(GLuint id, GLenum target)
-{
- return gl::QueryCounterEXT(id, target);
-}
-
-void GL_APIENTRY glGetQueryivEXT(GLenum target, GLenum pname, GLint *params)
-{
- return gl::GetQueryivEXT(target, pname, params);
-}
-
-void GL_APIENTRY glGetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params)
-{
- return gl::GetQueryObjectivEXT(id, pname, params);
-}
-
-void GL_APIENTRY glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
-{
- return gl::GetQueryObjectuivEXT(id, pname, params);
-}
-
-void GL_APIENTRY glGetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params)
-{
- return gl::GetQueryObjecti64vEXT(id, pname, params);
-}
-
-void GL_APIENTRY glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params)
-{
- return gl::GetQueryObjectui64vEXT(id, pname, params);
-}
-
-void GL_APIENTRY glDrawBuffersEXT(GLsizei n, const GLenum *bufs)
-{
- return gl::DrawBuffersEXT(n, bufs);
-}
-
-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);
-}
-
-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);
-}
-
-void *GL_APIENTRY glMapBufferOES(GLenum target, GLenum access)
-{
- return gl::MapBufferOES(target, access);
-}
-
-GLboolean GL_APIENTRY glUnmapBufferOES(GLenum target)
-{
- return gl::UnmapBufferOES(target);
-}
-
-void GL_APIENTRY glGetBufferPointervOES(GLenum target, GLenum pname, void **params)
-{
- return gl::GetBufferPointervOES(target, pname, params);
-}
-
-void *GL_APIENTRY glMapBufferRangeEXT(GLenum target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access)
-{
- return gl::MapBufferRangeEXT(target, offset, length, access);
-}
-
-void GL_APIENTRY glFlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- return gl::FlushMappedBufferRangeEXT(target, offset, length);
-}
-
-void GL_APIENTRY glInsertEventMarkerEXT(GLsizei length, const char *marker)
-{
- return gl::InsertEventMarkerEXT(length, marker);
-}
-
-void GL_APIENTRY glPushGroupMarkerEXT(GLsizei length, const char *marker)
-{
- return gl::PushGroupMarkerEXT(length, marker);
-}
-
-void GL_APIENTRY glPopGroupMarkerEXT()
-{
- return gl::PopGroupMarkerEXT();
-}
-
-void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
-{
- return gl::EGLImageTargetTexture2DOES(target, image);
-}
-
-void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
-{
- return gl::EGLImageTargetRenderbufferStorageOES(target, image);
-}
-
-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);
-}
-
-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);
-}
-
-void GL_APIENTRY glDebugMessageCallbackKHR(GLDEBUGPROCKHR callback, const void *userParam)
-{
- return gl::DebugMessageCallbackKHR(callback, userParam);
-}
-
-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 glPushDebugGroupKHR(GLenum source,
- GLuint id,
- GLsizei length,
- const GLchar *message)
-{
- return gl::PushDebugGroupKHR(source, id, length, message);
-}
-
-void GL_APIENTRY glPopDebugGroupKHR(void)
-{
- return gl::PopDebugGroupKHR();
-}
-
-void GL_APIENTRY glObjectLabelKHR(GLenum identifier,
- GLuint name,
- GLsizei length,
- const GLchar *label)
-{
- return gl::ObjectLabelKHR(identifier, name, length, label);
-}
-
-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 glObjectPtrLabelKHR(const void *ptr, GLsizei length, const GLchar *label)
-{
- return gl::ObjectPtrLabelKHR(ptr, 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 glBindUniformLocationCHROMIUM(GLuint program, GLint location, const GLchar *name)
-{
- return gl::BindUniformLocationCHROMIUM(program, location, name);
-}
-
-void GL_APIENTRY glCoverageModulationCHROMIUM(GLenum components)
-{
- return gl::CoverageModulationCHROMIUM(components);
-}
-
-// CHROMIUM_path_rendendering
-void GL_APIENTRY glMatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat *matrix)
-{
- gl::MatrixLoadfCHROMIUM(matrixMode, matrix);
-}
-
-void GL_APIENTRY glMatrixLoadIdentityCHROMIUM(GLenum matrixMode)
-{
- gl::MatrixLoadIdentityCHROMIUM(matrixMode);
-}
-
-GLuint GL_APIENTRY glGenPathsCHROMIUM(GLsizei range)
-{
- return gl::GenPathsCHROMIUM(range);
-}
-
-void GL_APIENTRY glDeletePathsCHROMIUM(GLuint first, GLsizei range)
-{
- 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)
-{
- gl::PathCommandsCHROMIUM(path, numCommands, commands, numCoords, coordType, coords);
-}
-
-void GL_APIENTRY glPathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat value)
-{
- gl::PathParameterfCHROMIUM(path, pname, value);
-}
-
-void GL_APIENTRY glPathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value)
-{
- gl::PathParameteriCHROMIUM(path, pname, value);
-}
-
-void GL_APIENTRY glGetPathParameterfvCHROMIUM(GLuint path, GLenum pname, GLfloat *value)
-{
- gl::GetPathParameterfCHROMIUM(path, pname, value);
-}
-
-void GL_APIENTRY glGetPathParameterivCHROMIUM(GLuint path, GLenum pname, GLint *value)
-{
- gl::GetPathParameteriCHROMIUM(path, pname, value);
-}
-
-void GL_APIENTRY glPathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask)
-{
- gl::PathStencilFuncCHROMIUM(func, ref, mask);
-}
-
-void GL_APIENTRY glStencilFillPathCHROMIUM(GLuint path, GLenum fillMode, GLuint mask)
-{
- gl::StencilFillPathCHROMIUM(path, fillMode, mask);
-}
-
-void GL_APIENTRY glStencilStrokePathCHROMIUM(GLuint path, GLint reference, GLuint mask)
-{
- gl::StencilStrokePathCHROMIUM(path, reference, mask);
-}
-
-void GL_APIENTRY glCoverFillPathCHROMIUM(GLuint path, GLenum coverMode)
-{
- gl::CoverFillPathCHROMIUM(path, coverMode);
-}
-
-void GL_APIENTRY glCoverStrokePathCHROMIUM(GLuint path, GLenum coverMode)
-{
- gl::CoverStrokePathCHROMIUM(path, coverMode);
-}
-
-void GL_APIENTRY glStencilThenCoverFillPathCHROMIUM(GLuint path,
- GLenum fillMode,
- GLuint mask,
- GLenum coverMode)
-{
- gl::StencilThenCoverFillPathCHROMIUM(path, fillMode, mask, coverMode);
-}
-
-void GL_APIENTRY glStencilThenCoverStrokePathCHROMIUM(GLuint path,
- GLint reference,
- GLuint mask,
- GLenum coverMode)
-{
- gl::StencilThenCoverStrokePathCHROMIUM(path, reference, mask, coverMode);
-}
-
-void GL_APIENTRY glCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- gl::CoverFillPathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, coverMode,
- transformType, transformValues);
-}
-
-void GL_APIENTRY glCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- gl::CoverStrokePathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, coverMode,
- transformType, transformValues);
-}
-
-void GL_APIENTRY glStencilFillPathInstancedCHROMIUM(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum fillMode,
- GLuint mask,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- gl::StencilFillPathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, fillMode, mask,
- transformType, transformValues);
-}
-
-void GL_APIENTRY glStencilStrokePathInstancedCHROMIUM(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLint reference,
- GLuint mask,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- gl::StencilStrokePathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, reference, 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)
-{
- 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)
-{
- gl::StencilThenCoverStrokePathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase,
- reference, mask, coverMode, transformType,
- transformValues);
-}
-
-void GL_APIENTRY glBindFragmentInputLocationCHROMIUM(GLuint program,
- GLint location,
- const GLchar *name)
-{
- gl::BindFragmentInputLocationCHROMIUM(program, location, name);
-}
-
-void GL_APIENTRY glProgramPathFragmentInputGenCHROMIUM(GLuint program,
- GLint location,
- GLenum genMode,
- GLint components,
- const GLfloat *coeffs)
-{
- gl::ProgramPathFragmentInputGenCHROMIUM(program, location, genMode, components, coeffs);
-}
-
-// GLES 3.1
-void GL_APIENTRY glDispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ)
-{
- gl::DispatchCompute(numGroupsX, numGroupsY, numGroupsZ);
-}
-
-void GL_APIENTRY glDispatchComputeIndirect(GLintptr indirect)
-{
- gl::DispatchComputeIndirect(indirect);
-}
-
-void GL_APIENTRY glDrawArraysIndirect(GLenum mode, const void *indirect)
-{
- gl::DrawArraysIndirect(mode, indirect);
-}
-
-void GL_APIENTRY glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect)
-{
- gl::DrawElementsIndirect(mode, type, indirect);
-}
-
-void GL_APIENTRY glFramebufferParameteri(GLenum target, GLenum pname, GLint param)
-{
- gl::FramebufferParameteri(target, pname, param);
-}
-
-void GL_APIENTRY glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- gl::GetFramebufferParameteriv(target, pname, params);
-}
-
-void GL_APIENTRY glGetProgramInterfaceiv(GLuint program,
- GLenum programInterface,
- GLenum pname,
- GLint *params)
-{
- gl::GetProgramInterfaceiv(program, programInterface, pname, params);
-}
-
-GLuint GL_APIENTRY glGetProgramResourceIndex(GLuint program,
- GLenum programInterface,
- const GLchar *name)
-{
- return gl::GetProgramResourceIndex(program, programInterface, name);
-}
-
-void GL_APIENTRY glGetProgramResourceName(GLuint program,
- GLenum programInterface,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *name)
-{
- 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)
-{
- gl::GetProgramResourceiv(program, programInterface, index, propCount, props, bufSize, length,
- params);
-}
-
-GLint GL_APIENTRY glGetProgramResourceLocation(GLuint program,
- GLenum programInterface,
- const GLchar *name)
-{
- return gl::GetProgramResourceLocation(program, programInterface, name);
-}
-
-void GL_APIENTRY glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
-{
- gl::UseProgramStages(pipeline, stages, program);
-}
-
-void GL_APIENTRY glActiveShaderProgram(GLuint pipeline, GLuint program)
-{
- gl::ActiveShaderProgram(pipeline, program);
-}
-
-GLuint GL_APIENTRY glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
-{
- return gl::CreateShaderProgramv(type, count, strings);
-}
-
-void GL_APIENTRY glBindProgramPipeline(GLuint pipeline)
-{
- gl::BindProgramPipeline(pipeline);
-}
-
-void GL_APIENTRY glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
-{
- gl::DeleteProgramPipelines(n, pipelines);
-}
-
-void GL_APIENTRY glGenProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- gl::GenProgramPipelines(n, pipelines);
-}
-
-GLboolean GL_APIENTRY glIsProgramPipeline(GLuint pipeline)
-{
- return gl::IsProgramPipeline(pipeline);
-}
-
-void GL_APIENTRY glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- gl::GetProgramPipelineiv(pipeline, pname, params);
-}
-
-void GL_APIENTRY glProgramUniform1i(GLuint program, GLint location, GLint v0)
-{
- gl::ProgramUniform1i(program, location, v0);
-}
-
-void GL_APIENTRY glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
-{
- gl::ProgramUniform2i(program, location, v0, v1);
-}
-
-void GL_APIENTRY glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
-{
- gl::ProgramUniform3i(program, location, v0, v1, v2);
-}
-
-void GL_APIENTRY
-glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- gl::ProgramUniform4i(program, location, v0, v1, v2, v3);
-}
-
-void GL_APIENTRY glProgramUniform1ui(GLuint program, GLint location, GLuint v0)
-{
- gl::ProgramUniform1ui(program, location, v0);
-}
-
-void GL_APIENTRY glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
-{
- gl::ProgramUniform2ui(program, location, v0, v1);
-}
-
-void GL_APIENTRY
-glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- gl::ProgramUniform3ui(program, location, v0, v1, v2);
-}
-
-void GL_APIENTRY
-glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- gl::ProgramUniform4ui(program, location, v0, v1, v2, v3);
-}
-
-void GL_APIENTRY glProgramUniform1f(GLuint program, GLint location, GLfloat v0)
-{
- gl::ProgramUniform1f(program, location, v0);
-}
-
-void GL_APIENTRY glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
-{
- gl::ProgramUniform2f(program, location, v0, v1);
-}
-
-void GL_APIENTRY
-glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- gl::ProgramUniform3f(program, location, v0, v1, v2);
-}
-
-void GL_APIENTRY
-glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- gl::ProgramUniform4f(program, location, v0, v1, v2, v3);
-}
-
-void GL_APIENTRY glProgramUniform1iv(GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value)
-{
- gl::ProgramUniform1iv(program, location, count, value);
-}
-
-void GL_APIENTRY glProgramUniform2iv(GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value)
-{
- gl::ProgramUniform2iv(program, location, count, value);
-}
-
-void GL_APIENTRY glProgramUniform3iv(GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value)
-{
- gl::ProgramUniform3iv(program, location, count, value);
-}
-
-void GL_APIENTRY glProgramUniform4iv(GLuint program,
- GLint location,
- GLsizei count,
- const GLint *value)
-{
- gl::ProgramUniform4iv(program, location, count, value);
-}
-
-void GL_APIENTRY glProgramUniform1uiv(GLuint program,
- GLint location,
- GLsizei count,
- const GLuint *value)
-{
- gl::ProgramUniform1uiv(program, location, count, value);
-}
-
-void GL_APIENTRY glProgramUniform2uiv(GLuint program,
- GLint location,
- GLsizei count,
- const GLuint *value)
-{
- gl::ProgramUniform2uiv(program, location, count, value);
-}
-
-void GL_APIENTRY glProgramUniform3uiv(GLuint program,
- GLint location,
- GLsizei count,
- const GLuint *value)
-{
- gl::ProgramUniform3uiv(program, location, count, value);
-}
-
-void GL_APIENTRY glProgramUniform4uiv(GLuint program,
- GLint location,
- GLsizei count,
- const GLuint *value)
-{
- gl::ProgramUniform4uiv(program, location, count, value);
-}
-
-void GL_APIENTRY glProgramUniform1fv(GLuint program,
- GLint location,
- GLsizei count,
- const GLfloat *value)
-{
- gl::ProgramUniform1fv(program, location, count, value);
-}
-
-void GL_APIENTRY glProgramUniform2fv(GLuint program,
- GLint location,
- GLsizei count,
- const GLfloat *value)
-{
- gl::ProgramUniform2fv(program, location, count, value);
-}
-
-void GL_APIENTRY glProgramUniform3fv(GLuint program,
- GLint location,
- GLsizei count,
- const GLfloat *value)
-{
- gl::ProgramUniform3fv(program, location, count, value);
-}
-
-void GL_APIENTRY glProgramUniform4fv(GLuint program,
- GLint location,
- GLsizei count,
- const GLfloat *value)
-{
- gl::ProgramUniform4fv(program, location, count, value);
-}
-
-void GL_APIENTRY glProgramUniformMatrix2fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- gl::ProgramUniformMatrix2fv(program, location, count, transpose, value);
-}
-
-void GL_APIENTRY glProgramUniformMatrix3fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- gl::ProgramUniformMatrix3fv(program, location, count, transpose, value);
-}
-
-void GL_APIENTRY glProgramUniformMatrix4fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- gl::ProgramUniformMatrix4fv(program, location, count, transpose, value);
-}
-
-void GL_APIENTRY glProgramUniformMatrix2x3fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- gl::ProgramUniformMatrix2x3fv(program, location, count, transpose, value);
-}
-
-void GL_APIENTRY glProgramUniformMatrix3x2fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- gl::ProgramUniformMatrix3x2fv(program, location, count, transpose, value);
-}
-
-void GL_APIENTRY glProgramUniformMatrix2x4fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- gl::ProgramUniformMatrix2x4fv(program, location, count, transpose, value);
-}
-
-void GL_APIENTRY glProgramUniformMatrix4x2fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- gl::ProgramUniformMatrix4x2fv(program, location, count, transpose, value);
-}
-
-void GL_APIENTRY glProgramUniformMatrix3x4fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- gl::ProgramUniformMatrix3x4fv(program, location, count, transpose, value);
-}
-
-void GL_APIENTRY glProgramUniformMatrix4x3fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- gl::ProgramUniformMatrix4x3fv(program, location, count, transpose, value);
-}
-
-void GL_APIENTRY glValidateProgramPipeline(GLuint pipeline)
-{
- gl::ValidateProgramPipeline(pipeline);
-}
-
-void GL_APIENTRY glGetProgramPipelineInfoLog(GLuint pipeline,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *infoLog)
-{
- gl::GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
-}
-
-void GL_APIENTRY glBindImageTexture(GLuint unit,
- GLuint texture,
- GLint level,
- GLboolean layered,
- GLint layer,
- GLenum access,
- GLenum format)
-{
- gl::BindImageTexture(unit, texture, level, layered, layer, access, format);
-}
-
-void GL_APIENTRY glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- gl::GetBooleani_v(target, index, data);
-}
-
-void GL_APIENTRY glMemoryBarrier(GLbitfield barriers)
-{
- gl::MemoryBarrier(barriers);
-}
-
-void GL_APIENTRY glMemoryBarrierByRegion(GLbitfield barriers)
-{
- gl::MemoryBarrierByRegion(barriers);
-}
-
-void GL_APIENTRY glTexStorage2DMultisample(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLboolean fixedsamplelocations)
-{
- gl::TexStorage2DMultisample(target, samples, internalformat, width, height,
- fixedsamplelocations);
-}
-
-void GL_APIENTRY glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- gl::GetMultisamplefv(pname, index, val);
-}
-
-void GL_APIENTRY glSampleMaski(GLuint maskNumber, GLbitfield mask)
-{
- gl::SampleMaski(maskNumber, mask);
-}
-
-void GL_APIENTRY glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- gl::GetTexLevelParameteriv(target, level, pname, params);
-}
-
-void GL_APIENTRY glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- gl::GetTexLevelParameterfv(target, level, pname, params);
-}
-
-void GL_APIENTRY glBindVertexBuffer(GLuint bindingindex,
- GLuint buffer,
- GLintptr offset,
- GLsizei stride)
-{
- gl::BindVertexBuffer(bindingindex, buffer, offset, stride);
-}
-
-void GL_APIENTRY glVertexAttribFormat(GLuint attribindex,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLuint relativeoffset)
-{
- gl::VertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
-}
-
-void GL_APIENTRY glVertexAttribIFormat(GLuint attribindex,
- GLint size,
- GLenum type,
- GLuint relativeoffset)
-{
- gl::VertexAttribIFormat(attribindex, size, type, relativeoffset);
-}
-
-void GL_APIENTRY glVertexAttribBinding(GLuint attribindex, GLuint bindingindex)
-{
- gl::VertexAttribBinding(attribindex, bindingindex);
-}
-
-void GL_APIENTRY glVertexBindingDivisor(GLuint bindingindex, GLuint divisor)
-{
- gl::VertexBindingDivisor(bindingindex, divisor);
-}
-
-void GL_APIENTRY glFramebufferTextureMultiviewLayeredANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLint baseViewIndex,
- GLsizei numViews)
-{
- gl::FramebufferTextureMultiviewLayeredANGLE(target, attachment, texture, level, baseViewIndex,
- numViews);
-}
-
-void GL_APIENTRY glFramebufferTextureMultiviewSideBySideANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLsizei numViews,
- const GLint *viewportOffsets)
-{
- gl::FramebufferTextureMultiviewSideBySideANGLE(target, attachment, texture, level, numViews,
- viewportOffsets);
-}
-
-void GL_APIENTRY glRequestExtensionANGLE(const GLchar *name)
-{
- gl::RequestExtensionANGLE(name);
-}
-
-} // extern "C"
diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2.def b/src/3rdparty/angle/src/libGLESv2/libGLESv2.def
deleted file mode 100644
index 2ff4cc0579..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/libGLESv2.def
+++ /dev/null
@@ -1,412 +0,0 @@
-LIBRARY libGLESv2
-EXPORTS
- glActiveTexture @1
- glAttachShader @2
- glBindAttribLocation @3
- glBindBuffer @4
- glBindFramebuffer @5
- glBindRenderbuffer @6
- glBindTexture @7
- glBlendColor @8
- glBlendEquation @9
- glBlendEquationSeparate @10
- glBlendFunc @11
- glBlendFuncSeparate @12
- glBufferData @13
- glBufferSubData @14
- glCheckFramebufferStatus @15
- glClear @16
- glClearColor @17
- glClearDepthf @18
- glClearStencil @19
- glColorMask @20
- glCompileShader @21
- glCompressedTexImage2D @22
- glCompressedTexSubImage2D @23
- glCopyTexImage2D @24
- glCopyTexSubImage2D @25
- glCreateProgram @26
- glCreateShader @27
- glCullFace @28
- glDeleteBuffers @29
- glDeleteFramebuffers @30
- glDeleteProgram @32
- glDeleteRenderbuffers @33
- glDeleteShader @34
- glDeleteTextures @31
- glDepthFunc @36
- glDepthMask @37
- glDepthRangef @38
- glDetachShader @35
- glDisable @39
- glDisableVertexAttribArray @40
- glDrawArrays @41
- glDrawElements @42
- glEnable @43
- glEnableVertexAttribArray @44
- glFinish @45
- glFlush @46
- glFramebufferRenderbuffer @47
- glFramebufferTexture2D @48
- glFrontFace @49
- glGenBuffers @50
- glGenFramebuffers @52
- glGenRenderbuffers @53
- glGenTextures @54
- glGenerateMipmap @51
- glGetActiveAttrib @55
- glGetActiveUniform @56
- glGetAttachedShaders @57
- glGetAttribLocation @58
- glGetBooleanv @59
- glGetBufferParameteriv @60
- glGetError @61
- glGetFloatv @62
- glGetFramebufferAttachmentParameteriv @63
- glGetIntegerv @64
- glGetProgramInfoLog @66
- glGetProgramiv @65
- glGetRenderbufferParameteriv @67
- glGetShaderInfoLog @69
- glGetShaderPrecisionFormat @70
- glGetShaderSource @71
- glGetShaderiv @68
- glGetString @72
- glGetTexParameterfv @73
- glGetTexParameteriv @74
- glGetUniformLocation @77
- glGetUniformfv @75
- glGetUniformiv @76
- glGetVertexAttribPointerv @80
- glGetVertexAttribfv @78
- glGetVertexAttribiv @79
- glHint @81
- glIsBuffer @82
- glIsEnabled @83
- glIsFramebuffer @84
- glIsProgram @85
- glIsRenderbuffer @86
- glIsShader @87
- glIsTexture @88
- glLineWidth @89
- glLinkProgram @90
- glPixelStorei @91
- glPolygonOffset @92
- glReadPixels @93
- glReleaseShaderCompiler @94
- glRenderbufferStorage @95
- glSampleCoverage @96
- glScissor @97
- glShaderBinary @98
- glShaderSource @99
- glStencilFunc @100
- glStencilFuncSeparate @101
- glStencilMask @102
- glStencilMaskSeparate @103
- glStencilOp @104
- glStencilOpSeparate @105
- glTexImage2D @106
- glTexParameterf @107
- glTexParameterfv @108
- glTexParameteri @109
- glTexParameteriv @110
- glTexSubImage2D @111
- glUniform1f @112
- glUniform1fv @113
- glUniform1i @114
- glUniform1iv @115
- glUniform2f @116
- glUniform2fv @117
- glUniform2i @118
- glUniform2iv @119
- glUniform3f @120
- glUniform3fv @121
- glUniform3i @122
- glUniform3iv @123
- glUniform4f @124
- glUniform4fv @125
- glUniform4i @126
- glUniform4iv @127
- glUniformMatrix2fv @128
- glUniformMatrix3fv @129
- glUniformMatrix4fv @130
- glUseProgram @131
- glValidateProgram @132
- glVertexAttrib1f @133
- glVertexAttrib1fv @134
- glVertexAttrib2f @135
- glVertexAttrib2fv @136
- glVertexAttrib3f @137
- glVertexAttrib3fv @138
- glVertexAttrib4f @139
- glVertexAttrib4fv @140
- glVertexAttribPointer @141
- glViewport @142
-
- ; Extensions
- glBlitFramebufferANGLE @149
- glRenderbufferStorageMultisampleANGLE @150
- glDeleteFencesNV @151
- glFinishFenceNV @152
- glGenFencesNV @153
- glGetFenceivNV @154
- glIsFenceNV @155
- glSetFenceNV @156
- glTestFenceNV @157
- glGetTranslatedShaderSourceANGLE @159
- glTexStorage2DEXT @160
- glGetGraphicsResetStatusEXT @161
- glReadnPixelsEXT @162
- glGetnUniformfvEXT @163
- glGetnUniformivEXT @164
- glGenQueriesEXT @165
- glDeleteQueriesEXT @166
- glIsQueryEXT @167
- glBeginQueryEXT @168
- glEndQueryEXT @169
- glGetQueryivEXT @170
- glGetQueryObjectuivEXT @171
- glVertexAttribDivisorANGLE @172
- glDrawArraysInstancedANGLE @173
- glDrawElementsInstancedANGLE @174
- glProgramBinaryOES @175
- glGetProgramBinaryOES @176
- glDrawBuffersEXT @179
- glMapBufferOES @285
- glUnmapBufferOES @286
- glGetBufferPointervOES @287
- glMapBufferRangeEXT @288
- glFlushMappedBufferRangeEXT @289
- glDiscardFramebufferEXT @293
- glInsertEventMarkerEXT @294
- glPushGroupMarkerEXT @295
- glPopGroupMarkerEXT @296
- glEGLImageTargetTexture2DOES @297
- glEGLImageTargetRenderbufferStorageOES @298
- glBindVertexArrayOES @299
- glDeleteVertexArraysOES @300
- glGenVertexArraysOES @301
- glIsVertexArrayOES @302
- glDebugMessageControlKHR @303
- glDebugMessageInsertKHR @304
- glDebugMessageCallbackKHR @305
- glGetDebugMessageLogKHR @306
- glPushDebugGroupKHR @307
- glPopDebugGroupKHR @308
- glObjectLabelKHR @309
- glGetObjectLabelKHR @310
- glObjectPtrLabelKHR @311
- glGetObjectPtrLabelKHR @312
- glGetPointervKHR @313
- glQueryCounterEXT @314
- glGetQueryObjectivEXT @315
- glGetQueryObjecti64vEXT @316
- glGetQueryObjectui64vEXT @317
- glBindUniformLocationCHROMIUM @318
- glCoverageModulationCHROMIUM @319
-
- glMatrixLoadfCHROMIUM @320
- glMatrixLoadIdentityCHROMIUM @321
- glGenPathsCHROMIUM @322
- glDeletePathsCHROMIUM @323
- glIsPathCHROMIUM @324
- glPathCommandsCHROMIUM @325
- glPathParameterfCHROMIUM @326
- glPathParameteriCHROMIUM @327
- glGetPathParameterfvCHROMIUM @328
- glGetPathParameterivCHROMIUM @329
- glPathStencilFuncCHROMIUM @330
- glStencilFillPathCHROMIUM @331
- glStencilStrokePathCHROMIUM @332
- glCoverFillPathCHROMIUM @333
- glCoverStrokePathCHROMIUM @334
- glStencilThenCoverFillPathCHROMIUM @335
- glStencilThenCoverStrokePathCHROMIUM @336
- glCoverFillPathInstancedCHROMIUM @337
- glCoverStrokePathInstancedCHROMIUM @338
- glStencilStrokePathInstancedCHROMIUM @339
- glStencilFillPathInstancedCHROMIUM @340
- glStencilThenCoverFillPathInstancedCHROMIUM @341
- glStencilThenCoverStrokePathInstancedCHROMIUM @342
- glBindFragmentInputLocationCHROMIUM @343
- glProgramPathFragmentInputGenCHROMIUM @344
-
- glFramebufferTextureMultiviewLayeredANGLE @413
- glFramebufferTextureMultiviewSideBySideANGLE @414
- glRequestExtensionANGLE @415
-
- ; GLES 3.0 Functions
- glReadBuffer @180
- glDrawRangeElements @181
- glTexImage3D @182
- glTexSubImage3D @183
- glCopyTexSubImage3D @184
- glCompressedTexImage3D @185
- glCompressedTexSubImage3D @186
- glGenQueries @187
- glDeleteQueries @188
- glIsQuery @189
- glBeginQuery @190
- glEndQuery @191
- glGetQueryiv @192
- glGetQueryObjectuiv @193
- glUnmapBuffer @194
- glGetBufferPointerv @195
- glDrawBuffers @196
- glUniformMatrix2x3fv @197
- glUniformMatrix3x2fv @198
- glUniformMatrix2x4fv @199
- glUniformMatrix4x2fv @200
- glUniformMatrix3x4fv @201
- glUniformMatrix4x3fv @202
- glBlitFramebuffer @203
- glRenderbufferStorageMultisample @204
- glFramebufferTextureLayer @205
- glMapBufferRange @206
- glFlushMappedBufferRange @207
- glBindVertexArray @208
- glDeleteVertexArrays @209
- glGenVertexArrays @210
- glIsVertexArray @211
- glGetIntegeri_v @212
- glBeginTransformFeedback @213
- glEndTransformFeedback @214
- glBindBufferRange @215
- glBindBufferBase @216
- glTransformFeedbackVaryings @217
- glGetTransformFeedbackVarying @218
- glVertexAttribIPointer @219
- glGetVertexAttribIiv @220
- glGetVertexAttribIuiv @221
- glVertexAttribI4i @222
- glVertexAttribI4ui @223
- glVertexAttribI4iv @224
- glVertexAttribI4uiv @225
- glGetUniformuiv @226
- glGetFragDataLocation @227
- glUniform1ui @228
- glUniform2ui @229
- glUniform3ui @230
- glUniform4ui @231
- glUniform1uiv @232
- glUniform2uiv @233
- glUniform3uiv @234
- glUniform4uiv @235
- glClearBufferiv @236
- glClearBufferuiv @237
- glClearBufferfv @238
- glClearBufferfi @239
- glGetStringi @240
- glCopyBufferSubData @241
- glGetUniformIndices @242
- glGetActiveUniformsiv @243
- glGetUniformBlockIndex @244
- glGetActiveUniformBlockiv @245
- glGetActiveUniformBlockName @246
- glUniformBlockBinding @247
- glDrawArraysInstanced @248
- glDrawElementsInstanced @249
- glFenceSync @250
- glIsSync @251
- glDeleteSync @252
- glClientWaitSync @253
- glWaitSync @254
- glGetInteger64v @255
- glGetSynciv @256
- glGetInteger64i_v @257
- glGetBufferParameteri64v @258
- glGenSamplers @259
- glDeleteSamplers @260
- glIsSampler @261
- glBindSampler @262
- glSamplerParameteri @263
- glSamplerParameteriv @264
- glSamplerParameterf @265
- glSamplerParameterfv @266
- glGetSamplerParameteriv @267
- glGetSamplerParameterfv @268
- glVertexAttribDivisor @269
- glBindTransformFeedback @270
- glDeleteTransformFeedbacks @271
- glGenTransformFeedbacks @272
- glIsTransformFeedback @273
- glPauseTransformFeedback @274
- glResumeTransformFeedback @275
- glGetProgramBinary @276
- glProgramBinary @277
- glProgramParameteri @278
- glInvalidateFramebuffer @279
- glInvalidateSubFramebuffer @280
- glTexStorage2D @281
- glTexStorage3D @282
- glGetInternalformativ @283
-
- ; GLES 3.1 Functions
- glDispatchCompute @345
- glDispatchComputeIndirect @346
- glDrawArraysIndirect @347
- glDrawElementsIndirect @348
- glFramebufferParameteri @349
- glGetFramebufferParameteriv @350
- glGetProgramInterfaceiv @351
- glGetProgramResourceIndex @352
- glGetProgramResourceName @353
- glGetProgramResourceiv @354
- glGetProgramResourceLocation @355
- glUseProgramStages @356
- glActiveShaderProgram @357
- glCreateShaderProgramv @358
- glBindProgramPipeline @359
- glDeleteProgramPipelines @360
- glGenProgramPipelines @361
- glIsProgramPipeline @362
- glGetProgramPipelineiv @363
- glProgramUniform1i @364
- glProgramUniform2i @365
- glProgramUniform3i @366
- glProgramUniform4i @367
- glProgramUniform1ui @368
- glProgramUniform2ui @369
- glProgramUniform3ui @370
- glProgramUniform4ui @371
- glProgramUniform1f @372
- glProgramUniform2f @373
- glProgramUniform3f @374
- glProgramUniform4f @375
- glProgramUniform1iv @376
- glProgramUniform2iv @377
- glProgramUniform3iv @378
- glProgramUniform4iv @379
- glProgramUniform1uiv @380
- glProgramUniform2uiv @381
- glProgramUniform3uiv @382
- glProgramUniform4uiv @383
- glProgramUniform1fv @384
- glProgramUniform2fv @385
- glProgramUniform3fv @386
- glProgramUniform4fv @387
- glProgramUniformMatrix2fv @388
- glProgramUniformMatrix3fv @389
- glProgramUniformMatrix4fv @390
- glProgramUniformMatrix2x3fv @391
- glProgramUniformMatrix3x2fv @392
- glProgramUniformMatrix2x4fv @393
- glProgramUniformMatrix4x2fv @394
- glProgramUniformMatrix3x4fv @395
- glProgramUniformMatrix4x3fv @396
- glValidateProgramPipeline @397
- glGetProgramPipelineInfoLog @398
- glBindImageTexture @399
- glGetBooleani_v @400
- glMemoryBarrier @401
- glMemoryBarrierByRegion @402
- glTexStorage2DMultisample @403
- glGetMultisamplefv @404
- glSampleMaski @405
- glGetTexLevelParameteriv @406
- glGetTexLevelParameterfv @407
- glBindVertexBuffer @408
- glVertexAttribFormat @409
- glVertexAttribIFormat @410
- glVertexAttribBinding @411
- glVertexBindingDivisor @412
diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2_mingw32.def b/src/3rdparty/angle/src/libGLESv2/libGLESv2_mingw32.def
deleted file mode 100644
index a182c21a05..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/libGLESv2_mingw32.def
+++ /dev/null
@@ -1,411 +0,0 @@
-LIBRARY libGLESv2
-EXPORTS
- glActiveTexture@4 @1
- glAttachShader@8 @2
- glBindAttribLocation@12 @3
- glBindBuffer@8 @4
- glBindFramebuffer@8 @5
- glBindRenderbuffer@8 @6
- glBindTexture@8 @7
- glBlendColor@16 @8
- glBlendEquation@4 @9
- glBlendEquationSeparate@8 @10
- glBlendFunc@8 @11
- glBlendFuncSeparate@16 @12
- glBufferData@16 @13
- glBufferSubData@16 @14
- glCheckFramebufferStatus@4 @15
- glClear@4 @16
- glClearColor@16 @17
- glClearDepthf@4 @18
- glClearStencil@4 @19
- glColorMask@16 @20
- glCompileShader@4 @21
- glCompressedTexImage2D@32 @22
- glCompressedTexSubImage2D@36 @23
- glCopyTexImage2D@32 @24
- glCopyTexSubImage2D@32 @25
- glCreateProgram@0 @26
- glCreateShader@4 @27
- glCullFace@4 @28
- glDeleteBuffers@8 @29
- glDeleteFramebuffers@8 @30
- glDeleteProgram@4 @32
- glDeleteRenderbuffers@8 @33
- glDeleteShader@4 @34
- glDeleteTextures@8 @31
- glDepthFunc@4 @36
- glDepthMask@4 @37
- glDepthRangef@8 @38
- glDetachShader@8 @35
- glDisable@4 @39
- glDisableVertexAttribArray@4 @40
- glDrawArrays@12 @41
- glDrawElements@16 @42
- glEnable@4 @43
- glEnableVertexAttribArray@4 @44
- glFinish@0 @45
- glFlush@0 @46
- glFramebufferRenderbuffer@16 @47
- glFramebufferTexture2D@20 @48
- glFrontFace@4 @49
- glGenBuffers@8 @50
- glGenFramebuffers@8 @52
- glGenRenderbuffers@8 @53
- glGenTextures@8 @54
- glGenerateMipmap@4 @51
- glGetActiveAttrib@28 @55
- glGetActiveUniform@28 @56
- glGetAttachedShaders@16 @57
- glGetAttribLocation@8 @58
- glGetBooleanv@8 @59
- glGetBufferParameteriv@12 @60
- glGetError@0 @61
- glGetFloatv@8 @62
- glGetFramebufferAttachmentParameteriv@16 @63
- glGetIntegerv@8 @64
- glGetProgramInfoLog@16 @66
- glGetProgramiv@12 @65
- glGetRenderbufferParameteriv@12 @67
- glGetShaderInfoLog@16 @69
- glGetShaderPrecisionFormat@16 @70
- glGetShaderSource@16 @71
- glGetShaderiv@12 @68
- glGetString@4 @72
- glGetTexParameterfv@12 @73
- glGetTexParameteriv@12 @74
- glGetUniformLocation@8 @77
- glGetUniformfv@12 @75
- glGetUniformiv@12 @76
- glGetVertexAttribPointerv@12 @80
- glGetVertexAttribfv@12 @78
- glGetVertexAttribiv@12 @79
- glHint@8 @81
- glIsBuffer@4 @82
- glIsEnabled@4 @83
- glIsFramebuffer@4 @84
- glIsProgram@4 @85
- glIsRenderbuffer@4 @86
- glIsShader@4 @87
- glIsTexture@4 @88
- glLineWidth@4 @89
- glLinkProgram@4 @90
- glPixelStorei@8 @91
- glPolygonOffset@8 @92
- glReadPixels@28 @93
- glReleaseShaderCompiler@0 @94
- glRenderbufferStorage@16 @95
- glSampleCoverage@8 @96
- glScissor@16 @97
- glShaderBinary@20 @98
- glShaderSource@16 @99
- glStencilFunc@12 @100
- glStencilFuncSeparate@16 @101
- glStencilMask@4 @102
- glStencilMaskSeparate@8 @103
- glStencilOp@12 @104
- glStencilOpSeparate@16 @105
- glTexImage2D@36 @106
- glTexParameterf@12 @107
- glTexParameterfv@12 @108
- glTexParameteri@12 @109
- glTexParameteriv@12 @110
- glTexSubImage2D@36 @111
- glUniform1f@8 @112
- glUniform1fv@12 @113
- glUniform1i@8 @114
- glUniform1iv@12 @115
- glUniform2f@12 @116
- glUniform2fv@12 @117
- glUniform2i@12 @118
- glUniform2iv@12 @119
- glUniform3f@16 @120
- glUniform3fv@12 @121
- glUniform3i@16 @122
- glUniform3iv@12 @123
- glUniform4f@20 @124
- glUniform4fv@12 @125
- glUniform4i@20 @126
- glUniform4iv@12 @127
- glUniformMatrix2fv@16 @128
- glUniformMatrix3fv@16 @129
- glUniformMatrix4fv@16 @130
- glUseProgram@4 @131
- glValidateProgram@4 @132
- glVertexAttrib1f@8 @133
- glVertexAttrib1fv@8 @134
- glVertexAttrib2f@12 @135
- glVertexAttrib2fv@8 @136
- glVertexAttrib3f@16 @137
- glVertexAttrib3fv@8 @138
- glVertexAttrib4f@20 @139
- glVertexAttrib4fv@8 @140
- glVertexAttribPointer@24 @141
- glViewport@16 @142
-
- ; Extensions
- glBlitFramebufferANGLE@40 @149
- glRenderbufferStorageMultisampleANGLE@20 @150
- glDeleteFencesNV@8 @151
- glFinishFenceNV@4 @152
- glGenFencesNV@8 @153
- glGetFenceivNV@12 @154
- glIsFenceNV@4 @155
- glSetFenceNV@8 @156
- glTestFenceNV@4 @157
- glGetTranslatedShaderSourceANGLE@16 @159
- glTexStorage2DEXT@20 @160
- glGetGraphicsResetStatusEXT@0 @161
- glReadnPixelsEXT@32 @162
- glGetnUniformfvEXT@16 @163
- glGetnUniformivEXT@16 @164
- glGenQueriesEXT@8 @165
- glDeleteQueriesEXT@8 @166
- glIsQueryEXT@4 @167
- glBeginQueryEXT@8 @168
- glEndQueryEXT@4 @169
- glGetQueryivEXT@12 @170
- glGetQueryObjectuivEXT@12 @171
- glVertexAttribDivisorANGLE@8 @172
- glDrawArraysInstancedANGLE@16 @173
- glDrawElementsInstancedANGLE@20 @174
- glProgramBinaryOES@16 @175
- glGetProgramBinaryOES@20 @176
- glDrawBuffersEXT@8 @179
- glMapBufferOES@8 @285
- glUnmapBufferOES@4 @286
- glGetBufferPointervOES@12 @287
- glMapBufferRangeEXT@16 @288
- glFlushMappedBufferRangeEXT@12 @289
- glDiscardFramebufferEXT@12 @293
- glInsertEventMarkerEXT@8 @294
- glPushGroupMarkerEXT@8 @295
- glPopGroupMarkerEXT@0 @296
- glEGLImageTargetTexture2DOES@8 @297
- glEGLImageTargetRenderbufferStorageOES@8 @298
- glBindVertexArrayOES@4 @299
- glDeleteVertexArraysOES@8 @300
- glGenVertexArraysOES@8 @301
- glIsVertexArrayOES@4 @302
- glDebugMessageControlKHR@24 @303
- glDebugMessageInsertKHR@24 @304
- glDebugMessageCallbackKHR@8 @305
- glGetDebugMessageLogKHR@32 @306
- glPushDebugGroupKHR@16 @307
- glPopDebugGroupKHR@0 @308
- glObjectLabelKHR@16 @309
- glGetObjectLabelKHR@20 @310
- glObjectPtrLabelKHR@12 @311
- glGetObjectPtrLabelKHR@16 @312
- glGetPointervKHR@8 @313
- glQueryCounterEXT@8 @314
- glGetQueryObjectivEXT@12 @315
- glGetQueryObjecti64vEXT@12 @316
- glGetQueryObjectui64vEXT@12 @317
- glBindUniformLocationCHROMIUM@12 @318
- glCoverageModulationCHROMIUM@4 @319
- glMatrixLoadfCHROMIUM@8 @320
- glMatrixLoadIdentityCHROMIUM@4 @321
- glGenPathsCHROMIUM@4 @322
- glDeletePathsCHROMIUM@8 @323
- glIsPathCHROMIUM@4 @324
- glPathCommandsCHROMIUM@24 @325
- glPathParameterfCHROMIUM@12 @326
- glPathParameteriCHROMIUM@12 @327
- glGetPathParameterfvCHROMIUM@12 @328
- glGetPathParameterivCHROMIUM@12 @329
- glPathStencilFuncCHROMIUM@12 @330
- glStencilFillPathCHROMIUM@12 @331
- glStencilStrokePathCHROMIUM@12 @332
- glCoverFillPathCHROMIUM@8 @333
- glCoverStrokePathCHROMIUM@8 @334
- glStencilThenCoverFillPathCHROMIUM@16 @335
- glStencilThenCoverStrokePathCHROMIUM@16 @336
- glCoverFillPathInstancedCHROMIUM@28 @337
- glCoverStrokePathInstancedCHROMIUM@28 @338
- glStencilStrokePathInstancedCHROMIUM@32 @339
- glStencilFillPathInstancedCHROMIUM@32 @340
- glStencilThenCoverFillPathInstancedCHROMIUM@36 @341
- glStencilThenCoverStrokePathInstancedCHROMIUM@36 @342
- glBindFragmentInputLocationCHROMIUM@12 @343
- glProgramPathFragmentInputGenCHROMIUM@20 @344
-
- glFramebufferTextureMultiviewLayeredANGLE@24 @413
- glFramebufferTextureMultiviewSideBySideANGLE@24 @414
- glRequestExtensionANGLE@4 @415
-
- ; GLES 3.0 Functions
- glReadBuffer@4 @180
- glDrawRangeElements@24 @181
- glTexImage3D@40 @182
- glTexSubImage3D@44 @183
- glCopyTexSubImage3D@36 @184
- glCompressedTexImage3D@36 @185
- glCompressedTexSubImage3D@44 @186
- glGenQueries@8 @187
- glDeleteQueries@8 @188
- glIsQuery@4 @189
- glBeginQuery@8 @190
- glEndQuery@4 @191
- glGetQueryiv@12 @192
- glGetQueryObjectuiv@12 @193
- glUnmapBuffer@4 @194
- glGetBufferPointerv@12 @195
- glDrawBuffers@8 @196
- glUniformMatrix2x3fv@16 @197
- glUniformMatrix3x2fv@16 @198
- glUniformMatrix2x4fv@16 @199
- glUniformMatrix4x2fv@16 @200
- glUniformMatrix3x4fv@16 @201
- glUniformMatrix4x3fv@16 @202
- glBlitFramebuffer@40 @203
- glRenderbufferStorageMultisample@20 @204
- glFramebufferTextureLayer@20 @205
- glMapBufferRange@16 @206
- glFlushMappedBufferRange@12 @207
- glBindVertexArray@4 @208
- glDeleteVertexArrays@8 @209
- glGenVertexArrays@8 @210
- glIsVertexArray@4 @211
- glGetIntegeri_v@12 @212
- glBeginTransformFeedback@4 @213
- glEndTransformFeedback@0 @214
- glBindBufferRange@20 @215
- glBindBufferBase@12 @216
- glTransformFeedbackVaryings@16 @217
- glGetTransformFeedbackVarying@28 @218
- glVertexAttribIPointer@20 @219
- glGetVertexAttribIiv@12 @220
- glGetVertexAttribIuiv@12 @221
- glVertexAttribI4i@20 @222
- glVertexAttribI4ui@20 @223
- glVertexAttribI4iv@8 @224
- glVertexAttribI4uiv@8 @225
- glGetUniformuiv@12 @226
- glGetFragDataLocation@8 @227
- glUniform1ui@8 @228
- glUniform2ui@12 @229
- glUniform3ui@16 @230
- glUniform4ui@20 @231
- glUniform1uiv@12 @232
- glUniform2uiv@12 @233
- glUniform3uiv@12 @234
- glUniform4uiv@12 @235
- glClearBufferiv@12 @236
- glClearBufferuiv@12 @237
- glClearBufferfv@12 @238
- glClearBufferfi@16 @239
- glGetStringi@8 @240
- glCopyBufferSubData@20 @241
- glGetUniformIndices@16 @242
- glGetActiveUniformsiv@20 @243
- glGetUniformBlockIndex@8 @244
- glGetActiveUniformBlockiv@16 @245
- glGetActiveUniformBlockName@20 @246
- glUniformBlockBinding@12 @247
- glDrawArraysInstanced@16 @248
- glDrawElementsInstanced@20 @249
- glFenceSync@8 @250
- glIsSync@4 @251
- glDeleteSync@4 @252
- glClientWaitSync@16 @253
- glWaitSync@16 @254
- glGetInteger64v@8 @255
- glGetSynciv@20 @256
- glGetInteger64i_v@12 @257
- glGetBufferParameteri64v@12 @258
- glGenSamplers@8 @259
- glDeleteSamplers@8 @260
- glIsSampler@4 @261
- glBindSampler@8 @262
- glSamplerParameteri@12 @263
- glSamplerParameteriv@12 @264
- glSamplerParameterf@12 @265
- glSamplerParameterfv@12 @266
- glGetSamplerParameteriv@12 @267
- glGetSamplerParameterfv@12 @268
- glVertexAttribDivisor@8 @269
- glBindTransformFeedback@8 @270
- glDeleteTransformFeedbacks@8 @271
- glGenTransformFeedbacks@8 @272
- glIsTransformFeedback@4 @273
- glPauseTransformFeedback@0 @274
- glResumeTransformFeedback@0 @275
- glGetProgramBinary@20 @276
- glProgramBinary@16 @277
- glProgramParameteri@12 @278
- glInvalidateFramebuffer@12 @279
- glInvalidateSubFramebuffer@28 @280
- glTexStorage2D@20 @281
- glTexStorage3D@24 @282
- glGetInternalformativ@20 @283
-
- ; GLES 3.1 Functions
- glDispatchCompute@12 @345
- glDispatchComputeIndirect@4 @346
- glDrawArraysIndirect@8 @347
- glDrawElementsIndirect@12 @348
- glFramebufferParameteri@12 @349
- glGetFramebufferParameteriv@12 @350
- glGetProgramInterfaceiv@16 @351
- glGetProgramResourceIndex@12 @352
- glGetProgramResourceName@24 @353
- glGetProgramResourceiv@32 @354
- glGetProgramResourceLocation@12 @355
- glUseProgramStages@12 @356
- glActiveShaderProgram@8 @357
- glCreateShaderProgramv@12 @358
- glBindProgramPipeline@4 @359
- glDeleteProgramPipelines@8 @360
- glGenProgramPipelines@8 @361
- glIsProgramPipeline@4 @362
- glGetProgramPipelineiv@12 @363
- glProgramUniform1i@12 @364
- glProgramUniform2i@16 @365
- glProgramUniform3i@20 @366
- glProgramUniform4i@24 @367
- glProgramUniform1ui@12 @368
- glProgramUniform2ui@16 @369
- glProgramUniform3ui@20 @370
- glProgramUniform4ui@24 @371
- glProgramUniform1f@12 @372
- glProgramUniform2f@16 @373
- glProgramUniform3f@20 @374
- glProgramUniform4f@24 @375
- glProgramUniform1iv@16 @376
- glProgramUniform2iv@16 @377
- glProgramUniform3iv@16 @378
- glProgramUniform4iv@16 @379
- glProgramUniform1uiv@16 @380
- glProgramUniform2uiv@16 @381
- glProgramUniform3uiv@16 @382
- glProgramUniform4uiv@16 @383
- glProgramUniform1fv@16 @384
- glProgramUniform2fv@16 @385
- glProgramUniform3fv@16 @386
- glProgramUniform4fv@16 @387
- glProgramUniformMatrix2fv@20 @388
- glProgramUniformMatrix3fv@20 @389
- glProgramUniformMatrix4fv@20 @390
- glProgramUniformMatrix2x3fv@20 @391
- glProgramUniformMatrix3x2fv@20 @392
- glProgramUniformMatrix2x4fv@20 @393
- glProgramUniformMatrix4x2fv@20 @394
- glProgramUniformMatrix3x4fv@20 @395
- glProgramUniformMatrix4x3fv@20 @396
- glValidateProgramPipeline@4 @397
- glGetProgramPipelineInfoLog@16 @398
- glBindImageTexture@28 @399
- glGetBooleani_v@12 @400
- glMemoryBarrier@4 @401
- glMemoryBarrierByRegion@4 @402
- glTexStorage2DMultisample@24 @403
- glGetMultisamplefv@12 @404
- glSampleMaski@8 @405
- glGetTexLevelParameteriv@16 @406
- glGetTexLevelParameterfv@16 @407
- glBindVertexBuffer@16 @408
- glVertexAttribFormat@20 @409
- glVertexAttribIFormat@16 @410
- glVertexAttribBinding@8 @411
- glVertexBindingDivisor@8 @412
diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2d.def b/src/3rdparty/angle/src/libGLESv2/libGLESv2d.def
deleted file mode 100644
index 9a00a9f8ae..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/libGLESv2d.def
+++ /dev/null
@@ -1,412 +0,0 @@
-LIBRARY libGLESv2d
-EXPORTS
- glActiveTexture @1
- glAttachShader @2
- glBindAttribLocation @3
- glBindBuffer @4
- glBindFramebuffer @5
- glBindRenderbuffer @6
- glBindTexture @7
- glBlendColor @8
- glBlendEquation @9
- glBlendEquationSeparate @10
- glBlendFunc @11
- glBlendFuncSeparate @12
- glBufferData @13
- glBufferSubData @14
- glCheckFramebufferStatus @15
- glClear @16
- glClearColor @17
- glClearDepthf @18
- glClearStencil @19
- glColorMask @20
- glCompileShader @21
- glCompressedTexImage2D @22
- glCompressedTexSubImage2D @23
- glCopyTexImage2D @24
- glCopyTexSubImage2D @25
- glCreateProgram @26
- glCreateShader @27
- glCullFace @28
- glDeleteBuffers @29
- glDeleteFramebuffers @30
- glDeleteProgram @32
- glDeleteRenderbuffers @33
- glDeleteShader @34
- glDeleteTextures @31
- glDepthFunc @36
- glDepthMask @37
- glDepthRangef @38
- glDetachShader @35
- glDisable @39
- glDisableVertexAttribArray @40
- glDrawArrays @41
- glDrawElements @42
- glEnable @43
- glEnableVertexAttribArray @44
- glFinish @45
- glFlush @46
- glFramebufferRenderbuffer @47
- glFramebufferTexture2D @48
- glFrontFace @49
- glGenBuffers @50
- glGenFramebuffers @52
- glGenRenderbuffers @53
- glGenTextures @54
- glGenerateMipmap @51
- glGetActiveAttrib @55
- glGetActiveUniform @56
- glGetAttachedShaders @57
- glGetAttribLocation @58
- glGetBooleanv @59
- glGetBufferParameteriv @60
- glGetError @61
- glGetFloatv @62
- glGetFramebufferAttachmentParameteriv @63
- glGetIntegerv @64
- glGetProgramInfoLog @66
- glGetProgramiv @65
- glGetRenderbufferParameteriv @67
- glGetShaderInfoLog @69
- glGetShaderPrecisionFormat @70
- glGetShaderSource @71
- glGetShaderiv @68
- glGetString @72
- glGetTexParameterfv @73
- glGetTexParameteriv @74
- glGetUniformLocation @77
- glGetUniformfv @75
- glGetUniformiv @76
- glGetVertexAttribPointerv @80
- glGetVertexAttribfv @78
- glGetVertexAttribiv @79
- glHint @81
- glIsBuffer @82
- glIsEnabled @83
- glIsFramebuffer @84
- glIsProgram @85
- glIsRenderbuffer @86
- glIsShader @87
- glIsTexture @88
- glLineWidth @89
- glLinkProgram @90
- glPixelStorei @91
- glPolygonOffset @92
- glReadPixels @93
- glReleaseShaderCompiler @94
- glRenderbufferStorage @95
- glSampleCoverage @96
- glScissor @97
- glShaderBinary @98
- glShaderSource @99
- glStencilFunc @100
- glStencilFuncSeparate @101
- glStencilMask @102
- glStencilMaskSeparate @103
- glStencilOp @104
- glStencilOpSeparate @105
- glTexImage2D @106
- glTexParameterf @107
- glTexParameterfv @108
- glTexParameteri @109
- glTexParameteriv @110
- glTexSubImage2D @111
- glUniform1f @112
- glUniform1fv @113
- glUniform1i @114
- glUniform1iv @115
- glUniform2f @116
- glUniform2fv @117
- glUniform2i @118
- glUniform2iv @119
- glUniform3f @120
- glUniform3fv @121
- glUniform3i @122
- glUniform3iv @123
- glUniform4f @124
- glUniform4fv @125
- glUniform4i @126
- glUniform4iv @127
- glUniformMatrix2fv @128
- glUniformMatrix3fv @129
- glUniformMatrix4fv @130
- glUseProgram @131
- glValidateProgram @132
- glVertexAttrib1f @133
- glVertexAttrib1fv @134
- glVertexAttrib2f @135
- glVertexAttrib2fv @136
- glVertexAttrib3f @137
- glVertexAttrib3fv @138
- glVertexAttrib4f @139
- glVertexAttrib4fv @140
- glVertexAttribPointer @141
- glViewport @142
-
- ; Extensions
- glBlitFramebufferANGLE @149
- glRenderbufferStorageMultisampleANGLE @150
- glDeleteFencesNV @151
- glFinishFenceNV @152
- glGenFencesNV @153
- glGetFenceivNV @154
- glIsFenceNV @155
- glSetFenceNV @156
- glTestFenceNV @157
- glGetTranslatedShaderSourceANGLE @159
- glTexStorage2DEXT @160
- glGetGraphicsResetStatusEXT @161
- glReadnPixelsEXT @162
- glGetnUniformfvEXT @163
- glGetnUniformivEXT @164
- glGenQueriesEXT @165
- glDeleteQueriesEXT @166
- glIsQueryEXT @167
- glBeginQueryEXT @168
- glEndQueryEXT @169
- glGetQueryivEXT @170
- glGetQueryObjectuivEXT @171
- glVertexAttribDivisorANGLE @172
- glDrawArraysInstancedANGLE @173
- glDrawElementsInstancedANGLE @174
- glProgramBinaryOES @175
- glGetProgramBinaryOES @176
- glDrawBuffersEXT @179
- glMapBufferOES @285
- glUnmapBufferOES @286
- glGetBufferPointervOES @287
- glMapBufferRangeEXT @288
- glFlushMappedBufferRangeEXT @289
- glDiscardFramebufferEXT @293
- glInsertEventMarkerEXT @294
- glPushGroupMarkerEXT @295
- glPopGroupMarkerEXT @296
- glEGLImageTargetTexture2DOES @297
- glEGLImageTargetRenderbufferStorageOES @298
- glBindVertexArrayOES @299
- glDeleteVertexArraysOES @300
- glGenVertexArraysOES @301
- glIsVertexArrayOES @302
- glDebugMessageControlKHR @303
- glDebugMessageInsertKHR @304
- glDebugMessageCallbackKHR @305
- glGetDebugMessageLogKHR @306
- glPushDebugGroupKHR @307
- glPopDebugGroupKHR @308
- glObjectLabelKHR @309
- glGetObjectLabelKHR @310
- glObjectPtrLabelKHR @311
- glGetObjectPtrLabelKHR @312
- glGetPointervKHR @313
- glQueryCounterEXT @314
- glGetQueryObjectivEXT @315
- glGetQueryObjecti64vEXT @316
- glGetQueryObjectui64vEXT @317
- glBindUniformLocationCHROMIUM @318
- glCoverageModulationCHROMIUM @319
-
- glMatrixLoadfCHROMIUM @320
- glMatrixLoadIdentityCHROMIUM @321
- glGenPathsCHROMIUM @322
- glDeletePathsCHROMIUM @323
- glIsPathCHROMIUM @324
- glPathCommandsCHROMIUM @325
- glPathParameterfCHROMIUM @326
- glPathParameteriCHROMIUM @327
- glGetPathParameterfvCHROMIUM @328
- glGetPathParameterivCHROMIUM @329
- glPathStencilFuncCHROMIUM @330
- glStencilFillPathCHROMIUM @331
- glStencilStrokePathCHROMIUM @332
- glCoverFillPathCHROMIUM @333
- glCoverStrokePathCHROMIUM @334
- glStencilThenCoverFillPathCHROMIUM @335
- glStencilThenCoverStrokePathCHROMIUM @336
- glCoverFillPathInstancedCHROMIUM @337
- glCoverStrokePathInstancedCHROMIUM @338
- glStencilStrokePathInstancedCHROMIUM @339
- glStencilFillPathInstancedCHROMIUM @340
- glStencilThenCoverFillPathInstancedCHROMIUM @341
- glStencilThenCoverStrokePathInstancedCHROMIUM @342
- glBindFragmentInputLocationCHROMIUM @343
- glProgramPathFragmentInputGenCHROMIUM @344
-
- glFramebufferTextureMultiviewLayeredANGLE @413
- glFramebufferTextureMultiviewSideBySideANGLE @414
- glRequestExtensionANGLE @415
-
- ; GLES 3.0 Functions
- glReadBuffer @180
- glDrawRangeElements @181
- glTexImage3D @182
- glTexSubImage3D @183
- glCopyTexSubImage3D @184
- glCompressedTexImage3D @185
- glCompressedTexSubImage3D @186
- glGenQueries @187
- glDeleteQueries @188
- glIsQuery @189
- glBeginQuery @190
- glEndQuery @191
- glGetQueryiv @192
- glGetQueryObjectuiv @193
- glUnmapBuffer @194
- glGetBufferPointerv @195
- glDrawBuffers @196
- glUniformMatrix2x3fv @197
- glUniformMatrix3x2fv @198
- glUniformMatrix2x4fv @199
- glUniformMatrix4x2fv @200
- glUniformMatrix3x4fv @201
- glUniformMatrix4x3fv @202
- glBlitFramebuffer @203
- glRenderbufferStorageMultisample @204
- glFramebufferTextureLayer @205
- glMapBufferRange @206
- glFlushMappedBufferRange @207
- glBindVertexArray @208
- glDeleteVertexArrays @209
- glGenVertexArrays @210
- glIsVertexArray @211
- glGetIntegeri_v @212
- glBeginTransformFeedback @213
- glEndTransformFeedback @214
- glBindBufferRange @215
- glBindBufferBase @216
- glTransformFeedbackVaryings @217
- glGetTransformFeedbackVarying @218
- glVertexAttribIPointer @219
- glGetVertexAttribIiv @220
- glGetVertexAttribIuiv @221
- glVertexAttribI4i @222
- glVertexAttribI4ui @223
- glVertexAttribI4iv @224
- glVertexAttribI4uiv @225
- glGetUniformuiv @226
- glGetFragDataLocation @227
- glUniform1ui @228
- glUniform2ui @229
- glUniform3ui @230
- glUniform4ui @231
- glUniform1uiv @232
- glUniform2uiv @233
- glUniform3uiv @234
- glUniform4uiv @235
- glClearBufferiv @236
- glClearBufferuiv @237
- glClearBufferfv @238
- glClearBufferfi @239
- glGetStringi @240
- glCopyBufferSubData @241
- glGetUniformIndices @242
- glGetActiveUniformsiv @243
- glGetUniformBlockIndex @244
- glGetActiveUniformBlockiv @245
- glGetActiveUniformBlockName @246
- glUniformBlockBinding @247
- glDrawArraysInstanced @248
- glDrawElementsInstanced @249
- glFenceSync @250
- glIsSync @251
- glDeleteSync @252
- glClientWaitSync @253
- glWaitSync @254
- glGetInteger64v @255
- glGetSynciv @256
- glGetInteger64i_v @257
- glGetBufferParameteri64v @258
- glGenSamplers @259
- glDeleteSamplers @260
- glIsSampler @261
- glBindSampler @262
- glSamplerParameteri @263
- glSamplerParameteriv @264
- glSamplerParameterf @265
- glSamplerParameterfv @266
- glGetSamplerParameteriv @267
- glGetSamplerParameterfv @268
- glVertexAttribDivisor @269
- glBindTransformFeedback @270
- glDeleteTransformFeedbacks @271
- glGenTransformFeedbacks @272
- glIsTransformFeedback @273
- glPauseTransformFeedback @274
- glResumeTransformFeedback @275
- glGetProgramBinary @276
- glProgramBinary @277
- glProgramParameteri @278
- glInvalidateFramebuffer @279
- glInvalidateSubFramebuffer @280
- glTexStorage2D @281
- glTexStorage3D @282
- glGetInternalformativ @283
-
- ; GLES 3.1 Functions
- glDispatchCompute @345
- glDispatchComputeIndirect @346
- glDrawArraysIndirect @347
- glDrawElementsIndirect @348
- glFramebufferParameteri @349
- glGetFramebufferParameteriv @350
- glGetProgramInterfaceiv @351
- glGetProgramResourceIndex @352
- glGetProgramResourceName @353
- glGetProgramResourceiv @354
- glGetProgramResourceLocation @355
- glUseProgramStages @356
- glActiveShaderProgram @357
- glCreateShaderProgramv @358
- glBindProgramPipeline @359
- glDeleteProgramPipelines @360
- glGenProgramPipelines @361
- glIsProgramPipeline @362
- glGetProgramPipelineiv @363
- glProgramUniform1i @364
- glProgramUniform2i @365
- glProgramUniform3i @366
- glProgramUniform4i @367
- glProgramUniform1ui @368
- glProgramUniform2ui @369
- glProgramUniform3ui @370
- glProgramUniform4ui @371
- glProgramUniform1f @372
- glProgramUniform2f @373
- glProgramUniform3f @374
- glProgramUniform4f @375
- glProgramUniform1iv @376
- glProgramUniform2iv @377
- glProgramUniform3iv @378
- glProgramUniform4iv @379
- glProgramUniform1uiv @380
- glProgramUniform2uiv @381
- glProgramUniform3uiv @382
- glProgramUniform4uiv @383
- glProgramUniform1fv @384
- glProgramUniform2fv @385
- glProgramUniform3fv @386
- glProgramUniform4fv @387
- glProgramUniformMatrix2fv @388
- glProgramUniformMatrix3fv @389
- glProgramUniformMatrix4fv @390
- glProgramUniformMatrix2x3fv @391
- glProgramUniformMatrix3x2fv @392
- glProgramUniformMatrix2x4fv @393
- glProgramUniformMatrix4x2fv @394
- glProgramUniformMatrix3x4fv @395
- glProgramUniformMatrix4x3fv @396
- glValidateProgramPipeline @397
- glGetProgramPipelineInfoLog @398
- glBindImageTexture @399
- glGetBooleani_v @400
- glMemoryBarrier @401
- glMemoryBarrierByRegion @402
- glTexStorage2DMultisample @403
- glGetMultisamplefv @404
- glSampleMaski @405
- glGetTexLevelParameteriv @406
- glGetTexLevelParameterfv @407
- glBindVertexBuffer @408
- glVertexAttribFormat @409
- glVertexAttribIFormat @410
- glVertexAttribBinding @411
- glVertexBindingDivisor @412
diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2d_mingw32.def b/src/3rdparty/angle/src/libGLESv2/libGLESv2d_mingw32.def
deleted file mode 100644
index a182c21a05..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/libGLESv2d_mingw32.def
+++ /dev/null
@@ -1,411 +0,0 @@
-LIBRARY libGLESv2
-EXPORTS
- glActiveTexture@4 @1
- glAttachShader@8 @2
- glBindAttribLocation@12 @3
- glBindBuffer@8 @4
- glBindFramebuffer@8 @5
- glBindRenderbuffer@8 @6
- glBindTexture@8 @7
- glBlendColor@16 @8
- glBlendEquation@4 @9
- glBlendEquationSeparate@8 @10
- glBlendFunc@8 @11
- glBlendFuncSeparate@16 @12
- glBufferData@16 @13
- glBufferSubData@16 @14
- glCheckFramebufferStatus@4 @15
- glClear@4 @16
- glClearColor@16 @17
- glClearDepthf@4 @18
- glClearStencil@4 @19
- glColorMask@16 @20
- glCompileShader@4 @21
- glCompressedTexImage2D@32 @22
- glCompressedTexSubImage2D@36 @23
- glCopyTexImage2D@32 @24
- glCopyTexSubImage2D@32 @25
- glCreateProgram@0 @26
- glCreateShader@4 @27
- glCullFace@4 @28
- glDeleteBuffers@8 @29
- glDeleteFramebuffers@8 @30
- glDeleteProgram@4 @32
- glDeleteRenderbuffers@8 @33
- glDeleteShader@4 @34
- glDeleteTextures@8 @31
- glDepthFunc@4 @36
- glDepthMask@4 @37
- glDepthRangef@8 @38
- glDetachShader@8 @35
- glDisable@4 @39
- glDisableVertexAttribArray@4 @40
- glDrawArrays@12 @41
- glDrawElements@16 @42
- glEnable@4 @43
- glEnableVertexAttribArray@4 @44
- glFinish@0 @45
- glFlush@0 @46
- glFramebufferRenderbuffer@16 @47
- glFramebufferTexture2D@20 @48
- glFrontFace@4 @49
- glGenBuffers@8 @50
- glGenFramebuffers@8 @52
- glGenRenderbuffers@8 @53
- glGenTextures@8 @54
- glGenerateMipmap@4 @51
- glGetActiveAttrib@28 @55
- glGetActiveUniform@28 @56
- glGetAttachedShaders@16 @57
- glGetAttribLocation@8 @58
- glGetBooleanv@8 @59
- glGetBufferParameteriv@12 @60
- glGetError@0 @61
- glGetFloatv@8 @62
- glGetFramebufferAttachmentParameteriv@16 @63
- glGetIntegerv@8 @64
- glGetProgramInfoLog@16 @66
- glGetProgramiv@12 @65
- glGetRenderbufferParameteriv@12 @67
- glGetShaderInfoLog@16 @69
- glGetShaderPrecisionFormat@16 @70
- glGetShaderSource@16 @71
- glGetShaderiv@12 @68
- glGetString@4 @72
- glGetTexParameterfv@12 @73
- glGetTexParameteriv@12 @74
- glGetUniformLocation@8 @77
- glGetUniformfv@12 @75
- glGetUniformiv@12 @76
- glGetVertexAttribPointerv@12 @80
- glGetVertexAttribfv@12 @78
- glGetVertexAttribiv@12 @79
- glHint@8 @81
- glIsBuffer@4 @82
- glIsEnabled@4 @83
- glIsFramebuffer@4 @84
- glIsProgram@4 @85
- glIsRenderbuffer@4 @86
- glIsShader@4 @87
- glIsTexture@4 @88
- glLineWidth@4 @89
- glLinkProgram@4 @90
- glPixelStorei@8 @91
- glPolygonOffset@8 @92
- glReadPixels@28 @93
- glReleaseShaderCompiler@0 @94
- glRenderbufferStorage@16 @95
- glSampleCoverage@8 @96
- glScissor@16 @97
- glShaderBinary@20 @98
- glShaderSource@16 @99
- glStencilFunc@12 @100
- glStencilFuncSeparate@16 @101
- glStencilMask@4 @102
- glStencilMaskSeparate@8 @103
- glStencilOp@12 @104
- glStencilOpSeparate@16 @105
- glTexImage2D@36 @106
- glTexParameterf@12 @107
- glTexParameterfv@12 @108
- glTexParameteri@12 @109
- glTexParameteriv@12 @110
- glTexSubImage2D@36 @111
- glUniform1f@8 @112
- glUniform1fv@12 @113
- glUniform1i@8 @114
- glUniform1iv@12 @115
- glUniform2f@12 @116
- glUniform2fv@12 @117
- glUniform2i@12 @118
- glUniform2iv@12 @119
- glUniform3f@16 @120
- glUniform3fv@12 @121
- glUniform3i@16 @122
- glUniform3iv@12 @123
- glUniform4f@20 @124
- glUniform4fv@12 @125
- glUniform4i@20 @126
- glUniform4iv@12 @127
- glUniformMatrix2fv@16 @128
- glUniformMatrix3fv@16 @129
- glUniformMatrix4fv@16 @130
- glUseProgram@4 @131
- glValidateProgram@4 @132
- glVertexAttrib1f@8 @133
- glVertexAttrib1fv@8 @134
- glVertexAttrib2f@12 @135
- glVertexAttrib2fv@8 @136
- glVertexAttrib3f@16 @137
- glVertexAttrib3fv@8 @138
- glVertexAttrib4f@20 @139
- glVertexAttrib4fv@8 @140
- glVertexAttribPointer@24 @141
- glViewport@16 @142
-
- ; Extensions
- glBlitFramebufferANGLE@40 @149
- glRenderbufferStorageMultisampleANGLE@20 @150
- glDeleteFencesNV@8 @151
- glFinishFenceNV@4 @152
- glGenFencesNV@8 @153
- glGetFenceivNV@12 @154
- glIsFenceNV@4 @155
- glSetFenceNV@8 @156
- glTestFenceNV@4 @157
- glGetTranslatedShaderSourceANGLE@16 @159
- glTexStorage2DEXT@20 @160
- glGetGraphicsResetStatusEXT@0 @161
- glReadnPixelsEXT@32 @162
- glGetnUniformfvEXT@16 @163
- glGetnUniformivEXT@16 @164
- glGenQueriesEXT@8 @165
- glDeleteQueriesEXT@8 @166
- glIsQueryEXT@4 @167
- glBeginQueryEXT@8 @168
- glEndQueryEXT@4 @169
- glGetQueryivEXT@12 @170
- glGetQueryObjectuivEXT@12 @171
- glVertexAttribDivisorANGLE@8 @172
- glDrawArraysInstancedANGLE@16 @173
- glDrawElementsInstancedANGLE@20 @174
- glProgramBinaryOES@16 @175
- glGetProgramBinaryOES@20 @176
- glDrawBuffersEXT@8 @179
- glMapBufferOES@8 @285
- glUnmapBufferOES@4 @286
- glGetBufferPointervOES@12 @287
- glMapBufferRangeEXT@16 @288
- glFlushMappedBufferRangeEXT@12 @289
- glDiscardFramebufferEXT@12 @293
- glInsertEventMarkerEXT@8 @294
- glPushGroupMarkerEXT@8 @295
- glPopGroupMarkerEXT@0 @296
- glEGLImageTargetTexture2DOES@8 @297
- glEGLImageTargetRenderbufferStorageOES@8 @298
- glBindVertexArrayOES@4 @299
- glDeleteVertexArraysOES@8 @300
- glGenVertexArraysOES@8 @301
- glIsVertexArrayOES@4 @302
- glDebugMessageControlKHR@24 @303
- glDebugMessageInsertKHR@24 @304
- glDebugMessageCallbackKHR@8 @305
- glGetDebugMessageLogKHR@32 @306
- glPushDebugGroupKHR@16 @307
- glPopDebugGroupKHR@0 @308
- glObjectLabelKHR@16 @309
- glGetObjectLabelKHR@20 @310
- glObjectPtrLabelKHR@12 @311
- glGetObjectPtrLabelKHR@16 @312
- glGetPointervKHR@8 @313
- glQueryCounterEXT@8 @314
- glGetQueryObjectivEXT@12 @315
- glGetQueryObjecti64vEXT@12 @316
- glGetQueryObjectui64vEXT@12 @317
- glBindUniformLocationCHROMIUM@12 @318
- glCoverageModulationCHROMIUM@4 @319
- glMatrixLoadfCHROMIUM@8 @320
- glMatrixLoadIdentityCHROMIUM@4 @321
- glGenPathsCHROMIUM@4 @322
- glDeletePathsCHROMIUM@8 @323
- glIsPathCHROMIUM@4 @324
- glPathCommandsCHROMIUM@24 @325
- glPathParameterfCHROMIUM@12 @326
- glPathParameteriCHROMIUM@12 @327
- glGetPathParameterfvCHROMIUM@12 @328
- glGetPathParameterivCHROMIUM@12 @329
- glPathStencilFuncCHROMIUM@12 @330
- glStencilFillPathCHROMIUM@12 @331
- glStencilStrokePathCHROMIUM@12 @332
- glCoverFillPathCHROMIUM@8 @333
- glCoverStrokePathCHROMIUM@8 @334
- glStencilThenCoverFillPathCHROMIUM@16 @335
- glStencilThenCoverStrokePathCHROMIUM@16 @336
- glCoverFillPathInstancedCHROMIUM@28 @337
- glCoverStrokePathInstancedCHROMIUM@28 @338
- glStencilStrokePathInstancedCHROMIUM@32 @339
- glStencilFillPathInstancedCHROMIUM@32 @340
- glStencilThenCoverFillPathInstancedCHROMIUM@36 @341
- glStencilThenCoverStrokePathInstancedCHROMIUM@36 @342
- glBindFragmentInputLocationCHROMIUM@12 @343
- glProgramPathFragmentInputGenCHROMIUM@20 @344
-
- glFramebufferTextureMultiviewLayeredANGLE@24 @413
- glFramebufferTextureMultiviewSideBySideANGLE@24 @414
- glRequestExtensionANGLE@4 @415
-
- ; GLES 3.0 Functions
- glReadBuffer@4 @180
- glDrawRangeElements@24 @181
- glTexImage3D@40 @182
- glTexSubImage3D@44 @183
- glCopyTexSubImage3D@36 @184
- glCompressedTexImage3D@36 @185
- glCompressedTexSubImage3D@44 @186
- glGenQueries@8 @187
- glDeleteQueries@8 @188
- glIsQuery@4 @189
- glBeginQuery@8 @190
- glEndQuery@4 @191
- glGetQueryiv@12 @192
- glGetQueryObjectuiv@12 @193
- glUnmapBuffer@4 @194
- glGetBufferPointerv@12 @195
- glDrawBuffers@8 @196
- glUniformMatrix2x3fv@16 @197
- glUniformMatrix3x2fv@16 @198
- glUniformMatrix2x4fv@16 @199
- glUniformMatrix4x2fv@16 @200
- glUniformMatrix3x4fv@16 @201
- glUniformMatrix4x3fv@16 @202
- glBlitFramebuffer@40 @203
- glRenderbufferStorageMultisample@20 @204
- glFramebufferTextureLayer@20 @205
- glMapBufferRange@16 @206
- glFlushMappedBufferRange@12 @207
- glBindVertexArray@4 @208
- glDeleteVertexArrays@8 @209
- glGenVertexArrays@8 @210
- glIsVertexArray@4 @211
- glGetIntegeri_v@12 @212
- glBeginTransformFeedback@4 @213
- glEndTransformFeedback@0 @214
- glBindBufferRange@20 @215
- glBindBufferBase@12 @216
- glTransformFeedbackVaryings@16 @217
- glGetTransformFeedbackVarying@28 @218
- glVertexAttribIPointer@20 @219
- glGetVertexAttribIiv@12 @220
- glGetVertexAttribIuiv@12 @221
- glVertexAttribI4i@20 @222
- glVertexAttribI4ui@20 @223
- glVertexAttribI4iv@8 @224
- glVertexAttribI4uiv@8 @225
- glGetUniformuiv@12 @226
- glGetFragDataLocation@8 @227
- glUniform1ui@8 @228
- glUniform2ui@12 @229
- glUniform3ui@16 @230
- glUniform4ui@20 @231
- glUniform1uiv@12 @232
- glUniform2uiv@12 @233
- glUniform3uiv@12 @234
- glUniform4uiv@12 @235
- glClearBufferiv@12 @236
- glClearBufferuiv@12 @237
- glClearBufferfv@12 @238
- glClearBufferfi@16 @239
- glGetStringi@8 @240
- glCopyBufferSubData@20 @241
- glGetUniformIndices@16 @242
- glGetActiveUniformsiv@20 @243
- glGetUniformBlockIndex@8 @244
- glGetActiveUniformBlockiv@16 @245
- glGetActiveUniformBlockName@20 @246
- glUniformBlockBinding@12 @247
- glDrawArraysInstanced@16 @248
- glDrawElementsInstanced@20 @249
- glFenceSync@8 @250
- glIsSync@4 @251
- glDeleteSync@4 @252
- glClientWaitSync@16 @253
- glWaitSync@16 @254
- glGetInteger64v@8 @255
- glGetSynciv@20 @256
- glGetInteger64i_v@12 @257
- glGetBufferParameteri64v@12 @258
- glGenSamplers@8 @259
- glDeleteSamplers@8 @260
- glIsSampler@4 @261
- glBindSampler@8 @262
- glSamplerParameteri@12 @263
- glSamplerParameteriv@12 @264
- glSamplerParameterf@12 @265
- glSamplerParameterfv@12 @266
- glGetSamplerParameteriv@12 @267
- glGetSamplerParameterfv@12 @268
- glVertexAttribDivisor@8 @269
- glBindTransformFeedback@8 @270
- glDeleteTransformFeedbacks@8 @271
- glGenTransformFeedbacks@8 @272
- glIsTransformFeedback@4 @273
- glPauseTransformFeedback@0 @274
- glResumeTransformFeedback@0 @275
- glGetProgramBinary@20 @276
- glProgramBinary@16 @277
- glProgramParameteri@12 @278
- glInvalidateFramebuffer@12 @279
- glInvalidateSubFramebuffer@28 @280
- glTexStorage2D@20 @281
- glTexStorage3D@24 @282
- glGetInternalformativ@20 @283
-
- ; GLES 3.1 Functions
- glDispatchCompute@12 @345
- glDispatchComputeIndirect@4 @346
- glDrawArraysIndirect@8 @347
- glDrawElementsIndirect@12 @348
- glFramebufferParameteri@12 @349
- glGetFramebufferParameteriv@12 @350
- glGetProgramInterfaceiv@16 @351
- glGetProgramResourceIndex@12 @352
- glGetProgramResourceName@24 @353
- glGetProgramResourceiv@32 @354
- glGetProgramResourceLocation@12 @355
- glUseProgramStages@12 @356
- glActiveShaderProgram@8 @357
- glCreateShaderProgramv@12 @358
- glBindProgramPipeline@4 @359
- glDeleteProgramPipelines@8 @360
- glGenProgramPipelines@8 @361
- glIsProgramPipeline@4 @362
- glGetProgramPipelineiv@12 @363
- glProgramUniform1i@12 @364
- glProgramUniform2i@16 @365
- glProgramUniform3i@20 @366
- glProgramUniform4i@24 @367
- glProgramUniform1ui@12 @368
- glProgramUniform2ui@16 @369
- glProgramUniform3ui@20 @370
- glProgramUniform4ui@24 @371
- glProgramUniform1f@12 @372
- glProgramUniform2f@16 @373
- glProgramUniform3f@20 @374
- glProgramUniform4f@24 @375
- glProgramUniform1iv@16 @376
- glProgramUniform2iv@16 @377
- glProgramUniform3iv@16 @378
- glProgramUniform4iv@16 @379
- glProgramUniform1uiv@16 @380
- glProgramUniform2uiv@16 @381
- glProgramUniform3uiv@16 @382
- glProgramUniform4uiv@16 @383
- glProgramUniform1fv@16 @384
- glProgramUniform2fv@16 @385
- glProgramUniform3fv@16 @386
- glProgramUniform4fv@16 @387
- glProgramUniformMatrix2fv@20 @388
- glProgramUniformMatrix3fv@20 @389
- glProgramUniformMatrix4fv@20 @390
- glProgramUniformMatrix2x3fv@20 @391
- glProgramUniformMatrix3x2fv@20 @392
- glProgramUniformMatrix2x4fv@20 @393
- glProgramUniformMatrix4x2fv@20 @394
- glProgramUniformMatrix3x4fv@20 @395
- glProgramUniformMatrix4x3fv@20 @396
- glValidateProgramPipeline@4 @397
- glGetProgramPipelineInfoLog@16 @398
- glBindImageTexture@28 @399
- glGetBooleani_v@12 @400
- glMemoryBarrier@4 @401
- glMemoryBarrierByRegion@4 @402
- glTexStorage2DMultisample@24 @403
- glGetMultisamplefv@12 @404
- glSampleMaski@8 @405
- glGetTexLevelParameteriv@16 @406
- glGetTexLevelParameterfv@16 @407
- glBindVertexBuffer@16 @408
- glVertexAttribFormat@20 @409
- glVertexAttribIFormat@16 @410
- glVertexAttribBinding@8 @411
- glVertexBindingDivisor@8 @412
diff --git a/src/3rdparty/angle/src/libGLESv2/proc_table.h b/src/3rdparty/angle/src/libGLESv2/proc_table.h
deleted file mode 100644
index f718291be7..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/proc_table.h
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// 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 <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/src/3rdparty/angle/src/libGLESv2/proc_table_autogen.cpp b/src/3rdparty/angle/src/libGLESv2/proc_table_autogen.cpp
deleted file mode 100644
index f294c1edc3..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/proc_table_autogen.cpp
+++ /dev/null
@@ -1,548 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by gen_proc_table.py using data from proc_table_data.json.
-//
-// 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.
-//
-
-#include "libGLESv2/proc_table.h"
-
-#include "libGLESv2/entry_points_egl.h"
-#include "libGLESv2/entry_points_egl_ext.h"
-#include "libGLESv2/entry_points_gles_2_0_autogen.h"
-#include "libGLESv2/entry_points_gles_2_0_ext.h"
-#include "libGLESv2/entry_points_gles_3_0_autogen.h"
-#include "libGLESv2/entry_points_gles_3_1_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)},
- {"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)},
- {"eglCreatePlatformWindowSurface", P(egl::CreatePlatformWindowSurface)},
- {"eglCreateStreamKHR", P(egl::CreateStreamKHR)},
- {"eglCreateStreamProducerD3DTextureNV12ANGLE", P(egl::CreateStreamProducerD3DTextureNV12ANGLE)},
- {"eglCreateSync", P(egl::CreateSync)},
- {"eglCreateWindowSurface", P(egl::CreateWindowSurface)},
- {"eglDestroyContext", P(egl::DestroyContext)},
- {"eglDestroyImage", P(egl::DestroyImage)},
- {"eglDestroyImageKHR", P(egl::DestroyImageKHR)},
- {"eglDestroyStreamKHR", P(egl::DestroyStreamKHR)},
- {"eglDestroySurface", P(egl::DestroySurface)},
- {"eglDestroySync", P(egl::DestroySync)},
- {"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)},
- {"eglGetPlatformDisplay", P(egl::GetPlatformDisplay)},
- {"eglGetPlatformDisplayEXT", P(egl::GetPlatformDisplayEXT)},
- {"eglGetProcAddress", P(egl::GetProcAddress)},
- {"eglGetSyncAttrib", P(egl::GetSyncAttrib)},
- {"eglGetSyncValuesCHROMIUM", P(egl::GetSyncValuesCHROMIUM)},
- {"eglInitialize", P(egl::Initialize)},
- {"eglMakeCurrent", P(egl::MakeCurrent)},
- {"eglPostSubBufferNV", P(egl::PostSubBufferNV)},
- {"eglProgramCacheGetAttribANGLE", P(egl::ProgramCacheGetAttribANGLE)},
- {"eglProgramCachePopulateANGLE", P(egl::ProgramCachePopulateANGLE)},
- {"eglProgramCacheQueryANGLE", P(egl::ProgramCacheQueryANGLE)},
- {"eglProgramCacheResizeANGLE", P(egl::ProgramCacheResizeANGLE)},
- {"eglQueryAPI", P(egl::QueryAPI)},
- {"eglQueryContext", P(egl::QueryContext)},
- {"eglQueryDeviceAttribEXT", P(egl::QueryDeviceAttribEXT)},
- {"eglQueryDeviceStringEXT", P(egl::QueryDeviceStringEXT)},
- {"eglQueryDisplayAttribEXT", P(egl::QueryDisplayAttribEXT)},
- {"eglQueryStreamKHR", P(egl::QueryStreamKHR)},
- {"eglQueryStreamu64KHR", P(egl::QueryStreamu64KHR)},
- {"eglQueryString", P(egl::QueryString)},
- {"eglQuerySurface", P(egl::QuerySurface)},
- {"eglQuerySurfacePointerANGLE", P(egl::QuerySurfacePointerANGLE)},
- {"eglReleaseDeviceANGLE", P(egl::ReleaseDeviceANGLE)},
- {"eglReleaseTexImage", P(egl::ReleaseTexImage)},
- {"eglReleaseThread", P(egl::ReleaseThread)},
- {"eglStreamAttribKHR", P(egl::StreamAttribKHR)},
- {"eglStreamConsumerAcquireKHR", P(egl::StreamConsumerAcquireKHR)},
- {"eglStreamConsumerGLTextureExternalAttribsNV",
- P(egl::StreamConsumerGLTextureExternalAttribsNV)},
- {"eglStreamConsumerGLTextureExternalKHR", P(egl::StreamConsumerGLTextureExternalKHR)},
- {"eglStreamConsumerReleaseKHR", P(egl::StreamConsumerReleaseKHR)},
- {"eglStreamPostD3DTextureNV12ANGLE", P(egl::StreamPostD3DTextureNV12ANGLE)},
- {"eglSurfaceAttrib", P(egl::SurfaceAttrib)},
- {"eglSwapBuffers", P(egl::SwapBuffers)},
- {"eglSwapBuffersWithDamageEXT", P(egl::SwapBuffersWithDamageEXT)},
- {"eglSwapInterval", P(egl::SwapInterval)},
- {"eglTerminate", P(egl::Terminate)},
- {"eglWaitClient", P(egl::WaitClient)},
- {"eglWaitGL", P(egl::WaitGL)},
- {"eglWaitNative", P(egl::WaitNative)},
- {"eglWaitSync", P(egl::WaitSync)},
- {"glActiveShaderProgram", P(gl::ActiveShaderProgram)},
- {"glActiveTexture", P(gl::ActiveTexture)},
- {"glAttachShader", P(gl::AttachShader)},
- {"glBeginQuery", P(gl::BeginQuery)},
- {"glBeginQueryEXT", P(gl::BeginQueryEXT)},
- {"glBeginTransformFeedback", P(gl::BeginTransformFeedback)},
- {"glBindAttribLocation", P(gl::BindAttribLocation)},
- {"glBindBuffer", P(gl::BindBuffer)},
- {"glBindBufferBase", P(gl::BindBufferBase)},
- {"glBindBufferRange", P(gl::BindBufferRange)},
- {"glBindFramebuffer", P(gl::BindFramebuffer)},
- {"glBindImageTexture", P(gl::BindImageTexture)},
- {"glBindProgramPipeline", P(gl::BindProgramPipeline)},
- {"glBindRenderbuffer", P(gl::BindRenderbuffer)},
- {"glBindSampler", P(gl::BindSampler)},
- {"glBindTexture", P(gl::BindTexture)},
- {"glBindTransformFeedback", P(gl::BindTransformFeedback)},
- {"glBindUniformLocationCHROMIUM", P(gl::BindUniformLocationCHROMIUM)},
- {"glBindVertexArray", P(gl::BindVertexArray)},
- {"glBindVertexArrayOES", P(gl::BindVertexArrayOES)},
- {"glBindVertexBuffer", P(gl::BindVertexBuffer)},
- {"glBlendColor", P(gl::BlendColor)},
- {"glBlendEquation", P(gl::BlendEquation)},
- {"glBlendEquationSeparate", P(gl::BlendEquationSeparate)},
- {"glBlendFunc", P(gl::BlendFunc)},
- {"glBlendFuncSeparate", P(gl::BlendFuncSeparate)},
- {"glBlitFramebuffer", P(gl::BlitFramebuffer)},
- {"glBlitFramebufferANGLE", P(gl::BlitFramebufferANGLE)},
- {"glBufferData", P(gl::BufferData)},
- {"glBufferSubData", P(gl::BufferSubData)},
- {"glCheckFramebufferStatus", P(gl::CheckFramebufferStatus)},
- {"glClear", P(gl::Clear)},
- {"glClearBufferfi", P(gl::ClearBufferfi)},
- {"glClearBufferfv", P(gl::ClearBufferfv)},
- {"glClearBufferiv", P(gl::ClearBufferiv)},
- {"glClearBufferuiv", P(gl::ClearBufferuiv)},
- {"glClearColor", P(gl::ClearColor)},
- {"glClearDepthf", P(gl::ClearDepthf)},
- {"glClearStencil", P(gl::ClearStencil)},
- {"glClientWaitSync", P(gl::ClientWaitSync)},
- {"glColorMask", P(gl::ColorMask)},
- {"glCompileShader", P(gl::CompileShader)},
- {"glCompressedCopyTextureCHROMIUM", P(gl::CompressedCopyTextureCHROMIUM)},
- {"glCompressedTexImage2D", P(gl::CompressedTexImage2D)},
- {"glCompressedTexImage2DRobustANGLE", P(gl::CompressedTexImage2DRobustANGLE)},
- {"glCompressedTexImage3D", P(gl::CompressedTexImage3D)},
- {"glCompressedTexImage3DRobustANGLE", P(gl::CompressedTexImage3DRobustANGLE)},
- {"glCompressedTexSubImage2D", P(gl::CompressedTexSubImage2D)},
- {"glCompressedTexSubImage2DRobustANGLE", P(gl::CompressedTexSubImage2DRobustANGLE)},
- {"glCompressedTexSubImage3D", P(gl::CompressedTexSubImage3D)},
- {"glCompressedTexSubImage3DRobustANGLE", P(gl::CompressedTexSubImage3DRobustANGLE)},
- {"glCopyBufferSubData", P(gl::CopyBufferSubData)},
- {"glCopySubTextureCHROMIUM", P(gl::CopySubTextureCHROMIUM)},
- {"glCopyTexImage2D", P(gl::CopyTexImage2D)},
- {"glCopyTexSubImage2D", P(gl::CopyTexSubImage2D)},
- {"glCopyTexSubImage3D", P(gl::CopyTexSubImage3D)},
- {"glCopyTextureCHROMIUM", P(gl::CopyTextureCHROMIUM)},
- {"glCreateProgram", P(gl::CreateProgram)},
- {"glCreateShader", P(gl::CreateShader)},
- {"glCreateShaderProgramv", P(gl::CreateShaderProgramv)},
- {"glCullFace", P(gl::CullFace)},
- {"glDebugMessageCallbackKHR", P(gl::DebugMessageCallbackKHR)},
- {"glDebugMessageControlKHR", P(gl::DebugMessageControlKHR)},
- {"glDebugMessageInsertKHR", P(gl::DebugMessageInsertKHR)},
- {"glDeleteBuffers", P(gl::DeleteBuffers)},
- {"glDeleteFencesNV", P(gl::DeleteFencesNV)},
- {"glDeleteFramebuffers", P(gl::DeleteFramebuffers)},
- {"glDeleteProgram", P(gl::DeleteProgram)},
- {"glDeleteProgramPipelines", P(gl::DeleteProgramPipelines)},
- {"glDeleteQueries", P(gl::DeleteQueries)},
- {"glDeleteQueriesEXT", P(gl::DeleteQueriesEXT)},
- {"glDeleteRenderbuffers", P(gl::DeleteRenderbuffers)},
- {"glDeleteSamplers", P(gl::DeleteSamplers)},
- {"glDeleteShader", P(gl::DeleteShader)},
- {"glDeleteSync", P(gl::DeleteSync)},
- {"glDeleteTextures", P(gl::DeleteTextures)},
- {"glDeleteTransformFeedbacks", P(gl::DeleteTransformFeedbacks)},
- {"glDeleteVertexArrays", P(gl::DeleteVertexArrays)},
- {"glDeleteVertexArraysOES", P(gl::DeleteVertexArraysOES)},
- {"glDepthFunc", P(gl::DepthFunc)},
- {"glDepthMask", P(gl::DepthMask)},
- {"glDepthRangef", P(gl::DepthRangef)},
- {"glDetachShader", P(gl::DetachShader)},
- {"glDisable", P(gl::Disable)},
- {"glDisableVertexAttribArray", P(gl::DisableVertexAttribArray)},
- {"glDiscardFramebufferEXT", P(gl::DiscardFramebufferEXT)},
- {"glDispatchCompute", P(gl::DispatchCompute)},
- {"glDispatchComputeIndirect", P(gl::DispatchComputeIndirect)},
- {"glDrawArrays", P(gl::DrawArrays)},
- {"glDrawArraysIndirect", P(gl::DrawArraysIndirect)},
- {"glDrawArraysInstanced", P(gl::DrawArraysInstanced)},
- {"glDrawArraysInstancedANGLE", P(gl::DrawArraysInstancedANGLE)},
- {"glDrawBuffers", P(gl::DrawBuffers)},
- {"glDrawBuffersEXT", P(gl::DrawBuffersEXT)},
- {"glDrawElements", P(gl::DrawElements)},
- {"glDrawElementsIndirect", P(gl::DrawElementsIndirect)},
- {"glDrawElementsInstanced", P(gl::DrawElementsInstanced)},
- {"glDrawElementsInstancedANGLE", P(gl::DrawElementsInstancedANGLE)},
- {"glDrawRangeElements", P(gl::DrawRangeElements)},
- {"glEGLImageTargetRenderbufferStorageOES", P(gl::EGLImageTargetRenderbufferStorageOES)},
- {"glEGLImageTargetTexture2DOES", P(gl::EGLImageTargetTexture2DOES)},
- {"glEnable", P(gl::Enable)},
- {"glEnableVertexAttribArray", P(gl::EnableVertexAttribArray)},
- {"glEndQuery", P(gl::EndQuery)},
- {"glEndQueryEXT", P(gl::EndQueryEXT)},
- {"glEndTransformFeedback", P(gl::EndTransformFeedback)},
- {"glFenceSync", P(gl::FenceSync)},
- {"glFinish", P(gl::Finish)},
- {"glFinishFenceNV", P(gl::FinishFenceNV)},
- {"glFlush", P(gl::Flush)},
- {"glFlushMappedBufferRange", P(gl::FlushMappedBufferRange)},
- {"glFlushMappedBufferRangeEXT", P(gl::FlushMappedBufferRangeEXT)},
- {"glFramebufferParameteri", P(gl::FramebufferParameteri)},
- {"glFramebufferRenderbuffer", P(gl::FramebufferRenderbuffer)},
- {"glFramebufferTexture2D", P(gl::FramebufferTexture2D)},
- {"glFramebufferTextureLayer", P(gl::FramebufferTextureLayer)},
- {"glFramebufferTextureMultiviewLayeredANGLE", P(gl::FramebufferTextureMultiviewLayeredANGLE)},
- {"glFramebufferTextureMultiviewSideBySideANGLE",
- P(gl::FramebufferTextureMultiviewSideBySideANGLE)},
- {"glFrontFace", P(gl::FrontFace)},
- {"glGenBuffers", P(gl::GenBuffers)},
- {"glGenFencesNV", P(gl::GenFencesNV)},
- {"glGenFramebuffers", P(gl::GenFramebuffers)},
- {"glGenProgramPipelines", P(gl::GenProgramPipelines)},
- {"glGenQueries", P(gl::GenQueries)},
- {"glGenQueriesEXT", P(gl::GenQueriesEXT)},
- {"glGenRenderbuffers", P(gl::GenRenderbuffers)},
- {"glGenSamplers", P(gl::GenSamplers)},
- {"glGenTextures", P(gl::GenTextures)},
- {"glGenTransformFeedbacks", P(gl::GenTransformFeedbacks)},
- {"glGenVertexArrays", P(gl::GenVertexArrays)},
- {"glGenVertexArraysOES", P(gl::GenVertexArraysOES)},
- {"glGenerateMipmap", P(gl::GenerateMipmap)},
- {"glGetActiveAttrib", P(gl::GetActiveAttrib)},
- {"glGetActiveUniform", P(gl::GetActiveUniform)},
- {"glGetActiveUniformBlockName", P(gl::GetActiveUniformBlockName)},
- {"glGetActiveUniformBlockiv", P(gl::GetActiveUniformBlockiv)},
- {"glGetActiveUniformBlockivRobustANGLE", P(gl::GetActiveUniformBlockivRobustANGLE)},
- {"glGetActiveUniformsiv", P(gl::GetActiveUniformsiv)},
- {"glGetAttachedShaders", P(gl::GetAttachedShaders)},
- {"glGetAttribLocation", P(gl::GetAttribLocation)},
- {"glGetBooleani_v", P(gl::GetBooleani_v)},
- {"glGetBooleani_vRobustANGLE", P(gl::GetBooleani_vRobustANGLE)},
- {"glGetBooleanv", P(gl::GetBooleanv)},
- {"glGetBooleanvRobustANGLE", P(gl::GetBooleanvRobustANGLE)},
- {"glGetBufferParameteri64v", P(gl::GetBufferParameteri64v)},
- {"glGetBufferParameteri64vRobustANGLE", P(gl::GetBufferParameteri64vRobustANGLE)},
- {"glGetBufferParameteriv", P(gl::GetBufferParameteriv)},
- {"glGetBufferParameterivRobustANGLE", P(gl::GetBufferParameterivRobustANGLE)},
- {"glGetBufferPointerv", P(gl::GetBufferPointerv)},
- {"glGetBufferPointervOES", P(gl::GetBufferPointervOES)},
- {"glGetBufferPointervRobustANGLE", P(gl::GetBufferPointervRobustANGLE)},
- {"glGetDebugMessageLogKHR", P(gl::GetDebugMessageLogKHR)},
- {"glGetError", P(gl::GetError)},
- {"glGetFenceivNV", P(gl::GetFenceivNV)},
- {"glGetFloatv", P(gl::GetFloatv)},
- {"glGetFloatvRobustANGLE", P(gl::GetFloatvRobustANGLE)},
- {"glGetFragDataLocation", P(gl::GetFragDataLocation)},
- {"glGetFramebufferAttachmentParameteriv", P(gl::GetFramebufferAttachmentParameteriv)},
- {"glGetFramebufferAttachmentParameterivRobustANGLE",
- P(gl::GetFramebufferAttachmentParameterivRobustANGLE)},
- {"glGetFramebufferParameteriv", P(gl::GetFramebufferParameteriv)},
- {"glGetFramebufferParameterivRobustANGLE", P(gl::GetFramebufferParameterivRobustANGLE)},
- {"glGetGraphicsResetStatusEXT", P(gl::GetGraphicsResetStatusEXT)},
- {"glGetInteger64i_v", P(gl::GetInteger64i_v)},
- {"glGetInteger64i_vRobustANGLE", P(gl::GetInteger64i_vRobustANGLE)},
- {"glGetInteger64v", P(gl::GetInteger64v)},
- {"glGetInteger64vRobustANGLE", P(gl::GetInteger64vRobustANGLE)},
- {"glGetIntegeri_v", P(gl::GetIntegeri_v)},
- {"glGetIntegeri_vRobustANGLE", P(gl::GetIntegeri_vRobustANGLE)},
- {"glGetIntegerv", P(gl::GetIntegerv)},
- {"glGetIntegervRobustANGLE", P(gl::GetIntegervRobustANGLE)},
- {"glGetInternalformativ", P(gl::GetInternalformativ)},
- {"glGetInternalformativRobustANGLE", P(gl::GetInternalformativRobustANGLE)},
- {"glGetMultisamplefv", P(gl::GetMultisamplefv)},
- {"glGetMultisamplefvRobustANGLE", P(gl::GetMultisamplefvRobustANGLE)},
- {"glGetObjectLabelKHR", P(gl::GetObjectLabelKHR)},
- {"glGetObjectPtrLabelKHR", P(gl::GetObjectPtrLabelKHR)},
- {"glGetPointervKHR", P(gl::GetPointervKHR)},
- {"glGetPointervRobustANGLERobustANGLE", P(gl::GetPointervRobustANGLERobustANGLE)},
- {"glGetProgramBinary", P(gl::GetProgramBinary)},
- {"glGetProgramBinaryOES", P(gl::GetProgramBinaryOES)},
- {"glGetProgramInfoLog", P(gl::GetProgramInfoLog)},
- {"glGetProgramInterfaceiv", P(gl::GetProgramInterfaceiv)},
- {"glGetProgramInterfaceivRobustANGLE", P(gl::GetProgramInterfaceivRobustANGLE)},
- {"glGetProgramPipelineInfoLog", P(gl::GetProgramPipelineInfoLog)},
- {"glGetProgramPipelineiv", P(gl::GetProgramPipelineiv)},
- {"glGetProgramResourceIndex", P(gl::GetProgramResourceIndex)},
- {"glGetProgramResourceLocation", P(gl::GetProgramResourceLocation)},
- {"glGetProgramResourceName", P(gl::GetProgramResourceName)},
- {"glGetProgramResourceiv", P(gl::GetProgramResourceiv)},
- {"glGetProgramiv", P(gl::GetProgramiv)},
- {"glGetProgramivRobustANGLE", P(gl::GetProgramivRobustANGLE)},
- {"glGetQueryObjecti64vEXT", P(gl::GetQueryObjecti64vEXT)},
- {"glGetQueryObjecti64vRobustANGLE", P(gl::GetQueryObjecti64vRobustANGLE)},
- {"glGetQueryObjectivEXT", P(gl::GetQueryObjectivEXT)},
- {"glGetQueryObjectivRobustANGLE", P(gl::GetQueryObjectivRobustANGLE)},
- {"glGetQueryObjectui64vEXT", P(gl::GetQueryObjectui64vEXT)},
- {"glGetQueryObjectui64vRobustANGLE", P(gl::GetQueryObjectui64vRobustANGLE)},
- {"glGetQueryObjectuiv", P(gl::GetQueryObjectuiv)},
- {"glGetQueryObjectuivEXT", P(gl::GetQueryObjectuivEXT)},
- {"glGetQueryObjectuivRobustANGLE", P(gl::GetQueryObjectuivRobustANGLE)},
- {"glGetQueryiv", P(gl::GetQueryiv)},
- {"glGetQueryivEXT", P(gl::GetQueryivEXT)},
- {"glGetQueryivRobustANGLE", P(gl::GetQueryivRobustANGLE)},
- {"glGetRenderbufferParameteriv", P(gl::GetRenderbufferParameteriv)},
- {"glGetRenderbufferParameterivRobustANGLE", P(gl::GetRenderbufferParameterivRobustANGLE)},
- {"glGetSamplerParameterIivRobustANGLE", P(gl::GetSamplerParameterIivRobustANGLE)},
- {"glGetSamplerParameterIuivRobustANGLE", P(gl::GetSamplerParameterIuivRobustANGLE)},
- {"glGetSamplerParameterfv", P(gl::GetSamplerParameterfv)},
- {"glGetSamplerParameterfvRobustANGLE", P(gl::GetSamplerParameterfvRobustANGLE)},
- {"glGetSamplerParameteriv", P(gl::GetSamplerParameteriv)},
- {"glGetSamplerParameterivRobustANGLE", P(gl::GetSamplerParameterivRobustANGLE)},
- {"glGetShaderInfoLog", P(gl::GetShaderInfoLog)},
- {"glGetShaderPrecisionFormat", P(gl::GetShaderPrecisionFormat)},
- {"glGetShaderSource", P(gl::GetShaderSource)},
- {"glGetShaderiv", P(gl::GetShaderiv)},
- {"glGetShaderivRobustANGLE", P(gl::GetShaderivRobustANGLE)},
- {"glGetString", P(gl::GetString)},
- {"glGetStringi", P(gl::GetStringi)},
- {"glGetSynciv", P(gl::GetSynciv)},
- {"glGetTexLevelParameterfv", P(gl::GetTexLevelParameterfv)},
- {"glGetTexLevelParameterfvRobustANGLE", P(gl::GetTexLevelParameterfvRobustANGLE)},
- {"glGetTexLevelParameteriv", P(gl::GetTexLevelParameteriv)},
- {"glGetTexLevelParameterivRobustANGLE", P(gl::GetTexLevelParameterivRobustANGLE)},
- {"glGetTexParameterIivRobustANGLE", P(gl::GetTexParameterIivRobustANGLE)},
- {"glGetTexParameterIuivRobustANGLE", P(gl::GetTexParameterIuivRobustANGLE)},
- {"glGetTexParameterfv", P(gl::GetTexParameterfv)},
- {"glGetTexParameterfvRobustANGLE", P(gl::GetTexParameterfvRobustANGLE)},
- {"glGetTexParameteriv", P(gl::GetTexParameteriv)},
- {"glGetTexParameterivRobustANGLE", P(gl::GetTexParameterivRobustANGLE)},
- {"glGetTransformFeedbackVarying", P(gl::GetTransformFeedbackVarying)},
- {"glGetTranslatedShaderSourceANGLE", P(gl::GetTranslatedShaderSourceANGLE)},
- {"glGetUniformBlockIndex", P(gl::GetUniformBlockIndex)},
- {"glGetUniformIndices", P(gl::GetUniformIndices)},
- {"glGetUniformLocation", P(gl::GetUniformLocation)},
- {"glGetUniformfv", P(gl::GetUniformfv)},
- {"glGetUniformfvRobustANGLE", P(gl::GetUniformfvRobustANGLE)},
- {"glGetUniformiv", P(gl::GetUniformiv)},
- {"glGetUniformivRobustANGLE", P(gl::GetUniformivRobustANGLE)},
- {"glGetUniformuiv", P(gl::GetUniformuiv)},
- {"glGetUniformuivRobustANGLE", P(gl::GetUniformuivRobustANGLE)},
- {"glGetVertexAttribIiv", P(gl::GetVertexAttribIiv)},
- {"glGetVertexAttribIivRobustANGLE", P(gl::GetVertexAttribIivRobustANGLE)},
- {"glGetVertexAttribIuiv", P(gl::GetVertexAttribIuiv)},
- {"glGetVertexAttribIuivRobustANGLE", P(gl::GetVertexAttribIuivRobustANGLE)},
- {"glGetVertexAttribPointerv", P(gl::GetVertexAttribPointerv)},
- {"glGetVertexAttribPointervRobustANGLE", P(gl::GetVertexAttribPointervRobustANGLE)},
- {"glGetVertexAttribfv", P(gl::GetVertexAttribfv)},
- {"glGetVertexAttribfvRobustANGLE", P(gl::GetVertexAttribfvRobustANGLE)},
- {"glGetVertexAttribiv", P(gl::GetVertexAttribiv)},
- {"glGetVertexAttribivRobustANGLE", P(gl::GetVertexAttribivRobustANGLE)},
- {"glGetnUniformfvEXT", P(gl::GetnUniformfvEXT)},
- {"glGetnUniformfvRobustANGLE", P(gl::GetnUniformfvRobustANGLE)},
- {"glGetnUniformivEXT", P(gl::GetnUniformivEXT)},
- {"glGetnUniformivRobustANGLE", P(gl::GetnUniformivRobustANGLE)},
- {"glGetnUniformuivRobustANGLE", P(gl::GetnUniformuivRobustANGLE)},
- {"glHint", P(gl::Hint)},
- {"glInsertEventMarkerEXT", P(gl::InsertEventMarkerEXT)},
- {"glInvalidateFramebuffer", P(gl::InvalidateFramebuffer)},
- {"glInvalidateSubFramebuffer", P(gl::InvalidateSubFramebuffer)},
- {"glIsBuffer", P(gl::IsBuffer)},
- {"glIsEnabled", P(gl::IsEnabled)},
- {"glIsFenceNV", P(gl::IsFenceNV)},
- {"glIsFramebuffer", P(gl::IsFramebuffer)},
- {"glIsProgram", P(gl::IsProgram)},
- {"glIsProgramPipeline", P(gl::IsProgramPipeline)},
- {"glIsQuery", P(gl::IsQuery)},
- {"glIsQueryEXT", P(gl::IsQueryEXT)},
- {"glIsRenderbuffer", P(gl::IsRenderbuffer)},
- {"glIsSampler", P(gl::IsSampler)},
- {"glIsShader", P(gl::IsShader)},
- {"glIsSync", P(gl::IsSync)},
- {"glIsTexture", P(gl::IsTexture)},
- {"glIsTransformFeedback", P(gl::IsTransformFeedback)},
- {"glIsVertexArray", P(gl::IsVertexArray)},
- {"glIsVertexArrayOES", P(gl::IsVertexArrayOES)},
- {"glLineWidth", P(gl::LineWidth)},
- {"glLinkProgram", P(gl::LinkProgram)},
- {"glMapBufferOES", P(gl::MapBufferOES)},
- {"glMapBufferRange", P(gl::MapBufferRange)},
- {"glMapBufferRangeEXT", P(gl::MapBufferRangeEXT)},
- {"glMemoryBarrier", P(gl::MemoryBarrier)},
- {"glMemoryBarrierByRegion", P(gl::MemoryBarrierByRegion)},
- {"glObjectLabelKHR", P(gl::ObjectLabelKHR)},
- {"glObjectPtrLabelKHR", P(gl::ObjectPtrLabelKHR)},
- {"glPauseTransformFeedback", P(gl::PauseTransformFeedback)},
- {"glPixelStorei", P(gl::PixelStorei)},
- {"glPolygonOffset", P(gl::PolygonOffset)},
- {"glPopDebugGroupKHR", P(gl::PopDebugGroupKHR)},
- {"glPopGroupMarkerEXT", P(gl::PopGroupMarkerEXT)},
- {"glProgramBinary", P(gl::ProgramBinary)},
- {"glProgramBinaryOES", P(gl::ProgramBinaryOES)},
- {"glProgramParameteri", P(gl::ProgramParameteri)},
- {"glProgramUniform1f", P(gl::ProgramUniform1f)},
- {"glProgramUniform1fv", P(gl::ProgramUniform1fv)},
- {"glProgramUniform1i", P(gl::ProgramUniform1i)},
- {"glProgramUniform1iv", P(gl::ProgramUniform1iv)},
- {"glProgramUniform1ui", P(gl::ProgramUniform1ui)},
- {"glProgramUniform1uiv", P(gl::ProgramUniform1uiv)},
- {"glProgramUniform2f", P(gl::ProgramUniform2f)},
- {"glProgramUniform2fv", P(gl::ProgramUniform2fv)},
- {"glProgramUniform2i", P(gl::ProgramUniform2i)},
- {"glProgramUniform2iv", P(gl::ProgramUniform2iv)},
- {"glProgramUniform2ui", P(gl::ProgramUniform2ui)},
- {"glProgramUniform2uiv", P(gl::ProgramUniform2uiv)},
- {"glProgramUniform3f", P(gl::ProgramUniform3f)},
- {"glProgramUniform3fv", P(gl::ProgramUniform3fv)},
- {"glProgramUniform3i", P(gl::ProgramUniform3i)},
- {"glProgramUniform3iv", P(gl::ProgramUniform3iv)},
- {"glProgramUniform3ui", P(gl::ProgramUniform3ui)},
- {"glProgramUniform3uiv", P(gl::ProgramUniform3uiv)},
- {"glProgramUniform4f", P(gl::ProgramUniform4f)},
- {"glProgramUniform4fv", P(gl::ProgramUniform4fv)},
- {"glProgramUniform4i", P(gl::ProgramUniform4i)},
- {"glProgramUniform4iv", P(gl::ProgramUniform4iv)},
- {"glProgramUniform4ui", P(gl::ProgramUniform4ui)},
- {"glProgramUniform4uiv", P(gl::ProgramUniform4uiv)},
- {"glProgramUniformMatrix2fv", P(gl::ProgramUniformMatrix2fv)},
- {"glProgramUniformMatrix2x3fv", P(gl::ProgramUniformMatrix2x3fv)},
- {"glProgramUniformMatrix2x4fv", P(gl::ProgramUniformMatrix2x4fv)},
- {"glProgramUniformMatrix3fv", P(gl::ProgramUniformMatrix3fv)},
- {"glProgramUniformMatrix3x2fv", P(gl::ProgramUniformMatrix3x2fv)},
- {"glProgramUniformMatrix3x4fv", P(gl::ProgramUniformMatrix3x4fv)},
- {"glProgramUniformMatrix4fv", P(gl::ProgramUniformMatrix4fv)},
- {"glProgramUniformMatrix4x2fv", P(gl::ProgramUniformMatrix4x2fv)},
- {"glProgramUniformMatrix4x3fv", P(gl::ProgramUniformMatrix4x3fv)},
- {"glPushDebugGroupKHR", P(gl::PushDebugGroupKHR)},
- {"glPushGroupMarkerEXT", P(gl::PushGroupMarkerEXT)},
- {"glQueryCounterEXT", P(gl::QueryCounterEXT)},
- {"glReadBuffer", P(gl::ReadBuffer)},
- {"glReadPixels", P(gl::ReadPixels)},
- {"glReadPixelsRobustANGLE", P(gl::ReadPixelsRobustANGLE)},
- {"glReadnPixelsEXT", P(gl::ReadnPixelsEXT)},
- {"glReadnPixelsRobustANGLE", P(gl::ReadnPixelsRobustANGLE)},
- {"glReleaseShaderCompiler", P(gl::ReleaseShaderCompiler)},
- {"glRenderbufferStorage", P(gl::RenderbufferStorage)},
- {"glRenderbufferStorageMultisample", P(gl::RenderbufferStorageMultisample)},
- {"glRenderbufferStorageMultisampleANGLE", P(gl::RenderbufferStorageMultisampleANGLE)},
- {"glRequestExtensionANGLE", P(gl::RequestExtensionANGLE)},
- {"glResumeTransformFeedback", P(gl::ResumeTransformFeedback)},
- {"glSampleCoverage", P(gl::SampleCoverage)},
- {"glSampleMaski", P(gl::SampleMaski)},
- {"glSamplerParameterIivRobustANGLE", P(gl::SamplerParameterIivRobustANGLE)},
- {"glSamplerParameterIuivRobustANGLE", P(gl::SamplerParameterIuivRobustANGLE)},
- {"glSamplerParameterf", P(gl::SamplerParameterf)},
- {"glSamplerParameterfv", P(gl::SamplerParameterfv)},
- {"glSamplerParameterfvRobustANGLE", P(gl::SamplerParameterfvRobustANGLE)},
- {"glSamplerParameteri", P(gl::SamplerParameteri)},
- {"glSamplerParameteriv", P(gl::SamplerParameteriv)},
- {"glSamplerParameterivRobustANGLE", P(gl::SamplerParameterivRobustANGLE)},
- {"glScissor", P(gl::Scissor)},
- {"glSetFenceNV", P(gl::SetFenceNV)},
- {"glShaderBinary", P(gl::ShaderBinary)},
- {"glShaderSource", P(gl::ShaderSource)},
- {"glStencilFunc", P(gl::StencilFunc)},
- {"glStencilFuncSeparate", P(gl::StencilFuncSeparate)},
- {"glStencilMask", P(gl::StencilMask)},
- {"glStencilMaskSeparate", P(gl::StencilMaskSeparate)},
- {"glStencilOp", P(gl::StencilOp)},
- {"glStencilOpSeparate", P(gl::StencilOpSeparate)},
- {"glTestFenceNV", P(gl::TestFenceNV)},
- {"glTexImage2D", P(gl::TexImage2D)},
- {"glTexImage2DRobustANGLE", P(gl::TexImage2DRobustANGLE)},
- {"glTexImage3D", P(gl::TexImage3D)},
- {"glTexImage3DRobustANGLE", P(gl::TexImage3DRobustANGLE)},
- {"glTexParameterIivRobustANGLE", P(gl::TexParameterIivRobustANGLE)},
- {"glTexParameterIuivRobustANGLE", P(gl::TexParameterIuivRobustANGLE)},
- {"glTexParameterf", P(gl::TexParameterf)},
- {"glTexParameterfv", P(gl::TexParameterfv)},
- {"glTexParameterfvRobustANGLE", P(gl::TexParameterfvRobustANGLE)},
- {"glTexParameteri", P(gl::TexParameteri)},
- {"glTexParameteriv", P(gl::TexParameteriv)},
- {"glTexParameterivRobustANGLE", P(gl::TexParameterivRobustANGLE)},
- {"glTexStorage2D", P(gl::TexStorage2D)},
- {"glTexStorage2DEXT", P(gl::TexStorage2DEXT)},
- {"glTexStorage2DMultisample", P(gl::TexStorage2DMultisample)},
- {"glTexStorage3D", P(gl::TexStorage3D)},
- {"glTexSubImage2D", P(gl::TexSubImage2D)},
- {"glTexSubImage2DRobustANGLE", P(gl::TexSubImage2DRobustANGLE)},
- {"glTexSubImage3D", P(gl::TexSubImage3D)},
- {"glTexSubImage3DRobustANGLE", P(gl::TexSubImage3DRobustANGLE)},
- {"glTransformFeedbackVaryings", P(gl::TransformFeedbackVaryings)},
- {"glUniform1f", P(gl::Uniform1f)},
- {"glUniform1fv", P(gl::Uniform1fv)},
- {"glUniform1i", P(gl::Uniform1i)},
- {"glUniform1iv", P(gl::Uniform1iv)},
- {"glUniform1ui", P(gl::Uniform1ui)},
- {"glUniform1uiv", P(gl::Uniform1uiv)},
- {"glUniform2f", P(gl::Uniform2f)},
- {"glUniform2fv", P(gl::Uniform2fv)},
- {"glUniform2i", P(gl::Uniform2i)},
- {"glUniform2iv", P(gl::Uniform2iv)},
- {"glUniform2ui", P(gl::Uniform2ui)},
- {"glUniform2uiv", P(gl::Uniform2uiv)},
- {"glUniform3f", P(gl::Uniform3f)},
- {"glUniform3fv", P(gl::Uniform3fv)},
- {"glUniform3i", P(gl::Uniform3i)},
- {"glUniform3iv", P(gl::Uniform3iv)},
- {"glUniform3ui", P(gl::Uniform3ui)},
- {"glUniform3uiv", P(gl::Uniform3uiv)},
- {"glUniform4f", P(gl::Uniform4f)},
- {"glUniform4fv", P(gl::Uniform4fv)},
- {"glUniform4i", P(gl::Uniform4i)},
- {"glUniform4iv", P(gl::Uniform4iv)},
- {"glUniform4ui", P(gl::Uniform4ui)},
- {"glUniform4uiv", P(gl::Uniform4uiv)},
- {"glUniformBlockBinding", P(gl::UniformBlockBinding)},
- {"glUniformMatrix2fv", P(gl::UniformMatrix2fv)},
- {"glUniformMatrix2x3fv", P(gl::UniformMatrix2x3fv)},
- {"glUniformMatrix2x4fv", P(gl::UniformMatrix2x4fv)},
- {"glUniformMatrix3fv", P(gl::UniformMatrix3fv)},
- {"glUniformMatrix3x2fv", P(gl::UniformMatrix3x2fv)},
- {"glUniformMatrix3x4fv", P(gl::UniformMatrix3x4fv)},
- {"glUniformMatrix4fv", P(gl::UniformMatrix4fv)},
- {"glUniformMatrix4x2fv", P(gl::UniformMatrix4x2fv)},
- {"glUniformMatrix4x3fv", P(gl::UniformMatrix4x3fv)},
- {"glUnmapBuffer", P(gl::UnmapBuffer)},
- {"glUnmapBufferOES", P(gl::UnmapBufferOES)},
- {"glUseProgram", P(gl::UseProgram)},
- {"glUseProgramStages", P(gl::UseProgramStages)},
- {"glValidateProgram", P(gl::ValidateProgram)},
- {"glValidateProgramPipeline", P(gl::ValidateProgramPipeline)},
- {"glVertexAttrib1f", P(gl::VertexAttrib1f)},
- {"glVertexAttrib1fv", P(gl::VertexAttrib1fv)},
- {"glVertexAttrib2f", P(gl::VertexAttrib2f)},
- {"glVertexAttrib2fv", P(gl::VertexAttrib2fv)},
- {"glVertexAttrib3f", P(gl::VertexAttrib3f)},
- {"glVertexAttrib3fv", P(gl::VertexAttrib3fv)},
- {"glVertexAttrib4f", P(gl::VertexAttrib4f)},
- {"glVertexAttrib4fv", P(gl::VertexAttrib4fv)},
- {"glVertexAttribBinding", P(gl::VertexAttribBinding)},
- {"glVertexAttribDivisor", P(gl::VertexAttribDivisor)},
- {"glVertexAttribDivisorANGLE", P(gl::VertexAttribDivisorANGLE)},
- {"glVertexAttribFormat", P(gl::VertexAttribFormat)},
- {"glVertexAttribI4i", P(gl::VertexAttribI4i)},
- {"glVertexAttribI4iv", P(gl::VertexAttribI4iv)},
- {"glVertexAttribI4ui", P(gl::VertexAttribI4ui)},
- {"glVertexAttribI4uiv", P(gl::VertexAttribI4uiv)},
- {"glVertexAttribIFormat", P(gl::VertexAttribIFormat)},
- {"glVertexAttribIPointer", P(gl::VertexAttribIPointer)},
- {"glVertexAttribPointer", P(gl::VertexAttribPointer)},
- {"glVertexBindingDivisor", P(gl::VertexBindingDivisor)},
- {"glViewport", P(gl::Viewport)},
- {"glWaitSync", P(gl::WaitSync)}};
-
-size_t g_numProcs = 516;
-} // namespace egl
diff --git a/src/3rdparty/angle/src/libGLESv2/proc_table_data.json b/src/3rdparty/angle/src/libGLESv2/proc_table_data.json
deleted file mode 100644
index 5ce1d433a8..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/proc_table_data.json
+++ /dev/null
@@ -1,662 +0,0 @@
-{
- "GLES2 core": [
- "glActiveTexture",
- "glAttachShader",
- "glBindAttribLocation",
- "glBindBuffer",
- "glBindFramebuffer",
- "glBindRenderbuffer",
- "glBindTexture",
- "glBlendColor",
- "glBlendEquation",
- "glBlendEquationSeparate",
- "glBlendFunc",
- "glBlendFuncSeparate",
- "glBufferData",
- "glBufferSubData",
- "glCheckFramebufferStatus",
- "glClear",
- "glClearColor",
- "glClearDepthf",
- "glClearStencil",
- "glCompileShader",
- "glColorMask",
- "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",
- "glGenerateMipmap",
- "glGenFramebuffers",
- "glGenRenderbuffers",
- "glGenTextures",
- "glGetActiveAttrib",
- "glGetActiveUniform",
- "glGetAttachedShaders",
- "glGetAttribLocation",
- "glGetBooleanv",
- "glGetBufferParameteriv",
- "glGetError",
- "glGetFloatv",
- "glGetFramebufferAttachmentParameteriv",
- "glGetIntegerv",
- "glGetProgramiv",
- "glGetProgramInfoLog",
- "glGetRenderbufferParameteriv",
- "glGetShaderiv",
- "glGetShaderInfoLog",
- "glGetShaderPrecisionFormat",
- "glGetShaderSource",
- "glGetString",
- "glGetTexParameterfv",
- "glGetTexParameteriv",
- "glGetUniformfv",
- "glGetUniformiv",
- "glGetUniformLocation",
- "glGetVertexAttribfv",
- "glGetVertexAttribiv",
- "glGetVertexAttribPointerv",
- "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"
- ],
-
- "GL_ANGLE_framebuffer_blit": [
- "glBlitFramebufferANGLE"
- ],
-
- "GL_ANGLE_framebuffer_multisample": [
- "glRenderbufferStorageMultisampleANGLE"
- ],
-
- "GL_EXT_discard_framebuffer": [
- "glDiscardFramebufferEXT"
- ],
-
- "GL_NV_fence": [
- "glDeleteFencesNV",
- "glGenFencesNV",
- "glIsFenceNV",
- "glTestFenceNV",
- "glGetFenceivNV",
- "glFinishFenceNV",
- "glSetFenceNV"
- ],
-
- "GL_ANGLE_translated_shader_source": [
- "glGetTranslatedShaderSourceANGLE"
- ],
-
- "GL_EXT_texture_storage": [
- "glTexStorage2DEXT"
- ],
-
- "GL_EXT_robustness": [
- "glGetGraphicsResetStatusEXT",
- "glReadnPixelsEXT",
- "glGetnUniformfvEXT",
- "glGetnUniformivEXT"
- ],
-
- "GL_EXT_occlusion_query_boolean": [
- "glGenQueriesEXT",
- "glDeleteQueriesEXT",
- "glIsQueryEXT",
- "glBeginQueryEXT",
- "glEndQueryEXT",
- "glGetQueryivEXT",
- "glGetQueryObjectuivEXT"
- ],
-
- "GL_EXT_disjoint_timer_query": [
- "glGenQueriesEXT",
- "glDeleteQueriesEXT",
- "glIsQueryEXT",
- "glBeginQueryEXT",
- "glEndQueryEXT",
- "glQueryCounterEXT",
- "glGetQueryivEXT",
- "glGetQueryObjectivEXT",
- "glGetQueryObjectuivEXT",
- "glGetQueryObjecti64vEXT",
- "glGetQueryObjectui64vEXT"
- ],
-
- "GL_EXT_draw_buffers": [
- "glDrawBuffersEXT"
- ],
-
- "GL_ANGLE_instanced_arrays": [
- "glDrawArraysInstancedANGLE",
- "glDrawElementsInstancedANGLE",
- "glVertexAttribDivisorANGLE"
- ],
-
- "GL_OES_get_program_binary": [
- "glGetProgramBinaryOES",
- "glProgramBinaryOES"
- ],
-
- "GL_OES_mapbuffer": [
- "glMapBufferOES",
- "glUnmapBufferOES",
- "glGetBufferPointervOES"
- ],
-
- "GL_EXT_map_buffer_range": [
- "glMapBufferRangeEXT",
- "glFlushMappedBufferRangeEXT"
- ],
-
- "GL_EXT_debug_marker": [
- "glInsertEventMarkerEXT",
- "glPushGroupMarkerEXT",
- "glPopGroupMarkerEXT"
- ],
-
- "GL_OES_EGL_image": [
- "glEGLImageTargetTexture2DOES",
- "glEGLImageTargetRenderbufferStorageOES"
- ],
-
- "GL_OES_vertex_array_object": [
- "glBindVertexArrayOES",
- "glDeleteVertexArraysOES",
- "glGenVertexArraysOES",
- "glIsVertexArrayOES"
- ],
-
- "GL_KHR_debug": [
- "glDebugMessageControlKHR",
- "glDebugMessageInsertKHR",
- "glDebugMessageCallbackKHR",
- "glGetDebugMessageLogKHR",
- "glPushDebugGroupKHR",
- "glPopDebugGroupKHR",
- "glObjectLabelKHR",
- "glGetObjectLabelKHR",
- "glObjectPtrLabelKHR",
- "glGetObjectPtrLabelKHR",
- "glGetPointervKHR"
- ],
-
- "GL_CHROMIUM_bind_uniform_location": [
- "glBindUniformLocationCHROMIUM"
- ],
-
- "GL_CHROMIUM_copy_texture": [
- "glCopyTextureCHROMIUM",
- "glCopySubTextureCHROMIUM"
- ],
-
- "GL_CHROMIUM_copy_compressed_texture": [
- "glCompressedCopyTextureCHROMIUM"
- ],
-
- "GL_ANGLE_request_extension": [
- "glRequestExtensionANGLE"
- ],
-
- "GL_ANGLE_robust_client_memory": [
- "glGetBooleanvRobustANGLE",
- "glGetBufferParameterivRobustANGLE",
- "glGetFloatvRobustANGLE",
- "glGetFramebufferAttachmentParameterivRobustANGLE",
- "glGetIntegervRobustANGLE",
- "glGetProgramivRobustANGLE",
- "glGetRenderbufferParameterivRobustANGLE",
- "glGetShaderivRobustANGLE",
- "glGetTexParameterfvRobustANGLE",
- "glGetTexParameterivRobustANGLE",
- "glGetUniformfvRobustANGLE",
- "glGetUniformivRobustANGLE",
- "glGetVertexAttribfvRobustANGLE",
- "glGetVertexAttribivRobustANGLE",
- "glGetVertexAttribPointervRobustANGLE",
- "glReadPixelsRobustANGLE",
- "glTexImage2DRobustANGLE",
- "glTexParameterfvRobustANGLE",
- "glTexParameterivRobustANGLE",
- "glTexSubImage2DRobustANGLE",
- "glTexImage3DRobustANGLE",
- "glTexSubImage3DRobustANGLE",
- "glCompressedTexImage2DRobustANGLE",
- "glCompressedTexSubImage2DRobustANGLE",
- "glCompressedTexImage3DRobustANGLE",
- "glCompressedTexSubImage3DRobustANGLE",
- "glGetQueryivRobustANGLE",
- "glGetQueryObjectuivRobustANGLE",
- "glGetBufferPointervRobustANGLE",
- "glGetIntegeri_vRobustANGLE",
- "glGetInternalformativRobustANGLE",
- "glGetVertexAttribIivRobustANGLE",
- "glGetVertexAttribIuivRobustANGLE",
- "glGetUniformuivRobustANGLE",
- "glGetActiveUniformBlockivRobustANGLE",
- "glGetInteger64vRobustANGLE",
- "glGetInteger64i_vRobustANGLE",
- "glGetBufferParameteri64vRobustANGLE",
- "glSamplerParameterivRobustANGLE",
- "glSamplerParameterfvRobustANGLE",
- "glGetSamplerParameterivRobustANGLE",
- "glGetSamplerParameterfvRobustANGLE",
- "glGetFramebufferParameterivRobustANGLE",
- "glGetProgramInterfaceivRobustANGLE",
- "glGetBooleani_vRobustANGLE",
- "glGetMultisamplefvRobustANGLE",
- "glGetTexLevelParameterivRobustANGLE",
- "glGetTexLevelParameterfvRobustANGLE",
- "glGetPointervRobustANGLERobustANGLE",
- "glReadnPixelsRobustANGLE",
- "glGetnUniformfvRobustANGLE",
- "glGetnUniformivRobustANGLE",
- "glGetnUniformuivRobustANGLE",
- "glTexParameterIivRobustANGLE",
- "glTexParameterIuivRobustANGLE",
- "glGetTexParameterIivRobustANGLE",
- "glGetTexParameterIuivRobustANGLE",
- "glSamplerParameterIivRobustANGLE",
- "glSamplerParameterIuivRobustANGLE",
- "glGetSamplerParameterIivRobustANGLE",
- "glGetSamplerParameterIuivRobustANGLE",
- "glGetQueryObjectivRobustANGLE",
- "glGetQueryObjecti64vRobustANGLE",
- "glGetQueryObjectui64vRobustANGLE"
- ],
-
- "GL_ANGLE_multiview": [
- "glFramebufferTextureMultiviewLayeredANGLE",
- "glFramebufferTextureMultiviewSideBySideANGLE"
- ],
-
- "GLES3 core": [
- "glReadBuffer",
- "glDrawRangeElements",
- "glTexImage3D",
- "glTexSubImage3D",
- "glCopyTexSubImage3D",
- "glCompressedTexImage3D",
- "glCompressedTexSubImage3D",
- "glGenQueries",
- "glDeleteQueries",
- "glIsQuery",
- "glBeginQuery",
- "glEndQuery",
- "glGetQueryiv",
- "glGetQueryObjectuiv",
- "glUnmapBuffer",
- "glGetBufferPointerv",
- "glDrawBuffers",
- "glUniformMatrix2x3fv",
- "glUniformMatrix3x2fv",
- "glUniformMatrix2x4fv",
- "glUniformMatrix4x2fv",
- "glUniformMatrix3x4fv",
- "glUniformMatrix4x3fv",
- "glBlitFramebuffer",
- "glRenderbufferStorageMultisample",
- "glFramebufferTextureLayer",
- "glMapBufferRange",
- "glFlushMappedBufferRange",
- "glBindVertexArray",
- "glDeleteVertexArrays",
- "glGenVertexArrays",
- "glIsVertexArray",
- "glGetIntegeri_v",
- "glBeginTransformFeedback",
- "glEndTransformFeedback",
- "glBindBufferRange",
- "glBindBufferBase",
- "glTransformFeedbackVaryings",
- "glGetTransformFeedbackVarying",
- "glVertexAttribIPointer",
- "glGetVertexAttribIiv",
- "glGetVertexAttribIuiv",
- "glVertexAttribI4i",
- "glVertexAttribI4ui",
- "glVertexAttribI4iv",
- "glVertexAttribI4uiv",
- "glGetUniformuiv",
- "glGetFragDataLocation",
- "glUniform1ui",
- "glUniform2ui",
- "glUniform3ui",
- "glUniform4ui",
- "glUniform1uiv",
- "glUniform2uiv",
- "glUniform3uiv",
- "glUniform4uiv",
- "glClearBufferiv",
- "glClearBufferuiv",
- "glClearBufferfv",
- "glClearBufferfi",
- "glGetStringi",
- "glCopyBufferSubData",
- "glGetUniformIndices",
- "glGetActiveUniformsiv",
- "glGetUniformBlockIndex",
- "glGetActiveUniformBlockiv",
- "glGetActiveUniformBlockName",
- "glUniformBlockBinding",
- "glDrawArraysInstanced",
- "glDrawElementsInstanced",
- "glFenceSync",
- "glIsSync",
- "glDeleteSync",
- "glClientWaitSync",
- "glWaitSync",
- "glGetInteger64v",
- "glGetSynciv",
- "glGetInteger64i_v",
- "glGetBufferParameteri64v",
- "glGenSamplers",
- "glDeleteSamplers",
- "glIsSampler",
- "glBindSampler",
- "glSamplerParameteri",
- "glSamplerParameteriv",
- "glSamplerParameterf",
- "glSamplerParameterfv",
- "glGetSamplerParameteriv",
- "glGetSamplerParameterfv",
- "glVertexAttribDivisor",
- "glBindTransformFeedback",
- "glDeleteTransformFeedbacks",
- "glGenTransformFeedbacks",
- "glIsTransformFeedback",
- "glPauseTransformFeedback",
- "glResumeTransformFeedback",
- "glGetProgramBinary",
- "glProgramBinary",
- "glProgramParameteri",
- "glInvalidateFramebuffer",
- "glInvalidateSubFramebuffer",
- "glTexStorage2D",
- "glTexStorage3D",
- "glGetInternalformativ"
- ],
-
- "GLES31 core": [
- "glDispatchCompute",
- "glDispatchComputeIndirect",
- "glDrawArraysIndirect",
- "glDrawElementsIndirect",
- "glFramebufferParameteri",
- "glGetFramebufferParameteriv",
- "glGetProgramInterfaceiv",
- "glGetProgramResourceIndex",
- "glGetProgramResourceName",
- "glGetProgramResourceiv",
- "glGetProgramResourceLocation",
- "glUseProgramStages",
- "glActiveShaderProgram",
- "glCreateShaderProgramv",
- "glBindProgramPipeline",
- "glDeleteProgramPipelines",
- "glGenProgramPipelines",
- "glIsProgramPipeline",
- "glGetProgramPipelineiv",
- "glProgramUniform1i",
- "glProgramUniform2i",
- "glProgramUniform3i",
- "glProgramUniform4i",
- "glProgramUniform1ui",
- "glProgramUniform2ui",
- "glProgramUniform3ui",
- "glProgramUniform4ui",
- "glProgramUniform1f",
- "glProgramUniform2f",
- "glProgramUniform3f",
- "glProgramUniform4f",
- "glProgramUniform1iv",
- "glProgramUniform2iv",
- "glProgramUniform3iv",
- "glProgramUniform4iv",
- "glProgramUniform1uiv",
- "glProgramUniform2uiv",
- "glProgramUniform3uiv",
- "glProgramUniform4uiv",
- "glProgramUniform1fv",
- "glProgramUniform2fv",
- "glProgramUniform3fv",
- "glProgramUniform4fv",
- "glProgramUniformMatrix2fv",
- "glProgramUniformMatrix3fv",
- "glProgramUniformMatrix4fv",
- "glProgramUniformMatrix2x3fv",
- "glProgramUniformMatrix3x2fv",
- "glProgramUniformMatrix2x4fv",
- "glProgramUniformMatrix4x2fv",
- "glProgramUniformMatrix3x4fv",
- "glProgramUniformMatrix4x3fv",
- "glValidateProgramPipeline",
- "glGetProgramPipelineInfoLog",
- "glBindImageTexture",
- "glGetBooleani_v",
- "glMemoryBarrier",
- "glMemoryBarrierByRegion",
- "glTexStorage2DMultisample",
- "glGetMultisamplefv",
- "glSampleMaski",
- "glGetTexLevelParameteriv",
- "glGetTexLevelParameterfv",
- "glBindVertexBuffer",
- "glVertexAttribFormat",
- "glVertexAttribIFormat",
- "glVertexAttribBinding",
- "glVertexBindingDivisor"
- ],
-
- "EGL 1.0": [
- "eglChooseConfig",
- "eglCopyBuffers",
- "eglCreateContext",
- "eglCreatePbufferSurface",
- "eglCreatePixmapSurface",
- "eglCreateWindowSurface",
- "eglDestroyContext",
- "eglDestroySurface",
- "eglGetConfigAttrib",
- "eglGetConfigs",
- "eglGetCurrentDisplay",
- "eglGetCurrentSurface",
- "eglGetDisplay",
- "eglGetError",
- "eglGetProcAddress",
- "eglInitialize",
- "eglMakeCurrent",
- "eglQueryContext",
- "eglQueryString",
- "eglQuerySurface",
- "eglSwapBuffers",
- "eglTerminate",
- "eglWaitGL",
- "eglWaitNative"
- ],
-
- "EGL 1.1": [
- "eglBindTexImage",
- "eglReleaseTexImage",
- "eglSurfaceAttrib",
- "eglSwapInterval"
- ],
-
- "EGL 1.2": [
- "eglBindAPI",
- "eglQueryAPI",
- "eglCreatePbufferFromClientBuffer",
- "eglReleaseThread",
- "eglWaitClient"
- ],
-
- "EGL 1.4": [
- "eglGetCurrentContext"
- ],
-
- "EGL 1.5": [
- "eglCreateSync",
- "eglDestroySync",
- "eglClientWaitSync",
- "eglGetSyncAttrib",
- "eglCreateImage",
- "eglDestroyImage",
- "eglGetPlatformDisplay",
- "eglCreatePlatformWindowSurface",
- "eglCreatePlatformPixmapSurface",
- "eglWaitSync"
- ],
-
- "EGL_ANGLE_query_surface_pointer": [
- "eglQuerySurfacePointerANGLE"
- ],
-
- "EGL_NV_post_sub_buffer": [
- "eglPostSubBufferNV"
- ],
-
- "EGL_EXT_platform_base": [
- "eglGetPlatformDisplayEXT"
- ],
-
- "EGL_EXT_device_query": [
- "eglQueryDisplayAttribEXT",
- "eglQueryDeviceAttribEXT",
- "eglQueryDeviceStringEXT"
- ],
-
- "EGL_KHR_image_base/EGL_KHR_image": [
- "eglCreateImageKHR",
- "eglDestroyImageKHR"
- ],
-
- "EGL_EXT_device_creation": [
- "eglCreateDeviceANGLE",
- "eglReleaseDeviceANGLE"
- ],
-
- "EGL_KHR_stream": [
- "eglCreateStreamKHR",
- "eglDestroyStreamKHR",
- "eglStreamAttribKHR",
- "eglQueryStreamKHR",
- "eglQueryStreamu64KHR"
- ],
-
- "EGL_KHR_stream_consumer_gltexture": [
- "eglStreamConsumerGLTextureExternalKHR",
- "eglStreamConsumerAcquireKHR",
- "eglStreamConsumerReleaseKHR"
- ],
-
- "EGL_NV_stream_consumer_gltexture_yuv": [
- "eglStreamConsumerGLTextureExternalAttribsNV"
- ],
-
- "EGL_ANGLE_stream_producer_d3d_texture_nv12": [
- "eglCreateStreamProducerD3DTextureNV12ANGLE",
- "eglStreamPostD3DTextureNV12ANGLE"
- ],
-
- "EGL_CHROMIUM_get_sync_values": [
- "eglGetSyncValuesCHROMIUM"
- ],
-
- "EGL_EXT_swap_buffers_with_damage": [
- "eglSwapBuffersWithDamageEXT"
- ],
-
- "EGL_ANGLE_program_cache_control": [
- "eglProgramCacheGetAttribANGLE",
- "eglProgramCacheQueryANGLE",
- "eglProgramCachePopulateANGLE",
- "eglProgramCacheResizeANGLE"
- ],
-
- "angle::Platform related entry points": [
- "ANGLEGetDisplayPlatform",
- "ANGLEResetDisplayPlatform"
- ]
-}
diff --git a/src/3rdparty/angle/src/libGLESv2/resource.h b/src/3rdparty/angle/src/libGLESv2/resource.h
deleted file mode 100644
index 39adaad0dd..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/resource.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by libGLESv2.rc
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.cpp b/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.cpp
deleted file mode 100644
index 17e272301a..0000000000
--- a/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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/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/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h b/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h
deleted file mode 100644
index a4c407f760..0000000000
--- a/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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/src/3rdparty/angle/src/third_party/compiler/LICENSE b/src/3rdparty/angle/src/third_party/compiler/LICENSE
deleted file mode 100644
index c2cb2125e9..0000000000
--- a/src/3rdparty/angle/src/third_party/compiler/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-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.
diff --git a/src/3rdparty/angle/src/third_party/compiler/README.angle b/src/3rdparty/angle/src/third_party/compiler/README.angle
deleted file mode 100644
index 4fdf757ef4..0000000000
--- a/src/3rdparty/angle/src/third_party/compiler/README.angle
+++ /dev/null
@@ -1,12 +0,0 @@
-Name: ANGLE array bounds clamper from WebKit
-Short Name: WebKit
-URL: http://webkit.org
-Version: 0
-License: BSD
-Security Critical: yes
-
-Description:
-Implements clamping of array indexing expressions during shader translation.
-
-Local Modifications:
-None
diff --git a/src/3rdparty/angle/src/third_party/libXNVCtrl/LICENSE b/src/3rdparty/angle/src/third_party/libXNVCtrl/LICENSE
deleted file mode 100644
index 74324c0c6f..0000000000
--- a/src/3rdparty/angle/src/third_party/libXNVCtrl/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2008 NVIDIA, Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */ \ No newline at end of file
diff --git a/src/3rdparty/angle/src/third_party/libXNVCtrl/NVCtrl.c b/src/3rdparty/angle/src/third_party/libXNVCtrl/NVCtrl.c
deleted file mode 100644
index e984373947..0000000000
--- a/src/3rdparty/angle/src/third_party/libXNVCtrl/NVCtrl.c
+++ /dev/null
@@ -1,1240 +0,0 @@
-/*
- * Copyright (c) 2008 NVIDIA, Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Make sure that XTHREADS is defined, so that the
- * LockDisplay/UnlockDisplay macros are expanded properly and the
- * libXNVCtrl library properly protects the Display connection.
- */
-
-#if !defined(XTHREADS)
-#define XTHREADS
-#endif /* XTHREADS */
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <stdint.h>
-#include <stdlib.h>
-#include <X11/Xlibint.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include "NVCtrlLib.h"
-#include "nv_control.h"
-
-#define NVCTRL_EXT_EXISTS 1
-#define NVCTRL_EXT_NEED_TARGET_SWAP 2
-#define NVCTRL_EXT_64_BIT_ATTRIBUTES 4
-#define NVCTRL_EXT_NEED_CHECK (1 << (sizeof(XPointer) - 1))
-
-static XExtensionInfo _nvctrl_ext_info_data;
-static XExtensionInfo *nvctrl_ext_info = &_nvctrl_ext_info_data;
-static const char *nvctrl_extension_name = NV_CONTROL_NAME;
-
-#define XNVCTRLCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, nvctrl_extension_name, val)
-#define XNVCTRLSimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension (dpy, i, nvctrl_extension_name)
-
-static int close_display();
-static uintptr_t version_flags(Display *dpy, XExtDisplayInfo *info);
-static Bool wire_to_event();
-static /* const */ XExtensionHooks nvctrl_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- wire_to_event, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, nvctrl_ext_info,
- nvctrl_extension_name,
- &nvctrl_extension_hooks,
- NV_CONTROL_EVENTS,
- (XPointer)NVCTRL_EXT_NEED_CHECK)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, nvctrl_ext_info)
-
-/*
- * NV-CONTROL versions 1.8 and 1.9 pack the target_type and target_id
- * fields in reversed order. In order to talk to one of these servers,
- * we need to swap these fields.
- */
-
-static void XNVCTRLCheckTargetData(Display *dpy, XExtDisplayInfo *info,
- int *target_type, int *target_id)
-{
- uintptr_t flags = version_flags(dpy, info);
-
- /* We need to swap the target_type and target_id */
- if (flags & NVCTRL_EXT_NEED_TARGET_SWAP) {
- int tmp;
- tmp = *target_type;
- *target_type = *target_id;
- *target_id = tmp;
- }
-}
-
-
-Bool XNVCTRLQueryExtension (
- Display *dpy,
- int *event_basep,
- int *error_basep
-){
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- if (event_basep) *event_basep = info->codes->first_event;
- if (error_basep) *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-/*
- * Retrieve any cached flags that depend on the version of the NV-CONTROL
- * extension.
- */
-
-static uintptr_t version_flags(Display *dpy, XExtDisplayInfo *info)
-{
- uintptr_t data = (uintptr_t)info->data;
-
- /* If necessary, determine the NV-CONTROL version */
- if (data & NVCTRL_EXT_NEED_CHECK) {
- int major, minor;
- data = 0;
- if (XNVCTRLQueryVersion(dpy, &major, &minor)) {
- data |= NVCTRL_EXT_EXISTS;
- if (major == 1 && (minor == 8 || minor == 9)) {
- data |= NVCTRL_EXT_NEED_TARGET_SWAP;
- }
- if ((major > 1) || ((major == 1) && (minor > 20))) {
- data |= NVCTRL_EXT_64_BIT_ATTRIBUTES;
- }
- }
-
- info->data = (XPointer)data;
- }
-
- return data;
-}
-
-Bool XNVCTRLQueryVersion (
- Display *dpy,
- int *major,
- int *minor
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlQueryExtensionReply rep;
- xnvCtrlQueryExtensionReq *req;
-
- if(!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension (dpy, info, False);
-
- LockDisplay (dpy);
- GetReq (nvCtrlQueryExtension, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlQueryExtension;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- if (major) *major = rep.major;
- if (minor) *minor = rep.minor;
- UnlockDisplay (dpy);
- SyncHandle ();
- return True;
-}
-
-
-Bool XNVCTRLIsNvScreen (
- Display *dpy,
- int screen
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlIsNvReply rep;
- xnvCtrlIsNvReq *req;
- Bool isnv;
-
- if(!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension (dpy, info, False);
-
- LockDisplay (dpy);
- GetReq (nvCtrlIsNv, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlIsNv;
- req->screen = screen;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- isnv = rep.isnv;
- UnlockDisplay (dpy);
- SyncHandle ();
- return isnv;
-}
-
-
-Bool XNVCTRLQueryTargetCount (
- Display *dpy,
- int target_type,
- int *value
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlQueryTargetCountReply rep;
- xnvCtrlQueryTargetCountReq *req;
-
- if(!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension (dpy, info, False);
-
- LockDisplay (dpy);
- GetReq (nvCtrlQueryTargetCount, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlQueryTargetCount;
- req->target_type = target_type;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- if (value) *value = rep.count;
- UnlockDisplay (dpy);
- SyncHandle ();
- return True;
-}
-
-
-void XNVCTRLSetTargetAttribute (
- Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- int value
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlSetAttributeReq *req;
-
- XNVCTRLSimpleCheckExtension (dpy, info);
- XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id);
-
- LockDisplay (dpy);
- GetReq (nvCtrlSetAttribute, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlSetAttribute;
- req->target_type = target_type;
- req->target_id = target_id;
- req->display_mask = display_mask;
- req->attribute = attribute;
- req->value = value;
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-void XNVCTRLSetAttribute (
- Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- int value
-){
- XNVCTRLSetTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, screen,
- display_mask, attribute, value);
-}
-
-
-Bool XNVCTRLSetTargetAttributeAndGetStatus (
- Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- int value
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlSetAttributeAndGetStatusReq *req;
- xnvCtrlSetAttributeAndGetStatusReply rep;
- Bool success;
-
- if(!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension (dpy, info, False);
-
- LockDisplay (dpy);
- GetReq (nvCtrlSetAttributeAndGetStatus, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlSetAttributeAndGetStatus;
- req->target_type = target_type;
- req->target_id = target_id;
- req->display_mask = display_mask;
- req->attribute = attribute;
- req->value = value;
- if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
-
- success = rep.flags;
- return success;
-}
-
-Bool XNVCTRLSetAttributeAndGetStatus (
- Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- int value
-){
- return XNVCTRLSetTargetAttributeAndGetStatus(dpy,
- NV_CTRL_TARGET_TYPE_X_SCREEN,
- screen, display_mask,
- attribute, value);
-}
-
-
-Bool XNVCTRLQueryTargetAttribute (
- Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- int *value
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlQueryAttributeReply rep;
- xnvCtrlQueryAttributeReq *req;
- Bool exists;
-
- if(!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension (dpy, info, False);
- XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id);
-
- LockDisplay (dpy);
- GetReq (nvCtrlQueryAttribute, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlQueryAttribute;
- req->target_type = target_type;
- req->target_id = target_id;
- req->display_mask = display_mask;
- req->attribute = attribute;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- exists = rep.flags;
- if (exists && value) *value = rep.value;
- UnlockDisplay (dpy);
- SyncHandle ();
- return exists;
-}
-
-Bool XNVCTRLQueryAttribute (
- Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- int *value
-){
- return XNVCTRLQueryTargetAttribute(dpy, NV_CTRL_TARGET_TYPE_X_SCREEN,
- screen, display_mask, attribute, value);
-}
-
-
-Bool XNVCTRLQueryTargetAttribute64 (
- Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- int64_t *value
-){
- XExtDisplayInfo *info = find_display(dpy);
- xnvCtrlQueryAttribute64Reply rep;
- xnvCtrlQueryAttributeReq *req;
- Bool exists;
-
- if (!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension(dpy, info, False);
- XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id);
-
- LockDisplay(dpy);
- GetReq(nvCtrlQueryAttribute, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlQueryAttribute64;
- req->target_type = target_type;
- req->target_id = target_id;
- req->display_mask = display_mask;
- req->attribute = attribute;
- if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- exists = rep.flags;
- if (exists && value) *value = rep.value_64;
- UnlockDisplay(dpy);
- SyncHandle();
- return exists;
-}
-
-
-Bool XNVCTRLQueryTargetStringAttribute (
- Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- char **ptr
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlQueryStringAttributeReply rep;
- xnvCtrlQueryStringAttributeReq *req;
- Bool exists;
- int length, numbytes, slop;
-
- if (!ptr) return False;
-
- if(!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension (dpy, info, False);
- XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id);
-
- LockDisplay (dpy);
- GetReq (nvCtrlQueryStringAttribute, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlQueryStringAttribute;
- req->target_type = target_type;
- req->target_id = target_id;
- req->display_mask = display_mask;
- req->attribute = attribute;
- if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- length = rep.length;
- numbytes = rep.n;
- slop = numbytes & 3;
- exists = rep.flags;
- if (exists) {
- *ptr = (char *) Xmalloc(numbytes);
- }
- if (!exists || !*ptr) {
- _XEatData(dpy, length);
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- } else {
- _XRead(dpy, (char *) *ptr, numbytes);
- if (slop) _XEatData(dpy, 4-slop);
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- return exists;
-}
-
-Bool XNVCTRLQueryStringAttribute (
- Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- char **ptr
-){
- return XNVCTRLQueryTargetStringAttribute(dpy, NV_CTRL_TARGET_TYPE_X_SCREEN,
- screen, display_mask,
- attribute, ptr);
-}
-
-
-Bool XNVCTRLSetTargetStringAttribute (
- Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- char *ptr
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlSetStringAttributeReq *req;
- xnvCtrlSetStringAttributeReply rep;
- int size;
- Bool success;
-
- if(!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension (dpy, info, False);
-
- size = strlen(ptr)+1;
-
- LockDisplay (dpy);
- GetReq (nvCtrlSetStringAttribute, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlSetStringAttribute;
- req->target_type = target_type;
- req->target_id = target_id;
- req->display_mask = display_mask;
- req->attribute = attribute;
- req->length += ((size + 3) & ~3) >> 2;
- req->num_bytes = size;
- Data(dpy, ptr, size);
-
- if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
-
- success = rep.flags;
- return success;
-}
-
-Bool XNVCTRLSetStringAttribute (
- Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- char *ptr
-){
- return XNVCTRLSetTargetStringAttribute(dpy, NV_CTRL_TARGET_TYPE_X_SCREEN,
- screen, display_mask,
- attribute, ptr);
-}
-
-
-static Bool XNVCTRLQueryValidTargetAttributeValues32 (
- Display *dpy,
- XExtDisplayInfo *info,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- NVCTRLAttributeValidValuesRec *values
-){
- xnvCtrlQueryValidAttributeValuesReply rep;
- xnvCtrlQueryValidAttributeValuesReq *req;
- Bool exists;
-
- LockDisplay (dpy);
- GetReq (nvCtrlQueryValidAttributeValues, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlQueryValidAttributeValues;
- req->target_type = target_type;
- req->target_id = target_id;
- req->display_mask = display_mask;
- req->attribute = attribute;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- exists = rep.flags;
- if (exists) {
- values->type = rep.attr_type;
- if (rep.attr_type == ATTRIBUTE_TYPE_RANGE) {
- values->u.range.min = rep.min;
- values->u.range.max = rep.max;
- }
- if (rep.attr_type == ATTRIBUTE_TYPE_INT_BITS) {
- values->u.bits.ints = rep.bits;
- }
- values->permissions = rep.perms;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- return exists;
-}
-
-
-Bool XNVCTRLQueryValidTargetStringAttributeValues (
- Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- NVCTRLAttributeValidValuesRec *values
-){
- XExtDisplayInfo *info = find_display(dpy);
- Bool exists;
- xnvCtrlQueryValidAttributeValuesReply rep;
- xnvCtrlQueryValidAttributeValuesReq *req;
-
- if (!values) return False;
-
- if (!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq (nvCtrlQueryValidAttributeValues, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlQueryValidStringAttributeValues;
- req->target_type = target_type;
- req->target_id = target_id;
- req->display_mask = display_mask;
- req->attribute = attribute;
- if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- exists = rep.flags;
- if (exists) {
- values->type = rep.attr_type;
- values->permissions = rep.perms;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return exists;
-}
-
-
-static Bool XNVCTRLQueryValidTargetAttributeValues64 (
- Display *dpy,
- XExtDisplayInfo *info,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- NVCTRLAttributeValidValuesRec *values
-){
- xnvCtrlQueryValidAttributeValues64Reply rep;
- xnvCtrlQueryValidAttributeValuesReq *req;
- Bool exists;
-
- LockDisplay(dpy);
- GetReq(nvCtrlQueryValidAttributeValues, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlQueryValidAttributeValues64;
- req->target_type = target_type;
- req->target_id = target_id;
- req->display_mask = display_mask;
- req->attribute = attribute;
- if (!_XReply(dpy, (xReply *)&rep,
- sz_xnvCtrlQueryValidAttributeValues64Reply_extra,
- xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- exists = rep.flags;
- if (exists) {
- values->type = rep.attr_type;
- if (rep.attr_type == ATTRIBUTE_TYPE_RANGE) {
- values->u.range.min = rep.min_64;
- values->u.range.max = rep.max_64;
- }
- if (rep.attr_type == ATTRIBUTE_TYPE_INT_BITS) {
- values->u.bits.ints = rep.bits_64;
- }
- values->permissions = rep.perms;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return exists;
-}
-
-Bool XNVCTRLQueryValidTargetAttributeValues (
- Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- NVCTRLAttributeValidValuesRec *values
-){
- XExtDisplayInfo *info = find_display(dpy);
- Bool exists;
- uintptr_t flags;
-
- if (!values) return False;
-
- if (!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension(dpy, info, False);
- XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id);
-
- flags = version_flags(dpy,info);
-
- if (!(flags & NVCTRL_EXT_EXISTS))
- return False;
-
- if (flags & NVCTRL_EXT_64_BIT_ATTRIBUTES) {
- exists = XNVCTRLQueryValidTargetAttributeValues64(dpy, info,
- target_type,
- target_id,
- display_mask,
- attribute,
- values);
- } else {
- exists = XNVCTRLQueryValidTargetAttributeValues32(dpy, info,
- target_type,
- target_id,
- display_mask,
- attribute,
- values);
- }
- return exists;
-}
-
-
-Bool XNVCTRLQueryValidAttributeValues (
- Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- NVCTRLAttributeValidValuesRec *values
-){
- return XNVCTRLQueryValidTargetAttributeValues(dpy,
- NV_CTRL_TARGET_TYPE_X_SCREEN,
- screen, display_mask,
- attribute, values);
-}
-
-
-static Bool QueryAttributePermissionsInternal (
- Display *dpy,
- unsigned int attribute,
- NVCTRLAttributePermissionsRec *permissions,
- unsigned int reqType
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlQueryAttributePermissionsReply rep;
- xnvCtrlQueryAttributePermissionsReq *req;
- Bool exists;
-
- if(!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(nvCtrlQueryAttributePermissions, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = reqType;
- req->attribute = attribute;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle();
- return False;
- }
- exists = rep.flags;
- if (exists && permissions) {
- permissions->type = rep.attr_type;
- permissions->permissions = rep.perms;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return exists;
-}
-
-
-Bool XNVCTRLQueryAttributePermissions (
- Display *dpy,
- unsigned int attribute,
- NVCTRLAttributePermissionsRec *permissions
-){
- return QueryAttributePermissionsInternal(dpy,
- attribute,
- permissions,
- X_nvCtrlQueryAttributePermissions);
-}
-
-
-Bool XNVCTRLQueryStringAttributePermissions (
- Display *dpy,
- unsigned int attribute,
- NVCTRLAttributePermissionsRec *permissions
-){
- return QueryAttributePermissionsInternal(dpy,
- attribute,
- permissions,
- X_nvCtrlQueryStringAttributePermissions);
-}
-
-
-Bool XNVCTRLQueryBinaryDataAttributePermissions (
- Display *dpy,
- unsigned int attribute,
- NVCTRLAttributePermissionsRec *permissions
-){
- return QueryAttributePermissionsInternal(dpy,
- attribute,
- permissions,
- X_nvCtrlQueryBinaryDataAttributePermissions);
-}
-
-
-Bool XNVCTRLQueryStringOperationAttributePermissions (
- Display *dpy,
- unsigned int attribute,
- NVCTRLAttributePermissionsRec *permissions
-){
- return QueryAttributePermissionsInternal(dpy,
- attribute,
- permissions,
- X_nvCtrlQueryStringOperationAttributePermissions);
-}
-
-
-void XNVCTRLSetGvoColorConversion (
- Display *dpy,
- int screen,
- float colorMatrix[3][3],
- float colorOffset[3],
- float colorScale[3]
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlSetGvoColorConversionReq *req;
-
- XNVCTRLSimpleCheckExtension (dpy, info);
-
- LockDisplay (dpy);
- GetReq (nvCtrlSetGvoColorConversion, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlSetGvoColorConversion;
- req->screen = screen;
-
- req->cscMatrix_y_r = colorMatrix[0][0];
- req->cscMatrix_y_g = colorMatrix[0][1];
- req->cscMatrix_y_b = colorMatrix[0][2];
-
- req->cscMatrix_cr_r = colorMatrix[1][0];
- req->cscMatrix_cr_g = colorMatrix[1][1];
- req->cscMatrix_cr_b = colorMatrix[1][2];
-
- req->cscMatrix_cb_r = colorMatrix[2][0];
- req->cscMatrix_cb_g = colorMatrix[2][1];
- req->cscMatrix_cb_b = colorMatrix[2][2];
-
- req->cscOffset_y = colorOffset[0];
- req->cscOffset_cr = colorOffset[1];
- req->cscOffset_cb = colorOffset[2];
-
- req->cscScale_y = colorScale[0];
- req->cscScale_cr = colorScale[1];
- req->cscScale_cb = colorScale[2];
-
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-
-Bool XNVCTRLQueryGvoColorConversion (
- Display *dpy,
- int screen,
- float colorMatrix[3][3],
- float colorOffset[3],
- float colorScale[3]
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlQueryGvoColorConversionReply rep;
- xnvCtrlQueryGvoColorConversionReq *req;
-
- if(!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension (dpy, info, False);
-
- LockDisplay (dpy);
-
- GetReq (nvCtrlQueryGvoColorConversion, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlQueryGvoColorConversion;
- req->screen = screen;
-
- if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
-
- _XRead(dpy, (char *)(colorMatrix), 36);
- _XRead(dpy, (char *)(colorOffset), 12);
- _XRead(dpy, (char *)(colorScale), 12);
-
- UnlockDisplay (dpy);
- SyncHandle ();
-
- return True;
-}
-
-
-Bool XNVCtrlSelectTargetNotify (
- Display *dpy,
- int target_type,
- int target_id,
- int notify_type,
- Bool onoff
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlSelectTargetNotifyReq *req;
-
- if(!XextHasExtension (info))
- return False;
-
- XNVCTRLCheckExtension (dpy, info, False);
-
- LockDisplay (dpy);
- GetReq (nvCtrlSelectTargetNotify, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlSelectTargetNotify;
- req->target_type = target_type;
- req->target_id = target_id;
- req->notifyType = notify_type;
- req->onoff = onoff;
- UnlockDisplay (dpy);
- SyncHandle ();
-
- return True;
-}
-
-
-Bool XNVCtrlSelectNotify (
- Display *dpy,
- int screen,
- int type,
- Bool onoff
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlSelectNotifyReq *req;
-
- if(!XextHasExtension (info))
- return False;
-
- XNVCTRLCheckExtension (dpy, info, False);
-
- LockDisplay (dpy);
- GetReq (nvCtrlSelectNotify, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlSelectNotify;
- req->screen = screen;
- req->notifyType = type;
- req->onoff = onoff;
- UnlockDisplay (dpy);
- SyncHandle ();
-
- return True;
-}
-
-Bool XNVCTRLQueryTargetBinaryData (
- Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- unsigned char **ptr,
- int *len
-){
- XExtDisplayInfo *info = find_display (dpy);
- xnvCtrlQueryBinaryDataReply rep;
- xnvCtrlQueryBinaryDataReq *req;
- Bool exists;
- int length, numbytes, slop;
-
- if (!ptr) return False;
-
- if(!XextHasExtension(info))
- return False;
-
- XNVCTRLCheckExtension (dpy, info, False);
- XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id);
-
- LockDisplay (dpy);
- GetReq (nvCtrlQueryBinaryData, req);
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlQueryBinaryData;
- req->target_type = target_type;
- req->target_id = target_id;
- req->display_mask = display_mask;
- req->attribute = attribute;
- if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- length = rep.length;
- numbytes = rep.n;
- slop = numbytes & 3;
- exists = rep.flags;
- if (exists) {
- *ptr = (unsigned char *) Xmalloc(numbytes);
- }
- if (!exists || !*ptr) {
- _XEatData(dpy, length);
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- } else {
- _XRead(dpy, (char *) *ptr, numbytes);
- if (slop) _XEatData(dpy, 4-slop);
- }
- if (len) *len = numbytes;
- UnlockDisplay (dpy);
- SyncHandle ();
- return exists;
-}
-
-Bool XNVCTRLQueryBinaryData (
- Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- unsigned char **ptr,
- int *len
-){
- return XNVCTRLQueryTargetBinaryData(dpy, NV_CTRL_TARGET_TYPE_X_SCREEN,
- screen, display_mask,
- attribute, ptr, len);
-}
-
-Bool XNVCTRLStringOperation (
- Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- char *pIn,
- char **ppOut
-) {
- XExtDisplayInfo *info = find_display(dpy);
- xnvCtrlStringOperationReq *req;
- xnvCtrlStringOperationReply rep;
- Bool ret;
- int inSize, outSize, length, slop;
-
- if (!XextHasExtension(info))
- return False;
-
- if (!ppOut)
- return False;
-
- *ppOut = NULL;
-
- XNVCTRLCheckExtension(dpy, info, False);
- XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id);
-
- if (pIn) {
- inSize = strlen(pIn) + 1;
- } else {
- inSize = 0;
- }
-
- LockDisplay(dpy);
- GetReq(nvCtrlStringOperation, req);
-
- req->reqType = info->codes->major_opcode;
- req->nvReqType = X_nvCtrlStringOperation;
- req->target_type = target_type;
- req->target_id = target_id;
- req->display_mask = display_mask;
- req->attribute = attribute;
-
- req->length += ((inSize + 3) & ~3) >> 2;
- req->num_bytes = inSize;
-
- if (pIn) {
- Data(dpy, pIn, inSize);
- }
-
- if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- length = rep.length;
- outSize = rep.num_bytes;
- slop = outSize & 3;
-
- if (outSize) *ppOut = (char *) Xmalloc(outSize);
-
- if (!*ppOut) {
- _XEatData(dpy, length);
- } else {
- _XRead(dpy, (char *) *ppOut, outSize);
- if (slop) _XEatData(dpy, 4-slop);
- }
-
- ret = rep.ret;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return ret;
-}
-
-
-static Bool wire_to_event (Display *dpy, XEvent *host, xEvent *wire)
-{
- XExtDisplayInfo *info = find_display (dpy);
- XNVCtrlEvent *re;
- xnvctrlEvent *event;
- XNVCtrlEventTarget *reTarget;
- xnvctrlEventTarget *eventTarget;
- XNVCtrlEventTargetAvailability *reTargetAvailability;
- XNVCtrlStringEventTarget *reTargetString;
- XNVCtrlBinaryEventTarget *reTargetBinary;
-
- XNVCTRLCheckExtension (dpy, info, False);
-
- switch ((wire->u.u.type & 0x7F) - info->codes->first_event) {
- case ATTRIBUTE_CHANGED_EVENT:
- re = (XNVCtrlEvent *) host;
- event = (xnvctrlEvent *) wire;
- re->attribute_changed.type = event->u.u.type & 0x7F;
- re->attribute_changed.serial =
- _XSetLastRequestRead(dpy, (xGenericReply*) event);
- re->attribute_changed.send_event = ((event->u.u.type & 0x80) != 0);
- re->attribute_changed.display = dpy;
- re->attribute_changed.time = event->u.attribute_changed.time;
- re->attribute_changed.screen = event->u.attribute_changed.screen;
- re->attribute_changed.display_mask =
- event->u.attribute_changed.display_mask;
- re->attribute_changed.attribute = event->u.attribute_changed.attribute;
- re->attribute_changed.value = event->u.attribute_changed.value;
- break;
- case TARGET_ATTRIBUTE_CHANGED_EVENT:
- reTarget = (XNVCtrlEventTarget *) host;
- eventTarget = (xnvctrlEventTarget *) wire;
- reTarget->attribute_changed.type = eventTarget->u.u.type & 0x7F;
- reTarget->attribute_changed.serial =
- _XSetLastRequestRead(dpy, (xGenericReply*) eventTarget);
- reTarget->attribute_changed.send_event =
- ((eventTarget->u.u.type & 0x80) != 0);
- reTarget->attribute_changed.display = dpy;
- reTarget->attribute_changed.time =
- eventTarget->u.attribute_changed.time;
- reTarget->attribute_changed.target_type =
- eventTarget->u.attribute_changed.target_type;
- reTarget->attribute_changed.target_id =
- eventTarget->u.attribute_changed.target_id;
- reTarget->attribute_changed.display_mask =
- eventTarget->u.attribute_changed.display_mask;
- reTarget->attribute_changed.attribute =
- eventTarget->u.attribute_changed.attribute;
- reTarget->attribute_changed.value =
- eventTarget->u.attribute_changed.value;
- break;
- case TARGET_ATTRIBUTE_AVAILABILITY_CHANGED_EVENT:
- reTargetAvailability = (XNVCtrlEventTargetAvailability *) host;
- eventTarget = (xnvctrlEventTarget *) wire;
- reTargetAvailability->attribute_changed.type =
- eventTarget->u.u.type & 0x7F;
- reTargetAvailability->attribute_changed.serial =
- _XSetLastRequestRead(dpy, (xGenericReply*) eventTarget);
- reTargetAvailability->attribute_changed.send_event =
- ((eventTarget->u.u.type & 0x80) != 0);
- reTargetAvailability->attribute_changed.display = dpy;
- reTargetAvailability->attribute_changed.time =
- eventTarget->u.availability_changed.time;
- reTargetAvailability->attribute_changed.target_type =
- eventTarget->u.availability_changed.target_type;
- reTargetAvailability->attribute_changed.target_id =
- eventTarget->u.availability_changed.target_id;
- reTargetAvailability->attribute_changed.display_mask =
- eventTarget->u.availability_changed.display_mask;
- reTargetAvailability->attribute_changed.attribute =
- eventTarget->u.availability_changed.attribute;
- reTargetAvailability->attribute_changed.availability =
- eventTarget->u.availability_changed.availability;
- reTargetAvailability->attribute_changed.value =
- eventTarget->u.availability_changed.value;
- break;
- case TARGET_STRING_ATTRIBUTE_CHANGED_EVENT:
- reTargetString = (XNVCtrlStringEventTarget *) host;
- eventTarget = (xnvctrlEventTarget *) wire;
- reTargetString->attribute_changed.type = eventTarget->u.u.type & 0x7F;
- reTargetString->attribute_changed.serial =
- _XSetLastRequestRead(dpy, (xGenericReply*) eventTarget);
- reTargetString->attribute_changed.send_event =
- ((eventTarget->u.u.type & 0x80) != 0);
- reTargetString->attribute_changed.display = dpy;
- reTargetString->attribute_changed.time =
- eventTarget->u.attribute_changed.time;
- reTargetString->attribute_changed.target_type =
- eventTarget->u.attribute_changed.target_type;
- reTargetString->attribute_changed.target_id =
- eventTarget->u.attribute_changed.target_id;
- reTargetString->attribute_changed.display_mask =
- eventTarget->u.attribute_changed.display_mask;
- reTargetString->attribute_changed.attribute =
- eventTarget->u.attribute_changed.attribute;
- break;
- case TARGET_BINARY_ATTRIBUTE_CHANGED_EVENT:
- reTargetBinary = (XNVCtrlBinaryEventTarget *) host;
- eventTarget = (xnvctrlEventTarget *) wire;
- reTargetBinary->attribute_changed.type = eventTarget->u.u.type & 0x7F;
- reTargetBinary->attribute_changed.serial =
- _XSetLastRequestRead(dpy, (xGenericReply*) eventTarget);
- reTargetBinary->attribute_changed.send_event =
- ((eventTarget->u.u.type & 0x80) != 0);
- reTargetBinary->attribute_changed.display = dpy;
- reTargetBinary->attribute_changed.time =
- eventTarget->u.attribute_changed.time;
- reTargetBinary->attribute_changed.target_type =
- eventTarget->u.attribute_changed.target_type;
- reTargetBinary->attribute_changed.target_id =
- eventTarget->u.attribute_changed.target_id;
- reTargetBinary->attribute_changed.display_mask =
- eventTarget->u.attribute_changed.display_mask;
- reTargetBinary->attribute_changed.attribute =
- eventTarget->u.attribute_changed.attribute;
- break;
-
- default:
- return False;
- }
-
- return True;
-}
-
diff --git a/src/3rdparty/angle/src/third_party/libXNVCtrl/NVCtrl.h b/src/3rdparty/angle/src/third_party/libXNVCtrl/NVCtrl.h
deleted file mode 100644
index 7bd7ab7a33..0000000000
--- a/src/3rdparty/angle/src/third_party/libXNVCtrl/NVCtrl.h
+++ /dev/null
@@ -1,4365 +0,0 @@
-/*
- * Copyright (c) 2010 NVIDIA, Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __NVCTRL_H
-#define __NVCTRL_H
-
-#include <stdint.h>
-
-/**************************************************************************/
-
-/*
- * Attribute Targets
- *
- * Targets define attribute groups. For example, some attributes are only
- * valid to set on a GPU, others are only valid when talking about an
- * X Screen. Target types are then what is used to identify the target
- * group of the attribute you wish to set/query.
- *
- * Here are the supported target types:
- */
-
-#define NV_CTRL_TARGET_TYPE_X_SCREEN 0
-#define NV_CTRL_TARGET_TYPE_GPU 1
-#define NV_CTRL_TARGET_TYPE_FRAMELOCK 2
-#define NV_CTRL_TARGET_TYPE_VCSC 3 /* Visual Computing System */
-#define NV_CTRL_TARGET_TYPE_GVI 4
-#define NV_CTRL_TARGET_TYPE_COOLER 5 /* e.g., fan */
-#define NV_CTRL_TARGET_TYPE_THERMAL_SENSOR 6
-#define NV_CTRL_TARGET_TYPE_3D_VISION_PRO_TRANSCEIVER 7
-#define NV_CTRL_TARGET_TYPE_DISPLAY 8
-
-/**************************************************************************/
-
-/*
- * Attributes
- *
- * Some attributes may only be read; some may require a display_mask
- * argument and others may be valid only for specific target types.
- * This information is encoded in the "permission" comment after each
- * attribute #define, and can be queried at run time with
- * XNVCTRLQueryValidAttributeValues() and/or
- * XNVCTRLQueryValidTargetAttributeValues()
- *
- * Key to Integer Attribute "Permissions":
- *
- * R: The attribute is readable (in general, all attributes will be
- * readable)
- *
- * W: The attribute is writable (attributes may not be writable for
- * various reasons: they represent static system information, they
- * can only be changed by changing an XF86Config option, etc).
- *
- * D: The attribute requires the display mask argument. The
- * attributes NV_CTRL_CONNECTED_DISPLAYS and NV_CTRL_ENABLED_DISPLAYS
- * will be a bitmask of what display devices are connected and what
- * display devices are enabled for use in X, respectively. Each bit
- * in the bitmask represents a display device; it is these bits which
- * should be used as the display_mask when dealing with attributes
- * designated with "D" below. For attributes that do not require the
- * display mask, the argument is ignored.
- *
- * Alternatively, NV-CONTROL versions 1.27 and greater allow these
- * attributes to be accessed via display target types, in which case
- * the display_mask is ignored.
- *
- * G: The attribute may be queried using an NV_CTRL_TARGET_TYPE_GPU
- * target type via XNVCTRLQueryTargetAttribute().
- *
- * F: The attribute may be queried using an NV_CTRL_TARGET_TYPE_FRAMELOCK
- * target type via XNVCTRLQueryTargetAttribute().
- *
- * X: When Xinerama is enabled, this attribute is kept consistent across
- * all Physical X Screens; assignment of this attribute will be
- * broadcast by the NVIDIA X Driver to all X Screens.
- *
- * V: The attribute may be queried using an NV_CTRL_TARGET_TYPE_VCSC
- * target type via XNVCTRLQueryTargetAttribute().
- *
- * I: The attribute may be queried using an NV_CTRL_TARGET_TYPE_GVI target type
- * via XNVCTRLQueryTargetAttribute().
- *
- * Q: The attribute is a 64-bit integer attribute; use the 64-bit versions
- * of the appropriate query interfaces.
- *
- * C: The attribute may be queried using an NV_CTRL_TARGET_TYPE_COOLER target
- * type via XNVCTRLQueryTargetAttribute().
- *
- * S: The attribute may be queried using an NV_CTRL_TARGET_TYPE_THERMAL_SENSOR
- * target type via XNVCTRLQueryTargetAttribute().
- *
- * T: The attribute may be queried using an
- * NV_CTRL_TARGET_TYPE_3D_VISION_PRO_TRANSCEIVER target type
- * via XNVCTRLQueryTargetAttribute().
- *
- * NOTE: Unless mentioned otherwise, all attributes may be queried using
- * an NV_CTRL_TARGET_TYPE_X_SCREEN target type via
- * XNVCTRLQueryTargetAttribute().
- */
-
-/**************************************************************************/
-
-/*
- * Integer attributes:
- *
- * Integer attributes can be queried through the XNVCTRLQueryAttribute() and
- * XNVCTRLQueryTargetAttribute() function calls.
- *
- * Integer attributes can be set through the XNVCTRLSetAttribute() and
- * XNVCTRLSetTargetAttribute() function calls.
- *
- * Unless otherwise noted, all integer attributes can be queried/set
- * using an NV_CTRL_TARGET_TYPE_X_SCREEN target. Attributes that cannot
- * take an NV_CTRL_TARGET_TYPE_X_SCREEN also cannot be queried/set through
- * XNVCTRLQueryAttribute()/XNVCTRLSetAttribute() (Since these assume
- * an X Screen target).
- */
-
-/*
- * NV_CTRL_FLATPANEL_SCALING - not supported
- */
-
-#define NV_CTRL_FLATPANEL_SCALING 2 /* RWDG */
-#define NV_CTRL_FLATPANEL_SCALING_DEFAULT 0
-#define NV_CTRL_FLATPANEL_SCALING_NATIVE 1
-#define NV_CTRL_FLATPANEL_SCALING_SCALED 2
-#define NV_CTRL_FLATPANEL_SCALING_CENTERED 3
-#define NV_CTRL_FLATPANEL_SCALING_ASPECT_SCALED 4
-
-/*
- * NV_CTRL_FLATPANEL_DITHERING is deprecated; NV_CTRL_DITHERING should
- * be used instead.
- */
-
-#define NV_CTRL_FLATPANEL_DITHERING 3 /* RWDG */
-#define NV_CTRL_FLATPANEL_DITHERING_DEFAULT 0
-#define NV_CTRL_FLATPANEL_DITHERING_ENABLED 1
-#define NV_CTRL_FLATPANEL_DITHERING_DISABLED 2
-
-/*
- * NV_CTRL_DITHERING - the requested dithering configuration;
- * possible values are:
- *
- * 0: auto (the driver will decide when to dither)
- * 1: enabled (the driver will always dither when possible)
- * 2: disabled (the driver will never dither)
- */
-
-#define NV_CTRL_DITHERING 3 /* RWDG */
-#define NV_CTRL_DITHERING_AUTO 0
-#define NV_CTRL_DITHERING_ENABLED 1
-#define NV_CTRL_DITHERING_DISABLED 2
-
-/*
- * NV_CTRL_DIGITAL_VIBRANCE - sets the digital vibrance level for the
- * specified display device.
- */
-
-#define NV_CTRL_DIGITAL_VIBRANCE 4 /* RWDG */
-
-/*
- * NV_CTRL_BUS_TYPE - returns the bus type through which the specified device
- * is connected to the computer.
- * When this attribute is queried on an X screen target, the bus type of the
- * GPU driving the X screen is returned.
- */
-
-#define NV_CTRL_BUS_TYPE 5 /* R--GI */
-#define NV_CTRL_BUS_TYPE_AGP 0
-#define NV_CTRL_BUS_TYPE_PCI 1
-#define NV_CTRL_BUS_TYPE_PCI_EXPRESS 2
-#define NV_CTRL_BUS_TYPE_INTEGRATED 3
-
-/*
- * NV_CTRL_VIDEO_RAM - returns the total amount of memory available
- * to the specified GPU (or the GPU driving the specified X
- * screen). Note: if the GPU supports TurboCache(TM), the value
- * reported may exceed the amount of video memory installed on the
- * GPU. The value reported for integrated GPUs may likewise exceed
- * the amount of dedicated system memory set aside by the system
- * BIOS for use by the integrated GPU.
- */
-
-#define NV_CTRL_VIDEO_RAM 6 /* R--G */
-
-/*
- * NV_CTRL_IRQ - returns the interrupt request line used by the specified
- * device.
- * When this attribute is queried on an X screen target, the IRQ of the GPU
- * driving the X screen is returned.
- */
-
-#define NV_CTRL_IRQ 7 /* R--GI */
-
-/*
- * NV_CTRL_OPERATING_SYSTEM - returns the operating system on which
- * the X server is running.
- */
-
-#define NV_CTRL_OPERATING_SYSTEM 8 /* R--G */
-#define NV_CTRL_OPERATING_SYSTEM_LINUX 0
-#define NV_CTRL_OPERATING_SYSTEM_FREEBSD 1
-#define NV_CTRL_OPERATING_SYSTEM_SUNOS 2
-
-/*
- * NV_CTRL_SYNC_TO_VBLANK - enables sync to vblank for OpenGL clients.
- * This setting is only applied to OpenGL clients that are started
- * after this setting is applied.
- */
-
-#define NV_CTRL_SYNC_TO_VBLANK 9 /* RW-X */
-#define NV_CTRL_SYNC_TO_VBLANK_OFF 0
-#define NV_CTRL_SYNC_TO_VBLANK_ON 1
-
-/*
- * NV_CTRL_LOG_ANISO - enables anisotropic filtering for OpenGL
- * clients; on some NVIDIA hardware, this can only be enabled or
- * disabled; on other hardware different levels of anisotropic
- * filtering can be specified. This setting is only applied to OpenGL
- * clients that are started after this setting is applied.
- */
-
-#define NV_CTRL_LOG_ANISO 10 /* RW-X */
-
-/*
- * NV_CTRL_FSAA_MODE - the FSAA setting for OpenGL clients; possible
- * FSAA modes:
- *
- * NV_CTRL_FSAA_MODE_2x "2x Bilinear Multisampling"
- * NV_CTRL_FSAA_MODE_2x_5t "2x Quincunx Multisampling"
- * NV_CTRL_FSAA_MODE_15x15 "1.5 x 1.5 Supersampling"
- * NV_CTRL_FSAA_MODE_2x2 "2 x 2 Supersampling"
- * NV_CTRL_FSAA_MODE_4x "4x Bilinear Multisampling"
- * NV_CTRL_FSAA_MODE_4x_9t "4x Gaussian Multisampling"
- * NV_CTRL_FSAA_MODE_8x "2x Bilinear Multisampling by 4x Supersampling"
- * NV_CTRL_FSAA_MODE_16x "4x Bilinear Multisampling by 4x Supersampling"
- * NV_CTRL_FSAA_MODE_8xS "4x Multisampling by 2x Supersampling"
- *
- * This setting is only applied to OpenGL clients that are started
- * after this setting is applied.
- */
-
-#define NV_CTRL_FSAA_MODE 11 /* RW-X */
-#define NV_CTRL_FSAA_MODE_NONE 0
-#define NV_CTRL_FSAA_MODE_2x 1
-#define NV_CTRL_FSAA_MODE_2x_5t 2
-#define NV_CTRL_FSAA_MODE_15x15 3
-#define NV_CTRL_FSAA_MODE_2x2 4
-#define NV_CTRL_FSAA_MODE_4x 5
-#define NV_CTRL_FSAA_MODE_4x_9t 6
-#define NV_CTRL_FSAA_MODE_8x 7
-#define NV_CTRL_FSAA_MODE_16x 8
-#define NV_CTRL_FSAA_MODE_8xS 9
-#define NV_CTRL_FSAA_MODE_8xQ 10
-#define NV_CTRL_FSAA_MODE_16xS 11
-#define NV_CTRL_FSAA_MODE_16xQ 12
-#define NV_CTRL_FSAA_MODE_32xS 13
-#define NV_CTRL_FSAA_MODE_32x 14
-#define NV_CTRL_FSAA_MODE_64xS 15
-#define NV_CTRL_FSAA_MODE_MAX NV_CTRL_FSAA_MODE_64xS
-
-/*
- * NV_CTRL_TEXTURE_SHARPEN - enables texture sharpening for OpenGL
- * clients. This setting is only applied to OpenGL clients that are
- * started after this setting is applied.
- */
-
-#define NV_CTRL_TEXTURE_SHARPEN 12 /* RW-X */
-#define NV_CTRL_TEXTURE_SHARPEN_OFF 0
-#define NV_CTRL_TEXTURE_SHARPEN_ON 1
-
-/*
- * NV_CTRL_UBB - returns whether UBB is enabled for the specified X
- * screen.
- */
-
-#define NV_CTRL_UBB 13 /* R-- */
-#define NV_CTRL_UBB_OFF 0
-#define NV_CTRL_UBB_ON 1
-
-/*
- * NV_CTRL_OVERLAY - returns whether the RGB overlay is enabled for
- * the specified X screen.
- */
-
-#define NV_CTRL_OVERLAY 14 /* R-- */
-#define NV_CTRL_OVERLAY_OFF 0
-#define NV_CTRL_OVERLAY_ON 1
-
-/*
- * NV_CTRL_STEREO - returns whether stereo (and what type) is enabled
- * for the specified X screen.
- */
-
-#define NV_CTRL_STEREO 16 /* R-- */
-#define NV_CTRL_STEREO_OFF 0
-#define NV_CTRL_STEREO_DDC 1
-#define NV_CTRL_STEREO_BLUELINE 2
-#define NV_CTRL_STEREO_DIN 3
-#define NV_CTRL_STEREO_PASSIVE_EYE_PER_DPY 4
-#define NV_CTRL_STEREO_VERTICAL_INTERLACED 5
-#define NV_CTRL_STEREO_COLOR_INTERLACED 6
-#define NV_CTRL_STEREO_HORIZONTAL_INTERLACED 7
-#define NV_CTRL_STEREO_CHECKERBOARD_PATTERN 8
-#define NV_CTRL_STEREO_INVERSE_CHECKERBOARD_PATTERN 9
-#define NV_CTRL_STEREO_3D_VISION 10
-#define NV_CTRL_STEREO_3D_VISION_PRO 11
-
-/*
- * NV_CTRL_EMULATE - controls OpenGL software emulation of future
- * NVIDIA GPUs.
- */
-
-#define NV_CTRL_EMULATE 17 /* RW- */
-#define NV_CTRL_EMULATE_NONE 0
-
-/*
- * NV_CTRL_TWINVIEW - returns whether TwinView is enabled for the
- * specified X screen.
- */
-
-#define NV_CTRL_TWINVIEW 18 /* R-- */
-#define NV_CTRL_TWINVIEW_NOT_ENABLED 0
-#define NV_CTRL_TWINVIEW_ENABLED 1
-
-/*
- * NV_CTRL_CONNECTED_DISPLAYS - returns a display mask indicating the last
- * cached state of the display devices connected to the GPU or GPU driving
- * the specified X screen.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_CONNECTED_DISPLAYS 19 /* R--G */
-
-/*
- * NV_CTRL_ENABLED_DISPLAYS - returns a display mask indicating what
- * display devices are enabled for use on the specified X screen or
- * GPU.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_ENABLED_DISPLAYS 20 /* R--G */
-
-/**************************************************************************/
-/*
- * Integer attributes specific to configuring Frame Lock on boards that
- * support it.
- */
-
-/*
- * NV_CTRL_FRAMELOCK - returns whether the underlying GPU supports
- * Frame Lock. All of the other frame lock attributes are only
- * applicable if NV_CTRL_FRAMELOCK is _SUPPORTED.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_FRAMELOCK 21 /* R--G */
-#define NV_CTRL_FRAMELOCK_NOT_SUPPORTED 0
-#define NV_CTRL_FRAMELOCK_SUPPORTED 1
-
-/*
- * NV_CTRL_FRAMELOCK_MASTER - get/set which display device to use
- * as the frame lock master for the entire sync group. Note that only
- * one node in the sync group should be configured as the master.
- *
- * This attribute can only be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU target. This attribute cannot be
- * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN.
- */
-
-#define NV_CTRL_FRAMELOCK_MASTER 22 /* RW-G */
-
-/* These are deprecated. NV_CTRL_FRAMELOCK_MASTER now takes and
- returns a display mask as value. */
-#define NV_CTRL_FRAMELOCK_MASTER_FALSE 0
-#define NV_CTRL_FRAMELOCK_MASTER_TRUE 1
-
-/*
- * NV_CTRL_FRAMELOCK_POLARITY - sync either to the rising edge of the
- * frame lock pulse, the falling edge of the frame lock pulse or both.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- */
-
-#define NV_CTRL_FRAMELOCK_POLARITY 23 /* RW-F */
-#define NV_CTRL_FRAMELOCK_POLARITY_RISING_EDGE 0x1
-#define NV_CTRL_FRAMELOCK_POLARITY_FALLING_EDGE 0x2
-#define NV_CTRL_FRAMELOCK_POLARITY_BOTH_EDGES 0x3
-
-/*
- * NV_CTRL_FRAMELOCK_SYNC_DELAY - delay between the frame lock pulse
- * and the GPU sync. This value must be multiplied by
- * NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION to determine the sync delay in
- * nanoseconds.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- *
- * USAGE NODE: NV_CTRL_FRAMELOCK_SYNC_DELAY_MAX and
- * NV_CTRL_FRAMELOCK_SYNC_DELAY_FACTOR are deprecated.
- * The Sync Delay _MAX and _FACTOR are different for different
- * GSync products and so, to be correct, the valid values for
- * NV_CTRL_FRAMELOCK_SYNC_DELAY must be queried to get the range
- * of acceptable sync delay values, and
- * NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION must be queried to
- * obtain the correct factor.
- */
-
-#define NV_CTRL_FRAMELOCK_SYNC_DELAY 24 /* RW-F */
-#define NV_CTRL_FRAMELOCK_SYNC_DELAY_MAX 2047 // deprecated
-#define NV_CTRL_FRAMELOCK_SYNC_DELAY_FACTOR 7.81 // deprecated
-
-/*
- * NV_CTRL_FRAMELOCK_SYNC_INTERVAL - how many house sync pulses
- * between the frame lock sync generation (0 == sync every house sync);
- * this only applies to the master when receiving house sync.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- */
-
-#define NV_CTRL_FRAMELOCK_SYNC_INTERVAL 25 /* RW-F */
-
-/*
- * NV_CTRL_FRAMELOCK_PORT0_STATUS - status of the rj45 port0.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- */
-
-#define NV_CTRL_FRAMELOCK_PORT0_STATUS 26 /* R--F */
-#define NV_CTRL_FRAMELOCK_PORT0_STATUS_INPUT 0
-#define NV_CTRL_FRAMELOCK_PORT0_STATUS_OUTPUT 1
-
-/*
- * NV_CTRL_FRAMELOCK_PORT1_STATUS - status of the rj45 port1.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- */
-
-#define NV_CTRL_FRAMELOCK_PORT1_STATUS 27 /* R--F */
-#define NV_CTRL_FRAMELOCK_PORT1_STATUS_INPUT 0
-#define NV_CTRL_FRAMELOCK_PORT1_STATUS_OUTPUT 1
-
-/*
- * NV_CTRL_FRAMELOCK_HOUSE_STATUS - returns whether or not the house
- * sync signal was detected on the BNC connector of the frame lock
- * board.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- */
-
-#define NV_CTRL_FRAMELOCK_HOUSE_STATUS 28 /* R--F */
-#define NV_CTRL_FRAMELOCK_HOUSE_STATUS_NOT_DETECTED 0
-#define NV_CTRL_FRAMELOCK_HOUSE_STATUS_DETECTED 1
-
-/*
- * NV_CTRL_FRAMELOCK_SYNC - enable/disable the syncing of display
- * devices to the frame lock pulse as specified by previous calls to
- * NV_CTRL_FRAMELOCK_MASTER and NV_CTRL_FRAMELOCK_SLAVES.
- *
- * This attribute can only be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU target. This attribute cannot be
- * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN.
- */
-
-#define NV_CTRL_FRAMELOCK_SYNC 29 /* RW-G */
-#define NV_CTRL_FRAMELOCK_SYNC_DISABLE 0
-#define NV_CTRL_FRAMELOCK_SYNC_ENABLE 1
-
-/*
- * NV_CTRL_FRAMELOCK_SYNC_READY - reports whether a frame lock
- * board is receiving sync (regardless of whether or not any display
- * devices are using the sync).
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- */
-
-#define NV_CTRL_FRAMELOCK_SYNC_READY 30 /* R--F */
-#define NV_CTRL_FRAMELOCK_SYNC_READY_FALSE 0
-#define NV_CTRL_FRAMELOCK_SYNC_READY_TRUE 1
-
-/*
- * NV_CTRL_FRAMELOCK_STEREO_SYNC - this indicates that the GPU stereo
- * signal is in sync with the frame lock stereo signal.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- */
-
-#define NV_CTRL_FRAMELOCK_STEREO_SYNC 31 /* R--G */
-#define NV_CTRL_FRAMELOCK_STEREO_SYNC_FALSE 0
-#define NV_CTRL_FRAMELOCK_STEREO_SYNC_TRUE 1
-
-/*
- * NV_CTRL_FRAMELOCK_TEST_SIGNAL - to test the connections in the sync
- * group, tell the master to enable a test signal, then query port[01]
- * status and sync_ready on all slaves. When done, tell the master to
- * disable the test signal. Test signal should only be manipulated
- * while NV_CTRL_FRAMELOCK_SYNC is enabled.
- *
- * The TEST_SIGNAL is also used to reset the Universal Frame Count (as
- * returned by the glXQueryFrameCountNV() function in the
- * GLX_NV_swap_group extension). Note: for best accuracy of the
- * Universal Frame Count, it is recommended to toggle the TEST_SIGNAL
- * on and off after enabling frame lock.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_FRAMELOCK_TEST_SIGNAL 32 /* RW-G */
-#define NV_CTRL_FRAMELOCK_TEST_SIGNAL_DISABLE 0
-#define NV_CTRL_FRAMELOCK_TEST_SIGNAL_ENABLE 1
-
-/*
- * NV_CTRL_FRAMELOCK_ETHERNET_DETECTED - The frame lock boards are
- * cabled together using regular cat5 cable, connecting to rj45 ports
- * on the backplane of the card. There is some concern that users may
- * think these are ethernet ports and connect them to a
- * router/hub/etc. The hardware can detect this and will shut off to
- * prevent damage (either to itself or to the router).
- * NV_CTRL_FRAMELOCK_ETHERNET_DETECTED may be called to find out if
- * ethernet is connected to one of the rj45 ports. An appropriate
- * error message should then be displayed. The _PORT0 and _PORT1
- * values may be or'ed together.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- */
-
-#define NV_CTRL_FRAMELOCK_ETHERNET_DETECTED 33 /* R--F */
-#define NV_CTRL_FRAMELOCK_ETHERNET_DETECTED_NONE 0
-#define NV_CTRL_FRAMELOCK_ETHERNET_DETECTED_PORT0 0x1
-#define NV_CTRL_FRAMELOCK_ETHERNET_DETECTED_PORT1 0x2
-
-/*
- * NV_CTRL_FRAMELOCK_VIDEO_MODE - get/set what video mode is used
- * to interperate the house sync signal. This should only be set
- * on the master.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- */
-
-#define NV_CTRL_FRAMELOCK_VIDEO_MODE 34 /* RW-F */
-#define NV_CTRL_FRAMELOCK_VIDEO_MODE_NONE 0
-#define NV_CTRL_FRAMELOCK_VIDEO_MODE_TTL 1
-#define NV_CTRL_FRAMELOCK_VIDEO_MODE_NTSCPALSECAM 2
-#define NV_CTRL_FRAMELOCK_VIDEO_MODE_HDTV 3
-
-/*
- * During FRAMELOCK bring-up, the above values were redefined to
- * these:
- */
-
-#define NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_AUTO 0
-#define NV_CTRL_FRAMELOCK_VIDEO_MODE_TTL 1
-#define NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_BI_LEVEL 2
-#define NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_TRI_LEVEL 3
-
-/*
- * NV_CTRL_FRAMELOCK_SYNC_RATE - this is the refresh rate that the
- * frame lock board is sending to the GPU, in milliHz.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- */
-
-#define NV_CTRL_FRAMELOCK_SYNC_RATE 35 /* R--F */
-
-/**************************************************************************/
-
-/*
- * NV_CTRL_FORCE_GENERIC_CPU - inhibit the use of CPU specific
- * features such as MMX, SSE, or 3DNOW! for OpenGL clients; this
- * option may result in performance loss, but may be useful in
- * conjunction with software such as the Valgrind memory debugger.
- * This setting is only applied to OpenGL clients that are started
- * after this setting is applied.
- *
- * USAGE NOTE: This attribute is deprecated. CPU compatibility is now
- * checked each time during initialization.
- */
-
-#define NV_CTRL_FORCE_GENERIC_CPU 37 /* RW-X */
-#define NV_CTRL_FORCE_GENERIC_CPU_DISABLE 0
-#define NV_CTRL_FORCE_GENERIC_CPU_ENABLE 1
-
-/*
- * NV_CTRL_OPENGL_AA_LINE_GAMMA - for OpenGL clients, allow
- * Gamma-corrected antialiased lines to consider variances in the
- * color display capabilities of output devices when rendering smooth
- * lines. Only available on recent Quadro GPUs. This setting is only
- * applied to OpenGL clients that are started after this setting is
- * applied.
- */
-
-#define NV_CTRL_OPENGL_AA_LINE_GAMMA 38 /* RW-X */
-#define NV_CTRL_OPENGL_AA_LINE_GAMMA_DISABLE 0
-#define NV_CTRL_OPENGL_AA_LINE_GAMMA_ENABLE 1
-
-/*
- * NV_CTRL_FRAMELOCK_TIMING - this is TRUE when the gpu is both receiving
- * and locked to an input timing signal. Timing information may come from
- * the following places: Another frame lock device that is set to master,
- * the house sync signal, or the GPU's internal timing from a display
- * device.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_FRAMELOCK_TIMING 39 /* R--G */
-#define NV_CTRL_FRAMELOCK_TIMING_FALSE 0
-#define NV_CTRL_FRAMELOCK_TIMING_TRUE 1
-
-/*
- * NV_CTRL_FLIPPING_ALLOWED - when TRUE, OpenGL will swap by flipping
- * when possible; when FALSE, OpenGL will alway swap by blitting.
- */
-
-#define NV_CTRL_FLIPPING_ALLOWED 40 /* RW-X */
-#define NV_CTRL_FLIPPING_ALLOWED_FALSE 0
-#define NV_CTRL_FLIPPING_ALLOWED_TRUE 1
-
-/*
- * NV_CTRL_ARCHITECTURE - returns the architecture on which the X server is
- * running.
- */
-
-#define NV_CTRL_ARCHITECTURE 41 /* R-- */
-#define NV_CTRL_ARCHITECTURE_X86 0
-#define NV_CTRL_ARCHITECTURE_X86_64 1
-#define NV_CTRL_ARCHITECTURE_IA64 2
-
-/*
- * NV_CTRL_TEXTURE_CLAMPING - texture clamping mode in OpenGL. By
- * default, _SPEC is used, which forces OpenGL texture clamping to
- * conform with the OpenGL specification. _EDGE forces NVIDIA's
- * OpenGL implementation to remap GL_CLAMP to GL_CLAMP_TO_EDGE,
- * which is not strictly conformant, but some applications rely on
- * the non-conformant behavior.
- */
-
-#define NV_CTRL_TEXTURE_CLAMPING 42 /* RW-X */
-#define NV_CTRL_TEXTURE_CLAMPING_EDGE 0
-#define NV_CTRL_TEXTURE_CLAMPING_SPEC 1
-
-#define NV_CTRL_CURSOR_SHADOW 43 /* RW- */
-#define NV_CTRL_CURSOR_SHADOW_DISABLE 0
-#define NV_CTRL_CURSOR_SHADOW_ENABLE 1
-
-#define NV_CTRL_CURSOR_SHADOW_ALPHA 44 /* RW- */
-#define NV_CTRL_CURSOR_SHADOW_RED 45 /* RW- */
-#define NV_CTRL_CURSOR_SHADOW_GREEN 46 /* RW- */
-#define NV_CTRL_CURSOR_SHADOW_BLUE 47 /* RW- */
-
-#define NV_CTRL_CURSOR_SHADOW_X_OFFSET 48 /* RW- */
-#define NV_CTRL_CURSOR_SHADOW_Y_OFFSET 49 /* RW- */
-
-/*
- * When Application Control for FSAA is enabled, then what the
- * application requests is used, and NV_CTRL_FSAA_MODE is ignored. If
- * this is disabled, then any application setting is overridden with
- * NV_CTRL_FSAA_MODE
- */
-
-#define NV_CTRL_FSAA_APPLICATION_CONTROLLED 50 /* RW-X */
-#define NV_CTRL_FSAA_APPLICATION_CONTROLLED_ENABLED 1
-#define NV_CTRL_FSAA_APPLICATION_CONTROLLED_DISABLED 0
-
-/*
- * When Application Control for LogAniso is enabled, then what the
- * application requests is used, and NV_CTRL_LOG_ANISO is ignored. If
- * this is disabled, then any application setting is overridden with
- * NV_CTRL_LOG_ANISO
- */
-
-#define NV_CTRL_LOG_ANISO_APPLICATION_CONTROLLED 51 /* RW-X */
-#define NV_CTRL_LOG_ANISO_APPLICATION_CONTROLLED_ENABLED 1
-#define NV_CTRL_LOG_ANISO_APPLICATION_CONTROLLED_DISABLED 0
-
-/*
- * IMAGE_SHARPENING adjusts the sharpness of the display's image
- * quality by amplifying high frequency content. Valid values will
- * normally be in the range [0,32). Only available on GeForceFX or
- * newer.
- */
-
-#define NV_CTRL_IMAGE_SHARPENING 52 /* RWDG */
-
-/*
- * NV_CTRL_TV_OVERSCAN adjusts the amount of overscan on the specified
- * display device.
- */
-
-#define NV_CTRL_TV_OVERSCAN 53 /* RWDG */
-
-/*
- * NV_CTRL_TV_FLICKER_FILTER adjusts the amount of flicker filter on
- * the specified display device.
- */
-
-#define NV_CTRL_TV_FLICKER_FILTER 54 /* RWDG */
-
-/*
- * NV_CTRL_TV_BRIGHTNESS adjusts the amount of brightness on the
- * specified display device.
- */
-
-#define NV_CTRL_TV_BRIGHTNESS 55 /* RWDG */
-
-/*
- * NV_CTRL_TV_HUE adjusts the amount of hue on the specified display
- * device.
- */
-
-#define NV_CTRL_TV_HUE 56 /* RWDG */
-
-/*
- * NV_CTRL_TV_CONTRAST adjusts the amount of contrast on the specified
- * display device.
- */
-
-#define NV_CTRL_TV_CONTRAST 57 /* RWDG */
-
-/*
- * NV_CTRL_TV_SATURATION adjusts the amount of saturation on the
- * specified display device.
- */
-
-#define NV_CTRL_TV_SATURATION 58 /* RWDG */
-
-/*
- * NV_CTRL_TV_RESET_SETTINGS - this write-only attribute can be used
- * to request that all TV Settings be reset to their default values;
- * typical usage would be that this attribute be sent, and then all
- * the TV attributes be queried to retrieve their new values.
- */
-
-#define NV_CTRL_TV_RESET_SETTINGS 59 /* -WDG */
-
-/*
- * NV_CTRL_GPU_CORE_TEMPERATURE reports the current core temperature
- * of the GPU driving the X screen.
- */
-
-#define NV_CTRL_GPU_CORE_TEMPERATURE 60 /* R--G */
-
-/*
- * NV_CTRL_GPU_CORE_THRESHOLD reports the current GPU core slowdown
- * threshold temperature, NV_CTRL_GPU_DEFAULT_CORE_THRESHOLD and
- * NV_CTRL_GPU_MAX_CORE_THRESHOLD report the default and MAX core
- * slowdown threshold temperatures.
- *
- * NV_CTRL_GPU_CORE_THRESHOLD reflects the temperature at which the
- * GPU is throttled to prevent overheating.
- */
-
-#define NV_CTRL_GPU_CORE_THRESHOLD 61 /* R--G */
-#define NV_CTRL_GPU_DEFAULT_CORE_THRESHOLD 62 /* R--G */
-#define NV_CTRL_GPU_MAX_CORE_THRESHOLD 63 /* R--G */
-
-/*
- * NV_CTRL_AMBIENT_TEMPERATURE reports the current temperature in the
- * immediate neighbourhood of the GPU driving the X screen.
- */
-
-#define NV_CTRL_AMBIENT_TEMPERATURE 64 /* R--G */
-
-/*
- * NV_CTRL_PBUFFER_SCANOUT_SUPPORTED - returns whether this X screen
- * supports scanout of FP pbuffers;
- *
- * if this screen does not support PBUFFER_SCANOUT, then all other
- * PBUFFER_SCANOUT attributes are unavailable.
- *
- * PBUFFER_SCANOUT is supported if and only if:
- * - Twinview is configured with clone mode. The secondary screen is used to
- * scanout the pbuffer.
- * - The desktop is running in with 16 bits per pixel.
- */
-#define NV_CTRL_PBUFFER_SCANOUT_SUPPORTED 65 /* R-- */
-#define NV_CTRL_PBUFFER_SCANOUT_FALSE 0
-#define NV_CTRL_PBUFFER_SCANOUT_TRUE 1
-
-/*
- * NV_CTRL_PBUFFER_SCANOUT_XID indicates the XID of the pbuffer used for
- * scanout.
- */
-#define NV_CTRL_PBUFFER_SCANOUT_XID 66 /* RW- */
-
-/**************************************************************************/
-/*
- * The NV_CTRL_GVO_* integer attributes are used to configure GVO
- * (Graphics to Video Out). This functionality is available, for
- * example, on the Quadro FX 4000 SDI graphics board.
- *
- * The following is a typical usage pattern for the GVO attributes:
- *
- * - query NV_CTRL_GVO_SUPPORTED to determine if the X screen supports GV0.
- *
- * - specify NV_CTRL_GVO_SYNC_MODE (one of FREE_RUNNING, GENLOCK, or
- * FRAMELOCK); if you specify GENLOCK or FRAMELOCK, you should also
- * specify NV_CTRL_GVO_SYNC_SOURCE.
- *
- * - Use NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED and
- * NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED to detect what input syncs are
- * present.
- *
- * (If no analog sync is detected but it is known that a valid
- * bi-level or tri-level sync is connected set
- * NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE appropriately and
- * retest with NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED).
- *
- * - if syncing to input sync, query the
- * NV_CTRL_GVIO_DETECTED_VIDEO_FORMAT attribute; note that Input video
- * format can only be queried after SYNC_SOURCE is specified.
- *
- * - specify the NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT
- *
- * - specify the NV_CTRL_GVO_DATA_FORMAT
- *
- * - specify any custom Color Space Conversion (CSC) matrix, offset,
- * and scale with XNVCTRLSetGvoColorConversion().
- *
- * - if using the GLX_NV_video_out extension to display one or more
- * pbuffers, call glXGetVideoDeviceNV() to lock the GVO output for use
- * by the GLX client; then bind the pbuffer(s) to the GVO output with
- * glXBindVideoImageNV() and send pbuffers to the GVO output with
- * glXSendPbufferToVideoNV(); see the GLX_NV_video_out spec for more
- * details.
- *
- * - if using the GLX_NV_present_video extension, call
- * glXBindVideoDeviceNV() to bind the GVO video device to current
- * OpenGL context.
- *
- * Note that setting most GVO attributes only causes the value to be
- * cached in the X server. The values will be flushed to the hardware
- * either when the next MetaMode is set that uses the GVO display
- * device, or when a GLX pbuffer is bound to the GVO output (with
- * glXBindVideoImageNV()).
- *
- * Note that GLX_NV_video_out/GLX_NV_present_video and X screen use
- * are mutually exclusive. If a MetaMode is currently using the GVO
- * device, then glXGetVideoDeviceNV and glXBindVideoImageNV() will
- * fail. Similarly, if a GLX client has locked the GVO output (via
- * glXGetVideoDeviceNV or glXBindVideoImageNV), then setting a
- * MetaMode that uses the GVO device will fail. The
- * NV_CTRL_GVO_GLX_LOCKED event will be sent when a GLX client locks
- * the GVO output.
- *
- */
-
-/*
- * NV_CTRL_GVO_SUPPORTED - returns whether this X screen supports GVO;
- * if this screen does not support GVO output, then all other GVO
- * attributes are unavailable.
- */
-
-#define NV_CTRL_GVO_SUPPORTED 67 /* R-- */
-#define NV_CTRL_GVO_SUPPORTED_FALSE 0
-#define NV_CTRL_GVO_SUPPORTED_TRUE 1
-
-/*
- * NV_CTRL_GVO_SYNC_MODE - selects the GVO sync mode; possible values
- * are:
- *
- * FREE_RUNNING - GVO does not sync to any external signal
- *
- * GENLOCK - the GVO output is genlocked to an incoming sync signal;
- * genlocking locks at hsync. This requires that the output video
- * format exactly match the incoming sync video format.
- *
- * FRAMELOCK - the GVO output is frame locked to an incoming sync
- * signal; frame locking locks at vsync. This requires that the output
- * video format have the same refresh rate as the incoming sync video
- * format.
- */
-
-#define NV_CTRL_GVO_SYNC_MODE 68 /* RW- */
-#define NV_CTRL_GVO_SYNC_MODE_FREE_RUNNING 0
-#define NV_CTRL_GVO_SYNC_MODE_GENLOCK 1
-#define NV_CTRL_GVO_SYNC_MODE_FRAMELOCK 2
-
-/*
- * NV_CTRL_GVO_SYNC_SOURCE - if NV_CTRL_GVO_SYNC_MODE is set to either
- * GENLOCK or FRAMELOCK, this controls which sync source is used as
- * the incoming sync signal (either Composite or SDI). If
- * NV_CTRL_GVO_SYNC_MODE is FREE_RUNNING, this attribute has no
- * effect.
- */
-
-#define NV_CTRL_GVO_SYNC_SOURCE 69 /* RW- */
-#define NV_CTRL_GVO_SYNC_SOURCE_COMPOSITE 0
-#define NV_CTRL_GVO_SYNC_SOURCE_SDI 1
-
-/*
- * NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT - specifies the desired output video
- * format for GVO devices or the desired input video format for GVI devices.
- *
- * Note that for GVO, the valid video formats may vary depending on
- * the NV_CTRL_GVO_SYNC_MODE and the incoming sync video format. See
- * the definition of NV_CTRL_GVO_SYNC_MODE.
- *
- * Note that when querying the ValidValues for this data type, the
- * values are reported as bits within a bitmask
- * (ATTRIBUTE_TYPE_INT_BITS); unfortunately, there are more valid
- * value bits than will fit in a single 32-bit value. To solve this,
- * query the ValidValues for NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT to
- * check which of the first 31 VIDEO_FORMATS are valid, query the
- * ValidValues for NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT2 to check which
- * of the 32-63 VIDEO_FORMATS are valid, and query the ValidValues of
- * NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT3 to check which of the 64-95
- * VIDEO_FORMATS are valid.
- *
- * Note: Setting this attribute on a GVI device may also result in the
- * following NV-CONTROL attributes being reset on that device (to
- * ensure the configuration remains valid):
- * NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT
- * NV_CTRL_GVI_REQUESTED_STREAM_COMPONENT_SAMPLING
- */
-
-#define NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT 70 /* RW--I */
-
-#define NV_CTRL_GVIO_VIDEO_FORMAT_NONE 0
-#define NV_CTRL_GVIO_VIDEO_FORMAT_487I_59_94_SMPTE259_NTSC 1
-#define NV_CTRL_GVIO_VIDEO_FORMAT_576I_50_00_SMPTE259_PAL 2
-#define NV_CTRL_GVIO_VIDEO_FORMAT_720P_59_94_SMPTE296 3
-#define NV_CTRL_GVIO_VIDEO_FORMAT_720P_60_00_SMPTE296 4
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1035I_59_94_SMPTE260 5
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1035I_60_00_SMPTE260 6
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080I_50_00_SMPTE295 7
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080I_50_00_SMPTE274 8
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080I_59_94_SMPTE274 9
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080I_60_00_SMPTE274 10
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_23_976_SMPTE274 11
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_24_00_SMPTE274 12
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_25_00_SMPTE274 13
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_29_97_SMPTE274 14
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_30_00_SMPTE274 15
-#define NV_CTRL_GVIO_VIDEO_FORMAT_720P_50_00_SMPTE296 16
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080I_48_00_SMPTE274 17
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080I_47_96_SMPTE274 18
-#define NV_CTRL_GVIO_VIDEO_FORMAT_720P_30_00_SMPTE296 19
-#define NV_CTRL_GVIO_VIDEO_FORMAT_720P_29_97_SMPTE296 20
-#define NV_CTRL_GVIO_VIDEO_FORMAT_720P_25_00_SMPTE296 21
-#define NV_CTRL_GVIO_VIDEO_FORMAT_720P_24_00_SMPTE296 22
-#define NV_CTRL_GVIO_VIDEO_FORMAT_720P_23_98_SMPTE296 23
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080PSF_25_00_SMPTE274 24
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080PSF_29_97_SMPTE274 25
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080PSF_30_00_SMPTE274 26
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080PSF_24_00_SMPTE274 27
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080PSF_23_98_SMPTE274 28
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048P_30_00_SMPTE372 29
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048P_29_97_SMPTE372 30
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048I_60_00_SMPTE372 31
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048I_59_94_SMPTE372 32
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048P_25_00_SMPTE372 33
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048I_50_00_SMPTE372 34
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048P_24_00_SMPTE372 35
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048P_23_98_SMPTE372 36
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048I_48_00_SMPTE372 37
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048I_47_96_SMPTE372 38
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_50_00_3G_LEVEL_A_SMPTE274 39
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_59_94_3G_LEVEL_A_SMPTE274 40
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_60_00_3G_LEVEL_A_SMPTE274 41
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_60_00_3G_LEVEL_B_SMPTE274 42
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080I_60_00_3G_LEVEL_B_SMPTE274 43
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048I_60_00_3G_LEVEL_B_SMPTE372 44
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_50_00_3G_LEVEL_B_SMPTE274 45
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080I_50_00_3G_LEVEL_B_SMPTE274 46
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048I_50_00_3G_LEVEL_B_SMPTE372 47
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_30_00_3G_LEVEL_B_SMPTE274 48
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048P_30_00_3G_LEVEL_B_SMPTE372 49
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_25_00_3G_LEVEL_B_SMPTE274 50
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048P_25_00_3G_LEVEL_B_SMPTE372 51
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_24_00_3G_LEVEL_B_SMPTE274 52
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048P_24_00_3G_LEVEL_B_SMPTE372 53
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080I_48_00_3G_LEVEL_B_SMPTE274 54
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048I_48_00_3G_LEVEL_B_SMPTE372 55
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_59_94_3G_LEVEL_B_SMPTE274 56
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080I_59_94_3G_LEVEL_B_SMPTE274 57
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048I_59_94_3G_LEVEL_B_SMPTE372 58
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_29_97_3G_LEVEL_B_SMPTE274 59
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048P_29_97_3G_LEVEL_B_SMPTE372 60
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080P_23_98_3G_LEVEL_B_SMPTE274 61
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048P_23_98_3G_LEVEL_B_SMPTE372 62
-#define NV_CTRL_GVIO_VIDEO_FORMAT_1080I_47_96_3G_LEVEL_B_SMPTE274 63
-#define NV_CTRL_GVIO_VIDEO_FORMAT_2048I_47_96_3G_LEVEL_B_SMPTE372 64
-
-/*
- * The following are deprecated; NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT and the
- * corresponding NV_CTRL_GVIO_* formats should be used instead.
- */
-#define NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT 70 /* RW- */
-
-#define NV_CTRL_GVO_VIDEO_FORMAT_NONE 0
-#define NV_CTRL_GVO_VIDEO_FORMAT_487I_59_94_SMPTE259_NTSC 1
-#define NV_CTRL_GVO_VIDEO_FORMAT_576I_50_00_SMPTE259_PAL 2
-#define NV_CTRL_GVO_VIDEO_FORMAT_720P_59_94_SMPTE296 3
-#define NV_CTRL_GVO_VIDEO_FORMAT_720P_60_00_SMPTE296 4
-#define NV_CTRL_GVO_VIDEO_FORMAT_1035I_59_94_SMPTE260 5
-#define NV_CTRL_GVO_VIDEO_FORMAT_1035I_60_00_SMPTE260 6
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_50_00_SMPTE295 7
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_50_00_SMPTE274 8
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_59_94_SMPTE274 9
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_60_00_SMPTE274 10
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080P_23_976_SMPTE274 11
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080P_24_00_SMPTE274 12
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080P_25_00_SMPTE274 13
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080P_29_97_SMPTE274 14
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080P_30_00_SMPTE274 15
-#define NV_CTRL_GVO_VIDEO_FORMAT_720P_50_00_SMPTE296 16
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_48_00_SMPTE274 17
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_47_96_SMPTE274 18
-#define NV_CTRL_GVO_VIDEO_FORMAT_720P_30_00_SMPTE296 19
-#define NV_CTRL_GVO_VIDEO_FORMAT_720P_29_97_SMPTE296 20
-#define NV_CTRL_GVO_VIDEO_FORMAT_720P_25_00_SMPTE296 21
-#define NV_CTRL_GVO_VIDEO_FORMAT_720P_24_00_SMPTE296 22
-#define NV_CTRL_GVO_VIDEO_FORMAT_720P_23_98_SMPTE296 23
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_25_00_SMPTE274 24
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_29_97_SMPTE274 25
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_30_00_SMPTE274 26
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_24_00_SMPTE274 27
-#define NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_23_98_SMPTE274 28
-#define NV_CTRL_GVO_VIDEO_FORMAT_2048P_30_00_SMPTE372 29
-#define NV_CTRL_GVO_VIDEO_FORMAT_2048P_29_97_SMPTE372 30
-#define NV_CTRL_GVO_VIDEO_FORMAT_2048I_60_00_SMPTE372 31
-#define NV_CTRL_GVO_VIDEO_FORMAT_2048I_59_94_SMPTE372 32
-#define NV_CTRL_GVO_VIDEO_FORMAT_2048P_25_00_SMPTE372 33
-#define NV_CTRL_GVO_VIDEO_FORMAT_2048I_50_00_SMPTE372 34
-#define NV_CTRL_GVO_VIDEO_FORMAT_2048P_24_00_SMPTE372 35
-#define NV_CTRL_GVO_VIDEO_FORMAT_2048P_23_98_SMPTE372 36
-#define NV_CTRL_GVO_VIDEO_FORMAT_2048I_48_00_SMPTE372 37
-#define NV_CTRL_GVO_VIDEO_FORMAT_2048I_47_96_SMPTE372 38
-
-/*
- * NV_CTRL_GVIO_DETECTED_VIDEO_FORMAT - indicates the input video format
- * detected for GVO or GVI devices; the possible values are the
- * NV_CTRL_GVIO_VIDEO_FORMAT constants.
- *
- * For GVI devices, the jack number should be specified in the lower
- * 16 bits of the "display_mask" parameter, while the channel number should be
- * specified in the upper 16 bits.
- */
-
-#define NV_CTRL_GVIO_DETECTED_VIDEO_FORMAT 71 /* R--I */
-
-/*
- * The following is deprecated. Use NV_CTRL_GVIO_DETECTED_VIDEO_FORMAT,
- * instead.
- */
-#define NV_CTRL_GVO_INPUT_VIDEO_FORMAT 71 /* R-- */
-
-/*
- * NV_CTRL_GVO_DATA_FORMAT - This controls how the data in the source
- * (either the X screen or the GLX pbuffer) is interpretted and
- * displayed.
- *
- * Note: some of the below DATA_FORMATS have been renamed. For
- * example, R8G8B8_TO_RGB444 has been renamed to X8X8X8_444_PASSTHRU.
- * This is to more accurately reflect DATA_FORMATS where the
- * per-channel data could be either RGB or YCrCb -- the point is that
- * the driver and GVO hardware do not perform any implicit color space
- * conversion on the data; it is passed through to the SDI out.
- */
-
-#define NV_CTRL_GVO_DATA_FORMAT 72 /* RW- */
-#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8_TO_YCRCB444 0
-#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8A8_TO_YCRCBA4444 1
-#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8Z10_TO_YCRCBZ4444 2
-#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8_TO_YCRCB422 3
-#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8A8_TO_YCRCBA4224 4
-#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8Z10_TO_YCRCBZ4224 5
-#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8_TO_RGB444 6 // renamed
-#define NV_CTRL_GVO_DATA_FORMAT_X8X8X8_444_PASSTHRU 6
-#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8A8_TO_RGBA4444 7 // renamed
-#define NV_CTRL_GVO_DATA_FORMAT_X8X8X8A8_4444_PASSTHRU 7
-#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8Z10_TO_RGBZ4444 8 // renamed
-#define NV_CTRL_GVO_DATA_FORMAT_X8X8X8Z8_4444_PASSTHRU 8
-#define NV_CTRL_GVO_DATA_FORMAT_Y10CR10CB10_TO_YCRCB444 9 // renamed
-#define NV_CTRL_GVO_DATA_FORMAT_X10X10X10_444_PASSTHRU 9
-#define NV_CTRL_GVO_DATA_FORMAT_Y10CR8CB8_TO_YCRCB444 10 // renamed
-#define NV_CTRL_GVO_DATA_FORMAT_X10X8X8_444_PASSTHRU 10
-#define NV_CTRL_GVO_DATA_FORMAT_Y10CR8CB8A10_TO_YCRCBA4444 11 // renamed
-#define NV_CTRL_GVO_DATA_FORMAT_X10X8X8A10_4444_PASSTHRU 11
-#define NV_CTRL_GVO_DATA_FORMAT_Y10CR8CB8Z10_TO_YCRCBZ4444 12 // renamed
-#define NV_CTRL_GVO_DATA_FORMAT_X10X8X8Z10_4444_PASSTHRU 12
-#define NV_CTRL_GVO_DATA_FORMAT_DUAL_R8G8B8_TO_DUAL_YCRCB422 13
-#define NV_CTRL_GVO_DATA_FORMAT_DUAL_Y8CR8CB8_TO_DUAL_YCRCB422 14 // renamed
-#define NV_CTRL_GVO_DATA_FORMAT_DUAL_X8X8X8_TO_DUAL_422_PASSTHRU 14
-#define NV_CTRL_GVO_DATA_FORMAT_R10G10B10_TO_YCRCB422 15
-#define NV_CTRL_GVO_DATA_FORMAT_R10G10B10_TO_YCRCB444 16
-#define NV_CTRL_GVO_DATA_FORMAT_Y12CR12CB12_TO_YCRCB444 17 // renamed
-#define NV_CTRL_GVO_DATA_FORMAT_X12X12X12_444_PASSTHRU 17
-#define NV_CTRL_GVO_DATA_FORMAT_R12G12B12_TO_YCRCB444 18
-#define NV_CTRL_GVO_DATA_FORMAT_X8X8X8_422_PASSTHRU 19
-#define NV_CTRL_GVO_DATA_FORMAT_X8X8X8A8_4224_PASSTHRU 20
-#define NV_CTRL_GVO_DATA_FORMAT_X8X8X8Z8_4224_PASSTHRU 21
-#define NV_CTRL_GVO_DATA_FORMAT_X10X10X10_422_PASSTHRU 22
-#define NV_CTRL_GVO_DATA_FORMAT_X10X8X8_422_PASSTHRU 23
-#define NV_CTRL_GVO_DATA_FORMAT_X10X8X8A10_4224_PASSTHRU 24
-#define NV_CTRL_GVO_DATA_FORMAT_X10X8X8Z10_4224_PASSTHRU 25
-#define NV_CTRL_GVO_DATA_FORMAT_X12X12X12_422_PASSTHRU 26
-#define NV_CTRL_GVO_DATA_FORMAT_R12G12B12_TO_YCRCB422 27
-
-/*
- * NV_CTRL_GVO_DISPLAY_X_SCREEN - no longer supported
- */
-
-#define NV_CTRL_GVO_DISPLAY_X_SCREEN 73 /* RW- */
-#define NV_CTRL_GVO_DISPLAY_X_SCREEN_ENABLE 1
-#define NV_CTRL_GVO_DISPLAY_X_SCREEN_DISABLE 0
-
-/*
- * NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED - indicates whether
- * Composite Sync input is detected.
- */
-
-#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED 74 /* R-- */
-#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED_FALSE 0
-#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED_TRUE 1
-
-/*
- * NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE - get/set the
- * Composite Sync input detect mode.
- */
-
-#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE 75 /* RW- */
-#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE_AUTO 0
-#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE_BI_LEVEL 1
-#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE_TRI_LEVEL 2
-
-/*
- * NV_CTRL_GVO_SYNC_INPUT_DETECTED - indicates whether SDI Sync input
- * is detected, and what type.
- */
-
-#define NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED 76 /* R-- */
-#define NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_NONE 0
-#define NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_HD 1
-#define NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_SD 2
-
-/*
- * NV_CTRL_GVO_VIDEO_OUTPUTS - indicates which GVO video output
- * connectors are currently outputing data.
- */
-
-#define NV_CTRL_GVO_VIDEO_OUTPUTS 77 /* R-- */
-#define NV_CTRL_GVO_VIDEO_OUTPUTS_NONE 0
-#define NV_CTRL_GVO_VIDEO_OUTPUTS_VIDEO1 1
-#define NV_CTRL_GVO_VIDEO_OUTPUTS_VIDEO2 2
-#define NV_CTRL_GVO_VIDEO_OUTPUTS_VIDEO_BOTH 3
-
-/*
- * NV_CTRL_GVO_FPGA_VERSION - indicates the version of the Firmware on
- * the GVO device. Deprecated; use
- * NV_CTRL_STRING_GVIO_FIRMWARE_VERSION instead.
- */
-
-#define NV_CTRL_GVO_FIRMWARE_VERSION 78 /* R-- */
-
-/*
- * NV_CTRL_GVO_SYNC_DELAY_PIXELS - controls the delay between the
- * input sync and the output sync in numbers of pixels from hsync;
- * this is a 12 bit value.
- *
- * If the NV_CTRL_GVO_CAPABILITIES_ADVANCE_SYNC_SKEW bit is set,
- * then setting this value will set an advance instead of a delay.
- */
-
-#define NV_CTRL_GVO_SYNC_DELAY_PIXELS 79 /* RW- */
-
-/*
- * NV_CTRL_GVO_SYNC_DELAY_LINES - controls the delay between the input
- * sync and the output sync in numbers of lines from vsync; this is a
- * 12 bit value.
- *
- * If the NV_CTRL_GVO_CAPABILITIES_ADVANCE_SYNC_SKEW bit is set,
- * then setting this value will set an advance instead of a delay.
- */
-
-#define NV_CTRL_GVO_SYNC_DELAY_LINES 80 /* RW- */
-
-/*
- * NV_CTRL_GVO_INPUT_VIDEO_FORMAT_REACQUIRE - must be set for a period
- * of about 2 seconds for the new InputVideoFormat to be properly
- * locked to. In nvidia-settings, we do a reacquire whenever genlock
- * or frame lock mode is entered into, when the user clicks the
- * "detect" button. This value can be written, but always reads back
- * _FALSE.
- */
-
-#define NV_CTRL_GVO_INPUT_VIDEO_FORMAT_REACQUIRE 81 /* -W- */
-#define NV_CTRL_GVO_INPUT_VIDEO_FORMAT_REACQUIRE_FALSE 0
-#define NV_CTRL_GVO_INPUT_VIDEO_FORMAT_REACQUIRE_TRUE 1
-
-/*
- * NV_CTRL_GVO_GLX_LOCKED - indicates that GVO configurability is
- * locked by GLX; this occurs when either glXGetVideoDeviceNV (part of
- * GLX_NV_video_out) or glXBindVideoDeviceNV (part of
- * GLX_NV_present_video) is called. All GVO output resources are
- * locked until released by the GLX_NV_video_out/GLX_NV_present_video
- * client.
- *
- * When GVO is locked, setting of the following GVO NV-CONTROL attributes will
- * not happen immediately and will instead be cached. The GVO resource will
- * need to be disabled/released and re-enabled/claimed for the values to be
- * flushed. These attributes are:
- * NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT
- * NV_CTRL_GVO_DATA_FORMAT
- * NV_CTRL_GVO_FLIP_QUEUE_SIZE
- *
- * This attribute is deprecated and may be removed in a future release. Its
- * functionality has been replaced by NV_CTRL_GVO_LOCK_OWNER.
- */
-
-#define NV_CTRL_GVO_GLX_LOCKED 82 /* R-- */
-#define NV_CTRL_GVO_GLX_LOCKED_FALSE 0
-#define NV_CTRL_GVO_GLX_LOCKED_TRUE 1
-
-/*
- * NV_CTRL_GVIO_VIDEO_FORMAT_{WIDTH,HEIGHT,REFRESH_RATE} - query the
- * width, height, and refresh rate for the specified
- * NV_CTRL_GVIO_VIDEO_FORMAT_*. So that this can be queried with
- * existing interfaces, XNVCTRLQueryAttribute() should be used, and
- * the video format specified in the display_mask field; eg:
- *
- * XNVCTRLQueryAttribute (dpy,
- * screen,
- * NV_CTRL_GVIO_VIDEO_FORMAT_487I_59_94_SMPTE259_NTSC,
- * NV_CTRL_GVIO_VIDEO_FORMAT_WIDTH,
- * &value);
- *
- * Note that Refresh Rate is in milliHertz values
- */
-
-#define NV_CTRL_GVIO_VIDEO_FORMAT_WIDTH 83 /* R--I */
-#define NV_CTRL_GVIO_VIDEO_FORMAT_HEIGHT 84 /* R--I */
-#define NV_CTRL_GVIO_VIDEO_FORMAT_REFRESH_RATE 85 /* R--I */
-
-/* The following are deprecated; use the NV_CTRL_GVIO_* versions, instead */
-#define NV_CTRL_GVO_VIDEO_FORMAT_WIDTH 83 /* R-- */
-#define NV_CTRL_GVO_VIDEO_FORMAT_HEIGHT 84 /* R-- */
-#define NV_CTRL_GVO_VIDEO_FORMAT_REFRESH_RATE 85 /* R-- */
-
-/*
- * NV_CTRL_GVO_X_SCREEN_PAN_[XY] - no longer supported
- */
-
-#define NV_CTRL_GVO_X_SCREEN_PAN_X 86 /* RW- */
-#define NV_CTRL_GVO_X_SCREEN_PAN_Y 87 /* RW- */
-
-/*
- * NV_CTRL_GPU_OVERCLOCKING_STATE - query the current or set a new
- * overclocking state; the value of this attribute controls the
- * availability of additional overclocking attributes (see below).
- *
- * Note: this attribute is unavailable unless overclocking support
- * has been enabled in the X server (by the user).
- */
-
-#define NV_CTRL_GPU_OVERCLOCKING_STATE 88 /* RW-G */
-#define NV_CTRL_GPU_OVERCLOCKING_STATE_NONE 0
-#define NV_CTRL_GPU_OVERCLOCKING_STATE_MANUAL 1
-
-/*
- * NV_CTRL_GPU_{2,3}D_CLOCK_FREQS - query or set the GPU and memory
- * clocks of the device driving the X screen. New clock frequencies
- * are tested before being applied, and may be rejected.
- *
- * Note: if the target clocks are too aggressive, their testing may
- * render the system unresponsive.
- *
- * Note: while this attribute can always be queried, it can't be set
- * unless NV_CTRL_GPU_OVERCLOCKING_STATE is set to _MANUAL. Since
- * the target clocks may be rejected, the requester should read this
- * attribute after the set to determine success or failure.
- *
- * NV_CTRL_GPU_{2,3}D_CLOCK_FREQS are "packed" integer attributes; the
- * GPU clock is stored in the upper 16 bits of the integer, and the
- * memory clock is stored in the lower 16 bits of the integer. All
- * clock values are in MHz.
- */
-
-#define NV_CTRL_GPU_2D_CLOCK_FREQS 89 /* RW-G */
-#define NV_CTRL_GPU_3D_CLOCK_FREQS 90 /* RW-G */
-
-/*
- * NV_CTRL_GPU_DEFAULT_{2,3}D_CLOCK_FREQS - query the default memory
- * and GPU core clocks of the device driving the X screen.
- *
- * NV_CTRL_GPU_DEFAULT_{2,3}D_CLOCK_FREQS are "packed" integer
- * attributes; the GPU clock is stored in the upper 16 bits of the
- * integer, and the memory clock is stored in the lower 16 bits of the
- * integer. All clock values are in MHz.
- */
-
-#define NV_CTRL_GPU_DEFAULT_2D_CLOCK_FREQS 91 /* R--G */
-#define NV_CTRL_GPU_DEFAULT_3D_CLOCK_FREQS 92 /* R--G */
-
-/*
- * NV_CTRL_GPU_CURRENT_CLOCK_FREQS - query the current GPU and memory
- * clocks of the graphics device driving the X screen.
- *
- * NV_CTRL_GPU_CURRENT_CLOCK_FREQS is a "packed" integer attribute;
- * the GPU clock is stored in the upper 16 bits of the integer, and
- * the memory clock is stored in the lower 16 bits of the integer.
- * All clock values are in MHz. All clock values are in MHz.
- */
-
-#define NV_CTRL_GPU_CURRENT_CLOCK_FREQS 93 /* R--G */
-
-/*
- * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS - Holds the last calculated
- * optimal 3D clock frequencies found by the
- * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION process. Querying this
- * attribute before having probed for the optimal clocks will return
- * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_INVALID
- *
- * Note: unless NV_CTRL_GPU_OVERCLOCKING_STATE is set to _MANUAL, the
- * optimal clock detection process is unavailable.
- */
-
-#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS 94 /* R--G */
-#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_INVALID 0
-
-/*
- * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION - set to _START to
- * initiate testing for the optimal 3D clock frequencies. Once
- * found, the optimal clock frequencies will be returned by the
- * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS attribute asynchronously
- * (using an X event, see XNVCtrlSelectNotify).
- *
- * To cancel an ongoing test for the optimal clocks, set the
- * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION attribute to _CANCEL
- *
- * Note: unless NV_CTRL_GPU_OVERCLOCKING_STATE is set to _MANUAL, the
- * optimal clock detection process is unavailable.
- */
-
-#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION 95 /* -W-G */
-#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_START 0
-#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_CANCEL 1
-
-/*
- * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE - query this
- * variable to know if a test is currently being run to
- * determine the optimal 3D clock frequencies. _BUSY means a
- * test is currently running, _IDLE means the test is not running.
- *
- * Note: unless NV_CTRL_GPU_OVERCLOCKING_STATE is set to _MANUAL, the
- * optimal clock detection process is unavailable.
- */
-
-#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE 96 /* R--G */
-#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE_IDLE 0
-#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE_BUSY 1
-
-/*
- * NV_CTRL_FLATPANEL_CHIP_LOCATION - for the specified display device,
- * report whether the flat panel is driven by the on-chip controller,
- * or a separate controller chip elsewhere on the graphics board.
- * This attribute is only available for flat panels.
- */
-
-#define NV_CTRL_FLATPANEL_CHIP_LOCATION 215 /* R-DG */
-#define NV_CTRL_FLATPANEL_CHIP_LOCATION_INTERNAL 0
-#define NV_CTRL_FLATPANEL_CHIP_LOCATION_EXTERNAL 1
-
-/*
- * NV_CTRL_FLATPANEL_LINK - report the number of links for a DVI connection, or
- * the main link's active lane count for DisplayPort.
- * This attribute is only available for flat panels.
- */
-
-#define NV_CTRL_FLATPANEL_LINK 216 /* R-DG */
-#define NV_CTRL_FLATPANEL_LINK_SINGLE 0
-#define NV_CTRL_FLATPANEL_LINK_DUAL 1
-#define NV_CTRL_FLATPANEL_LINK_QUAD 3
-
-/*
- * NV_CTRL_FLATPANEL_SIGNAL - for the specified display device, report
- * whether the flat panel is driven by an LVDS, TMDS, or DisplayPort signal.
- * This attribute is only available for flat panels.
- */
-
-#define NV_CTRL_FLATPANEL_SIGNAL 217 /* R-DG */
-#define NV_CTRL_FLATPANEL_SIGNAL_LVDS 0
-#define NV_CTRL_FLATPANEL_SIGNAL_TMDS 1
-#define NV_CTRL_FLATPANEL_SIGNAL_DISPLAYPORT 2
-
-/*
- * NV_CTRL_USE_HOUSE_SYNC - when TRUE, the server (master) frame lock
- * device will propagate the incoming house sync signal as the outgoing
- * frame lock sync signal. If the frame lock device cannot detect a
- * frame lock sync signal, it will default to using the internal timings
- * from the GPU connected to the primary connector.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- */
-
-#define NV_CTRL_USE_HOUSE_SYNC 218 /* RW-F */
-#define NV_CTRL_USE_HOUSE_SYNC_FALSE 0
-#define NV_CTRL_USE_HOUSE_SYNC_TRUE 1
-
-/*
- * NV_CTRL_EDID_AVAILABLE - report if an EDID is available for the
- * specified display device.
- *
- * This attribute may also be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN
- * target.
- */
-
-#define NV_CTRL_EDID_AVAILABLE 219 /* R-DG */
-#define NV_CTRL_EDID_AVAILABLE_FALSE 0
-#define NV_CTRL_EDID_AVAILABLE_TRUE 1
-
-/*
- * NV_CTRL_FORCE_STEREO - when TRUE, OpenGL will force stereo flipping
- * even when no stereo drawables are visible (if the device is configured
- * to support it, see the "Stereo" X config option).
- * When false, fall back to the default behavior of only flipping when a
- * stereo drawable is visible.
- */
-
-#define NV_CTRL_FORCE_STEREO 220 /* RW- */
-#define NV_CTRL_FORCE_STEREO_FALSE 0
-#define NV_CTRL_FORCE_STEREO_TRUE 1
-
-/*
- * NV_CTRL_IMAGE_SETTINGS - the image quality setting for OpenGL clients.
- *
- * This setting is only applied to OpenGL clients that are started
- * after this setting is applied.
- */
-
-#define NV_CTRL_IMAGE_SETTINGS 221 /* RW-X */
-#define NV_CTRL_IMAGE_SETTINGS_HIGH_QUALITY 0
-#define NV_CTRL_IMAGE_SETTINGS_QUALITY 1
-#define NV_CTRL_IMAGE_SETTINGS_PERFORMANCE 2
-#define NV_CTRL_IMAGE_SETTINGS_HIGH_PERFORMANCE 3
-
-/*
- * NV_CTRL_XINERAMA - return whether xinerama is enabled
- */
-
-#define NV_CTRL_XINERAMA 222 /* R--G */
-#define NV_CTRL_XINERAMA_OFF 0
-#define NV_CTRL_XINERAMA_ON 1
-
-/*
- * NV_CTRL_XINERAMA_STEREO - when TRUE, OpenGL will allow stereo flipping
- * on multiple X screens configured with Xinerama.
- * When FALSE, flipping is allowed only on one X screen at a time.
- */
-
-#define NV_CTRL_XINERAMA_STEREO 223 /* RW- */
-#define NV_CTRL_XINERAMA_STEREO_FALSE 0
-#define NV_CTRL_XINERAMA_STEREO_TRUE 1
-
-/*
- * NV_CTRL_BUS_RATE - if the bus type of the specified device is AGP, then
- * NV_CTRL_BUS_RATE returns the configured AGP transfer rate. If the bus type
- * is PCI Express, then this attribute returns the maximum link width.
- * When this attribute is queried on an X screen target, the bus rate of the
- * GPU driving the X screen is returned.
- */
-
-#define NV_CTRL_BUS_RATE 224 /* R--GI */
-
-/*
- * NV_CTRL_GPU_PCIE_MAX_LINK_WIDTH - returns the maximum
- * PCIe link width, in number of lanes.
- */
-#define NV_CTRL_GPU_PCIE_MAX_LINK_WIDTH NV_CTRL_BUS_RATE
-
-/*
- * NV_CTRL_SHOW_SLI_HUD - when TRUE, OpenGL will draw information about the
- * current SLI mode.
- * Renamed this attribute to NV_CTRL_SHOW_SLI_VISUAL_INDICATOR
- */
-
-#define NV_CTRL_SHOW_SLI_HUD NV_CTRL_SHOW_SLI_VISUAL_INDICATOR
-#define NV_CTRL_SHOW_SLI_HUD_FALSE NV_CTRL_SHOW_SLI_VISUAL_INDICATOR_FALSE
-#define NV_CTRL_SHOW_SLI_HUD_TRUE NV_CTRL_SHOW_SLI_VISUAL_INDICATOR_TRUE
-
-/*
- * NV_CTRL_SHOW_SLI_VISUAL_INDICATOR - when TRUE, OpenGL will draw information
- * about the current SLI mode.
- */
-
-#define NV_CTRL_SHOW_SLI_VISUAL_INDICATOR 225 /* RW-X */
-#define NV_CTRL_SHOW_SLI_VISUAL_INDICATOR_FALSE 0
-#define NV_CTRL_SHOW_SLI_VISUAL_INDICATOR_TRUE 1
-
-/*
- * NV_CTRL_XV_SYNC_TO_DISPLAY - this control is valid when TwinView and
- * XVideo Sync To VBlank are enabled.
- * It controls which display device will be synched to.
- */
-
-#define NV_CTRL_XV_SYNC_TO_DISPLAY 226 /* RW- */
-
-/*
- * NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT2 - this attribute is only
- * intended to be used to query the ValidValues for
- * NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT for VIDEO_FORMAT values between
- * 31 and 63. See NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT for details.
- */
-
-#define NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT2 227 /* ---GI */
-
-/*
- * The following is deprecated; use NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT2,
- * instead
- */
-#define NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT2 227 /* --- */
-
-/*
- * NV_CTRL_GVO_OVERRIDE_HW_CSC - Override the SDI hardware's Color Space
- * Conversion with the values controlled through
- * XNVCTRLSetGvoColorConversion() and XNVCTRLGetGvoColorConversion(). If
- * this attribute is FALSE, then the values specified through
- * XNVCTRLSetGvoColorConversion() are ignored.
- */
-
-#define NV_CTRL_GVO_OVERRIDE_HW_CSC 228 /* RW- */
-#define NV_CTRL_GVO_OVERRIDE_HW_CSC_FALSE 0
-#define NV_CTRL_GVO_OVERRIDE_HW_CSC_TRUE 1
-
-/*
- * NV_CTRL_GVO_CAPABILITIES - this read-only attribute describes GVO
- * capabilities that differ between NVIDIA SDI products. This value
- * is a bitmask where each bit indicates whether that capability is
- * available.
- *
- * APPLY_CSC_IMMEDIATELY - whether the CSC matrix, offset, and scale
- * specified through XNVCTRLSetGvoColorConversion() will take affect
- * immediately, or only after SDI output is disabled and enabled
- * again.
- *
- * APPLY_CSC_TO_X_SCREEN - whether the CSC matrix, offset, and scale
- * specified through XNVCTRLSetGvoColorConversion() will also apply
- * to GVO output of an X screen, or only to OpenGL GVO output, as
- * enabled through the GLX_NV_video_out extension.
- *
- * COMPOSITE_TERMINATION - whether the 75 ohm termination of the
- * SDI composite input signal can be programmed through the
- * NV_CTRL_GVO_COMPOSITE_TERMINATION attribute.
- *
- * SHARED_SYNC_BNC - whether the SDI device has a single BNC
- * connector used for both (SDI & Composite) incoming signals.
- *
- * MULTIRATE_SYNC - whether the SDI device supports synchronization
- * of input and output video modes that match in being odd or even
- * modes (ie, AA.00 Hz modes can be synched to other BB.00 Hz modes and
- * AA.XX Hz can match to BB.YY Hz where .XX and .YY are not .00)
- */
-
-#define NV_CTRL_GVO_CAPABILITIES 229 /* R-- */
-#define NV_CTRL_GVO_CAPABILITIES_APPLY_CSC_IMMEDIATELY 0x00000001
-#define NV_CTRL_GVO_CAPABILITIES_APPLY_CSC_TO_X_SCREEN 0x00000002
-#define NV_CTRL_GVO_CAPABILITIES_COMPOSITE_TERMINATION 0x00000004
-#define NV_CTRL_GVO_CAPABILITIES_SHARED_SYNC_BNC 0x00000008
-#define NV_CTRL_GVO_CAPABILITIES_MULTIRATE_SYNC 0x00000010
-#define NV_CTRL_GVO_CAPABILITIES_ADVANCE_SYNC_SKEW 0x00000020
-
-/*
- * NV_CTRL_GVO_COMPOSITE_TERMINATION - enable or disable 75 ohm
- * termination of the SDI composite input signal.
- */
-
-#define NV_CTRL_GVO_COMPOSITE_TERMINATION 230 /* RW- */
-#define NV_CTRL_GVO_COMPOSITE_TERMINATION_ENABLE 1
-#define NV_CTRL_GVO_COMPOSITE_TERMINATION_DISABLE 0
-
-/*
- * NV_CTRL_ASSOCIATED_DISPLAY_DEVICES - display device mask indicating
- * which display devices are "associated" with the specified X screen
- * (ie: are available to the X screen for displaying the X screen).
- */
-
-#define NV_CTRL_ASSOCIATED_DISPLAY_DEVICES 231 /* RW- */
-
-/*
- * NV_CTRL_FRAMELOCK_SLAVES - get/set whether the display device(s)
- * given should listen or ignore the master's sync signal.
- *
- * This attribute can only be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU target. This attribute cannot be
- * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN.
- */
-
-#define NV_CTRL_FRAMELOCK_SLAVES 232 /* RW-G */
-
-/*
- * NV_CTRL_FRAMELOCK_MASTERABLE - Can any of the given display devices
- * be set as master of the frame lock group. Returns a bitmask of the
- * corresponding display devices that can be set as master.
- *
- * This attribute can only be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU target. This attribute cannot be
- * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN.
- */
-
-#define NV_CTRL_FRAMELOCK_MASTERABLE 233 /* R-DG */
-
-/*
- * NV_CTRL_PROBE_DISPLAYS - re-probes the hardware to detect what
- * display devices are connected to the GPU or GPU driving the
- * specified X screen. Returns a display mask.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_PROBE_DISPLAYS 234 /* R--G */
-
-/*
- * NV_CTRL_REFRESH_RATE - Returns the refresh rate of the specified
- * display device in 100 * Hz (ie. to get the refresh rate in Hz, divide
- * the returned value by 100.)
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_REFRESH_RATE 235 /* R-DG */
-
-/*
- * NV_CTRL_GVO_FLIP_QUEUE_SIZE - The Graphics to Video Out interface
- * exposed through NV-CONTROL and the GLX_NV_video_out extension uses
- * an internal flip queue when pbuffers are sent to the video device
- * (via glXSendPbufferToVideoNV()). The NV_CTRL_GVO_FLIP_QUEUE_SIZE
- * can be used to query and assign the flip queue size. This
- * attribute is applied to GLX when glXGetVideoDeviceNV() is called by
- * the application.
- */
-
-#define NV_CTRL_GVO_FLIP_QUEUE_SIZE 236 /* RW- */
-
-/*
- * NV_CTRL_CURRENT_SCANLINE - query the current scanline for the
- * specified display device.
- */
-
-#define NV_CTRL_CURRENT_SCANLINE 237 /* R-DG */
-
-/*
- * NV_CTRL_INITIAL_PIXMAP_PLACEMENT - Controls where X pixmaps are initially
- * created.
- *
- * NV_CTRL_INITIAL_PIXMAP_PLACEMENT_FORCE_SYSMEM causes pixmaps to stay in
- * system memory. These pixmaps can't be accelerated by the NVIDIA driver; this
- * will cause blank windows if used with an OpenGL compositing manager.
- * NV_CTRL_INITIAL_PIXMAP_PLACEMENT_SYSMEM creates pixmaps in system memory
- * initially, but allows them to migrate to video memory.
- * NV_CTRL_INITIAL_PIXMAP_PLACEMENT_VIDMEM creates pixmaps in video memory
- * when enough resources are available.
- * NV_CTRL_INITIAL_PIXMAP_PLACEMENT_RESERVED is currently reserved for future
- * use. Behavior is undefined.
- * NV_CTRL_INITIAL_PIXMAP_PLACEMENT_GPU_SYSMEM creates pixmaps in GPU accessible
- * system memory when enough resources are available.
- */
-
-#define NV_CTRL_INITIAL_PIXMAP_PLACEMENT 238 /* RW- */
-#define NV_CTRL_INITIAL_PIXMAP_PLACEMENT_FORCE_SYSMEM 0
-#define NV_CTRL_INITIAL_PIXMAP_PLACEMENT_SYSMEM 1
-#define NV_CTRL_INITIAL_PIXMAP_PLACEMENT_VIDMEM 2
-#define NV_CTRL_INITIAL_PIXMAP_PLACEMENT_RESERVED 3
-#define NV_CTRL_INITIAL_PIXMAP_PLACEMENT_GPU_SYSMEM 4
-
-/*
- * NV_CTRL_PCI_BUS - Returns the PCI bus number the specified device is using.
- */
-
-#define NV_CTRL_PCI_BUS 239 /* R--GI */
-
-/*
- * NV_CTRL_PCI_DEVICE - Returns the PCI device number the specified device is
- * using.
- */
-
-#define NV_CTRL_PCI_DEVICE 240 /* R--GI */
-
-/*
- * NV_CTRL_PCI_FUNCTION - Returns the PCI function number the specified device
- * is using.
- */
-
-#define NV_CTRL_PCI_FUNCTION 241 /* R--GI */
-
-/*
- * NV_CTRL_FRAMELOCK_FPGA_REVISION - Querys the FPGA revision of the
- * Frame Lock device.
- *
- * This attribute must be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK target.
- */
-
-#define NV_CTRL_FRAMELOCK_FPGA_REVISION 242 /* R--F */
-
-/*
- * NV_CTRL_MAX_SCREEN_{WIDTH,HEIGHT} - the maximum allowable size, in
- * pixels, of either the specified X screen (if the target_type of the
- * query is an X screen), or any X screen on the specified GPU (if the
- * target_type of the query is a GPU).
- */
-
-#define NV_CTRL_MAX_SCREEN_WIDTH 243 /* R--G */
-#define NV_CTRL_MAX_SCREEN_HEIGHT 244 /* R--G */
-
-/*
- * NV_CTRL_MAX_DISPLAYS - the maximum number of display devices that
- * can be driven simultaneously on a GPU (e.g., that can be used in a
- * MetaMode at once). Note that this does not indicate the maximum
- * number of bits that can be set in NV_CTRL_CONNECTED_DISPLAYS,
- * because more display devices can be connected than are actively in
- * use.
- */
-
-#define NV_CTRL_MAX_DISPLAYS 245 /* R--G */
-
-/*
- * NV_CTRL_DYNAMIC_TWINVIEW - Returns whether or not the screen
- * supports dynamic twinview.
- */
-
-#define NV_CTRL_DYNAMIC_TWINVIEW 246 /* R-- */
-
-/*
- * NV_CTRL_MULTIGPU_DISPLAY_OWNER - Returns the (NV-CONTROL) GPU ID of
- * the GPU that has the display device(s) used for showing the X Screen.
- */
-
-#define NV_CTRL_MULTIGPU_DISPLAY_OWNER 247 /* R-- */
-
-/*
- * NV_CTRL_GPU_SCALING - not supported
- */
-
-#define NV_CTRL_GPU_SCALING 248 /* RWDG */
-
-#define NV_CTRL_GPU_SCALING_TARGET_INVALID 0
-#define NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_BEST_FIT 1
-#define NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_NATIVE 2
-
-#define NV_CTRL_GPU_SCALING_METHOD_INVALID 0
-#define NV_CTRL_GPU_SCALING_METHOD_STRETCHED 1
-#define NV_CTRL_GPU_SCALING_METHOD_CENTERED 2
-#define NV_CTRL_GPU_SCALING_METHOD_ASPECT_SCALED 3
-
-/*
- * NV_CTRL_FRONTEND_RESOLUTION - not supported
- */
-
-#define NV_CTRL_FRONTEND_RESOLUTION 249 /* R-DG */
-
-/*
- * NV_CTRL_BACKEND_RESOLUTION - not supported
- */
-
-#define NV_CTRL_BACKEND_RESOLUTION 250 /* R-DG */
-
-/*
- * NV_CTRL_FLATPANEL_NATIVE_RESOLUTION - Returns the dimensions of the
- * native resolution of the flat panel as determined by the
- * NVIDIA X Driver.
- *
- * The native resolution is the resolution at which a flat panel
- * must display any image. All other resolutions must be scaled to this
- * resolution through GPU scaling or the DFP's native scaling capabilities
- * in order to be displayed.
- *
- * This attribute is only valid for flat panel (DFP) display devices.
- *
- * This attribute is a packed integer; the width is packed in the upper
- * 16-bits and the height is packed in the lower 16-bits.
- */
-
-#define NV_CTRL_FLATPANEL_NATIVE_RESOLUTION 251 /* R-DG */
-
-/*
- * NV_CTRL_FLATPANEL_BEST_FIT_RESOLUTION - not supported
- */
-
-#define NV_CTRL_FLATPANEL_BEST_FIT_RESOLUTION 252 /* R-DG */
-
-/*
- * NV_CTRL_GPU_SCALING_ACTIVE - not supported
- */
-
-#define NV_CTRL_GPU_SCALING_ACTIVE 253 /* R-DG */
-
-/*
- * NV_CTRL_DFP_SCALING_ACTIVE - not supported
- */
-
-#define NV_CTRL_DFP_SCALING_ACTIVE 254 /* R-DG */
-
-/*
- * NV_CTRL_FSAA_APPLICATION_ENHANCED - Controls how the NV_CTRL_FSAA_MODE
- * is applied when NV_CTRL_FSAA_APPLICATION_CONTROLLED is set to
- * NV_CTRL_APPLICATION_CONTROLLED_DISABLED. When
- * NV_CTRL_FSAA_APPLICATION_ENHANCED is _DISABLED, OpenGL applications will
- * be forced to use the FSAA mode specified by NV_CTRL_FSAA_MODE. when set
- * to _ENABLED, only those applications that have selected a multisample
- * FBConfig will be made to use the NV_CTRL_FSAA_MODE specified.
- *
- * This attribute is ignored when NV_CTRL_FSAA_APPLICATION_CONTROLLED is
- * set to NV_CTRL_FSAA_APPLICATION_CONTROLLED_ENABLED.
- */
-
-#define NV_CTRL_FSAA_APPLICATION_ENHANCED 255 /* RW-X */
-#define NV_CTRL_FSAA_APPLICATION_ENHANCED_ENABLED 1
-#define NV_CTRL_FSAA_APPLICATION_ENHANCED_DISABLED 0
-
-/*
- * NV_CTRL_FRAMELOCK_SYNC_RATE_4 - This is the refresh rate that the
- * frame lock board is sending to the GPU with 4 digits of precision.
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK.
- */
-
-#define NV_CTRL_FRAMELOCK_SYNC_RATE_4 256 /* R--F */
-
-/*
- * NV_CTRL_GVO_LOCK_OWNER - indicates that the GVO device is available
- * or in use (by GLX or an X screen).
- *
- * The GVO device is locked by GLX when either glXGetVideoDeviceNV
- * (part of GLX_NV_video_out) or glXBindVideoDeviceNV (part of
- * GLX_NV_present_video) is called. All GVO output resources are
- * locked until released by the GLX_NV_video_out/GLX_NV_present_video
- * client.
- *
- * The GVO device is locked/unlocked by an X screen, when the GVO device is
- * used in a MetaMode on an X screen.
- *
- * When the GVO device is locked, setting of the following GVO NV-CONTROL
- * attributes will not happen immediately and will instead be cached. The
- * GVO resource will need to be disabled/released and re-enabled/claimed for
- * the values to be flushed. These attributes are:
- *
- * NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT
- * NV_CTRL_GVO_DATA_FORMAT
- * NV_CTRL_GVO_FLIP_QUEUE_SIZE
- */
-
-#define NV_CTRL_GVO_LOCK_OWNER 257 /* R-- */
-#define NV_CTRL_GVO_LOCK_OWNER_NONE 0
-#define NV_CTRL_GVO_LOCK_OWNER_GLX 1
-#define NV_CTRL_GVO_LOCK_OWNER_CLONE /* no longer supported */ 2
-#define NV_CTRL_GVO_LOCK_OWNER_X_SCREEN 3
-
-/*
- * NV_CTRL_HWOVERLAY - when a workstation overlay is in use, reports
- * whether the hardware overlay is used, or if the overlay is emulated.
- */
-
-#define NV_CTRL_HWOVERLAY 258 /* R-- */
-#define NV_CTRL_HWOVERLAY_FALSE 0
-#define NV_CTRL_HWOVERLAY_TRUE 1
-
-/*
- * NV_CTRL_NUM_GPU_ERRORS_RECOVERED - Returns the number of GPU errors
- * occured. This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_NUM_GPU_ERRORS_RECOVERED 259 /* R--- */
-
-/*
- * NV_CTRL_REFRESH_RATE_3 - Returns the refresh rate of the specified
- * display device in 1000 * Hz (ie. to get the refresh rate in Hz, divide
- * the returned value by 1000.)
- *
- * This attribute may be queried through XNVCTRLQueryTargetAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_REFRESH_RATE_3 260 /* R-DG */
-
-/*
- * NV_CTRL_ONDEMAND_VBLANK_INTERRUPTS - if the OnDemandVBlankInterrupts
- * X driver option is set to true, this attribute can be used to
- * determine if on-demand VBlank interrupt control is enabled on the
- * specified GPU, as well as to enable or disable this feature.
- */
-
-#define NV_CTRL_ONDEMAND_VBLANK_INTERRUPTS 261 /* RW-G */
-#define NV_CTRL_ONDEMAND_VBLANK_INTERRUPTS_OFF 0
-#define NV_CTRL_ONDEMAND_VBLANK_INTERRUPTS_ON 1
-
-/*
- * NV_CTRL_GPU_POWER_SOURCE reports the type of power source
- * of the GPU driving the X screen.
- */
-
-#define NV_CTRL_GPU_POWER_SOURCE 262 /* R--G */
-#define NV_CTRL_GPU_POWER_SOURCE_AC 0
-#define NV_CTRL_GPU_POWER_SOURCE_BATTERY 1
-
-/*
- * NV_CTRL_GPU_CURRENT_PERFORMANCE_MODE is deprecated
- */
-
-#define NV_CTRL_GPU_CURRENT_PERFORMANCE_MODE 263 /* R--G */
-#define NV_CTRL_GPU_CURRENT_PERFORMANCE_MODE_DESKTOP 0
-#define NV_CTRL_GPU_CURRENT_PERFORMANCE_MODE_MAXPERF 1
-
-/* NV_CTRL_GLYPH_CACHE - Enables RENDER Glyph Caching to VRAM */
-
-#define NV_CTRL_GLYPH_CACHE 264 /* RW- */
-#define NV_CTRL_GLYPH_CACHE_DISABLED 0
-#define NV_CTRL_GLYPH_CACHE_ENABLED 1
-
-/*
- * NV_CTRL_GPU_CURRENT_PERFORMANCE_LEVEL reports the current
- * Performance level of the GPU driving the X screen. Each
- * Performance level has associated NVClock and Mem Clock values.
- */
-
-#define NV_CTRL_GPU_CURRENT_PERFORMANCE_LEVEL 265 /* R--G */
-
-/*
- * NV_CTRL_GPU_ADAPTIVE_CLOCK_STATE reports if Adaptive Clocking
- * is Enabled on the GPU driving the X screen.
- */
-
-#define NV_CTRL_GPU_ADAPTIVE_CLOCK_STATE 266 /* R--G */
-#define NV_CTRL_GPU_ADAPTIVE_CLOCK_STATE_DISABLED 0
-#define NV_CTRL_GPU_ADAPTIVE_CLOCK_STATE_ENABLED 1
-
-/*
- * NV_CTRL_GVO_OUTPUT_VIDEO_LOCKED - Returns whether or not the GVO output
- * video is locked to the GPU.
- */
-
-#define NV_CTRL_GVO_OUTPUT_VIDEO_LOCKED 267 /* R--- */
-#define NV_CTRL_GVO_OUTPUT_VIDEO_LOCKED_FALSE 0
-#define NV_CTRL_GVO_OUTPUT_VIDEO_LOCKED_TRUE 1
-
-/*
- * NV_CTRL_GVO_SYNC_LOCK_STATUS - Returns whether or not the GVO device
- * is locked to the input ref signal. If the sync mode is set to
- * NV_CTRL_GVO_SYNC_MODE_GENLOCK, then this returns the genlock
- * sync status, and if the sync mode is set to NV_CTRL_GVO_SYNC_MODE_FRAMELOCK,
- * then this reports the frame lock status.
- */
-
-#define NV_CTRL_GVO_SYNC_LOCK_STATUS 268 /* R--- */
-#define NV_CTRL_GVO_SYNC_LOCK_STATUS_UNLOCKED 0
-#define NV_CTRL_GVO_SYNC_LOCK_STATUS_LOCKED 1
-
-/*
- * NV_CTRL_GVO_ANC_TIME_CODE_GENERATION - Allows SDI device to generate
- * time codes in the ANC region of the SDI video output stream.
- */
-
-#define NV_CTRL_GVO_ANC_TIME_CODE_GENERATION 269 /* RW-- */
-#define NV_CTRL_GVO_ANC_TIME_CODE_GENERATION_DISABLE 0
-#define NV_CTRL_GVO_ANC_TIME_CODE_GENERATION_ENABLE 1
-
-/*
- * NV_CTRL_GVO_COMPOSITE - Enables/Disables SDI compositing. This attribute
- * is only available when an SDI input source is detected and is in genlock
- * mode.
- */
-
-#define NV_CTRL_GVO_COMPOSITE 270 /* RW-- */
-#define NV_CTRL_GVO_COMPOSITE_DISABLE 0
-#define NV_CTRL_GVO_COMPOSITE_ENABLE 1
-
-/*
- * NV_CTRL_GVO_COMPOSITE_ALPHA_KEY - When compositing is enabled, this
- * enables/disables alpha blending.
- */
-
-#define NV_CTRL_GVO_COMPOSITE_ALPHA_KEY 271 /* RW-- */
-#define NV_CTRL_GVO_COMPOSITE_ALPHA_KEY_DISABLE 0
-#define NV_CTRL_GVO_COMPOSITE_ALPHA_KEY_ENABLE 1
-
-/*
- * NV_CTRL_GVO_COMPOSITE_LUMA_KEY_RANGE - Set the values of a luma
- * channel range. This is a packed int that has the following format
- * (in order of high-bits to low bits):
- *
- * Range # (11 bits), (Enabled 1 bit), min value (10 bits), max value (10 bits)
- *
- * To query the current values, pass the range # throught the display_mask
- * variable.
- */
-
-#define NV_CTRL_GVO_COMPOSITE_LUMA_KEY_RANGE 272 /* RW-- */
-
-#define NV_CTRL_GVO_COMPOSITE_MAKE_RANGE(range, enable, min, max) \
- ((((min)&0x3FF) << 0) | (((max)&0x3FF) << 10) | (((enable)&0x1) << 20) | \
- (((range)&0x7FF) << 21))
-
-#define NV_CTRL_GVO_COMPOSITE_GET_RANGE(val, range, enable, min, max) \
- (min) = ((val) >> 0) & 0x3FF; \
- (max) = ((val) >> 10) & 0x3FF; \
- (enable) = ((val) >> 20) & 0x1; \
- (range) = ((val) >> 21) & 0x7FF;
-
-/*
- * NV_CTRL_GVO_COMPOSITE_CR_KEY_RANGE - Set the values of a CR
- * channel range. This is a packed int that has the following format
- * (in order of high-bits to low bits):
- *
- * Range # (11 bits), (Enabled 1 bit), min value (10 bits), max value (10 bits)
- *
- * To query the current values, pass the range # throught he display_mask
- * variable.
- */
-
-#define NV_CTRL_GVO_COMPOSITE_CR_KEY_RANGE 273 /* RW-- */
-
-/*
- * NV_CTRL_GVO_COMPOSITE_CB_KEY_RANGE - Set the values of a CB
- * channel range. This is a packed int that has the following format
- * (in order of high-bits to low bits):
- *
- * Range # (11 bits), (Enabled 1 bit), min value (10 bits), max value (10 bits)
- *
- * To query the current values, pass the range # throught he display_mask
- * variable.
- */
-
-#define NV_CTRL_GVO_COMPOSITE_CB_KEY_RANGE 274 /* RW-- */
-
-/*
- * NV_CTRL_GVO_COMPOSITE_NUM_KEY_RANGES - Returns the number of ranges
- * available for each channel (Y/Luma, Cr, and Cb.)
- */
-
-#define NV_CTRL_GVO_COMPOSITE_NUM_KEY_RANGES 275 /* R--- */
-
-/*
- * NV_CTRL_SWITCH_TO_DISPLAYS - Can be used to select which displays
- * to switch to (as a hotkey event).
- */
-
-#define NV_CTRL_SWITCH_TO_DISPLAYS 276 /* -W- */
-
-/*
- * NV_CTRL_NOTEBOOK_DISPLAY_CHANGE_LID_EVENT - Event that notifies
- * when a notebook lid change occurs (i.e. when the lid is opened or
- * closed.) This attribute can be queried to retrieve the current
- * notebook lid status (opened/closed.)
- */
-
-#define NV_CTRL_NOTEBOOK_DISPLAY_CHANGE_LID_EVENT 277 /* RW- */
-#define NV_CTRL_NOTEBOOK_DISPLAY_CHANGE_LID_EVENT_CLOSE 0
-#define NV_CTRL_NOTEBOOK_DISPLAY_CHANGE_LID_EVENT_OPEN 1
-
-/*
- * NV_CTRL_NOTEBOOK_INTERNAL_LCD - Returns the display device mask of
- * the intenal LCD of a notebook.
- */
-
-#define NV_CTRL_NOTEBOOK_INTERNAL_LCD 278 /* R-- */
-
-/*
- * NV_CTRL_DEPTH_30_ALLOWED - returns whether the NVIDIA X driver supports
- * depth 30 on the specified X screen or GPU.
- */
-
-#define NV_CTRL_DEPTH_30_ALLOWED 279 /* R--G */
-
-/*
- * NV_CTRL_MODE_SET_EVENT This attribute is sent as an event
- * when hotkey, ctrl-alt-+/- or randr event occurs. Note that
- * This attribute cannot be set or queried and is meant to
- * be received by clients that wish to be notified of when
- * mode set events occur.
- */
-
-#define NV_CTRL_MODE_SET_EVENT 280 /* --- */
-
-/*
- * NV_CTRL_OPENGL_AA_LINE_GAMMA_VALUE - the gamma value used by
- * OpenGL when NV_CTRL_OPENGL_AA_LINE_GAMMA is enabled
- */
-
-#define NV_CTRL_OPENGL_AA_LINE_GAMMA_VALUE 281 /* RW-X */
-
-/*
- * NV_CTRL_VCSC_HIGH_PERF_MODE - Is used to both query High Performance Mode
- * status on the Visual Computing System, and also to enable or disable High
- * Performance Mode.
- */
-
-#define NV_CTRL_VCSC_HIGH_PERF_MODE 282 /* RW-V */
-#define NV_CTRL_VCSC_HIGH_PERF_MODE_DISABLE 0
-#define NV_CTRL_VCSC_HIGH_PERF_MODE_ENABLE 1
-
-/*
- * NV_CTRL_DISPLAYPORT_LINK_RATE - returns the negotiated lane bandwidth of the
- * DisplayPort main link.
- * This attribute is only available for DisplayPort flat panels.
- */
-
-#define NV_CTRL_DISPLAYPORT_LINK_RATE 291 /* R-DG */
-#define NV_CTRL_DISPLAYPORT_LINK_RATE_DISABLED 0x0
-#define NV_CTRL_DISPLAYPORT_LINK_RATE_1_62GBPS 0x6
-#define NV_CTRL_DISPLAYPORT_LINK_RATE_2_70GBPS 0xA
-
-/*
- * NV_CTRL_STEREO_EYES_EXCHANGE - Controls whether or not the left and right
- * eyes of a stereo image are flipped.
- */
-
-#define NV_CTRL_STEREO_EYES_EXCHANGE 292 /* RW-X */
-#define NV_CTRL_STEREO_EYES_EXCHANGE_OFF 0
-#define NV_CTRL_STEREO_EYES_EXCHANGE_ON 1
-
-/*
- * NV_CTRL_NO_SCANOUT - returns whether the special "NoScanout" mode is
- * enabled on the specified X screen or GPU; for details on this mode,
- * see the description of the "none" value for the "UseDisplayDevice"
- * X configuration option in the NVIDIA driver README.
- */
-
-#define NV_CTRL_NO_SCANOUT 293 /* R--G */
-#define NV_CTRL_NO_SCANOUT_DISABLED 0
-#define NV_CTRL_NO_SCANOUT_ENABLED 1
-
-/*
- * NV_CTRL_GVO_CSC_CHANGED_EVENT This attribute is sent as an event
- * when the color space conversion matrix has been altered by another
- * client.
- */
-
-#define NV_CTRL_GVO_CSC_CHANGED_EVENT 294 /* --- */
-
-/*
- * NV_CTRL_FRAMELOCK_SLAVEABLE - Returns a bitmask of the display devices
- * that are (currently) allowed to be selected as slave devices for the
- * given GPU
- */
-
-#define NV_CTRL_FRAMELOCK_SLAVEABLE 295 /* R-DG */
-
-/*
- * NV_CTRL_GVO_SYNC_TO_DISPLAY This attribute controls whether or not
- * the non-SDI display device will be sync'ed to the SDI display device
- * (when configured in TwinView, Clone Mode or when using the SDI device
- * with OpenGL).
- */
-
-#define NV_CTRL_GVO_SYNC_TO_DISPLAY 296 /* --- */
-#define NV_CTRL_GVO_SYNC_TO_DISPLAY_DISABLE 0
-#define NV_CTRL_GVO_SYNC_TO_DISPLAY_ENABLE 1
-
-/*
- * NV_CTRL_X_SERVER_UNIQUE_ID - returns a pseudo-unique identifier for this
- * X server. Intended for use in cases where an NV-CONTROL client communicates
- * with multiple X servers, and wants some level of confidence that two
- * X Display connections correspond to the same or different X servers.
- */
-
-#define NV_CTRL_X_SERVER_UNIQUE_ID 297 /* R--- */
-
-/*
- * NV_CTRL_PIXMAP_CACHE - This attribute controls whether the driver attempts to
- * store video memory pixmaps in a cache. The cache speeds up allocation and
- * deallocation of pixmaps, but could use more memory than when the cache is
- * disabled.
- */
-
-#define NV_CTRL_PIXMAP_CACHE 298 /* RW-X */
-#define NV_CTRL_PIXMAP_CACHE_DISABLE 0
-#define NV_CTRL_PIXMAP_CACHE_ENABLE 1
-
-/*
- * NV_CTRL_PIXMAP_CACHE_ROUNDING_SIZE_KB - When the pixmap cache is enabled and
- * there is not enough free space in the cache to fit a new pixmap, the driver
- * will round up to the next multiple of this number of kilobytes when
- * allocating more memory for the cache.
- */
-
-#define NV_CTRL_PIXMAP_CACHE_ROUNDING_SIZE_KB 299 /* RW-X */
-
-/*
- * NV_CTRL_IS_GVO_DISPLAY - returns whether or not a given display is an
- * SDI device.
- */
-
-#define NV_CTRL_IS_GVO_DISPLAY 300 /* R-D */
-#define NV_CTRL_IS_GVO_DISPLAY_FALSE 0
-#define NV_CTRL_IS_GVO_DISPLAY_TRUE 1
-
-/*
- * NV_CTRL_PCI_ID - Returns the PCI vendor and device ID of the specified
- * device.
- *
- * NV_CTRL_PCI_ID is a "packed" integer attribute; the PCI vendor ID is stored
- * in the upper 16 bits of the integer, and the PCI device ID is stored in the
- * lower 16 bits of the integer.
- */
-
-#define NV_CTRL_PCI_ID 301 /* R--GI */
-
-/*
- * NV_CTRL_GVO_FULL_RANGE_COLOR - Allow full range color data [4-1019]
- * without clamping to [64-940].
- */
-
-#define NV_CTRL_GVO_FULL_RANGE_COLOR 302 /* RW- */
-#define NV_CTRL_GVO_FULL_RANGE_COLOR_DISABLED 0
-#define NV_CTRL_GVO_FULL_RANGE_COLOR_ENABLED 1
-
-/*
- * NV_CTRL_SLI_MOSAIC_MODE_AVAILABLE - Returns whether or not
- * SLI Mosaic Mode supported.
- */
-
-#define NV_CTRL_SLI_MOSAIC_MODE_AVAILABLE 303 /* R-- */
-#define NV_CTRL_SLI_MOSAIC_MODE_AVAILABLE_FALSE 0
-#define NV_CTRL_SLI_MOSAIC_MODE_AVAILABLE_TRUE 1
-
-/*
- * NV_CTRL_GVO_ENABLE_RGB_DATA - Allows clients to specify when
- * the GVO board should process colors as RGB when the output data
- * format is one of the NV_CTRL_GVO_DATA_FORMAT_???_PASSTRHU modes.
- */
-
-#define NV_CTRL_GVO_ENABLE_RGB_DATA 304 /* RW- */
-#define NV_CTRL_GVO_ENABLE_RGB_DATA_DISABLE 0
-#define NV_CTRL_GVO_ENABLE_RGB_DATA_ENABLE 1
-
-/*
- * NV_CTRL_IMAGE_SHARPENING_DEFAULT - Returns default value of
- * Image Sharpening.
- */
-
-#define NV_CTRL_IMAGE_SHARPENING_DEFAULT 305 /* R-- */
-
-/*
- * NV_CTRL_PCI_DOMAIN - Returns the PCI domain number the specified device is
- * using.
- */
-
-#define NV_CTRL_PCI_DOMAIN 306 /* R--GI */
-
-/*
- * NV_CTRL_GVI_NUM_JACKS - Returns the number of input BNC jacks available
- * on a GVI device.
- */
-
-#define NV_CTRL_GVI_NUM_JACKS 307 /* R--I */
-
-/*
- * NV_CTRL_GVI_MAX_LINKS_PER_STREAM - Returns the maximum supported number of
- * links that can be tied to one stream.
- */
-
-#define NV_CTRL_GVI_MAX_LINKS_PER_STREAM 308 /* R--I */
-
-/*
- * NV_CTRL_GVI_DETECTED_CHANNEL_BITS_PER_COMPONENT - Returns the detected
- * number of bits per component (BPC) of data on the given input jack+
- * channel.
- *
- * The jack number should be specified in the lower 16 bits of the
- * "display_mask" parameter, while the channel number should be specified in
- * the upper 16 bits.
- */
-
-#define NV_CTRL_GVI_DETECTED_CHANNEL_BITS_PER_COMPONENT 309 /* R--I */
-#define NV_CTRL_GVI_BITS_PER_COMPONENT_UNKNOWN 0
-#define NV_CTRL_GVI_BITS_PER_COMPONENT_8 1
-#define NV_CTRL_GVI_BITS_PER_COMPONENT_10 2
-#define NV_CTRL_GVI_BITS_PER_COMPONENT_12 3
-
-/*
- * NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT - Specify the number of
- * bits per component (BPC) of data for the captured stream.
- * The stream number should be specified in the "display_mask" parameter.
- *
- * Note: Setting this attribute may also result in the following
- * NV-CONTROL attributes being reset on the GVI device (to ensure
- * the configuration remains valid):
- * NV_CTRL_GVI_REQUESTED_STREAM_COMPONENT_SAMPLING
- */
-
-#define NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT 310 /* RW-I */
-
-/*
- * NV_CTRL_GVI_DETECTED_CHANNEL_COMPONENT_SAMPLING - Returns the detected
- * sampling format for the input jack+channel.
- *
- * The jack number should be specified in the lower 16 bits of the
- * "display_mask" parameter, while the channel number should be specified in
- * the upper 16 bits.
- */
-
-#define NV_CTRL_GVI_DETECTED_CHANNEL_COMPONENT_SAMPLING 311 /* R--I */
-#define NV_CTRL_GVI_COMPONENT_SAMPLING_UNKNOWN 0
-#define NV_CTRL_GVI_COMPONENT_SAMPLING_4444 1
-#define NV_CTRL_GVI_COMPONENT_SAMPLING_4224 2
-#define NV_CTRL_GVI_COMPONENT_SAMPLING_444 3
-#define NV_CTRL_GVI_COMPONENT_SAMPLING_422 4
-#define NV_CTRL_GVI_COMPONENT_SAMPLING_420 5
-
-/*
- * NV_CTRL_GVI_REQUESTED_COMPONENT_SAMPLING - Specify the sampling format for
- * the captured stream.
- * The possible values are the NV_CTRL_GVI_DETECTED_COMPONENT_SAMPLING
- * constants.
- * The stream number should be specified in the "display_mask" parameter.
- */
-
-#define NV_CTRL_GVI_REQUESTED_STREAM_COMPONENT_SAMPLING 312 /* RW-I */
-
-/*
- * NV_CTRL_GVI_CHROMA_EXPAND - Enable or disable 4:2:2 -> 4:4:4 chroma
- * expansion for the captured stream. This value is ignored when a
- * COMPONENT_SAMPLING format is selected that does not use chroma subsampling,
- * or if a BITS_PER_COMPONENT value is selected that is not supported.
- * The stream number should be specified in the "display_mask" parameter.
- */
-
-#define NV_CTRL_GVI_REQUESTED_STREAM_CHROMA_EXPAND 313 /* RW-I */
-#define NV_CTRL_GVI_CHROMA_EXPAND_FALSE 0
-#define NV_CTRL_GVI_CHROMA_EXPAND_TRUE 1
-
-/*
- * NV_CTRL_GVI_DETECTED_CHANNEL_COLOR_SPACE - Returns the detected color space
- * of the input jack+channel.
- *
- * The jack number should be specified in the lower 16 bits of the
- * "display_mask" parameter, while the channel number should be specified in
- * the upper 16 bits.
- */
-
-#define NV_CTRL_GVI_DETECTED_CHANNEL_COLOR_SPACE 314 /* R--I */
-#define NV_CTRL_GVI_COLOR_SPACE_UNKNOWN 0
-#define NV_CTRL_GVI_COLOR_SPACE_GBR 1
-#define NV_CTRL_GVI_COLOR_SPACE_GBRA 2
-#define NV_CTRL_GVI_COLOR_SPACE_GBRD 3
-#define NV_CTRL_GVI_COLOR_SPACE_YCBCR 4
-#define NV_CTRL_GVI_COLOR_SPACE_YCBCRA 5
-#define NV_CTRL_GVI_COLOR_SPACE_YCBCRD 6
-
-/*
- * NV_CTRL_GVI_DETECTED_CHANNEL_LINK_ID - Returns the detected link identifier
- * for the given input jack+channel.
- *
- * The jack number should be specified in the lower 16 bits of the
- * "display_mask" parameter, while the channel number should be specified in
- * the upper 16 bits.
- */
-
-#define NV_CTRL_GVI_DETECTED_CHANNEL_LINK_ID 315 /* R--I */
-#define NV_CTRL_GVI_LINK_ID_UNKNOWN 0xFFFF
-
-/*
- * NV_CTRL_GVI_DETECTED_CHANNEL_SMPTE352_IDENTIFIER - Returns the 4-byte
- * SMPTE 352 identifier from the given input jack+channel.
- *
- * The jack number should be specified in the lower 16 bits of the
- * "display_mask" parameter, while the channel number should be specified in
- * the upper 16 bits.
- */
-
-#define NV_CTRL_GVI_DETECTED_CHANNEL_SMPTE352_IDENTIFIER 316 /* R--I */
-
-/*
- * NV_CTRL_GVI_GLOBAL_IDENTIFIER - Returns a global identifier for the
- * GVI device. This identifier can be used to relate GVI devices named
- * in NV-CONTROL with those enumerated in OpenGL.
- */
-
-#define NV_CTRL_GVI_GLOBAL_IDENTIFIER 317 /* R--I */
-
-/*
- * NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION - Returns the number of nanoseconds
- * that one unit of NV_CTRL_FRAMELOCK_SYNC_DELAY corresponds to.
- */
-#define NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION 318 /* R-- */
-
-/*
- * NV_CTRL_GPU_COOLER_MANUAL_CONTROL - Query the current or set a new
- * cooler control state; the value of this attribute controls the
- * availability of additional cooler control attributes (see below).
- *
- * Note: this attribute is unavailable unless cooler control support
- * has been enabled in the X server (by the user).
- */
-
-#define NV_CTRL_GPU_COOLER_MANUAL_CONTROL 319 /* RW-G */
-#define NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE 0
-#define NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE 1
-
-/*
- * NV_CTRL_THERMAL_COOLER_LEVEL - Returns cooler's current operating
- * level.
- */
-
-#define NV_CTRL_THERMAL_COOLER_LEVEL 320 /* RW-C */
-
-/* NV_CTRL_THERMAL_COOLER_LEVEL_SET_DEFAULT - Sets default values of
- * cooler.
- */
-
-#define NV_CTRL_THERMAL_COOLER_LEVEL_SET_DEFAULT 321 /* -W-C */
-
-/*
- * NV_CTRL_THERMAL_COOLER_CONTROL_TYPE -
- * Returns a cooler's control signal characteristics.
- * The possible types are restricted, Variable and Toggle.
- */
-
-#define NV_CTRL_THERMAL_COOLER_CONTROL_TYPE 322 /* R--C */
-#define NV_CTRL_THERMAL_COOLER_CONTROL_TYPE_NONE 0
-#define NV_CTRL_THERMAL_COOLER_CONTROL_TYPE_TOGGLE 1
-#define NV_CTRL_THERMAL_COOLER_CONTROL_TYPE_VARIABLE 2
-
-/*
- * NV_CTRL_THERMAL_COOLER_TARGET - Returns objects that cooler cools.
- * Targets may be GPU, Memory, Power Supply or All of these.
- * GPU_RELATED = GPU | MEMORY | POWER_SUPPLY
- *
- */
-
-#define NV_CTRL_THERMAL_COOLER_TARGET 323 /* R--C */
-#define NV_CTRL_THERMAL_COOLER_TARGET_NONE 0
-#define NV_CTRL_THERMAL_COOLER_TARGET_GPU 1
-#define NV_CTRL_THERMAL_COOLER_TARGET_MEMORY 2
-#define NV_CTRL_THERMAL_COOLER_TARGET_POWER_SUPPLY 4
-#define NV_CTRL_THERMAL_COOLER_TARGET_GPU_RELATED \
- (NV_CTRL_THERMAL_COOLER_TARGET_GPU | NV_CTRL_THERMAL_COOLER_TARGET_MEMORY | \
- NV_CTRL_THERMAL_COOLER_TARGET_POWER_SUPPLY)
-
-/*
- * NV_CTRL_GPU_ECC_SUPPORTED - Reports whether ECC is supported by the
- * targeted GPU.
- */
-#define NV_CTRL_GPU_ECC_SUPPORTED 324 /* R--G */
-#define NV_CTRL_GPU_ECC_SUPPORTED_FALSE 0
-#define NV_CTRL_GPU_ECC_SUPPORTED_TRUE 1
-
-/*
- * NV_CTRL_GPU_ECC_STATUS - Returns the current hardware ECC setting
- * for the targeted GPU.
- */
-#define NV_CTRL_GPU_ECC_STATUS 325 /* R--G */
-#define NV_CTRL_GPU_ECC_STATUS_DISABLED 0
-#define NV_CTRL_GPU_ECC_STATUS_ENABLED 1
-
-/*
- * NV_CTRL_GPU_ECC_CONFIGURATION - Reports whether ECC can be configured
- * dynamically for the GPU in question.
- */
-#define NV_CTRL_GPU_ECC_CONFIGURATION_SUPPORTED 326 /* R--G */
-#define NV_CTRL_GPU_ECC_CONFIGURATION_SUPPORTED_FALSE 0
-#define NV_CTRL_GPU_ECC_CONFIGURATION_SUPPORTED_TRUE 1
-
-/*
- * NV_CTRL_GPU_ECC_CONFIGURATION_SETTING - Returns the current ECC
- * configuration setting or specifies new settings. New settings do not
- * take effect until the next POST.
- */
-#define NV_CTRL_GPU_ECC_CONFIGURATION 327 /* RW-G */
-#define NV_CTRL_GPU_ECC_CONFIGURATION_DISABLED 0
-#define NV_CTRL_GPU_ECC_CONFIGURATION_ENABLED 1
-
-/*
- * NV_CTRL_GPU_ECC_DEFAULT_CONFIGURATION_SETTING - Returns the default
- * ECC configuration setting.
- */
-#define NV_CTRL_GPU_ECC_DEFAULT_CONFIGURATION 328 /* R--G */
-#define NV_CTRL_GPU_ECC_DEFAULT_CONFIGURATION_DISABLED 0
-#define NV_CTRL_GPU_ECC_DEFAULT_CONFIGURATION_ENABLED 1
-
-/*
- * NV_CTRL_GPU_ECC_SINGLE_BIT_ERRORS - Returns the number of single-bit
- * ECC errors detected by the targeted GPU since the last POST.
- * Note: this attribute is a 64-bit integer attribute.
- */
-#define NV_CTRL_GPU_ECC_SINGLE_BIT_ERRORS 329 /* R--GQ */
-
-/*
- * NV_CTRL_GPU_ECC_DOUBLE_BIT_ERRORS - Returns the number of double-bit
- * ECC errors detected by the targeted GPU since the last POST.
- * Note: this attribute is a 64-bit integer attribute.
- */
-#define NV_CTRL_GPU_ECC_DOUBLE_BIT_ERRORS 330 /* R--GQ */
-
-/*
- * NV_CTRL_GPU_ECC_AGGREGATE_SINGLE_BIT_ERRORS - Returns the number of
- * single-bit ECC errors detected by the targeted GPU since the
- * last counter reset.
- * Note: this attribute is a 64-bit integer attribute.
- */
-#define NV_CTRL_GPU_ECC_AGGREGATE_SINGLE_BIT_ERRORS 331 /* R--GQ */
-
-/*
- * NV_CTRL_GPU_ECC_AGGREGATE_DOUBLE_BIT_ERRORS - Returns the number of
- * double-bit ECC errors detected by the targeted GPU since the
- * last counter reset.
- * Note: this attribute is a 64-bit integer attribute.
- */
-#define NV_CTRL_GPU_ECC_AGGREGATE_DOUBLE_BIT_ERRORS 332 /* R--GQ */
-
-/*
- * NV_CTRL_GPU_ECC_RESET_ERROR_STATUS - Resets the volatile/aggregate
- * single-bit and double-bit error counters. This attribute is a
- * bitmask attribute.
- */
-#define NV_CTRL_GPU_ECC_RESET_ERROR_STATUS 333 /* -W-G */
-#define NV_CTRL_GPU_ECC_RESET_ERROR_STATUS_VOLATILE 0x00000001
-#define NV_CTRL_GPU_ECC_RESET_ERROR_STATUS_AGGREGATE 0x00000002
-
-/*
- * NV_CTRL_GPU_POWER_MIZER_MODE - Provides a hint to the driver
- * as to how to manage the performance of the GPU.
- *
- * ADAPTIVE - adjust GPU clocks based on GPU
- * utilization
- * PREFER_MAXIMUM_PERFORMANCE - raise GPU clocks to favor
- * maximum performance, to the extent
- * that thermal and other constraints
- * allow
- */
-#define NV_CTRL_GPU_POWER_MIZER_MODE 334 /* RW-G */
-#define NV_CTRL_GPU_POWER_MIZER_MODE_ADAPTIVE 0
-#define NV_CTRL_GPU_POWER_MIZER_MODE_PREFER_MAXIMUM_PERFORMANCE 1
-
-/*
- * NV_CTRL_GVI_SYNC_OUTPUT_FORMAT - Returns the output sync signal
- * from the GVI device.
- */
-
-#define NV_CTRL_GVI_SYNC_OUTPUT_FORMAT 335 /* R--I */
-
-/*
- * NV_CTRL_GVI_MAX_CHANNELS_PER_JACK - Returns the maximum
- * supported number of (logical) channels within a single physical jack of
- * a GVI device. For most SDI video formats, there is only one channel
- * (channel 0). But for 3G video formats (as specified in SMPTE 425),
- * as an example, there are two channels (channel 0 and channel 1) per
- * physical jack.
- */
-
-#define NV_CTRL_GVI_MAX_CHANNELS_PER_JACK 336 /* R--I */
-
-/*
- * NV_CTRL_GVI_MAX_STREAMS - Returns the maximum number of streams
- * that can be configured on the GVI device.
- */
-
-#define NV_CTRL_GVI_MAX_STREAMS 337 /* R--I */
-
-/*
- * NV_CTRL_GVI_NUM_CAPTURE_SURFACES - The GVI interface exposed through
- * NV-CONTROL and the GLX_NV_video_input extension uses internal capture
- * surfaces when frames are read from the GVI device. The
- * NV_CTRL_GVI_NUM_CAPTURE_SURFACES can be used to query and assign the
- * number of capture surfaces. This attribute is applied when
- * glXBindVideoCaptureDeviceNV() is called by the application.
- *
- * A lower number of capture surfaces will mean less video memory is used,
- * but can result in frames being dropped if the application cannot keep up
- * with the capture device. A higher number will prevent frames from being
- * dropped, making capture more reliable but will consume move video memory.
- */
-#define NV_CTRL_GVI_NUM_CAPTURE_SURFACES 338 /* RW-I */
-
-/*
- * NV_CTRL_OVERSCAN_COMPENSATION - not supported
- */
-#define NV_CTRL_OVERSCAN_COMPENSATION 339 /* RWDG */
-
-/*
- * NV_CTRL_GPU_PCIE_GENERATION - Reports the current PCIe generation.
- */
-#define NV_CTRL_GPU_PCIE_GENERATION 341 /* R--GI */
-#define NV_CTRL_GPU_PCIE_GENERATION1 0x00000001
-#define NV_CTRL_GPU_PCIE_GENERATION2 0x00000002
-#define NV_CTRL_GPU_PCIE_GENERATION3 0x00000003
-
-/*
- * NV_CTRL_GVI_BOUND_GPU - Returns the NV_CTRL_TARGET_TYPE_GPU target_id of
- * the GPU currently bound to the GVI device. Returns -1 if no GPU is
- * currently bound to the GVI device.
- */
-#define NV_CTRL_GVI_BOUND_GPU 342 /* R--I */
-
-/*
- * NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT3 - this attribute is only
- * intended to be used to query the ValidValues for
- * NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT for VIDEO_FORMAT values between
- * 64 and 95. See NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT for details.
- */
-
-#define NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT3 343 /* ---GI */
-
-/*
- * NV_CTRL_ACCELERATE_TRAPEZOIDS - Toggles RENDER Trapezoid acceleration
- */
-
-#define NV_CTRL_ACCELERATE_TRAPEZOIDS 344 /* RW- */
-#define NV_CTRL_ACCELERATE_TRAPEZOIDS_DISABLE 0
-#define NV_CTRL_ACCELERATE_TRAPEZOIDS_ENABLE 1
-
-/*
- * NV_CTRL_GPU_CORES - Returns number of GPU cores supported by the graphics
- * pipeline.
- */
-
-#define NV_CTRL_GPU_CORES 345 /* R--G */
-
-/*
- * NV_CTRL_GPU_MEMORY_BUS_WIDTH - Returns memory bus bandwidth on the associated
- * subdevice.
- */
-
-#define NV_CTRL_GPU_MEMORY_BUS_WIDTH 346 /* R--G */
-
-/*
- * NV_CTRL_GVI_TEST_MODE - This attribute controls the GVI test mode. When
- * enabled, the GVI device will generate fake data as quickly as possible. All
- * GVI settings are still valid when this is enabled (e.g., the requested video
- * format is honored and sets the video size).
- * This may be used to test the pipeline.
- */
-
-#define NV_CTRL_GVI_TEST_MODE 347 /* R--I */
-#define NV_CTRL_GVI_TEST_MODE_DISABLE 0
-#define NV_CTRL_GVI_TEST_MODE_ENABLE 1
-
-/*
- * NV_CTRL_COLOR_SPACE - This option sets color space of the video
- * signal.
- */
-#define NV_CTRL_COLOR_SPACE 348 /* RWDG */
-#define NV_CTRL_COLOR_SPACE_RGB 0
-#define NV_CTRL_COLOR_SPACE_YCbCr422 1
-#define NV_CTRL_COLOR_SPACE_YCbCr444 2
-
-/*
- * NV_CTRL_COLOR_RANGE - This option sets color range of the video
- * signal.
- */
-#define NV_CTRL_COLOR_RANGE 349 /* RWDG */
-#define NV_CTRL_COLOR_RANGE_FULL 0
-#define NV_CTRL_COLOR_RANGE_LIMITED 1
-
-/*
- * NV_CTRL_GPU_SCALING_DEFAULT_TARGET - not supported
- *
- * NV_CTRL_GPU_SCALING_DEFAULT_METHOD - not supported
- */
-#define NV_CTRL_GPU_SCALING_DEFAULT_TARGET 350 /* R-DG */
-#define NV_CTRL_GPU_SCALING_DEFAULT_METHOD 351 /* R-DG */
-
-/*
- * NV_CTRL_DITHERING_MODE - Controls the dithering mode, when
- * NV_CTRL_CURRENT_DITHERING is Enabled.
- *
- * AUTO: allow the driver to choose the dithering mode automatically.
- *
- * DYNAMIC_2X2: use a 2x2 matrix to dither from the GPU's pixel
- * pipeline to the bit depth of the flat panel. The matrix values
- * are changed from frame to frame.
- *
- * STATIC_2X2: use a 2x2 matrix to dither from the GPU's pixel
- * pipeline to the bit depth of the flat panel. The matrix values
- * do not change from frame to frame.
- *
- * TEMPORAL: use a pseudorandom value from a uniform distribution calculated at
- * every pixel to achieve stochastic dithering. This method produces a better
- * visual result than 2x2 matrix approaches.
- */
-#define NV_CTRL_DITHERING_MODE 352 /* RWDG */
-#define NV_CTRL_DITHERING_MODE_AUTO 0
-#define NV_CTRL_DITHERING_MODE_DYNAMIC_2X2 1
-#define NV_CTRL_DITHERING_MODE_STATIC_2X2 2
-#define NV_CTRL_DITHERING_MODE_TEMPORAL 3
-
-/*
- * NV_CTRL_CURRENT_DITHERING - Returns the current dithering state.
- */
-#define NV_CTRL_CURRENT_DITHERING 353 /* R-DG */
-#define NV_CTRL_CURRENT_DITHERING_DISABLED 0
-#define NV_CTRL_CURRENT_DITHERING_ENABLED 1
-
-/*
- * NV_CTRL_CURRENT_DITHERING_MODE - Returns the current dithering
- * mode.
- */
-#define NV_CTRL_CURRENT_DITHERING_MODE 354 /* R-DG */
-#define NV_CTRL_CURRENT_DITHERING_MODE_NONE 0
-#define NV_CTRL_CURRENT_DITHERING_MODE_DYNAMIC_2X2 1
-#define NV_CTRL_CURRENT_DITHERING_MODE_STATIC_2X2 2
-#define NV_CTRL_CURRENT_DITHERING_MODE_TEMPORAL 3
-
-/*
- * NV_CTRL_THERMAL_SENSOR_READING - Returns the thermal sensor's current
- * reading.
- */
-#define NV_CTRL_THERMAL_SENSOR_READING 355 /* R--S */
-
-/*
- * NV_CTRL_THERMAL_SENSOR_PROVIDER - Returns the hardware device that
- * provides the thermal sensor.
- */
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER 356 /* R--S */
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_NONE 0
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_GPU_INTERNAL 1
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_ADM1032 2
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_ADT7461 3
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_MAX6649 4
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_MAX1617 5
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_LM99 6
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_LM89 7
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_LM64 8
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_G781 9
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_ADT7473 10
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_SBMAX6649 11
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_VBIOSEVT 12
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_OS 13
-#define NV_CTRL_THERMAL_SENSOR_PROVIDER_UNKNOWN 0xFFFFFFFF
-
-/*
- * NV_CTRL_THERMAL_SENSOR_TARGET - Returns what hardware component
- * the thermal sensor is measuring.
- */
-#define NV_CTRL_THERMAL_SENSOR_TARGET 357 /* R--S */
-#define NV_CTRL_THERMAL_SENSOR_TARGET_NONE 0
-#define NV_CTRL_THERMAL_SENSOR_TARGET_GPU 1
-#define NV_CTRL_THERMAL_SENSOR_TARGET_MEMORY 2
-#define NV_CTRL_THERMAL_SENSOR_TARGET_POWER_SUPPLY 4
-#define NV_CTRL_THERMAL_SENSOR_TARGET_BOARD 8
-#define NV_CTRL_THERMAL_SENSOR_TARGET_UNKNOWN 0xFFFFFFFF
-
-/*
- * NV_CTRL_SHOW_MULTIGPU_VISUAL_INDICATOR - when TRUE, OpenGL will
- * draw information about the current MULTIGPU mode.
- */
-#define NV_CTRL_SHOW_MULTIGPU_VISUAL_INDICATOR 358 /* RW-X */
-#define NV_CTRL_SHOW_MULTIGPU_VISUAL_INDICATOR_FALSE 0
-#define NV_CTRL_SHOW_MULTIGPU_VISUAL_INDICATOR_TRUE 1
-
-/*
- * NV_CTRL_GPU_CURRENT_PROCESSOR_CLOCK_FREQS - Returns GPU's processor
- * clock freqs.
- */
-#define NV_CTRL_GPU_CURRENT_PROCESSOR_CLOCK_FREQS 359 /* RW-G */
-
-/*
- * NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS - query the flags (various information
- * for the specified NV_CTRL_GVIO_VIDEO_FORMAT_*. So that this can be
- * queried with existing interfaces, the video format should be specified
- * in the display_mask field; eg:
- *
- * XNVCTRLQueryTargetAttribute(dpy,
- * NV_CTRL_TARGET_TYPE_GVI,
- * gvi,
- * NV_CTRL_GVIO_VIDEO_FORMAT_720P_60_00_SMPTE296,
- * NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS,
- * &flags);
- *
- * Note: The NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_3G_1080P_NO_12BPC flag is set
- * for those 1080P 3G modes (level A and B) that do not support
- * 12 bits per component (when configuring a GVI stream.)
- */
-
-#define NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS 360 /* R--I */
-#define NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_NONE 0x00000000
-#define NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_INTERLACED 0x00000001
-#define NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_PROGRESSIVE 0x00000002
-#define NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_PSF 0x00000004
-#define NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_3G_LEVEL_A 0x00000008
-#define NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_3G_LEVEL_B 0x00000010
-#define NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_3G \
- ((NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_3G_LEVEL_A) | (NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_3G_LEVEL_B))
-#define NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_3G_1080P_NO_12BPC 0x00000020
-
-/*
- * NV_CTRL_GPU_PCIE_MAX_LINK_SPEED - returns maximum PCIe link speed,
- * in gigatransfers per second (GT/s).
- */
-
-#define NV_CTRL_GPU_PCIE_MAX_LINK_SPEED 361 /* R--GI */
-
-/*
- * NV_CTRL_3D_VISION_PRO_RESET_TRANSCEIVER_TO_FACTORY_SETTINGS - Resets the
- * 3D Vision Pro transceiver to its factory settings.
- */
-#define NV_CTRL_3D_VISION_PRO_RESET_TRANSCEIVER_TO_FACTORY_SETTINGS 363 /* -W-T */
-
-/*
- * NV_CTRL_3D_VISION_PRO_TRANSCEIVER_CHANNEL - Controls the channel that is
- * currently used by the 3D Vision Pro transceiver.
- */
-#define NV_CTRL_3D_VISION_PRO_TRANSCEIVER_CHANNEL 364 /* RW-T */
-
-/*
- * NV_CTRL_3D_VISION_PRO_TRANSCEIVER_MODE - Controls the mode in which the
- * 3D Vision Pro transceiver operates.
- * NV_CTRL_3D_VISION_PRO_TM_LOW_RANGE is bidirectional
- * NV_CTRL_3D_VISION_PRO_TM_MEDIUM_RANGE is bidirectional
- * NV_CTRL_3D_VISION_PRO_TM_HIGH_RANGE may be bidirectional just up to a
- * given range, and unidirectional beyond it
- * NV_CTRL_3D_VISION_PRO_TM_COUNT is the total number of
- * 3D Vision Pro transceiver modes
- */
-#define NV_CTRL_3D_VISION_PRO_TRANSCEIVER_MODE 365 /* RW-T */
-#define NV_CTRL_3D_VISION_PRO_TRANSCEIVER_MODE_INVALID 0
-#define NV_CTRL_3D_VISION_PRO_TRANSCEIVER_MODE_LOW_RANGE 1
-#define NV_CTRL_3D_VISION_PRO_TRANSCEIVER_MODE_MEDIUM_RANGE 2
-#define NV_CTRL_3D_VISION_PRO_TRANSCEIVER_MODE_HIGH_RANGE 3
-#define NV_CTRL_3D_VISION_PRO_TRANSCEIVER_MODE_COUNT 4
-
-/*
- * NV_CTRL_SYNCHRONOUS_PALETTE_UPDATES - controls whether updates to the color
- * lookup table (LUT) are synchronous with respect to X rendering. For example,
- * if an X client sends XStoreColors followed by XFillRectangle, the driver will
- * guarantee that the FillRectangle request is not processed until after the
- * updated LUT colors are actually visible on the screen if
- * NV_CTRL_SYNCHRONOUS_PALETTE_UPDATES is enabled. Otherwise, the rendering may
- * occur first.
- *
- * This makes a difference for applications that use the LUT to animate, such as
- * XPilot. If you experience flickering in applications that use LUT
- * animations, try enabling this attribute.
- *
- * When synchronous updates are enabled, XStoreColors requests will be processed
- * at your screen's refresh rate.
- */
-
-#define NV_CTRL_SYNCHRONOUS_PALETTE_UPDATES 367 /* RWDG */
-#define NV_CTRL_SYNCHRONOUS_PALETTE_UPDATES_DISABLE 0
-#define NV_CTRL_SYNCHRONOUS_PALETTE_UPDATES_ENABLE 1
-
-/*
- * NV_CTRL_DITHERING_DEPTH - Controls the dithering depth when
- * NV_CTRL_CURRENT_DITHERING is ENABLED. Some displays connected
- * to the GPU via the DVI or LVDS interfaces cannot display the
- * full color range of ten bits per channel, so the GPU will
- * dither to either 6 or 8 bits per channel.
- */
-#define NV_CTRL_DITHERING_DEPTH 368 /* RWDG */
-#define NV_CTRL_DITHERING_DEPTH_AUTO 0
-#define NV_CTRL_DITHERING_DEPTH_6_BITS 1
-#define NV_CTRL_DITHERING_DEPTH_8_BITS 2
-
-/*
- * NV_CTRL_CURRENT_DITHERING_DEPTH - Returns the current dithering
- * depth value.
- */
-#define NV_CTRL_CURRENT_DITHERING_DEPTH 369 /* R-DG */
-#define NV_CTRL_CURRENT_DITHERING_DEPTH_NONE 0
-#define NV_CTRL_CURRENT_DITHERING_DEPTH_6_BITS 1
-#define NV_CTRL_CURRENT_DITHERING_DEPTH_8_BITS 2
-
-/*
- * NV_CTRL_3D_VISION_PRO_TRANSCEIVER_CHANNEL_FREQUENCY - Returns the
- * frequency of the channel(in kHz) of the 3D Vision Pro transceiver.
- * Use the display_mask parameter to specify the channel number.
- */
-#define NV_CTRL_3D_VISION_PRO_TRANSCEIVER_CHANNEL_FREQUENCY 370 /* R--T */
-
-/*
- * NV_CTRL_3D_VISION_PRO_TRANSCEIVER_CHANNEL_QUALITY - Returns the
- * quality of the channel(in percentage) of the 3D Vision Pro transceiver.
- * Use the display_mask parameter to specify the channel number.
- */
-#define NV_CTRL_3D_VISION_PRO_TRANSCEIVER_CHANNEL_QUALITY 371 /* R--T */
-
-/*
- * NV_CTRL_3D_VISION_PRO_TRANSCEIVER_CHANNEL_COUNT - Returns the number of
- * channels on the 3D Vision Pro transceiver.
- */
-#define NV_CTRL_3D_VISION_PRO_TRANSCEIVER_CHANNEL_COUNT 372 /* R--T */
-
-/*
- * NV_CTRL_3D_VISION_PRO_PAIR_GLASSES - Puts the 3D Vision Pro
- * transceiver into pairing mode to gather additional glasses.
- * NV_CTRL_3D_VISION_PRO_PAIR_GLASSES_STOP - stops any pairing
- * NV_CTRL_3D_VISION_PRO_PAIR_GLASSES_BEACON - starts continuous
- * pairing via beacon mode
- * Any other value, N - Puts the 3D Vision Pro transceiver into
- * authenticated pairing mode for N seconds.
- */
-#define NV_CTRL_3D_VISION_PRO_PAIR_GLASSES 373 /* -W-T */
-#define NV_CTRL_3D_VISION_PRO_PAIR_GLASSES_STOP 0
-#define NV_CTRL_3D_VISION_PRO_PAIR_GLASSES_BEACON 0xFFFFFFFF
-
-/*
- * NV_CTRL_3D_VISION_PRO_UNPAIR_GLASSES - Tells a specific pair
- * of glasses to unpair. The glasses will "forget" the address
- * of the 3D Vision Pro transceiver to which they have been paired.
- * To unpair all the currently paired glasses, specify
- * the glasses id as 0.
- */
-#define NV_CTRL_3D_VISION_PRO_UNPAIR_GLASSES 374 /* -W-T */
-
-/*
- * NV_CTRL_3D_VISION_PRO_DISCOVER_GLASSES - Tells the 3D Vision Pro
- * transceiver about the glasses that have been paired using
- * NV_CTRL_3D_VISION_PRO_PAIR_GLASSES_BEACON. Unless this is done,
- * the 3D Vision Pro transceiver will not know about glasses paired in
- * beacon mode.
- */
-#define NV_CTRL_3D_VISION_PRO_DISCOVER_GLASSES 375 /* -W-T */
-
-/*
- * NV_CTRL_3D_VISION_PRO_IDENTIFY_GLASSES - Causes glasses LEDs to
- * flash for a short period of time.
- */
-#define NV_CTRL_3D_VISION_PRO_IDENTIFY_GLASSES 376 /* -W-T */
-
-/*
- * NV_CTRL_3D_VISION_PRO_GLASSES_SYNC_CYCLE - Controls the
- * sync cycle duration(in milliseconds) of the glasses.
- * Use the display_mask parameter to specify the glasses id.
- */
-#define NV_CTRL_3D_VISION_PRO_GLASSES_SYNC_CYCLE 378 /* RW-T */
-
-/*
- * NV_CTRL_3D_VISION_PRO_GLASSES_MISSED_SYNC_CYCLES - Returns the
- * number of state sync cycles recently missed by the glasses.
- * Use the display_mask parameter to specify the glasses id.
- */
-#define NV_CTRL_3D_VISION_PRO_GLASSES_MISSED_SYNC_CYCLES 379 /* R--T */
-
-/*
- * NV_CTRL_3D_VISION_PRO_GLASSES_BATTERY_LEVEL - Returns the
- * battery level(in percentage) of the glasses.
- * Use the display_mask parameter to specify the glasses id.
- */
-#define NV_CTRL_3D_VISION_PRO_GLASSES_BATTERY_LEVEL 380 /* R--T */
-
-/*
- * NV_CTRL_GVO_ANC_PARITY_COMPUTATION - Controls the SDI device's computation
- * of the parity bit (bit 8) for ANC data words.
- */
-
-#define NV_CTRL_GVO_ANC_PARITY_COMPUTATION 381 /* RW--- */
-#define NV_CTRL_GVO_ANC_PARITY_COMPUTATION_AUTO 0
-#define NV_CTRL_GVO_ANC_PARITY_COMPUTATION_ON 1
-#define NV_CTRL_GVO_ANC_PARITY_COMPUTATION_OFF 2
-
-/*
- * NV_CTRL_3D_VISION_PRO_GLASSES_PAIR_EVENT - This attribute is sent
- * as an event when glasses get paired in response to pair command
- * from any of the clients.
- */
-#define NV_CTRL_3D_VISION_PRO_GLASSES_PAIR_EVENT 382 /* ---T */
-
-/*
- * NV_CTRL_3D_VISION_PRO_GLASSES_UNPAIR_EVENT - This attribute is sent
- * as an event when glasses get unpaired in response to unpair command
- * from any of the clients.
- */
-#define NV_CTRL_3D_VISION_PRO_GLASSES_UNPAIR_EVENT 383 /* ---T */
-
-/*
- * NV_CTRL_GPU_PCIE_CURRENT_LINK_WIDTH - returns the current
- * PCIe link width, in number of lanes.
- */
-#define NV_CTRL_GPU_PCIE_CURRENT_LINK_WIDTH 384 /* R--GI */
-
-/*
- * NV_CTRL_GPU_PCIE_CURRENT_LINK_SPEED - returns the current
- * PCIe link speed, in megatransfers per second (GT/s).
- */
-#define NV_CTRL_GPU_PCIE_CURRENT_LINK_SPEED 385 /* R--GI */
-
-/*
- * NV_CTRL_GVO_AUDIO_BLANKING - specifies whether the GVO device should delete
- * audio ancillary data packets when frames are repeated.
- *
- * When a new frame is not ready in time, the current frame, including all
- * ancillary data packets, is repeated. When this data includes audio packets,
- * this can result in stutters or clicks. When this option is enabled, the GVO
- * device will detect when frames are repeated, identify audio ancillary data
- * packets, and mark them for deletion.
- *
- * This option is applied when the GVO device is bound.
- */
-#define NV_CTRL_GVO_AUDIO_BLANKING 386 /* RW- */
-#define NV_CTRL_GVO_AUDIO_BLANKING_DISABLE 0
-#define NV_CTRL_GVO_AUDIO_BLANKING_ENABLE 1
-
-/*
- * NV_CTRL_CURRENT_METAMODE_ID - switch modes to the MetaMode with
- * the specified ID.
- */
-#define NV_CTRL_CURRENT_METAMODE_ID 387 /* RW- */
-
-/*
- * NV_CTRL_DISPLAY_ENABLED - Returns whether or not the display device
- * is currently enabled.
- */
-#define NV_CTRL_DISPLAY_ENABLED 388 /* R-D */
-#define NV_CTRL_DISPLAY_ENABLED_TRUE 1
-#define NV_CTRL_DISPLAY_ENABLED_FALSE 0
-
-#define NV_CTRL_LAST_ATTRIBUTE NV_CTRL_DISPLAY_ENABLED
-
-/**************************************************************************/
-
-/*
- * String Attributes:
- *
- * String attributes can be queryied through the XNVCTRLQueryStringAttribute()
- * and XNVCTRLQueryTargetStringAttribute() function calls.
- *
- * String attributes can be set through the XNVCTRLSetStringAttribute()
- * function call. (There are currently no string attributes that can be
- * set on non-X Screen targets.)
- *
- * Unless otherwise noted, all string attributes can be queried/set using an
- * NV_CTRL_TARGET_TYPE_X_SCREEN target. Attributes that cannot take an
- * NV_CTRL_TARGET_TYPE_X_SCREEN target also cannot be queried/set through
- * XNVCTRLQueryStringAttribute()/XNVCTRLSetStringAttribute() (Since
- * these assume an X Screen target).
- */
-
-/*
- * NV_CTRL_STRING_PRODUCT_NAME - the GPU product name on which the
- * specified X screen is running.
- *
- * This attribute may be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_STRING_PRODUCT_NAME 0 /* R--G */
-
-/*
- * NV_CTRL_STRING_VBIOS_VERSION - the video bios version on the GPU on
- * which the specified X screen is running.
- */
-
-#define NV_CTRL_STRING_VBIOS_VERSION 1 /* R--G */
-
-/*
- * NV_CTRL_STRING_NVIDIA_DRIVER_VERSION - string representation of the
- * NVIDIA driver version number for the NVIDIA X driver in use.
- */
-
-#define NV_CTRL_STRING_NVIDIA_DRIVER_VERSION 3 /* R--G */
-
-/*
- * NV_CTRL_STRING_DISPLAY_DEVICE_NAME - name of the display device
- * specified in the display_mask argument.
- *
- * This attribute may be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_STRING_DISPLAY_DEVICE_NAME 4 /* R-DG */
-
-/*
- * NV_CTRL_STRING_TV_ENCODER_NAME - name of the TV encoder used by the
- * specified display device; only valid if the display device is a TV.
- */
-
-#define NV_CTRL_STRING_TV_ENCODER_NAME 5 /* R-DG */
-
-/*
- * NV_CTRL_STRING_GVIO_FIRMWARE_VERSION - indicates the version of the
- * Firmware on the GVIO device.
- */
-
-#define NV_CTRL_STRING_GVIO_FIRMWARE_VERSION 8 /* R--I */
-
-/*
- * The following is deprecated; use NV_CTRL_STRING_GVIO_FIRMWARE_VERSION,
- * instead
- */
-#define NV_CTRL_STRING_GVO_FIRMWARE_VERSION 8 /* R-- */
-
-/*
- * NV_CTRL_STRING_CURRENT_MODELINE - Return the ModeLine currently
- * being used by the specified display device.
- *
- * This attribute may be queried through XNVCTRLQueryTargetStringAttribute()
- * using an NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- *
- * The ModeLine string may be prepended with a comma-separated list of
- * "token=value" pairs, separated from the ModeLine string by "::".
- * This "token=value" syntax is the same as that used in
- * NV_CTRL_BINARY_DATA_MODELINES
- */
-
-#define NV_CTRL_STRING_CURRENT_MODELINE 9 /* R-DG */
-
-/*
- * NV_CTRL_STRING_ADD_MODELINE - Adds a ModeLine to the specified
- * display device. The ModeLine is not added if validation fails.
- *
- * The ModeLine string should have the same syntax as a ModeLine in
- * the X configuration file; e.g.,
- *
- * "1600x1200" 229.5 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync
- */
-
-#define NV_CTRL_STRING_ADD_MODELINE 10 /* -WDG */
-
-/*
- * NV_CTRL_STRING_DELETE_MODELINE - Deletes an existing ModeLine
- * from the specified display device. The currently selected
- * ModeLine cannot be deleted. (This also means you cannot delete
- * the last ModeLine.)
- *
- * The ModeLine string should have the same syntax as a ModeLine in
- * the X configuration file; e.g.,
- *
- * "1600x1200" 229.5 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync
- */
-
-#define NV_CTRL_STRING_DELETE_MODELINE 11 /* -WDG */
-
-/*
- * NV_CTRL_STRING_CURRENT_METAMODE - Returns the metamode currently
- * being used by the specified X screen. The MetaMode string has the
- * same syntax as the MetaMode X configuration option, as documented
- * in the NVIDIA driver README.
- *
- * The returned string may be prepended with a comma-separated list of
- * "token=value" pairs, separated from the MetaMode string by "::".
- * This "token=value" syntax is the same as that used in
- * NV_CTRL_BINARY_DATA_METAMODES.
- */
-
-#define NV_CTRL_STRING_CURRENT_METAMODE 12 /* RW-- */
-#define NV_CTRL_STRING_CURRENT_METAMODE_VERSION_1 NV_CTRL_STRING_CURRENT_METAMODE
-
-/*
- * NV_CTRL_STRING_ADD_METAMODE - Adds a MetaMode to the specified
- * X Screen.
- *
- * It is recommended to not use this attribute, but instead use
- * NV_CTRL_STRING_OPERATION_ADD_METAMODE.
- */
-
-#define NV_CTRL_STRING_ADD_METAMODE 13 /* -W-- */
-
-/*
- * NV_CTRL_STRING_DELETE_METAMODE - Deletes an existing MetaMode from
- * the specified X Screen. The currently selected MetaMode cannot be
- * deleted. (This also means you cannot delete the last MetaMode).
- * The MetaMode string should have the same syntax as the MetaMode X
- * configuration option, as documented in the NVIDIA driver README.
- */
-
-#define NV_CTRL_STRING_DELETE_METAMODE 14 /* -WD-- */
-
-/*
- * NV_CTRL_STRING_VCSC_PRODUCT_NAME - Querys the product name of the
- * VCSC device.
- *
- * This attribute must be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_VCSC target.
- */
-
-#define NV_CTRL_STRING_VCSC_PRODUCT_NAME 15 /* R---V */
-
-/*
- * NV_CTRL_STRING_VCSC_PRODUCT_ID - Querys the product ID of the VCSC device.
- *
- * This attribute must be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_VCSC target.
- */
-
-#define NV_CTRL_STRING_VCSC_PRODUCT_ID 16 /* R---V */
-
-/*
- * NV_CTRL_STRING_VCSC_SERIAL_NUMBER - Querys the unique serial number
- * of the VCS device.
- *
- * This attribute must be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_VCSC target.
- */
-
-#define NV_CTRL_STRING_VCSC_SERIAL_NUMBER 17 /* R---V */
-
-/*
- * NV_CTRL_STRING_VCSC_BUILD_DATE - Querys the date of the VCS device.
- * the returned string is in the following format: "Week.Year"
- *
- * This attribute must be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_VCSC target.
- */
-
-#define NV_CTRL_STRING_VCSC_BUILD_DATE 18 /* R---V */
-
-/*
- * NV_CTRL_STRING_VCSC_FIRMWARE_VERSION - Querys the firmware version
- * of the VCS device.
- *
- * This attribute must be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_VCSC target.
- */
-
-#define NV_CTRL_STRING_VCSC_FIRMWARE_VERSION 19 /* R---V */
-
-/*
- * NV_CTRL_STRING_VCSC_FIRMWARE_REVISION - Querys the firmware revision
- * of the VCS device.
- *
- * This attribute must be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_VCS target.
- */
-
-#define NV_CTRL_STRING_VCSC_FIRMWARE_REVISION 20 /* R---V */
-
-/*
- * NV_CTRL_STRING_VCSC_HARDWARE_VERSION - Querys the hardware version
- * of the VCS device.
- *
- * This attribute must be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_VCSC target.
- */
-
-#define NV_CTRL_STRING_VCSC_HARDWARE_VERSION 21 /* R---V */
-
-/*
- * NV_CTRL_STRING_VCSC_HARDWARE_REVISION - Querys the hardware revision
- * of the VCS device.
- *
- * This attribute must be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_VCSC target.
- */
-
-#define NV_CTRL_STRING_VCSC_HARDWARE_REVISION 22 /* R---V */
-
-/*
- * NV_CTRL_STRING_MOVE_METAMODE - Moves a MetaMode to the specified
- * index location. The MetaMode must already exist in the X Screen's
- * list of MetaModes (as returned by the NV_CTRL_BINARY_DATA_METAMODES
- * attribute). If the index is larger than the number of MetaModes in
- * the list, the MetaMode is moved to the end of the list. The
- * MetaMode string should have the same syntax as the MetaMode X
- * configuration option, as documented in the NVIDIA driver README.
-
- * The MetaMode string must be prepended with a comma-separated list
- * of "token=value" pairs, separated from the MetaMode string by "::".
- * Currently, the only valid token is "index", which indicates where
- * in the MetaMode list the MetaMode should be moved to.
- *
- * Other tokens may be added in the future.
- *
- * E.g.,
- * "index=5 :: CRT-0: 1024x768 @1024x768 +0+0"
- */
-
-#define NV_CTRL_STRING_MOVE_METAMODE 23 /* -W-- */
-
-/*
- * NV_CTRL_STRING_VALID_HORIZ_SYNC_RANGES - returns the valid
- * horizontal sync ranges used to perform mode validation for the
- * specified display device. The ranges are in the same format as the
- * "HorizSync" X config option:
- *
- * "horizsync-range may be a comma separated list of either discrete
- * values or ranges of values. A range of values is two values
- * separated by a dash."
- *
- * The values are in kHz.
- *
- * Additionally, the string may be prepended with a comma-separated
- * list of "token=value" pairs, separated from the HorizSync string by
- * "::". Valid tokens:
- *
- * Token Value
- * "source" "edid" - HorizSync is from the display device's EDID
- * "xconfig" - HorizSync is from the "HorizSync" entry in
- * the Monitor section of the X config file
- * "option" - HorizSync is from the "HorizSync" NVIDIA X
- * config option
- * "twinview" - HorizSync is from the "SecondMonitorHorizSync"
- * NVIDIA X config option
- * "builtin" - HorizSync is from NVIDIA X driver builtin
- * default values
- *
- * Additional tokens and/or values may be added in the future.
- *
- * Example: "source=edid :: 30.000-62.000"
- */
-
-#define NV_CTRL_STRING_VALID_HORIZ_SYNC_RANGES 24 /* R-DG */
-
-/*
- * NV_CTRL_STRING_VALID_VERT_REFRESH_RANGES - returns the valid
- * vertical refresh ranges used to perform mode validation for the
- * specified display device. The ranges are in the same format as the
- * "VertRefresh" X config option:
- *
- * "vertrefresh-range may be a comma separated list of either discrete
- * values or ranges of values. A range of values is two values
- * separated by a dash."
- *
- * The values are in Hz.
- *
- * Additionally, the string may be prepended with a comma-separated
- * list of "token=value" pairs, separated from the VertRefresh string by
- * "::". Valid tokens:
- *
- * Token Value
- * "source" "edid" - VertRefresh is from the display device's EDID
- * "xconfig" - VertRefresh is from the "VertRefresh" entry in
- * the Monitor section of the X config file
- * "option" - VertRefresh is from the "VertRefresh" NVIDIA X
- * config option
- * "twinview" - VertRefresh is from the "SecondMonitorVertRefresh"
- * NVIDIA X config option
- * "builtin" - VertRefresh is from NVIDIA X driver builtin
- * default values
- *
- * Additional tokens and/or values may be added in the future.
- *
- * Example: "source=edid :: 50.000-75.000"
- */
-
-#define NV_CTRL_STRING_VALID_VERT_REFRESH_RANGES 25 /* R-DG */
-
-/*
- * NV_CTRL_STRING_XINERAMA_SCREEN_INFO - returns the physical X Screen's
- * initial position and size (in absolute coordinates) within the Xinerama
- * desktop as the "token=value" string: "x=#, y=#, width=#, height=#"
- *
- * Querying this attribute returns FALSE if NV_CTRL_XINERAMA is not
- * NV_CTRL_XINERAMA_ON.
- */
-
-#define NV_CTRL_STRING_XINERAMA_SCREEN_INFO 26 /* R--- */
-
-/*
- * NV_CTRL_STRING_TWINVIEW_XINERAMA_INFO_ORDER - used to specify the
- * order that display devices will be returned via Xinerama when
- * nvidiaXineramaInfo is enabled. Follows the same syntax as the
- * nvidiaXineramaInfoOrder X config option.
- */
-
-#define NV_CTRL_STRING_NVIDIA_XINERAMA_INFO_ORDER 27 /* RW-- */
-
-#define NV_CTRL_STRING_TWINVIEW_XINERAMA_INFO_ORDER \
- NV_CTRL_STRING_NVIDIA_XINERAMA_INFO_ORDER /* for backwards compatibility: */
-
-/*
- * NV_CTRL_STRING_SLI_MODE - returns a string describing the current
- * SLI mode, if any, or FALSE if SLI is not currently enabled.
- *
- * This string should be used for informational purposes only, and
- * should not be used to distinguish between SLI modes, other than to
- * recognize when SLI is disabled (FALSE is returned) or
- * enabled (the returned string is non-NULL and describes the current
- * SLI configuration).
- */
-
-#define NV_CTRL_STRING_SLI_MODE 28 /* R---*/
-
-/*
- * NV_CTRL_STRING_PERFORMANCE_MODES - returns a string with all the
- * performance modes defined for this GPU along with their associated
- * NV Clock and Memory Clock values.
- *
- * Each performance modes are returned as a comma-separated list of
- * "token=value" pairs. Each set of performance mode tokens are separated
- * by a ";". Valid tokens:
- *
- * Token Value
- * "perf" integer - the Performance level
- * "nvclock" integer - the GPU clocks (in MHz) for the perf level
- * "memclock" integer - the memory clocks (in MHz) for the perf level
- *
- *
- * Example:
- *
- * perf=0, nvclock=500, memclock=505 ; perf=1, nvclock=650, memclock=505
- *
- * This attribute may be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_STRING_PERFORMANCE_MODES 29 /* R--G */
-
-/*
- * NV_CTRL_STRING_VCSC_FAN_STATUS - returns a string with status of all the
- * fans in the Visual Computing System, if such a query is supported. Fan
- * information is reported along with its tachometer reading (in RPM) and a
- * flag indicating whether the fan has failed or not.
- *
- * Valid tokens:
- *
- * Token Value
- * "fan" integer - the Fan index
- * "speed" integer - the tachometer reading of the fan in rpm
- * "fail" integer - flag to indicate whether the fan has failed
- *
- * Example:
- *
- * fan=0, speed=694, fail=0 ; fan=1, speed=693, fail=0
- *
- * This attribute must be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_VCSC target.
- *
- */
-
-#define NV_CTRL_STRING_VCSC_FAN_STATUS 30 /* R---V */
-
-/*
- * NV_CTRL_STRING_VCSC_TEMPERATURES - returns a string with all Temperature
- * readings in the Visual Computing System, if such a query is supported.
- * Intake, Exhaust and Board Temperature values are reported in Celcius.
- *
- * Valid tokens:
- *
- * Token Value
- * "intake" integer - the intake temperature for the VCS
- * "exhaust" integer - the exhaust temperature for the VCS
- * "board" integer - the board temperature of the VCS
- *
- * Example:
- *
- * intake=29, exhaust=46, board=41
- *
- * This attribute must be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_VCSC target.
- *
- */
-
-#define NV_CTRL_STRING_VCSC_TEMPERATURES 31 /* R---V */
-
-/*
- * NV_CTRL_STRING_VCSC_PSU_INFO - returns a string with all Power Supply Unit
- * related readings in the Visual Computing System, if such a query is
- * supported. Current in amperes, Power in watts, Voltage in volts and PSU
- * state may be reported. Not all PSU types support all of these values, and
- * therefore some readings may be unknown.
- *
- * Valid tokens:
- *
- * Token Value
- * "current" integer - the current drawn in amperes by the VCS
- * "power" integer - the power drawn in watts by the VCS
- * "voltage" integer - the voltage reading of the VCS
- * "state" integer - flag to indicate whether PSU is operating normally
- *
- * Example:
- *
- * current=10, power=15, voltage=unknown, state=normal
- *
- * This attribute must be queried through XNVCTRLQueryTargetStringAttribute()
- * using a NV_CTRL_TARGET_TYPE_VCSC target.
- *
- */
-
-#define NV_CTRL_STRING_VCSC_PSU_INFO 32 /* R---V */
-
-/*
- * NV_CTRL_STRING_GVIO_VIDEO_FORMAT_NAME - query the name for the specified
- * NV_CTRL_GVIO_VIDEO_FORMAT_*. So that this can be queried with existing
- * interfaces, XNVCTRLQueryStringAttribute() should be used, and the video
- * format specified in the display_mask field; eg:
- *
- * XNVCTRLQueryStringAttribute(dpy,
- * screen,
- * NV_CTRL_GVIO_VIDEO_FORMAT_720P_60_00_SMPTE296,
- * NV_CTRL_GVIO_VIDEO_FORMAT_NAME,
- * &name);
- */
-
-#define NV_CTRL_STRING_GVIO_VIDEO_FORMAT_NAME 33 /* R--GI */
-
-/*
- * The following is deprecated; use NV_CTRL_STRING_GVIO_VIDEO_FORMAT_NAME,
- * instead
- */
-#define NV_CTRL_STRING_GVO_VIDEO_FORMAT_NAME 33 /* R--- */
-
-/*
- * NV_CTRL_STRING_GPU_CURRENT_CLOCK_FREQS - returns a string with the
- * associated NV Clock, Memory Clock and Processor Clock values.
- *
- * Current valid tokens are "nvclock", "memclock", and "processorclock".
- * Not all tokens will be reported on all GPUs, and additional tokens
- * may be added in the future.
- *
- * Clock values are returned as a comma-separated list of
- * "token=value" pairs.
- * Valid tokens:
- *
- * Token Value
- * "nvclock" integer - the GPU clocks (in MHz) for the current
- * perf level
- * "memclock" integer - the memory clocks (in MHz) for the current
- * perf level
- * "processorclock" integer - the processor clocks (in MHz) for the perf level
- *
- *
- * Example:
- *
- * nvclock=459, memclock=400, processorclock=918
- *
- * This attribute may be queried through XNVCTRLQueryTargetStringAttribute()
- * using an NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_STRING_GPU_CURRENT_CLOCK_FREQS 34 /* RW-G */
-
-/*
- * NV_CTRL_STRING_3D_VISION_PRO_TRANSCEIVER_HARDWARE_REVISION - Returns the
- * hardware revision of the 3D Vision Pro transceiver.
- */
-#define NV_CTRL_STRING_3D_VISION_PRO_TRANSCEIVER_HARDWARE_REVISION 35 /* R--T */
-
-/*
- * NV_CTRL_STRING_3D_VISION_PRO_TRANSCEIVER_FIRMWARE_VERSION_A - Returns the
- * firmware version of chip A of the 3D Vision Pro transceiver.
- */
-#define NV_CTRL_STRING_3D_VISION_PRO_TRANSCEIVER_FIRMWARE_VERSION_A 36 /* R--T */
-
-/*
- * NV_CTRL_STRING_3D_VISION_PRO_TRANSCEIVER_FIRMWARE_DATE_A - Returns the
- * date of the firmware of chip A of the 3D Vision Pro transceiver.
- */
-#define NV_CTRL_STRING_3D_VISION_PRO_TRANSCEIVER_FIRMWARE_DATE_A 37 /* R--T */
-
-/*
- * NV_CTRL_STRING_3D_VISION_PRO_TRANSCEIVER_FIRMWARE_VERSION_B - Returns the
- * firmware version of chip B of the 3D Vision Pro transceiver.
- */
-#define NV_CTRL_STRING_3D_VISION_PRO_TRANSCEIVER_FIRMWARE_VERSION_B 38 /* R--T */
-
-/*
- * NV_CTRL_STRING_3D_VISION_PRO_TRANSCEIVER_FIRMWARE_DATE_B - Returns the
- * date of the firmware of chip B of the 3D Vision Pro transceiver.
- */
-#define NV_CTRL_STRING_3D_VISION_PRO_TRANSCEIVER_FIRMWARE_DATE_B 39 /* R--T */
-
-/*
- * NV_CTRL_STRING_3D_VISION_PRO_TRANSCEIVER_ADDRESS - Returns the RF address
- * of the 3D Vision Pro transceiver.
- */
-#define NV_CTRL_STRING_3D_VISION_PRO_TRANSCEIVER_ADDRESS 40 /* R--T */
-
-/*
- * NV_CTRL_STRING_3D_VISION_PRO_GLASSES_FIRMWARE_VERSION_A - Returns the
- * firmware version of chip A of the glasses.
- * Use the display_mask parameter to specify the glasses id.
- */
-#define NV_CTRL_STRING_3D_VISION_PRO_GLASSES_FIRMWARE_VERSION_A 41 /* R--T */
-
-/*
- * NV_CTRL_STRING_3D_VISION_PRO_GLASSES_FIRMWARE_DATE_A - Returns the
- * date of the firmware of chip A of the glasses.
- * Use the display_mask parameter to specify the glasses id.
- */
-#define NV_CTRL_STRING_3D_VISION_PRO_GLASSES_FIRMWARE_DATE_A 42 /* R--T */
-
-/*
- * NV_CTRL_STRING_3D_VISION_PRO_GLASSES_ADDRESS - Returns the RF address
- * of the glasses.
- * Use the display_mask parameter to specify the glasses id.
- */
-#define NV_CTRL_STRING_3D_VISION_PRO_GLASSES_ADDRESS 43 /* R--T */
-
-/*
- * NV_CTRL_STRING_3D_VISION_PRO_GLASSES_NAME - Controls the name the
- * glasses should use.
- * Use the display_mask parameter to specify the glasses id.
- * Glasses' name should start and end with an alpha-numeric character.
- */
-#define NV_CTRL_STRING_3D_VISION_PRO_GLASSES_NAME 44 /* RW-T */
-
-/*
- * NV_CTRL_STRING_CURRENT_METAMODE_VERSION_2 - Returns the metamode currently
- * being used by the specified X screen. The MetaMode string has the same
- * syntax as the MetaMode X configuration option, as documented in the NVIDIA
- * driver README. Also, see NV_CTRL_BINARY_DATA_METAMODES_VERSION_2 for more
- * details on the base syntax.
- *
- * The returned string may also be prepended with a comma-separated list of
- * "token=value" pairs, separated from the MetaMode string by "::".
- */
-#define NV_CTRL_STRING_CURRENT_METAMODE_VERSION_2 45 /* RW-- */
-
-/*
- * NV_CTRL_STRING_DISPLAY_NAME_TYPE_BASENAME - Returns a type name for the
- * display device ("CRT", "DFP", or "TV"). However, note that the determination
- * of the name is based on the protocol through which the X driver communicates
- * to the display device. E.g., if the driver communicates using VGA ,then the
- * basename is "CRT"; if the driver communicates using TMDS, LVDS, or DP, then
- * the name is "DFP".
- */
-#define NV_CTRL_STRING_DISPLAY_NAME_TYPE_BASENAME 46 /* R-D- */
-
-/*
- * NV_CTRL_STRING_DISPLAY_NAME_TYPE_ID - Returns the type-based name + ID for
- * the display device, e.g. "CRT-0", "DFP-1", "TV-2". If this device is a
- * DisplayPort 1.2 device, then this name will also be prepended with the
- * device's port address like so: "DFP-1.0.1.2.3". See
- * NV_CTRL_STRING_DISPLAY_NAME_TYPE_BASENAME for more information about the
- * construction of type-based names.
- */
-#define NV_CTRL_STRING_DISPLAY_NAME_TYPE_ID 47 /* R-D- */
-
-/*
- * NV_CTRL_STRING_DISPLAY_NAME_DP_GUID - Returns the GUID of the DisplayPort
- * display device. e.g. "DP-GUID-f16a5bde-79f3-11e1-b2ae-8b5a8969ba9c"
- *
- * The display device must be a DisplayPort 1.2 device.
- */
-#define NV_CTRL_STRING_DISPLAY_NAME_DP_GUID 48 /* R-D- */
-
-/*
- * NV_CTRL_STRING_DISPLAY_NAME_EDID_HASH - Returns the SHA-1 hash of the
- * display device's EDID in 8-4-4-4-12 UID format. e.g.
- * "DPY-EDID-f16a5bde-79f3-11e1-b2ae-8b5a8969ba9c"
- *
- * The display device must have a valid EDID.
- */
-#define NV_CTRL_STRING_DISPLAY_NAME_EDID_HASH 49 /* R-D- */
-
-/*
- * NV_CTRL_STRING_DISPLAY_NAME_TARGET_INDEX - Returns the current NV-CONTROL
- * target ID (name) of the display device. e.g. "DPY-1", "DPY-4"
- *
- * This name for the display device is not guarenteed to be the same between
- * different runs of the X server.
- */
-#define NV_CTRL_STRING_DISPLAY_NAME_TARGET_INDEX 50 /* R-D- */
-
-/*
- * NV_CTRL_STRING_DISPLAY_NAME_RANDR - Returns the RandR output name for the
- * display device. e.g. "VGA-1", "DVI-I-0", "DVI-D-3", "LVDS-1", "DP-2",
- * "HDMI-3", "eDP-6". This name should match If this device is a DisplayPort
- * 1.2 device, then this name will also be prepended with the device's port
- * address like so: "DVI-I-3.0.1.2.3"
- */
-#define NV_CTRL_STRING_DISPLAY_NAME_RANDR 51 /* R-D- */
-
-#define NV_CTRL_STRING_LAST_ATTRIBUTE NV_CTRL_STRING_DISPLAY_NAME_RANDR
-
-/**************************************************************************/
-
-/*
- * Binary Data Attributes:
- *
- * Binary data attributes can be queryied through the XNVCTRLQueryBinaryData()
- * and XNVCTRLQueryTargetBinaryData() function calls.
- *
- * There are currently no binary data attributes that can be set.
- *
- * Unless otherwise noted, all Binary data attributes can be queried
- * using an NV_CTRL_TARGET_TYPE_X_SCREEN target. Attributes that cannot take
- * an NV_CTRL_TARGET_TYPE_X_SCREEN target also cannot be queried through
- * XNVCTRLQueryBinaryData() (Since an X Screen target is assumed).
- */
-
-/*
- * NV_CTRL_BINARY_DATA_EDID - Returns a display device's EDID information
- * data.
- *
- * This attribute may be queried through XNVCTRLQueryTargetBinaryData()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_BINARY_DATA_EDID 0 /* R-DG */
-
-/*
- * NV_CTRL_BINARY_DATA_MODELINES - Returns a display device's supported
- * ModeLines. ModeLines are returned in a buffer, separated by a single
- * '\0' and terminated by two consecutive '\0' s like so:
- *
- * "ModeLine 1\0ModeLine 2\0ModeLine 3\0Last ModeLine\0\0"
- *
- * This attribute may be queried through XNVCTRLQueryTargetBinaryData()
- * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target.
- *
- * Each ModeLine string may be prepended with a comma-separated list
- * of "token=value" pairs, separated from the ModeLine string with a
- * "::". Valid tokens:
- *
- * Token Value
- * "source" "xserver" - the ModeLine is from the core X server
- * "xconfig" - the ModeLine was specified in the X config file
- * "builtin" - the NVIDIA driver provided this builtin ModeLine
- * "vesa" - this is a VESA standard ModeLine
- * "edid" - the ModeLine was in the display device's EDID
- * "nv-control" - the ModeLine was specified via NV-CONTROL
- *
- * "xconfig-name" - for ModeLines that were specified in the X config
- * file, this is the name the X config file
- * gave for the ModeLine.
- *
- * Note that a ModeLine can have several sources; the "source" token
- * can appear multiple times in the "token=value" pairs list.
- * Additional source values may be specified in the future.
- *
- * Additional tokens may be added in the future, so it is recommended
- * that any token parser processing the returned string from
- * NV_CTRL_BINARY_DATA_MODELINES be implemented to gracefully ignore
- * unrecognized tokens.
- *
- * E.g.,
- *
- * "source=xserver, source=vesa, source=edid :: "1024x768_70" 75.0 1024 1048 1184 1328 768 771
- * 777 806 -HSync -VSync"
- * "source=xconfig, xconfig-name=1600x1200_60.00 :: "1600x1200_60_0" 161.0 1600 1704 1880 2160
- * 1200 1201 1204 1242 -HSync +VSync"
- */
-
-#define NV_CTRL_BINARY_DATA_MODELINES 1 /* R-DG */
-
-/*
- * NV_CTRL_BINARY_DATA_METAMODES - Returns an X Screen's supported
- * MetaModes. MetaModes are returned in a buffer separated by a
- * single '\0' and terminated by two consecutive '\0' s like so:
- *
- * "MetaMode 1\0MetaMode 2\0MetaMode 3\0Last MetaMode\0\0"
- *
- * The MetaMode string should have the same syntax as the MetaMode X
- * configuration option, as documented in the NVIDIA driver README.
-
- * Each MetaMode string may be prepended with a comma-separated list
- * of "token=value" pairs, separated from the MetaMode string with
- * "::". Currently, valid tokens are:
- *
- * Token Value
- * "id" <number> - the id of this MetaMode; this is stored in
- * the Vertical Refresh field, as viewed
- * by the XRandR and XF86VidMode X *
- * extensions.
- *
- * "switchable" "yes"/"no" - whether this MetaMode may be switched to via
- * ctrl-alt-+/-; Implicit MetaModes (see
- * the "IncludeImplicitMetaModes" X
- * config option), for example, are not
- * normally made available through
- * ctrl-alt-+/-.
- *
- * "source" "xconfig" - the MetaMode was specified in the X
- * config file.
- * "implicit" - the MetaMode was implicitly added; see the
- * "IncludeImplicitMetaModes" X config option
- * for details.
- * "nv-control" - the MetaMode was added via the NV-CONTROL X
- * extension to the currently running X server.
- * "RandR" - the MetaMode was modified in response to an
- * RandR RRSetCrtcConfig request.
- *
- * Additional tokens may be added in the future, so it is recommended
- * that any token parser processing the returned string from
- * NV_CTRL_BINARY_DATA_METAMODES be implemented to gracefully ignore
- * unrecognized tokens.
- *
- * E.g.,
- *
- * "id=50, switchable=yes, source=xconfig :: CRT-0: 1024x768 @1024x768 +0+0"
- */
-
-#define NV_CTRL_BINARY_DATA_METAMODES 2 /* R-D- */
-#define NV_CTRL_BINARY_DATA_METAMODES_VERSION_1 NV_CTRL_BINARY_DATA_METAMODES
-
-/*
- * NV_CTRL_BINARY_DATA_XSCREENS_USING_GPU - Returns the list of X
- * screens currently driven by the given GPU.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of screens
- * 4 * n CARD32 screen indices
- *
- * This attribute can only be queried through XNVCTRLQueryTargetBinaryData()
- * using a NV_CTRL_TARGET_TYPE_GPU target. This attribute cannot be
- * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN.
- */
-
-#define NV_CTRL_BINARY_DATA_XSCREENS_USING_GPU 3 /* R-DG */
-
-/*
- * NV_CTRL_BINARY_DATA_GPUS_USED_BY_XSCREEN - Returns the list of GPUs
- * currently in use by the given X screen.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of GPUs
- * 4 * n CARD32 GPU indices
- */
-
-#define NV_CTRL_BINARY_DATA_GPUS_USED_BY_XSCREEN 4 /* R--- */
-
-/*
- * NV_CTRL_BINARY_DATA_GPUS_USING_FRAMELOCK - Returns the list of
- * GPUs currently connected to the given frame lock board.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of GPUs
- * 4 * n CARD32 GPU indices
- *
- * This attribute can only be queried through XNVCTRLQueryTargetBinaryData()
- * using a NV_CTRL_TARGET_TYPE_FRAMELOCK target. This attribute cannot be
- * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN.
- */
-
-#define NV_CTRL_BINARY_DATA_GPUS_USING_FRAMELOCK 5 /* R-DF */
-
-/*
- * NV_CTRL_BINARY_DATA_DISPLAY_VIEWPORT - Returns the Display Device's
- * viewport box into the given X Screen (in X Screen coordinates.)
- *
- * The format of the returned data is:
- *
- * 4 CARD32 Offset X
- * 4 CARD32 Offset Y
- * 4 CARD32 Width
- * 4 CARD32 Height
- */
-
-#define NV_CTRL_BINARY_DATA_DISPLAY_VIEWPORT 6 /* R-DG */
-
-/*
- * NV_CTRL_BINARY_DATA_FRAMELOCKS_USED_BY_GPU - Returns the list of
- * Framelock devices currently connected to the given GPU.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of Framelocks
- * 4 * n CARD32 Framelock indices
- *
- * This attribute can only be queried through XNVCTRLQueryTargetBinaryData()
- * using a NV_CTRL_TARGET_TYPE_GPU target. This attribute cannot be
- * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN.
- */
-
-#define NV_CTRL_BINARY_DATA_FRAMELOCKS_USED_BY_GPU 7 /* R-DG */
-
-/*
- * NV_CTRL_BINARY_DATA_GPUS_USING_VCSC - Returns the list of
- * GPU devices connected to the given VCS.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of GPUs
- * 4 * n CARD32 GPU indices
- *
- * This attribute can only be queried through XNVCTRLQueryTargetBinaryData()
- * using a NV_CTRL_TARGET_TYPE_VCSC target. This attribute cannot be
- * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN and cannot be queried using
- * a NV_CTRL_TARGET_TYPE_X_GPU
- */
-
-#define NV_CTRL_BINARY_DATA_GPUS_USING_VCSC 8 /* R-DV */
-
-/*
- * NV_CTRL_BINARY_DATA_VCSCS_USED_BY_GPU - Returns the VCSC device
- * that is controlling the given GPU.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of VCS (always 1)
- * 4 * n CARD32 VCS indices
- *
- * This attribute can only be queried through XNVCTRLQueryTargetBinaryData()
- * using a NV_CTRL_TARGET_TYPE_GPU target. This attribute cannot be
- * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN
- */
-
-#define NV_CTRL_BINARY_DATA_VCSCS_USED_BY_GPU 9 /* R-DG */
-
-/*
- * NV_CTRL_BINARY_DATA_COOLERS_USED_BY_GPU - Returns the coolers that
- * are cooling the given GPU.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of COOLER
- * 4 * n CARD32 COOLER indices
- *
- * This attribute can only be queried through XNVCTRLQueryTargetBinaryData()
- * using a NV_CTRL_TARGET_TYPE_GPU target. This attribute cannot be
- * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN
- */
-
-#define NV_CTRL_BINARY_DATA_COOLERS_USED_BY_GPU 10 /* R-DG */
-
-/*
- * NV_CTRL_BINARY_DATA_GPUS_USED_BY_LOGICAL_XSCREEN - Returns the list of
- * GPUs currently driving the given X screen. If Xinerama is enabled, this
- * will return all GPUs that are driving any X screen.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of GPUs
- * 4 * n CARD32 GPU indices
- */
-
-#define NV_CTRL_BINARY_DATA_GPUS_USED_BY_LOGICAL_XSCREEN 11 /* R--- */
-
-/*
- * NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU - Returns the sensors that
- * are attached to the given GPU.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of SENSOR
- * 4 * n CARD32 SENSOR indices
- *
- * This attribute can only be queried through XNVCTRLQueryTargetBinaryData()
- * using a NV_CTRL_TARGET_TYPE_GPU target. This attribute cannot be
- * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN
- */
-
-#define NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU 12 /* R--G */
-
-/*
- * NV_CTRL_BINARY_DATA_GLASSES_PAIRED_TO_3D_VISION_PRO_TRANSCEIVER - Returns
- * the id of the glasses that are currently paired to the given
- * 3D Vision Pro transceiver.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of glasses
- * 4 * n CARD32 id of glasses
- *
- * This attribute can only be queried through XNVCTRLQueryTargetBinaryData()
- * using a NV_CTRL_TARGET_TYPE_3D_VISION_PRO_TRANSCEIVER target.
- */
-#define NV_CTRL_BINARY_DATA_GLASSES_PAIRED_TO_3D_VISION_PRO_TRANSCEIVER 13 /* R--T */
-
-/*
- * NV_CTRL_BINARY_DATA_DISPLAY_TARGETS - Returns all the display devices
- * currently connected to any GPU on the X server.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of display devices
- * 4 * n CARD32 display device indices
- *
- * This attribute can only be queried through XNVCTRLQueryTargetBinaryData().
- */
-
-#define NV_CTRL_BINARY_DATA_DISPLAY_TARGETS 14 /* R--- */
-
-/*
- * NV_CTRL_BINARY_DATA_DISPLAYS_CONNECTED_TO_GPU - Returns the list of
- * display devices that are connected to the GPU target.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of display devices
- * 4 * n CARD32 display device indices
- *
- * This attribute can only be queried through XNVCTRLQueryTargetBinaryData()
- * using a NV_CTRL_TARGET_TYPE_GPU target.
- */
-
-#define NV_CTRL_BINARY_DATA_DISPLAYS_CONNECTED_TO_GPU 15 /* R--G */
-
-/*
- * NV_CTRL_BINARY_DATA_METAMODES_VERSION_2 - Returns values similar to
- * NV_CTRL_BINARY_DATA_METAMODES(_VERSION_1) but also returns extended syntax
- * information to indicate a specific display device, as well as other per-
- * display deviceflags as "token=value" pairs. For example:
- *
- * "DPY-1: 1280x1024 {Stereo=PassiveLeft},
- * DPY-2: 1280x1024 {Stereo=PassiveRight},"
- *
- * The display device names have the form "DPY-%d", where the integer
- * part of the name is the NV-CONTROL target ID for that display device
- * for this instance of the X server. Note that display device NV-CONTROL
- * target IDs are not guaranteed to be the same from one run of the X
- * server to the next.
- */
-
-#define NV_CTRL_BINARY_DATA_METAMODES_VERSION_2 16 /* R-D- */
-
-/*
- * NV_CTRL_BINARY_DATA_DISPLAYS_ENABLED_ON_XSCREEN - Returns the list of
- * display devices that are currently scanning out the X screen target.
- *
- * The format of the returned data is:
- *
- * 4 CARD32 number of display devices
- * 4 * n CARD32 display device indices
- *
- * This attribute can only be queried through XNVCTRLQueryTargetBinaryData()
- * using a NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-#define NV_CTRL_BINARY_DATA_DISPLAYS_ENABLED_ON_XSCREEN 17 /* R--- */
-
-#define NV_CTRL_BINARY_DATA_LAST_ATTRIBUTE NV_CTRL_BINARY_DATA_DISPLAYS_ENABLED_ON_XSCREEN
-
-/**************************************************************************/
-
-/*
- * String Operation Attributes:
- *
- * These attributes are used with the XNVCTRLStringOperation()
- * function; a string is specified as input, and a string is returned
- * as output.
- *
- * Unless otherwise noted, all attributes can be operated upon using
- * an NV_CTRL_TARGET_TYPE_X_SCREEN target.
- */
-
-/*
- * NV_CTRL_STRING_OPERATION_ADD_METAMODE - provide a MetaMode string
- * as input, and returns a string containing comma-separated list of
- * "token=value" pairs as output. Currently, the only output token is
- * "id", which indicates the id that was assigned to the MetaMode.
- *
- * All ModeLines referenced in the MetaMode must already exist for
- * each display device (as returned by the
- * NV_CTRL_BINARY_DATA_MODELINES attribute).
- *
- * The MetaMode string should have the same syntax as the MetaMode X
- * configuration option, as documented in the NVIDIA driver README.
- *
- * The input string can optionally be prepended with a string of
- * comma-separated "token=value" pairs, separated from the MetaMode
- * string by "::". Currently, the only valid token is "index" which
- * indicates the insertion index for the MetaMode.
- *
- * E.g.,
- *
- * Input: "index=5 :: 1600x1200+0+0, 1600x1200+1600+0"
- * Output: "id=58"
- *
- * which causes the MetaMode to be inserted at position 5 in the
- * MetaMode list (all entries after 5 will be shifted down one slot in
- * the list), and the X server's containing mode stores 58 as the
- * VRefresh, so that the MetaMode can be uniquely identifed through
- * XRandR and XF86VidMode.
- */
-
-#define NV_CTRL_STRING_OPERATION_ADD_METAMODE 0
-
-/*
- * NV_CTRL_STRING_OPERATION_GTF_MODELINE - provide as input a string
- * of comma-separated "token=value" pairs, and returns a ModeLine
- * string, computed using the GTF formula using the parameters from
- * the input string. Valid tokens for the input string are "width",
- * "height", and "refreshrate".
- *
- * E.g.,
- *
- * Input: "width=1600, height=1200, refreshrate=60"
- * Output: "160.96 1600 1704 1880 2160 1200 1201 1204 1242 -HSync +VSync"
- *
- * This operation does not have any impact on any display device's
- * modePool, and the ModeLine is not validated; it is simply intended
- * for generating ModeLines.
- */
-
-#define NV_CTRL_STRING_OPERATION_GTF_MODELINE 1
-
-/*
- * NV_CTRL_STRING_OPERATION_CVT_MODELINE - provide as input a string
- * of comma-separated "token=value" pairs, and returns a ModeLine
- * string, computed using the CVT formula using the parameters from
- * the input string. Valid tokens for the input string are "width",
- * "height", "refreshrate", and "reduced-blanking". The
- * "reduced-blanking" argument can be "0" or "1", to enable or disable
- * use of reduced blanking for the CVT formula.
- *
- * E.g.,
- *
- * Input: "width=1600, height=1200, refreshrate=60, reduced-blanking=1"
- * Output: "130.25 1600 1648 1680 1760 1200 1203 1207 1235 +HSync -VSync"
- *
- * This operation does not have any impact on any display device's
- * modePool, and the ModeLine is not validated; it is simply intended
- * for generating ModeLines.
- */
-
-#define NV_CTRL_STRING_OPERATION_CVT_MODELINE 2
-
-/*
- * NV_CTRL_STRING_OPERATION_BUILD_MODEPOOL - build a ModePool for the
- * specified display device on the specified target (either an X
- * screen or a GPU). This is typically used to generate a ModePool
- * for a display device on a GPU on which no X screens are present.
- *
- * Currently, a display device's ModePool is static for the life of
- * the X server, so XNVCTRLStringOperation will return FALSE if
- * requested to build a ModePool on a display device that already has
- * a ModePool.
- *
- * The string input to BUILD_MODEPOOL may be NULL. If it is not NULL,
- * then it is interpreted as a double-colon ("::") separated list
- * of "option=value" pairs, where the options and the syntax of their
- * values are the X configuration options that impact the behavior of
- * modePool construction; namely:
- *
- * "ModeValidation"
- * "HorizSync"
- * "VertRefresh"
- * "FlatPanelProperties"
- * "TVStandard"
- * "ExactModeTimingsDVI"
- * "UseEdidFreqs"
- *
- * An example input string might look like:
- *
- * "ModeValidation=NoVesaModes :: HorizSync=50-110 :: VertRefresh=50-150"
- *
- * This request currently does not return a string.
- */
-
-#define NV_CTRL_STRING_OPERATION_BUILD_MODEPOOL 3 /* DG */
-
-/*
- * NV_CTRL_STRING_OPERATION_GVI_CONFIGURE_STREAMS - Configure the streams-
- * to-jack+channel topology for a GVI (Graphics capture board).
- *
- * The string input to GVI_CONFIGURE_STREAMS may be NULL. If this is the
- * case, then the current topology is returned.
- *
- * If the input string to GVI_CONFIGURE_STREAMS is not NULL, the string
- * is interpreted as a semicolon (";") separated list of comma-separated
- * lists of "option=value" pairs that define a stream's composition. The
- * available options and their values are:
- *
- * "stream": Defines which stream this comma-separated list describes.
- * Valid values are the integers between 0 and
- * NV_CTRL_GVI_NUM_STREAMS-1 (inclusive).
- *
- * "linkN": Defines a jack+channel pair to use for the given link N.
- * Valid options are the string "linkN", where N is an integer
- * between 0 and NV_CTRL_GVI_MAX_LINKS_PER_STREAM-1 (inclusive).
- * Valid values for these options are strings of the form
- * "jackX" and/or "jackX.Y", where X is an integer between 0 and
- * NV_CTRL_GVI_NUM_JACKS-1 (inclusive), and Y (optional) is an
- * integer between 0 and NV_CTRL_GVI_MAX_CHANNELS_PER_JACK-1
- * (inclusive).
- *
- * An example input string might look like:
- *
- * "stream=0, link0=jack0, link1=jack1; stream=1, link0=jack2.1"
- *
- * This example specifies two streams, stream 0 and stream 1. Stream 0
- * is defined to capture link0 data from the first channel (channel 0) of
- * BNC jack 0 and link1 data from the first channel of BNC jack 1. The
- * second stream (Stream 1) is defined to capture link0 data from channel 1
- * (second channel) of BNC jack 2.
- *
- * This example shows a possible configuration for capturing 3G input:
- *
- * "stream=0, link0=jack0.0, link1=jack0.1"
- *
- * Applications should query the following attributes to determine
- * possible combinations:
- *
- * NV_CTRL_GVI_MAX_STREAMS
- * NV_CTRL_GVI_MAX_LINKS_PER_STREAM
- * NV_CTRL_GVI_NUM_JACKS
- * NV_CTRL_GVI_MAX_CHANNELS_PER_JACK
- *
- * Note: A jack+channel pair can only be tied to one link/stream.
- *
- * Upon successful configuration or querying of this attribute, a string
- * representing the current topology for all known streams on the device
- * will be returned. On failure, NULL is returned.
- *
- * Note: Setting this attribute may also result in the following
- * NV-CONTROL attributes being reset on the GVI device (to ensure
- * the configuration remains valid):
- * NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT
- * NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT
- * NV_CTRL_GVI_REQUESTED_STREAM_COMPONENT_SAMPLING
- */
-
-#define NV_CTRL_STRING_OPERATION_GVI_CONFIGURE_STREAMS 4 /* RW-I */
-
-#define NV_CTRL_STRING_OPERATION_LAST_ATTRIBUTE NV_CTRL_STRING_OPERATION_GVI_CONFIGURE_STREAMS
-
-/**************************************************************************/
-
-/*
- * CTRLAttributeValidValuesRec -
- *
- * structure and related defines used by
- * XNVCTRLQueryValidAttributeValues() to describe the valid values of
- * a particular attribute. The type field will be one of:
- *
- * ATTRIBUTE_TYPE_INTEGER : the attribute is an integer value; there
- * is no fixed range of valid values.
- *
- * ATTRIBUTE_TYPE_BITMASK : the attribute is an integer value,
- * interpretted as a bitmask.
- *
- * ATTRIBUTE_TYPE_BOOL : the attribute is a boolean, valid values are
- * either 1 (on/true) or 0 (off/false).
- *
- * ATTRIBUTE_TYPE_RANGE : the attribute can have any integer value
- * between NVCTRLAttributeValidValues.u.range.min and
- * NVCTRLAttributeValidValues.u.range.max (inclusive).
- *
- * ATTRIBUTE_TYPE_INT_BITS : the attribute can only have certain
- * integer values, indicated by which bits in
- * NVCTRLAttributeValidValues.u.bits.ints are on (for example: if bit
- * 0 is on, then 0 is a valid value; if bit 5 is on, then 5 is a valid
- * value, etc). This is useful for attributes like NV_CTRL_FSAA_MODE,
- * which can only have certain values, depending on GPU.
- *
- * ATTRIBUTE_TYPE_64BIT_INTEGER : the attribute is a 64 bit integer value;
- * there is no fixed range of valid values.
- *
- * ATTRIBUTE_TYPE_STRING : the attribute is a string value; there is no fixed
- * range of valid values.
- *
- * ATTRIBUTE_TYPE_BINARY_DATA : the attribute is binary data; there is
- * no fixed range of valid values.
- *
- * ATTRIBUTE_TYPE_STRING_OPERATION : the attribute is a string; there is
- * no fixed range of valid values.
- *
- *
- * The permissions field of NVCTRLAttributeValidValuesRec is a bitmask
- * that may contain:
- *
- * ATTRIBUTE_TYPE_READ - Attribute may be read (queried.)
- * ATTRIBUTE_TYPE_WRITE - Attribute may be written to (set.)
- * ATTRIBUTE_TYPE_DISPLAY - Attribute is valid for display target types
- * (requires a display_mask if queried via
- * a GPU or X screen.)
- * ATTRIBUTE_TYPE_GPU - Attribute is valid for GPU target types.
- * ATTRIBUTE_TYPE_FRAMELOCK - Attribute is valid for Frame Lock target types.
- * ATTRIBUTE_TYPE_X_SCREEN - Attribute is valid for X Screen target types.
- * ATTRIBUTE_TYPE_XINERAMA - Attribute will be made consistent for all
- * X Screens when the Xinerama extension is enabled.
- * ATTRIBUTE_TYPE_VCSC - Attribute is valid for Visual Computing System
- * target types.
- * ATTRIBUTE_TYPE_GVI - Attribute is valid for Graphics Video In target
- * types.
- * ATTRIBUTE_TYPE_COOLER - Attribute is valid for Cooler target types.
- * ATTRIBUTE_TYPE_3D_VISION_PRO_TRANSCEIVER - Attribute is valid for 3D Vision
- * Pro Transceiver target types.
- *
- * See 'Key to Integer Attribute "Permissions"' at the top of this
- * file for a description of what these permission bits mean.
- */
-
-#define ATTRIBUTE_TYPE_UNKNOWN 0
-#define ATTRIBUTE_TYPE_INTEGER 1
-#define ATTRIBUTE_TYPE_BITMASK 2
-#define ATTRIBUTE_TYPE_BOOL 3
-#define ATTRIBUTE_TYPE_RANGE 4
-#define ATTRIBUTE_TYPE_INT_BITS 5
-#define ATTRIBUTE_TYPE_64BIT_INTEGER 6
-#define ATTRIBUTE_TYPE_STRING 7
-#define ATTRIBUTE_TYPE_BINARY_DATA 8
-#define ATTRIBUTE_TYPE_STRING_OPERATION 9
-
-#define ATTRIBUTE_TYPE_READ 0x001
-#define ATTRIBUTE_TYPE_WRITE 0x002
-#define ATTRIBUTE_TYPE_DISPLAY 0x004
-#define ATTRIBUTE_TYPE_GPU 0x008
-#define ATTRIBUTE_TYPE_FRAMELOCK 0x010
-#define ATTRIBUTE_TYPE_X_SCREEN 0x020
-#define ATTRIBUTE_TYPE_XINERAMA 0x040
-#define ATTRIBUTE_TYPE_VCSC 0x080
-#define ATTRIBUTE_TYPE_GVI 0x100
-#define ATTRIBUTE_TYPE_COOLER 0x200
-#define ATTRIBUTE_TYPE_THERMAL_SENSOR 0x400
-#define ATTRIBUTE_TYPE_3D_VISION_PRO_TRANSCEIVER 0x800
-
-#define ATTRIBUTE_TYPE_ALL_TARGETS \
- ((ATTRIBUTE_TYPE_DISPLAY) | (ATTRIBUTE_TYPE_GPU) | (ATTRIBUTE_TYPE_FRAMELOCK) | \
- (ATTRIBUTE_TYPE_X_SCREEN) | (ATTRIBUTE_TYPE_VCSC) | (ATTRIBUTE_TYPE_GVI) | \
- (ATTRIBUTE_TYPE_COOLER) | (ATTRIBUTE_TYPE_THERMAL_SENSOR) | \
- (ATTRIBUTE_TYPE_3D_VISION_PRO_TRANSCEIVER))
-
-typedef struct _NVCTRLAttributeValidValues
-{
- int type;
- union
- {
- struct
- {
- int64_t min;
- int64_t max;
- } range;
- struct
- {
- unsigned int ints;
- } bits;
- } u;
- unsigned int permissions;
-} NVCTRLAttributeValidValuesRec;
-
-typedef struct _NVCTRLAttributePermissions
-{
- int type;
- unsigned int permissions;
-} NVCTRLAttributePermissionsRec;
-
-/**************************************************************************/
-
-/*
- * NV-CONTROL X event notification.
- *
- * To receive X event notifications dealing with NV-CONTROL, you should
- * call XNVCtrlSelectNotify() with one of the following set as the type
- * of event to receive (see NVCtrlLib.h for more information):
- */
-
-#define ATTRIBUTE_CHANGED_EVENT 0
-#define TARGET_ATTRIBUTE_CHANGED_EVENT 1
-#define TARGET_ATTRIBUTE_AVAILABILITY_CHANGED_EVENT 2
-#define TARGET_STRING_ATTRIBUTE_CHANGED_EVENT 3
-#define TARGET_BINARY_ATTRIBUTE_CHANGED_EVENT 4
-
-#endif /* __NVCTRL_H */
diff --git a/src/3rdparty/angle/src/third_party/libXNVCtrl/NVCtrlLib.h b/src/3rdparty/angle/src/third_party/libXNVCtrl/NVCtrlLib.h
deleted file mode 100644
index 1a5d5decfa..0000000000
--- a/src/3rdparty/angle/src/third_party/libXNVCtrl/NVCtrlLib.h
+++ /dev/null
@@ -1,707 +0,0 @@
-/*
- * Copyright (c) 2008 NVIDIA, Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __NVCTRLLIB_H
-#define __NVCTRLLIB_H
-
-#include "NVCtrl.h"
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-/*
- * XNVCTRLQueryExtension -
- *
- * Returns True if the extension exists, returns False otherwise.
- * event_basep and error_basep are the extension event and error
- * bases. Currently, no extension specific errors or events are
- * defined.
- */
-
-Bool XNVCTRLQueryExtension(Display *dpy, int *event_basep, int *error_basep);
-
-/*
- * XNVCTRLQueryVersion -
- *
- * Returns True if the extension exists, returns False otherwise.
- * major and minor are the extension's major and minor version
- * numbers.
- */
-
-Bool XNVCTRLQueryVersion(Display *dpy, int *major, int *minor);
-
-/*
- * XNVCTRLIsNvScreen
- *
- * Returns True is the specified screen is controlled by the NVIDIA
- * driver. Returns False otherwise.
- */
-
-Bool XNVCTRLIsNvScreen(Display *dpy, int screen);
-
-/*
- * XNVCTRLQueryTargetCount -
- *
- * Returns True if the target type exists. Returns False otherwise.
- * If XNVCTRLQueryTargetCount returns True, value will contain the
- * count of existing targets on the server of the specified target
- * type.
- *
- * Please see "Attribute Targets" in NVCtrl.h for the list of valid
- * target types.
- *
- * Possible errors:
- * BadValue - The target doesn't exist.
- */
-
-Bool XNVCTRLQueryTargetCount(Display *dpy, int target_type, int *value);
-
-/*
- * XNVCTRLSetAttribute -
- *
- * Sets the attribute to the given value. The attributes and their
- * possible values are listed in NVCtrl.h.
- *
- * Not all attributes require the display_mask parameter; see
- * NVCtrl.h for details.
- *
- * Calling this function is equivalent to calling XNVCTRLSetTargetAttribute()
- * with the target_type set to NV_CTRL_TARGET_TYPE_X_SCREEN and
- * target_id set to 'screen'.
- *
- * Possible errors:
- * BadValue - The screen or attribute doesn't exist.
- * BadMatch - The NVIDIA driver is not present on that screen.
- */
-
-void XNVCTRLSetAttribute(Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- int value);
-
-/*
- * XNVCTRLSetTargetAttribute -
- *
- * Sets the attribute to the given value. The attributes and their
- * possible values are listed in NVCtrl.h.
- *
- * Not all attributes require the display_mask parameter; see
- * NVCtrl.h for details.
- *
- * Possible errors:
- * BadValue - The target or attribute doesn't exist.
- * BadMatch - The NVIDIA driver is not present on that target.
- */
-
-void XNVCTRLSetTargetAttribute(Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- int value);
-
-/*
- * XNVCTRLSetAttributeAndGetStatus -
- *
- * Same as XNVCTRLSetAttribute().
- * In addition, XNVCTRLSetAttributeAndGetStatus() returns
- * True if the operation succeeds, False otherwise.
- *
- */
-
-Bool XNVCTRLSetAttributeAndGetStatus(Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- int value);
-
-/*
- * XNVCTRLSetTargetAttributeAndGetStatus -
- *
- * Same as XNVCTRLSetTargetAttribute().
- * In addition, XNVCTRLSetTargetAttributeAndGetStatus() returns
- * True if the operation succeeds, False otherwise.
- *
- */
-
-Bool XNVCTRLSetTargetAttributeAndGetStatus(Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- int value);
-
-/*
- * XNVCTRLQueryAttribute -
- *
- * Returns True if the attribute exists. Returns False otherwise.
- * If XNVCTRLQueryAttribute returns True, value will contain the
- * value of the specified attribute.
- *
- * Not all attributes require the display_mask parameter; see
- * NVCtrl.h for details.
- *
- * Calling this function is equivalent to calling
- * XNVCTRLQueryTargetAttribute() with the target_type set to
- * NV_CTRL_TARGET_TYPE_X_SCREEN and target_id set to 'screen'.
- *
- * Possible errors:
- * BadValue - The screen doesn't exist.
- * BadMatch - The NVIDIA driver is not present on that screen.
- */
-
-Bool XNVCTRLQueryAttribute(Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- int *value);
-
-/*
- * XNVCTRLQueryTargetAttribute -
- *
- * Returns True if the attribute exists. Returns False otherwise.
- * If XNVCTRLQueryTargetAttribute returns True, value will contain the
- * value of the specified attribute.
- *
- * Not all attributes require the display_mask parameter; see
- * NVCtrl.h for details.
- *
- * Possible errors:
- * BadValue - The target doesn't exist.
- * BadMatch - The NVIDIA driver does not control the target.
- */
-
-Bool XNVCTRLQueryTargetAttribute(Display *dpy,
- int target_Type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- int *value);
-
-/*
- * XNVCTRLQueryTargetAttribute64 -
- *
- * Returns True if the attribute exists. Returns False otherwise.
- * If XNVCTRLQueryTargetAttribute returns True, value will contain the
- * value of the specified attribute.
- *
- * Not all attributes require the display_mask parameter; see
- * NVCtrl.h for details.
- *
- * Note: this function behaves like XNVCTRLQueryTargetAttribute(),
- * but supports 64-bit integer attributes.
- *
- * Possible errors:
- * BadValue - The target doesn't exist.
- * BadMatch - The NVIDIA driver does not control the target.
- */
-
-Bool XNVCTRLQueryTargetAttribute64(Display *dpy,
- int target_Type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- int64_t *value);
-
-/*
- * XNVCTRLQueryStringAttribute -
- *
- * Returns True if the attribute exists. Returns False otherwise.
- * If XNVCTRLQueryStringAttribute returns True, *ptr will point to an
- * allocated string containing the string attribute requested. It is
- * the caller's responsibility to free the string when done.
- *
- * Calling this function is equivalent to calling
- * XNVCTRLQueryTargetStringAttribute() with the target_type set to
- * NV_CTRL_TARGET_TYPE_X_SCREEN and target_id set to 'screen'.
- *
- * Possible errors:
- * BadValue - The screen doesn't exist.
- * BadMatch - The NVIDIA driver is not present on that screen.
- * BadAlloc - Insufficient resources to fulfill the request.
- */
-
-Bool XNVCTRLQueryStringAttribute(Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- char **ptr);
-
-/*
- * XNVCTRLQueryTargetStringAttribute -
- *
- * Returns True if the attribute exists. Returns False otherwise.
- * If XNVCTRLQueryTargetStringAttribute returns True, *ptr will point
- * to an allocated string containing the string attribute requested.
- * It is the caller's responsibility to free the string when done.
- *
- * Possible errors:
- * BadValue - The target doesn't exist.
- * BadMatch - The NVIDIA driver does not control the target.
- * BadAlloc - Insufficient resources to fulfill the request.
- */
-
-Bool XNVCTRLQueryTargetStringAttribute(Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- char **ptr);
-
-/*
- * XNVCTRLSetStringAttribute -
- *
- * Returns True if the operation succeded. Returns False otherwise.
- *
- * Possible X errors:
- * BadValue - The screen doesn't exist.
- * BadMatch - The NVIDIA driver is not present on that screen.
- * BadAlloc - Insufficient resources to fulfill the request.
- */
-
-Bool XNVCTRLSetStringAttribute(Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- char *ptr);
-
-/*
- * XNVCTRLSetTargetStringAttribute -
- *
- * Returns True if the operation succeded. Returns False otherwise.
- *
- * Possible X errors:
- * BadValue - The screen doesn't exist.
- * BadMatch - The NVIDIA driver is not present on that screen.
- * BadAlloc - Insufficient resources to fulfill the request.
- */
-
-Bool XNVCTRLSetTargetStringAttribute(Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- char *ptr);
-
-/*
- * XNVCTRLQueryValidAttributeValues -
- *
- * Returns True if the attribute exists. Returns False otherwise. If
- * XNVCTRLQueryValidAttributeValues returns True, values will indicate
- * the valid values for the specified attribute; see the description
- * of NVCTRLAttributeValidValues in NVCtrl.h.
- *
- * Calling this function is equivalent to calling
- * XNVCTRLQueryValidTargetAttributeValues() with the target_type set to
- * NV_CTRL_TARGET_TYPE_X_SCREEN and target_id set to 'screen'.
- */
-
-Bool XNVCTRLQueryValidAttributeValues(Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- NVCTRLAttributeValidValuesRec *values);
-
-/*
- * XNVCTRLQueryValidTargetAttributeValues -
- *
- * Returns True if the attribute exists. Returns False otherwise. If
- * XNVCTRLQueryValidTargetAttributeValues returns True, values will indicate
- * the valid values for the specified attribute.
- */
-
-Bool XNVCTRLQueryValidTargetAttributeValues(Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- NVCTRLAttributeValidValuesRec *values);
-
-/*
- * XNVCTRLQueryValidTargetStringAttributeValues -
- *
- * Returns True if the attribute exists. Returns False otherwise. If
- * XNVCTRLQueryValidTargetStringAttributeValues returns True, values will
- * indicate the valid values for the specified attribute.
- */
-
-Bool XNVCTRLQueryValidTargetStringAttributeValues(Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- NVCTRLAttributeValidValuesRec *values);
-
-/*
- * XNVCTRLQueryAttributePermissions -
- *
- * Returns True if the attribute exists. Returns False otherwise. If
- * XNVCTRLQueryAttributePermissions returns True, permissions will
- * indicate the permission flags for the attribute.
- */
-
-Bool XNVCTRLQueryAttributePermissions(Display *dpy,
- unsigned int attribute,
- NVCTRLAttributePermissionsRec *permissions);
-
-/*
- * XNVCTRLQueryStringAttributePermissions -
- *
- * Returns True if the attribute exists. Returns False otherwise. If
- * XNVCTRLQueryStringAttributePermissions returns True, permissions will
- * indicate the permission flags for the attribute.
- */
-
-Bool XNVCTRLQueryStringAttributePermissions(Display *dpy,
- unsigned int attribute,
- NVCTRLAttributePermissionsRec *permissions);
-
-/*
- * XNVCTRLQueryBinaryDataAttributePermissions -
- *
- * Returns True if the attribute exists. Returns False otherwise. If
- * XNVCTRLQueryBinaryDataAttributePermissions returns True, permissions
- * will indicate the permission flags for the attribute.
- */
-
-Bool XNVCTRLQueryBinaryDataAttributePermissions(Display *dpy,
- unsigned int attribute,
- NVCTRLAttributePermissionsRec *permissions);
-
-/*
- * XNVCTRLQueryStringOperationAttributePermissions -
- *
- * Returns True if the attribute exists. Returns False otherwise. If
- * XNVCTRLQueryStringOperationAttributePermissions returns True,
- * permissions will indicate the permission flags for the attribute.
- */
-
-Bool XNVCTRLQueryStringOperationAttributePermissions(Display *dpy,
- unsigned int attribute,
- NVCTRLAttributePermissionsRec *permissions);
-
-/*
- * XNVCTRLSetGvoColorConversion -
- *
- * Sets the color conversion matrix, offset, and scale that should be
- * used for GVO (Graphic to Video Out).
- *
- * The Color Space Conversion data is ordered like this:
- *
- * colorMatrix[0][0] // r.Y
- * colorMatrix[0][1] // g.Y
- * colorMatrix[0][2] // b.Y
- *
- * colorMatrix[1][0] // r.Cr
- * colorMatrix[1][1] // g.Cr
- * colorMatrix[1][2] // b.Cr
- *
- * colorMatrix[2][0] // r.Cb
- * colorMatrix[2][1] // g.Cb
- * colorMatrix[2][2] // b.Cb
- *
- * colorOffset[0] // Y
- * colorOffset[1] // Cr
- * colorOffset[2] // Cb
- *
- * colorScale[0] // Y
- * colorScale[1] // Cr
- * colorScale[2] // Cb
- *
- * where the data is used according to the following formulae:
- *
- * Y = colorOffset[0] + colorScale[0] *
- * (R * colorMatrix[0][0] +
- * G * colorMatrix[0][1] +
- * B * colorMatrix[0][2]);
- *
- * Cr = colorOffset[1] + colorScale[1] *
- * (R * colorMatrix[1][0] +
- * G * colorMatrix[1][1] +
- * B * colorMatrix[1][2]);
- *
- * Cb = colorOffset[2] + colorScale[2] *
- * (R * colorMatrix[2][0] +
- * G * colorMatrix[2][1] +
- * B * colorMatrix[2][2]);
- *
- * Possible errors:
- * BadMatch - The NVIDIA driver is not present on that screen.
- * BadImplementation - GVO is not available on that screen.
- */
-
-void XNVCTRLSetGvoColorConversion(Display *dpy,
- int screen,
- float colorMatrix[3][3],
- float colorOffset[3],
- float colorScale[3]);
-
-/*
- * XNVCTRLQueryGvoColorConversion -
- *
- * Retrieves the color conversion matrix and color offset
- * that are currently being used for GVO (Graphic to Video Out).
- *
- * The values are ordered within the arrays according to the comments
- * for XNVCTRLSetGvoColorConversion().
- *
- * Possible errors:
- * BadMatch - The NVIDIA driver is not present on that screen.
- * BadImplementation - GVO is not available on that screen.
- */
-
-Bool XNVCTRLQueryGvoColorConversion(Display *dpy,
- int screen,
- float colorMatrix[3][3],
- float colorOffset[3],
- float colorScale[3]);
-
-/*
- * XNVCTRLQueryBinaryData -
- *
- * Returns True if the attribute exists. Returns False otherwise.
- * If XNVCTRLQueryBinaryData returns True, *ptr will point to an
- * allocated block of memory containing the binary data attribute
- * requested. It is the caller's responsibility to free the data
- * when done. len will list the length of the binary data.
- *
- * Calling this function is equivalent to calling
- * XNVCTRLQueryTargetBinaryData() with the target_type set to
- * NV_CTRL_TARGET_TYPE_X_SCREEN and target_id set to 'screen'.
- *
- * Possible errors:
- * BadValue - The screen doesn't exist.
- * BadMatch - The NVIDIA driver is not present on that screen.
- * BadAlloc - Insufficient resources to fulfill the request.
- */
-
-Bool XNVCTRLQueryBinaryData(Display *dpy,
- int screen,
- unsigned int display_mask,
- unsigned int attribute,
- unsigned char **ptr,
- int *len);
-
-/*
- * XNVCTRLQueryTargetBinaryData -
- *
- * Returns True if the attribute exists. Returns False otherwise.
- * If XNVCTRLQueryTargetBinaryData returns True, *ptr will point to an
- * allocated block of memory containing the binary data attribute
- * requested. It is the caller's responsibility to free the data
- * when done. len will list the length of the binary data.
- *
- * Possible errors:
- * BadValue - The target doesn't exist.
- * BadMatch - The NVIDIA driver does not control the target.
- * BadAlloc - Insufficient resources to fulfill the request.
- */
-
-Bool XNVCTRLQueryTargetBinaryData(Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- unsigned char **ptr,
- int *len);
-
-/*
- * XNVCTRLStringOperation -
- *
- * Takes a string as input and returns a Xmalloc'ed string as output.
- * Returns True on success and False on failure.
- */
-
-Bool XNVCTRLStringOperation(Display *dpy,
- int target_type,
- int target_id,
- unsigned int display_mask,
- unsigned int attribute,
- char *pIn,
- char **ppOut);
-
-/*
- * XNVCtrlSelectNotify -
- *
- * This enables/disables receiving of NV-CONTROL events. The type
- * specifies the type of event to enable (currently, the only
- * type that can be requested per-screen with XNVCtrlSelectNotify()
- * is ATTRIBUTE_CHANGED_EVENT); onoff controls whether receiving this
- * type of event should be enabled (True) or disabled (False).
- *
- * Returns True if successful, or False if the screen is not
- * controlled by the NVIDIA driver.
- */
-
-Bool XNVCtrlSelectNotify(Display *dpy, int screen, int type, Bool onoff);
-
-/*
- * XNVCtrlSelectTargetNotify -
- *
- * This enables/disables receiving of NV-CONTROL events that happen on
- * the specified target. The notify_type specifies the type of event to
- * enable (currently, the only type that can be requested per-target with
- * XNVCtrlSelectTargetNotify() is TARGET_ATTRIBUTE_CHANGED_EVENT); onoff
- * controls whether receiving this type of event should be enabled (True)
- * or disabled (False).
- *
- * Returns True if successful, or False if the target is not
- * controlled by the NVIDIA driver.
- */
-
-Bool XNVCtrlSelectTargetNotify(Display *dpy,
- int target_type,
- int target_id,
- int notify_type,
- Bool onoff);
-
-/*
- * XNVCtrlEvent structure
- */
-
-typedef struct
-{
- int type;
- unsigned long serial;
- Bool send_event; /* always FALSE, we don't allow send_events */
- Display *display;
- Time time;
- int screen;
- unsigned int display_mask;
- unsigned int attribute;
- int value;
-} XNVCtrlAttributeChangedEvent;
-
-typedef union
-{
- int type;
- XNVCtrlAttributeChangedEvent attribute_changed;
- long pad[24];
-} XNVCtrlEvent;
-
-/*
- * XNVCtrlEventTarget structure
- */
-
-typedef struct
-{
- int type;
- unsigned long serial;
- Bool send_event; /* always FALSE, we don't allow send_events */
- Display *display;
- Time time;
- int target_type;
- int target_id;
- unsigned int display_mask;
- unsigned int attribute;
- int value;
-} XNVCtrlAttributeChangedEventTarget;
-
-typedef union
-{
- int type;
- XNVCtrlAttributeChangedEventTarget attribute_changed;
- long pad[24];
-} XNVCtrlEventTarget;
-
-/*
- * XNVCtrlEventTargetAvailability structure
- */
-
-typedef struct
-{
- int type;
- unsigned long serial;
- Bool send_event; /* always FALSE, we don't allow send_events */
- Display *display;
- Time time;
- int target_type;
- int target_id;
- unsigned int display_mask;
- unsigned int attribute;
- int value;
- Bool availability;
-} XNVCtrlAttributeChangedEventTargetAvailability;
-
-typedef union
-{
- int type;
- XNVCtrlAttributeChangedEventTargetAvailability attribute_changed;
- long pad[24];
-} XNVCtrlEventTargetAvailability;
-
-/*
- * XNVCtrlStringEventTarget structure
- */
-
-typedef struct
-{
- int type;
- unsigned long serial;
- Bool send_event; /* always FALSE, we don't allow send_events */
- Display *display;
- Time time;
- int target_type;
- int target_id;
- unsigned int display_mask;
- unsigned int attribute;
-} XNVCtrlStringAttributeChangedEventTarget;
-
-typedef union
-{
- int type;
- XNVCtrlStringAttributeChangedEventTarget attribute_changed;
- long pad[24];
-} XNVCtrlStringEventTarget;
-
-/*
- * XNVCtrlBinaryEventTarget structure
- */
-
-typedef struct
-{
- int type;
- unsigned long serial;
- Bool send_event; /* always FALSE, we don't allow send_events */
- Display *display;
- Time time;
- int target_type;
- int target_id;
- unsigned int display_mask;
- unsigned int attribute;
-} XNVCtrlBinaryAttributeChangedEventTarget;
-
-typedef union
-{
- int type;
- XNVCtrlBinaryAttributeChangedEventTarget attribute_changed;
- long pad[24];
-} XNVCtrlBinaryEventTarget;
-
-#if defined __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* __NVCTRLLIB_H */
diff --git a/src/3rdparty/angle/src/third_party/libXNVCtrl/README.angle b/src/3rdparty/angle/src/third_party/libXNVCtrl/README.angle
deleted file mode 100644
index 22b9bd0aac..0000000000
--- a/src/3rdparty/angle/src/third_party/libXNVCtrl/README.angle
+++ /dev/null
@@ -1,14 +0,0 @@
-Name: NVidia Control X Extension Library
-Short Name: libXNVCtrl
-URL: http://cgit.freedesktop.org/~aplattner/nvidia-settings/
-Version: unknown
-Date: 2008
-License: MIT
-Security Critical: no
-
-Description:
-This package provides access to NVidia Control X Extension. It is used to determine the version of the NVIDIA driver in use.
-
-The current version is pulled from nvidia-settings-302.17.
-
-Local Modifications:
diff --git a/src/3rdparty/angle/src/third_party/libXNVCtrl/nv_control.h b/src/3rdparty/angle/src/third_party/libXNVCtrl/nv_control.h
deleted file mode 100644
index 5023c9b58c..0000000000
--- a/src/3rdparty/angle/src/third_party/libXNVCtrl/nv_control.h
+++ /dev/null
@@ -1,652 +0,0 @@
-/*
- * Copyright (c) 2008 NVIDIA, Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- *
- * NV-CONTROL Protocol Version History
- *
- * 1.0 - 1.5 NVIDIA Internal development versions
- * 1.6 Initial public version
- * 1.7 Added QueryBinaryData request
- * 1.8 Added TargetTypes
- * 1.9 Added QueryTargetCount request
- * 1.10 Fixed target type/id byte ordering for compatibility with
- * pre-1.8 NV-CONTROL clients
- * 1.11 NVIDIA Internal development version
- * 1.12 Added StringOperation request
- * 1.13 NVIDIA Internal development version
- * 1.14 Fixed an NV_CTRL_BINARY_DATA_MODELINES double scan modeline
- * reporting bug (vsyncstart, vsyncend, and vtotal were incorrectly
- * doubled)
- * 1.15 Added AVAILABILITY_TARGET_ATTRIBUTE_CHANGED_EVENT
- * 1.16 Added TARGET_STRING_ATTRIBUTE_CHANGED_EVENT
- * 1.17 Added TARGET_BINARY_ATTRIBUTE_CHANGED_EVENT
- * 1.18 Updated QueryTargetCount to return a count of 0, rather than
- * BadMatch, if an unknown TargetType is specified
- * 1.19 Added TargetType support for SetAttributeAndGetStatus and
- * SetStringAttribute requests
- * 1.20 Added COOLER TargetType
- * 1.21 Added initial 64-bit integer attribute support (read-only)
- * 1.22 Added X_nvCtrlQueryValidStringAttributeValues to check
- * string attribute permissions.
- * 1.23 Added SENSOR TargetType
- * 1.24 Fixed a bug where SLI_MOSAIC_MODE_AVAILABLE attribute would
- * report false positives via the GPU and X screen target types
- * 1.25 Added 3D_VISION_PRO_TRANSCEIVER TargetType
- * 1.26 Added XNVCTRLQueryXXXAttributePermissions.
- * 1.27 Added DISPLAY TargetType
- * 1.28 Added NV_CTRL_CURRENT_METAMODE_ID: clients should use this
- * attribute to switch MetaModes, rather than pass the MetaMode ID
- * through the RRSetScreenConfig protocol request.
- */
-
-#ifndef __NVCONTROL_H
-#define __NVCONTROL_H
-
-#define NV_CONTROL_ERRORS 0
-#define NV_CONTROL_EVENTS 5
-#define NV_CONTROL_NAME "NV-CONTROL"
-
-#define NV_CONTROL_MAJOR 1
-#define NV_CONTROL_MINOR 28
-
-#define X_nvCtrlQueryExtension 0
-#define X_nvCtrlIsNv 1
-#define X_nvCtrlQueryAttribute 2
-#define X_nvCtrlSetAttribute 3
-#define X_nvCtrlQueryStringAttribute 4
-#define X_nvCtrlQueryValidAttributeValues 5
-#define X_nvCtrlSelectNotify 6
-#define X_nvCtrlSetGvoColorConversionDeprecated 7
-#define X_nvCtrlQueryGvoColorConversionDeprecated 8
-#define X_nvCtrlSetStringAttribute 9
-/* STUB X_nvCtrlQueryDDCCILutSize 10 */
-/* STUB X_nvCtrlQueryDDCCISinglePointLutOperation 11 */
-/* STUB X_nvCtrlSetDDCCISinglePointLutOperation 12 */
-/* STUB X_nvCtrlQueryDDCCIBlockLutOperation 13 */
-/* STUB X_nvCtrlSetDDCCIBlockLutOperation 14 */
-/* STUB X_nvCtrlSetDDCCIRemoteProcedureCall 15 */
-/* STUB X_nvCtrlQueryDDCCIDisplayControllerType 16 */
-/* STUB X_nvCtrlQueryDDCCICapabilities 17 */
-/* STUB X_nvCtrlQueryDDCCITimingReport 18 */
-#define X_nvCtrlSetAttributeAndGetStatus 19
-#define X_nvCtrlQueryBinaryData 20
-#define X_nvCtrlSetGvoColorConversion 21
-#define X_nvCtrlQueryGvoColorConversion 22
-#define X_nvCtrlSelectTargetNotify 23
-#define X_nvCtrlQueryTargetCount 24
-#define X_nvCtrlStringOperation 25
-#define X_nvCtrlQueryValidAttributeValues64 26
-#define X_nvCtrlQueryAttribute64 27
-#define X_nvCtrlQueryValidStringAttributeValues 28
-#define X_nvCtrlQueryAttributePermissions 29
-#define X_nvCtrlQueryStringAttributePermissions 30
-#define X_nvCtrlQueryBinaryDataAttributePermissions 31
-#define X_nvCtrlQueryStringOperationAttributePermissions 32
-
-#define X_nvCtrlLastRequest (X_nvCtrlQueryStringOperationAttributePermissions + 1)
-
-/* Define 32 bit floats */
-typedef float FLOAT32;
-#ifndef F32
-#define F32
-#endif
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
-} xnvCtrlQueryExtensionReq;
-#define sz_xnvCtrlQueryExtensionReq 4
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- CARD8 padb1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD16 major B16;
- CARD16 minor B16;
- CARD32 padl4 B32;
- CARD32 padl5 B32;
- CARD32 padl6 B32;
- CARD32 padl7 B32;
- CARD32 padl8 B32;
-} xnvCtrlQueryExtensionReply;
-#define sz_xnvCtrlQueryExtensionReply 32
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD32 screen B32;
-} xnvCtrlIsNvReq;
-#define sz_xnvCtrlIsNvReq 8
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- CARD8 padb1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 isnv B32;
- CARD32 padl4 B32;
- CARD32 padl5 B32;
- CARD32 padl6 B32;
- CARD32 padl7 B32;
- CARD32 padl8 B32;
-} xnvCtrlIsNvReply;
-#define sz_xnvCtrlIsNvReply 32
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD32 target_type B32;
-} xnvCtrlQueryTargetCountReq;
-#define sz_xnvCtrlQueryTargetCountReq 8
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- CARD8 padb1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 count B32;
- CARD32 padl4 B32;
- CARD32 padl5 B32;
- CARD32 padl6 B32;
- CARD32 padl7 B32;
- CARD32 padl8 B32;
-} xnvCtrlQueryTargetCountReply;
-#define sz_xnvCtrlQueryTargetCountReply 32
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD16 target_id B16; /* X screen number or GPU number */
- CARD16 target_type B16; /* X screen or GPU */
- CARD32 display_mask B32;
- CARD32 attribute B32;
-} xnvCtrlQueryAttributeReq;
-#define sz_xnvCtrlQueryAttributeReq 16
-
-typedef struct
-{
- BYTE type;
- BYTE pad0;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 flags B32;
- INT32 value B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
-} xnvCtrlQueryAttributeReply;
-#define sz_xnvCtrlQueryAttributeReply 32
-
-typedef struct
-{
- BYTE type;
- BYTE pad0;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 flags B32;
- CARD32 pad3 B32;
- int64_t value_64;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
-} xnvCtrlQueryAttribute64Reply;
-#define sz_xnvCtrlQueryAttribute64Reply 32
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD16 target_id B16;
- CARD16 target_type B16;
- CARD32 display_mask B32;
- CARD32 attribute B32;
- INT32 value B32;
-} xnvCtrlSetAttributeReq;
-#define sz_xnvCtrlSetAttributeReq 20
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD16 target_id B16;
- CARD16 target_type B16;
- CARD32 display_mask B32;
- CARD32 attribute B32;
- INT32 value B32;
-} xnvCtrlSetAttributeAndGetStatusReq;
-#define sz_xnvCtrlSetAttributeAndGetStatusReq 20
-
-typedef struct
-{
- BYTE type;
- BYTE pad0;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 flags B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
-} xnvCtrlSetAttributeAndGetStatusReply;
-#define sz_xnvCtrlSetAttributeAndGetStatusReply 32
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD16 target_id B16; /* X screen number or GPU number */
- CARD16 target_type B16; /* X screen or GPU */
- CARD32 display_mask B32;
- CARD32 attribute B32;
-} xnvCtrlQueryStringAttributeReq;
-#define sz_xnvCtrlQueryStringAttributeReq 16
-
-typedef struct
-{
- BYTE type;
- BYTE pad0;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 flags B32;
- CARD32 n B32; /* Length of string */
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
-} xnvCtrlQueryStringAttributeReply;
-#define sz_xnvCtrlQueryStringAttributeReply 32
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD16 target_id B16;
- CARD16 target_type B16;
- CARD32 display_mask B32;
- CARD32 attribute B32;
- CARD32 num_bytes B32;
-} xnvCtrlSetStringAttributeReq;
-#define sz_xnvCtrlSetStringAttributeReq 20
-
-typedef struct
-{
- BYTE type;
- BYTE pad0;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 flags B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
-} xnvCtrlSetStringAttributeReply;
-#define sz_xnvCtrlSetStringAttributeReply 32
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD16 target_id B16; /* X screen number or GPU number */
- CARD16 target_type B16; /* X screen or GPU */
- CARD32 display_mask B32;
- CARD32 attribute B32;
-} xnvCtrlQueryValidAttributeValuesReq;
-#define sz_xnvCtrlQueryValidAttributeValuesReq 16
-
-typedef struct
-{
- BYTE type;
- BYTE pad0;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 flags B32;
- INT32 attr_type B32;
- INT32 min B32;
- INT32 max B32;
- CARD32 bits B32;
- CARD32 perms B32;
-} xnvCtrlQueryValidAttributeValuesReply;
-#define sz_xnvCtrlQueryValidAttributeValuesReply 32
-
-typedef struct
-{
- BYTE type;
- BYTE pad0;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 flags B32;
- INT32 attr_type B32;
- int64_t min_64;
- int64_t max_64;
- CARD64 bits_64;
- CARD32 perms B32;
- CARD32 pad1 B32;
-} xnvCtrlQueryValidAttributeValues64Reply;
-#define sz_xnvCtrlQueryValidAttributeValues64Reply 48
-#define sz_xnvCtrlQueryValidAttributeValues64Reply_extra ((48 - 32) >> 2)
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD32 attribute B32;
-} xnvCtrlQueryAttributePermissionsReq;
-#define sz_xnvCtrlQueryAttributePermissionsReq 8
-
-typedef struct
-{
- BYTE type;
- BYTE pad0;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 flags B32;
- INT32 attr_type B32;
- CARD32 perms B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
- CARD32 pad8 B32;
-} xnvCtrlQueryAttributePermissionsReply;
-#define sz_xnvCtrlQueryAttributePermissionsReply 32
-
-/* Set GVO Color Conversion request (deprecated) */
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD32 screen B32;
- FLOAT32 row1_col1 F32;
- FLOAT32 row1_col2 F32;
- FLOAT32 row1_col3 F32;
- FLOAT32 row1_col4 F32;
- FLOAT32 row2_col1 F32;
- FLOAT32 row2_col2 F32;
- FLOAT32 row2_col3 F32;
- FLOAT32 row2_col4 F32;
- FLOAT32 row3_col1 F32;
- FLOAT32 row3_col2 F32;
- FLOAT32 row3_col3 F32;
- FLOAT32 row3_col4 F32;
-} xnvCtrlSetGvoColorConversionDeprecatedReq;
-#define sz_xnvCtrlSetGvoColorConversionDeprecatedReq 56
-
-/* Query GVO Color Conversion request (deprecated) */
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD32 screen B32;
-} xnvCtrlQueryGvoColorConversionDeprecatedReq;
-#define sz_xnvCtrlQueryGvoColorConversionDeprecatedReq 8
-
-/* Query GVO Color Conversion reply (deprecated) */
-typedef struct
-{
- BYTE type; /* X_Reply */
- BYTE pad0;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
- CARD32 pad8 B32;
-} xnvCtrlQueryGvoColorConversionDeprecatedReply;
-#define sz_xnvCtrlQueryGvoColorConversionDeprecatedReply 32
-
-/* Set GVO Color Conversion request */
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD32 screen B32;
-
- FLOAT32 cscMatrix_y_r F32;
- FLOAT32 cscMatrix_y_g F32;
- FLOAT32 cscMatrix_y_b F32;
-
- FLOAT32 cscMatrix_cr_r F32;
- FLOAT32 cscMatrix_cr_g F32;
- FLOAT32 cscMatrix_cr_b F32;
-
- FLOAT32 cscMatrix_cb_r F32;
- FLOAT32 cscMatrix_cb_g F32;
- FLOAT32 cscMatrix_cb_b F32;
-
- FLOAT32 cscOffset_y F32;
- FLOAT32 cscOffset_cr F32;
- FLOAT32 cscOffset_cb F32;
-
- FLOAT32 cscScale_y F32;
- FLOAT32 cscScale_cr F32;
- FLOAT32 cscScale_cb F32;
-
-} xnvCtrlSetGvoColorConversionReq;
-#define sz_xnvCtrlSetGvoColorConversionReq 68
-
-/* Query GVO Color Conversion request */
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD32 screen B32;
-} xnvCtrlQueryGvoColorConversionReq;
-#define sz_xnvCtrlQueryGvoColorConversionReq 8
-
-/* Query GVO Color Conversion reply */
-typedef struct
-{
- BYTE type; /* X_Reply */
- BYTE pad0;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
- CARD32 pad8 B32;
-} xnvCtrlQueryGvoColorConversionReply;
-#define sz_xnvCtrlQueryGvoColorConversionReply 32
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD16 target_id B16; /* X screen number or GPU number */
- CARD16 target_type B16; /* X screen or GPU */
- CARD32 display_mask B32;
- CARD32 attribute B32;
-} xnvCtrlQueryBinaryDataReq;
-#define sz_xnvCtrlQueryBinaryDataReq 16
-
-typedef struct
-{
- BYTE type;
- BYTE pad0;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 flags B32;
- CARD32 n B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
-} xnvCtrlQueryBinaryDataReply;
-#define sz_xnvCtrlQueryBinaryDataReply 32
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD32 screen B32;
- CARD16 notifyType B16;
- CARD16 onoff B16;
-} xnvCtrlSelectNotifyReq;
-#define sz_xnvCtrlSelectNotifyReq 12
-
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD16 target_id B16; /* X screen number or GPU number */
- CARD16 target_type B16; /* X screen or GPU */
- CARD32 display_mask B32;
- CARD32 attribute B32;
- CARD32 num_bytes B32; /* Length of string */
-} xnvCtrlStringOperationReq;
-#define sz_xnvCtrlStringOperationReq 20
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- CARD8 padb1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 ret B32;
- CARD32 num_bytes B32; /* Length of string */
- CARD32 padl4 B32;
- CARD32 padl5 B32;
- CARD32 padl6 B32;
- CARD32 padl7 B32;
-} xnvCtrlStringOperationReply;
-#define sz_xnvCtrlStringOperationReply 32
-
-typedef struct
-{
- union
- {
- struct
- {
- BYTE type;
- BYTE detail;
- CARD16 sequenceNumber B16;
- } u;
- struct
- {
- BYTE type;
- BYTE detail;
- CARD16 sequenceNumber B16;
- CARD32 time B32;
- CARD32 screen B32;
- CARD32 display_mask B32;
- CARD32 attribute B32;
- CARD32 value B32;
- CARD32 pad0 B32;
- CARD32 pad1 B32;
- } attribute_changed;
- } u;
-} xnvctrlEvent;
-
-/*
- * Leave target_type before target_id for the
- * xnvCtrlSelectTargetNotifyReq and xnvctrlEventTarget
- * structures, even though other request protocol structures
- * store target_id in the bottom 16-bits of the second DWORD of the
- * structures. The event-related structures were added in version
- * 1.8, and so there is no prior version with which to maintain
- * compatibility.
- */
-typedef struct
-{
- CARD8 reqType;
- CARD8 nvReqType;
- CARD16 length B16;
- CARD16 target_type B16; /* Don't swap these */
- CARD16 target_id B16;
- CARD16 notifyType B16;
- CARD16 onoff B16;
-} xnvCtrlSelectTargetNotifyReq;
-#define sz_xnvCtrlSelectTargetNotifyReq 12
-
-typedef struct
-{
- union
- {
- struct
- {
- BYTE type;
- BYTE detail;
- CARD16 sequenceNumber B16;
- } u;
- struct
- {
- BYTE type;
- BYTE detail;
- CARD16 sequenceNumber B16;
- CARD32 time B32;
- CARD16 target_type B16; /* Don't swap these */
- CARD16 target_id B16;
- CARD32 display_mask B32;
- CARD32 attribute B32;
- CARD32 value B32;
- CARD32 pad0 B32;
- CARD32 pad1 B32;
- } attribute_changed;
- struct
- {
- BYTE type;
- BYTE detail;
- CARD16 sequenceNumber B16;
- CARD32 time B32;
- CARD16 target_type B16; /* Don't swap these */
- CARD16 target_id B16;
- CARD32 display_mask B32;
- CARD32 attribute B32;
- CARD32 value B32;
- CARD8 availability;
- CARD8 pad0;
- CARD16 pad1 B16;
- CARD32 pad2 B32;
- } availability_changed;
- } u;
-} xnvctrlEventTarget;
-
-#endif /* __NVCONTROL_H */
diff --git a/src/3rdparty/angle/src/third_party/systeminfo/SystemInfo.cpp b/src/3rdparty/angle/src/third_party/systeminfo/SystemInfo.cpp
deleted file mode 100644
index 97dfcaac51..0000000000
--- a/src/3rdparty/angle/src/third_party/systeminfo/SystemInfo.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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/src/3rdparty/angle/src/third_party/systeminfo/SystemInfo.h b/src/3rdparty/angle/src/third_party/systeminfo/SystemInfo.h
deleted file mode 100644
index 226085fbd3..0000000000
--- a/src/3rdparty/angle/src/third_party/systeminfo/SystemInfo.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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/src/3rdparty/angle/src/third_party/trace_event/trace_event.h b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
deleted file mode 100644
index bdb8804428..0000000000
--- a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
+++ /dev/null
@@ -1,798 +0,0 @@
-// 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(category, name) \
- INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name)
-#define TRACE_EVENT1(category, name, arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, arg1_name, arg1_val)
-#define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
- INTERNAL_TRACE_EVENT_ADD_SCOPED(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(category, name) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
- category, name, TRACE_EVENT_FLAG_NONE)
-#define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
- category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
-#define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \
- arg2_name, arg2_val) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
- category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
- arg2_name, arg2_val)
-#define TRACE_EVENT_COPY_INSTANT0(category, name) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
- category, name, TRACE_EVENT_FLAG_COPY)
-#define TRACE_EVENT_COPY_INSTANT1(category, name, arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
- category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_INSTANT2(category, name, arg1_name, arg1_val, \
- arg2_name, arg2_val) \
- INTERNAL_TRACE_EVENT_ADD(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(category, name) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \
- category, name, TRACE_EVENT_FLAG_NONE)
-#define TRACE_EVENT_BEGIN1(category, name, arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \
- category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
-#define TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val, \
- arg2_name, arg2_val) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \
- category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
- arg2_name, arg2_val)
-#define TRACE_EVENT_COPY_BEGIN0(category, name) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \
- category, name, TRACE_EVENT_FLAG_COPY)
-#define TRACE_EVENT_COPY_BEGIN1(category, name, arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \
- category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_BEGIN2(category, name, arg1_name, arg1_val, \
- arg2_name, arg2_val) \
- INTERNAL_TRACE_EVENT_ADD(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(category, name) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \
- category, name, TRACE_EVENT_FLAG_NONE)
-#define TRACE_EVENT_END1(category, name, arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \
- category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
-#define TRACE_EVENT_END2(category, name, arg1_name, arg1_val, \
- arg2_name, arg2_val) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \
- category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
- arg2_name, arg2_val)
-#define TRACE_EVENT_COPY_END0(category, name) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \
- category, name, TRACE_EVENT_FLAG_COPY)
-#define TRACE_EVENT_COPY_END1(category, name, arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \
- category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_END2(category, name, arg1_name, arg1_val, \
- arg2_name, arg2_val) \
- INTERNAL_TRACE_EVENT_ADD(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(category, name, value) \
- INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, \
- category, name, TRACE_EVENT_FLAG_NONE, \
- "value", static_cast<int>(value))
-#define TRACE_COPY_COUNTER1(category, name, value) \
- INTERNAL_TRACE_EVENT_ADD(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(category, name, value1_name, value1_val, \
- value2_name, value2_val) \
- INTERNAL_TRACE_EVENT_ADD(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(category, name, value1_name, value1_val, \
- value2_name, value2_val) \
- INTERNAL_TRACE_EVENT_ADD(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(category, name, id, value) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \
- category, name, id, TRACE_EVENT_FLAG_NONE, \
- "value", static_cast<int>(value))
-#define TRACE_COPY_COUNTER_ID1(category, name, id, value) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(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(category, name, id, value1_name, value1_val, \
- value2_name, value2_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(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(category, name, id, value1_name, value1_val, \
- value2_name, value2_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(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(category, name, id) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
- category, name, id, TRACE_EVENT_FLAG_NONE)
-#define TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
- category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
-#define TRACE_EVENT_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \
- arg2_name, arg2_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(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(category, name, id) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
- category, name, id, TRACE_EVENT_FLAG_COPY)
-#define TRACE_EVENT_COPY_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
- category, name, id, TRACE_EVENT_FLAG_COPY, \
- arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \
- arg2_name, arg2_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(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(category, name, id, step) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP, \
- category, name, id, TRACE_EVENT_FLAG_NONE, "step", step)
-#define TRACE_EVENT_ASYNC_STEP1(category, name, id, step, \
- arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP, \
- category, name, id, TRACE_EVENT_FLAG_NONE, "step", step, \
- arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_ASYNC_STEP0(category, name, id, step) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP, \
- category, name, id, TRACE_EVENT_FLAG_COPY, "step", step)
-#define TRACE_EVENT_COPY_ASYNC_STEP1(category, name, id, step, \
- arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(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(category, name, id) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
- category, name, id, TRACE_EVENT_FLAG_NONE)
-#define TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
- category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
-#define TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name, arg1_val, \
- arg2_name, arg2_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(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(category, name, id) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
- category, name, id, TRACE_EVENT_FLAG_COPY)
-#define TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
- category, name, id, TRACE_EVENT_FLAG_COPY, \
- arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name, arg1_val, \
- arg2_name, arg2_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(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(category) \
- static const unsigned char* INTERNALTRACEEVENTUID(catstatic) = 0; \
- if (!INTERNALTRACEEVENTUID(catstatic)) \
- INTERNALTRACEEVENTUID(catstatic) = \
- TRACE_EVENT_API_GET_CATEGORY_ENABLED(category);
-
-// Implementation detail: internal macro to create static category and add
-// event if the category is enabled.
-#define INTERNAL_TRACE_EVENT_ADD(phase, category, name, flags, ...) \
- do { \
- INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \
- if (*INTERNALTRACEEVENTUID(catstatic)) { \
- gl::TraceEvent::addTraceEvent( \
- 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(category, name, ...) \
- INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \
- gl::TraceEvent::TraceEndOnScopeClose \
- INTERNALTRACEEVENTUID(profileScope); \
- if (*INTERNALTRACEEVENTUID(catstatic)) { \
- gl::TraceEvent::addTraceEvent( \
- TRACE_EVENT_PHASE_BEGIN, \
- INTERNALTRACEEVENTUID(catstatic), \
- name, gl::TraceEvent::noEventId, \
- TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__); \
- INTERNALTRACEEVENTUID(profileScope).initialize( \
- 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(phase, category, name, id, flags, \
- ...) \
- do { \
- INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \
- if (*INTERNALTRACEEVENTUID(catstatic)) { \
- unsigned char traceEventFlags = flags | TRACE_EVENT_FLAG_HAS_ID; \
- gl::TraceEvent::TraceID traceEventTraceID( \
- id, &traceEventFlags); \
- gl::TraceEvent::addTraceEvent( \
- 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(char phase,
- const unsigned char *categoryEnabled,
- const char *name,
- unsigned long long id,
- unsigned char flags)
-{
- return TRACE_EVENT_API_ADD_TRACE_EVENT(
- phase, categoryEnabled, name, id,
- zeroNumArgs, 0, 0, 0,
- flags);
-}
-
-template <class ARG1_TYPE>
-static inline angle::TraceEventHandle addTraceEvent(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(
- phase, categoryEnabled, name, id,
- numArgs, &arg1Name, argTypes, argValues,
- flags);
-}
-
-template <class ARG1_TYPE, class ARG2_TYPE>
-static inline angle::TraceEventHandle addTraceEvent(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(
- 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(const unsigned char* categoryEnabled,
- const char* name)
- {
- 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(
- 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 {
- const unsigned char* categoryEnabled;
- const char* name;
- };
- Data* m_pdata;
- Data m_data;
-};
-
-} // namespace TraceEvent
-
-} // namespace gl
-
-#endif