summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2014-02-24 11:18:33 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-26 07:56:50 +0100
commita7d093e740b1e20874b5ebeb37b5c5d76ae19e42 (patch)
tree573b63025dbaa090392e468e1a90de8104054578 /src/3rdparty/angle
parent45e17d0cc74d3444e23c18f73d6ac155659cec55 (diff)
Upgrade ANGLE to 1.3.5bb7ec572d0a
This brings Qt's copy of ANGLE up to ANGLE master, which contains a number of bugfixes as well as restructuring for the upcoming ES 3.0 support. This version brings considerable stability improvements to the D3D11 renderer. The static translator project files have been merged to align with the ANGLE source tree. Two new patches have been applied to fix errors in upstream ANGLE: - 0011-ANGLE-Fix-compilation-error-on-MinGW-caused-by-trace.patch The event trace header in ANGLE's third_party directory has an unused template which causes a compilation error on MinGW. Disable this part of the code. - 0012-ANGLE-fix-semantic-index-lookup.patch The sorted semantic index table was returning a direct mapping to the new indices, instead of the old indices. This caused a mismatch in the GL type lookup for the translated attribute. All other patches have been rebased, removed if no longer needed, and renamed to clear up the application order: - 0001-Fix-compilation-for-MSVC-2008-and-std-tuple.patch No changes. - 0001-Fix-compilation-with-MinGW-mingw-tdm64-gcc-4.8.1.patch No changes. Renamed to 0002. - 0001-Fix-compilation-with-MinGW-gcc-64-bit.patch No changes. Renamed to 0003. - 0001-Make-it-possible-to-link-ANGLE-statically-for-single.patch Modified patch to adapt to new DLL loading structure. Renamed to 0004. - 0005-Fix-build-when-SSE2-is-not-available.patch No changes. - 0011-Fix-compilation-of-libGLESv2-with-older-MinGW-w64-he.patch No changes. Renamed to 0006. - 0006-Make-DX9-DX11-mutually-exclusive.patch Made the patch less invasive by allowing D3D9 code to run unless explicitly disabled (e.g. on WinRT, where it doesn't compile). This makes the patch smaller and allows Desktop Windows to compile both D3D9 and D3D11 codepaths. Renamed to 0007. - 0015-ANGLE-Dynamically-load-D3D-compiler-from-a-list-of-k.patch No changes. Renamed to 0008. - 0012-ANGLE-Support-WinRT.patch Made D3D11_level9 initialization only possible if D3D9 is disabled. This makes sure Desktop PCs use the old D3D9 codepath instead of the less-tested D3D11_level9 codepath. Renamed to 0009. - 0013-Enable-D3D11-for-feature-level-9-cards.patch Conveniently smaller patch due to buffer implementation improvements upstream. Renamed to 0010. - 0014-ANGLE-D3D11-Alwayls-execute-QueryInterface.patch This was a fix for patch 0009, so was integrated there. Removed. - 0016-ANGLE-D3D11-Fix-build-on-desktop-Windows.patch This was a fix for patch 0009, so it was integrated there. Removed. - 0001-ANGLE-Fix-compilation-with-MSVC2013.patch Fixed upstream. Removed. - 0007-ANGLE-Fix-typedefs-for-Win64.patch Fixed upstream. Removed. - 0004-Fix-black-screen-after-minimizing-OpenGL-window-with.patch The issue has been fixed in Qt itself. Removed. - 0008-DX11-Prevent-assert-when-view-is-minimized-or-.patch The cause of the problem was the same as patch 0004, but for the D3D11 codepath. Removed. Change-Id: Id69484ab3a3e013050741c462fb1b06dfb0fd112 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Diffstat (limited to 'src/3rdparty/angle')
-rw-r--r--src/3rdparty/angle/AUTHORS2
-rw-r--r--src/3rdparty/angle/LICENSE.preprocessor45
-rw-r--r--src/3rdparty/angle/include/GLSLANG/ShaderLang.h33
-rw-r--r--src/3rdparty/angle/include/KHR/khrplatform.h8
-rw-r--r--src/3rdparty/angle/src/commit.h2
-rw-r--r--src/3rdparty/angle/src/common/angleutils.h14
-rw-r--r--src/3rdparty/angle/src/common/debug.cpp44
-rw-r--r--src/3rdparty/angle/src/common/debug.h32
-rw-r--r--src/3rdparty/angle/src/common/event_tracer.cpp2
-rw-r--r--src/3rdparty/angle/src/common/event_tracer.h12
-rw-r--r--src/3rdparty/angle/src/common/system.h26
-rw-r--r--src/3rdparty/angle/src/common/version.h18
-rw-r--r--src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp33
-rw-r--r--src/3rdparty/angle/src/compiler/DetectRecursion.cpp125
-rw-r--r--src/3rdparty/angle/src/compiler/DetectRecursion.h60
-rw-r--r--src/3rdparty/angle/src/compiler/InitializeGLPosition.cpp61
-rw-r--r--src/3rdparty/angle/src/compiler/InitializeGLPosition.h33
-rw-r--r--src/3rdparty/angle/src/compiler/IntermTraverse.cpp293
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp84
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h86
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp78
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y18
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp6
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp4
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BaseTypes.h (renamed from src/3rdparty/angle/src/compiler/BaseTypes.h)1
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp (renamed from src/3rdparty/angle/src/compiler/BuiltInFunctionEmulator.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h (renamed from src/3rdparty/angle/src/compiler/BuiltInFunctionEmulator.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/CodeGen.cpp (renamed from src/3rdparty/angle/src/compiler/CodeGenGLSL.cpp)12
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Common.h (renamed from src/3rdparty/angle/src/compiler/Common.h)17
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Compiler.cpp (renamed from src/3rdparty/angle/src/compiler/Compiler.cpp)216
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ConstantUnion.h (renamed from src/3rdparty/angle/src/compiler/ConstantUnion.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DetectCallDepth.cpp (renamed from src/3rdparty/angle/src/compiler/DetectCallDepth.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DetectCallDepth.h (renamed from src/3rdparty/angle/src/compiler/DetectCallDepth.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.cpp (renamed from src/3rdparty/angle/src/compiler/DetectDiscontinuity.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.h (renamed from src/3rdparty/angle/src/compiler/DetectDiscontinuity.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Diagnostics.cpp (renamed from src/3rdparty/angle/src/compiler/Diagnostics.cpp)10
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Diagnostics.h (renamed from src/3rdparty/angle/src/compiler/Diagnostics.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DirectiveHandler.cpp (renamed from src/3rdparty/angle/src/compiler/DirectiveHandler.cpp)26
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DirectiveHandler.h (renamed from src/3rdparty/angle/src/compiler/DirectiveHandler.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.h (renamed from src/3rdparty/angle/src/compiler/ExtensionBehavior.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.cpp (renamed from src/3rdparty/angle/src/compiler/ForLoopUnroll.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.h (renamed from src/3rdparty/angle/src/compiler/ForLoopUnroll.h)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/HashNames.h (renamed from src/3rdparty/angle/src/compiler/HashNames.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InfoSink.cpp (renamed from src/3rdparty/angle/src/compiler/InfoSink.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InfoSink.h (renamed from src/3rdparty/angle/src/compiler/InfoSink.h)3
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Initialize.cpp (renamed from src/3rdparty/angle/src/compiler/Initialize.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Initialize.h (renamed from src/3rdparty/angle/src/compiler/Initialize.h)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeDll.cpp (renamed from src/3rdparty/angle/src/compiler/InitializeDll.cpp)8
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeDll.h (renamed from src/3rdparty/angle/src/compiler/InitializeDll.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeGlobals.h (renamed from src/3rdparty/angle/src/compiler/InitializeGlobals.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeParseContext.cpp (renamed from src/3rdparty/angle/src/compiler/InitializeParseContext.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeParseContext.h (renamed from src/3rdparty/angle/src/compiler/InitializeParseContext.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp116
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeVariables.h50
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp259
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Intermediate.cpp (renamed from src/3rdparty/angle/src/compiler/Intermediate.cpp)76
-rw-r--r--src/3rdparty/angle/src/compiler/translator/MMap.h (renamed from src/3rdparty/angle/src/compiler/MMap.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/MapLongVariableNames.cpp (renamed from src/3rdparty/angle/src/compiler/MapLongVariableNames.cpp)9
-rw-r--r--src/3rdparty/angle/src/compiler/translator/MapLongVariableNames.h (renamed from src/3rdparty/angle/src/compiler/MapLongVariableNames.h)5
-rw-r--r--src/3rdparty/angle/src/compiler/translator/NodeSearch.h80
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputESSL.cpp (renamed from src/3rdparty/angle/src/compiler/OutputESSL.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputESSL.h (renamed from src/3rdparty/angle/src/compiler/OutputESSL.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSL.cpp (renamed from src/3rdparty/angle/src/compiler/OutputGLSL.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSL.h (renamed from src/3rdparty/angle/src/compiler/OutputGLSL.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp (renamed from src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp)12
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h (renamed from src/3rdparty/angle/src/compiler/OutputGLSLBase.h)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp (renamed from src/3rdparty/angle/src/compiler/OutputHLSL.cpp)90
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputHLSL.h (renamed from src/3rdparty/angle/src/compiler/OutputHLSL.h)7
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ParseContext.cpp (renamed from src/3rdparty/angle/src/compiler/ParseHelper.cpp)10
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ParseContext.h (renamed from src/3rdparty/angle/src/compiler/ParseHelper.h)10
-rw-r--r--src/3rdparty/angle/src/compiler/translator/PoolAlloc.cpp (renamed from src/3rdparty/angle/src/compiler/PoolAlloc.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/PoolAlloc.h (renamed from src/3rdparty/angle/src/compiler/PoolAlloc.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Pragma.h (renamed from src/3rdparty/angle/src/compiler/Pragma.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/QualifierAlive.cpp (renamed from src/3rdparty/angle/src/compiler/QualifierAlive.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/QualifierAlive.h (renamed from src/3rdparty/angle/src/compiler/QualifierAlive.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveTree.cpp (renamed from src/3rdparty/angle/src/compiler/RemoveTree.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveTree.h (renamed from src/3rdparty/angle/src/compiler/RemoveTree.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RenameFunction.h (renamed from src/3rdparty/angle/src/compiler/RenameFunction.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp98
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h39
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SearchSymbol.cpp (renamed from src/3rdparty/angle/src/compiler/SearchSymbol.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SearchSymbol.h (renamed from src/3rdparty/angle/src/compiler/SearchSymbol.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ShHandle.h (renamed from src/3rdparty/angle/src/compiler/ShHandle.h)22
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp (renamed from src/3rdparty/angle/src/compiler/ShaderLang.cpp)11
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp (renamed from src/3rdparty/angle/src/compiler/SymbolTable.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SymbolTable.h (renamed from src/3rdparty/angle/src/compiler/SymbolTable.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorESSL.cpp (renamed from src/3rdparty/angle/src/compiler/TranslatorESSL.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorESSL.h (renamed from src/3rdparty/angle/src/compiler/TranslatorESSL.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.cpp (renamed from src/3rdparty/angle/src/compiler/TranslatorGLSL.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.h (renamed from src/3rdparty/angle/src/compiler/TranslatorGLSL.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp (renamed from src/3rdparty/angle/src/compiler/TranslatorHLSL.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h (renamed from src/3rdparty/angle/src/compiler/TranslatorHLSL.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Types.h (renamed from src/3rdparty/angle/src/compiler/Types.h)26
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.cpp (renamed from src/3rdparty/angle/src/compiler/UnfoldShortCircuit.cpp)20
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.h (renamed from src/3rdparty/angle/src/compiler/UnfoldShortCircuit.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp81
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h51
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Uniform.cpp (renamed from src/3rdparty/angle/src/compiler/Uniform.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Uniform.h (renamed from src/3rdparty/angle/src/compiler/Uniform.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateLimitations.cpp (renamed from src/3rdparty/angle/src/compiler/ValidateLimitations.cpp)10
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h (renamed from src/3rdparty/angle/src/compiler/ValidateLimitations.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariableInfo.cpp (renamed from src/3rdparty/angle/src/compiler/VariableInfo.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariableInfo.h (renamed from src/3rdparty/angle/src/compiler/VariableInfo.h)3
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp (renamed from src/3rdparty/angle/src/compiler/VariablePacker.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariablePacker.h (renamed from src/3rdparty/angle/src/compiler/VariablePacker.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp (renamed from src/3rdparty/angle/src/compiler/VersionGLSL.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VersionGLSL.h (renamed from src/3rdparty/angle/src/compiler/VersionGLSL.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/compilerdebug.cpp (renamed from src/3rdparty/angle/src/compiler/debug.cpp)8
-rw-r--r--src/3rdparty/angle/src/compiler/translator/compilerdebug.h (renamed from src/3rdparty/angle/src/compiler/debug.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.cpp (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraph.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.h (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraph.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraphBuilder.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.h (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraphBuilder.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphOutput.cpp (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraphOutput.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphOutput.h (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraphOutput.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphTraverse.cpp (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraphTraverse.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/glslang.h (renamed from src/3rdparty/angle/src/compiler/glslang.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/glslang.l (renamed from src/3rdparty/angle/src/compiler/glslang.l)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/glslang.y (renamed from src/3rdparty/angle/src/compiler/glslang.y)54
-rw-r--r--src/3rdparty/angle/src/compiler/translator/intermOut.cpp (renamed from src/3rdparty/angle/src/compiler/intermOut.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/intermediate.h (renamed from src/3rdparty/angle/src/compiler/intermediate.h)80
-rw-r--r--src/3rdparty/angle/src/compiler/translator/localintermediate.h (renamed from src/3rdparty/angle/src/compiler/localintermediate.h)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/osinclude.h (renamed from src/3rdparty/angle/src/compiler/osinclude.h)20
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ossource_posix.cpp (renamed from src/3rdparty/angle/src/compiler/ossource_posix.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ossource_win.cpp (renamed from src/3rdparty/angle/src/compiler/ossource_win.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ossource_winrt.cpp (renamed from src/3rdparty/angle/src/compiler/ossource_winrt.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/parseConst.cpp (renamed from src/3rdparty/angle/src/compiler/parseConst.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp (renamed from src/3rdparty/angle/src/compiler/timing/RestrictFragmentShaderTiming.cpp)8
-rw-r--r--src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h (renamed from src/3rdparty/angle/src/compiler/timing/RestrictFragmentShaderTiming.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp (renamed from src/3rdparty/angle/src/compiler/timing/RestrictVertexShaderTiming.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h (renamed from src/3rdparty/angle/src/compiler/timing/RestrictVertexShaderTiming.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/util.cpp (renamed from src/3rdparty/angle/src/compiler/util.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/util.h (renamed from src/3rdparty/angle/src/compiler/util.h)0
-rw-r--r--src/3rdparty/angle/src/libEGL/Display.cpp11
-rw-r--r--src/3rdparty/angle/src/libEGL/Display.h5
-rw-r--r--src/3rdparty/angle/src/libEGL/Surface.cpp41
-rw-r--r--src/3rdparty/angle/src/libEGL/Surface.h3
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGL.cpp12
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGL.rc11
-rw-r--r--src/3rdparty/angle/src/libEGL/main.cpp135
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Buffer.cpp8
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Buffer.h4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Context.cpp30
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Context.h9
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Framebuffer.h2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp37
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Renderbuffer.cpp15
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Renderbuffer.h5
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Shader.cpp2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Shader.h3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Texture.cpp8
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp10
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2.rc11
-rw-r--r--src/3rdparty/angle/src/libGLESv2/main.cpp112
-rw-r--r--src/3rdparty/angle/src/libGLESv2/main.h3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/mathutil.h1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/precompiled.h57
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp361
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h56
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp83
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h34
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h7
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/VertexDataManager.cpp4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp366
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.h92
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Fence11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Fence11.cpp)4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Fence11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Fence11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Image11.cpp)48
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Image11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.cpp)8
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.cpp)14
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Query11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Query11.cpp)4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Query11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Query11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.cpp)60
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.h)22
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.cpp)6
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp)400
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h)20
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.cpp)2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp)215
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.cpp)18
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.cpp)4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.cpp)2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl (renamed from src/3rdparty/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough11.hlsl (renamed from src/3rdparty/angle/src/libGLESv2/renderer/shaders/Passthrough11.hlsl)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Blit.cpp)20
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Blit.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.cpp)4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.h)2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Fence9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Fence9.cpp)6
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Fence9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Fence9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Image9.cpp)12
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Image9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.cpp)4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Query9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Query9.cpp)6
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Query9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Query9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.cpp)6
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Renderer9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.cpp)207
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Renderer9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.h)14
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.cpp)2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/SwapChain9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.cpp)44
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/SwapChain9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.cpp)10
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.cpp)8
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.cpp)4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.cpp)2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.ps (renamed from src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.ps)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.vs (renamed from src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.vs)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/vertexconversion.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/vertexconversion.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/utilities.cpp63
-rw-r--r--src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h4
-rw-r--r--src/3rdparty/angle/src/third_party/trace_event/trace_event.h4
229 files changed, 3161 insertions, 2503 deletions
diff --git a/src/3rdparty/angle/AUTHORS b/src/3rdparty/angle/AUTHORS
index a2ce91575a..0bdb65ee9a 100644
--- a/src/3rdparty/angle/AUTHORS
+++ b/src/3rdparty/angle/AUTHORS
@@ -13,6 +13,8 @@ TransGaming Inc.
Adobe Systems Inc.
Autodesk, Inc.
+BlackBerry Limited
+Cable Television Laboratories, Inc.
Cloud Party, Inc.
Intel Corporation
Mozilla Corporation
diff --git a/src/3rdparty/angle/LICENSE.preprocessor b/src/3rdparty/angle/LICENSE.preprocessor
deleted file mode 100644
index 0ec2123b61..0000000000
--- a/src/3rdparty/angle/LICENSE.preprocessor
+++ /dev/null
@@ -1,45 +0,0 @@
-Files in src/compiler/preprocessor are provided under the following license:
-
-****************************************************************************
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-****************************************************************************
diff --git a/src/3rdparty/angle/include/GLSLANG/ShaderLang.h b/src/3rdparty/angle/include/GLSLANG/ShaderLang.h
index 28bf516f7f..9912939b95 100644
--- a/src/3rdparty/angle/include/GLSLANG/ShaderLang.h
+++ b/src/3rdparty/angle/include/GLSLANG/ShaderLang.h
@@ -6,20 +6,20 @@
#ifndef _COMPILER_INTERFACE_INCLUDED_
#define _COMPILER_INTERFACE_INCLUDED_
-#if defined(COMPONENT_BUILD)
+#if defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC)
#if defined(_WIN32) || defined(_WIN64)
-#if defined(COMPILER_IMPLEMENTATION)
+#if defined(ANGLE_TRANSLATOR_IMPLEMENTATION)
#define COMPILER_EXPORT __declspec(dllexport)
#else
#define COMPILER_EXPORT __declspec(dllimport)
-#endif // defined(COMPILER_IMPLEMENTATION)
+#endif // defined(ANGLE_TRANSLATOR_IMPLEMENTATION)
-#else // defined(WIN32)
+#else // defined(_WIN32) || defined(_WIN64)
#define COMPILER_EXPORT __attribute__((visibility("default")))
#endif
-#else // defined(COMPONENT_BUILD)
+#else // defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC)
#define COMPILER_EXPORT
#endif
@@ -146,14 +146,14 @@ typedef enum {
// This is needed only as a workaround for certain OpenGL driver bugs.
SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100,
- // This is an experimental flag to enforce restrictions that aim to prevent
+ // This is an experimental flag to enforce restrictions that aim to prevent
// timing attacks.
// It generates compilation errors for shaders that could expose sensitive
// texture information via the timing channel.
// To use this flag, you must compile the shader under the WebGL spec
// (using the SH_WEBGL_SPEC flag).
SH_TIMING_RESTRICTIONS = 0x0200,
-
+
// This flag prints the dependency graph that is used to enforce timing
// restrictions on fragment shaders.
// This flag only has an effect if all of the following are true:
@@ -184,11 +184,24 @@ typedef enum {
// This flag limits the depth of the call stack.
SH_LIMIT_CALL_STACK_DEPTH = 0x4000,
- // This flag initializes gl_Position to vec4(0.0, 0.0, 0.0, 1.0) at
- // the beginning of the vertex shader, and has no effect in the
+ // This flag initializes gl_Position to vec4(0,0,0,0) at the
+ // beginning of the vertex shader's main(), and has no effect in the
// fragment shader. It is intended as a workaround for drivers which
// incorrectly fail to link programs if gl_Position is not written.
SH_INIT_GL_POSITION = 0x8000,
+
+ // This flag replaces
+ // "a && b" with "a ? b : false",
+ // "a || b" with "a ? true : b".
+ // This is to work around a MacOSX driver bug that |b| is executed
+ // independent of |a|'s value.
+ SH_UNFOLD_SHORT_CIRCUIT = 0x10000,
+
+ // This flag initializes varyings without static use in vertex shader
+ // at the beginning of main(), and has no effects in the fragment shader.
+ // It is intended as a workaround for drivers which incorrectly optimize
+ // out such varyings and cause a link failure.
+ SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x20000,
} ShCompileOptions;
// Defines alternate strategies for implementing array index clamping.
@@ -267,7 +280,7 @@ COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources);
//
// ShHandle held by but opaque to the driver. It is allocated,
-// managed, and de-allocated by the compiler. It's contents
+// managed, and de-allocated by the compiler. It's contents
// are defined by and used by the compiler.
//
// If handle creation fails, 0 will be returned.
diff --git a/src/3rdparty/angle/include/KHR/khrplatform.h b/src/3rdparty/angle/include/KHR/khrplatform.h
index 001e925f46..1ac2d3f324 100644
--- a/src/3rdparty/angle/include/KHR/khrplatform.h
+++ b/src/3rdparty/angle/include/KHR/khrplatform.h
@@ -26,7 +26,7 @@
/* Khronos platform-specific types and definitions.
*
- * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+ * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
@@ -221,6 +221,12 @@ typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
+
+/*
+ * Types that differ between LLP64 and LP64 architectures - in LLP64,
+ * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
+ * to be the only LLP64 architecture in current use.
+ */
#ifdef _WIN64
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
diff --git a/src/3rdparty/angle/src/commit.h b/src/3rdparty/angle/src/commit.h
new file mode 100644
index 0000000000..f4a36a3cfe
--- /dev/null
+++ b/src/3rdparty/angle/src/commit.h
@@ -0,0 +1,2 @@
+#define ANGLE_COMMIT_HASH "5bb7ec572d0a"
+#define ANGLE_COMMIT_HASH_SIZE 12
diff --git a/src/3rdparty/angle/src/common/angleutils.h b/src/3rdparty/angle/src/common/angleutils.h
index 9761567fb2..7723f0fb72 100644
--- a/src/3rdparty/angle/src/common/angleutils.h
+++ b/src/3rdparty/angle/src/common/angleutils.h
@@ -42,6 +42,20 @@ void SafeRelease(T& resource)
}
}
+template <typename T>
+void SafeDelete(T*& resource)
+{
+ delete resource;
+ resource = NULL;
+}
+
+template <typename T>
+void SafeDeleteArray(T*& resource)
+{
+ delete[] resource;
+ resource = NULL;
+}
+
#if defined(_MSC_VER)
#define snprintf _snprintf
#endif
diff --git a/src/3rdparty/angle/src/common/debug.cpp b/src/3rdparty/angle/src/common/debug.cpp
index 9b932567b0..05d3dc62ad 100644
--- a/src/3rdparty/angle/src/common/debug.cpp
+++ b/src/3rdparty/angle/src/common/debug.cpp
@@ -7,21 +7,23 @@
// debug.cpp: Debugging utilities.
#include "common/debug.h"
-#include "common/system.h"
-#ifndef ANGLE_ENABLE_D3D11
+#include <stdarg.h>
+
+#if defined(ANGLE_ENABLE_PERF)
#include <d3d9.h>
-#else
-typedef DWORD D3DCOLOR;
#endif
namespace gl
{
-
+#if defined(ANGLE_ENABLE_PERF)
typedef void (WINAPI *PerfOutputFunction)(D3DCOLOR, LPCWSTR);
+#else
+typedef void (*PerfOutputFunction)(unsigned int, const wchar_t*);
+#endif
static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
{
-#if !defined(ANGLE_DISABLE_PERF)
+#if defined(ANGLE_ENABLE_PERF)
if (perfActive())
{
char message[32768];
@@ -41,15 +43,15 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c
perfFunc(0, wideMessage);
}
-#endif
+#endif // ANGLE_ENABLE_PERF
-#if !defined(ANGLE_DISABLE_TRACE)
+#if defined(ANGLE_ENABLE_TRACE)
#if defined(NDEBUG)
if (traceFileDebugOnly)
{
return;
}
-#endif
+#endif // NDEBUG
FILE* file = fopen(TRACE_OUTPUT_FILE, "a");
if (file)
@@ -57,50 +59,50 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c
vfprintf(file, format, vararg);
fclose(file);
}
-#endif
+#endif // ANGLE_ENABLE_TRACE
}
void trace(bool traceFileDebugOnly, const char *format, ...)
{
va_list vararg;
va_start(vararg, format);
-#if defined(ANGLE_DISABLE_PERF)
- output(traceFileDebugOnly, NULL, format, vararg);
-#else
+#if defined(ANGLE_ENABLE_PERF)
output(traceFileDebugOnly, D3DPERF_SetMarker, format, vararg);
+#else
+ output(traceFileDebugOnly, NULL, format, vararg);
#endif
va_end(vararg);
}
bool perfActive()
{
-#if defined(ANGLE_DISABLE_PERF)
- return false;
-#else
+#if defined(ANGLE_ENABLE_PERF)
static bool active = D3DPERF_GetStatus() != 0;
return active;
+#else
+ return false;
#endif
}
ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
{
-#if !defined(ANGLE_DISABLE_PERF)
-#if defined(ANGLE_DISABLE_TRACE)
+#if defined(ANGLE_ENABLE_PERF)
+#if !defined(ANGLE_ENABLE_TRACE)
if (!perfActive())
{
return;
}
-#endif
+#endif // !ANGLE_ENABLE_TRACE
va_list vararg;
va_start(vararg, format);
output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg);
va_end(vararg);
-#endif
+#endif // ANGLE_ENABLE_PERF
}
ScopedPerfEventHelper::~ScopedPerfEventHelper()
{
-#if !defined(ANGLE_DISABLE_PERF)
+#if defined(ANGLE_ENABLE_PERF)
if (perfActive())
{
D3DPERF_EndEvent();
diff --git a/src/3rdparty/angle/src/common/debug.h b/src/3rdparty/angle/src/common/debug.h
index 23ee26d23b..793843895c 100644
--- a/src/3rdparty/angle/src/common/debug.h
+++ b/src/3rdparty/angle/src/common/debug.h
@@ -39,33 +39,35 @@ namespace gl
}
// A macro to output a trace of a function call and its arguments to the debugging log
-#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
-#define TRACE(message, ...) (void(0))
-#else
+#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
#define TRACE(message, ...) gl::trace(true, "trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+#define TRACE(message, ...) (void(0))
#endif
// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
-#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
-#define FIXME(message, ...) (void(0))
-#else
+#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
#define FIXME(message, ...) gl::trace(false, "fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+#define FIXME(message, ...) (void(0))
#endif
// A macro to output a function call and its arguments to the debugging log, in case of error.
-#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
-#define ERR(message, ...) (void(0))
-#else
+#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
#define ERR(message, ...) gl::trace(false, "err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+#define ERR(message, ...) (void(0))
#endif
// A macro to log a performance event around a scope.
-#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
-#define EVENT(message, ...) (void(0))
-#elif defined(_MSC_VER)
+#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
+#if defined(_MSC_VER)
#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper ## __LINE__(__FUNCTION__ message "\n", __VA_ARGS__);
#else
#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper(message "\n", ##__VA_ARGS__);
+#endif // _MSC_VER
+#else
+#define EVENT(message, ...) (void(0))
#endif
// A macro asserting a condition and outputting failures to the debug log
@@ -99,8 +101,10 @@ namespace gl
#define UNREACHABLE() ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__)
#endif
-// A macro that determines whether an object has a given runtime type.
-#if !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI))
+// A macro that determines whether an object has a given runtime type. MSVC uses _CPPRTTI.
+// GCC uses __GXX_RTTI, but the macro was introduced in version 4.3, so we assume that all older
+// versions support RTTI.
+#if !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI)) && (!defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || defined(__GXX_RTTI))
#define HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast<type >(obj) != NULL)
#else
#define HAS_DYNAMIC_TYPE(type, obj) true
diff --git a/src/3rdparty/angle/src/common/event_tracer.cpp b/src/3rdparty/angle/src/common/event_tracer.cpp
index 96cbb01061..142373d13f 100644
--- a/src/3rdparty/angle/src/common/event_tracer.cpp
+++ b/src/3rdparty/angle/src/common/event_tracer.cpp
@@ -14,7 +14,7 @@ AddTraceEventFunc g_addTraceEvent;
extern "C" {
-void __stdcall SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
+void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
AddTraceEventFunc addTraceEvent)
{
gl::g_getCategoryEnabledFlag = getCategoryEnabledFlag;
diff --git a/src/3rdparty/angle/src/common/event_tracer.h b/src/3rdparty/angle/src/common/event_tracer.h
index ae397e7db9..14b7b298fd 100644
--- a/src/3rdparty/angle/src/common/event_tracer.h
+++ b/src/3rdparty/angle/src/common/event_tracer.h
@@ -5,6 +5,14 @@
#ifndef COMMON_EVENT_TRACER_H_
#define COMMON_EVENT_TRACER_H_
+#if !defined(TRACE_ENTRY)
+#if defined(_WIN32)
+#define TRACE_ENTRY __stdcall
+#else
+#define TRACE_ENTRY
+#endif // // _WIN32
+#endif //TRACE_ENTRY
+
extern "C" {
typedef const unsigned char* (*GetCategoryEnabledFlagFunc)(const char* name);
@@ -14,8 +22,8 @@ typedef void (*AddTraceEventFunc)(char phase, const unsigned char* categoryGroup
unsigned char flags);
// extern "C" so that it has a reasonable name for GetProcAddress.
-void __stdcall SetTraceFunctionPointers(GetCategoryEnabledFlagFunc get_category_enabled_flag,
- AddTraceEventFunc add_trace_event_func);
+void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc get_category_enabled_flag,
+ AddTraceEventFunc add_trace_event_func);
}
diff --git a/src/3rdparty/angle/src/common/system.h b/src/3rdparty/angle/src/common/system.h
deleted file mode 100644
index 5eb140bccd..0000000000
--- a/src/3rdparty/angle/src/common/system.h
+++ /dev/null
@@ -1,26 +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.
-//
-
-// system.h: Includes Windows system headers and undefines macros that conflict.
-
-#ifndef COMMON_SYSTEM_H
-#define COMMON_SYSTEM_H
-
-#if !defined(WIN32_LEAN_AND_MEAN)
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-
-#if defined(min)
-#undef min
-#endif
-
-#if defined(max)
-#undef max
-#endif
-
-#endif // COMMON_SYSTEM_H
diff --git a/src/3rdparty/angle/src/common/version.h b/src/3rdparty/angle/src/common/version.h
index 7a4942ad88..f6ae19f541 100644
--- a/src/3rdparty/angle/src/common/version.h
+++ b/src/3rdparty/angle/src/common/version.h
@@ -1,12 +1,12 @@
-#define MAJOR_VERSION 1
-#define MINOR_VERSION 2
-#define BUILD_VERSION 0
-#define BUILD_REVISION 2446
+#include "commit.h"
-#define STRINGIFY(x) #x
-#define MACRO_STRINGIFY(x) STRINGIFY(x)
+#define ANGLE_MAJOR_VERSION 1
+#define ANGLE_MINOR_VERSION 3
-#define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
-#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(BUILD_VERSION) "." MACRO_STRINGIFY(BUILD_REVISION)
+#define ANGLE_STRINGIFY(x) #x
+#define ANGLE_MACRO_STRINGIFY(x) ANGLE_STRINGIFY(x)
-#define VERSION_DWORD ((MAJOR_VERSION << 24) | (MINOR_VERSION << 16) | BUILD_REVISION)
+#define ANGLE_VERSION_STRING \
+ ANGLE_MACRO_STRINGIFY(ANGLE_MAJOR_VERSION) "." \
+ ANGLE_MACRO_STRINGIFY(ANGLE_MINOR_VERSION) "." \
+ ANGLE_COMMIT_HASH
diff --git a/src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp b/src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp
deleted file mode 100644
index 637ccc5e37..0000000000
--- a/src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp
+++ /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.
-//
-
-#include "compiler/TranslatorHLSL.h"
-
-//
-// This function must be provided to create the actual
-// compile object used by higher level code. It returns
-// a subclass of TCompiler.
-//
-TCompiler* ConstructCompiler(
- ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
-{
- switch (output)
- {
- case SH_HLSL9_OUTPUT:
- case SH_HLSL11_OUTPUT:
- return new TranslatorHLSL(type, spec, output);
- default:
- return NULL;
- }
-}
-
-//
-// Delete the compiler made by ConstructCompiler
-//
-void DeleteCompiler(TCompiler* compiler)
-{
- delete compiler;
-}
diff --git a/src/3rdparty/angle/src/compiler/DetectRecursion.cpp b/src/3rdparty/angle/src/compiler/DetectRecursion.cpp
deleted file mode 100644
index c09780dd92..0000000000
--- a/src/3rdparty/angle/src/compiler/DetectRecursion.cpp
+++ /dev/null
@@ -1,125 +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/DetectRecursion.h"
-
-DetectRecursion::FunctionNode::FunctionNode(const TString& fname)
- : name(fname),
- visit(PreVisit)
-{
-}
-
-const TString& DetectRecursion::FunctionNode::getName() const
-{
- return name;
-}
-
-void DetectRecursion::FunctionNode::addCallee(
- DetectRecursion::FunctionNode* callee)
-{
- for (size_t i = 0; i < callees.size(); ++i) {
- if (callees[i] == callee)
- return;
- }
- callees.push_back(callee);
-}
-
-bool DetectRecursion::FunctionNode::detectRecursion()
-{
- ASSERT(visit == PreVisit);
- visit = InVisit;
- for (size_t i = 0; i < callees.size(); ++i) {
- switch (callees[i]->visit) {
- case InVisit:
- // cycle detected, i.e., recursion detected.
- return true;
- case PostVisit:
- break;
- case PreVisit: {
- bool recursion = callees[i]->detectRecursion();
- if (recursion)
- return true;
- break;
- }
- default:
- UNREACHABLE();
- break;
- }
- }
- visit = PostVisit;
- return false;
-}
-
-DetectRecursion::DetectRecursion()
- : currentFunction(NULL)
-{
-}
-
-DetectRecursion::~DetectRecursion()
-{
- for (size_t i = 0; i < functions.size(); ++i)
- delete functions[i];
-}
-
-bool DetectRecursion::visitAggregate(Visit visit, TIntermAggregate* node)
-{
- switch (node->getOp())
- {
- case EOpPrototype:
- // Function declaration.
- // Don't add FunctionNode here because node->getName() is the
- // unmangled function name.
- break;
- case EOpFunction: {
- // Function definition.
- if (visit == PreVisit) {
- currentFunction = findFunctionByName(node->getName());
- if (currentFunction == NULL) {
- currentFunction = new FunctionNode(node->getName());
- functions.push_back(currentFunction);
- }
- }
- break;
- }
- case EOpFunctionCall: {
- // Function call.
- if (visit == PreVisit) {
- ASSERT(currentFunction != NULL);
- FunctionNode* func = findFunctionByName(node->getName());
- if (func == NULL) {
- func = new FunctionNode(node->getName());
- functions.push_back(func);
- }
- currentFunction->addCallee(func);
- }
- break;
- }
- default:
- break;
- }
- return true;
-}
-
-DetectRecursion::ErrorCode DetectRecursion::detectRecursion()
-{
- FunctionNode* main = findFunctionByName("main(");
- if (main == NULL)
- return kErrorMissingMain;
- if (main->detectRecursion())
- return kErrorRecursion;
- return kErrorNone;
-}
-
-DetectRecursion::FunctionNode* DetectRecursion::findFunctionByName(
- const TString& name)
-{
- for (size_t i = 0; i < functions.size(); ++i) {
- if (functions[i]->getName() == name)
- return functions[i];
- }
- return NULL;
-}
-
diff --git a/src/3rdparty/angle/src/compiler/DetectRecursion.h b/src/3rdparty/angle/src/compiler/DetectRecursion.h
deleted file mode 100644
index bbac79dc9c..0000000000
--- a/src/3rdparty/angle/src/compiler/DetectRecursion.h
+++ /dev/null
@@ -1,60 +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_DETECT_RECURSION_H_
-#define COMPILER_DETECT_RECURSION_H_
-
-#include "GLSLANG/ShaderLang.h"
-
-#include "compiler/intermediate.h"
-#include "compiler/VariableInfo.h"
-
-// Traverses intermediate tree to detect function recursion.
-class DetectRecursion : public TIntermTraverser {
-public:
- enum ErrorCode {
- kErrorMissingMain,
- kErrorRecursion,
- kErrorNone
- };
-
- DetectRecursion();
- ~DetectRecursion();
-
- virtual bool visitAggregate(Visit, TIntermAggregate*);
-
- ErrorCode detectRecursion();
-
-private:
- class FunctionNode {
- public:
- FunctionNode(const TString& fname);
-
- const TString& getName() const;
-
- // If a function is already in the callee list, this becomes a no-op.
- void addCallee(FunctionNode* callee);
-
- // Return true if recursive function calls are detected.
- bool detectRecursion();
-
- private:
- // mangled function name is unique.
- TString name;
-
- // functions that are directly called by this function.
- TVector<FunctionNode*> callees;
-
- Visit visit;
- };
-
- FunctionNode* findFunctionByName(const TString& name);
-
- TVector<FunctionNode*> functions;
- FunctionNode* currentFunction;
-};
-
-#endif // COMPILER_DETECT_RECURSION_H_
diff --git a/src/3rdparty/angle/src/compiler/InitializeGLPosition.cpp b/src/3rdparty/angle/src/compiler/InitializeGLPosition.cpp
deleted file mode 100644
index e0193e39d2..0000000000
--- a/src/3rdparty/angle/src/compiler/InitializeGLPosition.cpp
+++ /dev/null
@@ -1,61 +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/InitializeGLPosition.h"
-#include "compiler/debug.h"
-
-bool InitializeGLPosition::visitAggregate(Visit visit, TIntermAggregate* node)
-{
- bool visitChildren = !mCodeInserted;
- switch (node->getOp())
- {
- case EOpSequence: break;
- case EOpFunction:
- {
- // Function definition.
- ASSERT(visit == PreVisit);
- if (node->getName() == "main(")
- {
- TIntermSequence &sequence = node->getSequence();
- ASSERT((sequence.size() == 1) || (sequence.size() == 2));
- TIntermAggregate *body = NULL;
- if (sequence.size() == 1)
- {
- body = new TIntermAggregate(EOpSequence);
- sequence.push_back(body);
- }
- else
- {
- body = sequence[1]->getAsAggregate();
- }
- ASSERT(body);
- insertCode(body->getSequence());
- mCodeInserted = true;
- }
- break;
- }
- default: visitChildren = false; break;
- }
- return visitChildren;
-}
-
-void InitializeGLPosition::insertCode(TIntermSequence& sequence)
-{
- TIntermBinary *binary = new TIntermBinary(EOpAssign);
- sequence.insert(sequence.begin(), binary);
-
- TIntermSymbol *left = new TIntermSymbol(
- 0, "gl_Position", TType(EbtFloat, EbpUndefined, EvqPosition, 4));
- binary->setLeft(left);
-
- ConstantUnion *u = new ConstantUnion[4];
- for (int ii = 0; ii < 3; ++ii)
- u[ii].setFConst(0.0f);
- u[3].setFConst(1.0f);
- TIntermConstantUnion *right = new TIntermConstantUnion(
- u, TType(EbtFloat, EbpUndefined, EvqConst, 4));
- binary->setRight(right);
-}
diff --git a/src/3rdparty/angle/src/compiler/InitializeGLPosition.h b/src/3rdparty/angle/src/compiler/InitializeGLPosition.h
deleted file mode 100644
index 1b11075a13..0000000000
--- a/src/3rdparty/angle/src/compiler/InitializeGLPosition.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.
-//
-
-#ifndef COMPILER_INITIALIZE_GL_POSITION_H_
-#define COMPILER_INITIALIZE_GL_POSITION_H_
-
-#include "compiler/intermediate.h"
-
-class InitializeGLPosition : public TIntermTraverser
-{
-public:
- InitializeGLPosition() : mCodeInserted(false) { }
-
-protected:
- virtual bool visitBinary(Visit visit, TIntermBinary* node) { return false; }
- virtual bool visitUnary(Visit visit, TIntermUnary* node) { return false; }
- virtual bool visitSelection(Visit visit, TIntermSelection* node) { return false; }
- virtual bool visitLoop(Visit visit, TIntermLoop* node) { return false; }
- virtual bool visitBranch(Visit visit, TIntermBranch* node) { return false; }
-
- virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
-
-private:
- // Insert AST node in the beginning of main() for "gl_Position = vec4(0.0, 0.0, 0.0, 1.0);".
- void insertCode(TIntermSequence& sequence);
-
- bool mCodeInserted;
-};
-
-#endif // COMPILER_INITIALIZE_GL_POSITION_H_
diff --git a/src/3rdparty/angle/src/compiler/IntermTraverse.cpp b/src/3rdparty/angle/src/compiler/IntermTraverse.cpp
deleted file mode 100644
index a13877f18f..0000000000
--- a/src/3rdparty/angle/src/compiler/IntermTraverse.cpp
+++ /dev/null
@@ -1,293 +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/intermediate.h"
-
-//
-// 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.
-//
-// preVisit, postVisit, and rightToLeft control what order
-// nodes are visited in.
-//
-
-//
-// Traversal functions for terminals are straighforward....
-//
-void TIntermSymbol::traverse(TIntermTraverser* it)
-{
- it->visitSymbol(this);
-}
-
-void TIntermConstantUnion::traverse(TIntermTraverser* it)
-{
- it->visitConstantUnion(this);
-}
-
-//
-// Traverse a binary node.
-//
-void TIntermBinary::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- //
- // visit the node before children if pre-visiting.
- //
- if(it->preVisit)
- {
- visit = it->visitBinary(PreVisit, this);
- }
-
- //
- // Visit the children, in the right order.
- //
- if(visit)
- {
- it->incrementDepth();
-
- if(it->rightToLeft)
- {
- if(right)
- {
- right->traverse(it);
- }
-
- if(it->inVisit)
- {
- visit = it->visitBinary(InVisit, this);
- }
-
- if(visit && left)
- {
- left->traverse(it);
- }
- }
- else
- {
- if(left)
- {
- left->traverse(it);
- }
-
- if(it->inVisit)
- {
- visit = it->visitBinary(InVisit, this);
- }
-
- if(visit && right)
- {
- right->traverse(it);
- }
- }
-
- it->decrementDepth();
- }
-
- //
- // Visit the node after the children, if requested and the traversal
- // hasn't been cancelled yet.
- //
- if(visit && it->postVisit)
- {
- it->visitBinary(PostVisit, this);
- }
-}
-
-//
-// Traverse a unary node. Same comments in binary node apply here.
-//
-void TIntermUnary::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit)
- visit = it->visitUnary(PreVisit, this);
-
- if (visit) {
- it->incrementDepth();
- operand->traverse(it);
- it->decrementDepth();
- }
-
- if (visit && it->postVisit)
- it->visitUnary(PostVisit, this);
-}
-
-//
-// Traverse an aggregate node. Same comments in binary node apply here.
-//
-void TIntermAggregate::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if(it->preVisit)
- {
- visit = it->visitAggregate(PreVisit, this);
- }
-
- if(visit)
- {
- it->incrementDepth();
-
- if(it->rightToLeft)
- {
- for(TIntermSequence::reverse_iterator sit = sequence.rbegin(); sit != sequence.rend(); sit++)
- {
- (*sit)->traverse(it);
-
- if(visit && it->inVisit)
- {
- if(*sit != sequence.front())
- {
- visit = it->visitAggregate(InVisit, this);
- }
- }
- }
- }
- else
- {
- for(TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
- {
- (*sit)->traverse(it);
-
- if(visit && it->inVisit)
- {
- if(*sit != sequence.back())
- {
- visit = it->visitAggregate(InVisit, this);
- }
- }
- }
- }
-
- it->decrementDepth();
- }
-
- if(visit && it->postVisit)
- {
- it->visitAggregate(PostVisit, this);
- }
-}
-
-//
-// Traverse a selection node. Same comments in binary node apply here.
-//
-void TIntermSelection::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit)
- visit = it->visitSelection(PreVisit, this);
-
- if (visit) {
- it->incrementDepth();
- if (it->rightToLeft) {
- if (falseBlock)
- falseBlock->traverse(it);
- if (trueBlock)
- trueBlock->traverse(it);
- condition->traverse(it);
- } else {
- condition->traverse(it);
- if (trueBlock)
- trueBlock->traverse(it);
- if (falseBlock)
- falseBlock->traverse(it);
- }
- it->decrementDepth();
- }
-
- if (visit && it->postVisit)
- it->visitSelection(PostVisit, this);
-}
-
-//
-// Traverse a loop node. Same comments in binary node apply here.
-//
-void TIntermLoop::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if(it->preVisit)
- {
- visit = it->visitLoop(PreVisit, this);
- }
-
- if(visit)
- {
- it->incrementDepth();
-
- if(it->rightToLeft)
- {
- if(expr)
- {
- expr->traverse(it);
- }
-
- if(body)
- {
- body->traverse(it);
- }
-
- if(cond)
- {
- cond->traverse(it);
- }
- }
- else
- {
- if(cond)
- {
- cond->traverse(it);
- }
-
- if(body)
- {
- body->traverse(it);
- }
-
- if(expr)
- {
- expr->traverse(it);
- }
- }
-
- it->decrementDepth();
- }
-
- if(visit && it->postVisit)
- {
- it->visitLoop(PostVisit, this);
- }
-}
-
-//
-// Traverse a branch node. Same comments in binary node apply here.
-//
-void TIntermBranch::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit)
- visit = it->visitBranch(PreVisit, this);
-
- if (visit && expression) {
- it->incrementDepth();
- expression->traverse(it);
- it->decrementDepth();
- }
-
- if (visit && it->postVisit)
- it->visitBranch(PostVisit, this);
-}
-
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
index 3e22e1f1c5..a7ce862bcb 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
@@ -25,14 +25,14 @@ void Diagnostics::report(ID id,
Diagnostics::Severity Diagnostics::severity(ID id)
{
- if ((id > ERROR_BEGIN) && (id < ERROR_END))
- return ERROR;
+ if ((id > PP_ERROR_BEGIN) && (id < PP_ERROR_END))
+ return PP_ERROR;
- if ((id > WARNING_BEGIN) && (id < WARNING_END))
- return WARNING;
+ if ((id > PP_WARNING_BEGIN) && (id < PP_WARNING_END))
+ return PP_WARNING;
assert(false);
- return ERROR;
+ return PP_ERROR;
}
std::string Diagnostics::message(ID id)
@@ -40,82 +40,82 @@ std::string Diagnostics::message(ID id)
switch (id)
{
// Errors begin.
- case INTERNAL_ERROR:
+ case PP_INTERNAL_ERROR:
return "internal error";
- case OUT_OF_MEMORY:
+ case PP_OUT_OF_MEMORY:
return "out of memory";
- case INVALID_CHARACTER:
+ case PP_INVALID_CHARACTER:
return "invalid character";
- case INVALID_NUMBER:
+ case PP_INVALID_NUMBER:
return "invalid number";
- case INTEGER_OVERFLOW:
+ case PP_INTEGER_OVERFLOW:
return "integer overflow";
- case FLOAT_OVERFLOW:
+ case PP_FLOAT_OVERFLOW:
return "float overflow";
- case TOKEN_TOO_LONG:
+ case PP_TOKEN_TOO_LONG:
return "token too long";
- case INVALID_EXPRESSION:
+ case PP_INVALID_EXPRESSION:
return "invalid expression";
- case DIVISION_BY_ZERO:
+ case PP_DIVISION_BY_ZERO:
return "division by zero";
- case EOF_IN_COMMENT:
+ case PP_EOF_IN_COMMENT:
return "unexpected end of file found in comment";
- case UNEXPECTED_TOKEN:
+ case PP_UNEXPECTED_TOKEN:
return "unexpected token";
- case DIRECTIVE_INVALID_NAME:
+ case PP_DIRECTIVE_INVALID_NAME:
return "invalid directive name";
- case MACRO_NAME_RESERVED:
+ case PP_MACRO_NAME_RESERVED:
return "macro name is reserved";
- case MACRO_REDEFINED:
+ case PP_MACRO_REDEFINED:
return "macro redefined";
- case MACRO_PREDEFINED_REDEFINED:
+ case PP_MACRO_PREDEFINED_REDEFINED:
return "predefined macro redefined";
- case MACRO_PREDEFINED_UNDEFINED:
+ case PP_MACRO_PREDEFINED_UNDEFINED:
return "predefined macro undefined";
- case MACRO_UNTERMINATED_INVOCATION:
+ case PP_MACRO_UNTERMINATED_INVOCATION:
return "unterminated macro invocation";
- case MACRO_TOO_FEW_ARGS:
+ case PP_MACRO_TOO_FEW_ARGS:
return "Not enough arguments for macro";
- case MACRO_TOO_MANY_ARGS:
+ case PP_MACRO_TOO_MANY_ARGS:
return "Too many arguments for macro";
- case CONDITIONAL_ENDIF_WITHOUT_IF:
+ case PP_CONDITIONAL_ENDIF_WITHOUT_IF:
return "unexpected #endif found without a matching #if";
- case CONDITIONAL_ELSE_WITHOUT_IF:
+ case PP_CONDITIONAL_ELSE_WITHOUT_IF:
return "unexpected #else found without a matching #if";
- case CONDITIONAL_ELSE_AFTER_ELSE:
+ case PP_CONDITIONAL_ELSE_AFTER_ELSE:
return "unexpected #else found after another #else";
- case CONDITIONAL_ELIF_WITHOUT_IF:
+ case PP_CONDITIONAL_ELIF_WITHOUT_IF:
return "unexpected #elif found without a matching #if";
- case CONDITIONAL_ELIF_AFTER_ELSE:
+ case PP_CONDITIONAL_ELIF_AFTER_ELSE:
return "unexpected #elif found after #else";
- case CONDITIONAL_UNTERMINATED:
+ case PP_CONDITIONAL_UNTERMINATED:
return "unexpected end of file found in conditional block";
- case INVALID_EXTENSION_NAME:
+ case PP_INVALID_EXTENSION_NAME:
return "invalid extension name";
- case INVALID_EXTENSION_BEHAVIOR:
+ case PP_INVALID_EXTENSION_BEHAVIOR:
return "invalid extension behavior";
- case INVALID_EXTENSION_DIRECTIVE:
+ case PP_INVALID_EXTENSION_DIRECTIVE:
return "invalid extension directive";
- case INVALID_VERSION_NUMBER:
+ case PP_INVALID_VERSION_NUMBER:
return "invalid version number";
- case INVALID_VERSION_DIRECTIVE:
+ case PP_INVALID_VERSION_DIRECTIVE:
return "invalid version directive";
- case VERSION_NOT_FIRST_STATEMENT:
+ case PP_VERSION_NOT_FIRST_STATEMENT:
return "#version directive must occur before anything else, "
"except for comments and white space";
- case INVALID_LINE_NUMBER:
+ case PP_INVALID_LINE_NUMBER:
return "invalid line number";
- case INVALID_FILE_NUMBER:
+ case PP_INVALID_FILE_NUMBER:
return "invalid file number";
- case INVALID_LINE_DIRECTIVE:
+ case PP_INVALID_LINE_DIRECTIVE:
return "invalid line directive";
// Errors end.
// Warnings begin.
- case EOF_IN_DIRECTIVE:
+ case PP_EOF_IN_DIRECTIVE:
return "unexpected end of file found in directive";
- case CONDITIONAL_UNEXPECTED_TOKEN:
+ case PP_CONDITIONAL_UNEXPECTED_TOKEN:
return "unexpected token after conditional expression";
- case UNRECOGNIZED_PRAGMA:
+ case PP_UNRECOGNIZED_PRAGMA:
return "unrecognized pragma";
// Warnings end.
default:
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
index 07bc411846..2c8c539137 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
@@ -21,53 +21,53 @@ class Diagnostics
public:
enum Severity
{
- ERROR,
- WARNING
+ PP_ERROR,
+ PP_WARNING
};
enum ID
{
- ERROR_BEGIN,
- INTERNAL_ERROR,
- OUT_OF_MEMORY,
- INVALID_CHARACTER,
- INVALID_NUMBER,
- INTEGER_OVERFLOW,
- FLOAT_OVERFLOW,
- TOKEN_TOO_LONG,
- INVALID_EXPRESSION,
- DIVISION_BY_ZERO,
- EOF_IN_COMMENT,
- UNEXPECTED_TOKEN,
- DIRECTIVE_INVALID_NAME,
- MACRO_NAME_RESERVED,
- MACRO_REDEFINED,
- MACRO_PREDEFINED_REDEFINED,
- MACRO_PREDEFINED_UNDEFINED,
- MACRO_UNTERMINATED_INVOCATION,
- MACRO_TOO_FEW_ARGS,
- MACRO_TOO_MANY_ARGS,
- CONDITIONAL_ENDIF_WITHOUT_IF,
- CONDITIONAL_ELSE_WITHOUT_IF,
- CONDITIONAL_ELSE_AFTER_ELSE,
- CONDITIONAL_ELIF_WITHOUT_IF,
- CONDITIONAL_ELIF_AFTER_ELSE,
- CONDITIONAL_UNTERMINATED,
- INVALID_EXTENSION_NAME,
- INVALID_EXTENSION_BEHAVIOR,
- INVALID_EXTENSION_DIRECTIVE,
- INVALID_VERSION_NUMBER,
- INVALID_VERSION_DIRECTIVE,
- VERSION_NOT_FIRST_STATEMENT,
- INVALID_LINE_NUMBER,
- INVALID_FILE_NUMBER,
- INVALID_LINE_DIRECTIVE,
- ERROR_END,
+ 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_TOO_FEW_ARGS,
+ PP_MACRO_TOO_MANY_ARGS,
+ 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_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_INVALID_LINE_NUMBER,
+ PP_INVALID_FILE_NUMBER,
+ PP_INVALID_LINE_DIRECTIVE,
+ PP_ERROR_END,
- WARNING_BEGIN,
- EOF_IN_DIRECTIVE,
- CONDITIONAL_UNEXPECTED_TOKEN,
- UNRECOGNIZED_PRAGMA,
- WARNING_END
+ PP_WARNING_BEGIN,
+ PP_EOF_IN_DIRECTIVE,
+ PP_CONDITIONAL_UNEXPECTED_TOKEN,
+ PP_UNRECOGNIZED_PRAGMA,
+ PP_WARNING_END
};
virtual ~Diagnostics();
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
index 94dfdf513d..ebec79804d 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
@@ -172,7 +172,7 @@ class DefinedParser : public Lexer
if (token->type != Token::IDENTIFIER)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mLexer, token);
return;
@@ -185,7 +185,7 @@ class DefinedParser : public Lexer
mLexer->lex(token);
if (token->type != ')')
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mLexer, token);
return;
@@ -233,7 +233,7 @@ void DirectiveParser::lex(Token* token)
if (!mConditionalStack.empty())
{
const ConditionalBlock& block = mConditionalStack.back();
- mDiagnostics->report(Diagnostics::CONDITIONAL_UNTERMINATED,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNTERMINATED,
block.location, block.type);
}
break;
@@ -268,7 +268,7 @@ void DirectiveParser::parseDirective(Token* token)
switch(directive)
{
case DIRECTIVE_NONE:
- mDiagnostics->report(Diagnostics::DIRECTIVE_INVALID_NAME,
+ mDiagnostics->report(Diagnostics::PP_DIRECTIVE_INVALID_NAME,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
break;
@@ -319,7 +319,7 @@ void DirectiveParser::parseDirective(Token* token)
skipUntilEOD(mTokenizer, token);
if (token->type == Token::LAST)
{
- mDiagnostics->report(Diagnostics::EOF_IN_DIRECTIVE,
+ mDiagnostics->report(Diagnostics::PP_EOF_IN_DIRECTIVE,
token->location, token->text);
}
}
@@ -331,19 +331,19 @@ void DirectiveParser::parseDefine(Token* token)
mTokenizer->lex(token);
if (token->type != Token::IDENTIFIER)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
return;
}
if (isMacroPredefined(token->text, *mMacroSet))
{
- mDiagnostics->report(Diagnostics::MACRO_PREDEFINED_REDEFINED,
+ mDiagnostics->report(Diagnostics::PP_MACRO_PREDEFINED_REDEFINED,
token->location, token->text);
return;
}
if (isMacroNameReserved(token->text))
{
- mDiagnostics->report(Diagnostics::MACRO_NAME_RESERVED,
+ mDiagnostics->report(Diagnostics::PP_MACRO_NAME_RESERVED,
token->location, token->text);
return;
}
@@ -368,7 +368,7 @@ void DirectiveParser::parseDefine(Token* token)
if (token->type != ')')
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location,
token->text);
return;
@@ -396,7 +396,7 @@ void DirectiveParser::parseDefine(Token* token)
MacroSet::const_iterator iter = mMacroSet->find(macro.name);
if (iter != mMacroSet->end() && !macro.equals(iter->second))
{
- mDiagnostics->report(Diagnostics::MACRO_REDEFINED,
+ mDiagnostics->report(Diagnostics::PP_MACRO_REDEFINED,
token->location,
macro.name);
return;
@@ -411,7 +411,7 @@ void DirectiveParser::parseUndef(Token* token)
mTokenizer->lex(token);
if (token->type != Token::IDENTIFIER)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
return;
}
@@ -421,7 +421,7 @@ void DirectiveParser::parseUndef(Token* token)
{
if (iter->second.predefined)
{
- mDiagnostics->report(Diagnostics::MACRO_PREDEFINED_UNDEFINED,
+ mDiagnostics->report(Diagnostics::PP_MACRO_PREDEFINED_UNDEFINED,
token->location, token->text);
}
else
@@ -457,7 +457,7 @@ void DirectiveParser::parseElse(Token* token)
if (mConditionalStack.empty())
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_ELSE_WITHOUT_IF,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELSE_WITHOUT_IF,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
@@ -472,7 +472,7 @@ void DirectiveParser::parseElse(Token* token)
}
if (block.foundElseGroup)
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_ELSE_AFTER_ELSE,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELSE_AFTER_ELSE,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
@@ -486,7 +486,7 @@ void DirectiveParser::parseElse(Token* token)
mTokenizer->lex(token);
if (!isEOD(token))
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
}
@@ -498,7 +498,7 @@ void DirectiveParser::parseElif(Token* token)
if (mConditionalStack.empty())
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_ELIF_WITHOUT_IF,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELIF_WITHOUT_IF,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
@@ -513,7 +513,7 @@ void DirectiveParser::parseElif(Token* token)
}
if (block.foundElseGroup)
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_ELIF_AFTER_ELSE,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELIF_AFTER_ELSE,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
@@ -538,7 +538,7 @@ void DirectiveParser::parseEndif(Token* token)
if (mConditionalStack.empty())
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_ENDIF_WITHOUT_IF,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ENDIF_WITHOUT_IF,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
@@ -550,7 +550,7 @@ void DirectiveParser::parseEndif(Token* token)
mTokenizer->lex(token);
if (!isEOD(token))
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
}
@@ -618,7 +618,7 @@ void DirectiveParser::parsePragma(Token* token)
(state == RIGHT_PAREN + 1)); // With value.
if (!valid)
{
- mDiagnostics->report(Diagnostics::UNRECOGNIZED_PRAGMA,
+ mDiagnostics->report(Diagnostics::PP_UNRECOGNIZED_PRAGMA,
token->location, name);
}
else if (state > PRAGMA_NAME) // Do not notify for empty pragma.
@@ -650,7 +650,7 @@ void DirectiveParser::parseExtension(Token* token)
case EXT_NAME:
if (valid && (token->type != Token::IDENTIFIER))
{
- mDiagnostics->report(Diagnostics::INVALID_EXTENSION_NAME,
+ mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_NAME,
token->location, token->text);
valid = false;
}
@@ -659,7 +659,7 @@ void DirectiveParser::parseExtension(Token* token)
case COLON:
if (valid && (token->type != ':'))
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
valid = false;
}
@@ -667,7 +667,7 @@ void DirectiveParser::parseExtension(Token* token)
case EXT_BEHAVIOR:
if (valid && (token->type != Token::IDENTIFIER))
{
- mDiagnostics->report(Diagnostics::INVALID_EXTENSION_BEHAVIOR,
+ mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_BEHAVIOR,
token->location, token->text);
valid = false;
}
@@ -676,7 +676,7 @@ void DirectiveParser::parseExtension(Token* token)
default:
if (valid)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
valid = false;
}
@@ -686,7 +686,7 @@ void DirectiveParser::parseExtension(Token* token)
}
if (valid && (state != EXT_BEHAVIOR + 1))
{
- mDiagnostics->report(Diagnostics::INVALID_EXTENSION_DIRECTIVE,
+ mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_DIRECTIVE,
token->location, token->text);
valid = false;
}
@@ -700,7 +700,7 @@ void DirectiveParser::parseVersion(Token* token)
if (mPastFirstStatement)
{
- mDiagnostics->report(Diagnostics::VERSION_NOT_FIRST_STATEMENT,
+ mDiagnostics->report(Diagnostics::PP_VERSION_NOT_FIRST_STATEMENT,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
@@ -723,13 +723,13 @@ void DirectiveParser::parseVersion(Token* token)
case VERSION_NUMBER:
if (valid && (token->type != Token::CONST_INT))
{
- mDiagnostics->report(Diagnostics::INVALID_VERSION_NUMBER,
+ mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_NUMBER,
token->location, token->text);
valid = false;
}
if (valid && !token->iValue(&version))
{
- mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
+ mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
valid = false;
}
@@ -737,7 +737,7 @@ void DirectiveParser::parseVersion(Token* token)
default:
if (valid)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
valid = false;
}
@@ -747,7 +747,7 @@ void DirectiveParser::parseVersion(Token* token)
}
if (valid && (state != VERSION_NUMBER + 1))
{
- mDiagnostics->report(Diagnostics::INVALID_VERSION_DIRECTIVE,
+ mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE,
token->location, token->text);
valid = false;
}
@@ -778,13 +778,13 @@ void DirectiveParser::parseLine(Token* token)
case LINE_NUMBER:
if (valid && (token->type != Token::CONST_INT))
{
- mDiagnostics->report(Diagnostics::INVALID_LINE_NUMBER,
+ mDiagnostics->report(Diagnostics::PP_INVALID_LINE_NUMBER,
token->location, token->text);
valid = false;
}
if (valid && !token->iValue(&line))
{
- mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
+ mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
valid = false;
}
@@ -792,13 +792,13 @@ void DirectiveParser::parseLine(Token* token)
case FILE_NUMBER:
if (valid && (token->type != Token::CONST_INT))
{
- mDiagnostics->report(Diagnostics::INVALID_FILE_NUMBER,
+ mDiagnostics->report(Diagnostics::PP_INVALID_FILE_NUMBER,
token->location, token->text);
valid = false;
}
if (valid && !token->iValue(&file))
{
- mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
+ mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
valid = false;
}
@@ -806,7 +806,7 @@ void DirectiveParser::parseLine(Token* token)
default:
if (valid)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
valid = false;
}
@@ -817,7 +817,7 @@ void DirectiveParser::parseLine(Token* token)
if (valid && (state != FILE_NUMBER) && (state != FILE_NUMBER + 1))
{
- mDiagnostics->report(Diagnostics::INVALID_LINE_DIRECTIVE,
+ mDiagnostics->report(Diagnostics::PP_INVALID_LINE_DIRECTIVE,
token->location, token->text);
valid = false;
}
@@ -893,7 +893,7 @@ int DirectiveParser::parseExpressionIf(Token* token)
// Warn if there are tokens after #if expression.
if (!isEOD(token))
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
}
@@ -909,7 +909,7 @@ int DirectiveParser::parseExpressionIfdef(Token* token)
mTokenizer->lex(token);
if (token->type != Token::IDENTIFIER)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return 0;
@@ -922,7 +922,7 @@ int DirectiveParser::parseExpressionIfdef(Token* token)
mTokenizer->lex(token);
if (!isEOD(token))
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
}
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
index b6d3143e60..9fa0f0bf80 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
+++ b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
@@ -33,6 +33,12 @@ WHICH GENERATES THE GLSL ES preprocessor expression parser.
#include "ExpressionParser.h"
+#if defined(_MSC_VER)
+#include <malloc.h>
+#else
+#include <stdlib.h>
+#endif
+
#include <cassert>
#include <sstream>
@@ -146,7 +152,7 @@ expression
std::ostringstream stream;
stream << $1 << " % " << $3;
std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
+ context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
context->token->location,
text.c_str());
YYABORT;
@@ -159,7 +165,7 @@ expression
std::ostringstream stream;
stream << $1 << " / " << $3;
std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
+ context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
context->token->location,
text.c_str());
YYABORT;
@@ -201,7 +207,7 @@ int yylex(YYSTYPE* lvalp, Context* context)
unsigned int val = 0;
if (!token->uValue(&val))
{
- context->diagnostics->report(pp::Diagnostics::INTEGER_OVERFLOW,
+ context->diagnostics->report(pp::Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
}
*lvalp = static_cast<YYSTYPE>(val);
@@ -242,7 +248,7 @@ int yylex(YYSTYPE* lvalp, Context* context)
void yyerror(Context* context, const char* reason)
{
- context->diagnostics->report(pp::Diagnostics::INVALID_EXPRESSION,
+ context->diagnostics->report(pp::Diagnostics::PP_INVALID_EXPRESSION,
context->token->location,
reason);
}
@@ -270,12 +276,12 @@ bool ExpressionParser::parse(Token* token, int* result)
break;
case 2:
- mDiagnostics->report(Diagnostics::OUT_OF_MEMORY, token->location, "");
+ mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token->location, "");
break;
default:
assert(false);
- mDiagnostics->report(Diagnostics::INTERNAL_ERROR, token->location, "");
+ mDiagnostics->report(Diagnostics::PP_INTERNAL_ERROR, token->location, "");
break;
}
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
index 1116c516ff..b789260af9 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
@@ -254,7 +254,7 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
if (token.type == Token::LAST)
{
- mDiagnostics->report(Diagnostics::MACRO_UNTERMINATED_INVOCATION,
+ mDiagnostics->report(Diagnostics::PP_MACRO_UNTERMINATED_INVOCATION,
identifier.location, identifier.text);
// Do not lose EOF token.
ungetToken(token);
@@ -302,8 +302,8 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
if (args->size() != params.size())
{
Diagnostics::ID id = args->size() < macro.parameters.size() ?
- Diagnostics::MACRO_TOO_FEW_ARGS :
- Diagnostics::MACRO_TOO_MANY_ARGS;
+ Diagnostics::PP_MACRO_TOO_FEW_ARGS :
+ Diagnostics::PP_MACRO_TOO_MANY_ARGS;
mDiagnostics->report(id, identifier.location, identifier.text);
return false;
}
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
index b615c85dce..580ffba459 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
@@ -101,11 +101,11 @@ void Preprocessor::lex(Token* token)
assert(false);
break;
case Token::PP_NUMBER:
- mImpl->diagnostics->report(Diagnostics::INVALID_NUMBER,
+ mImpl->diagnostics->report(Diagnostics::PP_INVALID_NUMBER,
token->location, token->text);
break;
case Token::PP_OTHER:
- mImpl->diagnostics->report(Diagnostics::INVALID_CHARACTER,
+ mImpl->diagnostics->report(Diagnostics::PP_INVALID_CHARACTER,
token->location, token->text);
break;
default:
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
index 01f0177b6c..f1380b26b7 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
@@ -256,7 +256,7 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
if (YY_START == COMMENT)
{
- yyextra->diagnostics->report(pp::Diagnostics::EOF_IN_COMMENT,
+ yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
pp::SourceLocation(yyfileno, yylineno),
"");
}
@@ -304,7 +304,7 @@ void Tokenizer::lex(Token* token)
token->type = yylex(&token->text, &token->location, mHandle);
if (token->text.size() > mMaxTokenLength)
{
- mContext.diagnostics->report(Diagnostics::TOKEN_TOO_LONG,
+ mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
token->location, token->text);
token->text.erase(mMaxTokenLength);
}
diff --git a/src/3rdparty/angle/src/compiler/BaseTypes.h b/src/3rdparty/angle/src/compiler/translator/BaseTypes.h
index 1631f4f779..7bdaf14983 100644
--- a/src/3rdparty/angle/src/compiler/BaseTypes.h
+++ b/src/3rdparty/angle/src/compiler/translator/BaseTypes.h
@@ -82,6 +82,7 @@ enum TQualifier
{
EvqTemporary, // For temporaries (within a function), read/write
EvqGlobal, // For globals read/write
+ EvqInternal, // For internal use, not visible to the user
EvqConst, // User defined constants and non-output parameters in functions
EvqAttribute, // Readonly
EvqVaryingIn, // readonly, fragment shaders only
diff --git a/src/3rdparty/angle/src/compiler/BuiltInFunctionEmulator.cpp b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp
index 1c4b25f13f..92b71c6bdb 100644
--- a/src/3rdparty/angle/src/compiler/BuiltInFunctionEmulator.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp
@@ -4,9 +4,9 @@
// found in the LICENSE file.
//
-#include "compiler/BuiltInFunctionEmulator.h"
+#include "compiler/translator/BuiltInFunctionEmulator.h"
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/SymbolTable.h"
namespace {
diff --git a/src/3rdparty/angle/src/compiler/BuiltInFunctionEmulator.h b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h
index 0d904f41d0..cfb71a803a 100644
--- a/src/3rdparty/angle/src/compiler/BuiltInFunctionEmulator.h
+++ b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h
@@ -9,8 +9,8 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/InfoSink.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/intermediate.h"
//
// This class decides which built-in functions need to be replaced with the
diff --git a/src/3rdparty/angle/src/compiler/CodeGenGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/CodeGen.cpp
index 226bf8f0fc..8f5d129104 100644
--- a/src/3rdparty/angle/src/compiler/CodeGenGLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/CodeGen.cpp
@@ -4,8 +4,9 @@
// found in the LICENSE file.
//
-#include "compiler/TranslatorGLSL.h"
-#include "compiler/TranslatorESSL.h"
+#include "compiler/translator/TranslatorESSL.h"
+#include "compiler/translator/TranslatorGLSL.h"
+#include "compiler/translator/TranslatorHLSL.h"
//
// This function must be provided to create the actual
@@ -16,10 +17,13 @@ TCompiler* ConstructCompiler(
ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
{
switch (output) {
- case SH_GLSL_OUTPUT:
- return new TranslatorGLSL(type, spec);
case SH_ESSL_OUTPUT:
return new TranslatorESSL(type, spec);
+ case SH_GLSL_OUTPUT:
+ return new TranslatorGLSL(type, spec);
+ case SH_HLSL9_OUTPUT:
+ case SH_HLSL11_OUTPUT:
+ return new TranslatorHLSL(type, spec, output);
default:
return NULL;
}
diff --git a/src/3rdparty/angle/src/compiler/Common.h b/src/3rdparty/angle/src/compiler/translator/Common.h
index 46f9440fff..1e4503e340 100644
--- a/src/3rdparty/angle/src/compiler/Common.h
+++ b/src/3rdparty/angle/src/compiler/translator/Common.h
@@ -11,8 +11,12 @@
#include <sstream>
#include <string>
#include <vector>
+#include <limits>
+#include <stdio.h>
-#include "compiler/PoolAlloc.h"
+#include "compiler/translator/PoolAlloc.h"
+#include "compiler/translator/compilerdebug.h"
+#include "common/angleutils.h"
struct TSourceLoc {
int first_file;
@@ -74,4 +78,15 @@ public:
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;
+}
+
#endif // _COMMON_INCLUDED_
diff --git a/src/3rdparty/angle/src/compiler/Compiler.cpp b/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
index ee64057ac4..eb7465e35c 100644
--- a/src/3rdparty/angle/src/compiler/Compiler.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
@@ -4,22 +4,23 @@
// found in the LICENSE file.
//
-#include "compiler/BuiltInFunctionEmulator.h"
-#include "compiler/DetectCallDepth.h"
-#include "compiler/ForLoopUnroll.h"
-#include "compiler/Initialize.h"
-#include "compiler/InitializeGLPosition.h"
-#include "compiler/InitializeParseContext.h"
-#include "compiler/MapLongVariableNames.h"
-#include "compiler/ParseHelper.h"
-#include "compiler/RenameFunction.h"
-#include "compiler/ShHandle.h"
-#include "compiler/ValidateLimitations.h"
-#include "compiler/VariablePacker.h"
-#include "compiler/depgraph/DependencyGraph.h"
-#include "compiler/depgraph/DependencyGraphOutput.h"
-#include "compiler/timing/RestrictFragmentShaderTiming.h"
-#include "compiler/timing/RestrictVertexShaderTiming.h"
+#include "compiler/translator/BuiltInFunctionEmulator.h"
+#include "compiler/translator/DetectCallDepth.h"
+#include "compiler/translator/ForLoopUnroll.h"
+#include "compiler/translator/Initialize.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/InitializeVariables.h"
+#include "compiler/translator/MapLongVariableNames.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/RenameFunction.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/UnfoldShortCircuitAST.h"
+#include "compiler/translator/ValidateLimitations.h"
+#include "compiler/translator/VariablePacker.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
+#include "compiler/translator/depgraph/DependencyGraphOutput.h"
+#include "compiler/translator/timing/RestrictFragmentShaderTiming.h"
+#include "compiler/translator/timing/RestrictVertexShaderTiming.h"
#include "third_party/compiler/ArrayBoundsClamper.h"
bool isWebGLBasedSpec(ShShaderSpec spec)
@@ -28,43 +29,51 @@ bool isWebGLBasedSpec(ShShaderSpec spec)
}
namespace {
-class TScopedPoolAllocator {
-public:
- TScopedPoolAllocator(TPoolAllocator* allocator) : mAllocator(allocator) {
+class TScopedPoolAllocator
+{
+ public:
+ TScopedPoolAllocator(TPoolAllocator* allocator) : mAllocator(allocator)
+ {
mAllocator->push();
SetGlobalPoolAllocator(mAllocator);
}
- ~TScopedPoolAllocator() {
+ ~TScopedPoolAllocator()
+ {
SetGlobalPoolAllocator(NULL);
mAllocator->pop();
}
-private:
+ private:
TPoolAllocator* mAllocator;
};
-class TScopedSymbolTableLevel {
-public:
- TScopedSymbolTableLevel(TSymbolTable* table) : mTable(table) {
+class TScopedSymbolTableLevel
+{
+ public:
+ TScopedSymbolTableLevel(TSymbolTable* table) : mTable(table)
+ {
ASSERT(mTable->atBuiltInLevel());
mTable->push();
}
- ~TScopedSymbolTableLevel() {
+ ~TScopedSymbolTableLevel()
+ {
while (!mTable->atBuiltInLevel())
mTable->pop();
}
-private:
+ private:
TSymbolTable* mTable;
};
} // namespace
-TShHandleBase::TShHandleBase() {
+TShHandleBase::TShHandleBase()
+{
allocator.push();
SetGlobalPoolAllocator(&allocator);
}
-TShHandleBase::~TShHandleBase() {
+TShHandleBase::~TShHandleBase()
+{
SetGlobalPoolAllocator(NULL);
allocator.popAll();
}
@@ -150,7 +159,8 @@ bool TCompiler::compile(const char* const shaderStrings[],
bool success =
(PaParseStrings(numStrings - firstSource, &shaderStrings[firstSource], NULL, &parseContext) == 0) &&
(parseContext.treeRoot != NULL);
- if (success) {
+ if (success)
+ {
TIntermNode* root = parseContext.treeRoot;
success = intermediate.postProcess(root);
@@ -189,20 +199,31 @@ bool TCompiler::compile(const char* const shaderStrings[],
if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) && hashFunction == NULL)
mapLongVariableNames(root);
- if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION)) {
- InitializeGLPosition initGLPosition;
- root->traverse(&initGLPosition);
+ if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION))
+ initializeGLPosition(root);
+
+ if (success && (compileOptions & SH_UNFOLD_SHORT_CIRCUIT))
+ {
+ UnfoldShortCircuitAST unfoldShortCircuit;
+ root->traverse(&unfoldShortCircuit);
+ unfoldShortCircuit.updateTree();
}
- if (success && (compileOptions & SH_VARIABLES)) {
+ if (success && (compileOptions & SH_VARIABLES))
+ {
collectVariables(root);
- if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS) {
+ if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS)
+ {
success = enforcePackingRestrictions();
- if (!success) {
+ if (!success)
+ {
infoSink.info.prefix(EPrefixError);
infoSink.info << "too many uniforms";
}
}
+ if (success && shaderType == SH_VERTEX_SHADER &&
+ (compileOptions & SH_INIT_VARYINGS_WITHOUT_STATIC_USE))
+ initializeVaryingsWithoutStaticUse(root);
}
if (success && (compileOptions & SH_INTERMEDIATE_TREE))
@@ -251,12 +272,14 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
symbolTable.setDefaultPrecision(integer, EbpHigh);
symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
break;
- default: assert(false && "Language not supported");
+ default:
+ assert(false && "Language not supported");
}
// We set defaults for all the sampler types, even those that are
// only available if an extension exists.
for (int samplerType = EbtGuardSamplerBegin + 1;
- samplerType < EbtGuardSamplerEnd; ++samplerType) {
+ samplerType < EbtGuardSamplerEnd; ++samplerType)
+ {
sampler.type = static_cast<TBasicType>(samplerType);
symbolTable.setDefaultPrecision(sampler, EbpLow);
}
@@ -288,24 +311,25 @@ bool TCompiler::detectCallDepth(TIntermNode* root, TInfoSink& infoSink, bool lim
{
DetectCallDepth detect(infoSink, limitCallStackDepth, maxCallStackDepth);
root->traverse(&detect);
- switch (detect.detectCallDepth()) {
- case DetectCallDepth::kErrorNone:
- return true;
- case DetectCallDepth::kErrorMissingMain:
- infoSink.info.prefix(EPrefixError);
- infoSink.info << "Missing main()";
- return false;
- case DetectCallDepth::kErrorRecursion:
- infoSink.info.prefix(EPrefixError);
- infoSink.info << "Function recursion detected";
- return false;
- case DetectCallDepth::kErrorMaxDepthExceeded:
- infoSink.info.prefix(EPrefixError);
- infoSink.info << "Function call stack too deep";
- return false;
- default:
- UNREACHABLE();
- return false;
+ switch (detect.detectCallDepth())
+ {
+ case DetectCallDepth::kErrorNone:
+ return true;
+ case DetectCallDepth::kErrorMissingMain:
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "Missing main()";
+ return false;
+ case DetectCallDepth::kErrorRecursion:
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "Function recursion detected";
+ return false;
+ case DetectCallDepth::kErrorMaxDepthExceeded:
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "Function call stack too deep";
+ return false;
+ default:
+ UNREACHABLE();
+ return false;
}
}
@@ -315,7 +339,8 @@ void TCompiler::rewriteCSSShader(TIntermNode* root)
root->traverse(&renamer);
}
-bool TCompiler::validateLimitations(TIntermNode* root) {
+bool TCompiler::validateLimitations(TIntermNode* root)
+{
ValidateLimitations validate(shaderType, infoSink.info);
root->traverse(&validate);
return validate.numErrors() == 0;
@@ -323,26 +348,30 @@ bool TCompiler::validateLimitations(TIntermNode* root) {
bool TCompiler::enforceTimingRestrictions(TIntermNode* root, bool outputGraph)
{
- if (shaderSpec != SH_WEBGL_SPEC) {
+ if (shaderSpec != SH_WEBGL_SPEC)
+ {
infoSink.info << "Timing restrictions must be enforced under the WebGL spec.";
return false;
}
- if (shaderType == SH_FRAGMENT_SHADER) {
+ if (shaderType == SH_FRAGMENT_SHADER)
+ {
TDependencyGraph graph(root);
// Output any errors first.
bool success = enforceFragmentShaderTimingRestrictions(graph);
// Then, output the dependency graph.
- if (outputGraph) {
+ if (outputGraph)
+ {
TDependencyGraphOutput output(infoSink.info);
output.outputAllSpanningTrees(graph);
}
return success;
}
- else {
+ else
+ {
return enforceVertexShaderTimingRestrictions(root);
}
}
@@ -362,7 +391,8 @@ bool TCompiler::limitExpressionComplexity(TIntermNode* root)
samplerSymbol->traverse(&graphTraverser);
}
- if (traverser.getMaxDepth() > maxExpressionComplexity) {
+ if (traverser.getMaxDepth() > maxExpressionComplexity)
+ {
infoSink.info << "Expression too complex.";
return false;
}
@@ -395,6 +425,70 @@ bool TCompiler::enforcePackingRestrictions()
return packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
}
+void TCompiler::initializeGLPosition(TIntermNode* root)
+{
+ InitializeVariables::InitVariableInfoList variables;
+ InitializeVariables::InitVariableInfo var(
+ "gl_Position", TType(EbtFloat, EbpUndefined, EvqPosition, 4));
+ variables.push_back(var);
+ InitializeVariables initializer(variables);
+ root->traverse(&initializer);
+}
+
+void TCompiler::initializeVaryingsWithoutStaticUse(TIntermNode* root)
+{
+ InitializeVariables::InitVariableInfoList variables;
+ for (size_t ii = 0; ii < varyings.size(); ++ii)
+ {
+ const TVariableInfo& varying = varyings[ii];
+ if (varying.staticUse)
+ continue;
+ unsigned char size = 0;
+ bool matrix = false;
+ switch (varying.type)
+ {
+ case SH_FLOAT:
+ size = 1;
+ break;
+ case SH_FLOAT_VEC2:
+ size = 2;
+ break;
+ case SH_FLOAT_VEC3:
+ size = 3;
+ break;
+ case SH_FLOAT_VEC4:
+ size = 4;
+ break;
+ case SH_FLOAT_MAT2:
+ size = 2;
+ matrix = true;
+ break;
+ case SH_FLOAT_MAT3:
+ size = 3;
+ matrix = true;
+ break;
+ case SH_FLOAT_MAT4:
+ size = 4;
+ matrix = true;
+ break;
+ default:
+ ASSERT(false);
+ }
+ TType type(EbtFloat, EbpUndefined, EvqVaryingOut, size, matrix, varying.isArray);
+ TString name = varying.name.c_str();
+ if (varying.isArray)
+ {
+ type.setArraySize(varying.size);
+ name = name.substr(0, name.find_first_of('['));
+ }
+
+ InitializeVariables::InitVariableInfo var(name, type);
+ variables.push_back(var);
+ }
+ InitializeVariables initializer(variables);
+ root->traverse(&initializer);
+}
+
void TCompiler::mapLongVariableNames(TIntermNode* root)
{
ASSERT(longNameMap);
diff --git a/src/3rdparty/angle/src/compiler/ConstantUnion.h b/src/3rdparty/angle/src/compiler/translator/ConstantUnion.h
index b1e37885f9..b1e37885f9 100644
--- a/src/3rdparty/angle/src/compiler/ConstantUnion.h
+++ b/src/3rdparty/angle/src/compiler/translator/ConstantUnion.h
diff --git a/src/3rdparty/angle/src/compiler/DetectCallDepth.cpp b/src/3rdparty/angle/src/compiler/translator/DetectCallDepth.cpp
index 60df52c715..bfc1d5852f 100644
--- a/src/3rdparty/angle/src/compiler/DetectCallDepth.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/DetectCallDepth.cpp
@@ -4,8 +4,8 @@
// found in the LICENSE file.
//
-#include "compiler/DetectCallDepth.h"
-#include "compiler/InfoSink.h"
+#include "compiler/translator/DetectCallDepth.h"
+#include "compiler/translator/InfoSink.h"
DetectCallDepth::FunctionNode::FunctionNode(const TString& fname)
: name(fname),
diff --git a/src/3rdparty/angle/src/compiler/DetectCallDepth.h b/src/3rdparty/angle/src/compiler/translator/DetectCallDepth.h
index 89e85f88f6..5e7f23d15f 100644
--- a/src/3rdparty/angle/src/compiler/DetectCallDepth.h
+++ b/src/3rdparty/angle/src/compiler/translator/DetectCallDepth.h
@@ -10,8 +10,8 @@
#include "GLSLANG/ShaderLang.h"
#include <limits.h>
-#include "compiler/intermediate.h"
-#include "compiler/VariableInfo.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/VariableInfo.h"
class TInfoSink;
diff --git a/src/3rdparty/angle/src/compiler/DetectDiscontinuity.cpp b/src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.cpp
index 7c3b68a0b3..334eb0bfa8 100644
--- a/src/3rdparty/angle/src/compiler/DetectDiscontinuity.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.cpp
@@ -8,9 +8,9 @@
// gradients of functions with discontinuities.
//
-#include "compiler/DetectDiscontinuity.h"
+#include "compiler/translator/DetectDiscontinuity.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/ParseContext.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/DetectDiscontinuity.h b/src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.h
index e5520bd5b0..1dd8be9233 100644
--- a/src/3rdparty/angle/src/compiler/DetectDiscontinuity.h
+++ b/src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.h
@@ -11,7 +11,7 @@
#ifndef COMPILER_DETECTDISCONTINUITY_H_
#define COMPILER_DETECTDISCONTINUITY_H_
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/Diagnostics.cpp b/src/3rdparty/angle/src/compiler/translator/Diagnostics.cpp
index 8a38c41a65..99506c0849 100644
--- a/src/3rdparty/angle/src/compiler/Diagnostics.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Diagnostics.cpp
@@ -4,10 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/Diagnostics.h"
+#include "compiler/translator/Diagnostics.h"
-#include "compiler/debug.h"
-#include "compiler/InfoSink.h"
+#include "compiler/translator/compilerdebug.h"
+#include "compiler/translator/InfoSink.h"
#include "compiler/preprocessor/SourceLocation.h"
TDiagnostics::TDiagnostics(TInfoSink& infoSink) :
@@ -30,11 +30,11 @@ void TDiagnostics::writeInfo(Severity severity,
TPrefixType prefix = EPrefixNone;
switch (severity)
{
- case ERROR:
+ case PP_ERROR:
++mNumErrors;
prefix = EPrefixError;
break;
- case WARNING:
+ case PP_WARNING:
++mNumWarnings;
prefix = EPrefixWarning;
break;
diff --git a/src/3rdparty/angle/src/compiler/Diagnostics.h b/src/3rdparty/angle/src/compiler/translator/Diagnostics.h
index cb71bb1204..cb71bb1204 100644
--- a/src/3rdparty/angle/src/compiler/Diagnostics.h
+++ b/src/3rdparty/angle/src/compiler/translator/Diagnostics.h
diff --git a/src/3rdparty/angle/src/compiler/DirectiveHandler.cpp b/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.cpp
index d1f6ab3af5..662c8ae624 100644
--- a/src/3rdparty/angle/src/compiler/DirectiveHandler.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.cpp
@@ -4,12 +4,12 @@
// found in the LICENSE file.
//
-#include "compiler/DirectiveHandler.h"
+#include "compiler/translator/DirectiveHandler.h"
#include <sstream>
-#include "compiler/debug.h"
-#include "compiler/Diagnostics.h"
+#include "compiler/translator/compilerdebug.h"
+#include "compiler/translator/Diagnostics.h"
static TBehavior getBehavior(const std::string& str)
{
@@ -39,7 +39,7 @@ TDirectiveHandler::~TDirectiveHandler()
void TDirectiveHandler::handleError(const pp::SourceLocation& loc,
const std::string& msg)
{
- mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc, msg, "", "");
+ mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, msg, "", "");
}
void TDirectiveHandler::handlePragma(const pp::SourceLocation& loc,
@@ -73,12 +73,12 @@ void TDirectiveHandler::handlePragma(const pp::SourceLocation& loc,
}
else
{
- mDiagnostics.report(pp::Diagnostics::UNRECOGNIZED_PRAGMA, loc, name);
+ mDiagnostics.report(pp::Diagnostics::PP_UNRECOGNIZED_PRAGMA, loc, name);
return;
}
if (invalidValue)
- mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
+ mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"invalid pragma value", value,
"'on' or 'off' expected");
}
@@ -92,7 +92,7 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
TBehavior behaviorVal = getBehavior(behavior);
if (behaviorVal == EBhUndefined)
{
- mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
+ mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"behavior", name, "invalid");
return;
}
@@ -101,13 +101,13 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
{
if (behaviorVal == EBhRequire)
{
- mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
+ mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"extension", name,
"cannot have 'require' behavior");
}
else if (behaviorVal == EBhEnable)
{
- mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
+ mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"extension", name,
"cannot have 'enable' behavior");
}
@@ -127,15 +127,15 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
return;
}
- pp::Diagnostics::Severity severity = pp::Diagnostics::ERROR;
+ pp::Diagnostics::Severity severity = pp::Diagnostics::PP_ERROR;
switch (behaviorVal) {
case EBhRequire:
- severity = pp::Diagnostics::ERROR;
+ severity = pp::Diagnostics::PP_ERROR;
break;
case EBhEnable:
case EBhWarn:
case EBhDisable:
- severity = pp::Diagnostics::WARNING;
+ severity = pp::Diagnostics::PP_WARNING;
break;
default:
UNREACHABLE();
@@ -155,7 +155,7 @@ void TDirectiveHandler::handleVersion(const pp::SourceLocation& loc,
std::stringstream stream;
stream << version;
std::string str = stream.str();
- mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
+ mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"version number", str, "not supported");
}
}
diff --git a/src/3rdparty/angle/src/compiler/DirectiveHandler.h b/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.h
index 95ca59d6fe..eb5f055494 100644
--- a/src/3rdparty/angle/src/compiler/DirectiveHandler.h
+++ b/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.h
@@ -7,8 +7,8 @@
#ifndef COMPILER_DIRECTIVE_HANDLER_H_
#define COMPILER_DIRECTIVE_HANDLER_H_
-#include "compiler/ExtensionBehavior.h"
-#include "compiler/Pragma.h"
+#include "compiler/translator/ExtensionBehavior.h"
+#include "compiler/translator/Pragma.h"
#include "compiler/preprocessor/DirectiveHandlerBase.h"
class TDiagnostics;
diff --git a/src/3rdparty/angle/src/compiler/ExtensionBehavior.h b/src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.h
index 5c1595fb21..5c1595fb21 100644
--- a/src/3rdparty/angle/src/compiler/ExtensionBehavior.h
+++ b/src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.h
diff --git a/src/3rdparty/angle/src/compiler/ForLoopUnroll.cpp b/src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.cpp
index 27a13eabab..89e6f1a62b 100644
--- a/src/3rdparty/angle/src/compiler/ForLoopUnroll.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/ForLoopUnroll.h"
+#include "compiler/translator/ForLoopUnroll.h"
namespace {
diff --git a/src/3rdparty/angle/src/compiler/ForLoopUnroll.h b/src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.h
index e800e25b1f..afd70d1fd2 100644
--- a/src/3rdparty/angle/src/compiler/ForLoopUnroll.h
+++ b/src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.h
@@ -4,7 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/intermediate.h"
+#ifndef COMPILER_FORLOOPUNROLL_H_
+#define COMPILER_FORLOOPUNROLL_H_
+
+#include "compiler/translator/intermediate.h"
struct TLoopIndexInfo {
int id;
@@ -46,3 +49,4 @@ private:
TVector<TLoopIndexInfo> mLoopIndexStack;
};
+#endif
diff --git a/src/3rdparty/angle/src/compiler/HashNames.h b/src/3rdparty/angle/src/compiler/translator/HashNames.h
index d2141e2d85..751265b759 100644
--- a/src/3rdparty/angle/src/compiler/HashNames.h
+++ b/src/3rdparty/angle/src/compiler/translator/HashNames.h
@@ -9,7 +9,7 @@
#include <map>
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
#include "GLSLANG/ShaderLang.h"
#define HASHED_NAME_PREFIX "webgl_"
diff --git a/src/3rdparty/angle/src/compiler/InfoSink.cpp b/src/3rdparty/angle/src/compiler/translator/InfoSink.cpp
index d20a6c0175..cd59658ff7 100644
--- a/src/3rdparty/angle/src/compiler/InfoSink.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/InfoSink.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/InfoSink.h"
+#include "compiler/translator/InfoSink.h"
void TInfoSinkBase::prefix(TPrefixType p) {
switch(p) {
diff --git a/src/3rdparty/angle/src/compiler/InfoSink.h b/src/3rdparty/angle/src/compiler/translator/InfoSink.h
index 6888838142..698a8b454b 100644
--- a/src/3rdparty/angle/src/compiler/InfoSink.h
+++ b/src/3rdparty/angle/src/compiler/translator/InfoSink.h
@@ -8,7 +8,8 @@
#define _INFOSINK_INCLUDED_
#include <math.h>
-#include "compiler/Common.h"
+#include <stdlib.h>
+#include "compiler/translator/Common.h"
// Returns the fractional part of the given floating-point number.
inline float fractionalPart(float f) {
diff --git a/src/3rdparty/angle/src/compiler/Initialize.cpp b/src/3rdparty/angle/src/compiler/translator/Initialize.cpp
index 236383d874..db728b2129 100644
--- a/src/3rdparty/angle/src/compiler/Initialize.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Initialize.cpp
@@ -10,9 +10,9 @@
// built-in functions and operators.
//
-#include "compiler/Initialize.h"
+#include "compiler/translator/Initialize.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
{
@@ -363,7 +363,7 @@ void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltI
symbolTable.insertBuiltIn(float2, "dFdx", float2);
symbolTable.insertBuiltIn(float3, "dFdx", float3);
symbolTable.insertBuiltIn(float4, "dFdx", float4);
-
+
symbolTable.insertBuiltIn(float1, "dFdy", float1);
symbolTable.insertBuiltIn(float2, "dFdy", float2);
symbolTable.insertBuiltIn(float3, "dFdy", float3);
diff --git a/src/3rdparty/angle/src/compiler/Initialize.h b/src/3rdparty/angle/src/compiler/translator/Initialize.h
index 4aa13466ac..b5642869aa 100644
--- a/src/3rdparty/angle/src/compiler/Initialize.h
+++ b/src/3rdparty/angle/src/compiler/translator/Initialize.h
@@ -7,9 +7,9 @@
#ifndef _INITIALIZE_INCLUDED_
#define _INITIALIZE_INCLUDED_
-#include "compiler/Common.h"
-#include "compiler/ShHandle.h"
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/SymbolTable.h"
void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &table);
diff --git a/src/3rdparty/angle/src/compiler/InitializeDll.cpp b/src/3rdparty/angle/src/compiler/translator/InitializeDll.cpp
index 6c7f27fced..43f81784d0 100644
--- a/src/3rdparty/angle/src/compiler/InitializeDll.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeDll.cpp
@@ -4,11 +4,11 @@
// found in the LICENSE file.
//
-#include "compiler/InitializeDll.h"
+#include "compiler/translator/InitializeDll.h"
-#include "compiler/InitializeGlobals.h"
-#include "compiler/InitializeParseContext.h"
-#include "compiler/osinclude.h"
+#include "compiler/translator/InitializeGlobals.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/osinclude.h"
bool InitProcess()
{
diff --git a/src/3rdparty/angle/src/compiler/InitializeDll.h b/src/3rdparty/angle/src/compiler/translator/InitializeDll.h
index 43070cc3ff..43070cc3ff 100644
--- a/src/3rdparty/angle/src/compiler/InitializeDll.h
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeDll.h
diff --git a/src/3rdparty/angle/src/compiler/InitializeGlobals.h b/src/3rdparty/angle/src/compiler/translator/InitializeGlobals.h
index 0715941424..0715941424 100644
--- a/src/3rdparty/angle/src/compiler/InitializeGlobals.h
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeGlobals.h
diff --git a/src/3rdparty/angle/src/compiler/InitializeParseContext.cpp b/src/3rdparty/angle/src/compiler/translator/InitializeParseContext.cpp
index dfab027330..b4defae569 100644
--- a/src/3rdparty/angle/src/compiler/InitializeParseContext.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeParseContext.cpp
@@ -4,9 +4,9 @@
// found in the LICENSE file.
//
-#include "compiler/InitializeParseContext.h"
+#include "compiler/translator/InitializeParseContext.h"
-#include "compiler/osinclude.h"
+#include "compiler/translator/osinclude.h"
OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
diff --git a/src/3rdparty/angle/src/compiler/InitializeParseContext.h b/src/3rdparty/angle/src/compiler/translator/InitializeParseContext.h
index bffbab87d0..bffbab87d0 100644
--- a/src/3rdparty/angle/src/compiler/InitializeParseContext.h
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeParseContext.h
diff --git a/src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp b/src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp
new file mode 100644
index 0000000000..115c561c77
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp
@@ -0,0 +1,116 @@
+//
+// 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 "compiler/translator/compilerdebug.h"
+
+namespace
+{
+
+TIntermConstantUnion* constructFloatConstUnionNode(const TType& type)
+{
+ TType myType = type;
+ unsigned char size = myType.getNominalSize();
+ if (myType.isMatrix())
+ size *= size;
+ ConstantUnion *u = new ConstantUnion[size];
+ for (int ii = 0; ii < size; ++ii)
+ u[ii].setFConst(0.0f);
+
+ myType.clearArrayness();
+ myType.setQualifier(EvqConst);
+ TIntermConstantUnion *node = new TIntermConstantUnion(u, myType);
+ return node;
+}
+
+TIntermConstantUnion* constructIndexNode(int index)
+{
+ ConstantUnion *u = new ConstantUnion[1];
+ u[0].setIConst(index);
+
+ TType type(EbtInt, EbpUndefined, EvqConst, 1);
+ TIntermConstantUnion *node = new TIntermConstantUnion(u, type);
+ return node;
+}
+
+} // namespace anonymous
+
+bool InitializeVariables::visitAggregate(Visit visit, TIntermAggregate* node)
+{
+ bool visitChildren = !mCodeInserted;
+ switch (node->getOp())
+ {
+ case EOpSequence:
+ break;
+ case EOpFunction:
+ {
+ // Function definition.
+ ASSERT(visit == PreVisit);
+ if (node->getName() == "main(")
+ {
+ TIntermSequence &sequence = node->getSequence();
+ ASSERT((sequence.size() == 1) || (sequence.size() == 2));
+ TIntermAggregate *body = NULL;
+ if (sequence.size() == 1)
+ {
+ body = new TIntermAggregate(EOpSequence);
+ sequence.push_back(body);
+ }
+ else
+ {
+ body = sequence[1]->getAsAggregate();
+ }
+ ASSERT(body);
+ insertInitCode(body->getSequence());
+ mCodeInserted = true;
+ }
+ break;
+ }
+ default:
+ visitChildren = false;
+ break;
+ }
+ return visitChildren;
+}
+
+void InitializeVariables::insertInitCode(TIntermSequence& sequence)
+{
+ for (size_t ii = 0; ii < mVariables.size(); ++ii)
+ {
+ const InitVariableInfo& varInfo = mVariables[ii];
+
+ if (varInfo.type.isArray())
+ {
+ for (int index = varInfo.type.getArraySize() - 1; index >= 0; --index)
+ {
+ TIntermBinary *assign = new TIntermBinary(EOpAssign);
+ sequence.insert(sequence.begin(), assign);
+
+ TIntermBinary *indexDirect = new TIntermBinary(EOpIndexDirect);
+ TIntermSymbol *symbol = new TIntermSymbol(0, varInfo.name, varInfo.type);
+ indexDirect->setLeft(symbol);
+ TIntermConstantUnion *indexNode = constructIndexNode(index);
+ indexDirect->setRight(indexNode);
+
+ assign->setLeft(indexDirect);
+
+ TIntermConstantUnion *zeroConst = constructFloatConstUnionNode(varInfo.type);
+ assign->setRight(zeroConst);
+ }
+ }
+ else
+ {
+ TIntermBinary *assign = new TIntermBinary(EOpAssign);
+ sequence.insert(sequence.begin(), assign);
+ TIntermSymbol *symbol = new TIntermSymbol(0, varInfo.name, varInfo.type);
+ assign->setLeft(symbol);
+ TIntermConstantUnion *zeroConst = constructFloatConstUnionNode(varInfo.type);
+ assign->setRight(zeroConst);
+ }
+
+ }
+}
+
diff --git a/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h b/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h
new file mode 100644
index 0000000000..1cd6d7e1b5
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h
@@ -0,0 +1,50 @@
+//
+// 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_INITIALIZE_VARIABLES_H_
+#define COMPILER_INITIALIZE_VARIABLES_H_
+
+#include "compiler/translator/intermediate.h"
+
+class InitializeVariables : public TIntermTraverser
+{
+ public:
+ struct InitVariableInfo
+ {
+ TString name;
+ TType type;
+
+ InitVariableInfo(const TString& _name, const TType& _type)
+ : name(_name),
+ type(_type)
+ {
+ }
+ };
+ typedef TVector<InitVariableInfo> InitVariableInfoList;
+
+ InitializeVariables(const InitVariableInfoList& vars)
+ : mCodeInserted(false),
+ mVariables(vars)
+ {
+ }
+
+ protected:
+ virtual bool visitBinary(Visit visit, TIntermBinary* node) { return false; }
+ virtual bool visitUnary(Visit visit, TIntermUnary* node) { return false; }
+ virtual bool visitSelection(Visit visit, TIntermSelection* node) { return false; }
+ virtual bool visitLoop(Visit visit, TIntermLoop* node) { return false; }
+ virtual bool visitBranch(Visit visit, TIntermBranch* node) { return false; }
+
+ virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
+
+ private:
+ void insertInitCode(TIntermSequence& sequence);
+
+ InitVariableInfoList mVariables;
+ bool mCodeInserted;
+};
+
+#endif // COMPILER_INITIALIZE_VARIABLES_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp b/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp
new file mode 100644
index 0000000000..554b83409a
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp
@@ -0,0 +1,259 @@
+//
+// 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/intermediate.h"
+
+//
+// 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.
+//
+// preVisit, postVisit, and rightToLeft control what order
+// nodes are visited in.
+//
+
+//
+// Traversal functions for terminals are straighforward....
+//
+void TIntermSymbol::traverse(TIntermTraverser *it)
+{
+ it->visitSymbol(this);
+}
+
+void TIntermConstantUnion::traverse(TIntermTraverser *it)
+{
+ it->visitConstantUnion(this);
+}
+
+//
+// Traverse a binary node.
+//
+void TIntermBinary::traverse(TIntermTraverser *it)
+{
+ bool visit = true;
+
+ //
+ // visit the node before children if pre-visiting.
+ //
+ if (it->preVisit)
+ visit = it->visitBinary(PreVisit, this);
+
+ //
+ // Visit the children, in the right order.
+ //
+ if (visit)
+ {
+ it->incrementDepth(this);
+
+ if (it->rightToLeft)
+ {
+ if (right)
+ right->traverse(it);
+
+ if (it->inVisit)
+ visit = it->visitBinary(InVisit, this);
+
+ if (visit && left)
+ left->traverse(it);
+ }
+ else
+ {
+ if (left)
+ left->traverse(it);
+
+ if (it->inVisit)
+ visit = it->visitBinary(InVisit, this);
+
+ if (visit && right)
+ right->traverse(it);
+ }
+
+ it->decrementDepth();
+ }
+
+ //
+ // Visit the node after the children, if requested and the traversal
+ // hasn't been cancelled yet.
+ //
+ if (visit && it->postVisit)
+ it->visitBinary(PostVisit, this);
+}
+
+//
+// Traverse a unary node. Same comments in binary node apply here.
+//
+void TIntermUnary::traverse(TIntermTraverser *it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitUnary(PreVisit, this);
+
+ if (visit) {
+ it->incrementDepth(this);
+ operand->traverse(it);
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitUnary(PostVisit, this);
+}
+
+//
+// Traverse an aggregate node. Same comments in binary node apply here.
+//
+void TIntermAggregate::traverse(TIntermTraverser *it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitAggregate(PreVisit, this);
+
+ if (visit)
+ {
+ it->incrementDepth(this);
+
+ if (it->rightToLeft)
+ {
+ for (TIntermSequence::reverse_iterator sit = sequence.rbegin(); sit != sequence.rend(); sit++)
+ {
+ (*sit)->traverse(it);
+
+ if (visit && it->inVisit)
+ {
+ if (*sit != sequence.front())
+ visit = it->visitAggregate(InVisit, this);
+ }
+ }
+ }
+ else
+ {
+ for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
+ {
+ (*sit)->traverse(it);
+
+ if (visit && it->inVisit)
+ {
+ if (*sit != sequence.back())
+ visit = it->visitAggregate(InVisit, this);
+ }
+ }
+ }
+
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitAggregate(PostVisit, this);
+}
+
+//
+// Traverse a selection node. Same comments in binary node apply here.
+//
+void TIntermSelection::traverse(TIntermTraverser *it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitSelection(PreVisit, this);
+
+ if (visit) {
+ it->incrementDepth(this);
+ if (it->rightToLeft) {
+ if (falseBlock)
+ falseBlock->traverse(it);
+ if (trueBlock)
+ trueBlock->traverse(it);
+ condition->traverse(it);
+ } else {
+ condition->traverse(it);
+ if (trueBlock)
+ trueBlock->traverse(it);
+ if (falseBlock)
+ falseBlock->traverse(it);
+ }
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitSelection(PostVisit, this);
+}
+
+//
+// Traverse a loop node. Same comments in binary node apply here.
+//
+void TIntermLoop::traverse(TIntermTraverser *it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitLoop(PreVisit, this);
+
+ if (visit)
+ {
+ it->incrementDepth(this);
+
+ if (it->rightToLeft)
+ {
+ if (expr)
+ expr->traverse(it);
+
+ if (body)
+ body->traverse(it);
+
+ if (cond)
+ cond->traverse(it);
+
+ if (init)
+ init->traverse(it);
+ }
+ else
+ {
+ if (init)
+ init->traverse(it);
+
+ if (cond)
+ cond->traverse(it);
+
+ if (body)
+ body->traverse(it);
+
+ if (expr)
+ expr->traverse(it);
+ }
+
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitLoop(PostVisit, this);
+}
+
+//
+// Traverse a branch node. Same comments in binary node apply here.
+//
+void TIntermBranch::traverse(TIntermTraverser *it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitBranch(PreVisit, this);
+
+ if (visit && expression) {
+ it->incrementDepth(this);
+ expression->traverse(it);
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitBranch(PostVisit, this);
+}
+
diff --git a/src/3rdparty/angle/src/compiler/Intermediate.cpp b/src/3rdparty/angle/src/compiler/translator/Intermediate.cpp
index 3b6622185d..777cab5458 100644
--- a/src/3rdparty/angle/src/compiler/Intermediate.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Intermediate.cpp
@@ -12,18 +12,20 @@
#include <limits.h>
#include <algorithm>
-#include "compiler/HashNames.h"
-#include "compiler/localintermediate.h"
-#include "compiler/QualifierAlive.h"
-#include "compiler/RemoveTree.h"
+#include "compiler/translator/HashNames.h"
+#include "compiler/translator/localintermediate.h"
+#include "compiler/translator/QualifierAlive.h"
+#include "compiler/translator/RemoveTree.h"
bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray);
-static TPrecision GetHigherPrecision( TPrecision left, TPrecision right ){
+static TPrecision GetHigherPrecision(TPrecision left, TPrecision right)
+{
return left > right ? left : right;
}
-const char* getOperatorString(TOperator op) {
+const char* getOperatorString(TOperator op)
+{
switch (op) {
case EOpInitialize: return "=";
case EOpAssign: return "=";
@@ -742,12 +744,67 @@ void TIntermediate::remove(TIntermNode* root)
//
////////////////////////////////////////////////////////////////
+#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)
+{
+ REPLACE_IF_IS(init, TIntermNode, original, replacement);
+ REPLACE_IF_IS(cond, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(expr, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(body, TIntermNode, original, replacement);
+ return false;
+}
+
+bool TIntermBranch::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(expression, TIntermTyped, original, replacement);
+ return false;
+}
+
+bool TIntermBinary::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(left, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(right, TIntermTyped, original, replacement);
+ return false;
+}
+
+bool TIntermUnary::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(operand, TIntermTyped, original, replacement);
+ return false;
+}
+
+bool TIntermAggregate::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ for (size_t ii = 0; ii < sequence.size(); ++ii)
+ {
+ REPLACE_IF_IS(sequence[ii], TIntermNode, original, replacement);
+ }
+ return false;
+}
+
+bool TIntermSelection::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(condition, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(trueBlock, TIntermNode, original, replacement);
+ REPLACE_IF_IS(falseBlock, TIntermNode, original, replacement);
+ return false;
+}
+
//
// Say whether or not an operation node changes the value of a variable.
//
-// Returns true if state is modified.
-//
-bool TIntermOperator::modifiesState() const
+bool TIntermOperator::isAssignment() const
{
switch (op) {
case EOpPostIncrement:
@@ -796,6 +853,7 @@ bool TIntermOperator::isConstructor() const
return false;
}
}
+
//
// Make sure the type of a unary operator is appropriate for its
// combination of operation and operand type.
diff --git a/src/3rdparty/angle/src/compiler/MMap.h b/src/3rdparty/angle/src/compiler/translator/MMap.h
index a308671514..a308671514 100644
--- a/src/3rdparty/angle/src/compiler/MMap.h
+++ b/src/3rdparty/angle/src/compiler/translator/MMap.h
diff --git a/src/3rdparty/angle/src/compiler/MapLongVariableNames.cpp b/src/3rdparty/angle/src/compiler/translator/MapLongVariableNames.cpp
index a41d20f4e8..ef629c26b1 100644
--- a/src/3rdparty/angle/src/compiler/MapLongVariableNames.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/MapLongVariableNames.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/MapLongVariableNames.h"
+#include "compiler/translator/MapLongVariableNames.h"
namespace {
@@ -102,13 +102,6 @@ void MapLongVariableNames::visitSymbol(TIntermSymbol* symbol)
}
}
-bool MapLongVariableNames::visitLoop(Visit, TIntermLoop* node)
-{
- if (node->getInit())
- node->getInit()->traverse(this);
- return true;
-}
-
TString MapLongVariableNames::mapGlobalLongName(const TString& name)
{
ASSERT(mGlobalMap);
diff --git a/src/3rdparty/angle/src/compiler/MapLongVariableNames.h b/src/3rdparty/angle/src/compiler/translator/MapLongVariableNames.h
index d6352acb4b..3b085a3687 100644
--- a/src/3rdparty/angle/src/compiler/MapLongVariableNames.h
+++ b/src/3rdparty/angle/src/compiler/translator/MapLongVariableNames.h
@@ -9,8 +9,8 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
-#include "compiler/VariableInfo.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/VariableInfo.h"
// This size does not include '\0' in the end.
#define MAX_SHORTENED_IDENTIFIER_SIZE 32
@@ -48,7 +48,6 @@ public:
MapLongVariableNames(LongNameMap* globalMap);
virtual void visitSymbol(TIntermSymbol*);
- virtual bool visitLoop(Visit, TIntermLoop*);
private:
TString mapGlobalLongName(const TString& name);
diff --git a/src/3rdparty/angle/src/compiler/translator/NodeSearch.h b/src/3rdparty/angle/src/compiler/translator/NodeSearch.h
new file mode 100644
index 0000000000..b58c7ec689
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/NodeSearch.h
@@ -0,0 +1,80 @@
+//
+// 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 TRANSLATOR_NODESEARCH_H_
+#define TRANSLATOR_NODESEARCH_H_
+
+#include "compiler/translator/intermediate.h"
+
+namespace sh
+{
+
+template <class Parent>
+class NodeSearchTraverser : public TIntermTraverser
+{
+ public:
+ NodeSearchTraverser()
+ : 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;
+ }
+};
+
+class FindSideEffectRewriting : public NodeSearchTraverser<FindSideEffectRewriting>
+{
+ public:
+ virtual bool visitBinary(Visit visit, TIntermBinary *node)
+ {
+ switch (node->getOp())
+ {
+ case EOpLogicalOr:
+ case EOpLogicalAnd:
+ if (node->getRight()->hasSideEffects())
+ {
+ mFound = true;
+ }
+ break;
+
+ default: break;
+ }
+
+ return !mFound;
+ }
+};
+
+}
+
+#endif // TRANSLATOR_NODESEARCH_H_
diff --git a/src/3rdparty/angle/src/compiler/OutputESSL.cpp b/src/3rdparty/angle/src/compiler/translator/OutputESSL.cpp
index c2048f1cec..8367412462 100644
--- a/src/3rdparty/angle/src/compiler/OutputESSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/OutputESSL.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/OutputESSL.h"
+#include "compiler/translator/OutputESSL.h"
TOutputESSL::TOutputESSL(TInfoSinkBase& objSink,
ShArrayIndexClampingStrategy clampingStrategy,
diff --git a/src/3rdparty/angle/src/compiler/OutputESSL.h b/src/3rdparty/angle/src/compiler/translator/OutputESSL.h
index 05db96e497..2f02979a05 100644
--- a/src/3rdparty/angle/src/compiler/OutputESSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/OutputESSL.h
@@ -7,7 +7,7 @@
#ifndef CROSSCOMPILERGLSL_OUTPUTESSL_H_
#define CROSSCOMPILERGLSL_OUTPUTESSL_H_
-#include "compiler/OutputGLSLBase.h"
+#include "compiler/translator/OutputGLSLBase.h"
class TOutputESSL : public TOutputGLSLBase
{
diff --git a/src/3rdparty/angle/src/compiler/OutputGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/OutputGLSL.cpp
index 10a451c0d7..5589560682 100644
--- a/src/3rdparty/angle/src/compiler/OutputGLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/OutputGLSL.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/OutputGLSL.h"
+#include "compiler/translator/OutputGLSL.h"
TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink,
ShArrayIndexClampingStrategy clampingStrategy,
diff --git a/src/3rdparty/angle/src/compiler/OutputGLSL.h b/src/3rdparty/angle/src/compiler/translator/OutputGLSL.h
index fa68ac8103..e1f114d347 100644
--- a/src/3rdparty/angle/src/compiler/OutputGLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/OutputGLSL.h
@@ -7,7 +7,7 @@
#ifndef CROSSCOMPILERGLSL_OUTPUTGLSL_H_
#define CROSSCOMPILERGLSL_OUTPUTGLSL_H_
-#include "compiler/OutputGLSLBase.h"
+#include "compiler/translator/OutputGLSLBase.h"
class TOutputGLSL : public TOutputGLSLBase
{
diff --git a/src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp
index d677c75633..f2f0a3d6be 100644
--- a/src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp
@@ -4,8 +4,8 @@
// found in the LICENSE file.
//
-#include "compiler/OutputGLSLBase.h"
-#include "compiler/debug.h"
+#include "compiler/translator/OutputGLSLBase.h"
+#include "compiler/translator/compilerdebug.h"
#include <cfloat>
@@ -435,7 +435,7 @@ bool TOutputGLSLBase::visitSelection(Visit visit, TIntermSelection* node)
node->getCondition()->traverse(this);
out << ")\n";
- incrementDepth();
+ incrementDepth(node);
visitCodeBlock(node->getTrueBlock());
if (node->getFalseBlock())
@@ -460,7 +460,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
// Scope the sequences except when at the global scope.
if (depth > 0) out << "{\n";
- incrementDepth();
+ incrementDepth(node);
const TIntermSequence& sequence = node->getSequence();
for (TIntermSequence::const_iterator iter = sequence.begin();
iter != sequence.end(); ++iter)
@@ -498,7 +498,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
writeVariableType(node->getType());
out << " " << hashFunctionName(node->getName());
- incrementDepth();
+ incrementDepth(node);
// Function definition node contains one or two children nodes
// representing function parameters and function body. The latter
// is not present in case of empty function bodies.
@@ -638,7 +638,7 @@ bool TOutputGLSLBase::visitLoop(Visit visit, TIntermLoop* node)
{
TInfoSinkBase& out = objSink();
- incrementDepth();
+ incrementDepth(node);
// Loop header.
TLoopType loopType = node->getType();
if (loopType == ELoopFor) // for loop
diff --git a/src/3rdparty/angle/src/compiler/OutputGLSLBase.h b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h
index df4ad68c2c..76bec4de61 100644
--- a/src/3rdparty/angle/src/compiler/OutputGLSLBase.h
+++ b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h
@@ -9,9 +9,9 @@
#include <set>
-#include "compiler/ForLoopUnroll.h"
-#include "compiler/intermediate.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/ForLoopUnroll.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/ParseContext.h"
class TOutputGLSLBase : public TIntermTraverser
{
diff --git a/src/3rdparty/angle/src/compiler/OutputHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
index 79a373ebab..af996df719 100644
--- a/src/3rdparty/angle/src/compiler/OutputHLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
@@ -4,14 +4,16 @@
// found in the LICENSE file.
//
-#include "compiler/OutputHLSL.h"
+#include "compiler/translator/OutputHLSL.h"
#include "common/angleutils.h"
-#include "compiler/debug.h"
-#include "compiler/DetectDiscontinuity.h"
-#include "compiler/InfoSink.h"
-#include "compiler/SearchSymbol.h"
-#include "compiler/UnfoldShortCircuit.h"
+#include "compiler/translator/compilerdebug.h"
+#include "compiler/translator/DetectDiscontinuity.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/SearchSymbol.h"
+#include "compiler/translator/UnfoldShortCircuit.h"
+#include "compiler/translator/NodeSearch.h"
+#include "compiler/translator/RewriteElseBlocks.h"
#include <algorithm>
#include <cfloat>
@@ -19,13 +21,6 @@
namespace sh
{
-// Integer to TString conversion
-TString str(int i)
-{
- char buffer[20];
- snprintf(buffer, sizeof(buffer), "%d", i);
- return buffer;
-}
OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType)
: TIntermTraverser(true, true, true), mContext(context), mOutputType(outputType)
@@ -72,6 +67,7 @@ OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resourc
mUsesAtan2_2 = false;
mUsesAtan2_3 = false;
mUsesAtan2_4 = false;
+ mUsesDiscardRewriting = false;
mNumRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
@@ -113,6 +109,13 @@ void OutputHLSL::output()
{
mContainsLoopDiscontinuity = mContext.shaderType == SH_FRAGMENT_SHADER && containsLoopDiscontinuity(mContext.treeRoot);
+ // 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 (mOutputType == SH_HLSL9_OUTPUT && mContext.shaderType == SH_VERTEX_SHADER)
+ {
+ RewriteElseBlocks(mContext.treeRoot);
+ }
+
mContext.treeRoot->traverse(this); // Output the body first to determine what has to go in the header
header();
@@ -196,6 +199,11 @@ void OutputHLSL::header()
attributes += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
}
+ if (mUsesDiscardRewriting)
+ {
+ out << "#define ANGLE_USES_DISCARD_REWRITING" << "\n";
+ }
+
if (shaderType == SH_FRAGMENT_SHADER)
{
TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find("GL_EXT_draw_buffers");
@@ -761,12 +769,12 @@ void OutputHLSL::header()
}
else if (mOutputType == SH_HLSL11_OUTPUT)
{
- out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw, float lod)\n"
+ out << "float4 gl_texture2DProjLod(Texture2D t, SamplerState s, float3 uvw, float lod)\n"
"{\n"
" return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), lod);\n"
"}\n"
"\n"
- "float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw)\n"
+ "float4 gl_texture2DProjLod(Texture2D t, SamplerState s, float4 uvw, float lod)\n"
"{\n"
" return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), lod);\n"
"}\n"
@@ -1092,6 +1100,10 @@ void OutputHLSL::visitSymbol(TIntermSymbol *node)
mReferencedVaryings[name] = node;
out << decorate(name);
}
+ else if (qualifier == EvqInternal)
+ {
+ out << name;
+ }
else
{
out << decorate(name);
@@ -1299,15 +1311,31 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
case EOpMatrixTimesVector: outputTriplet(visit, "mul(transpose(", "), ", ")"); break;
case EOpMatrixTimesMatrix: outputTriplet(visit, "transpose(mul(transpose(", "), transpose(", ")))"); break;
case EOpLogicalOr:
- out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
- return false;
+ if (node->getRight()->hasSideEffects())
+ {
+ out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
+ return false;
+ }
+ else
+ {
+ outputTriplet(visit, "(", " || ", ")");
+ return true;
+ }
case EOpLogicalXor:
mUsesXor = true;
outputTriplet(visit, "xor(", ", ", ")");
break;
case EOpLogicalAnd:
- out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
- return false;
+ if (node->getRight()->hasSideEffects())
+ {
+ out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
+ return false;
+ }
+ else
+ {
+ outputTriplet(visit, "(", " && ", ")");
+ return true;
+ }
default: UNREACHABLE();
}
@@ -1491,7 +1519,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
{
symbol->traverse(this);
out << arrayString(symbol->getType());
- out << " = " + initializer(variable->getType());
+ out << " = " + initializer(symbol->getType());
}
else
{
@@ -1944,7 +1972,7 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
{
mUnfoldShortCircuit->traverse(node->getCondition());
- out << "if(";
+ out << "if (";
node->getCondition()->traverse(this);
@@ -1953,9 +1981,14 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
outputLineDirective(node->getLine().first_line);
out << "{\n";
+ bool discard = false;
+
if (node->getTrueBlock())
{
traverseStatements(node->getTrueBlock());
+
+ // Detect true discard
+ discard = (discard || FindDiscard::search(node->getTrueBlock()));
}
outputLineDirective(node->getLine().first_line);
@@ -1973,6 +2006,15 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
outputLineDirective(node->getFalseBlock()->getLine().first_line);
out << ";\n}\n";
+
+ // Detect false discard
+ discard = (discard || FindDiscard::search(node->getFalseBlock()));
+ }
+
+ // ANGLE issue 486: Detect problematic conditional discard
+ if (discard && FindSideEffectRewriting::search(node))
+ {
+ mUsesDiscardRewriting = true;
}
}
@@ -2070,7 +2112,9 @@ bool OutputHLSL::visitBranch(Visit visit, TIntermBranch *node)
switch (node->getFlowOp())
{
- case EOpKill: outputTriplet(visit, "discard;\n", "", ""); break;
+ case EOpKill:
+ outputTriplet(visit, "discard;\n", "", "");
+ break;
case EOpBreak:
if (visit == PreVisit)
{
@@ -2293,7 +2337,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
if (!firstLoopFragment)
{
- out << "if(!Break";
+ out << "if (!Break";
index->traverse(this);
out << ") {\n";
}
diff --git a/src/3rdparty/angle/src/compiler/OutputHLSL.h b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.h
index cde4120718..3afd8e9ada 100644
--- a/src/3rdparty/angle/src/compiler/OutputHLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.h
@@ -14,9 +14,9 @@
#define GL_APICALL
#include <GLES2/gl2.h>
-#include "compiler/intermediate.h"
-#include "compiler/ParseHelper.h"
-#include "compiler/Uniform.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/Uniform.h"
namespace sh
{
@@ -125,6 +125,7 @@ class OutputHLSL : public TIntermTraverser
bool mUsesAtan2_2;
bool mUsesAtan2_3;
bool mUsesAtan2_4;
+ bool mUsesDiscardRewriting;
int mNumRenderTargets;
diff --git a/src/3rdparty/angle/src/compiler/ParseHelper.cpp b/src/3rdparty/angle/src/compiler/translator/ParseContext.cpp
index 1f8538e6a4..1a1e0d140c 100644
--- a/src/3rdparty/angle/src/compiler/ParseHelper.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ParseContext.cpp
@@ -4,12 +4,12 @@
// found in the LICENSE file.
//
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/ParseContext.h"
#include <stdarg.h>
#include <stdio.h>
-#include "compiler/glslang.h"
+#include "compiler/translator/glslang.h"
#include "compiler/preprocessor/SourceLocation.h"
///////////////////////////////////////////////////////////////////////
@@ -182,7 +182,7 @@ void TParseContext::error(const TSourceLoc& loc,
pp::SourceLocation srcLoc;
srcLoc.file = loc.first_file;
srcLoc.line = loc.first_line;
- diagnostics.writeInfo(pp::Diagnostics::ERROR,
+ diagnostics.writeInfo(pp::Diagnostics::PP_ERROR,
srcLoc, reason, token, extraInfo);
}
@@ -193,7 +193,7 @@ void TParseContext::warning(const TSourceLoc& loc,
pp::SourceLocation srcLoc;
srcLoc.file = loc.first_file;
srcLoc.line = loc.first_line;
- diagnostics.writeInfo(pp::Diagnostics::WARNING,
+ diagnostics.writeInfo(pp::Diagnostics::PP_WARNING,
srcLoc, reason, token, extraInfo);
}
@@ -535,7 +535,7 @@ bool TParseContext::constructorErrorCheck(const TSourceLoc& line, TIntermNode* n
return true;
}
- if (op == EOpConstructStruct && !type->isArray() && int(type->getStruct()->fields().size()) != function.getParamCount()) {
+ if (op == EOpConstructStruct && !type->isArray() && type->getStruct()->fields().size() != function.getParamCount()) {
error(line, "Number of constructor parameters does not match the number of structure fields", "constructor");
return true;
}
diff --git a/src/3rdparty/angle/src/compiler/ParseHelper.h b/src/3rdparty/angle/src/compiler/translator/ParseContext.h
index c2b3c3f7ec..b324e575d3 100644
--- a/src/3rdparty/angle/src/compiler/ParseHelper.h
+++ b/src/3rdparty/angle/src/compiler/translator/ParseContext.h
@@ -6,12 +6,12 @@
#ifndef _PARSER_HELPER_INCLUDED_
#define _PARSER_HELPER_INCLUDED_
-#include "compiler/Diagnostics.h"
-#include "compiler/DirectiveHandler.h"
-#include "compiler/localintermediate.h"
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/DirectiveHandler.h"
+#include "compiler/translator/localintermediate.h"
#include "compiler/preprocessor/Preprocessor.h"
-#include "compiler/ShHandle.h"
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/SymbolTable.h"
struct TMatrixFields {
bool wholeRow;
diff --git a/src/3rdparty/angle/src/compiler/PoolAlloc.cpp b/src/3rdparty/angle/src/compiler/translator/PoolAlloc.cpp
index eb993567b3..abe70262f2 100644
--- a/src/3rdparty/angle/src/compiler/PoolAlloc.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/PoolAlloc.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/PoolAlloc.h"
+#include "compiler/translator/PoolAlloc.h"
#ifndef _MSC_VER
#include <stdint.h>
@@ -12,8 +12,8 @@
#include <stdio.h>
#include "common/angleutils.h"
-#include "compiler/InitializeGlobals.h"
-#include "compiler/osinclude.h"
+#include "compiler/translator/InitializeGlobals.h"
+#include "compiler/translator/osinclude.h"
OS_TLSIndex PoolIndex = OS_INVALID_TLS_INDEX;
diff --git a/src/3rdparty/angle/src/compiler/PoolAlloc.h b/src/3rdparty/angle/src/compiler/translator/PoolAlloc.h
index edd249c4d3..edd249c4d3 100644
--- a/src/3rdparty/angle/src/compiler/PoolAlloc.h
+++ b/src/3rdparty/angle/src/compiler/translator/PoolAlloc.h
diff --git a/src/3rdparty/angle/src/compiler/Pragma.h b/src/3rdparty/angle/src/compiler/translator/Pragma.h
index 2f744123b8..2f744123b8 100644
--- a/src/3rdparty/angle/src/compiler/Pragma.h
+++ b/src/3rdparty/angle/src/compiler/translator/Pragma.h
diff --git a/src/3rdparty/angle/src/compiler/QualifierAlive.cpp b/src/3rdparty/angle/src/compiler/translator/QualifierAlive.cpp
index 92a6874eb7..1ba087e176 100644
--- a/src/3rdparty/angle/src/compiler/QualifierAlive.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/QualifierAlive.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
class TAliveTraverser : public TIntermTraverser {
public:
diff --git a/src/3rdparty/angle/src/compiler/QualifierAlive.h b/src/3rdparty/angle/src/compiler/translator/QualifierAlive.h
index 872a06f721..872a06f721 100644
--- a/src/3rdparty/angle/src/compiler/QualifierAlive.h
+++ b/src/3rdparty/angle/src/compiler/translator/QualifierAlive.h
diff --git a/src/3rdparty/angle/src/compiler/RemoveTree.cpp b/src/3rdparty/angle/src/compiler/translator/RemoveTree.cpp
index a4b8c1e63e..92e5dbbfe1 100644
--- a/src/3rdparty/angle/src/compiler/RemoveTree.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/RemoveTree.cpp
@@ -4,8 +4,8 @@
// found in the LICENSE file.
//
-#include "compiler/intermediate.h"
-#include "compiler/RemoveTree.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/RemoveTree.h"
//
// Code to recursively delete the intermediate tree.
diff --git a/src/3rdparty/angle/src/compiler/RemoveTree.h b/src/3rdparty/angle/src/compiler/translator/RemoveTree.h
index 97a821679c..97a821679c 100644
--- a/src/3rdparty/angle/src/compiler/RemoveTree.h
+++ b/src/3rdparty/angle/src/compiler/translator/RemoveTree.h
diff --git a/src/3rdparty/angle/src/compiler/RenameFunction.h b/src/3rdparty/angle/src/compiler/translator/RenameFunction.h
index 3908bfddb8..1f7fb16c45 100644
--- a/src/3rdparty/angle/src/compiler/RenameFunction.h
+++ b/src/3rdparty/angle/src/compiler/translator/RenameFunction.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_RENAME_FUNCTION
#define COMPILER_RENAME_FUNCTION
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
//
// Renames a function, including its declaration and any calls to it.
diff --git a/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp b/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp
new file mode 100644
index 0000000000..48e87cd57a
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp
@@ -0,0 +1,98 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteElseBlocks.cpp: Implementation for tree transform to change
+// all if-else blocks to if-if blocks.
+//
+
+#include "compiler/translator/RewriteElseBlocks.h"
+#include "compiler/translator/NodeSearch.h"
+#include "compiler/translator/SymbolTable.h"
+
+namespace sh
+{
+
+TIntermSymbol *MakeNewTemporary(const TString &name, TBasicType type)
+{
+ TType variableType(type, EbpHigh, EvqInternal);
+ return new TIntermSymbol(-1, name, variableType);
+}
+
+TIntermBinary *MakeNewBinary(TOperator op, TIntermTyped *left, TIntermTyped *right, const TType &resultType)
+{
+ TIntermBinary *binary = new TIntermBinary(op);
+ binary->setLeft(left);
+ binary->setRight(right);
+ binary->setType(resultType);
+ return binary;
+}
+
+TIntermUnary *MakeNewUnary(TOperator op, TIntermTyped *operand)
+{
+ TIntermUnary *unary = new TIntermUnary(op, operand->getType());
+ unary->setOperand(operand);
+ return unary;
+}
+
+bool ElseBlockRewriter::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ switch (node->getOp())
+ {
+ case EOpSequence:
+ {
+ for (size_t statementIndex = 0; statementIndex != node->getSequence().size(); statementIndex++)
+ {
+ TIntermNode *statement = node->getSequence()[statementIndex];
+ TIntermSelection *selection = statement->getAsSelectionNode();
+ if (selection && selection->getFalseBlock() != NULL)
+ {
+ node->getSequence()[statementIndex] = rewriteSelection(selection);
+ delete selection;
+ }
+ }
+ }
+ break;
+
+ default: break;
+ }
+
+ return true;
+}
+
+TIntermNode *ElseBlockRewriter::rewriteSelection(TIntermSelection *selection)
+{
+ ASSERT(selection->getFalseBlock() != NULL);
+
+ TString temporaryName = "cond_" + str(mTemporaryIndex++);
+ TIntermTyped *typedCondition = selection->getCondition()->getAsTyped();
+ TType resultType(EbtBool, EbpUndefined);
+ TIntermSymbol *conditionSymbolA = MakeNewTemporary(temporaryName, EbtBool);
+ TIntermSymbol *conditionSymbolB = MakeNewTemporary(temporaryName, EbtBool);
+ TIntermSymbol *conditionSymbolC = MakeNewTemporary(temporaryName, EbtBool);
+ TIntermBinary *storeCondition = MakeNewBinary(EOpInitialize, conditionSymbolA,
+ typedCondition, resultType);
+ TIntermUnary *negatedCondition = MakeNewUnary(EOpLogicalNot, conditionSymbolB);
+ TIntermSelection *falseBlock = new TIntermSelection(negatedCondition,
+ selection->getFalseBlock(), NULL);
+ TIntermSelection *newIfElse = new TIntermSelection(conditionSymbolC,
+ selection->getTrueBlock(), falseBlock);
+
+ TIntermAggregate *declaration = new TIntermAggregate(EOpDeclaration);
+ declaration->getSequence().push_back(storeCondition);
+
+ TIntermAggregate *block = new TIntermAggregate(EOpSequence);
+ block->getSequence().push_back(declaration);
+ block->getSequence().push_back(newIfElse);
+
+ return block;
+}
+
+void RewriteElseBlocks(TIntermNode *node)
+{
+ ElseBlockRewriter rewriter;
+ node->traverse(&rewriter);
+}
+
+}
diff --git a/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h b/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h
new file mode 100644
index 0000000000..10221335ce
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h
@@ -0,0 +1,39 @@
+//
+// Copyright (c) 2014 The ANGLE Project 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_REWRITE_ELSE_BLOCKS_H_
+#define COMPILER_REWRITE_ELSE_BLOCKS_H_
+
+#include "compiler/translator/intermediate.h"
+
+namespace sh
+{
+
+class ElseBlockRewriter : public TIntermTraverser
+{
+ public:
+ ElseBlockRewriter()
+ : TIntermTraverser(false, false, true, false)
+ , mTemporaryIndex(0)
+ {}
+
+ protected:
+ bool visitAggregate(Visit visit, TIntermAggregate *aggregate);
+
+ private:
+ int mTemporaryIndex;
+
+ TIntermNode *rewriteSelection(TIntermSelection *selection);
+};
+
+void RewriteElseBlocks(TIntermNode *node);
+
+}
+
+#endif // COMPILER_REWRITE_ELSE_BLOCKS_H_
diff --git a/src/3rdparty/angle/src/compiler/SearchSymbol.cpp b/src/3rdparty/angle/src/compiler/translator/SearchSymbol.cpp
index 9368f1a4fa..f78c84e370 100644
--- a/src/3rdparty/angle/src/compiler/SearchSymbol.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/SearchSymbol.cpp
@@ -6,10 +6,10 @@
// SearchSymbol is an AST traverser to detect the use of a given symbol name
//
-#include "compiler/SearchSymbol.h"
+#include "compiler/translator/SearchSymbol.h"
-#include "compiler/InfoSink.h"
-#include "compiler/OutputHLSL.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/OutputHLSL.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/SearchSymbol.h b/src/3rdparty/angle/src/compiler/translator/SearchSymbol.h
index 6bc0b90feb..8ddd3cb1ac 100644
--- a/src/3rdparty/angle/src/compiler/SearchSymbol.h
+++ b/src/3rdparty/angle/src/compiler/translator/SearchSymbol.h
@@ -9,8 +9,8 @@
#ifndef COMPILER_SEARCHSYMBOL_H_
#define COMPILER_SEARCHSYMBOL_H_
-#include "compiler/intermediate.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/ParseContext.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/ShHandle.h b/src/3rdparty/angle/src/compiler/translator/ShHandle.h
index 873580a99c..54ae27852d 100644
--- a/src/3rdparty/angle/src/compiler/ShHandle.h
+++ b/src/3rdparty/angle/src/compiler/translator/ShHandle.h
@@ -16,12 +16,12 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/BuiltInFunctionEmulator.h"
-#include "compiler/ExtensionBehavior.h"
-#include "compiler/HashNames.h"
-#include "compiler/InfoSink.h"
-#include "compiler/SymbolTable.h"
-#include "compiler/VariableInfo.h"
+#include "compiler/translator/BuiltInFunctionEmulator.h"
+#include "compiler/translator/ExtensionBehavior.h"
+#include "compiler/translator/HashNames.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/VariableInfo.h"
#include "third_party/compiler/ArrayBoundsClamper.h"
class LongNameMap;
@@ -100,6 +100,16 @@ protected:
// Returns true if, after applying the packing rules in the GLSL 1.017 spec
// Appendix A, section 7, the shader does not use too many uniforms.
bool enforcePackingRestrictions();
+ // Insert statements to initialize varyings without static use in the beginning
+ // of main(). It is to work around a Mac driver where such varyings in a vertex
+ // shader may be optimized out incorrectly at compile time, causing a link failure.
+ // This function should only be applied to vertex shaders.
+ void initializeVaryingsWithoutStaticUse(TIntermNode* root);
+ // Insert gl_Position = vec4(0,0,0,0) to the beginning of main().
+ // It is to work around a Linux driver bug where missing this causes compile failure
+ // while spec says it is allowed.
+ // This function should only be applied to vertex shaders.
+ void initializeGLPosition(TIntermNode* root);
// Returns true if the shader passes the restrictions that aim to prevent timing attacks.
bool enforceTimingRestrictions(TIntermNode* root, bool outputGraph);
// Returns true if the shader does not use samplers.
diff --git a/src/3rdparty/angle/src/compiler/ShaderLang.cpp b/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp
index 42cd5cc5c1..608237860c 100644
--- a/src/3rdparty/angle/src/compiler/ShaderLang.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp
@@ -11,11 +11,11 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/InitializeDll.h"
+#include "compiler/translator/InitializeDll.h"
#include "compiler/preprocessor/length_limits.h"
-#include "compiler/ShHandle.h"
-#include "compiler/TranslatorHLSL.h"
-#include "compiler/VariablePacker.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/TranslatorHLSL.h"
+#include "compiler/translator/VariablePacker.h"
//
// This is the platform independent interface between an OGL driver
@@ -91,6 +91,9 @@ void ShInitBuiltInResources(ShBuiltInResources* resources)
resources->HashFunction = NULL;
resources->ArrayIndexClampingStrategy = SH_CLAMP_WITH_CLAMP_INTRINSIC;
+
+ resources->MaxExpressionComplexity = 256;
+ resources->MaxCallStackDepth = 256;
}
//
diff --git a/src/3rdparty/angle/src/compiler/SymbolTable.cpp b/src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp
index a7ce21680f..d04fe5d355 100644
--- a/src/3rdparty/angle/src/compiler/SymbolTable.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp
@@ -13,7 +13,7 @@
#pragma warning(disable: 4718)
#endif
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/SymbolTable.h"
#include <stdio.h>
#include <algorithm>
diff --git a/src/3rdparty/angle/src/compiler/SymbolTable.h b/src/3rdparty/angle/src/compiler/translator/SymbolTable.h
index bebad4b92e..6c7211f2a9 100644
--- a/src/3rdparty/angle/src/compiler/SymbolTable.h
+++ b/src/3rdparty/angle/src/compiler/translator/SymbolTable.h
@@ -33,8 +33,8 @@
#include <assert.h>
#include "common/angleutils.h"
-#include "compiler/InfoSink.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/intermediate.h"
//
// Symbol base class. (Can build functions or variables out of these...)
diff --git a/src/3rdparty/angle/src/compiler/TranslatorESSL.cpp b/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.cpp
index 2900f8a8ed..9262f7af8c 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorESSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.cpp
@@ -4,9 +4,9 @@
// found in the LICENSE file.
//
-#include "compiler/TranslatorESSL.h"
+#include "compiler/translator/TranslatorESSL.h"
-#include "compiler/OutputESSL.h"
+#include "compiler/translator/OutputESSL.h"
TranslatorESSL::TranslatorESSL(ShShaderType type, ShShaderSpec spec)
: TCompiler(type, spec) {
diff --git a/src/3rdparty/angle/src/compiler/TranslatorESSL.h b/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.h
index a1196bd001..e18f3c25ec 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorESSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_TRANSLATORESSL_H_
#define COMPILER_TRANSLATORESSL_H_
-#include "compiler/ShHandle.h"
+#include "compiler/translator/ShHandle.h"
class TranslatorESSL : public TCompiler {
public:
diff --git a/src/3rdparty/angle/src/compiler/TranslatorGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.cpp
index 7ca4341dcd..6688d7f362 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorGLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.cpp
@@ -4,10 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/TranslatorGLSL.h"
+#include "compiler/translator/TranslatorGLSL.h"
-#include "compiler/OutputGLSL.h"
-#include "compiler/VersionGLSL.h"
+#include "compiler/translator/OutputGLSL.h"
+#include "compiler/translator/VersionGLSL.h"
static void writeVersion(ShShaderType type, TIntermNode* root,
TInfoSinkBase& sink) {
diff --git a/src/3rdparty/angle/src/compiler/TranslatorGLSL.h b/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.h
index c2ce06d192..40bb3145e8 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorGLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_TRANSLATORGLSL_H_
#define COMPILER_TRANSLATORGLSL_H_
-#include "compiler/ShHandle.h"
+#include "compiler/translator/ShHandle.h"
class TranslatorGLSL : public TCompiler {
public:
diff --git a/src/3rdparty/angle/src/compiler/TranslatorHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp
index 37408a07c4..3c1db011b6 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorHLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp
@@ -4,10 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/TranslatorHLSL.h"
+#include "compiler/translator/TranslatorHLSL.h"
-#include "compiler/InitializeParseContext.h"
-#include "compiler/OutputHLSL.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/OutputHLSL.h"
TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
: TCompiler(type, spec), mOutputType(output)
diff --git a/src/3rdparty/angle/src/compiler/TranslatorHLSL.h b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h
index 9550e15e8e..6204b30cc2 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorHLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h
@@ -7,8 +7,8 @@
#ifndef COMPILER_TRANSLATORHLSL_H_
#define COMPILER_TRANSLATORHLSL_H_
-#include "compiler/ShHandle.h"
-#include "compiler/Uniform.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/Uniform.h"
class TranslatorHLSL : public TCompiler {
public:
diff --git a/src/3rdparty/angle/src/compiler/Types.h b/src/3rdparty/angle/src/compiler/translator/Types.h
index 505fa8e3bf..119f4f29e5 100644
--- a/src/3rdparty/angle/src/compiler/Types.h
+++ b/src/3rdparty/angle/src/compiler/translator/Types.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// 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.
//
@@ -9,9 +9,9 @@
#include "common/angleutils.h"
-#include "compiler/BaseTypes.h"
-#include "compiler/Common.h"
-#include "compiler/debug.h"
+#include "compiler/translator/BaseTypes.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/compilerdebug.h"
struct TPublicType;
class TType;
@@ -95,7 +95,7 @@ class TType
public:
POOL_ALLOCATOR_NEW_DELETE();
TType() {}
- TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, int s = 1, bool m = false, bool a = false) :
+ TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, unsigned char s = 1, bool m = false, bool a = false) :
type(t), precision(p), qualifier(q), size(s), matrix(m), array(a), arraySize(0), structure(0)
{
}
@@ -116,7 +116,7 @@ public:
// One-dimensional size of single instance type
int getNominalSize() const { return size; }
- void setNominalSize(int s) { size = s; }
+ void setNominalSize(unsigned char s) { size = s; }
// Full size of single instance of type
size_t getObjectSize() const;
@@ -234,12 +234,12 @@ public:
private:
TString buildMangledName() const;
- TBasicType type : 6;
+ TBasicType type;
TPrecision precision;
- TQualifier qualifier : 7;
- int size : 8; // size of vector or matrix, not size of array
- unsigned int matrix : 1;
- unsigned int array : 1;
+ TQualifier qualifier;
+ unsigned char size;
+ bool matrix;
+ bool array;
int arraySize;
TStructure* structure; // 0 unless this is a struct
@@ -261,7 +261,7 @@ struct TPublicType
TBasicType type;
TQualifier qualifier;
TPrecision precision;
- int size; // size of vector or matrix, not size of array
+ unsigned char size; // size of vector or matrix, not size of array
bool matrix;
bool array;
int arraySize;
@@ -281,7 +281,7 @@ struct TPublicType
line = ln;
}
- void setAggregate(int s, bool m = false)
+ void setAggregate(unsigned char s, bool m = false)
{
size = s;
matrix = m;
diff --git a/src/3rdparty/angle/src/compiler/UnfoldShortCircuit.cpp b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.cpp
index 47f0afca6a..b7826119ae 100644
--- a/src/3rdparty/angle/src/compiler/UnfoldShortCircuit.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.cpp
@@ -8,10 +8,10 @@
// the original expression.
//
-#include "compiler/UnfoldShortCircuit.h"
+#include "compiler/translator/UnfoldShortCircuit.h"
-#include "compiler/InfoSink.h"
-#include "compiler/OutputHLSL.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/OutputHLSL.h"
namespace sh
{
@@ -31,6 +31,14 @@ bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node)
{
TInfoSinkBase &out = mOutputHLSL->getBodyStream();
+ // 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)
+ if (!node->getRight()->hasSideEffects())
+ {
+ return true;
+ }
+
switch (node->getOp())
{
case EOpLogicalOr:
@@ -49,7 +57,7 @@ bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node)
mTemporaryIndex = i + 1;
node->getLeft()->traverse(mOutputHLSL);
out << ";\n";
- out << "if(!s" << i << ")\n"
+ out << "if (!s" << i << ")\n"
"{\n";
mTemporaryIndex = i + 1;
node->getRight()->traverse(this);
@@ -80,7 +88,7 @@ bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node)
mTemporaryIndex = i + 1;
node->getLeft()->traverse(mOutputHLSL);
out << ";\n";
- out << "if(s" << i << ")\n"
+ out << "if (s" << i << ")\n"
"{\n";
mTemporaryIndex = i + 1;
node->getRight()->traverse(this);
@@ -115,7 +123,7 @@ bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
mTemporaryIndex = i + 1;
node->getCondition()->traverse(this);
- out << "if(";
+ out << "if (";
mTemporaryIndex = i + 1;
node->getCondition()->traverse(mOutputHLSL);
out << ")\n"
diff --git a/src/3rdparty/angle/src/compiler/UnfoldShortCircuit.h b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.h
index cb176a5f1c..1e416bc04c 100644
--- a/src/3rdparty/angle/src/compiler/UnfoldShortCircuit.h
+++ b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.h
@@ -9,8 +9,8 @@
#ifndef COMPILER_UNFOLDSHORTCIRCUIT_H_
#define COMPILER_UNFOLDSHORTCIRCUIT_H_
-#include "compiler/intermediate.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/ParseContext.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp
new file mode 100644
index 0000000000..29c4397d56
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp
@@ -0,0 +1,81 @@
+//
+// 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
+{
+
+// "x || y" is equivalent to "x ? true : y".
+TIntermSelection *UnfoldOR(TIntermTyped *x, TIntermTyped *y)
+{
+ const TType boolType(EbtBool, EbpUndefined);
+ ConstantUnion *u = new ConstantUnion;
+ u->setBConst(true);
+ TIntermConstantUnion *trueNode = new TIntermConstantUnion(
+ u, TType(EbtBool, EbpUndefined, EvqConst, 1));
+ return new TIntermSelection(x, trueNode, y, boolType);
+}
+
+// "x && y" is equivalent to "x ? y : false".
+TIntermSelection *UnfoldAND(TIntermTyped *x, TIntermTyped *y)
+{
+ const TType boolType(EbtBool, EbpUndefined);
+ ConstantUnion *u = new ConstantUnion;
+ u->setBConst(false);
+ TIntermConstantUnion *falseNode = new TIntermConstantUnion(
+ u, TType(EbtBool, EbpUndefined, EvqConst, 1));
+ return new TIntermSelection(x, y, falseNode, boolType);
+}
+
+} // namespace anonymous
+
+bool UnfoldShortCircuitAST::visitBinary(Visit visit, TIntermBinary *node)
+{
+ TIntermSelection *replacement = NULL;
+
+ 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)
+ {
+ replacements.push_back(
+ NodeUpdateEntry(getParentNode(), node, replacement));
+ }
+ return true;
+}
+
+void UnfoldShortCircuitAST::updateTree()
+{
+ for (size_t ii = 0; ii < replacements.size(); ++ii)
+ {
+ const NodeUpdateEntry& entry = replacements[ii];
+ ASSERT(entry.parent);
+ bool replaced = entry.parent->replaceChildNode(
+ entry.original, entry.replacement);
+ ASSERT(replaced);
+
+ // In AST traversing, a parent is visited before its children.
+ // After we replace a node, if an immediate child is to
+ // be replaced, we need to make sure we don't update the replaced
+ // node; instead, we update the replacement node.
+ for (size_t jj = ii + 1; jj < replacements.size(); ++jj)
+ {
+ NodeUpdateEntry& entry2 = replacements[jj];
+ if (entry2.parent == entry.original)
+ entry2.parent = entry.replacement;
+ }
+ }
+}
+
diff --git a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h
new file mode 100644
index 0000000000..24c14a60e3
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h
@@ -0,0 +1,51 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// UnfoldShortCircuitAST is an AST traverser to replace short-circuiting
+// operations with ternary operations.
+//
+
+#ifndef COMPILER_UNFOLD_SHORT_CIRCUIT_AST_H_
+#define COMPILER_UNFOLD_SHORT_CIRCUIT_AST_H_
+
+#include "common/angleutils.h"
+#include "compiler/translator/intermediate.h"
+
+// 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() { }
+
+ virtual bool visitBinary(Visit visit, TIntermBinary *);
+
+ void updateTree();
+
+ private:
+ struct NodeUpdateEntry
+ {
+ NodeUpdateEntry(TIntermNode *_parent,
+ TIntermNode *_original,
+ TIntermNode *_replacement)
+ : parent(_parent),
+ original(_original),
+ replacement(_replacement) {}
+
+ TIntermNode *parent;
+ TIntermNode *original;
+ TIntermNode *replacement;
+ };
+
+ // During traversing, save all the replacements that need to happen;
+ // then replace them by calling updateNodes().
+ std::vector<NodeUpdateEntry> replacements;
+
+ DISALLOW_COPY_AND_ASSIGN(UnfoldShortCircuitAST);
+};
+
+#endif // COMPILER_UNFOLD_SHORT_CIRCUIT_AST_H_
diff --git a/src/3rdparty/angle/src/compiler/Uniform.cpp b/src/3rdparty/angle/src/compiler/translator/Uniform.cpp
index f367db2be8..922e13f071 100644
--- a/src/3rdparty/angle/src/compiler/Uniform.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Uniform.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/Uniform.h"
+#include "compiler/translator/Uniform.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/Uniform.h b/src/3rdparty/angle/src/compiler/translator/Uniform.h
index 4c53ffa7d2..4c53ffa7d2 100644
--- a/src/3rdparty/angle/src/compiler/Uniform.h
+++ b/src/3rdparty/angle/src/compiler/translator/Uniform.h
diff --git a/src/3rdparty/angle/src/compiler/ValidateLimitations.cpp b/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.cpp
index 736ceeaefc..3c2cc41cda 100644
--- a/src/3rdparty/angle/src/compiler/ValidateLimitations.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.cpp
@@ -4,10 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/ValidateLimitations.h"
-#include "compiler/InfoSink.h"
-#include "compiler/InitializeParseContext.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/ValidateLimitations.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/ParseContext.h"
namespace {
bool IsLoopIndex(const TIntermSymbol* symbol, const TLoopStack& stack) {
@@ -457,7 +457,7 @@ bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
bool ValidateLimitations::validateOperation(TIntermOperator* node,
TIntermNode* operand) {
// Check if loop index is modified in the loop body.
- if (!withinLoopBody() || !node->modifiesState())
+ if (!withinLoopBody() || !node->isAssignment())
return true;
const TIntermSymbol* symbol = operand->getAsSymbolNode();
diff --git a/src/3rdparty/angle/src/compiler/ValidateLimitations.h b/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h
index a835cb3c22..8839dd8b8a 100644
--- a/src/3rdparty/angle/src/compiler/ValidateLimitations.h
+++ b/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h
@@ -5,7 +5,7 @@
//
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
class TInfoSinkBase;
diff --git a/src/3rdparty/angle/src/compiler/VariableInfo.cpp b/src/3rdparty/angle/src/compiler/translator/VariableInfo.cpp
index f3f7b1ef35..ef888aff11 100644
--- a/src/3rdparty/angle/src/compiler/VariableInfo.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/VariableInfo.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/VariableInfo.h"
+#include "compiler/translator/VariableInfo.h"
namespace {
@@ -116,10 +116,12 @@ void getBuiltInVariableInfo(const TType& type,
varInfo.name = (name + "[0]").c_str();
varInfo.mappedName = (mappedName + "[0]").c_str();
varInfo.size = type.getArraySize();
+ varInfo.isArray = true;
} else {
varInfo.name = name.c_str();
varInfo.mappedName = mappedName.c_str();
varInfo.size = 1;
+ varInfo.isArray = false;
}
varInfo.precision = type.getPrecision();
varInfo.type = getVariableDataType(type);
@@ -167,6 +169,7 @@ TVariableInfo* findVariable(const TType& type,
TVariableInfo::TVariableInfo()
: type(SH_NONE),
size(0),
+ isArray(false),
precision(EbpUndefined),
staticUse(false)
{
@@ -175,6 +178,7 @@ TVariableInfo::TVariableInfo()
TVariableInfo::TVariableInfo(ShDataType type, int size)
: type(type),
size(size),
+ isArray(false),
precision(EbpUndefined),
staticUse(false)
{
diff --git a/src/3rdparty/angle/src/compiler/VariableInfo.h b/src/3rdparty/angle/src/compiler/translator/VariableInfo.h
index 3c7f2a5f84..37216cd142 100644
--- a/src/3rdparty/angle/src/compiler/VariableInfo.h
+++ b/src/3rdparty/angle/src/compiler/translator/VariableInfo.h
@@ -8,7 +8,7 @@
#define COMPILER_VARIABLE_INFO_H_
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
// Provides information about a variable.
// It is currently being used to store info about active attribs and uniforms.
@@ -20,6 +20,7 @@ struct TVariableInfo {
TPersistString mappedName;
ShDataType type;
int size;
+ bool isArray;
TPrecision precision;
bool staticUse;
};
diff --git a/src/3rdparty/angle/src/compiler/VariablePacker.cpp b/src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp
index 8957287763..5634d86337 100644
--- a/src/3rdparty/angle/src/compiler/VariablePacker.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp
@@ -3,10 +3,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/VariablePacker.h"
+#include "compiler/translator/VariablePacker.h"
#include <algorithm>
-#include "compiler/ShHandle.h"
+#include "compiler/translator/ShHandle.h"
namespace {
int GetSortOrder(ShDataType type)
diff --git a/src/3rdparty/angle/src/compiler/VariablePacker.h b/src/3rdparty/angle/src/compiler/translator/VariablePacker.h
index 8987066cc3..fd6090827c 100644
--- a/src/3rdparty/angle/src/compiler/VariablePacker.h
+++ b/src/3rdparty/angle/src/compiler/translator/VariablePacker.h
@@ -8,7 +8,7 @@
#define _VARIABLEPACKER_INCLUDED_
#include <vector>
-#include "compiler/ShHandle.h"
+#include "compiler/translator/ShHandle.h"
class VariablePacker {
public:
diff --git a/src/3rdparty/angle/src/compiler/VersionGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp
index 7a82bb4dc1..dd11f99eb8 100644
--- a/src/3rdparty/angle/src/compiler/VersionGLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/VersionGLSL.h"
+#include "compiler/translator/VersionGLSL.h"
static const int GLSL_VERSION_110 = 110;
static const int GLSL_VERSION_120 = 120;
diff --git a/src/3rdparty/angle/src/compiler/VersionGLSL.h b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.h
index 1c1cb1ab97..d310066171 100644
--- a/src/3rdparty/angle/src/compiler/VersionGLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.h
@@ -8,7 +8,7 @@
#define COMPILER_VERSIONGLSL_H_
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
// Traverses the intermediate tree to return the minimum GLSL version
// required to legally access all built-in features used in the shader.
diff --git a/src/3rdparty/angle/src/compiler/debug.cpp b/src/3rdparty/angle/src/compiler/translator/compilerdebug.cpp
index 53778bd3eb..10cbe43b8d 100644
--- a/src/3rdparty/angle/src/compiler/debug.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/compilerdebug.cpp
@@ -6,17 +6,17 @@
// debug.cpp: Debugging utilities.
-#include "compiler/debug.h"
+#include "compiler/translator/compilerdebug.h"
#include <stdarg.h>
#include <stdio.h>
-#include "compiler/InitializeParseContext.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/ParseContext.h"
+#ifdef TRACE_ENABLED
static const int kTraceBufferLen = 1024;
-#ifdef TRACE_ENABLED
extern "C" {
void Trace(const char *format, ...) {
if (!format) return;
diff --git a/src/3rdparty/angle/src/compiler/debug.h b/src/3rdparty/angle/src/compiler/translator/compilerdebug.h
index 7a371516af..7a371516af 100644
--- a/src/3rdparty/angle/src/compiler/debug.h
+++ b/src/3rdparty/angle/src/compiler/translator/compilerdebug.h
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraph.cpp b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.cpp
index ca661d6767..19ddf5c439 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraph.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.cpp
@@ -6,8 +6,8 @@
#pragma warning(disable: 4718)
-#include "compiler/depgraph/DependencyGraph.h"
-#include "compiler/depgraph/DependencyGraphBuilder.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
+#include "compiler/translator/depgraph/DependencyGraphBuilder.h"
TDependencyGraph::TDependencyGraph(TIntermNode* intermNode)
{
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraph.h b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.h
index 5a9c35d00b..5ea1cbb837 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraph.h
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_H
#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_H
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
#include <set>
#include <stack>
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphBuilder.cpp b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp
index d586cfd03c..d5f2cba5fc 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphBuilder.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/depgraph/DependencyGraphBuilder.h"
+#include "compiler/translator/depgraph/DependencyGraphBuilder.h"
void TDependencyGraphBuilder::build(TIntermNode* node, TDependencyGraph* graph)
{
@@ -94,7 +94,7 @@ void TDependencyGraphBuilder::visitSymbol(TIntermSymbol* intermSymbol)
bool TDependencyGraphBuilder::visitBinary(Visit visit, TIntermBinary* intermBinary)
{
TOperator op = intermBinary->getOp();
- if (op == EOpInitialize || intermBinary->modifiesState())
+ if (op == EOpInitialize || intermBinary->isAssignment())
visitAssignment(intermBinary);
else if (op == EOpLogicalAnd || op == EOpLogicalOr)
visitLogicalOp(intermBinary);
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphBuilder.h b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.h
index c5f232cb21..3e928fb77e 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphBuilder.h
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_BUILDER_H
#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_BUILDER_H
-#include "compiler/depgraph/DependencyGraph.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
//
// Creates a dependency graph of symbols, function calls, conditions etc. by traversing a
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphOutput.cpp b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphOutput.cpp
index 6fc489e7b6..e226333545 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphOutput.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphOutput.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/depgraph/DependencyGraphOutput.h"
+#include "compiler/translator/depgraph/DependencyGraphOutput.h"
void TDependencyGraphOutput::outputIndentation()
{
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphOutput.h b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphOutput.h
index 01447da987..c3a4112278 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphOutput.h
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphOutput.h
@@ -7,8 +7,8 @@
#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_OUTPUT_H
#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_OUTPUT_H
-#include "compiler/depgraph/DependencyGraph.h"
-#include "compiler/InfoSink.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
+#include "compiler/translator/InfoSink.h"
class TDependencyGraphOutput : public TDependencyGraphTraverser {
public:
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphTraverse.cpp b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphTraverse.cpp
index b158575cec..197fde97e2 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphTraverse.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphTraverse.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/depgraph/DependencyGraph.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
// These methods do a breadth-first traversal through the graph and mark visited nodes.
diff --git a/src/3rdparty/angle/src/compiler/glslang.h b/src/3rdparty/angle/src/compiler/translator/glslang.h
index f221199093..f221199093 100644
--- a/src/3rdparty/angle/src/compiler/glslang.h
+++ b/src/3rdparty/angle/src/compiler/translator/glslang.h
diff --git a/src/3rdparty/angle/src/compiler/glslang.l b/src/3rdparty/angle/src/compiler/translator/glslang.l
index 60663f9a6b..ffc1aa18ac 100644
--- a/src/3rdparty/angle/src/compiler/glslang.l
+++ b/src/3rdparty/angle/src/compiler/translator/glslang.l
@@ -36,10 +36,10 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
}
%{
-#include "compiler/glslang.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/glslang.h"
+#include "compiler/translator/ParseContext.h"
#include "compiler/preprocessor/Token.h"
-#include "compiler/util.h"
+#include "compiler/translator/util.h"
#include "glslang_tab.h"
/* windows only pragma */
diff --git a/src/3rdparty/angle/src/compiler/glslang.y b/src/3rdparty/angle/src/compiler/translator/glslang.y
index c64f736f41..7614ff3447 100644
--- a/src/3rdparty/angle/src/compiler/glslang.y
+++ b/src/3rdparty/angle/src/compiler/translator/glslang.y
@@ -34,8 +34,8 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
#pragma warning(disable: 4701)
#endif
-#include "compiler/SymbolTable.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/ParseContext.h"
#include "GLSLANG/ShaderLang.h"
#define YYENABLE_NLS 0
@@ -183,43 +183,55 @@ identifier
variable_identifier
: IDENTIFIER {
// The symbol table search was done in the lexical phase
- const TSymbol* symbol = $1.symbol;
- const TVariable* variable;
- if (symbol == 0) {
+ const TSymbol *symbol = $1.symbol;
+ const TVariable *variable = 0;
+
+ if (!symbol)
+ {
context->error(@1, "undeclared identifier", $1.string->c_str());
context->recover();
- TType type(EbtFloat, EbpUndefined);
- TVariable* fakeVariable = new TVariable($1.string, type);
- context->symbolTable.insert(*fakeVariable);
- variable = fakeVariable;
- } else {
- // This identifier can only be a variable type symbol
- if (! symbol->isVariable()) {
- context->error(@1, "variable expected", $1.string->c_str());
- context->recover();
- }
-
+ }
+ else if (!symbol->isVariable())
+ {
+ context->error(@1, "variable expected", $1.string->c_str());
+ context->recover();
+ }
+ else
+ {
variable = static_cast<const TVariable*>(symbol);
if (context->symbolTable.findBuiltIn(variable->getName()) &&
!variable->getExtension().empty() &&
- context->extensionErrorCheck(@1, variable->getExtension())) {
+ context->extensionErrorCheck(@1, variable->getExtension()))
+ {
context->recover();
}
}
- // don't delete $1.string, it's used by error recovery, and the pool
- // pop will reclaim the memory
+ if (!variable)
+ {
+ TType type(EbtFloat, EbpUndefined);
+ TVariable *fakeVariable = new TVariable($1.string, type);
+ context->symbolTable.insert(*fakeVariable);
+ variable = fakeVariable;
+ }
- if (variable->getType().getQualifier() == EvqConst ) {
+ if (variable->getType().getQualifier() == EvqConst)
+ {
ConstantUnion* constArray = variable->getConstPointer();
TType t(variable->getType());
$$ = context->intermediate.addConstantUnion(constArray, t, @1);
- } else
+ }
+ else
+ {
$$ = context->intermediate.addSymbol(variable->getUniqueId(),
variable->getName(),
variable->getType(),
@1);
+ }
+
+ // don't delete $1.string, it's used by error recovery, and the pool
+ // pop will reclaim the memory
}
;
diff --git a/src/3rdparty/angle/src/compiler/intermOut.cpp b/src/3rdparty/angle/src/compiler/translator/intermOut.cpp
index 13aa96af6d..f2f918d77a 100644
--- a/src/3rdparty/angle/src/compiler/intermOut.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/intermOut.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/localintermediate.h"
+#include "compiler/translator/localintermediate.h"
//
// Two purposes:
@@ -44,9 +44,9 @@ TString TType::getCompleteString() const
if (array)
stream << "array[" << getArraySize() << "] of ";
if (matrix)
- stream << size << "X" << size << " matrix of ";
+ stream << static_cast<int>(size) << "X" << static_cast<int>(size) << " matrix of ";
else if (size > 1)
- stream << size << "-component vector of ";
+ stream << static_cast<int>(size) << "-component vector of ";
stream << getBasicString();
return stream.str();
diff --git a/src/3rdparty/angle/src/compiler/intermediate.h b/src/3rdparty/angle/src/compiler/translator/intermediate.h
index 738621fe70..8f9fe23d3b 100644
--- a/src/3rdparty/angle/src/compiler/intermediate.h
+++ b/src/3rdparty/angle/src/compiler/translator/intermediate.h
@@ -19,9 +19,9 @@
#include "GLSLANG/ShaderLang.h"
#include <algorithm>
-#include "compiler/Common.h"
-#include "compiler/Types.h"
-#include "compiler/ConstantUnion.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/Types.h"
+#include "compiler/translator/ConstantUnion.h"
//
// Operators used by the high-level (parse tree) representation.
@@ -227,6 +227,11 @@ public:
virtual TIntermSymbol* getAsSymbolNode() { return 0; }
virtual TIntermLoop* getAsLoopNode() { return 0; }
+ // Replace a child node. Return true if |original| is a child
+ // node and it is replaced; otherwise, return false.
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement) = 0;
+
protected:
TSourceLoc line;
};
@@ -247,6 +252,8 @@ public:
TIntermTyped(const TType& t) : type(t) { }
virtual TIntermTyped* getAsTyped() { return this; }
+ virtual bool hasSideEffects() const = 0;
+
void setType(const TType& t) { type = t; }
const TType& getType() const { return type; }
TType* getTypePointer() { return &type; }
@@ -295,6 +302,8 @@ public:
virtual TIntermLoop* getAsLoopNode() { return this; }
virtual void traverse(TIntermTraverser*);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
TLoopType getType() const { return type; }
TIntermNode* getInit() { return init; }
@@ -325,6 +334,8 @@ public:
expression(e) { }
virtual void traverse(TIntermTraverser*);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
TOperator getFlowOp() { return flowOp; }
TIntermTyped* getExpression() { return expression; }
@@ -345,6 +356,8 @@ public:
TIntermSymbol(int i, const TString& sym, const TType& t) :
TIntermTyped(t), id(i) { symbol = sym; originalSymbol = sym; }
+ virtual bool hasSideEffects() const { return false; }
+
int getId() const { return id; }
const TString& getSymbol() const { return symbol; }
@@ -355,6 +368,7 @@ public:
virtual void traverse(TIntermTraverser*);
virtual TIntermSymbol* getAsSymbolNode() { return this; }
+ virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
protected:
int id;
@@ -366,14 +380,17 @@ class TIntermConstantUnion : public TIntermTyped {
public:
TIntermConstantUnion(ConstantUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
+ virtual bool hasSideEffects() const { return false; }
+
ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
- int getIConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; }
- float getFConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; }
- bool getBConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; }
+ int getIConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; }
+ float getFConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; }
+ bool getBConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; }
virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
virtual void traverse(TIntermTraverser*);
+ virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
TIntermTyped* fold(TOperator, TIntermTyped*, TInfoSink&);
@@ -389,12 +406,14 @@ public:
TOperator getOp() const { return op; }
void setOp(TOperator o) { op = o; }
- bool modifiesState() const;
+ bool isAssignment() const;
bool isConstructor() const;
+ virtual bool hasSideEffects() const { return isAssignment(); }
+
protected:
TIntermOperator(TOperator o) : TIntermTyped(TType(EbtFloat, EbpUndefined)), op(o) {}
- TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {}
+ TIntermOperator(TOperator o, const TType& t) : TIntermTyped(t), op(o) {}
TOperator op;
};
@@ -407,6 +426,10 @@ public:
virtual TIntermBinary* getAsBinaryNode() { return this; }
virtual void traverse(TIntermTraverser*);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ virtual bool hasSideEffects() const { return (isAssignment() || left->hasSideEffects() || right->hasSideEffects()); }
void setLeft(TIntermTyped* n) { left = n; }
void setRight(TIntermTyped* n) { right = n; }
@@ -430,11 +453,15 @@ protected:
//
class TIntermUnary : public TIntermOperator {
public:
- TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0), useEmulatedFunction(false) {}
+ TIntermUnary(TOperator o, const TType& t) : TIntermOperator(o, t), operand(0), useEmulatedFunction(false) {}
TIntermUnary(TOperator o) : TIntermOperator(o), operand(0), useEmulatedFunction(false) {}
virtual void traverse(TIntermTraverser*);
virtual TIntermUnary* getAsUnaryNode() { return this; }
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ virtual bool hasSideEffects() const { return (isAssignment() || operand->hasSideEffects()); }
void setOperand(TIntermTyped* o) { operand = o; }
TIntermTyped* getOperand() { return operand; }
@@ -465,6 +492,11 @@ public:
virtual TIntermAggregate* getAsAggregate() { return this; }
virtual void traverse(TIntermTraverser*);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ // Conservatively assume function calls and other aggregate operators have side-effects
+ virtual bool hasSideEffects() const { return true; }
TIntermSequence& getSequence() { return sequence; }
@@ -508,6 +540,11 @@ public:
TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
virtual void traverse(TIntermTraverser*);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ // Conservatively assume selections have side-effects
+ virtual bool hasSideEffects() const { return true; }
bool usesTernaryOperator() const { return getBasicType() != EbtVoid; }
TIntermNode* getCondition() const { return condition; }
@@ -547,7 +584,7 @@ public:
rightToLeft(rightToLeft),
depth(0),
maxDepth(0) {}
- virtual ~TIntermTraverser() {};
+ virtual ~TIntermTraverser() {}
virtual void visitSymbol(TIntermSymbol*) {}
virtual void visitConstantUnion(TIntermConstantUnion*) {}
@@ -559,8 +596,24 @@ public:
virtual bool visitBranch(Visit visit, TIntermBranch*) {return true;}
int getMaxDepth() const {return maxDepth;}
- void incrementDepth() {depth++; maxDepth = std::max(maxDepth, depth); }
- void decrementDepth() {depth--;}
+
+ void incrementDepth(TIntermNode *current)
+ {
+ depth++;
+ maxDepth = std::max(maxDepth, depth);
+ path.push_back(current);
+ }
+
+ void decrementDepth()
+ {
+ depth--;
+ path.pop_back();
+ }
+
+ TIntermNode *getParentNode()
+ {
+ return path.size() == 0 ? NULL : path.back();
+ }
// Return the original name if hash function pointer is NULL;
// otherwise return the hashed name.
@@ -574,6 +627,9 @@ public:
protected:
int depth;
int maxDepth;
+
+ // All the nodes from root to the current node's parent during traversing.
+ TVector<TIntermNode *> path;
};
#endif // __INTERMEDIATE_H
diff --git a/src/3rdparty/angle/src/compiler/localintermediate.h b/src/3rdparty/angle/src/compiler/translator/localintermediate.h
index 1214d821eb..b582e02f5d 100644
--- a/src/3rdparty/angle/src/compiler/localintermediate.h
+++ b/src/3rdparty/angle/src/compiler/translator/localintermediate.h
@@ -8,8 +8,8 @@
#define _LOCAL_INTERMEDIATE_INCLUDED_
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/SymbolTable.h"
struct TVectorFields {
int offsets[4];
@@ -39,7 +39,7 @@ public:
TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, const TSourceLoc&);
TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ;
- bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false);
+ bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false);
TIntermNode* addLoop(TLoopType, TIntermNode*, TIntermTyped*, TIntermTyped*, TIntermNode*, const TSourceLoc&);
TIntermBranch* addBranch(TOperator, const TSourceLoc&);
TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&);
diff --git a/src/3rdparty/angle/src/compiler/osinclude.h b/src/3rdparty/angle/src/compiler/translator/osinclude.h
index 60177d5fe5..cccfa6355c 100644
--- a/src/3rdparty/angle/src/compiler/osinclude.h
+++ b/src/3rdparty/angle/src/compiler/translator/osinclude.h
@@ -13,9 +13,6 @@
//
#if defined(_WIN32) || defined(_WIN64)
-#define STRICT
-#define VC_EXTRALEAN 1
-#include <windows.h>
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
#define ANGLE_OS_WINRT
#else
@@ -23,18 +20,27 @@
#endif
#elif defined(__APPLE__) || defined(__linux__) || \
defined(__FreeBSD__) || defined(__OpenBSD__) || \
+ defined(__NetBSD__) || defined(__DragonFly__) || \
defined(__sun) || defined(ANDROID) || \
defined(__GLIBC__) || defined(__GNU__) || \
defined(__QNX__)
#define ANGLE_OS_POSIX
-#include <pthread.h>
-#include <semaphore.h>
-#include <errno.h>
#else
#error Unsupported platform.
#endif
-#include "compiler/debug.h"
+#if defined(ANGLE_OS_WIN) || defined(ANGLE_OS_WINRT)
+#define STRICT
+#define VC_EXTRALEAN 1
+#include <windows.h>
+#elif defined(ANGLE_OS_POSIX)
+#include <pthread.h>
+#include <semaphore.h>
+#include <errno.h>
+#endif // ANGLE_OS_WIN
+
+
+#include "compiler/translator/compilerdebug.h"
//
// Thread Local Storage Operations
diff --git a/src/3rdparty/angle/src/compiler/ossource_posix.cpp b/src/3rdparty/angle/src/compiler/translator/ossource_posix.cpp
index 35510c1af5..d4bba4c70e 100644
--- a/src/3rdparty/angle/src/compiler/ossource_posix.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ossource_posix.cpp
@@ -7,7 +7,7 @@
//
// This file contains the posix specific functions
//
-#include "compiler/osinclude.h"
+#include "compiler/translator/osinclude.h"
#if !defined(ANGLE_OS_POSIX)
#error Trying to build a posix specific file in a non-posix build.
diff --git a/src/3rdparty/angle/src/compiler/ossource_win.cpp b/src/3rdparty/angle/src/compiler/translator/ossource_win.cpp
index 708a1ad311..abd8bc7833 100644
--- a/src/3rdparty/angle/src/compiler/ossource_win.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ossource_win.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/osinclude.h"
+#include "compiler/translator/osinclude.h"
//
// This file contains contains the window's specific functions
//
diff --git a/src/3rdparty/angle/src/compiler/ossource_winrt.cpp b/src/3rdparty/angle/src/compiler/translator/ossource_winrt.cpp
index 84443abc02..bb061ca85d 100644
--- a/src/3rdparty/angle/src/compiler/ossource_winrt.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ossource_winrt.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/osinclude.h"
+#include "compiler/translator/osinclude.h"
//
// This file contains contains Windows Runtime specific functions
//
diff --git a/src/3rdparty/angle/src/compiler/parseConst.cpp b/src/3rdparty/angle/src/compiler/translator/parseConst.cpp
index 1cc5db8d77..a59f0be9d8 100644
--- a/src/3rdparty/angle/src/compiler/parseConst.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/parseConst.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/ParseContext.h"
//
// Use this class to carry along data from node to node in
diff --git a/src/3rdparty/angle/src/compiler/timing/RestrictFragmentShaderTiming.cpp b/src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp
index 538b731b8e..a9f3f49ef3 100644
--- a/src/3rdparty/angle/src/compiler/timing/RestrictFragmentShaderTiming.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp
@@ -4,10 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/InfoSink.h"
-#include "compiler/ParseHelper.h"
-#include "compiler/depgraph/DependencyGraphOutput.h"
-#include "compiler/timing/RestrictFragmentShaderTiming.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/depgraph/DependencyGraphOutput.h"
+#include "compiler/translator/timing/RestrictFragmentShaderTiming.h"
RestrictFragmentShaderTiming::RestrictFragmentShaderTiming(TInfoSinkBase& sink)
: mSink(sink)
diff --git a/src/3rdparty/angle/src/compiler/timing/RestrictFragmentShaderTiming.h b/src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h
index 899165ca28..323cb62d8a 100644
--- a/src/3rdparty/angle/src/compiler/timing/RestrictFragmentShaderTiming.h
+++ b/src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h
@@ -9,8 +9,8 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
-#include "compiler/depgraph/DependencyGraph.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
class TInfoSinkBase;
diff --git a/src/3rdparty/angle/src/compiler/timing/RestrictVertexShaderTiming.cpp b/src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp
index 355eb62d65..ee78c35450 100644
--- a/src/3rdparty/angle/src/compiler/timing/RestrictVertexShaderTiming.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/timing/RestrictVertexShaderTiming.h"
+#include "compiler/translator/timing/RestrictVertexShaderTiming.h"
void RestrictVertexShaderTiming::visitSymbol(TIntermSymbol* node)
{
diff --git a/src/3rdparty/angle/src/compiler/timing/RestrictVertexShaderTiming.h b/src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h
index 19a05fa68b..5f0dd3197a 100644
--- a/src/3rdparty/angle/src/compiler/timing/RestrictVertexShaderTiming.h
+++ b/src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h
@@ -9,8 +9,8 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
-#include "compiler/InfoSink.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/InfoSink.h"
class TInfoSinkBase;
diff --git a/src/3rdparty/angle/src/compiler/util.cpp b/src/3rdparty/angle/src/compiler/translator/util.cpp
index d6e5eeed91..077bdcc48b 100644
--- a/src/3rdparty/angle/src/compiler/util.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/util.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/util.h"
+#include "compiler/translator/util.h"
#include <limits>
diff --git a/src/3rdparty/angle/src/compiler/util.h b/src/3rdparty/angle/src/compiler/translator/util.h
index dc69f39060..dc69f39060 100644
--- a/src/3rdparty/angle/src/compiler/util.h
+++ b/src/3rdparty/angle/src/compiler/translator/util.h
diff --git a/src/3rdparty/angle/src/libEGL/Display.cpp b/src/3rdparty/angle/src/libEGL/Display.cpp
index b18a876a55..e75a4b6440 100644
--- a/src/3rdparty/angle/src/libEGL/Display.cpp
+++ b/src/3rdparty/angle/src/libEGL/Display.cpp
@@ -1,3 +1,4 @@
+#include "../libGLESv2/precompiled.h"
//
// 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
@@ -40,13 +41,13 @@ egl::Display *Display::getDisplay(EGLNativeDisplayType displayId)
// FIXME: Check if displayId is a valid display device context
- egl::Display *display = new egl::Display(displayId, (HDC)displayId);
+ egl::Display *display = new egl::Display(displayId);
displays[displayId] = display;
return display;
}
-Display::Display(EGLNativeDisplayType displayId, HDC deviceContext) : mDc(deviceContext)
+Display::Display(EGLNativeDisplayType displayId)
{
mDisplayId = displayId;
mRenderer = NULL;
@@ -71,7 +72,7 @@ bool Display::initialize()
return true;
}
- mRenderer = glCreateRenderer(this, mDc, mDisplayId);
+ mRenderer = glCreateRenderer(this, mDisplayId);
if (!mRenderer)
{
@@ -486,7 +487,7 @@ void Display::initExtensionString()
mExtensionString += "EGL_ANGLE_query_surface_pointer ";
-#if !defined(ANGLE_OS_WINRT)
+#if defined(ANGLE_ENABLE_D3D9)
HMODULE swiftShader = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
if (swiftShader)
{
@@ -525,7 +526,7 @@ void Display::initVendorString()
if (mRenderer && mRenderer->getLUID(&adapterLuid))
{
char adapterLuidString[64];
- snprintf(adapterLuidString, sizeof(adapterLuidString), " (adapter LUID: %08l%08l)", adapterLuid.HighPart, adapterLuid.LowPart);
+ snprintf(adapterLuidString, sizeof(adapterLuidString), " (adapter LUID: %08x%08x)", adapterLuid.HighPart, adapterLuid.LowPart);
mVendorString += adapterLuidString;
}
diff --git a/src/3rdparty/angle/src/libEGL/Display.h b/src/3rdparty/angle/src/libEGL/Display.h
index 5d55410440..cd07bb3388 100644
--- a/src/3rdparty/angle/src/libEGL/Display.h
+++ b/src/3rdparty/angle/src/libEGL/Display.h
@@ -11,8 +11,6 @@
#ifndef LIBEGL_DISPLAY_H_
#define LIBEGL_DISPLAY_H_
-#include "common/system.h"
-
#include <set>
#include <vector>
@@ -65,12 +63,11 @@ class Display
private:
DISALLOW_COPY_AND_ASSIGN(Display);
- Display(EGLNativeDisplayType displayId, HDC deviceContext);
+ Display(EGLNativeDisplayType displayId);
bool restoreLostDevice();
EGLNativeDisplayType mDisplayId;
- const HDC mDc;
bool mSoftwareDevice;
diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp
index dbff159d0e..3443355c07 100644
--- a/src/3rdparty/angle/src/libEGL/Surface.cpp
+++ b/src/3rdparty/angle/src/libEGL/Surface.cpp
@@ -1,3 +1,4 @@
+#include "../libGLESv2/precompiled.h"
//
// 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
@@ -10,6 +11,8 @@
#include <tchar.h>
+#include <algorithm>
+
#include "libEGL/Surface.h"
#include "common/debug.h"
@@ -20,8 +23,6 @@
#include "libEGL/main.h"
#include "libEGL/Display.h"
-#include <algorithm>
-
#if defined(ANGLE_OS_WINRT)
#include <windows.foundation.h>
#include <windows.ui.core.h>
@@ -118,12 +119,9 @@ bool Surface::resetSwapChain()
#else
ABI::Windows::Foundation::Rect windowRect;
ABI::Windows::UI::Core::ICoreWindow *window;
- HRESULT result = mWindow->QueryInterface(IID_PPV_ARGS(&window));
- if (FAILED(result))
- {
- ASSERT(false);
+ HRESULT hr = mWindow->QueryInterface(IID_PPV_ARGS(&window));
+ if (FAILED(hr))
return false;
- }
window->get_Bounds(&windowRect);
width = windowRect.Width;
height = windowRect.Height;
@@ -156,16 +154,9 @@ bool Surface::resetSwapChain()
bool Surface::resizeSwapChain(int backbufferWidth, int backbufferHeight)
{
+ ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
ASSERT(mSwapChain);
- // Prevent bad swap chain resize by calling reset if size is invalid
- if (backbufferWidth < 1 || backbufferHeight < 1)
- {
- mWidth = backbufferWidth;
- mHeight = backbufferHeight;
- return mSwapChain->reset(0, 0, mSwapInterval) == EGL_SUCCESS;
- }
-
EGLint status = mSwapChain->resize(backbufferWidth, backbufferHeight);
if (status == EGL_CONTEXT_LOST)
@@ -347,18 +338,26 @@ bool Surface::checkForOutOfDateSwapChain()
#else
ABI::Windows::Foundation::Rect windowRect;
ABI::Windows::UI::Core::ICoreWindow *window;
- HRESULT result = mWindow->QueryInterface(IID_PPV_ARGS(&window));
- if (FAILED(result))
- {
- ASSERT(false);
+ HRESULT hr = mWindow->QueryInterface(IID_PPV_ARGS(&window));
+ if (FAILED(hr))
return false;
- }
window->get_Bounds(&windowRect);
int clientWidth = windowRect.Width;
int clientHeight = windowRect.Height;
#endif
bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
+#if !defined(ANGLE_OS_WINRT)
+ if (IsIconic(getWindowHandle()))
+ {
+ // The window is automatically resized to 150x22 when it's minimized, but the swapchain shouldn't be resized
+ // because that's not a useful size to render to.
+ sizeDirty = false;
+ }
+#endif
+
+ bool wasDirty = (mSwapIntervalDirty || sizeDirty);
+
if (mSwapIntervalDirty)
{
resetSwapChain(clientWidth, clientHeight);
@@ -368,7 +367,7 @@ bool Surface::checkForOutOfDateSwapChain()
resizeSwapChain(clientWidth, clientHeight);
}
- if (mSwapIntervalDirty || sizeDirty)
+ if (wasDirty)
{
if (static_cast<egl::Surface*>(getCurrentDrawSurface()) == this)
{
diff --git a/src/3rdparty/angle/src/libEGL/Surface.h b/src/3rdparty/angle/src/libEGL/Surface.h
index ae9a380858..1d2303c6eb 100644
--- a/src/3rdparty/angle/src/libEGL/Surface.h
+++ b/src/3rdparty/angle/src/libEGL/Surface.h
@@ -15,7 +15,6 @@
#include <EGL/egl.h>
#include "common/angleutils.h"
-#include "windows.h"
namespace gl
{
@@ -80,7 +79,7 @@ private:
bool resetSwapChain(int backbufferWidth, int backbufferHeight);
bool swapRect(EGLint x, EGLint y, EGLint width, EGLint height);
- const EGLNativeWindowType mWindow; // Window that the surface is created for.
+ const EGLNativeWindowType mWindow; // Window that the surface is created for.
bool mWindowSubclassed; // Indicates whether we successfully subclassed mWindow for WM_RESIZE hooking
const egl::Config *mConfig; // EGL config surface was created with
EGLint mHeight; // Height of surface
diff --git a/src/3rdparty/angle/src/libEGL/libEGL.cpp b/src/3rdparty/angle/src/libEGL/libEGL.cpp
index 5bcb5d5959..b2944d5c0d 100644
--- a/src/3rdparty/angle/src/libEGL/libEGL.cpp
+++ b/src/3rdparty/angle/src/libEGL/libEGL.cpp
@@ -184,7 +184,7 @@ const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
case EGL_VENDOR:
return egl::success(display->getVendorString());
case EGL_VERSION:
- return egl::success("1.4 (ANGLE " VERSION_STRING ")");
+ return egl::success("1.4 (ANGLE " ANGLE_VERSION_STRING ")");
}
return egl::error(EGL_BAD_PARAMETER, (const char*)NULL);
@@ -821,13 +821,21 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte
return egl::error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
}
- if (share_context && static_cast<gl::Context*>(share_context)->isResetNotificationEnabled() != reset_notification)
+ gl::Context *sharedContextPtr = (share_context != EGL_NO_CONTEXT ? static_cast<gl::Context*>(share_context) : NULL);
+
+ if (sharedContextPtr != NULL && sharedContextPtr->isResetNotificationEnabled() != reset_notification)
{
return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
}
egl::Display *display = static_cast<egl::Display*>(dpy);
+ // Can not share contexts between displays
+ if (sharedContextPtr != NULL && sharedContextPtr->getRenderer() != display->getRenderer())
+ {
+ return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
+ }
+
if (!validateConfig(display, config))
{
return EGL_NO_CONTEXT;
diff --git a/src/3rdparty/angle/src/libEGL/libEGL.rc b/src/3rdparty/angle/src/libEGL/libEGL.rc
index 5d1f32f1c9..65e0aa50c8 100644
--- a/src/3rdparty/angle/src/libEGL/libEGL.rc
+++ b/src/3rdparty/angle/src/libEGL/libEGL.rc
@@ -54,8 +54,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
+ FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
+ PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -71,13 +71,14 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "ANGLE libEGL Dynamic Link Library"
- VALUE "FileVersion", VERSION_STRING
+ VALUE "FileVersion", ANGLE_VERSION_STRING
VALUE "InternalName", "libEGL"
VALUE "LegalCopyright", "Copyright (C) 2011 Google Inc."
VALUE "OriginalFilename", "libEGL.dll"
- VALUE "PrivateBuild", VERSION_STRING
+ VALUE "PrivateBuild", ANGLE_VERSION_STRING
VALUE "ProductName", "ANGLE libEGL Dynamic Link Library"
- VALUE "ProductVersion", VERSION_STRING
+ VALUE "ProductVersion", ANGLE_VERSION_STRING
+ VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE
END
END
BLOCK "VarFileInfo"
diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp
index 964b4b21fd..e972691a4f 100644
--- a/src/3rdparty/angle/src/libEGL/main.cpp
+++ b/src/3rdparty/angle/src/libEGL/main.cpp
@@ -11,15 +11,63 @@
#include "common/debug.h"
-#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
-
#if !defined(ANGLE_OS_WINRT)
static DWORD currentTLS = TLS_OUT_OF_INDEXES;
#else
static __declspec(thread) void *currentTLS = 0;
#endif
-namespace egl { Current *getCurrent(); }
+namespace egl
+{
+
+Current *AllocateCurrent()
+{
+#if !defined(ANGLE_OS_WINRT)
+ Current *current = (egl::Current*)LocalAlloc(LPTR, sizeof(egl::Current));
+#else
+ currentTLS = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Current));
+ Current *current = (egl::Current*)currentTLS;
+#endif
+
+ if (!current)
+ {
+ ERR("Could not allocate thread local storage.");
+ return NULL;
+ }
+
+#if !defined(ANGLE_OS_WINRT)
+ ASSERT(currentTLS != TLS_OUT_OF_INDEXES);
+ TlsSetValue(currentTLS, current);
+#endif
+
+ current->error = EGL_SUCCESS;
+ current->API = EGL_OPENGL_ES_API;
+ current->display = EGL_NO_DISPLAY;
+ current->drawSurface = EGL_NO_SURFACE;
+ current->readSurface = EGL_NO_SURFACE;
+
+ return current;
+}
+
+void DeallocateCurrent()
+{
+#if !defined(ANGLE_OS_WINRT)
+ void *current = TlsGetValue(currentTLS);
+
+ if (current)
+ {
+ LocalFree((HLOCAL)current);
+ }
+#else
+ if (currentTLS)
+ {
+ HeapFree(GetProcessHeap(), 0, currentTLS);
+ currentTLS = 0;
+ }
+#endif
+}
+
+}
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
@@ -27,7 +75,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
{
case DLL_PROCESS_ATTACH:
{
-#if !defined(ANGLE_DISABLE_TRACE)
+#if defined(ANGLE_ENABLE_TRACE)
FILE *debug = fopen(TRACE_OUTPUT_FILE, "rt");
if (debug)
@@ -41,7 +89,6 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
}
}
#endif
-
#if !defined(ANGLE_OS_WINRT)
currentTLS = TlsAlloc();
@@ -54,51 +101,19 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
// Fall throught to initialize index
case DLL_THREAD_ATTACH:
{
- egl::Current *current = egl::getCurrent();
-
- if (current)
- {
-#if !defined(ANGLE_OS_WINRT)
- TlsSetValue(currentTLS, current);
-#endif
- current->error = EGL_SUCCESS;
- current->API = EGL_OPENGL_ES_API;
- current->display = EGL_NO_DISPLAY;
- current->drawSurface = EGL_NO_SURFACE;
- current->readSurface = EGL_NO_SURFACE;
- }
+ egl::AllocateCurrent();
}
break;
case DLL_THREAD_DETACH:
{
- egl::Current *current = egl::getCurrent();
-
- if (current)
- {
-#if !defined(ANGLE_OS_WINRT)
- LocalFree((HLOCAL)current);
-#else
- HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current);
- currentTLS = 0;
-#endif
- }
+ egl::DeallocateCurrent();
}
break;
case DLL_PROCESS_DETACH:
{
- egl::Current *current = egl::getCurrent();
-
- if (current)
- {
+ egl::DeallocateCurrent();
#if !defined(ANGLE_OS_WINRT)
- LocalFree((HLOCAL)current);
- }
-
TlsFree(currentTLS);
-#else
- HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current);
- currentTLS = 0;
- }
#endif
}
break;
@@ -109,96 +124,94 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
return TRUE;
}
-#endif // !QT_OPENGL_ES_2_ANGLE_STATIC
-
namespace egl
{
-Current *getCurrent()
+
+Current *GetCurrentData()
{
#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
#if !defined(ANGLE_OS_WINRT)
Current *current = (Current*)TlsGetValue(currentTLS);
- if (!current)
- current = (Current*)LocalAlloc(LPTR, sizeof(Current));
- return current;
#else
- if (!currentTLS)
- currentTLS = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY, sizeof(Current));
- return (Current*)currentTLS;
+ Current *current = (Current*)currentTLS;
#endif
#else
// No precautions for thread safety taken as ANGLE is used single-threaded in Qt.
- static Current curr = { EGL_SUCCESS, EGL_OPENGL_ES_API, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE };
- return &curr;
+ static Current s_current = { EGL_SUCCESS, EGL_OPENGL_ES_API, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE };
+ Current *current = &s_current;
#endif
+
+ // ANGLE issue 488: when the dll is loaded after thread initialization,
+ // thread local storage (current) might not exist yet.
+ return (current ? current : AllocateCurrent());
}
void setCurrentError(EGLint error)
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
current->error = error;
}
EGLint getCurrentError()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->error;
}
void setCurrentAPI(EGLenum API)
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
current->API = API;
}
EGLenum getCurrentAPI()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->API;
}
void setCurrentDisplay(EGLDisplay dpy)
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
current->display = dpy;
}
EGLDisplay getCurrentDisplay()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->display;
}
void setCurrentDrawSurface(EGLSurface surface)
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
current->drawSurface = surface;
}
EGLSurface getCurrentDrawSurface()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->drawSurface;
}
void setCurrentReadSurface(EGLSurface surface)
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
current->readSurface = surface;
}
EGLSurface getCurrentReadSurface()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->readSurface;
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Buffer.cpp b/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
index 40baa95760..c007d5d9e9 100644
--- a/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
@@ -37,11 +37,11 @@ Buffer::~Buffer()
delete mStaticIndexBuffer;
}
-void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage, GLenum target)
+void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
{
mBufferStorage->clear();
mIndexRangeCache.clear();
- mBufferStorage->setData(data, size, 0, target);
+ mBufferStorage->setData(data, size, 0);
mUsage = usage;
@@ -54,9 +54,9 @@ void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage, GLenum
}
}
-void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset, GLenum target)
+void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
{
- mBufferStorage->setData(data, size, offset, target);
+ mBufferStorage->setData(data, size, offset);
mIndexRangeCache.invalidateRange(offset, size);
if ((mStaticVertexBuffer && mStaticVertexBuffer->getBufferSize() != 0) || (mStaticIndexBuffer && mStaticIndexBuffer->getBufferSize() != 0))
diff --git a/src/3rdparty/angle/src/libGLESv2/Buffer.h b/src/3rdparty/angle/src/libGLESv2/Buffer.h
index 9b86b9791f..4048f4b906 100644
--- a/src/3rdparty/angle/src/libGLESv2/Buffer.h
+++ b/src/3rdparty/angle/src/libGLESv2/Buffer.h
@@ -33,8 +33,8 @@ class Buffer : public RefCountObject
virtual ~Buffer();
- void bufferData(const void *data, GLsizeiptr size, GLenum usage, GLenum target);
- void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset, GLenum target);
+ void bufferData(const void *data, GLsizeiptr size, GLenum usage);
+ void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
GLenum usage() const;
diff --git a/src/3rdparty/angle/src/libGLESv2/Context.cpp b/src/3rdparty/angle/src/libGLESv2/Context.cpp
index e829d508a6..e651785aed 100644
--- a/src/3rdparty/angle/src/libGLESv2/Context.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Context.cpp
@@ -1779,7 +1779,7 @@ void Context::applyState(GLenum drawMode)
{
mask = 0xFFFFFFFF;
}
- mRenderer->setBlendState(mState.blend, mState.blendColor, mask);
+ mRenderer->setBlendState(framebufferObject, mState.blend, mState.blendColor, mask);
mRenderer->setDepthStencilState(mState.depthStencil, mState.stencilRef, mState.stencilBackRef,
mState.rasterizer.frontFace == GL_CCW);
@@ -1813,6 +1813,8 @@ void Context::applyTextures(SamplerType type)
{
ProgramBinary *programBinary = getCurrentProgramBinary();
+ FramebufferTextureSerialSet boundFramebufferTextures = getBoundFramebufferTextureSerials();
+
// Range of Direct3D samplers of given sampler type
int samplerCount = (type == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS : mRenderer->getMaxVertexTextureImageUnits();
int samplerRange = programBinary->getUsedSamplerRange(type);
@@ -1826,7 +1828,8 @@ void Context::applyTextures(SamplerType type)
TextureType textureType = programBinary->getSamplerTextureType(type, samplerIndex);
Texture *texture = getSamplerTexture(textureUnit, textureType);
- if (texture->isSamplerComplete())
+ if (texture->isSamplerComplete() &&
+ boundFramebufferTextures.find(texture->getTextureSerial()) == boundFramebufferTextures.end())
{
SamplerState samplerState;
texture->getSamplerState(&samplerState);
@@ -2656,6 +2659,29 @@ const char *Context::getRendererString() const
return mRendererString;
}
+Context::FramebufferTextureSerialSet Context::getBoundFramebufferTextureSerials()
+{
+ FramebufferTextureSerialSet set;
+
+ Framebuffer *drawFramebuffer = getDrawFramebuffer();
+ for (unsigned int i = 0; i < IMPLEMENTATION_MAX_DRAW_BUFFERS; i++)
+ {
+ Renderbuffer *renderBuffer = drawFramebuffer->getColorbuffer(i);
+ if (renderBuffer && renderBuffer->getTextureSerial() != 0)
+ {
+ set.insert(renderBuffer->getTextureSerial());
+ }
+ }
+
+ Renderbuffer *depthStencilBuffer = drawFramebuffer->getDepthOrStencilbuffer();
+ if (depthStencilBuffer && depthStencilBuffer->getTextureSerial() != 0)
+ {
+ set.insert(depthStencilBuffer->getTextureSerial());
+ }
+
+ return set;
+}
+
void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask)
diff --git a/src/3rdparty/angle/src/libGLESv2/Context.h b/src/3rdparty/angle/src/libGLESv2/Context.h
index 9c222be24d..3dc95e3b95 100644
--- a/src/3rdparty/angle/src/libGLESv2/Context.h
+++ b/src/3rdparty/angle/src/libGLESv2/Context.h
@@ -18,6 +18,7 @@
#include <string>
#include <map>
+#include <set>
#ifdef _MSC_VER
#include <hash_map>
#else
@@ -37,7 +38,6 @@ class Renderer;
namespace egl
{
-class Display;
class Surface;
}
@@ -73,7 +73,7 @@ enum QueryType
class VertexAttribute
{
public:
- VertexAttribute() : mType(GL_FLOAT), mSize(0), mNormalized(false), mStride(0), mPointer(NULL), mArrayEnabled(false), mDivisor(0)
+ VertexAttribute() : mType(GL_FLOAT), mSize(4), mNormalized(false), mStride(0), mPointer(NULL), mArrayEnabled(false), mDivisor(0)
{
mCurrentValue[0] = 0.0f;
mCurrentValue[1] = 0.0f;
@@ -398,6 +398,8 @@ class Context
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask);
+ rx::Renderer *getRenderer() { return mRenderer; }
+
private:
DISALLOW_COPY_AND_ASSIGN(Context);
@@ -419,6 +421,9 @@ class Context
void initExtensionString();
void initRendererString();
+ typedef std::set<unsigned> FramebufferTextureSerialSet;
+ FramebufferTextureSerialSet getBoundFramebufferTextureSerials();
+
rx::Renderer *const mRenderer;
State mState;
diff --git a/src/3rdparty/angle/src/libGLESv2/Framebuffer.h b/src/3rdparty/angle/src/libGLESv2/Framebuffer.h
index b54e008dd8..50bfd4fd0f 100644
--- a/src/3rdparty/angle/src/libGLESv2/Framebuffer.h
+++ b/src/3rdparty/angle/src/libGLESv2/Framebuffer.h
@@ -12,7 +12,7 @@
#include "common/angleutils.h"
#include "common/RefCountObject.h"
-#include "constants.h"
+#include "Constants.h"
namespace rx
{
diff --git a/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp b/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
index bcd04b7157..a4d21192fa 100644
--- a/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
@@ -34,6 +34,11 @@ std::string str(int i)
return buffer;
}
+static rx::D3DWorkaroundType DiscardWorkaround(bool usesDiscard)
+{
+ return (usesDiscard ? rx::ANGLE_D3D_WORKAROUND_SM3_OPTIMIZER : rx::ANGLE_D3D_WORKAROUND_NONE);
+}
+
UniformLocation::UniformLocation(const std::string &name, unsigned int element, unsigned int index)
: name(name), element(element), index(index)
{
@@ -1622,9 +1627,19 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
return false;
}
- int version = 0;
- stream.read(&version);
- if (version != VERSION_DWORD)
+ int majorVersion = 0;
+ int minorVersion = 0;
+ stream.read(&majorVersion);
+ stream.read(&minorVersion);
+ if (majorVersion != ANGLE_MAJOR_VERSION || minorVersion != ANGLE_MINOR_VERSION)
+ {
+ infoLog.append("Invalid program binary version.");
+ return false;
+ }
+
+ unsigned char commitString[ANGLE_COMMIT_HASH_SIZE];
+ stream.read(commitString, ANGLE_COMMIT_HASH_SIZE);
+ if (memcmp(commitString, ANGLE_COMMIT_HASH, sizeof(unsigned char) * ANGLE_COMMIT_HASH_SIZE) != 0)
{
infoLog.append("Invalid program binary version.");
return false;
@@ -1791,7 +1806,9 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
BinaryOutputStream stream;
stream.write(GL_PROGRAM_BINARY_ANGLE);
- stream.write(VERSION_DWORD);
+ stream.write(ANGLE_MAJOR_VERSION);
+ stream.write(ANGLE_MINOR_VERSION);
+ stream.write(ANGLE_COMMIT_HASH, ANGLE_COMMIT_HASH_SIZE);
stream.write(ANGLE_COMPILE_OPTIMIZATION_LEVEL);
for (unsigned int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
@@ -1962,13 +1979,13 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin
if (success)
{
- mVertexExecutable = mRenderer->compileToExecutable(infoLog, vertexHLSL.c_str(), rx::SHADER_VERTEX);
- mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), rx::SHADER_PIXEL);
+ mVertexExecutable = mRenderer->compileToExecutable(infoLog, vertexHLSL.c_str(), rx::SHADER_VERTEX, DiscardWorkaround(vertexShader->mUsesDiscardRewriting));
+ mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), rx::SHADER_PIXEL, DiscardWorkaround(fragmentShader->mUsesDiscardRewriting));
if (usesGeometryShader())
{
std::string geometryHLSL = generateGeometryShaderHLSL(registers, packing, fragmentShader, vertexShader);
- mGeometryExecutable = mRenderer->compileToExecutable(infoLog, geometryHLSL.c_str(), rx::SHADER_GEOMETRY);
+ mGeometryExecutable = mRenderer->compileToExecutable(infoLog, geometryHLSL.c_str(), rx::SHADER_GEOMETRY, rx::ANGLE_D3D_WORKAROUND_NONE);
}
if (!mVertexExecutable || !mPixelExecutable || (usesGeometryShader() && !mGeometryExecutable))
@@ -2587,7 +2604,9 @@ struct AttributeSorter
bool operator()(int a, int b)
{
- return originalIndices[a] == -1 ? false : originalIndices[a] < originalIndices[b];
+ if (originalIndices[a] == -1) return false;
+ if (originalIndices[b] == -1) return true;
+ return (originalIndices[a] < originalIndices[b]);
}
const int (&originalIndices)[MAX_VERTEX_ATTRIBS];
@@ -2615,7 +2634,7 @@ void ProgramBinary::sortAttributesByLayout(rx::TranslatedAttribute attributes[MA
for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
{
int oldIndex = mAttributesByLayout[i];
- sortedSemanticIndices[i] = mSemanticIndex[oldIndex];
+ sortedSemanticIndices[i] = oldIndex;
attributes[i] = oldTranslatedAttributes[oldIndex];
}
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Renderbuffer.cpp b/src/3rdparty/angle/src/libGLESv2/Renderbuffer.cpp
index 127513741c..98d33ec6c3 100644
--- a/src/3rdparty/angle/src/libGLESv2/Renderbuffer.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Renderbuffer.cpp
@@ -129,6 +129,11 @@ unsigned int RenderbufferTexture2D::getSerial() const
return mTexture2D->getRenderTargetSerial(mTarget);
}
+unsigned int RenderbufferTexture2D::getTextureSerial() const
+{
+ return mTexture2D->getTextureSerial();
+}
+
///// RenderbufferTextureCubeMap Implementation ////////
RenderbufferTextureCubeMap::RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target) : mTarget(target)
@@ -193,6 +198,11 @@ unsigned int RenderbufferTextureCubeMap::getSerial() const
return mTextureCubeMap->getRenderTargetSerial(mTarget);
}
+unsigned int RenderbufferTextureCubeMap::getTextureSerial() const
+{
+ return mTextureCubeMap->getTextureSerial();
+}
+
////// Renderbuffer Implementation //////
Renderbuffer::Renderbuffer(rx::Renderer *renderer, GLuint id, RenderbufferInterface *instance) : RefCountObject(id)
@@ -292,6 +302,11 @@ unsigned int Renderbuffer::getSerial() const
return mInstance->getSerial();
}
+unsigned int Renderbuffer::getTextureSerial() const
+{
+ return mInstance->getTextureSerial();
+}
+
void Renderbuffer::setStorage(RenderbufferStorage *newStorage)
{
ASSERT(newStorage != NULL);
diff --git a/src/3rdparty/angle/src/libGLESv2/Renderbuffer.h b/src/3rdparty/angle/src/libGLESv2/Renderbuffer.h
index eca2f3a780..d46fd44557 100644
--- a/src/3rdparty/angle/src/libGLESv2/Renderbuffer.h
+++ b/src/3rdparty/angle/src/libGLESv2/Renderbuffer.h
@@ -60,6 +60,7 @@ class RenderbufferInterface
GLuint getStencilSize() const;
virtual unsigned int getSerial() const = 0;
+ virtual unsigned int getTextureSerial() const = 0;
private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferInterface);
@@ -85,6 +86,7 @@ class RenderbufferTexture2D : public RenderbufferInterface
virtual GLsizei getSamples() const;
virtual unsigned int getSerial() const;
+ virtual unsigned int getTextureSerial() const;
private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture2D);
@@ -113,6 +115,7 @@ class RenderbufferTextureCubeMap : public RenderbufferInterface
virtual GLsizei getSamples() const;
virtual unsigned int getSerial() const;
+ virtual unsigned int getTextureSerial() const;
private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferTextureCubeMap);
@@ -141,6 +144,7 @@ class RenderbufferStorage : public RenderbufferInterface
virtual GLsizei getSamples() const;
virtual unsigned int getSerial() const;
+ virtual unsigned int getTextureSerial() const { return 0; }
static unsigned int issueSerial();
static unsigned int issueCubeSerials();
@@ -193,6 +197,7 @@ class Renderbuffer : public RefCountObject
GLsizei getSamples() const;
unsigned int getSerial() const;
+ unsigned int getTextureSerial() const;
void setStorage(RenderbufferStorage *newStorage);
diff --git a/src/3rdparty/angle/src/libGLESv2/Shader.cpp b/src/3rdparty/angle/src/libGLESv2/Shader.cpp
index 7dfdd0ba3a..f6a2f03dfc 100644
--- a/src/3rdparty/angle/src/libGLESv2/Shader.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Shader.cpp
@@ -307,6 +307,7 @@ void Shader::parseVaryings()
mUsesPointCoord = strstr(mHlsl, "GL_USES_POINT_COORD") != NULL;
mUsesDepthRange = strstr(mHlsl, "GL_USES_DEPTH_RANGE") != NULL;
mUsesFragDepth = strstr(mHlsl, "GL_USES_FRAG_DEPTH") != NULL;
+ mUsesDiscardRewriting = strstr(mHlsl, "ANGLE_USES_DISCARD_REWRITING") != NULL;
}
}
@@ -340,6 +341,7 @@ void Shader::uncompile()
mUsesPointCoord = false;
mUsesDepthRange = false;
mUsesFragDepth = false;
+ mUsesDiscardRewriting = false;
mActiveUniforms.clear();
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Shader.h b/src/3rdparty/angle/src/libGLESv2/Shader.h
index 2afe2976c3..2015addd11 100644
--- a/src/3rdparty/angle/src/libGLESv2/Shader.h
+++ b/src/3rdparty/angle/src/libGLESv2/Shader.h
@@ -18,7 +18,7 @@
#include <list>
#include <vector>
-#include "compiler/Uniform.h"
+#include "compiler/translator/Uniform.h"
#include "common/angleutils.h"
namespace rx
@@ -107,6 +107,7 @@ class Shader
bool mUsesPointCoord;
bool mUsesDepthRange;
bool mUsesFragDepth;
+ bool mUsesDiscardRewriting;
static void *mFragmentCompiler;
static void *mVertexCompiler;
diff --git a/src/3rdparty/angle/src/libGLESv2/Texture.cpp b/src/3rdparty/angle/src/libGLESv2/Texture.cpp
index 72c0a8ab79..3257d05dd4 100644
--- a/src/3rdparty/angle/src/libGLESv2/Texture.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Texture.cpp
@@ -14,8 +14,8 @@
#include "libGLESv2/main.h"
#include "libGLESv2/mathutil.h"
#include "libGLESv2/utilities.h"
-#ifndef ANGLE_ENABLE_D3D11
-# include "libGLESv2/renderer/Blit.h"
+#if defined(ANGLE_ENABLE_D3D9)
+# include "libGLESv2/renderer/d3d9/Blit.h"
#else
# define D3DFMT_UNKNOWN DXGI_FORMAT_UNKNOWN
#endif
@@ -1362,10 +1362,10 @@ void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size
for (int level = 0; level < levels; level++)
{
+ GLsizei mipSize = std::max(1, size >> level);
for (int face = 0; face < 6; face++)
{
- mImageArray[face][level]->redefine(mRenderer, internalformat, size, size, true);
- size = std::max(1, size >> 1);
+ mImageArray[face][level]->redefine(mRenderer, internalformat, mipSize, mipSize, true);
}
}
diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp b/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
index 91719f8e6d..814dfbf965 100644
--- a/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
@@ -758,7 +758,7 @@ void __stdcall glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data,
return gl::error(GL_INVALID_OPERATION);
}
- buffer->bufferData(data, size, usage, target);
+ buffer->bufferData(data, size, usage);
}
}
catch(std::bad_alloc&)
@@ -812,7 +812,7 @@ void __stdcall glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size,
return gl::error(GL_INVALID_VALUE);
}
- buffer->bufferSubData(data, size, offset, target);
+ buffer->bufferSubData(data, size, offset);
}
}
catch(std::bad_alloc&)
@@ -3844,9 +3844,9 @@ const GLubyte* __stdcall glGetString(GLenum name)
case GL_RENDERER:
return (GLubyte*)((context != NULL) ? context->getRendererString() : "ANGLE");
case GL_VERSION:
- return (GLubyte*)"OpenGL ES 2.0 (ANGLE " VERSION_STRING ")";
+ return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")";
case GL_SHADING_LANGUAGE_VERSION:
- return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " VERSION_STRING ")";
+ return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")";
case GL_EXTENSIONS:
return (GLubyte*)((context != NULL) ? context->getExtensionString() : "");
default:
@@ -4893,9 +4893,9 @@ void __stdcall glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samp
case GL_RGB565:
case GL_RGB8_OES:
case GL_RGBA8_OES:
- case GL_BGRA8_EXT:
case GL_STENCIL_INDEX8:
case GL_DEPTH24_STENCIL8_OES:
+ case GL_BGRA8_EXT:
context->setRenderbufferStorage(width, height, internalformat, samples);
break;
default:
diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2.rc b/src/3rdparty/angle/src/libGLESv2/libGLESv2.rc
index 0ad21e440e..76cd05566e 100644
--- a/src/3rdparty/angle/src/libGLESv2/libGLESv2.rc
+++ b/src/3rdparty/angle/src/libGLESv2/libGLESv2.rc
@@ -54,8 +54,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
+ FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
+ PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -71,13 +71,14 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "ANGLE libGLESv2 Dynamic Link Library"
- VALUE "FileVersion", VERSION_STRING
+ VALUE "FileVersion", ANGLE_VERSION_STRING
VALUE "InternalName", "libGLESv2"
VALUE "LegalCopyright", "Copyright (C) 2011 Google Inc."
VALUE "OriginalFilename", "libGLESv2.dll"
- VALUE "PrivateBuild", VERSION_STRING
+ VALUE "PrivateBuild", ANGLE_VERSION_STRING
VALUE "ProductName", "ANGLE libGLESv2 Dynamic Link Library"
- VALUE "ProductVersion", VERSION_STRING
+ VALUE "ProductVersion", ANGLE_VERSION_STRING
+ VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE
END
END
BLOCK "VarFileInfo"
diff --git a/src/3rdparty/angle/src/libGLESv2/main.cpp b/src/3rdparty/angle/src/libGLESv2/main.cpp
index defdf35f77..95f4b8de1c 100644
--- a/src/3rdparty/angle/src/libGLESv2/main.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/main.cpp
@@ -11,15 +11,60 @@
#include "libGLESv2/Context.h"
-#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
-
#if !defined(ANGLE_OS_WINRT)
static DWORD currentTLS = TLS_OUT_OF_INDEXES;
#else
static __declspec(thread) void *currentTLS = 0;
#endif
-namespace gl { Current *getCurrent(); }
+namespace gl
+{
+
+Current *AllocateCurrent()
+{
+#if !defined(ANGLE_OS_WINRT)
+ Current *current = (Current*)LocalAlloc(LPTR, sizeof(Current));
+#else
+ currentTLS = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Current));
+ Current *current = (Current*)currentTLS;
+#endif
+
+ if (!current)
+ {
+ ERR("Could not allocate thread local storage.");
+ return NULL;
+ }
+
+#if !defined(ANGLE_OS_WINRT)
+ ASSERT(currentTLS != TLS_OUT_OF_INDEXES);
+ TlsSetValue(currentTLS, current);
+#endif
+
+ current->context = NULL;
+ current->display = NULL;
+
+ return current;
+}
+
+void DeallocateCurrent()
+{
+#if !defined(ANGLE_OS_WINRT)
+ void *current = TlsGetValue(currentTLS);
+
+ if (current)
+ {
+ LocalFree((HLOCAL)current);
+ }
+#else
+ if (currentTLS)
+ {
+ HeapFree(GetProcessHeap(), 0, currentTLS);
+ currentTLS = 0;
+ }
+#endif
+}
+
+}
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
@@ -39,48 +84,19 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
// Fall throught to initialize index
case DLL_THREAD_ATTACH:
{
- gl::Current *current = gl::getCurrent();
-
- if (current)
- {
-#if !defined(ANGLE_OS_WINRT)
- TlsSetValue(currentTLS, current);
-#endif
- current->context = NULL;
- current->display = NULL;
- }
+ gl::AllocateCurrent();
}
break;
case DLL_THREAD_DETACH:
{
- gl::Current *current = gl::getCurrent();
-
- if (current)
- {
-#if !defined(ANGLE_OS_WINRT)
- LocalFree((HLOCAL)current);
-#else
- HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current);
- currentTLS = 0;
-#endif
- }
+ gl::DeallocateCurrent();
}
break;
case DLL_PROCESS_DETACH:
{
- gl::Current *current = gl::getCurrent();
-
- if (current)
- {
+ gl::DeallocateCurrent();
#if !defined(ANGLE_OS_WINRT)
- LocalFree((HLOCAL)current);
- }
-
TlsFree(currentTLS);
-#else
- HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current);
- currentTLS = 0;
- }
#endif
}
break;
@@ -91,33 +107,31 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
return TRUE;
}
-#endif // !QT_OPENGL_ES_2_ANGLE_STATIC
-
namespace gl
{
-Current *getCurrent()
+
+Current *GetCurrentData()
{
#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
#if !defined(ANGLE_OS_WINRT)
Current *current = (Current*)TlsGetValue(currentTLS);
- if (!current)
- current = (Current*)LocalAlloc(LPTR, sizeof(Current));
- return current;
#else
- if (!currentTLS)
- currentTLS = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY, sizeof(Current));
- return (Current*)currentTLS;
+ Current *current = (Current*)currentTLS;
#endif
#else
// No precautions for thread safety taken as ANGLE is used single-threaded in Qt.
- static gl::Current curr = { 0, 0 };
- return &curr;
+ static Current s_current = { 0, 0 };
+ Current *current = &s_current;
#endif
+
+ // ANGLE issue 488: when the dll is loaded after thread initialization,
+ // thread local storage (current) might not exist yet.
+ return (current ? current : AllocateCurrent());
}
void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
current->context = context;
current->display = display;
@@ -130,7 +144,7 @@ void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
Context *getContext()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->context;
}
@@ -156,7 +170,7 @@ Context *getNonLostContext()
egl::Display *getDisplay()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->display;
}
diff --git a/src/3rdparty/angle/src/libGLESv2/main.h b/src/3rdparty/angle/src/libGLESv2/main.h
index 196afaeab6..69465c9bbf 100644
--- a/src/3rdparty/angle/src/libGLESv2/main.h
+++ b/src/3rdparty/angle/src/libGLESv2/main.h
@@ -10,7 +10,6 @@
#define LIBGLESV2_MAIN_H_
#include "common/debug.h"
-#include "common/system.h"
namespace egl
{
@@ -58,7 +57,7 @@ gl::Context *glCreateContext(const gl::Context *shareContext, rx::Renderer *rend
void glDestroyContext(gl::Context *context);
void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
gl::Context *glGetCurrentContext();
-rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayType displayId);
+rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType displayId);
void glDestroyRenderer(rx::Renderer *renderer);
__eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname);
diff --git a/src/3rdparty/angle/src/libGLESv2/mathutil.h b/src/3rdparty/angle/src/libGLESv2/mathutil.h
index 083548669a..6474b66745 100644
--- a/src/3rdparty/angle/src/libGLESv2/mathutil.h
+++ b/src/3rdparty/angle/src/libGLESv2/mathutil.h
@@ -11,7 +11,6 @@
#include <intrin.h>
-#include "common/system.h"
#include "common/debug.h"
namespace gl
diff --git a/src/3rdparty/angle/src/libGLESv2/precompiled.h b/src/3rdparty/angle/src/libGLESv2/precompiled.h
index 823d27bb60..2ff09f531e 100644
--- a/src/3rdparty/angle/src/libGLESv2/precompiled.h
+++ b/src/3rdparty/angle/src/libGLESv2/precompiled.h
@@ -33,26 +33,53 @@
#include <vector>
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
-#define ANGLE_OS_WINRT
-#if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
-#define ANGLE_OS_WINPHONE
+# define ANGLE_OS_WINRT
+# if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
+# define ANGLE_OS_WINPHONE
+# endif
#endif
+
+#if defined(ANGLE_ENABLE_D3D9)
+# include <d3d9.h>
+#endif
+#if defined(ANGLE_ENABLE_D3D11)
+# if !defined(ANGLE_OS_WINRT)
+# include <d3d11.h>
+# else
+# include <d3d11_1.h>
+# define Sleep(x) WaitForSingleObjectEx(GetCurrentThread(), x, FALSE)
+# define GetVersion() WINVER
+# define LoadLibrary(x) LoadPackagedLibrary(x, NULL)
+# endif
+# include <dxgi.h>
+#endif
+#if !defined(ANGLE_OS_WINPHONE)
+# include <d3dcompiler.h>
#endif
-#ifndef ANGLE_ENABLE_D3D11
-#include <d3d9.h>
-#else
-#if !defined(ANGLE_OS_WINRT)
-#include <D3D11.h>
-#else
-#include <d3d11_1.h>
-#define Sleep(x) WaitForSingleObjectEx(GetCurrentThread(), x, FALSE)
-#define GetVersion() WINVER
+#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL0
+#define D3DCOMPILE_OPTIMIZATION_LEVEL0 (1 << 14)
+#endif
+#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL1
+#define D3DCOMPILE_OPTIMIZATION_LEVEL1 0
+#endif
+#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL2
+#define D3DCOMPILE_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15))
+#endif
+#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL3
+#define D3DCOMPILE_OPTIMIZATION_LEVEL3 (1 << 15)
+#endif
+#ifndef D3DCOMPILE_DEBUG
+#define D3DCOMPILE_DEBUG (1 << 0)
+#endif
+#ifndef D3DCOMPILE_SKIP_OPTIMIZATION
+#define D3DCOMPILE_SKIP_OPTIMIZATION (1 << 2)
#endif
-#include <dxgi.h>
+#ifndef D3DCOMPILE_AVOID_FLOW_CONTROL
+#define D3DCOMPILE_AVOID_FLOW_CONTROL (1 << 9)
#endif
-#ifndef ANGLE_OS_WINPHONE
-#include <D3Dcompiler.h>
+#ifndef D3DCOMPILE_PREFER_FLOW_CONTROL
+#define D3DCOMPILE_PREFER_FLOW_CONTROL (1 << 10)
#endif
#ifdef _MSC_VER
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h
index 14a8c2765b..ace1a11bae 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h
@@ -22,7 +22,7 @@ class BufferStorage
// The data returned is only guaranteed valid until next non-const method.
virtual void *getData() = 0;
- virtual void setData(const void* data, unsigned int size, unsigned int offset, unsigned int target) = 0;
+ virtual void setData(const void* data, unsigned int size, unsigned int offset) = 0;
virtual void clear() = 0;
virtual unsigned int getSize() const = 0;
virtual bool supportsDirectBinding() const = 0;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp
deleted file mode 100644
index 2f694db061..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// BufferStorage11.cpp Defines the BufferStorage11 class.
-
-#include "libGLESv2/renderer/BufferStorage11.h"
-#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/Renderer11.h"
-
-namespace rx
-{
-
-BufferStorage11::BufferStorage11(Renderer11 *renderer)
-{
- mRenderer = renderer;
-
- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
-
- mBuffer = NULL;
- mBufferSize = 0;
-
- mSize = 0;
-
- mResolvedData = NULL;
- mResolvedDataSize = 0;
- mResolvedDataValid = false;
-
- mReadUsageCount = 0;
- mWriteUsageCount = 0;
-}
-
-BufferStorage11::~BufferStorage11()
-{
- if (mStagingBuffer)
- {
- mStagingBuffer->Release();
- mStagingBuffer = NULL;
- }
-
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- }
-
- if (mResolvedData)
- {
- free(mResolvedData);
- mResolvedData = NULL;
- }
-}
-
-BufferStorage11 *BufferStorage11::makeBufferStorage11(BufferStorage *bufferStorage)
-{
- ASSERT(HAS_DYNAMIC_TYPE(BufferStorage11*, bufferStorage));
- return static_cast<BufferStorage11*>(bufferStorage);
-}
-
-void *BufferStorage11::getData()
-{
- if (!mResolvedDataValid)
- {
- ID3D11Device *device = mRenderer->getDevice();
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- HRESULT result;
-
- if (!mStagingBuffer || mStagingBufferSize < mBufferSize)
- {
- if (mStagingBuffer)
- {
- mStagingBuffer->Release();
- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
- }
-
- D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = mSize;
- bufferDesc.Usage = D3D11_USAGE_STAGING;
- bufferDesc.BindFlags = 0;
- bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
- bufferDesc.MiscFlags = 0;
- bufferDesc.StructureByteStride = 0;
-
- result = device->CreateBuffer(&bufferDesc, NULL, &mStagingBuffer);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY, (void*)NULL);
- }
-
- mStagingBufferSize = bufferDesc.ByteWidth;
- }
-
- if (!mResolvedData || mResolvedDataSize < mBufferSize)
- {
- free(mResolvedData);
- mResolvedData = malloc(mSize);
- mResolvedDataSize = mSize;
- }
-
- D3D11_BOX srcBox;
- srcBox.left = 0;
- srcBox.right = mSize;
- srcBox.top = 0;
- srcBox.bottom = 1;
- srcBox.front = 0;
- srcBox.back = 1;
-
- context->CopySubresourceRegion(mStagingBuffer, 0, 0, 0, 0, mBuffer, 0, &srcBox);
-
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result = context->Map(mStagingBuffer, 0, D3D11_MAP_READ, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY, (void*)NULL);
- }
-
- memcpy(mResolvedData, mappedResource.pData, mSize);
-
- context->Unmap(mStagingBuffer, 0);
-
- mResolvedDataValid = true;
- }
-
- mReadUsageCount = 0;
-
- return mResolvedData;
-}
-
-void BufferStorage11::setData(const void* data, unsigned int size, unsigned int offset, unsigned int target)
-{
- ID3D11Device *device = mRenderer->getDevice();
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- HRESULT result;
-
- unsigned int requiredBufferSize = size + offset;
- unsigned int requiredStagingSize = size;
- bool directInitialization = offset == 0 && (!mBuffer || mBufferSize < size + offset);
-
- if (!directInitialization)
- {
- if (!mStagingBuffer || mStagingBufferSize < requiredStagingSize)
- {
- if (mStagingBuffer)
- {
- mStagingBuffer->Release();
- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
- }
-
- D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = size;
- bufferDesc.Usage = D3D11_USAGE_STAGING;
- bufferDesc.BindFlags = 0;
- bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
- bufferDesc.MiscFlags = 0;
- bufferDesc.StructureByteStride = 0;
-
- if (data)
- {
- D3D11_SUBRESOURCE_DATA initialData;
- initialData.pSysMem = data;
- initialData.SysMemPitch = size;
- initialData.SysMemSlicePitch = 0;
-
- result = device->CreateBuffer(&bufferDesc, &initialData, &mStagingBuffer);
- }
- else
- {
- result = device->CreateBuffer(&bufferDesc, NULL, &mStagingBuffer);
- }
-
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- mStagingBufferSize = size;
- }
- else if (data)
- {
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result = context->Map(mStagingBuffer, 0, D3D11_MAP_WRITE, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- memcpy(mappedResource.pData, data, size);
-
- context->Unmap(mStagingBuffer, 0);
- }
- }
-
- if (!mBuffer || mBufferSize < size + offset)
- {
- D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = requiredBufferSize;
- bufferDesc.Usage = D3D11_USAGE_DEFAULT;
- if (mRenderer->getFeatureLevel() > D3D_FEATURE_LEVEL_9_3)
- bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER | D3D11_BIND_INDEX_BUFFER;
- else
- bufferDesc.BindFlags = target == GL_ARRAY_BUFFER ? D3D11_BIND_VERTEX_BUFFER : D3D11_BIND_INDEX_BUFFER;
- bufferDesc.CPUAccessFlags = 0;
- bufferDesc.MiscFlags = 0;
- bufferDesc.StructureByteStride = 0;
-
- if (directInitialization)
- {
- // Since the data will fill the entire buffer (being larger than the initial size and having
- // no offset), the buffer can be initialized with the data so no staging buffer is required
-
- // No longer need the old buffer
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- mBufferSize = 0;
- }
-
- if (data)
- {
- D3D11_SUBRESOURCE_DATA initialData;
- initialData.pSysMem = data;
- initialData.SysMemPitch = size;
- initialData.SysMemSlicePitch = 0;
-
- result = device->CreateBuffer(&bufferDesc, &initialData, &mBuffer);
- }
- else
- {
- result = device->CreateBuffer(&bufferDesc, NULL, &mBuffer);
- }
-
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
- }
- else if (mBuffer && offset > 0)
- {
- // If offset is greater than zero and the buffer is non-null, need to preserve the data from
- // the old buffer up to offset
- ID3D11Buffer *newBuffer = NULL;
-
- result = device->CreateBuffer(&bufferDesc, NULL, &newBuffer);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- D3D11_BOX srcBox;
- srcBox.left = 0;
- srcBox.right = std::min(offset, mBufferSize);
- srcBox.top = 0;
- srcBox.bottom = 1;
- srcBox.front = 0;
- srcBox.back = 1;
-
- context->CopySubresourceRegion(newBuffer, 0, 0, 0, 0, mBuffer, 0, &srcBox);
-
- mBuffer->Release();
- mBuffer = newBuffer;
- }
- else
- {
- // Simple case, nothing needs to be copied from the old buffer to the new one, just create
- // a new buffer
-
- // No longer need the old buffer
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- mBufferSize = 0;
- }
-
- // Create a new buffer for data storage
- result = device->CreateBuffer(&bufferDesc, NULL, &mBuffer);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
- }
-
- updateSerial();
- mBufferSize = bufferDesc.ByteWidth;
- }
-
- if (!directInitialization)
- {
- ASSERT(mStagingBuffer && mStagingBufferSize >= requiredStagingSize);
-
- // Data is already put into the staging buffer, copy it over to the data buffer
- D3D11_BOX srcBox;
- srcBox.left = 0;
- srcBox.right = size;
- srcBox.top = 0;
- srcBox.bottom = 1;
- srcBox.front = 0;
- srcBox.back = 1;
-
- context->CopySubresourceRegion(mBuffer, 0, offset, 0, 0, mStagingBuffer, 0, &srcBox);
- }
-
- mSize = std::max(mSize, offset + size);
-
- mWriteUsageCount = 0;
-
- mResolvedDataValid = false;
-}
-
-void BufferStorage11::clear()
-{
- mResolvedDataValid = false;
- mSize = 0;
-}
-
-unsigned int BufferStorage11::getSize() const
-{
- return mSize;
-}
-
-bool BufferStorage11::supportsDirectBinding() const
-{
- return mRenderer->getFeatureLevel() >= D3D_FEATURE_LEVEL_10_0;
-}
-
-void BufferStorage11::markBufferUsage()
-{
- mReadUsageCount++;
- mWriteUsageCount++;
-
- static const unsigned int usageLimit = 5;
-
- if (mReadUsageCount > usageLimit && mResolvedData)
- {
- free(mResolvedData);
- mResolvedData = NULL;
- mResolvedDataSize = 0;
- mResolvedDataValid = false;
- }
-
- if (mReadUsageCount > usageLimit && mWriteUsageCount > usageLimit && mStagingBuffer)
- {
- mStagingBuffer->Release();
- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
- }
-}
-
-ID3D11Buffer *BufferStorage11::getBuffer() const
-{
- return mBuffer;
-}
-
-}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h
deleted file mode 100644
index c9489627c3..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h
+++ /dev/null
@@ -1,56 +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.
-//
-
-// BufferStorage11.h Defines the BufferStorage11 class.
-
-#ifndef LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
-#define LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
-
-#include "libGLESv2/renderer/BufferStorage.h"
-
-namespace rx
-{
-class Renderer11;
-
-class BufferStorage11 : public BufferStorage
-{
- public:
- explicit BufferStorage11(Renderer11 *renderer);
- virtual ~BufferStorage11();
-
- static BufferStorage11 *makeBufferStorage11(BufferStorage *bufferStorage);
-
- virtual void *getData();
- virtual void setData(const void* data, unsigned int size, unsigned int offset, unsigned int target);
- virtual void clear();
- virtual unsigned int getSize() const;
- virtual bool supportsDirectBinding() const;
- virtual void markBufferUsage();
-
- ID3D11Buffer *getBuffer() const;
-
- private:
- Renderer11 *mRenderer;
-
- ID3D11Buffer *mStagingBuffer;
- unsigned int mStagingBufferSize;
-
- ID3D11Buffer *mBuffer;
- unsigned int mBufferSize;
-
- unsigned int mSize;
-
- void *mResolvedData;
- unsigned int mResolvedDataSize;
- bool mResolvedDataValid;
-
- unsigned int mReadUsageCount;
- unsigned int mWriteUsageCount;
-};
-
-}
-
-#endif // LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
index 39fd0f41f0..5278113811 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
@@ -11,35 +11,26 @@
#include "libGLESv2/main.h"
#include "libGLESv2/Program.h"
#include "libGLESv2/renderer/Renderer.h"
-#ifndef ANGLE_ENABLE_D3D11
-#include "libGLESv2/renderer/Renderer9.h"
-#else
-#include "libGLESv2/renderer/Renderer11.h"
+#if defined(ANGLE_ENABLE_D3D9)
+# include "libGLESv2/renderer/d3d9/Renderer9.h"
+#endif
+#if defined(ANGLE_ENABLE_D3D11)
+# include "libGLESv2/renderer/d3d11/Renderer11.h"
#endif
#include "libGLESv2/utilities.h"
#include "third_party/trace_event/trace_event.h"
-#if !defined(ANGLE_ENABLE_D3D11)
-// Enables use of the Direct3D 11 API for a default display, when available
-#define ANGLE_ENABLE_D3D11 0
-#endif
-
#ifndef D3DERR_OUTOFVIDEOMEMORY
#define D3DERR_OUTOFVIDEOMEMORY MAKE_HRESULT(1, 0x876, 380)
#endif
-#ifndef D3DCOMPILER_DLL
-#define D3DCOMPILER_DLL L"d3dcompiler_43.dll" // Lowest common denominator
-#endif
+#if defined(__MINGW32__) || defined(ANGLE_OS_WINPHONE)
-#ifndef QT_D3DCOMPILER_DLL
-#define QT_D3DCOMPILER_DLL D3DCOMPILER_DLL
-#endif
+#ifndef D3DCOMPILER_DLL
-#if defined(__MINGW32__) || defined(ANGLE_OS_WINPHONE)
+// Add define + typedefs for older MinGW-w64 headers (pre 5783)
-//Add define + typedefs for older MinGW-w64 headers (pre 5783)
-//Also define these on Windows Phone, which doesn't have a shader compiler
+#define D3DCOMPILER_DLL L"d3dcompiler_43.dll"
HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filename,
const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint,
@@ -48,8 +39,14 @@ typedef HRESULT (WINAPI *pD3DCompile)(const void *data, SIZE_T data_size, const
const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint,
const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages);
+#endif // D3DCOMPILER_DLL
+
#endif // __MINGW32__ || ANGLE_OS_WINPHONE
+#ifndef QT_D3DCOMPILER_DLL
+#define QT_D3DCOMPILER_DLL D3DCOMPILER_DLL
+#endif
+
namespace rx
{
@@ -82,7 +79,8 @@ bool Renderer::initializeCompiler()
break;
}
}
-#else
+#endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
+
// Load the compiler DLL specified by the environment, or default to QT_D3DCOMPILER_DLL
#if !defined(ANGLE_OS_WINRT)
const wchar_t *defaultCompiler = _wgetenv(L"QT_D3DCOMPILER_DLL");
@@ -109,15 +107,11 @@ bool Renderer::initializeCompiler()
// Load the first available known compiler DLL
for (int i = 0; compilerDlls[i]; ++i)
{
-#if !defined(ANGLE_OS_WINRT)
+ // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with.
mD3dCompilerModule = LoadLibrary(compilerDlls[i]);
-#else
- mD3dCompilerModule = LoadPackagedLibrary(compilerDlls[i], NULL);
-#endif
if (mD3dCompilerModule)
break;
}
-#endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
if (!mD3dCompilerModule)
{
@@ -230,18 +224,46 @@ ShaderBlob *Renderer::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, co
extern "C"
{
-rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayType displayId)
+rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType displayId)
{
rx::Renderer *renderer = NULL;
EGLint status = EGL_BAD_ALLOC;
-#if ANGLE_ENABLE_D3D11
- renderer = new rx::Renderer11(display, hDc);
-#else
- bool softwareDevice = (displayId == EGL_SOFTWARE_DISPLAY_ANGLE);
- renderer = new rx::Renderer9(display, hDc, softwareDevice);
+#if defined(ANGLE_OS_WINRT)
+ if (displayId == EGL_DEFAULT_DISPLAY)
+ displayId = EGL_D3D11_ONLY_DISPLAY_ANGLE;
#endif
+#if defined(ANGLE_ENABLE_D3D11)
+ if (displayId == EGL_DEFAULT_DISPLAY ||
+ displayId == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
+ displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
+ {
+ renderer = new rx::Renderer11(display);
+
+ if (renderer)
+ {
+ status = renderer->initialize();
+ }
+
+ if (status == EGL_SUCCESS)
+ {
+ return renderer;
+ }
+ else if (displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
+ {
+ return NULL;
+ }
+
+ // Failed to create a D3D11 renderer, try creating a D3D9 renderer
+ delete renderer;
+ }
+#endif // ANGLE_ENABLE_D3D11
+
+#if defined(ANGLE_ENABLE_D3D9)
+ bool softwareDevice = (displayId == EGL_SOFTWARE_DISPLAY_ANGLE);
+ renderer = new rx::Renderer9(display, displayId, softwareDevice);
+
if (renderer)
{
status = renderer->initialize();
@@ -251,6 +273,7 @@ rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayT
{
return renderer;
}
+#endif // ANGLE_ENABLE_D3D9
return NULL;
}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h
index ac67c27e71..79578b2458 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h
@@ -14,30 +14,6 @@
#include "libGLESv2/Uniform.h"
#include "libGLESv2/angletypes.h"
-#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL0
-#define D3DCOMPILE_OPTIMIZATION_LEVEL0 (1 << 14)
-#endif
-#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL1
-#define D3DCOMPILE_OPTIMIZATION_LEVEL1 0
-#endif
-#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL2
-#define D3DCOMPILE_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15))
-#endif
-#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL3
-#define D3DCOMPILE_OPTIMIZATION_LEVEL3 (1 << 15)
-#endif
-#ifndef D3DCOMPILE_DEBUG
-#define D3DCOMPILE_DEBUG (1 << 0)
-#endif
-#ifndef D3DCOMPILE_SKIP_OPTIMIZATION
-#define D3DCOMPILE_SKIP_OPTIMIZATION (1 << 2)
-#endif
-#ifndef D3DCOMPILE_AVOID_FLOW_CONTROL
-#define D3DCOMPILE_AVOID_FLOW_CONTROL (1 << 9)
-#endif
-#ifndef D3DCOMPILE_PREFER_FLOW_CONTROL
-#define D3DCOMPILE_PREFER_FLOW_CONTROL (1 << 10)
-#endif
#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
#endif
@@ -118,6 +94,12 @@ enum ShaderType
SHADER_GEOMETRY
};
+enum D3DWorkaroundType
+{
+ ANGLE_D3D_WORKAROUND_NONE,
+ ANGLE_D3D_WORKAROUND_SM3_OPTIMIZER
+};
+
class Renderer
{
public:
@@ -138,7 +120,7 @@ class Renderer
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture) = 0;
virtual void setRasterizerState(const gl::RasterizerState &rasterState) = 0;
- virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
+ virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
unsigned int sampleMask) = 0;
virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
int stencilBackRef, bool frontFaceCCW) = 0;
@@ -232,7 +214,7 @@ class Renderer
// Shader operations
virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type) = 0;
- virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type) = 0;
+ virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround) = 0;
// Image operations
virtual Image *createImage() = 0;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h
index a6870ebedc..8231fbcb25 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h
@@ -1,3 +1,4 @@
+#include "../precompiled.h"
//
// 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
@@ -12,6 +13,10 @@
#include "common/angleutils.h"
+#if !defined(ANGLE_FORCE_VSYNC_OFF)
+#define ANGLE_FORCE_VSYNC_OFF 0
+#endif
+
namespace rx
{
@@ -33,7 +38,7 @@ class SwapChain
virtual HANDLE getShareHandle() {return mShareHandle;};
protected:
- const EGLNativeWindowType mWindow; // Window that the surface is created for.
+ const EGLNativeWindowType mWindow; // Window that the surface is created for.
const GLenum mBackBufferFormat;
const GLenum mDepthBufferFormat;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexDataManager.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/VertexDataManager.cpp
index 7ff5171fca..8034aed8c9 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexDataManager.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/VertexDataManager.cpp
@@ -266,6 +266,10 @@ GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[],
return GL_OUT_OF_MEMORY;
}
+ mCurrentValue[i][0] = attribs[i].mCurrentValue[0];
+ mCurrentValue[i][1] = attribs[i].mCurrentValue[1];
+ mCurrentValue[i][2] = attribs[i].mCurrentValue[2];
+ mCurrentValue[i][3] = attribs[i].mCurrentValue[3];
mCurrentValueOffsets[i] = streamOffset;
}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp
new file mode 100644
index 0000000000..31d5b8b886
--- /dev/null
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp
@@ -0,0 +1,366 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// BufferStorage11.cpp Defines the BufferStorage11 class.
+
+#include "libGLESv2/renderer/d3d11/BufferStorage11.h"
+#include "libGLESv2/main.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+
+namespace rx
+{
+
+BufferStorage11::BufferStorage11(Renderer11 *renderer)
+{
+ mRenderer = renderer;
+
+ mStagingBuffer = NULL;
+ mStagingBufferSize = 0;
+
+ mSize = 0;
+
+ mResolvedData = NULL;
+ mResolvedDataSize = 0;
+ mResolvedDataValid = false;
+
+ mReadUsageCount = 0;
+ mWriteUsageCount = 0;
+}
+
+BufferStorage11::~BufferStorage11()
+{
+ SafeRelease(mStagingBuffer);
+
+ if (mResolvedData)
+ {
+ free(mResolvedData);
+ mResolvedData = NULL;
+ }
+
+ for (auto it = mDirectBuffers.begin(); it != mDirectBuffers.end(); it++)
+ {
+ SafeDelete(it->second);
+ }
+}
+
+BufferStorage11 *BufferStorage11::makeBufferStorage11(BufferStorage *bufferStorage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(BufferStorage11*, bufferStorage));
+ return static_cast<BufferStorage11*>(bufferStorage);
+}
+
+void *BufferStorage11::getData()
+{
+ ASSERT(mStagingBuffer);
+
+ if (!mResolvedDataValid)
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ HRESULT result;
+
+ if (!mResolvedData || mResolvedDataSize < mStagingBufferSize)
+ {
+ free(mResolvedData);
+ mResolvedData = malloc(mSize);
+ mResolvedDataSize = mSize;
+ }
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ result = context->Map(mStagingBuffer, 0, D3D11_MAP_READ, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ return gl::error(GL_OUT_OF_MEMORY, (void*)NULL);
+ }
+
+ memcpy(mResolvedData, mappedResource.pData, mSize);
+
+ context->Unmap(mStagingBuffer, 0);
+
+ mResolvedDataValid = true;
+ }
+
+ mReadUsageCount = 0;
+
+ return mResolvedData;
+}
+
+void BufferStorage11::setData(const void* data, unsigned int size, unsigned int offset)
+{
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ HRESULT result;
+
+ const unsigned int requiredStagingBufferSize = size + offset;
+ const bool createStagingBuffer = !mStagingBuffer || mStagingBufferSize < requiredStagingBufferSize;
+
+ if (createStagingBuffer)
+ {
+ D3D11_BUFFER_DESC bufferDesc;
+ bufferDesc.ByteWidth = requiredStagingBufferSize;
+ bufferDesc.Usage = D3D11_USAGE_STAGING;
+ bufferDesc.BindFlags = 0;
+ bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
+ bufferDesc.MiscFlags = 0;
+ bufferDesc.StructureByteStride = 0;
+
+ HRESULT result;
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ ID3D11Buffer *newStagingBuffer;
+
+ if (data && offset == 0)
+ {
+ D3D11_SUBRESOURCE_DATA initialData;
+ initialData.pSysMem = data;
+ initialData.SysMemPitch = requiredStagingBufferSize;
+ initialData.SysMemSlicePitch = 0;
+
+ result = device->CreateBuffer(&bufferDesc, &initialData, &newStagingBuffer);
+ }
+ else
+ {
+ result = device->CreateBuffer(&bufferDesc, NULL, &newStagingBuffer);
+ }
+
+ if (FAILED(result))
+ {
+ mStagingBufferSize = 0;
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ mStagingBufferSize = requiredStagingBufferSize;
+
+ if (mStagingBuffer && offset > 0)
+ {
+ // If offset is greater than zero and the buffer is non-null, need to preserve the data from
+ // the old buffer up to offset
+ D3D11_BOX srcBox;
+ srcBox.left = 0;
+ srcBox.right = std::min(offset, requiredStagingBufferSize);
+ srcBox.top = 0;
+ srcBox.bottom = 1;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ context->CopySubresourceRegion(newStagingBuffer, 0, 0, 0, 0, mStagingBuffer, 0, &srcBox);
+ }
+
+ SafeRelease(mStagingBuffer);
+ mStagingBuffer = newStagingBuffer;
+ }
+
+ if (data && (offset != 0 || !createStagingBuffer))
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ result = context->Map(mStagingBuffer, 0, D3D11_MAP_WRITE, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ unsigned char *offsetBufferPointer = reinterpret_cast<unsigned char *>(mappedResource.pData) + offset;
+ memcpy(offsetBufferPointer, data, size);
+
+ context->Unmap(mStagingBuffer, 0);
+ }
+
+ for (auto it = mDirectBuffers.begin(); it != mDirectBuffers.end(); it++)
+ {
+ it->second->markDirty();
+ }
+
+ mSize = std::max(mSize, requiredStagingBufferSize);
+ mWriteUsageCount = 0;
+
+ mResolvedDataValid = false;
+}
+
+void BufferStorage11::copyData(BufferStorage* sourceStorage, unsigned int size,
+ unsigned int sourceOffset, unsigned int destOffset)
+{
+ BufferStorage11* source = makeBufferStorage11(sourceStorage);
+ if (source)
+ {
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ D3D11_BOX srcBox;
+ srcBox.left = sourceOffset;
+ srcBox.right = sourceOffset + size;
+ srcBox.top = 0;
+ srcBox.bottom = 1;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ ASSERT(mStagingBuffer && source->mStagingBuffer);
+ context->CopySubresourceRegion(mStagingBuffer, 0, destOffset, 0, 0, source->mStagingBuffer, 0, &srcBox);
+ }
+}
+
+void BufferStorage11::clear()
+{
+ mResolvedDataValid = false;
+ mSize = 0;
+}
+
+unsigned int BufferStorage11::getSize() const
+{
+ return mSize;
+}
+
+bool BufferStorage11::supportsDirectBinding() const
+{
+ return true;
+}
+
+void BufferStorage11::markBufferUsage()
+{
+ mReadUsageCount++;
+ mWriteUsageCount++;
+
+ const unsigned int usageLimit = 5;
+
+ if (mReadUsageCount > usageLimit && mResolvedData)
+ {
+ free(mResolvedData);
+ mResolvedData = NULL;
+ mResolvedDataSize = 0;
+ mResolvedDataValid = false;
+ }
+}
+
+ID3D11Buffer *BufferStorage11::getBuffer(BufferUsage usage)
+{
+ markBufferUsage();
+
+ DirectBufferStorage11 *directBuffer = NULL;
+
+ auto directBufferIt = mDirectBuffers.find(usage);
+ if (directBufferIt != mDirectBuffers.end())
+ {
+ directBuffer = directBufferIt->second;
+ }
+
+ if (directBuffer)
+ {
+ if (directBuffer->isDirty())
+ {
+ // if updateFromStagingBuffer returns true, the D3D buffer has been recreated
+ // and we should update our serial
+ if (directBuffer->updateFromStagingBuffer(mStagingBuffer, mSize, 0))
+ {
+ updateSerial();
+ }
+ }
+ }
+ else
+ {
+ // buffer is not allocated, create it
+ directBuffer = new DirectBufferStorage11(mRenderer, usage);
+ directBuffer->updateFromStagingBuffer(mStagingBuffer, mSize, 0);
+
+ mDirectBuffers.insert(std::make_pair(usage, directBuffer));
+ updateSerial();
+ }
+
+ return directBuffer->getD3DBuffer();
+}
+
+DirectBufferStorage11::DirectBufferStorage11(Renderer11 *renderer, BufferUsage usage)
+ : mRenderer(renderer),
+ mUsage(usage),
+ mDirectBuffer(NULL),
+ mBufferSize(0),
+ mDirty(false)
+{
+}
+
+DirectBufferStorage11::~DirectBufferStorage11()
+{
+ SafeRelease(mDirectBuffer);
+}
+
+BufferUsage DirectBufferStorage11::getUsage() const
+{
+ return mUsage;
+}
+
+// Returns true if it recreates the direct buffer
+bool DirectBufferStorage11::updateFromStagingBuffer(ID3D11Buffer *stagingBuffer, size_t size, size_t offset)
+{
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ // unused for now
+ ASSERT(offset == 0);
+
+ unsigned int requiredBufferSize = size + offset;
+ bool createBuffer = !mDirectBuffer || mBufferSize < requiredBufferSize;
+
+ // (Re)initialize D3D buffer if needed
+ if (createBuffer)
+ {
+ D3D11_BUFFER_DESC bufferDesc;
+ fillBufferDesc(&bufferDesc, mRenderer, mUsage, requiredBufferSize);
+
+ ID3D11Buffer *newBuffer;
+ HRESULT result = device->CreateBuffer(&bufferDesc, NULL, &newBuffer);
+
+ if (FAILED(result))
+ {
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
+
+ // No longer need the old buffer
+ SafeRelease(mDirectBuffer);
+ mDirectBuffer = newBuffer;
+
+ mBufferSize = bufferDesc.ByteWidth;
+ }
+
+ // Copy data via staging buffer
+ D3D11_BOX srcBox;
+ srcBox.left = 0;
+ srcBox.right = size;
+ srcBox.top = 0;
+ srcBox.bottom = 1;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ context->CopySubresourceRegion(mDirectBuffer, 0, offset, 0, 0, stagingBuffer, 0, &srcBox);
+
+ mDirty = false;
+
+ return createBuffer;
+}
+
+void DirectBufferStorage11::fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Renderer *renderer, BufferUsage usage, unsigned int bufferSize)
+{
+ bufferDesc->ByteWidth = bufferSize;
+ bufferDesc->MiscFlags = 0;
+ bufferDesc->StructureByteStride = 0;
+
+ switch (usage)
+ {
+ case BUFFER_USAGE_VERTEX:
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc->BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+ case BUFFER_USAGE_INDEX:
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc->BindFlags = D3D11_BIND_INDEX_BUFFER;
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+}
+
+}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.h
new file mode 100644
index 0000000000..a6afafe1b4
--- /dev/null
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.h
@@ -0,0 +1,92 @@
+//
+// 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.
+//
+
+// BufferStorage11.h Defines the BufferStorage11 class.
+
+#ifndef LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
+#define LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
+
+#include "libGLESv2/renderer/BufferStorage.h"
+
+namespace rx
+{
+class Renderer;
+class Renderer11;
+class DirectBufferStorage11;
+
+enum BufferUsage
+{
+ BUFFER_USAGE_VERTEX,
+ BUFFER_USAGE_INDEX,
+};
+
+class BufferStorage11 : public BufferStorage
+{
+ public:
+ explicit BufferStorage11(Renderer11 *renderer);
+ virtual ~BufferStorage11();
+
+ static BufferStorage11 *makeBufferStorage11(BufferStorage *bufferStorage);
+
+ virtual void *getData();
+ virtual void setData(const void* data, unsigned int size, unsigned int offset);
+ virtual void copyData(BufferStorage* sourceStorage, unsigned int size,
+ unsigned int sourceOffset, unsigned int destOffset);
+ virtual void clear();
+ virtual unsigned int getSize() const;
+ virtual bool supportsDirectBinding() const;
+
+ ID3D11Buffer *getBuffer(BufferUsage usage);
+
+ private:
+ Renderer11 *mRenderer;
+
+ ID3D11Buffer *mStagingBuffer;
+ unsigned int mStagingBufferSize;
+
+ std::map<BufferUsage, DirectBufferStorage11*> mDirectBuffers;
+
+ unsigned int mSize;
+
+ void *mResolvedData;
+ unsigned int mResolvedDataSize;
+ bool mResolvedDataValid;
+
+ unsigned int mReadUsageCount;
+ unsigned int mWriteUsageCount;
+
+ void markBufferUsage();
+};
+
+// Each instance of BufferStorageD3DBuffer11 is specialized for a class of D3D binding points
+// - vertex buffers
+// - index buffers
+class DirectBufferStorage11
+{
+ public:
+ DirectBufferStorage11(Renderer11 *renderer, BufferUsage usage);
+ ~DirectBufferStorage11();
+
+ BufferUsage getUsage() const;
+ bool updateFromStagingBuffer(ID3D11Buffer *stagingBuffer, size_t size, size_t offset);
+
+ ID3D11Buffer *getD3DBuffer() { return mDirectBuffer; }
+ bool isDirty() const { return mDirty; }
+ void markDirty() { mDirty = true; }
+
+ private:
+ Renderer11 *mRenderer;
+ const BufferUsage mUsage;
+ ID3D11Buffer *mDirectBuffer;
+ size_t mBufferSize;
+ bool mDirty;
+
+ static void fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Renderer *renderer, BufferUsage usage, unsigned int bufferSize);
+};
+
+}
+
+#endif // LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Fence11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Fence11.cpp
index 9d11c9a0fc..2a7d4d43ef 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Fence11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Fence11.cpp
@@ -7,9 +7,9 @@
// Fence11.cpp: Defines the rx::Fence11 class which implements rx::FenceImpl.
-#include "libGLESv2/renderer/Fence11.h"
+#include "libGLESv2/renderer/d3d11/Fence11.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
namespace rx
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Fence11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Fence11.h
index a5398bca14..a5398bca14 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Fence11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Fence11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Image11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.cpp
index 81e9e9ecb2..5d039a35e8 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Image11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.cpp
@@ -8,15 +8,15 @@
// Image11.h: Implements the rx::Image11 class, which acts as the interface to
// the actual underlying resources of a Texture
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/renderer/Image11.h"
-#include "libGLESv2/renderer/TextureStorage11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/Image11.h"
+#include "libGLESv2/renderer/d3d11/TextureStorage11.h"
#include "libGLESv2/Framebuffer.h"
#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/main.h"
#include "libGLESv2/utilities.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
#include "libGLESv2/renderer/generatemip.h"
namespace rx
@@ -106,9 +106,15 @@ void Image11::generateMipmap(Image11 *dest, Image11 *src)
dest->markDirty();
}
+static bool FormatRequiresInitialization(DXGI_FORMAT dxgiFormat, GLenum internalFormat)
+{
+ return (dxgiFormat == DXGI_FORMAT_R8G8B8A8_UNORM && gl::GetAlphaSize(internalFormat) == 0) ||
+ (dxgiFormat == DXGI_FORMAT_R32G32B32A32_FLOAT && gl::GetAlphaSize(internalFormat) == 0);
+}
+
bool Image11::isDirty() const
{
- return (mStagingTexture && mDirty);
+ return ((mStagingTexture || FormatRequiresInitialization(mDXGIFormat, mInternalFormat)) && mDirty);
}
bool Image11::updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
@@ -374,6 +380,27 @@ unsigned int Image11::getStagingSubresource()
return mStagingSubresource;
}
+template <typename T, size_t N>
+static void setDefaultData(ID3D11DeviceContext *deviceContext, ID3D11Texture2D *texture, UINT subresource,
+ GLsizei width, GLsizei height, const T (&defaultData)[N])
+{
+ D3D11_MAPPED_SUBRESOURCE map;
+ deviceContext->Map(texture, subresource, D3D11_MAP_WRITE, 0, &map);
+
+ unsigned char* ptr = reinterpret_cast<unsigned char*>(map.pData);
+ size_t pixelSize = sizeof(T) * N;
+
+ for (GLsizei y = 0; y < height; y++)
+ {
+ for (GLsizei x = 0; x < width; x++)
+ {
+ memcpy(ptr + (y * map.RowPitch) + (x * pixelSize), defaultData, pixelSize);
+ }
+ }
+
+ deviceContext->Unmap(texture, subresource);
+}
+
void Image11::createStagingTexture()
{
if (mStagingTexture)
@@ -421,6 +448,17 @@ void Image11::createStagingTexture()
mStagingTexture = newTexture;
mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
mDirty = false;
+
+ if (mDXGIFormat == DXGI_FORMAT_R8G8B8A8_UNORM && gl::GetAlphaSize(mInternalFormat) == 0)
+ {
+ unsigned char defaultPixel[4] = { 0, 0, 0, 255 };
+ setDefaultData(mRenderer->getDeviceContext(), mStagingTexture, mStagingSubresource, mWidth, mHeight, defaultPixel);
+ }
+ else if (mDXGIFormat == DXGI_FORMAT_R32G32B32A32_FLOAT && gl::GetAlphaSize(mInternalFormat) == 0)
+ {
+ float defaultPixel[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
+ setDefaultData(mRenderer->getDeviceContext(), mStagingTexture, mStagingSubresource, mWidth, mHeight, defaultPixel);
+ }
}
HRESULT Image11::map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map)
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Image11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.h
index 11a6492dc8..11a6492dc8 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Image11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp
index 36a62adc1c..44f9976d43 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp
@@ -7,8 +7,8 @@
// IndexBuffer11.cpp: Defines the D3D11 IndexBuffer implementation.
-#include "libGLESv2/renderer/IndexBuffer11.h"
-#include "libGLESv2/renderer/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/IndexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
namespace rx
{
@@ -170,7 +170,7 @@ DXGI_FORMAT IndexBuffer11::getIndexFormat() const
{
case GL_UNSIGNED_BYTE: return DXGI_FORMAT_R16_UINT;
case GL_UNSIGNED_SHORT: return DXGI_FORMAT_R16_UINT;
- case GL_UNSIGNED_INT: return mRenderer->get32BitIndexSupport() ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT;
+ case GL_UNSIGNED_INT: return DXGI_FORMAT_R32_UINT;
default: UNREACHABLE(); return DXGI_FORMAT_UNKNOWN;
}
}
@@ -180,4 +180,4 @@ ID3D11Buffer *IndexBuffer11::getBuffer() const
return mBuffer;
}
-}
+} \ No newline at end of file
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.h
index 39a61946ad..39a61946ad 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp
index 1552f3a326..4940b8c638 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp
@@ -8,10 +8,10 @@
// InputLayoutCache.cpp: Defines InputLayoutCache, a class that builds and caches
// D3D11 input layouts.
-#include "libGLESv2/renderer/InputLayoutCache.h"
-#include "libGLESv2/renderer/VertexBuffer11.h"
-#include "libGLESv2/renderer/BufferStorage11.h"
-#include "libGLESv2/renderer/ShaderExecutable11.h"
+#include "libGLESv2/renderer/d3d11/InputLayoutCache.h"
+#include "libGLESv2/renderer/d3d11/VertexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/BufferStorage11.h"
+#include "libGLESv2/renderer/d3d11/ShaderExecutable11.h"
#include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/Context.h"
#include "libGLESv2/renderer/VertexDataManager.h"
@@ -103,10 +103,10 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
// Record the type of the associated vertex shader vector in our key
// This will prevent mismatched vertex shaders from using the same input layout
GLint attributeSize;
- programBinary->getActiveAttribute(ilKey.elementCount, 0, NULL, &attributeSize, &ilKey.elements[ilKey.elementCount].glslElementType, NULL);
+ programBinary->getActiveAttribute(sortedSemanticIndices[i], 0, NULL, &attributeSize, &ilKey.elements[ilKey.elementCount].glslElementType, NULL);
ilKey.elements[ilKey.elementCount].desc.SemanticName = semanticName;
- ilKey.elements[ilKey.elementCount].desc.SemanticIndex = sortedSemanticIndices[i];
+ ilKey.elements[ilKey.elementCount].desc.SemanticIndex = i;
ilKey.elements[ilKey.elementCount].desc.Format = attributes[i].attribute->mArrayEnabled ? vertexBuffer->getDXGIFormat(*attributes[i].attribute) : DXGI_FORMAT_R32G32B32A32_FLOAT;
ilKey.elements[ilKey.elementCount].desc.InputSlot = i;
ilKey.elements[ilKey.elementCount].desc.AlignedByteOffset = 0;
@@ -114,7 +114,7 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
ilKey.elements[ilKey.elementCount].desc.InstanceDataStepRate = attributes[i].divisor;
ilKey.elementCount++;
- vertexBuffers[i] = bufferStorage ? bufferStorage->getBuffer() : vertexBuffer->getBuffer();
+ vertexBuffers[i] = bufferStorage ? bufferStorage->getBuffer(BUFFER_USAGE_VERTEX) : vertexBuffer->getBuffer();
vertexBufferSerials[i] = bufferStorage ? bufferStorage->getSerial() : vertexBuffer->getSerial();
vertexStrides[i] = attributes[i].stride;
vertexOffsets[i] = attributes[i].offset;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.h
index bb1a8eebcf..bb1a8eebcf 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Query11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Query11.cpp
index 13210fc929..24c0330a1e 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Query11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Query11.cpp
@@ -7,8 +7,8 @@
// Query11.cpp: Defines the rx::Query11 class which implements rx::QueryImpl.
-#include "libGLESv2/renderer/Query11.h"
-#include "libGLESv2/renderer/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/Query11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
#include "libGLESv2/main.h"
namespace rx
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Query11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Query11.h
index 0a03de77ca..0a03de77ca 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Query11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Query11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp
index fd388dfe08..a1c324cd80 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp
@@ -8,9 +8,12 @@
// RenderStateCache.cpp: Defines rx::RenderStateCache, a cache of Direct3D render
// state objects.
-#include "libGLESv2/renderer/RenderStateCache.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/RenderStateCache.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/Framebuffer.h"
+#include "libGLESv2/Renderbuffer.h"
+#include "libGLESv2/utilities.h"
#include "common/debug.h"
#include "third_party/murmurhash/MurmurHash3.h"
@@ -71,21 +74,21 @@ void RenderStateCache::clear()
mSamplerStateCache.clear();
}
-std::size_t RenderStateCache::hashBlendState(const gl::BlendState &blendState)
+std::size_t RenderStateCache::hashBlendState(const BlendStateKey &blendState)
{
static const unsigned int seed = 0xABCDEF98;
std::size_t hash = 0;
- MurmurHash3_x86_32(&blendState, sizeof(gl::BlendState), seed, &hash);
+ MurmurHash3_x86_32(&blendState, sizeof(BlendStateKey), seed, &hash);
return hash;
}
-bool RenderStateCache::compareBlendStates(const gl::BlendState &a, const gl::BlendState &b)
+bool RenderStateCache::compareBlendStates(const BlendStateKey &a, const BlendStateKey &b)
{
return memcmp(&a, &b, sizeof(gl::BlendState)) == 0;
}
-ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendState)
+ID3D11BlendState *RenderStateCache::getBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState)
{
if (!mDevice)
{
@@ -93,7 +96,36 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
return NULL;
}
- BlendStateMap::iterator i = mBlendStateCache.find(blendState);
+ bool mrt = false;
+
+ BlendStateKey key = { 0 };
+ key.blendState = blendState;
+ for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
+ {
+ gl::Renderbuffer *renderBuffer = framebuffer->getColorbuffer(i);
+ if (renderBuffer)
+ {
+ if (i > 0)
+ {
+ mrt = true;
+ }
+
+ GLenum internalFormat = renderBuffer->getInternalFormat();
+ key.rtChannels[i][0] = gl::GetRedSize(internalFormat) > 0;
+ key.rtChannels[i][1] = gl::GetGreenSize(internalFormat) > 0;
+ key.rtChannels[i][2] = gl::GetBlueSize(internalFormat) > 0;;
+ key.rtChannels[i][3] = gl::GetAlphaSize(internalFormat) > 0;
+ }
+ else
+ {
+ key.rtChannels[i][0] = false;
+ key.rtChannels[i][1] = false;
+ key.rtChannels[i][2] = false;
+ key.rtChannels[i][3] = false;
+ }
+ }
+
+ BlendStateMap::iterator i = mBlendStateCache.find(key);
if (i != mBlendStateCache.end())
{
BlendStateCounterPair &state = i->second;
@@ -122,7 +154,7 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
// Create a new blend state and insert it into the cache
D3D11_BLEND_DESC blendDesc = { 0 };
blendDesc.AlphaToCoverageEnable = blendState.sampleAlphaToCoverage;
- blendDesc.IndependentBlendEnable = FALSE;
+ blendDesc.IndependentBlendEnable = mrt ? TRUE : FALSE;
for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
@@ -140,10 +172,10 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
rtBlend.BlendOpAlpha = gl_d3d11::ConvertBlendOp(blendState.blendEquationAlpha);
}
- rtBlend.RenderTargetWriteMask = gl_d3d11::ConvertColorMask(blendState.colorMaskRed,
- blendState.colorMaskGreen,
- blendState.colorMaskBlue,
- blendState.colorMaskAlpha);
+ rtBlend.RenderTargetWriteMask = gl_d3d11::ConvertColorMask(key.rtChannels[i][0] && blendState.colorMaskRed,
+ key.rtChannels[i][1] && blendState.colorMaskGreen,
+ key.rtChannels[i][2] && blendState.colorMaskBlue,
+ key.rtChannels[i][3] && blendState.colorMaskAlpha);
}
ID3D11BlendState *dx11BlendState = NULL;
@@ -154,7 +186,7 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
return NULL;
}
- mBlendStateCache.insert(std::make_pair(blendState, std::make_pair(dx11BlendState, mCounter++)));
+ mBlendStateCache.insert(std::make_pair(key, std::make_pair(dx11BlendState, mCounter++)));
return dx11BlendState;
}
@@ -404,4 +436,4 @@ ID3D11SamplerState *RenderStateCache::getSamplerState(const gl::SamplerState &sa
}
}
-} \ No newline at end of file
+}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.h
index f8b5111de4..b4b871a4bd 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.h
@@ -13,6 +13,11 @@
#include "libGLESv2/angletypes.h"
#include "common/angleutils.h"
+namespace gl
+{
+class Framebuffer;
+}
+
namespace rx
{
@@ -26,7 +31,7 @@ class RenderStateCache
void clear();
// Increments refcount on the returned blend state, Release() must be called.
- ID3D11BlendState *getBlendState(const gl::BlendState &blendState);
+ ID3D11BlendState *getBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState);
ID3D11RasterizerState *getRasterizerState(const gl::RasterizerState &rasterState,
bool scissorEnabled, unsigned int depthSize);
ID3D11DepthStencilState *getDepthStencilState(const gl::DepthStencilState &dsState);
@@ -38,14 +43,19 @@ class RenderStateCache
unsigned long long mCounter;
// Blend state cache
- static std::size_t hashBlendState(const gl::BlendState &blendState);
- static bool compareBlendStates(const gl::BlendState &a, const gl::BlendState &b);
+ struct BlendStateKey
+ {
+ gl::BlendState blendState;
+ bool rtChannels[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT][4];
+ };
+ static std::size_t hashBlendState(const BlendStateKey &blendState);
+ static bool compareBlendStates(const BlendStateKey &a, const BlendStateKey &b);
static const unsigned int kMaxBlendStates;
- typedef std::size_t (*BlendStateHashFunction)(const gl::BlendState &);
- typedef bool (*BlendStateEqualityFunction)(const gl::BlendState &, const gl::BlendState &);
+ typedef std::size_t (*BlendStateHashFunction)(const BlendStateKey &);
+ typedef bool (*BlendStateEqualityFunction)(const BlendStateKey &, const BlendStateKey &);
typedef std::pair<ID3D11BlendState*, unsigned long long> BlendStateCounterPair;
- typedef std::unordered_map<gl::BlendState, BlendStateCounterPair, BlendStateHashFunction, BlendStateEqualityFunction> BlendStateMap;
+ typedef std::unordered_map<BlendStateKey, BlendStateCounterPair, BlendStateHashFunction, BlendStateEqualityFunction> BlendStateMap;
BlendStateMap mBlendStateCache;
// Rasterizer state cache
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp
index 2667cc6fa7..3707097aa4 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp
@@ -8,10 +8,10 @@
// RenderTarget11.cpp: Implements a DX11-specific wrapper for ID3D11View pointers
// retained by Renderbuffers.
-#include "libGLESv2/renderer/RenderTarget11.h"
-#include "libGLESv2/renderer/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/RenderTarget11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
#include "libGLESv2/main.h"
namespace rx
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.h
index 97827f2639..97827f2639 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp
index f83e9e91ce..31d976dec4 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp
@@ -12,31 +12,31 @@
#include "libGLESv2/Buffer.h"
#include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/Framebuffer.h"
-#include "libGLESv2/RenderBuffer.h"
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/renderer/RenderTarget11.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
-#include "libGLESv2/renderer/ShaderExecutable11.h"
-#include "libGLESv2/renderer/SwapChain11.h"
-#include "libGLESv2/renderer/Image11.h"
-#include "libGLESv2/renderer/VertexBuffer11.h"
-#include "libGLESv2/renderer/IndexBuffer11.h"
-#include "libGLESv2/renderer/BufferStorage11.h"
+#include "libGLESv2/Renderbuffer.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/RenderTarget11.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/ShaderExecutable11.h"
+#include "libGLESv2/renderer/d3d11/SwapChain11.h"
+#include "libGLESv2/renderer/d3d11/Image11.h"
+#include "libGLESv2/renderer/d3d11/VertexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/IndexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/BufferStorage11.h"
#include "libGLESv2/renderer/VertexDataManager.h"
#include "libGLESv2/renderer/IndexDataManager.h"
-#include "libGLESv2/renderer/TextureStorage11.h"
-#include "libGLESv2/renderer/Query11.h"
-#include "libGLESv2/renderer/Fence11.h"
+#include "libGLESv2/renderer/d3d11/TextureStorage11.h"
+#include "libGLESv2/renderer/d3d11/Query11.h"
+#include "libGLESv2/renderer/d3d11/Fence11.h"
-#include "libGLESv2/renderer/shaders/compiled/passthrough11vs.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughrgba11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughrgb11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughlum11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughlumalpha11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthrough11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/clear11vs.h"
-#include "libGLESv2/renderer/shaders/compiled/clearsingle11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/clearmultiple11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/clear11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/clearsingle11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/clearmultiple11ps.h"
#include "libEGL/Display.h"
@@ -66,7 +66,7 @@ enum
MAX_TEXTURE_IMAGE_UNITS_VTF_SM4 = 16
};
-Renderer11::Renderer11(egl::Display *display, HDC hDc) : Renderer(display), mDc(hDc)
+Renderer11::Renderer11(egl::Display *display) : Renderer(display)
{
mVertexDataManager = NULL;
mIndexDataManager = NULL;
@@ -147,6 +147,7 @@ EGLint Renderer11::initialize()
return EGL_NOT_INITIALIZED;
}
+
// create the D3D11 device
ASSERT(mDevice == NULL);
PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(mD3d11Module, "D3D11CreateDevice");
@@ -160,13 +161,14 @@ EGLint Renderer11::initialize()
D3D_FEATURE_LEVEL featureLevels[] =
{
- D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
+#if !defined(ANGLE_ENABLE_D3D9)
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1,
+#endif
};
HRESULT result = S_OK;
@@ -253,8 +255,6 @@ EGLint Renderer11::initialize()
{
D3D11_MESSAGE_ID hideMessages[] =
{
- D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD,
- D3D11_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD,
D3D11_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET
};
@@ -670,7 +670,7 @@ void Renderer11::setRasterizerState(const gl::RasterizerState &rasterState)
mForceSetRasterState = false;
}
-void Renderer11::setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
+void Renderer11::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
unsigned int sampleMask)
{
if (mForceSetBlendState ||
@@ -678,7 +678,7 @@ void Renderer11::setBlendState(const gl::BlendState &blendState, const gl::Color
memcmp(&blendColor, &mCurBlendColor, sizeof(gl::Color)) != 0 ||
sampleMask != mCurSampleMask)
{
- ID3D11BlendState *dxBlendState = mStateCache.getBlendState(blendState);
+ ID3D11BlendState *dxBlendState = mStateCache.getBlendState(framebuffer, blendState);
if (!dxBlendState)
{
ERR("NULL blend state returned by RenderStateCache::getBlendState, setting the default "
@@ -929,6 +929,25 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer)
renderTargetFormat = colorbuffer->getActualFormat();
missingColorRenderTarget = false;
}
+
+#ifdef _DEBUG
+ // Workaround for Debug SETSHADERRESOURCES_HAZARD D3D11 warnings
+ for (unsigned int vertexSerialIndex = 0; vertexSerialIndex < gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; vertexSerialIndex++)
+ {
+ if (colorbuffer->getTextureSerial() != 0 && mCurVertexTextureSerials[vertexSerialIndex] == colorbuffer->getTextureSerial())
+ {
+ setTexture(gl::SAMPLER_VERTEX, vertexSerialIndex, NULL);
+ }
+ }
+
+ for (unsigned int pixelSerialIndex = 0; pixelSerialIndex < gl::MAX_TEXTURE_IMAGE_UNITS; pixelSerialIndex++)
+ {
+ if (colorbuffer->getTextureSerial() != 0 && mCurPixelTextureSerials[pixelSerialIndex] == colorbuffer->getTextureSerial())
+ {
+ setTexture(gl::SAMPLER_PIXEL, pixelSerialIndex, NULL);
+ }
+ }
+#endif
}
}
@@ -1056,7 +1075,7 @@ GLenum Renderer11::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementAr
BufferStorage11 *storage = BufferStorage11::makeBufferStorage11(indexInfo->storage);
IndexBuffer11* indexBuffer = IndexBuffer11::makeIndexBuffer11(indexInfo->indexBuffer);
- mDeviceContext->IASetIndexBuffer(storage->getBuffer(), indexBuffer->getIndexFormat(), indexInfo->startOffset);
+ mDeviceContext->IASetIndexBuffer(storage->getBuffer(BUFFER_USAGE_INDEX), indexBuffer->getIndexFormat(), indexInfo->startOffset);
mAppliedIBSerial = 0;
mAppliedStorageIBSerial = storage->getSerial();
@@ -1118,43 +1137,6 @@ void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLv
}
}
-template <typename T>
-static void drawLineLoopIndexed(T *data, GLenum type, const GLvoid *indices, GLsizei count)
-{
- 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();
- }
-}
-
void Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer)
{
// Get the raw indices for an indexed draw
@@ -1203,71 +1185,59 @@ void Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
return gl::error(GL_OUT_OF_MEMORY);
}
- if (get32BitIndexSupport())
- drawLineLoopIndexed(reinterpret_cast<unsigned int*>(mappedMemory), type, indices, count);
- else
- drawLineLoopIndexed(reinterpret_cast<unsigned short*>(mappedMemory), type, indices, count);
-
+ unsigned int *data = reinterpret_cast<unsigned int*>(mappedMemory);
unsigned int indexBufferOffset = offset;
- if (!mLineLoopIB->unmapBuffer())
- {
- ERR("Could not unmap index buffer for GL_LINE_LOOP.");
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- if (mAppliedIBSerial != mLineLoopIB->getSerial() || mAppliedIBOffset != indexBufferOffset)
- {
- IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mLineLoopIB->getIndexBuffer());
-
- mDeviceContext->IASetIndexBuffer(indexBuffer->getBuffer(), indexBuffer->getIndexFormat(), indexBufferOffset);
- mAppliedIBSerial = mLineLoopIB->getSerial();
- mAppliedStorageIBSerial = 0;
- mAppliedIBOffset = indexBufferOffset;
- }
-
- mDeviceContext->DrawIndexed(count + 1, 0, -minIndex);
-}
-
-template <typename T>
-static void drawTriangleFanIndexed(T *data, GLenum type, const GLvoid *indices, unsigned int numTris)
-{
switch (type)
{
case GL_NONE: // Non-indexed draw
- for (unsigned int i = 0; i < numTris; i++)
+ for (int i = 0; i < count; i++)
{
- data[i*3 + 0] = 0;
- data[i*3 + 1] = i + 1;
- data[i*3 + 2] = i + 2;
+ data[i] = i;
}
+ data[count] = 0;
break;
case GL_UNSIGNED_BYTE:
- for (unsigned int i = 0; i < numTris; i++)
+ for (int i = 0; i < count; i++)
{
- data[i*3 + 0] = static_cast<const GLubyte*>(indices)[0];
- data[i*3 + 1] = static_cast<const GLubyte*>(indices)[i + 1];
- data[i*3 + 2] = static_cast<const GLubyte*>(indices)[i + 2];
+ data[i] = static_cast<const GLubyte*>(indices)[i];
}
+ data[count] = static_cast<const GLubyte*>(indices)[0];
break;
case GL_UNSIGNED_SHORT:
- for (unsigned int i = 0; i < numTris; i++)
+ for (int i = 0; i < count; i++)
{
- data[i*3 + 0] = static_cast<const GLushort*>(indices)[0];
- data[i*3 + 1] = static_cast<const GLushort*>(indices)[i + 1];
- data[i*3 + 2] = static_cast<const GLushort*>(indices)[i + 2];
+ data[i] = static_cast<const GLushort*>(indices)[i];
}
+ data[count] = static_cast<const GLushort*>(indices)[0];
break;
case GL_UNSIGNED_INT:
- for (unsigned int i = 0; i < numTris; i++)
+ for (int i = 0; i < count; i++)
{
- data[i*3 + 0] = static_cast<const GLuint*>(indices)[0];
- data[i*3 + 1] = static_cast<const GLuint*>(indices)[i + 1];
- data[i*3 + 2] = static_cast<const GLuint*>(indices)[i + 2];
+ data[i] = static_cast<const GLuint*>(indices)[i];
}
+ data[count] = static_cast<const GLuint*>(indices)[0];
break;
default: UNREACHABLE();
}
+
+ if (!mLineLoopIB->unmapBuffer())
+ {
+ ERR("Could not unmap index buffer for GL_LINE_LOOP.");
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ if (mAppliedIBSerial != mLineLoopIB->getSerial() || mAppliedIBOffset != indexBufferOffset)
+ {
+ IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mLineLoopIB->getIndexBuffer());
+
+ mDeviceContext->IASetIndexBuffer(indexBuffer->getBuffer(), indexBuffer->getIndexFormat(), indexBufferOffset);
+ mAppliedIBSerial = mLineLoopIB->getSerial();
+ mAppliedStorageIBSerial = 0;
+ mAppliedIBOffset = indexBufferOffset;
+ }
+
+ mDeviceContext->DrawIndexed(count + 1, 0, -minIndex);
}
void Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer, int instances)
@@ -1320,13 +1290,46 @@ void Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indic
return gl::error(GL_OUT_OF_MEMORY);
}
- if (get32BitIndexSupport())
- drawTriangleFanIndexed(reinterpret_cast<unsigned int*>(mappedMemory), type, indices, numTris);
- else
- drawTriangleFanIndexed(reinterpret_cast<unsigned short*>(mappedMemory), type, indices, numTris);
-
+ unsigned int *data = reinterpret_cast<unsigned int*>(mappedMemory);
unsigned int indexBufferOffset = offset;
+ switch (type)
+ {
+ case GL_NONE: // Non-indexed draw
+ for (unsigned int i = 0; i < numTris; i++)
+ {
+ data[i*3 + 0] = 0;
+ data[i*3 + 1] = i + 1;
+ data[i*3 + 2] = i + 2;
+ }
+ break;
+ case GL_UNSIGNED_BYTE:
+ for (unsigned int i = 0; i < numTris; i++)
+ {
+ data[i*3 + 0] = static_cast<const GLubyte*>(indices)[0];
+ data[i*3 + 1] = static_cast<const GLubyte*>(indices)[i + 1];
+ data[i*3 + 2] = static_cast<const GLubyte*>(indices)[i + 2];
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ for (unsigned int i = 0; i < numTris; i++)
+ {
+ data[i*3 + 0] = static_cast<const GLushort*>(indices)[0];
+ data[i*3 + 1] = static_cast<const GLushort*>(indices)[i + 1];
+ data[i*3 + 2] = static_cast<const GLushort*>(indices)[i + 2];
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ for (unsigned int i = 0; i < numTris; i++)
+ {
+ data[i*3 + 0] = static_cast<const GLuint*>(indices)[0];
+ data[i*3 + 1] = static_cast<const GLuint*>(indices)[i + 1];
+ data[i*3 + 2] = static_cast<const GLuint*>(indices)[i + 2];
+ }
+ break;
+ default: UNREACHABLE();
+ }
+
if (!mTriangleFanIB->unmapBuffer())
{
ERR("Could not unmap scratch index buffer for GL_TRIANGLE_FAN.");
@@ -1544,10 +1547,14 @@ void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArra
void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
{
- bool alphaUnmasked = (gl::GetAlphaSize(mRenderTargetDesc.format) == 0) || clearParams.colorMaskAlpha;
+ gl::Renderbuffer *firstRenderbuffer = frameBuffer->getFirstColorbuffer();
+ GLenum internalFormat = firstRenderbuffer ? firstRenderbuffer->getInternalFormat() : GL_NONE;
+
bool needMaskedColorClear = (clearParams.mask & GL_COLOR_BUFFER_BIT) &&
- !(clearParams.colorMaskRed && clearParams.colorMaskGreen &&
- clearParams.colorMaskBlue && alphaUnmasked);
+ ((!clearParams.colorMaskRed && gl::GetRedSize(internalFormat) > 0) ||
+ (!clearParams.colorMaskGreen && gl::GetGreenSize(internalFormat) > 0) ||
+ (!clearParams.colorMaskBlue && gl::GetBlueSize(internalFormat) > 0) ||
+ (!clearParams.colorMaskAlpha && gl::GetAlphaSize(internalFormat) > 0));
unsigned int stencilUnmasked = 0x0;
if (frameBuffer->hasStencil())
@@ -1564,7 +1571,7 @@ void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *
if (needMaskedColorClear || needMaskedStencilClear || needScissoredClear)
{
- maskedClear(clearParams, frameBuffer->usingExtendedDrawBuffers());
+ maskedClear(clearParams, frameBuffer);
}
else
{
@@ -1591,10 +1598,12 @@ void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *
return;
}
- const float clearValues[4] = { clearParams.colorClearValue.red,
- clearParams.colorClearValue.green,
- clearParams.colorClearValue.blue,
- clearParams.colorClearValue.alpha };
+ GLenum format = renderbufferObject->getInternalFormat();
+
+ const float clearValues[4] = { (gl::GetRedSize(format) > 0) ? clearParams.colorClearValue.red : 0.0f,
+ (gl::GetGreenSize(format) > 0) ? clearParams.colorClearValue.green : 0.0f,
+ (gl::GetBlueSize(format) > 0) ? clearParams.colorClearValue.blue : 0.0f,
+ (gl::GetAlphaSize(format) > 0) ? clearParams.colorClearValue.alpha : 1.0f };
mDeviceContext->ClearRenderTargetView(framebufferRTV, clearValues);
}
}
@@ -1638,7 +1647,7 @@ void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *
}
}
-void Renderer11::maskedClear(const gl::ClearParameters &clearParams, bool usingExtendedDrawBuffers)
+void Renderer11::maskedClear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
{
HRESULT result;
@@ -1758,7 +1767,7 @@ void Renderer11::maskedClear(const gl::ClearParameters &clearParams, bool usingE
static const float blendFactors[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
static const UINT sampleMask = 0xFFFFFFFF;
- ID3D11BlendState *blendState = mStateCache.getBlendState(glBlendState);
+ ID3D11BlendState *blendState = mStateCache.getBlendState(frameBuffer, glBlendState);
// Set the vertices
D3D11_MAPPED_SUBRESOURCE mappedResource;
@@ -1785,7 +1794,7 @@ void Renderer11::maskedClear(const gl::ClearParameters &clearParams, bool usingE
mDeviceContext->RSSetState(mScissorEnabled ? mClearScissorRS : mClearNoScissorRS);
// Apply shaders
- ID3D11PixelShader *pixelShader = usingExtendedDrawBuffers ? mClearMultiplePS : mClearSinglePS;
+ ID3D11PixelShader *pixelShader = frameBuffer->usingExtendedDrawBuffers() ? mClearMultiplePS : mClearSinglePS;
mDeviceContext->IASetInputLayout(mClearIL);
mDeviceContext->VSSetShader(mClearVS, NULL, 0);
@@ -1949,13 +1958,14 @@ bool Renderer11::testDeviceResettable()
D3D_FEATURE_LEVEL featureLevels[] =
{
- D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
+#if !defined(ANGLE_ENABLE_D3D9)
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1,
+#endif
};
ID3D11Device* dummyDevice;
@@ -2134,7 +2144,6 @@ float Renderer11::getTextureMaxAnisotropy() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
return D3D11_MAX_MAXANISOTROPY;
case D3D_FEATURE_LEVEL_10_1:
@@ -2159,7 +2168,6 @@ Range Renderer11::getViewportBounds() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
return Range(D3D11_VIEWPORT_BOUNDS_MIN, D3D11_VIEWPORT_BOUNDS_MAX);
case D3D_FEATURE_LEVEL_10_1:
@@ -2180,7 +2188,6 @@ unsigned int Renderer11::getMaxVertexTextureImageUnits() const
META_ASSERT(MAX_TEXTURE_IMAGE_UNITS_VTF_SM4 <= gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS);
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
@@ -2212,41 +2219,15 @@ unsigned int Renderer11::getReservedFragmentUniformVectors() const
unsigned int Renderer11::getMaxVertexUniformVectors() const
{
META_ASSERT(MAX_VERTEX_UNIFORM_VECTORS_D3D11 <= D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT);
- switch (mFeatureLevel)
- {
- 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 MAX_VERTEX_UNIFORM_VECTORS_D3D11;
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return MAX_VERTEX_UNIFORM_VECTORS_D3D9;
- default:
- UNIMPLEMENTED();
- return 0;
- }
+ ASSERT(mFeatureLevel >= D3D_FEATURE_LEVEL_9_1);
+ return MAX_VERTEX_UNIFORM_VECTORS_D3D11;
}
unsigned int Renderer11::getMaxFragmentUniformVectors() const
{
META_ASSERT(MAX_FRAGMENT_UNIFORM_VECTORS_D3D11 <= D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT);
- switch (mFeatureLevel)
- {
- 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 MAX_FRAGMENT_UNIFORM_VECTORS_D3D11;
- case D3D_FEATURE_LEVEL_9_3:
- return 221;
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 29;
- default: UNREACHABLE();
- return 0;
- }
+ ASSERT(mFeatureLevel >= D3D_FEATURE_LEVEL_9_1);
+ return MAX_FRAGMENT_UNIFORM_VECTORS_D3D11;
}
unsigned int Renderer11::getMaxVaryingVectors() const
@@ -2254,11 +2235,9 @@ unsigned int Renderer11::getMaxVaryingVectors() const
META_ASSERT(gl::IMPLEMENTATION_MAX_VARYING_VECTORS == D3D11_VS_OUTPUT_REGISTER_COUNT);
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
return D3D11_VS_OUTPUT_REGISTER_COUNT;
case D3D_FEATURE_LEVEL_10_1:
- return D3D10_1_VS_OUTPUT_REGISTER_COUNT;
case D3D_FEATURE_LEVEL_10_0:
return D3D10_VS_OUTPUT_REGISTER_COUNT;
case D3D_FEATURE_LEVEL_9_3:
@@ -2274,7 +2253,6 @@ bool Renderer11::getNonPower2TextureSupport() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
@@ -2292,10 +2270,10 @@ bool Renderer11::getOcclusionQuerySupport() const
{
switch (mFeatureLevel)
{
- 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:
return true;
@@ -2310,12 +2288,11 @@ bool Renderer11::getInstancingSupport() const
{
switch (mFeatureLevel)
{
- 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;
+ return true;
case D3D_FEATURE_LEVEL_9_2:
case D3D_FEATURE_LEVEL_9_1:
return false;
@@ -2336,10 +2313,10 @@ bool Renderer11::getDerivativeInstructionSupport() const
{
switch (mFeatureLevel)
{
- 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:
return true;
case D3D_FEATURE_LEVEL_9_2:
@@ -2360,13 +2337,12 @@ int Renderer11::getMajorShaderModel() const
{
switch (mFeatureLevel)
{
- 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:
case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1: return 4; // SM4 level 9, but treat as 4
+ case D3D_FEATURE_LEVEL_9_1: return D3D10_SHADER_MAJOR_VERSION; // 4 (level 9)
default: UNREACHABLE(); return 0;
}
}
@@ -2375,13 +2351,12 @@ int Renderer11::getMinorShaderModel() const
{
switch (mFeatureLevel)
{
- 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:
case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1: return 0;
+ case D3D_FEATURE_LEVEL_9_1: return D3D10_SHADER_MINOR_VERSION; // 0 (level 9)
default: UNREACHABLE(); return 0;
}
}
@@ -2402,8 +2377,7 @@ int Renderer11::getMaxViewportDimension() const
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_11_0:
return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
@@ -2422,7 +2396,6 @@ int Renderer11::getMaxTextureWidth() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192
@@ -2437,7 +2410,6 @@ int Renderer11::getMaxTextureHeight() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192
@@ -2452,8 +2424,7 @@ bool Renderer11::get32BitIndexSupport() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_11_0:
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP >= 32; // true
case D3D_FEATURE_LEVEL_9_3:
@@ -2510,17 +2481,17 @@ unsigned int Renderer11::getMaxRenderTargets() const
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
return D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; // 8
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
- return D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; // 8
- case D3D_FEATURE_LEVEL_9_3:
- return D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT; // 4
+ case D3D_FEATURE_LEVEL_9_3: // return D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT; // 4
case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT; // 1
+ case D3D_FEATURE_LEVEL_9_1: // return D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT; // 1
+ // Feature level 10.0 and 10.1 cards perform very poorly when the pixel shader
+ // outputs to multiple RTs that are not bound.
+ // TODO: Remove pixel shader outputs for render targets that are not bound.
+ return 1;
default:
UNREACHABLE();
return 1;
@@ -2703,7 +2674,7 @@ bool Renderer11::copyTexture(ID3D11ShaderResourceView *source, const gl::Rectang
samplerDesc.BorderColor[2] = 0.0f;
samplerDesc.BorderColor[3] = 0.0f;
samplerDesc.MinLOD = 0.0f;
- samplerDesc.MaxLOD = 0.0f;
+ samplerDesc.MaxLOD = mDevice->GetFeatureLevel() >= D3D_FEATURE_LEVEL_10_0 ? 0.0f : FLT_MAX;
result = mDevice->CreateSamplerState(&samplerDesc, &mCopySampler);
ASSERT(SUCCEEDED(result));
@@ -2946,7 +2917,7 @@ ShaderExecutable *Renderer11::loadExecutable(const void *function, size_t length
return executable;
}
-ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type)
+ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround)
{
std::string profile;
@@ -3124,7 +3095,7 @@ void Renderer11::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsi
area.width = width;
area.height = height;
- readTextureData(colorBufferTexture, subresourceIndex, area, format, type, outputPitch,
+ readTextureData(colorBufferTexture, subresourceIndex, area, colorbuffer->getActualFormat(), format, type, outputPitch,
packReverseRowOrder, packAlignment, pixels);
colorBufferTexture->Release();
@@ -3160,7 +3131,7 @@ TextureStorage *Renderer11::createTextureStorageCube(int levels, GLenum internal
return new TextureStorage11_Cube(this, levels, internalformat, usage, forceRenderable, size);
}
-static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum destFormat, GLenum destType)
+static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum sourceGLFormat, GLenum destFormat, GLenum destType)
{
if (sourceFormat == DXGI_FORMAT_A8_UNORM &&
destFormat == GL_ALPHA &&
@@ -3168,9 +3139,10 @@ static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum
{
return 1;
}
- else if (sourceFormat == DXGI_FORMAT_R8G8B8A8_UNORM &&
- destFormat == GL_RGBA &&
- destType == GL_UNSIGNED_BYTE)
+ else if (sourceFormat == DXGI_FORMAT_R8G8B8A8_UNORM &&
+ sourceGLFormat == GL_RGBA8_OES &&
+ destFormat == GL_RGBA &&
+ destType == GL_UNSIGNED_BYTE)
{
return 4;
}
@@ -3180,9 +3152,10 @@ static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum
{
return 4;
}
- else if (sourceFormat == DXGI_FORMAT_R16G16B16A16_FLOAT &&
- destFormat == GL_RGBA &&
- destType == GL_HALF_FLOAT_OES)
+ else if (sourceFormat == DXGI_FORMAT_R16G16B16A16_FLOAT &&
+ sourceGLFormat == GL_RGBA16F_EXT &&
+ destFormat == GL_RGBA &&
+ destType == GL_HALF_FLOAT_OES)
{
return 8;
}
@@ -3192,9 +3165,10 @@ static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum
{
return 12;
}
- else if (sourceFormat == DXGI_FORMAT_R32G32B32A32_FLOAT &&
- destFormat == GL_RGBA &&
- destType == GL_FLOAT)
+ else if (sourceFormat == DXGI_FORMAT_R32G32B32A32_FLOAT &&
+ sourceGLFormat == GL_RGBA32F_EXT &&
+ destFormat == GL_RGBA &&
+ destType == GL_FLOAT)
{
return 16;
}
@@ -3204,7 +3178,7 @@ static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum
}
}
-static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format, unsigned int x,
+static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format, GLenum glFormat, unsigned int x,
unsigned int y, int inputPitch, gl::Color *outColor)
{
switch (format)
@@ -3215,7 +3189,15 @@ static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format,
outColor->red = (rgba & 0x000000FF) * (1.0f / 0x000000FF);
outColor->green = (rgba & 0x0000FF00) * (1.0f / 0x0000FF00);
outColor->blue = (rgba & 0x00FF0000) * (1.0f / 0x00FF0000);
- outColor->alpha = (rgba & 0xFF000000) * (1.0f / 0xFF000000);
+
+ if (gl::GetAlphaSize(glFormat) > 0)
+ {
+ outColor->alpha = (rgba & 0xFF000000) * (1.0f / 0xFF000000);
+ }
+ else
+ {
+ outColor->alpha = 1.0f;
+ }
}
break;
@@ -3233,7 +3215,15 @@ static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format,
outColor->red = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 0);
outColor->green = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 1);
outColor->blue = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 2);
- outColor->alpha = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 3);
+
+ if (gl::GetAlphaSize(glFormat) > 0)
+ {
+ outColor->alpha = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 3);
+ }
+ else
+ {
+ outColor->alpha = 1.0f;
+ }
}
break;
@@ -3251,7 +3241,15 @@ static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format,
outColor->red = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 0));
outColor->green = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 1));
outColor->blue = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 2));
- outColor->alpha = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 3));
+
+ if (gl::GetAlphaSize(glFormat) > 0)
+ {
+ outColor->alpha = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 3));
+ }
+ else
+ {
+ outColor->alpha = 1.0f;
+ }
}
break;
@@ -3413,7 +3411,7 @@ static inline void writePixelColor(const gl::Color &color, GLenum format, GLenum
}
void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area,
- GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
+ GLenum sourceFormat, GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
GLint packAlignment, void *pixels)
{
D3D11_TEXTURE2D_DESC textureDesc;
@@ -3502,7 +3500,7 @@ void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResou
inputPitch = static_cast<int>(mapping.RowPitch);
}
- unsigned int fastPixelSize = getFastPixelCopySize(textureDesc.Format, format, type);
+ unsigned int fastPixelSize = getFastPixelCopySize(textureDesc.Format, sourceFormat, format, type);
if (fastPixelSize != 0)
{
unsigned char *dest = static_cast<unsigned char*>(pixels);
@@ -3537,7 +3535,7 @@ void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResou
{
for (int i = 0; i < area.width; i++)
{
- readPixelColor(source, textureDesc.Format, i, j, inputPitch, &pixelColor);
+ readPixelColor(source, textureDesc.Format, sourceFormat, i, j, inputPitch, &pixelColor);
writePixelColor(pixelColor, format, type, i, j, outputPitch, pixels);
}
}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h
index 433945da7a..a8a722c56c 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h
@@ -14,8 +14,8 @@
#include "libGLESv2/mathutil.h"
#include "libGLESv2/renderer/Renderer.h"
-#include "libGLESv2/renderer/RenderStateCache.h"
-#include "libGLESv2/renderer/InputLayoutCache.h"
+#include "libGLESv2/renderer/d3d11/RenderStateCache.h"
+#include "libGLESv2/renderer/d3d11/InputLayoutCache.h"
#include "libGLESv2/renderer/RenderTarget.h"
namespace gl
@@ -32,7 +32,6 @@ class StreamingIndexBufferInterface;
enum
{
- MAX_VERTEX_UNIFORM_VECTORS_D3D9 = 254,
MAX_VERTEX_UNIFORM_VECTORS_D3D11 = 1024,
MAX_FRAGMENT_UNIFORM_VECTORS_D3D11 = 1024
};
@@ -40,7 +39,7 @@ enum
class Renderer11 : public Renderer
{
public:
- Renderer11(egl::Display *display, HDC hDc);
+ Renderer11(egl::Display *display);
virtual ~Renderer11();
static Renderer11 *makeRenderer11(Renderer *renderer);
@@ -59,7 +58,7 @@ class Renderer11 : public Renderer
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture);
virtual void setRasterizerState(const gl::RasterizerState &rasterState);
- virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
+ virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
unsigned int sampleMask);
virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
int stencilBackRef, bool frontFaceCCW);
@@ -156,7 +155,7 @@ class Renderer11 : public Renderer
// Shader operations
virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type);
- virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type);
+ virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround);
// Image operations
virtual Image *createImage();
@@ -178,7 +177,7 @@ class Renderer11 : public Renderer
ID3D11Device *getDevice() { return mDevice; }
ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; };
IDXGIFactory *getDxgiFactory() { return mDxgiFactory; };
- D3D_FEATURE_LEVEL getFeatureLevel() const { return mFeatureLevel; }
+ D3D_FEATURE_LEVEL getFeatureLevel() { return mFeatureLevel; }
bool getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource);
void unapplyRenderTargets();
@@ -193,10 +192,10 @@ class Renderer11 : public Renderer
void drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer, int instances);
void readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area,
- GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
+ GLenum sourceFormat, GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
GLint packAlignment, void *pixels);
- void maskedClear(const gl::ClearParameters &clearParams, bool usingExtendedDrawBuffers);
+ void maskedClear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
rx::Range getViewportBounds() const;
bool blitRenderbufferRect(const gl::Rectangle &readRect, const gl::Rectangle &drawRect, RenderTarget *readRenderTarget,
@@ -205,7 +204,6 @@ class Renderer11 : public Renderer
HMODULE mD3d11Module;
HMODULE mDxgiModule;
- HDC mDc;
bool mDeviceLost;
@@ -237,7 +235,7 @@ class Renderer11 : public Renderer
unsigned int qualityLevels[D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT];
};
- typedef std::unordered_map<DXGI_FORMAT, MultisampleSupportInfo> MultisampleSupportMap;
+ typedef std::unordered_map<DXGI_FORMAT, MultisampleSupportInfo, std::hash<int> > MultisampleSupportMap;
MultisampleSupportMap mMultisampleSupportMap;
unsigned int mMaxSupportedSamples;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp
index e1eb560334..2e455e3af5 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp
@@ -8,7 +8,7 @@
// ShaderExecutable11.cpp: Implements a D3D11-specific class to contain shader
// executable implementation details.
-#include "libGLESv2/renderer/ShaderExecutable11.h"
+#include "libGLESv2/renderer/d3d11/ShaderExecutable11.h"
#include "common/debug.h"
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h
index c6ec1cf7d2..c6ec1cf7d2 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp
index 2fe15ff5b8..bd97d5cff5 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp
@@ -7,12 +7,13 @@
// SwapChain11.cpp: Implements a back-end specific class for the D3D11 swap chain.
-#include "libGLESv2/renderer/SwapChain11.h"
+#include "libGLESv2/renderer/d3d11/SwapChain11.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/renderer/shaders/compiled/passthrough11vs.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughrgba11ps.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthrough11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba11ps.h"
namespace rx
{
@@ -48,83 +49,19 @@ SwapChain11::~SwapChain11()
void SwapChain11::release()
{
- if (mSwapChain)
- {
- mSwapChain->Release();
- mSwapChain = NULL;
- }
-
- if (mBackBufferTexture)
- {
- mBackBufferTexture->Release();
- mBackBufferTexture = NULL;
- }
-
- if (mBackBufferRTView)
- {
- mBackBufferRTView->Release();
- mBackBufferRTView = NULL;
- }
-
- if (mOffscreenTexture)
- {
- mOffscreenTexture->Release();
- mOffscreenTexture = NULL;
- }
-
- if (mOffscreenRTView)
- {
- mOffscreenRTView->Release();
- mOffscreenRTView = NULL;
- }
-
- if (mOffscreenSRView)
- {
- mOffscreenSRView->Release();
- mOffscreenSRView = NULL;
- }
-
- if (mDepthStencilTexture)
- {
- mDepthStencilTexture->Release();
- mDepthStencilTexture = NULL;
- }
-
- if (mDepthStencilDSView)
- {
- mDepthStencilDSView->Release();
- mDepthStencilDSView = NULL;
- }
-
- if (mQuadVB)
- {
- mQuadVB->Release();
- mQuadVB = NULL;
- }
-
- if (mPassThroughSampler)
- {
- mPassThroughSampler->Release();
- mPassThroughSampler = NULL;
- }
-
- if (mPassThroughIL)
- {
- mPassThroughIL->Release();
- mPassThroughIL = NULL;
- }
-
- if (mPassThroughVS)
- {
- mPassThroughVS->Release();
- mPassThroughVS = NULL;
- }
-
- if (mPassThroughPS)
- {
- mPassThroughPS->Release();
- mPassThroughPS = NULL;
- }
+ SafeRelease(mSwapChain);
+ SafeRelease(mBackBufferTexture);
+ SafeRelease(mBackBufferRTView);
+ SafeRelease(mOffscreenTexture);
+ SafeRelease(mOffscreenRTView);
+ SafeRelease(mOffscreenSRView);
+ SafeRelease(mDepthStencilTexture);
+ SafeRelease(mDepthStencilDSView);
+ SafeRelease(mQuadVB);
+ SafeRelease(mPassThroughSampler);
+ SafeRelease(mPassThroughIL);
+ SafeRelease(mPassThroughVS);
+ SafeRelease(mPassThroughPS);
if (!mAppCreatedShareHandle)
{
@@ -134,35 +71,11 @@ void SwapChain11::release()
void SwapChain11::releaseOffscreenTexture()
{
- if (mOffscreenTexture)
- {
- mOffscreenTexture->Release();
- mOffscreenTexture = NULL;
- }
-
- if (mOffscreenRTView)
- {
- mOffscreenRTView->Release();
- mOffscreenRTView = NULL;
- }
-
- if (mOffscreenSRView)
- {
- mOffscreenSRView->Release();
- mOffscreenSRView = NULL;
- }
-
- if (mDepthStencilTexture)
- {
- mDepthStencilTexture->Release();
- mDepthStencilTexture = NULL;
- }
-
- if (mDepthStencilDSView)
- {
- mDepthStencilDSView->Release();
- mDepthStencilDSView = NULL;
- }
+ SafeRelease(mOffscreenTexture);
+ SafeRelease(mOffscreenRTView);
+ SafeRelease(mOffscreenSRView);
+ SafeRelease(mDepthStencilTexture);
+ SafeRelease(mDepthStencilDSView);
}
EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHeight)
@@ -369,23 +282,17 @@ EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight)
return EGL_BAD_ACCESS;
}
- if (!mSwapChain)
- reset(backbufferWidth, backbufferHeight, mSwapInterval);
+ // EGL allows creating a surface with 0x0 dimension, however, DXGI does not like 0x0 swapchains
+ if (backbufferWidth < 1 || backbufferHeight < 1)
+ {
+ return EGL_SUCCESS;
+ }
// Can only call resize if we have already created our swap buffer and resources
ASSERT(mSwapChain && mBackBufferTexture && mBackBufferRTView);
- if (mBackBufferTexture)
- {
- mBackBufferTexture->Release();
- mBackBufferTexture = NULL;
- }
-
- if (mBackBufferRTView)
- {
- mBackBufferRTView->Release();
- mBackBufferRTView = NULL;
- }
+ SafeRelease(mBackBufferTexture);
+ SafeRelease(mBackBufferRTView);
// Resize swap chain
DXGI_FORMAT backbufferDXGIFormat = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
@@ -434,23 +341,9 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
// Release specific resources to free up memory for the new render target, while the
// old render target still exists for the purpose of preserving its contents.
- if (mSwapChain)
- {
- mSwapChain->Release();
- mSwapChain = NULL;
- }
-
- if (mBackBufferTexture)
- {
- mBackBufferTexture->Release();
- mBackBufferTexture = NULL;
- }
-
- if (mBackBufferRTView)
- {
- mBackBufferRTView->Release();
- mBackBufferRTView = NULL;
- }
+ SafeRelease(mSwapChain);
+ SafeRelease(mBackBufferTexture);
+ SafeRelease(mBackBufferRTView);
mSwapInterval = static_cast<unsigned int>(swapInterval);
if (mSwapInterval > 4)
@@ -469,25 +362,13 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
if (mWindow)
{
#if !defined(ANGLE_OS_WINRT)
- // We cannot create a swap chain for an HWND that is owned by a different process
- DWORD currentProcessId = GetCurrentProcessId();
- DWORD wndProcessId;
- GetWindowThreadProcessId(mWindow, &wndProcessId);
-
- if (currentProcessId != wndProcessId)
- {
- ERR("Could not create swap chain, window owned by different process");
- release();
- return EGL_BAD_NATIVE_WINDOW;
- }
-
IDXGIFactory *factory = mRenderer->getDxgiFactory();
DXGI_SWAP_CHAIN_DESC swapChainDesc = {0};
- swapChainDesc.BufferCount = 2;
swapChainDesc.BufferDesc.Format = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
swapChainDesc.BufferDesc.Width = backbufferWidth;
swapChainDesc.BufferDesc.Height = backbufferHeight;
+ swapChainDesc.BufferCount = 2;
swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
swapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
@@ -512,7 +393,6 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
#endif
#endif
-
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.Flags = 0;
swapChainDesc.SampleDesc.Count = 1;
@@ -535,10 +415,28 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
{
return EGL_CONTEXT_LOST;
}
+#if !defined(ANGLE_OS_WINRT)
else
{
- return EGL_BAD_ALLOC;
+ // We cannot create a swap chain for an HWND that is owned by a different process on some versions of
+ // windows
+ DWORD currentProcessId = GetCurrentProcessId();
+ DWORD wndProcessId;
+ GetWindowThreadProcessId(mWindow, &wndProcessId);
+
+ if (currentProcessId != wndProcessId)
+ {
+ ERR("Could not create swap chain, window owned by different process");
+ return EGL_BAD_NATIVE_WINDOW;
+ }
+ else
+ {
+ return EGL_BAD_ALLOC;
+ }
}
+#else
+ return EGL_BAD_ALLOC;
+#endif
}
result = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mBackBufferTexture);
@@ -697,7 +595,12 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
// Draw
deviceContext->Draw(4, 0);
+
+#if ANGLE_FORCE_VSYNC_OFF
+ result = mSwapChain->Present(0, 0);
+#else
result = mSwapChain->Present(mSwapInterval, 0);
+#endif
if (result == DXGI_ERROR_DEVICE_REMOVED)
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h
index 2a030c839d..2a030c839d 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
index 32a407a988..fdfbe526ec 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
@@ -8,12 +8,12 @@
// 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 "libGLESv2/renderer/TextureStorage11.h"
+#include "libGLESv2/renderer/d3d11/TextureStorage11.h"
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/renderer/RenderTarget11.h"
-#include "libGLESv2/renderer/SwapChain11.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/RenderTarget11.h"
+#include "libGLESv2/renderer/d3d11/SwapChain11.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
#include "libGLESv2/utilities.h"
#include "libGLESv2/main.h"
@@ -229,7 +229,7 @@ TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, int levels, GLenum
mRenderTarget[i] = NULL;
}
- DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat, Renderer11::makeRenderer11(renderer)->getFeatureLevel());
+ DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat, mRenderer->getFeatureLevel());
if (d3d11::IsDepthStencilFormat(convertedFormat))
{
mTextureFormat = d3d11::GetDepthTextureFormat(convertedFormat);
@@ -331,7 +331,7 @@ RenderTarget *TextureStorage11_2D::getRenderTarget(int level)
srvDesc.Format = mShaderResourceFormat;
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
srvDesc.Texture2D.MostDetailedMip = level;
- srvDesc.Texture2D.MipLevels = 1;
+ srvDesc.Texture2D.MipLevels = level ? 1 : -1;
ID3D11ShaderResourceView *srv;
result = device->CreateShaderResourceView(mTexture, &srvDesc, &srv);
@@ -450,7 +450,7 @@ TextureStorage11_Cube::TextureStorage11_Cube(Renderer *renderer, int levels, GLe
}
}
- DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat, Renderer11::makeRenderer11(renderer)->getFeatureLevel());
+ DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat, mRenderer->getFeatureLevel());
if (d3d11::IsDepthStencilFormat(convertedFormat))
{
mTextureFormat = d3d11::GetDepthTextureFormat(convertedFormat);
@@ -549,7 +549,7 @@ RenderTarget *TextureStorage11_Cube::getRenderTarget(GLenum faceTarget, int leve
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
srvDesc.Format = mShaderResourceFormat;
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; // Will be used with Texture2D sampler, not TextureCube
srvDesc.Texture2DArray.MostDetailedMip = level;
srvDesc.Texture2DArray.MipLevels = 1;
srvDesc.Texture2DArray.FirstArraySlice = faceIdx;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.h
index 3c5ded05b8..3c5ded05b8 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp
index 521da80c3d..6f9b4181f1 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp
@@ -7,11 +7,11 @@
// VertexBuffer11.cpp: Defines the D3D11 VertexBuffer implementation.
-#include "libGLESv2/renderer/VertexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/VertexBuffer11.h"
#include "libGLESv2/renderer/BufferStorage.h"
#include "libGLESv2/Buffer.h"
-#include "libGLESv2/renderer/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
#include "libGLESv2/Context.h"
namespace rx
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.h
index eceb426e82..eceb426e82 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp
index 0624a61160..34b8259a80 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp
@@ -8,7 +8,7 @@
// renderer11_utils.cpp: Conversion functions and other utility routines
// specific to the D3D11 renderer.
-#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
#include "common/debug.h"
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h
index 70ad4fea2b..70ad4fea2b 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl
index cb132dc99c..cb132dc99c 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Passthrough11.hlsl b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough11.hlsl
index 43b7801efc..43b7801efc 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Passthrough11.hlsl
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough11.hlsl
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Blit.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.cpp
index 2a3ce39c63..d73df6418d 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Blit.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.cpp
@@ -7,23 +7,23 @@
// Blit.cpp: Surface copy utility class.
-#include "libGLESv2/renderer/Blit.h"
+#include "libGLESv2/renderer/d3d9/Blit.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/TextureStorage9.h"
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
#include "libGLESv2/Framebuffer.h"
#include "libGLESv2/Renderbuffer.h"
namespace
{
-#include "libGLESv2/renderer/shaders/compiled/standardvs.h"
-#include "libGLESv2/renderer/shaders/compiled/flipyvs.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughps.h"
-#include "libGLESv2/renderer/shaders/compiled/luminanceps.h"
-#include "libGLESv2/renderer/shaders/compiled/componentmaskps.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/standardvs.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/flipyvs.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/passthroughps.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/componentmaskps.h"
const BYTE* const g_shaderCode[] =
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Blit.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.h
index 3718028e66..3718028e66 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Blit.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp
index 57fd29bf80..9fdc1246f1 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp
@@ -7,7 +7,7 @@
// BufferStorage9.cpp Defines the BufferStorage9 class.
-#include "libGLESv2/renderer/BufferStorage9.h"
+#include "libGLESv2/renderer/d3d9/BufferStorage9.h"
#include "common/debug.h"
namespace rx
@@ -36,7 +36,7 @@ void *BufferStorage9::getData()
return mMemory;
}
-void BufferStorage9::setData(const void* data, unsigned int size, unsigned int offset, unsigned int)
+void BufferStorage9::setData(const void* data, unsigned int size, unsigned int offset)
{
if (!mMemory || offset + size > mAllocatedSize)
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.h
index 82ae577e23..3e803969bc 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.h
@@ -23,7 +23,7 @@ class BufferStorage9 : public BufferStorage
static BufferStorage9 *makeBufferStorage9(BufferStorage *bufferStorage);
virtual void *getData();
- virtual void setData(const void* data, unsigned int size, unsigned int offset, unsigned int target = 0);
+ virtual void setData(const void* data, unsigned int size, unsigned int offset);
virtual void clear();
virtual unsigned int getSize() const;
virtual bool supportsDirectBinding() const;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Fence9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Fence9.cpp
index 86064d7e52..639c37b4e4 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Fence9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Fence9.cpp
@@ -7,10 +7,10 @@
// Fence9.cpp: Defines the rx::Fence9 class.
-#include "libGLESv2/renderer/Fence9.h"
+#include "libGLESv2/renderer/d3d9/Fence9.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
namespace rx
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Fence9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Fence9.h
index 9f17641e51..9f17641e51 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Fence9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Fence9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Image9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.cpp
index 53030b7f1e..cd12d8cc9e 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Image9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.cpp
@@ -8,16 +8,16 @@
// Image9.cpp: Implements the rx::Image9 class, which acts as the interface to
// the actual underlying surfaces of a Texture.
-#include "libGLESv2/renderer/Image9.h"
+#include "libGLESv2/renderer/d3d9/Image9.h"
#include "libGLESv2/main.h"
#include "libGLESv2/Framebuffer.h"
#include "libGLESv2/Renderbuffer.h"
-#include "libGLESv2/renderer/Renderer9.h"
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/TextureStorage9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
#include "libGLESv2/renderer/generatemip.h"
namespace rx
@@ -733,4 +733,4 @@ void Image9::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
mDirty = true;
}
-} \ No newline at end of file
+}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Image9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.h
index 2fbbca3124..2fbbca3124 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Image9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp
index c6d83c5dca..7cb5d13a18 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp
@@ -7,8 +7,8 @@
// Indexffer9.cpp: Defines the D3D9 IndexBuffer implementation.
-#include "libGLESv2/renderer/IndexBuffer9.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/IndexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
namespace rx
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.h
index 6801867532..6801867532 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Query9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Query9.cpp
index ef694267dd..72781cbc39 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Query9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Query9.cpp
@@ -8,10 +8,10 @@
// Query9.cpp: Defines the rx::Query9 class which implements rx::QueryImpl.
-#include "libGLESv2/renderer/Query9.h"
+#include "libGLESv2/renderer/d3d9/Query9.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
namespace rx
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Query9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Query9.h
index 47eef89336..47eef89336 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Query9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Query9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp
index a84c709059..090431db99 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp
@@ -8,10 +8,10 @@
// RenderTarget9.cpp: Implements a D3D9-specific wrapper for IDirect3DSurface9
// pointers retained by renderbuffers.
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
#include "libGLESv2/main.h"
namespace rx
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.h
index faf8ad1c6d..faf8ad1c6d 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Renderer9.cpp
index d3f3814ae5..97a10d64bf 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Renderer9.cpp
@@ -14,19 +14,19 @@
#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/renderer/IndexDataManager.h"
-#include "libGLESv2/renderer/Renderer9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/ShaderExecutable9.h"
-#include "libGLESv2/renderer/SwapChain9.h"
-#include "libGLESv2/renderer/TextureStorage9.h"
-#include "libGLESv2/renderer/Image9.h"
-#include "libGLESv2/renderer/Blit.h"
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/VertexBuffer9.h"
-#include "libGLESv2/renderer/IndexBuffer9.h"
-#include "libGLESv2/renderer/BufferStorage9.h"
-#include "libGLESv2/renderer/Query9.h"
-#include "libGLESv2/renderer/Fence9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/ShaderExecutable9.h"
+#include "libGLESv2/renderer/d3d9/SwapChain9.h"
+#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
+#include "libGLESv2/renderer/d3d9/Image9.h"
+#include "libGLESv2/renderer/d3d9/Blit.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/VertexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/IndexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/BufferStorage9.h"
+#include "libGLESv2/renderer/d3d9/Query9.h"
+#include "libGLESv2/renderer/d3d9/Fence9.h"
#include "libEGL/Display.h"
@@ -121,8 +121,6 @@ Renderer9::Renderer9(egl::Display *display, HDC hDc, bool softwareDevice) : Rend
Renderer9::~Renderer9()
{
- releaseDeviceResources();
-
if (mDevice)
{
// If the device is lost, reset it first to prevent leaving the driver in an unstable state
@@ -130,22 +128,19 @@ Renderer9::~Renderer9()
{
resetDevice();
}
-
- mDevice->Release();
- mDevice = NULL;
}
- if (mDeviceEx)
- {
- mDeviceEx->Release();
- mDeviceEx = NULL;
- }
+ deinitialize();
+}
- if (mD3d9)
- {
- mD3d9->Release();
- mD3d9 = NULL;
- }
+void Renderer9::deinitialize()
+{
+ releaseDeviceResources();
+
+ SafeRelease(mDevice);
+ SafeRelease(mDeviceEx);
+ SafeRelease(mD3d9);
+ SafeRelease(mD3d9Ex);
if (mDeviceWindow)
{
@@ -153,12 +148,6 @@ Renderer9::~Renderer9()
mDeviceWindow = NULL;
}
- if (mD3d9Ex)
- {
- mD3d9Ex->Release();
- mD3d9Ex = NULL;
- }
-
if (mD3d9Module)
{
mD3d9Module = NULL;
@@ -863,7 +852,7 @@ void Renderer9::setRasterizerState(const gl::RasterizerState &rasterState)
mForceSetRasterState = false;
}
-void Renderer9::setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor, unsigned int sampleMask)
+void Renderer9::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor, unsigned int sampleMask)
{
bool blendStateChanged = mForceSetBlendState || memcmp(&blendState, &mCurBlendState, sizeof(gl::BlendState)) != 0;
bool blendColorChanged = mForceSetBlendState || memcmp(&blendColor, &mCurBlendColor, sizeof(gl::Color)) != 0;
@@ -1465,7 +1454,7 @@ void Renderer9::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvo
if (mode == GL_POINTS)
{
- drawIndexedPoints(count, type, indices, elementArrayBuffer);
+ drawIndexedPoints(count, type, indices, indexInfo.minIndex, elementArrayBuffer);
}
else if (mode == GL_LINE_LOOP)
{
@@ -1669,16 +1658,16 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
}
template <typename T>
-static void drawPoints(IDirect3DDevice9* device, GLsizei count, const GLvoid *indices)
+static void drawPoints(IDirect3DDevice9* device, GLsizei count, const GLvoid *indices, int minIndex)
{
for (int i = 0; i < count; i++)
{
- unsigned int indexValue = static_cast<unsigned int>(static_cast<const T*>(indices)[i]);
+ unsigned int indexValue = static_cast<unsigned int>(static_cast<const T*>(indices)[i]) - minIndex;
device->DrawPrimitive(D3DPT_POINTLIST, indexValue, 1);
}
}
-void Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer)
+void Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer)
{
// Drawing index point lists is unsupported in d3d9, fall back to a regular DrawPrimitive call
// for each individual point. This call is not expected to happen often.
@@ -1692,9 +1681,9 @@ void Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indi
switch (type)
{
- case GL_UNSIGNED_BYTE: drawPoints<GLubyte>(mDevice, count, indices); break;
- case GL_UNSIGNED_SHORT: drawPoints<GLushort>(mDevice, count, indices); break;
- case GL_UNSIGNED_INT: drawPoints<GLuint>(mDevice, count, indices); break;
+ case GL_UNSIGNED_BYTE: drawPoints<GLubyte>(mDevice, count, indices, minIndex); break;
+ case GL_UNSIGNED_SHORT: drawPoints<GLushort>(mDevice, count, indices, minIndex); break;
+ case GL_UNSIGNED_INT: drawPoints<GLuint>(mDevice, count, indices, minIndex); break;
default: UNREACHABLE();
}
}
@@ -2045,31 +2034,19 @@ void Renderer9::releaseDeviceResources()
mEventQueryPool.pop_back();
}
- if (mMaskedClearSavedState)
- {
- mMaskedClearSavedState->Release();
- mMaskedClearSavedState = NULL;
- }
+ SafeRelease(mMaskedClearSavedState);
mVertexShaderCache.clear();
mPixelShaderCache.clear();
- delete mBlit;
- mBlit = NULL;
-
- delete mVertexDataManager;
- mVertexDataManager = NULL;
-
- delete mIndexDataManager;
- mIndexDataManager = NULL;
-
- delete mLineLoopIB;
- mLineLoopIB = NULL;
+ SafeDelete(mBlit);
+ SafeDelete(mVertexDataManager);
+ SafeDelete(mIndexDataManager);
+ SafeDelete(mLineLoopIB);
for (int i = 0; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++)
{
- delete mNullColorbufferCache[i].buffer;
- mNullColorbufferCache[i].buffer = NULL;
+ SafeDelete(mNullColorbufferCache[i].buffer);
}
}
@@ -2089,22 +2066,8 @@ bool Renderer9::isDeviceLost()
// set notify to true to broadcast a message to all contexts of the device loss
bool Renderer9::testDeviceLost(bool notify)
{
- HRESULT status = S_OK;
-
- if (mDeviceEx)
- {
- status = mDeviceEx->CheckDeviceState(NULL);
- }
- else if (mDevice)
- {
- status = mDevice->TestCooperativeLevel();
- }
- else
- {
- // No device yet, so no reset required
- }
-
- bool isLost = FAILED(status) || d3d9::isDeviceLostError(status);
+ HRESULT status = getDeviceStatusCode();
+ bool isLost = FAILED(status);
if (isLost)
{
@@ -2123,7 +2086,7 @@ bool Renderer9::testDeviceLost(bool notify)
return isLost;
}
-bool Renderer9::testDeviceResettable()
+HRESULT Renderer9::getDeviceStatusCode()
{
HRESULT status = D3D_OK;
@@ -2136,9 +2099,14 @@ bool Renderer9::testDeviceResettable()
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 (status)
+ switch (getDeviceStatusCode())
{
case D3DERR_DEVICENOTRESET:
case D3DERR_DEVICEHUNG:
@@ -2146,8 +2114,8 @@ bool Renderer9::testDeviceResettable()
case D3DERR_DEVICELOST:
return (mDeviceEx != NULL);
case D3DERR_DEVICEREMOVED:
- UNIMPLEMENTED();
- return false;
+ ASSERT(mDeviceEx != NULL);
+ return isRemovedDeviceResettable();
default:
return false;
}
@@ -2161,14 +2129,26 @@ bool Renderer9::resetDevice()
HRESULT result = D3D_OK;
bool lost = testDeviceLost(false);
- int attempts = 3;
+ bool removedDevice = (getDeviceStatusCode() == D3DERR_DEVICEREMOVED);
- while (lost && attempts > 0)
+ // Device Removed is a feature which is only present with D3D9Ex
+ ASSERT(mDeviceEx != NULL || !removedDevice);
+
+ for (int attempts = 3; lost && attempts > 0; attempts--)
{
- if (mDeviceEx)
+ 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, NULL);
+ lost = testDeviceLost(false);
}
else
{
@@ -2183,10 +2163,8 @@ bool Renderer9::resetDevice()
{
result = mDevice->Reset(&presentParameters);
}
+ lost = testDeviceLost(false);
}
-
- lost = testDeviceLost(false);
- attempts --;
}
if (FAILED(result))
@@ -2195,13 +2173,58 @@ bool Renderer9::resetDevice()
return false;
}
- // reset device defaults
- initializeDevice();
+ 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
+ initializeDevice();
+ }
+
mDeviceLost = false;
return true;
}
+bool Renderer9::isRemovedDeviceResettable() const
+{
+ bool success = false;
+
+#ifdef ANGLE_ENABLE_D3D9EX
+ IDirect3D9Ex *d3d9Ex = NULL;
+ 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.
+ deinitialize();
+ return (initialize() == EGL_SUCCESS);
+}
+
DWORD Renderer9::getAdapterVendor() const
{
return mAdapterIdentifier.VendorId;
@@ -3129,7 +3152,7 @@ ShaderExecutable *Renderer9::loadExecutable(const void *function, size_t length,
return executable;
}
-ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type)
+ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround)
{
const char *profile = NULL;
@@ -3146,7 +3169,11 @@ ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const cha
return NULL;
}
- ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, ANGLE_COMPILE_OPTIMIZATION_LEVEL, true);
+ // ANGLE issue 486:
+ // Work-around a D3D9 compiler bug that presents itself when using conditional discard, by disabling optimization
+ UINT optimizationFlags = (workaround == ANGLE_D3D_WORKAROUND_SM3_OPTIMIZER ? D3DCOMPILE_SKIP_OPTIMIZATION : ANGLE_COMPILE_OPTIMIZATION_LEVEL);
+
+ ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, optimizationFlags, true);
if (!binary)
return NULL;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Renderer9.h
index f8932c4fd4..24fd2bdd84 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Renderer9.h
@@ -12,7 +12,7 @@
#include "common/angleutils.h"
#include "libGLESv2/mathutil.h"
#include "libGLESv2/renderer/ShaderCache.h"
-#include "libGLESv2/renderer/VertexDeclarationCache.h"
+#include "libGLESv2/renderer/d3d9/VertexDeclarationCache.h"
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/renderer/RenderTarget.h"
@@ -72,7 +72,7 @@ class Renderer9 : public Renderer
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture);
virtual void setRasterizerState(const gl::RasterizerState &rasterState);
- virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
+ virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
unsigned int sampleMask);
virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
int stencilBackRef, bool frontFaceCCW);
@@ -170,7 +170,7 @@ class Renderer9 : public Renderer
// Shader operations
virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type);
- virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type);
+ virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround);
// Image operations
virtual Image *createImage();
@@ -198,12 +198,14 @@ class Renderer9 : public Renderer
private:
DISALLOW_COPY_AND_ASSIGN(Renderer9);
+ void deinitialize();
+
void applyUniformnfv(gl::Uniform *targetUniform, const GLfloat *v);
void applyUniformniv(gl::Uniform *targetUniform, const GLint *v);
void applyUniformnbv(gl::Uniform *targetUniform, const GLint *v);
void drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
- void drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer);
+ void drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray);
bool copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged);
@@ -218,6 +220,10 @@ class Renderer9 : public Renderer
D3DPRESENT_PARAMETERS getDefaultPresentParameters();
void releaseDeviceResources();
+ HRESULT getDeviceStatusCode();
+ bool isRemovedDeviceResettable() const;
+ bool resetRemovedDevice();
+
UINT mAdapter;
D3DDEVTYPE mDeviceType;
bool mSoftwareDevice; // FIXME: Deprecate
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp
index 98868a3fbf..5decf9664d 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp
@@ -8,7 +8,7 @@
// ShaderExecutable9.cpp: Implements a D3D9-specific class to contain shader
// executable implementation details.
-#include "libGLESv2/renderer/ShaderExecutable9.h"
+#include "libGLESv2/renderer/d3d9/ShaderExecutable9.h"
#include "common/debug.h"
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.h
index fa1e6c2844..fa1e6c2844 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/SwapChain9.cpp
index f57a874688..dd8895d18d 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/SwapChain9.cpp
@@ -7,9 +7,9 @@
// SwapChain9.cpp: Implements a back-end specific class for the D3D9 swap chain.
-#include "libGLESv2/renderer/SwapChain9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/SwapChain9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
namespace rx
{
@@ -71,6 +71,9 @@ void SwapChain9::release()
static DWORD convertInterval(EGLint interval)
{
+#if ANGLE_FORCE_VSYNC_OFF
+ return D3DPRESENT_INTERVAL_IMMEDIATE;
+#else
switch(interval)
{
case 0: return D3DPRESENT_INTERVAL_IMMEDIATE;
@@ -82,6 +85,7 @@ static DWORD convertInterval(EGLint interval)
}
return D3DPRESENT_INTERVAL_DEFAULT;
+#endif
}
EGLint SwapChain9::resize(int backbufferWidth, int backbufferHeight)
@@ -137,21 +141,6 @@ EGLint SwapChain9::reset(int backbufferWidth, int backbufferHeight, EGLint swapI
pShareHandle = &mShareHandle;
}
- // CreateTexture will fail on zero dimensions, so just release old target
- if (!backbufferWidth || !backbufferHeight)
- {
- if (mRenderTarget)
- {
- mRenderTarget->Release();
- mRenderTarget = NULL;
- }
-
- mWidth = backbufferWidth;
- mHeight = backbufferHeight;
-
- return EGL_SUCCESS;
- }
-
result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
gl_d3d9::ConvertRenderbufferFormat(mBackBufferFormat), D3DPOOL_DEFAULT,
&mOffscreenTexture, pShareHandle);
@@ -323,6 +312,11 @@ EGLint SwapChain9::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
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, mWidth, mHeight, 0.0f, 1.0f};
device->SetViewport(&viewport);
@@ -357,17 +351,19 @@ EGLint SwapChain9::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
mRenderer->markAllStateDirty();
- if (d3d9::isDeviceLostError(result))
- {
- return EGL_CONTEXT_LOST;
- }
-
if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR)
{
return EGL_BAD_ALLOC;
}
- ASSERT(SUCCEEDED(result));
+ // 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;
}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/SwapChain9.h
index 16a62bd86f..16a62bd86f 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/SwapChain9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp
index 8aa74a7cba..2486a9a5bf 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp
@@ -10,11 +10,11 @@
// D3D9 texture.
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/Renderer9.h"
-#include "libGLESv2/renderer/TextureStorage9.h"
-#include "libGLESv2/renderer/SwapChain9.h"
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
+#include "libGLESv2/renderer/d3d9/SwapChain9.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
#include "libGLESv2/Texture.h"
namespace rx
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.h
index 86f551a131..86f551a131 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp
index b017b3af33..57f5bcd256 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp
@@ -7,11 +7,11 @@
// VertexBuffer9.cpp: Defines the D3D9 VertexBuffer implementation.
-#include "libGLESv2/renderer/VertexBuffer9.h"
-#include "libGLESv2/renderer/vertexconversion.h"
+#include "libGLESv2/renderer/d3d9/VertexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/vertexconversion.h"
#include "libGLESv2/renderer/BufferStorage.h"
#include "libGLESv2/Context.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
#include "libGLESv2/Buffer.h"
@@ -182,7 +182,7 @@ bool VertexBuffer9::getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei
bool VertexBuffer9::requiresConversion(const gl::VertexAttribute &attrib) const
{
- return formatConverter(attrib).identity;
+ return !formatConverter(attrib).identity;
}
unsigned int VertexBuffer9::getVertexSize(const gl::VertexAttribute &attrib) const
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.h
index 2f88117bda..2f88117bda 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp
index 9b83a6476e..e5c8a14232 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp
@@ -9,8 +9,8 @@
#include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/Context.h"
-#include "libGLESv2/renderer/VertexBuffer9.h"
-#include "libGLESv2/renderer/VertexDeclarationCache.h"
+#include "libGLESv2/renderer/d3d9/VertexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/VertexDeclarationCache.h"
namespace rx
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.h
index 3fc024a9ba..3fc024a9ba 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp
index da75d465e3..b7f2ffb1d9 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp
@@ -8,7 +8,7 @@
// renderer9_utils.cpp: Conversion functions and other utility routines
// specific to the D3D9 renderer.
-#include "libGLESv2/renderer/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
#include "libGLESv2/mathutil.h"
#include "libGLESv2/Context.h"
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.h
index bf6cdf1ea6..bf6cdf1ea6 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.ps b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.ps
index dcb3bd0e76..dcb3bd0e76 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.ps
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.ps
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.vs b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.vs
index 3a36980b93..3a36980b93 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.vs
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.vs
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/vertexconversion.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/vertexconversion.h
index 590b9d48a3..590b9d48a3 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/vertexconversion.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/vertexconversion.h
diff --git a/src/3rdparty/angle/src/libGLESv2/utilities.cpp b/src/3rdparty/angle/src/libGLESv2/utilities.cpp
index 8fd193b164..30765ffba0 100644
--- a/src/3rdparty/angle/src/libGLESv2/utilities.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/utilities.cpp
@@ -9,13 +9,13 @@
#include "libGLESv2/utilities.h"
#include "libGLESv2/mathutil.h"
-
#if defined(ANGLE_OS_WINRT)
-#include <locale>
-#include <codecvt>
-#include <wrl.h>
-#include <windows.storage.h>
-using namespace ABI::Windows::Storage;
+# include <locale>
+# include <codecvt>
+# include <wrl.h>
+# include <windows.storage.h>
+ using namespace Microsoft::WRL;
+ using namespace ABI::Windows::Storage;
#endif
namespace gl
@@ -745,29 +745,43 @@ bool IsTriangleMode(GLenum drawMode)
std::string getTempPath()
{
-#if defined(ANGLE_OS_WINRT)
+#if !defined(ANGLE_OS_WINRT)
+ 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();
+ }
+#else
static std::string path;
while (path.empty()) {
- IApplicationDataStatics *applicationDataFactory;
- HRESULT result = RoGetActivationFactory(Microsoft::WRL::Wrappers::HStringReference(RuntimeClass_Windows_Storage_ApplicationData).Get(),
- IID_PPV_ARGS(&applicationDataFactory));
+ ComPtr<IApplicationDataStatics> factory;
+ Wrappers::HStringReference classId(RuntimeClass_Windows_Storage_ApplicationData);
+ HRESULT result = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
if (FAILED(result))
break;
- IApplicationData *applicationData;
- result = applicationDataFactory->get_Current(&applicationData);
+ ComPtr<IApplicationData> applicationData;
+ result = factory->get_Current(&applicationData);
if (FAILED(result))
break;
- IStorageFolder *storageFolder;
+ ComPtr<IStorageFolder> storageFolder;
result = applicationData->get_LocalFolder(&storageFolder);
if (FAILED(result))
break;
- IStorageItem *localFolder;
- result = storageFolder->QueryInterface(IID_PPV_ARGS(&localFolder));
+ ComPtr<IStorageItem> localFolder;
+ result = storageFolder.As(&localFolder);
if (FAILED(result))
break;
@@ -784,25 +798,6 @@ std::string getTempPath()
break;
}
}
-
-#else
-
- 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();
- }
-
#endif
return path;
diff --git a/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h b/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h
index 0d4e1a374c..f725f55b57 100644
--- a/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h
+++ b/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h
@@ -28,8 +28,8 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/InfoSink.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/intermediate.h"
class ArrayBoundsClamper {
public:
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
index 72d354dd64..96ac910b08 100644
--- a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
+++ b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
@@ -574,8 +574,6 @@
namespace gl {
-extern long **traceSamplingState;
-
namespace TraceEvent {
// Specify these values when the corresponding argument of addTraceEvent is not
@@ -793,6 +791,7 @@ private:
// TraceEventSamplingStateScope records the current sampling state
// and sets a new sampling state. When the scope exists, it restores
// the sampling state having recorded.
+#if 0 // This is not used by ANGLE and causes a compilation error on MinGW
template<size_t BucketNumber>
class SamplingStateScope {
public:
@@ -820,6 +819,7 @@ public:
private:
const char* m_previousState;
};
+#endif
} // namespace TraceEvent