summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure35
-rw-r--r--dist/changes-5.0.249
-rw-r--r--doc/global/qt-cpp-ignore.qdocconf1
-rw-r--r--examples/network/torrent/main.cpp1
-rw-r--r--examples/network/torrent/peerwireclient.cpp8
-rw-r--r--examples/network/torrent/peerwireclient.h9
-rw-r--r--examples/network/torrent/trackerclient.cpp49
-rw-r--r--examples/widgets/graphicsview/boxes/boxes.pro6
-rw-r--r--mkspecs/common/clang-mac.conf3
-rw-r--r--mkspecs/common/mac.conf3
-rw-r--r--mkspecs/common/xcode.conf8
-rw-r--r--mkspecs/features/c++11.prf7
-rw-r--r--mkspecs/features/create_cmake.prf8
-rw-r--r--mkspecs/features/ctest_testcase.prf20
-rw-r--r--mkspecs/features/data/android/dx.bat2
-rw-r--r--mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in6
-rw-r--r--mkspecs/features/exclusive_builds.prf2
-rw-r--r--mkspecs/features/mac/default_post.prf4
-rw-r--r--mkspecs/features/mac/sdk.prf9
-rw-r--r--mkspecs/features/qt_parts.prf3
-rwxr-xr-xmkspecs/unsupported/macx-ios-clang/Info.plist.app8
-rw-r--r--mkspecs/unsupported/macx-ios-clang/qmake.conf5
-rw-r--r--qmake/generators/makefile.cpp6
-rw-r--r--qmake/generators/unix/unixmake2.cpp8
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp1
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp6
-rw-r--r--src/3rdparty/angle/.gitignore21
-rw-r--r--src/3rdparty/angle/include/GLES2/gl2ext.h46
-rw-r--r--src/3rdparty/angle/include/GLSLANG/ShaderLang.h103
-rw-r--r--src/3rdparty/angle/src/common/angleutils.h28
-rw-r--r--src/3rdparty/angle/src/common/debug.cpp15
-rw-r--r--src/3rdparty/angle/src/common/debug.h7
-rw-r--r--src/3rdparty/angle/src/common/system.h26
-rw-r--r--src/3rdparty/angle/src/common/version.h6
-rw-r--r--src/3rdparty/angle/src/compiler/BaseTypes.h6
-rw-r--r--src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp10
-rw-r--r--src/3rdparty/angle/src/compiler/Compiler.cpp43
-rw-r--r--src/3rdparty/angle/src/compiler/ConstantUnion.h3
-rw-r--r--src/3rdparty/angle/src/compiler/DetectDiscontinuity.cpp22
-rw-r--r--src/3rdparty/angle/src/compiler/DetectDiscontinuity.h2
-rw-r--r--src/3rdparty/angle/src/compiler/Diagnostics.cpp2
-rw-r--r--src/3rdparty/angle/src/compiler/Diagnostics.h2
-rw-r--r--src/3rdparty/angle/src/compiler/DirectiveHandler.h2
-rw-r--r--src/3rdparty/angle/src/compiler/ExtensionBehavior.h2
-rw-r--r--src/3rdparty/angle/src/compiler/ForLoopUnroll.cpp4
-rw-r--r--src/3rdparty/angle/src/compiler/HashNames.h19
-rw-r--r--src/3rdparty/angle/src/compiler/Initialize.cpp2
-rw-r--r--src/3rdparty/angle/src/compiler/Intermediate.cpp40
-rw-r--r--src/3rdparty/angle/src/compiler/MapLongVariableNames.cpp6
-rw-r--r--src/3rdparty/angle/src/compiler/MapLongVariableNames.h2
-rw-r--r--src/3rdparty/angle/src/compiler/OutputESSL.cpp8
-rw-r--r--src/3rdparty/angle/src/compiler/OutputESSL.h6
-rw-r--r--src/3rdparty/angle/src/compiler/OutputGLSL.cpp8
-rw-r--r--src/3rdparty/angle/src/compiler/OutputGLSL.h6
-rw-r--r--src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp168
-rw-r--r--src/3rdparty/angle/src/compiler/OutputGLSLBase.h25
-rw-r--r--src/3rdparty/angle/src/compiler/OutputHLSL.cpp1304
-rw-r--r--src/3rdparty/angle/src/compiler/OutputHLSL.h35
-rw-r--r--src/3rdparty/angle/src/compiler/ParseHelper.cpp17
-rw-r--r--src/3rdparty/angle/src/compiler/ParseHelper.h5
-rw-r--r--src/3rdparty/angle/src/compiler/ShHandle.h23
-rw-r--r--src/3rdparty/angle/src/compiler/ShaderLang.cpp113
-rw-r--r--src/3rdparty/angle/src/compiler/SymbolTable.h16
-rw-r--r--src/3rdparty/angle/src/compiler/TranslatorESSL.cpp5
-rw-r--r--src/3rdparty/angle/src/compiler/TranslatorGLSL.cpp5
-rw-r--r--src/3rdparty/angle/src/compiler/TranslatorHLSL.cpp9
-rw-r--r--src/3rdparty/angle/src/compiler/TranslatorHLSL.h11
-rw-r--r--src/3rdparty/angle/src/compiler/Types.h37
-rw-r--r--src/3rdparty/angle/src/compiler/UnfoldShortCircuit.cpp10
-rw-r--r--src/3rdparty/angle/src/compiler/Uniform.cpp21
-rw-r--r--src/3rdparty/angle/src/compiler/Uniform.h35
-rw-r--r--src/3rdparty/angle/src/compiler/ValidateLimitations.cpp2
-rw-r--r--src/3rdparty/angle/src/compiler/VariableInfo.cpp34
-rw-r--r--src/3rdparty/angle/src/compiler/VariableInfo.h5
-rw-r--r--src/3rdparty/angle/src/compiler/VariablePacker.cpp2
-rw-r--r--src/3rdparty/angle/src/compiler/glslang.h2
-rw-r--r--src/3rdparty/angle/src/compiler/glslang.l170
-rw-r--r--src/3rdparty/angle/src/compiler/glslang.y41
-rw-r--r--src/3rdparty/angle/src/compiler/intermOut.cpp2
-rw-r--r--src/3rdparty/angle/src/compiler/intermediate.h29
-rw-r--r--src/3rdparty/angle/src/compiler/osinclude.h21
-rw-r--r--src/3rdparty/angle/src/compiler/ossource_nspr.cpp43
-rw-r--r--src/3rdparty/angle/src/compiler/parseConst.cpp7
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Diagnostics.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Diagnostics.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.cpp (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/DirectiveHandler.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/DirectiveHandler.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/DirectiveParser.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/DirectiveParser.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/ExpressionParser.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/ExpressionParser.y)8
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Input.cpp (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Input.cpp)15
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Input.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Input.h)19
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Lexer.cpp (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Lexer.cpp)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Lexer.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Lexer.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Macro.cpp)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Macro.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Macro.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/MacroExpander.cpp)14
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/MacroExpander.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Preprocessor.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Preprocessor.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/SourceLocation.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/SourceLocation.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Token.cpp (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Token.cpp)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Token.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Token.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Tokenizer.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/Tokenizer.l)16
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/atom.c737
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/atom.h63
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/compile.h100
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/cpp.c1118
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/cpp.h86
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/cppstruct.c152
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/memory.c158
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/memory.h58
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/numeric_lex.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/parser.h93
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/pp_utils.h (renamed from src/3rdparty/angle/src/compiler/preprocessor/new/pp_utils.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/preprocess.h50
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/scanner.c698
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/scanner.h81
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/slglobals.h82
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/symbols.c288
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/symbols.h111
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/tokens.c467
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/tokens.h90
-rw-r--r--src/3rdparty/angle/src/libEGL/Config.cpp117
-rw-r--r--src/3rdparty/angle/src/libEGL/Config.h15
-rw-r--r--src/3rdparty/angle/src/libEGL/Display.cpp874
-rw-r--r--src/3rdparty/angle/src/libEGL/Display.h94
-rw-r--r--src/3rdparty/angle/src/libEGL/Surface.cpp433
-rw-r--r--src/3rdparty/angle/src/libEGL/Surface.h34
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGL.cpp258
-rw-r--r--src/3rdparty/angle/src/libEGL/main.cpp3
-rw-r--r--src/3rdparty/angle/src/libEGL/main.h3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/BinaryStream.h3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Buffer.cpp72
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Buffer.h42
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Context.cpp2769
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Context.h248
-rw-r--r--src/3rdparty/angle/src/libGLESv2/D3DConstantTable.cpp231
-rw-r--r--src/3rdparty/angle/src/libGLESv2/D3DConstantTable.h117
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Fence.cpp104
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Fence.h18
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Float16ToFloat32.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Float16ToFloat32.py8
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Framebuffer.cpp361
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Framebuffer.h69
-rw-r--r--src/3rdparty/angle/src/libGLESv2/HandleAllocator.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/IndexDataManager.cpp473
-rw-r--r--src/3rdparty/angle/src/libGLESv2/IndexDataManager.h149
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Program.cpp27
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Program.h15
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp1774
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ProgramBinary.h145
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Query.cpp98
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Query.h17
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Renderbuffer.cpp230
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Renderbuffer.h64
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ResourceManager.cpp18
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ResourceManager.h24
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Shader.cpp79
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Shader.h26
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Texture.cpp2301
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Texture.h242
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Uniform.cpp43
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Uniform.h48
-rw-r--r--src/3rdparty/angle/src/libGLESv2/VertexDataManager.cpp783
-rw-r--r--src/3rdparty/angle/src/libGLESv2/VertexDataManager.h169
-rw-r--r--src/3rdparty/angle/src/libGLESv2/angletypes.h128
-rw-r--r--src/3rdparty/angle/src/libGLESv2/constants.h34
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp1390
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2.def3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2d.def2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/main.cpp35
-rw-r--r--src/3rdparty/angle/src/libGLESv2/main.h40
-rw-r--r--src/3rdparty/angle/src/libGLESv2/mathutil.h22
-rw-r--r--src/3rdparty/angle/src/libGLESv2/precompiled.cpp9
-rw-r--r--src/3rdparty/angle/src/libGLESv2/precompiled.h45
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Blit.cpp (renamed from src/3rdparty/angle/src/libGLESv2/Blit.cpp)163
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Blit.h (renamed from src/3rdparty/angle/src/libGLESv2/Blit.h)28
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.cpp40
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h44
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp352
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h56
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.cpp76
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.h42
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Fence11.cpp134
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Fence11.h39
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Fence9.cpp135
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Fence9.h39
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/FenceImpl.h45
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Image.cpp548
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Image.h131
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Image11.cpp457
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Image11.h76
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Image9.cpp736
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Image9.h79
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/ImageSSE2.cpp (renamed from src/3rdparty/angle/src/libGLESv2/TextureSSE2.cpp)18
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer.cpp202
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer.h137
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.cpp182
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.h53
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.cpp207
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.h53
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/IndexDataManager.cpp316
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/IndexDataManager.h66
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.cpp166
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.h74
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Query11.cpp122
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Query11.h40
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Query9.cpp125
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Query9.h40
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/QueryImpl.h42
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.cpp406
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.h101
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget.h56
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.cpp378
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.h58
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.cpp113
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.h40
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp201
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h238
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp3531
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h348
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.cpp3211
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.h347
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/ShaderCache.h (renamed from src/3rdparty/angle/src/libEGL/ShaderCache.h)20
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable.h51
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.cpp109
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.h47
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.cpp60
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.h39
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h44
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp770
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.h78
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.cpp449
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.h55
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage.cpp122
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage.h110
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.cpp676
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.h120
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.cpp328
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.h109
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer.cpp229
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer.h138
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.cpp418
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.h73
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.cpp486
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.h90
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/VertexDataManager.cpp258
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/VertexDataManager.h65
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.cpp217
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.h58
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/generatemip.h203
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.cpp688
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.h95
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.cpp500
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.h74
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.ps (renamed from src/3rdparty/angle/src/libGLESv2/shaders/Blit.ps)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.vs (renamed from src/3rdparty/angle/src/libGLESv2/shaders/Blit.vs)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl33
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/shaders/Passthrough11.hlsl29
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/vertexconversion.h (renamed from src/3rdparty/angle/src/libGLESv2/vertexconversion.h)7
-rw-r--r--src/3rdparty/angle/src/libGLESv2/utilities.cpp674
-rw-r--r--src/3rdparty/angle/src/libGLESv2/utilities.h75
-rw-r--r--src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.cpp106
-rw-r--r--src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h62
-rw-r--r--src/3rdparty/angle/src/third_party/compiler/LICENSE22
-rw-r--r--src/3rdparty/angle/src/third_party/compiler/README.angle12
-rw-r--r--src/3rdparty/angle/src/third_party/murmurhash/LICENSE2
-rw-r--r--src/3rdparty/angle/src/third_party/murmurhash/MurmurHash3.cpp334
-rw-r--r--src/3rdparty/angle/src/third_party/murmurhash/MurmurHash3.h37
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java124
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtNative.java14
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtSurface.java5
-rw-r--r--src/android/java/AndroidManifest.xml2
-rw-r--r--src/android/java/res/values/libs.xml7
-rw-r--r--src/android/java/src/org/kde/necessitas/ministro/IMinistro.aidl11
-rw-r--r--src/android/java/src/org/kde/necessitas/ministro/IMinistroCallback.aidl6
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java74
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtApplication.java2
-rw-r--r--src/android/java/version.xml2
-rw-r--r--src/angle/patches/0001-Dynamically-resolve-functions-of-dwmapi.dll.patch22
-rw-r--r--src/angle/patches/0003-Fix-Float16ToFloat32.py.patch54
-rw-r--r--src/angle/patches/0004-Fix-black-screen-after-minimizing-OpenGL-window-with.patch30
-rw-r--r--src/angle/patches/0005-Fix-build-when-SSE2-is-not-available.patch40
-rw-r--r--src/angle/patches/0006-ANGLE-Do-not-reset-the-share-handle-when-resetting-t.patch32
-rw-r--r--src/angle/patches/0006-Make-DX9-DX11-mutually-exclusive.patch140
-rw-r--r--src/angle/patches/0007-ANGLE-Fix-typedefs-for-Win64.patch14
-rw-r--r--src/angle/patches/0008-ANGLE-DX11-Prevent-assert-when-view-is-minimized-or-.patch58
-rw-r--r--src/angle/patches/0009-ANGLE-Avoid-memory-copies-on-buffers-when-data-is-nu.patch72
-rw-r--r--src/angle/src/compiler/preprocessor/preprocessor.pro52
-rw-r--r--src/angle/src/compiler/translator_common.pro24
-rw-r--r--src/angle/src/compiler/translator_hlsl.pro6
-rw-r--r--src/angle/src/config.pri5
-rw-r--r--src/angle/src/libEGL/libEGL.pro9
-rw-r--r--src/angle/src/libGLESv2/libGLESv2.pro186
-rw-r--r--src/corelib/Qt5CTestMacros.cmake29
-rw-r--r--src/corelib/Qt5CoreConfigExtras.cmake.in6
-rw-r--r--src/corelib/doc/src/objectmodel/properties.qdoc2
-rw-r--r--src/corelib/global/qlibraryinfo.cpp4
-rw-r--r--src/corelib/io/qdatastream.cpp1
-rw-r--r--src/corelib/io/qlockfile.h4
-rw-r--r--src/corelib/io/qsavefile.cpp101
-rw-r--r--src/corelib/io/qsavefile.h3
-rw-r--r--src/corelib/io/qsavefile_p.h3
-rw-r--r--src/corelib/itemmodels/qabstractproxymodel.cpp7
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp3
-rw-r--r--src/corelib/kernel/qmetatype.h2
-rw-r--r--src/corelib/kernel/qvariant.cpp2
-rw-r--r--src/dbus/doc/snippets/code/doc_src_qdbusadaptors.cpp2
-rw-r--r--src/gui/accessible/qaccessible.cpp73
-rw-r--r--src/gui/accessible/qaccessible.h12
-rw-r--r--src/gui/accessible/qaccessible2.cpp35
-rw-r--r--src/gui/accessible/qaccessible2_p.h18
-rw-r--r--src/gui/doc/qtgui.qdocconf2
-rw-r--r--src/gui/doc/src/qtgui.qdoc4
-rw-r--r--src/gui/opengl/qopenglfunctions_1_2.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_1_3.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_1_4.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_1_5.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_3_1.h6
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_core.h6
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_core.h6
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_core.h6
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_core.h6
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_core.h6
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.h12
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_core.h6
-rw-r--r--src/gui/opengl/qopenglversionfunctions.cpp2
-rw-r--r--src/gui/opengl/qopenglversionfunctions.h2
-rw-r--r--src/gui/painting/qdrawhelper.cpp15
-rw-r--r--src/network/bearer/qnetworkconfigmanager.cpp6
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor.cpp14
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor_p.h2
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.cpp94
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.h8
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp7
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.h6
-rw-r--r--src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp3
-rw-r--r--src/plugins/platforms/android/src/androidjnimain.cpp11
-rw-r--r--src/plugins/platforms/android/src/androidjnimain.h1
-rw-r--r--src/plugins/platforms/android/src/androidjnimenu.cpp29
-rw-r--r--src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp7
-rw-r--r--src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp6
-rw-r--r--src/plugins/platforms/android/src/raster/qandroidplatformscreen.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm10
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm2
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks.h2
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_stub.cpp9
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp6
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.h1
-rw-r--r--src/plugins/platforms/ios/qioscontext.mm2
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm2
-rw-r--r--src/plugins/platforms/ios/qiostheme.h4
-rw-r--r--src/plugins/platforms/ios/qiostheme.mm14
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.mm2
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm2
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp5
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp6
-rw-r--r--src/printsupport/doc/src/qtprintsupport-module.qdoc3
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp17
-rw-r--r--src/sql/drivers/db2/qsql_db2_p.h2
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp30
-rw-r--r--src/sql/drivers/ibase/qsql_ibase_p.h7
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp69
-rw-r--r--src/sql/drivers/mysql/qsql_mysql_p.h4
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp21
-rw-r--r--src/sql/drivers/oci/qsql_oci_p.h3
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp44
-rw-r--r--src/sql/drivers/odbc/qsql_odbc_p.h3
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp48
-rw-r--r--src/sql/drivers/psql/qsql_psql_p.h5
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.cpp16
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite_p.h4
-rw-r--r--src/sql/drivers/sqlite2/qsql_sqlite2.cpp20
-rw-r--r--src/sql/drivers/sqlite2/qsql_sqlite2_p.h6
-rw-r--r--src/sql/drivers/tds/qsql_tds.cpp18
-rw-r--r--src/sql/drivers/tds/qsql_tds_p.h2
-rw-r--r--src/sql/kernel/qsqldriver.cpp7
-rw-r--r--src/sql/kernel/qsqldriver.h1
-rw-r--r--src/sql/kernel/qsqldriver_p.h29
-rw-r--r--src/tools/qdoc/doc/config/qdoc.qdocconf2
-rw-r--r--src/tools/qdoc/node.cpp1
-rw-r--r--src/tools/qdoc/node.h4
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp22
-rw-r--r--src/tools/uic/qclass_lib_map.h2
-rw-r--r--src/widgets/dialogs/qwizard.cpp12
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp18
-rw-r--r--src/widgets/kernel/qwidget.cpp3
-rw-r--r--src/widgets/styles/qgtkstyle_p.cpp50
-rw-r--r--src/xml/doc/src/qtxml-index.qdoc2
-rw-r--r--tests/auto/cmake/cmake.pro10
-rw-r--r--tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp85
-rw-r--r--tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp26
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp35
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp50
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_databases.h22
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp193
-rw-r--r--tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp8
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp236
-rw-r--r--tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp14
-rw-r--r--tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp70
-rw-r--r--tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp86
-rw-r--r--tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp62
-rw-r--r--tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp95
-rw-r--r--tests/benchmarks/sql/kernel/qsqlquery/main.cpp80
-rw-r--r--tools/configure/configureapp.cpp17
-rw-r--r--util/glgen/qopenglextensions.h.footer60
-rw-r--r--util/glgen/qopenglextensions.h.header116
-rw-r--r--util/glgen/qopenglversionfunctions.h.header7
-rw-r--r--util/glgen/qopenglversionfunctions__VERSION__.h.footer2
-rw-r--r--util/glgen/qopenglversionfunctions__VERSION__.h.header4
-rw-r--r--util/glgen/specparser.cpp7
-rw-r--r--util/glgen/specparser.h1
432 files changed, 29728 insertions, 17873 deletions
diff --git a/configure b/configure
index a7d1790969..0c58ab21c3 100755
--- a/configure
+++ b/configure
@@ -233,7 +233,7 @@ macSDKify()
sdk=$(getSingleQMakeVariable "QMAKE_MAC_SDK" "$1")
if [ -z "$sdk" ]; then echo "QMAKE_MAC_SDK must be set when building on Mac" >&2; exit 1; fi
- sysroot=$(xcodebuild -sdk $sdk -version Path 2>/dev/null)
+ sysroot=$(/usr/bin/xcodebuild -sdk $sdk -version Path 2>/dev/null)
if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi
case "$sdk" in
@@ -256,7 +256,7 @@ macSDKify()
# Prefix tool with toolchain path
var=$(echo "$line" | cut -d '=' -f 1)
val=$(echo "$line" | cut -d '=' -f 2-)
- sdk_val=$(xcrun -sdk $sdk -find $(echo $val | cut -d ' ' -f 1))
+ sdk_val=$(/usr/bin/xcrun -sdk $sdk -find $(echo $val | cut -d ' ' -f 1))
val=$(echo $sdk_val $(echo $val | cut -s -d ' ' -f 2-))
echo "$var=$val"
;;
@@ -445,6 +445,28 @@ if [ "$OSTYPE" = "msys" ]; then
BUILD_ON_MSYS=yes
fi
+#-------------------------------------------------------------------------------
+# Verify Xcode installation on Mac OS
+#-------------------------------------------------------------------------------
+
+if [ "$BUILD_ON_MAC" = "yes" ]; then
+ if ! /usr/bin/xcode-select --print-path >/dev/null 2>&1; then
+ echo >&2
+ echo " No Xcode is selected. Use xcode-select -switch to choose an Xcode" >&2
+ echo " version. See the xcode-select man page for more information." >&2
+ echo >&2
+ exit 2
+ fi
+
+ if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
+ echo >&2
+ echo " Xcode not set up properly. You may need to confirm the license" >&2
+ echo " agreement by running /usr/bin/xcodebuild without arguments." >&2
+ echo >&2
+ exit 2
+ fi
+fi
+
#-----------------------------------------------------------------------------
# Qt version detection
#-----------------------------------------------------------------------------
@@ -2459,7 +2481,7 @@ if [ -z "$PLATFORM" ]; then
# about the OS version, since we're not using the clang version that comes
# with the system. We use 'xcrun' to check the clang version that's part of
# the Xcode installation.
- if [ "$(xcrun -sdk macosx clang -v 2>&1 | sed -n 's/.*version \([0-9]\).*/\1/p')" -ge 3 ]; then
+ if [ "$(/usr/bin/xcrun -sdk macosx clang -v 2>&1 | sed -n 's/.*version \([0-9]\).*/\1/p')" -ge 3 ]; then
PLATFORM=macx-clang
# Advertise g++ as an alternative on Lion and below
@@ -2814,9 +2836,10 @@ if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG force_debug_info"
fi
-# iOS builds should be static to be able to submit to the App Store
if [ "$XPLATFORM_IOS" = "yes" ]; then
- CFG_SHARED="no"
+ CFG_SHARED="no" # iOS builds should be static to be able to submit to the App Store
+ CFG_CXX11="no" # C++11 support disabled for now
+ CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtdeclarative qtquickcontrols qtwebkit qtgraphicaleffects qtdoc qtmultimedia qtwebkit-examples-and-demos qttools"
fi
# disable GTK style support auto-detection on Mac
@@ -3040,7 +3063,7 @@ fi
QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"`
if [ "$XPLATFORM_MINGW" = "yes" ]; then
- QT_INSTALL_LIBEXECS_DIRNAME="lib"
+ QT_INSTALL_LIBEXECS_DIRNAME="bin"
else
QT_INSTALL_LIBEXECS_DIRNAME="libexec"
fi
diff --git a/dist/changes-5.0.2 b/dist/changes-5.0.2
index 108512a98a..a9d715d1e6 100644
--- a/dist/changes-5.0.2
+++ b/dist/changes-5.0.2
@@ -22,9 +22,6 @@ information about a particular change.
General Improvements
--------------------
- - [QTBUG-26697] The -skip option was added to configure, which enables not
- building particular modules. Typical use case: -skip webkit.
-
Third party components
----------------------
@@ -50,6 +47,8 @@ QtGui
QtWidgets
---------
+- [QTBUG-28817] Fixed QColorDialog::setOption(), QFontDialog::setOption().
+
QtNetwork
---------
@@ -88,6 +87,10 @@ Qt for Linux/X11
Qt for Windows
--------------
+ - [QTBUG-30185] Fixed adding of suffixes in Window native file save dialog.
+ - [QTBUG-29010, QTBUG-28531] Fixed handling of layered windows required for
+ translucent or non-opaque windows.
+
Qt for Mac OS X
---------------
@@ -110,12 +113,52 @@ Qt for Windows CE
* Tools *
****************************************************************************
+Build System & configure
+------------------------
+
+ - [QTBUG-26697] The -skip option was added to configure, which enables not
+ building particular modules. Typical use case: -skip webkit.
+ - [QTBUG-28769, ...] Assorted build fixes
+ - [QTBUG-28902] Fixed contents of installed .prl files
+ - [QTBUG-29110, QTBUG-29186, ...] Assorted fixes to CMake config files
+ - [QTBUG-29174] Fixed numerous configure options which start with -l
+ - [QTBUG-29400] Fixed configure -fully-process not creating .vcproj files
+ - [QTBUG-29453, ...] Fixed generation of pkg-config .pc files
+ - [QTBUG-29478] Fixed static builds with ICU
+ - [QTBUG-29661] Fixed QtWebProcess.exe not finding Qt DLLs. -libexec
+ now defaults to bin/ on Windows.
+ - [QTBUG-29838] Fixed module versioning when mixing releases
+ - [QTBUG-30102] Fixed passing of values with spaces to -device-option
+ - Production builds do not build examples any more. 'make install' will
+ copy only the example sources.
+ - pkg-config: qt_config is now contained only in Qt5Core.pc, and it reflects
+ QT_CONFIG, not the module build's CONFIG.
+
qmake
-----
+ - [QTBUG-28132] Fixed parallelized 'jom install'
+ - [QTBUG-29143] MSVC: Fixed parsing of /openmp
+ - [QTBUG-29286] MSVC: Fixed use of VERSION breaking MSVC2010 projects
+ - [QTBUG-29329] MSVC: Fixed misparsing of /Gs as /GS
+ - [QTBUG-29329] MSVC: Stopped disabling buffer security check by default
+ - [QTBUG-29371] Fixed generation of XCode projects for XCode 4.6
+ - [QTBUG-29698] MSVC: Fixed incremental linking with non-standard shells
+ - [QTBUG-29700] Fixed pkg-config file generation when cross-compiling
+ - Qt modules are now enumerated in QT_MODULES, not QT_CONFIG. For portability,
+ use qtHaveModule() (since 5.0.1) or !isEmpty(QT.<module>.name) instead.
- $$(VAR) style environment variable expansions will not split on
whitespace any more. Use $$split() if necessary.
+ - Fixed qmake -tp vc (and configure without -no-vcproj)
+ - MSVC: Fixed an empty VERSION causing a garbled version in .rc files
+ - Windows: Added support for specifying application icon (via RC_ICONS)
+ - Added spec for BlackBerry Playbook
+
+moc
+---
+ - [QTBUG-29759] Fixed infinite recursion in macro substitution which
+ prevented some headers to compile.
****************************************************************************
* Plugins *
diff --git a/doc/global/qt-cpp-ignore.qdocconf b/doc/global/qt-cpp-ignore.qdocconf
index 6c71263bff..1f34f366cb 100644
--- a/doc/global/qt-cpp-ignore.qdocconf
+++ b/doc/global/qt-cpp-ignore.qdocconf
@@ -41,6 +41,7 @@ Cpp.ignoretokens += \
Q_OPENVG_EXPORT \
Q_OUTOFLINE_TEMPLATE \
Q_PRINTSUPPORT_EXPORT \
+ Q_QML_EXPORT \
Q_SCRIPT_EXPORT \
Q_SCRIPTTOOLS_EXPORT \
Q_SQL_EXPORT \
diff --git a/examples/network/torrent/main.cpp b/examples/network/torrent/main.cpp
index 13b40d28cc..9cdca69122 100644
--- a/examples/network/torrent/main.cpp
+++ b/examples/network/torrent/main.cpp
@@ -45,7 +45,6 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- qWarning("The usage of QHttp is not recommended anymore, please use QNetworkAccessManager.");
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
Q_INIT_RESOURCE(icons);
diff --git a/examples/network/torrent/peerwireclient.cpp b/examples/network/torrent/peerwireclient.cpp
index ade465ab47..0f77ba10d3 100644
--- a/examples/network/torrent/peerwireclient.cpp
+++ b/examples/network/torrent/peerwireclient.cpp
@@ -386,15 +386,15 @@ bool PeerWireClient::canTransferMore() const
|| !outgoingBuffer.isEmpty() || !pendingBlocks.isEmpty();
}
-void PeerWireClient::connectToHostImplementation(const QString &hostName,
- quint16 port, OpenMode openMode)
+void PeerWireClient::connectToHost(const QHostAddress &address,
+ quint16 port, OpenMode openMode)
{
setOpenMode(openMode);
- socket.connectToHost(hostName, port, openMode);
+ socket.connectToHost(address, port, openMode);
}
-void PeerWireClient::diconnectFromHostImplementation()
+void PeerWireClient::diconnectFromHost()
{
socket.disconnectFromHost();
}
diff --git a/examples/network/torrent/peerwireclient.h b/examples/network/torrent/peerwireclient.h
index 7cd08d90cb..35e4cc6ffb 100644
--- a/examples/network/torrent/peerwireclient.h
+++ b/examples/network/torrent/peerwireclient.h
@@ -118,6 +118,10 @@ public:
void setReadBufferSize(qint64 size);
+ void connectToHost(const QHostAddress &address,
+ quint16 port, OpenMode openMode = ReadWrite);
+ void diconnectFromHost();
+
signals:
void infoHashReceived(const QByteArray &infoHash);
void readyToTransfer();
@@ -133,11 +137,6 @@ signals:
void bytesReceived(qint64 size);
-protected slots:
- void connectToHostImplementation(const QString &hostName,
- quint16 port, OpenMode openMode = ReadWrite);
- void diconnectFromHostImplementation();
-
protected:
void timerEvent(QTimerEvent *event);
diff --git a/examples/network/torrent/trackerclient.cpp b/examples/network/torrent/trackerclient.cpp
index d714050fa7..fef3c7d596 100644
--- a/examples/network/torrent/trackerclient.cpp
+++ b/examples/network/torrent/trackerclient.cpp
@@ -97,14 +97,10 @@ void TrackerClient::timerEvent(QTimerEvent *event)
void TrackerClient::fetchPeerList()
{
- // Prepare connection details
- QString fullUrl = metaInfo.announceUrl();
- QUrl url(fullUrl);
- QString passkey = "?";
- if (fullUrl.contains("?passkey")) {
- passkey = metaInfo.announceUrl().mid(fullUrl.indexOf("?passkey"), -1);
- passkey += '&';
- }
+ QUrl url(metaInfo.announceUrl());
+
+ // Base the query on announce url to include a passkey (if any)
+ QUrlQuery query(url);
// Percent encode the hash
QByteArray infoHash = torrentDownloader->infoHash();
@@ -115,43 +111,44 @@ void TrackerClient::fetchPeerList()
}
bool seeding = (torrentDownloader->state() == TorrentClient::Seeding);
- QByteArray query;
- query += url.path().toLatin1();
- query += passkey;
- query += "info_hash=" + encodedSum;
- query += "&peer_id=" + ConnectionManager::instance()->clientId();
- query += "&port=" + QByteArray::number(TorrentServer::instance()->serverPort());
- query += "&compact=1";
- query += "&uploaded=" + QByteArray::number(torrentDownloader->uploadedBytes());
+
+ query.addQueryItem("info_hash", encodedSum);
+ query.addQueryItem("peer_id", ConnectionManager::instance()->clientId());
+ query.addQueryItem("port", QByteArray::number(TorrentServer::instance()->serverPort()));
+ query.addQueryItem("compact", "1");
+ query.addQueryItem("uploaded", QByteArray::number(torrentDownloader->uploadedBytes()));
if (!firstSeeding) {
- query += "&downloaded=0";
- query += "&left=0";
+ query.addQueryItem("downloaded", "0");
+ query.addQueryItem("left", "0");
} else {
- query += "&downloaded=" + QByteArray::number(
- torrentDownloader->downloadedBytes());
+ query.addQueryItem("downloaded",
+ QByteArray::number(torrentDownloader->downloadedBytes()));
int left = qMax<int>(0, metaInfo.totalSize() - torrentDownloader->downloadedBytes());
- query += "&left=" + QByteArray::number(seeding ? 0 : left);
+ query.addQueryItem("left", QByteArray::number(seeding ? 0 : left));
}
if (seeding && firstSeeding) {
- query += "&event=completed";
+ query.addQueryItem("event", "completed");
firstSeeding = false;
} else if (firstTrackerRequest) {
firstTrackerRequest = false;
- query += "&event=started";
+ query.addQueryItem("event", "started");
} else if(lastTrackerRequest) {
- query += "&event=stopped";
+ query.addQueryItem("event", "stopped");
}
if (!trackerId.isEmpty())
- query += "&trackerid=" + trackerId;
+ query.addQueryItem("trackerid", trackerId);
+
+ url.setQuery(query);
QNetworkRequest req(url);
if (!url.userName().isEmpty()) {
uname = url.userName();
pwd = url.password();
- connect(&http, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(provideAuthentication(QNetworkReply*,QAuthenticator*)));
+ connect(&http, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
+ this, SLOT(provideAuthentication(QNetworkReply*,QAuthenticator*)));
}
http.get(req);
}
diff --git a/examples/widgets/graphicsview/boxes/boxes.pro b/examples/widgets/graphicsview/boxes/boxes.pro
index a4b253c580..93621878f1 100644
--- a/examples/widgets/graphicsview/boxes/boxes.pro
+++ b/examples/widgets/graphicsview/boxes/boxes.pro
@@ -1,5 +1,11 @@
QT += opengl widgets
+contains(QT_CONFIG, opengles.) {
+ contains(QT_CONFIG, angle): \
+ warning("Qt was built with ANGLE, which provides only OpenGL ES 2.0 on top of DirectX 9.0c")
+ error("This example requires Qt to be configured with -opengl desktop")
+}
+
HEADERS += 3rdparty/fbm.h \
glbuffers.h \
glextensions.h \
diff --git a/mkspecs/common/clang-mac.conf b/mkspecs/common/clang-mac.conf
index efe771d24d..3280274f36 100644
--- a/mkspecs/common/clang-mac.conf
+++ b/mkspecs/common/clang-mac.conf
@@ -5,3 +5,6 @@ QMAKE_OBJCXXFLAGS_PRECOMPILE = -x objective-c++-header -c ${QMAKE_PCH_INPUT}
QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvm.clang.1_0
+
+QMAKE_CXXFLAGS_CXX11 += -stdlib=libc++
+QMAKE_LFLAGS_CXX11 += -stdlib=libc++
diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
index cf54f3f580..f31db3bb4b 100644
--- a/mkspecs/common/mac.conf
+++ b/mkspecs/common/mac.conf
@@ -26,4 +26,7 @@ QMAKE_LIBS_THREAD =
QMAKE_AR = ar cq
QMAKE_RANLIB = ranlib -s
+# We rely on Xcode to build
+include(xcode.conf)
+
include(unix.conf)
diff --git a/mkspecs/common/xcode.conf b/mkspecs/common/xcode.conf
index 9da6406f7f..b15266b678 100644
--- a/mkspecs/common/xcode.conf
+++ b/mkspecs/common/xcode.conf
@@ -3,7 +3,7 @@
#
# Get path of Xcode's Developer directory
-QMAKE_XCODE_DEVELOPER_PATH = $$system("xcode-select --print-path")
+QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
@@ -11,7 +11,11 @@ isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
!exists($$QMAKE_XCODE_DEVELOPER_PATH): \
error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
+# Make sure Xcode is set up properly
+isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))): \
+ error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.")
+
# Extract Xcode version using xcodebuild
-xcode_version = $$system("xcodebuild -version")
+xcode_version = $$system("/usr/bin/xcodebuild -version")
QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
unset(xcode_version)
diff --git a/mkspecs/features/c++11.prf b/mkspecs/features/c++11.prf
index 4b56fa9fd2..32eaca4a9b 100644
--- a/mkspecs/features/c++11.prf
+++ b/mkspecs/features/c++11.prf
@@ -1,3 +1,10 @@
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_CXX11
QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CXXFLAGS_CXX11
QMAKE_LFLAGS += $$QMAKE_LFLAGS_CXX11
+
+contains(QMAKE_LFLAGS, -stdlib=libc++) {
+ equals(QMAKE_MACOSX_DEPLOYMENT_TARGET, 10.6): \
+ QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
+ contains(QMAKE_IOS_DEPLOYMENT_TARGET, ^4.*): \
+ QMAKE_IOS_DEPLOYMENT_TARGET = 5.0
+}
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 9aef37472f..cf0acaf4b7 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -55,10 +55,10 @@ CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
CMAKE_BIN_DIR_IS_ABSOLUTE = True
}
-CMAKE_ARCHDATA_DIR = $$cmakeRelativePath($$[QT_INSTALL_ARCHDATA], $$[QT_INSTALL_PREFIX])
-!isEmpty(CMAKE_FORCE_ABSOLUTE_PATHS)|contains(CMAKE_ARCHDATA_DIR, "^\\.\\./.*") { # For the mkspecs
- CMAKE_ARCHDATA_DIR = $$[QT_INSTALL_ARCHDATA]/
- CMAKE_ARCHDATA_DIR_IS_ABSOLUTE = True
+CMAKE_HOST_DATA_DIR = $$cmakeRelativePath($$[QT_HOST_DATA], $$[QT_INSTALL_PREFIX])
+!isEmpty(CMAKE_FORCE_ABSOLUTE_PATHS)|contains(CMAKE_HOST_DATA_DIR, "^\\.\\./.*") {
+ CMAKE_HOST_DATA_DIR = $$[QT_HOST_DATA]/
+ CMAKE_HOST_DATA_DIR_IS_ABSOLUTE = True
}
static|staticlib:CMAKE_STATIC_TYPE = true
diff --git a/mkspecs/features/ctest_testcase.prf b/mkspecs/features/ctest_testcase.prf
index 79adde3446..7faf738d6e 100644
--- a/mkspecs/features/ctest_testcase.prf
+++ b/mkspecs/features/ctest_testcase.prf
@@ -56,9 +56,27 @@ isEmpty(CMAKE_VERSION) {
SET = set
equals(QMAKE_DIR_SEP, "/"):SET = export
+ CMAKE_MODULE_VERSIONS =
+ CMAKE_MODULES_UNDER_TEST =
+ for (MODULE_UNDER_TEST, CMAKE_QT_MODULES_UNDER_TEST) {
+ CMAKE_NAME = $$cmakeModuleName($$MODULE_UNDER_TEST)
+ CMAKE_MODULE_VERSIONS += \
+ -DCMAKE_$${CMAKE_NAME}_MODULE_MAJOR_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.MAJOR_VERSION) \
+ -DCMAKE_$${CMAKE_NAME}_MODULE_MINOR_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.MINOR_VERSION) \
+ -DCMAKE_$${CMAKE_NAME}_MODULE_PATCH_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.PATCH_VERSION)
+ CMAKE_MODULES_UNDER_TEST += $$CMAKE_NAME
+ }
+ CMAKE_MODULES_UNDER_TEST = $$join(CMAKE_MODULES_UNDER_TEST, ;)
+
check.commands = \
$(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && $$SET VERBOSE=1 && \
- cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR $$CMAKE_MODULE_DEFINES -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=$$CMAKE_PREFIX_PATH -DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" && \
+ cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR \
+ $$CMAKE_MODULE_DEFINES \
+ -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} \
+ -DCMAKE_PREFIX_PATH=$$CMAKE_PREFIX_PATH \
+ -DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" \
+ $${CMAKE_MODULE_VERSIONS} \
+ -DCMAKE_MODULES_UNDER_TEST=\"$$CMAKE_MODULES_UNDER_TEST\" && \
$(TESTRUNNER) ctest --output-on-failure
}
diff --git a/mkspecs/features/data/android/dx.bat b/mkspecs/features/data/android/dx.bat
index a60a1b4cbe..af143c52b5 100644
--- a/mkspecs/features/data/android/dx.bat
+++ b/mkspecs/features/data/android/dx.bat
@@ -41,7 +41,7 @@ set jarfile=dx.jar
set "frameworkdir=%androidsdk%\platform-tools"
if exist "%frameworkdir%\%jarfile%" goto JarFileOk
- set "frameworkdir=%androidsdk%\lib"
+ set "frameworkdir=%frameworkdir%\lib"
if exist "%frameworkdir%\%jarfile%" goto JarFileOk
set "frameworkdir=%androidsdk%\framework"
diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
index e5bbc97161..65ba03d44c 100644
--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
@@ -9,9 +9,7 @@ get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURREN
set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
!!ENDIF
-set(Qt5$${CMAKE_MODULE_NAME}_VERSION_MAJOR "$$eval(QT.$${MODULE}.MAJOR_VERSION)")
-set(Qt5$${CMAKE_MODULE_NAME}_VERSION_MINOR "$$eval(QT.$${MODULE}.MINOR_VERSION)")
-set(Qt5$${CMAKE_MODULE_NAME}_VERSION_PATCH "$$eval(QT.$${MODULE}.PATCH_VERSION)")
+# For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION).$$eval(QT.$${MODULE}.MINOR_VERSION).$$eval(QT.$${MODULE}.PATCH_VERSION)")
set(Qt5$${CMAKE_MODULE_NAME}_LIBRARIES Qt5::$${CMAKE_MODULE_NAME})
@@ -88,7 +86,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING} ${_Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT}
${_Qt5$${CMAKE_MODULE_NAME}_DEPENDENCIES_FIND_QUIET}
${_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED}
- PATHS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}\" NO_DEFAULT_PATH
+ PATHS \"${CMAKE_CURRENT_LIST_DIR}/..\" NO_DEFAULT_PATH
)
endif()
diff --git a/mkspecs/features/exclusive_builds.prf b/mkspecs/features/exclusive_builds.prf
index adcad79fe1..c45ff22c06 100644
--- a/mkspecs/features/exclusive_builds.prf
+++ b/mkspecs/features/exclusive_builds.prf
@@ -6,7 +6,7 @@ defineTest(fixExclusiveOutputDirs) {
count(ARGS, 2, greaterThan):isEqual($$list($$lower($$3)), false):appendFirstBuild = false
else:appendFirstBuild = true
- isEmpty(QMAKE_DIR_REPLACE):QMAKE_DIR_REPLACE += OBJECTS_DIR MOC_DIR RCC_DIR
+ isEmpty(QMAKE_DIR_REPLACE):QMAKE_DIR_REPLACE += OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR
lessThan(firstBuild, $$secondBuild):eval($${firstBuild}_and_$${secondBuild}_target:QMAKE_DIR_REPLACE += DESTDIR)
else:eval($${secondBuild}_and_$${firstBuild}_target:QMAKE_DIR_REPLACE += DESTDIR)
for(fix, QMAKE_DIR_REPLACE) {
diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
index 714b4c7d06..437e3d93e4 100644
--- a/mkspecs/features/mac/default_post.prf
+++ b/mkspecs/features/mac/default_post.prf
@@ -15,3 +15,7 @@ qt:!isEmpty(QT_CONFIG) {
contains(QT_CONFIG, x86_64):!contains(QT_CONFIG, x86):CONFIG += x86_64
}
}
+
+# Ensure that we process sdk.prf first, as it will update QMAKE_CXX
+# and friends that other features/extra compilers may depend on.
+sdk: load(sdk)
diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
index eaa3108a8b..ece0e27536 100644
--- a/mkspecs/features/mac/sdk.prf
+++ b/mkspecs/features/mac/sdk.prf
@@ -5,7 +5,7 @@ isEmpty(QMAKE_MAC_SDK): \
contains(QMAKE_MAC_SDK, .*/.*): \
error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
-QMAKE_MAC_SDK_PATH = $$system("xcodebuild -sdk $$QMAKE_MAC_SDK -version Path 2>/dev/null")
+QMAKE_MAC_SDK_PATH = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version Path 2>/dev/null")
isEmpty(QMAKE_MAC_SDK_PATH): error("Could not resolve SDK path for \'$$QMAKE_MAC_SDK\'")
!equals(MAKEFILE_GENERATOR, XCODE) {
@@ -24,7 +24,9 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_
value = $$eval($$tool)
isEmpty(value): next()
- sysrooted = $$system("xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value)")
+ sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null")
+ isEmpty(sysrooted): next()
+
$$tool = $$sysrooted $$member(value, 1, -1)
}
@@ -40,6 +42,9 @@ isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK
# FIXME: Get the version_min_flag out of the platform's 'Native Build System.xcspec'
version_identifier = $$replace(QMAKE_MAC_PLATFORM_NAME, iphonesimulator, ios-simulator)
+ # C++11 support may affect the deployment target
+ c++11: load(c++11)
+
ios:!host_build: \
deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
else: \
diff --git a/mkspecs/features/qt_parts.prf b/mkspecs/features/qt_parts.prf
index 12ba312bcd..37dc849f83 100644
--- a/mkspecs/features/qt_parts.prf
+++ b/mkspecs/features/qt_parts.prf
@@ -9,6 +9,9 @@
# We mean it.
#
+# Ensure that each module has a .qmake.cache when properly qmake'd.
+cache()
+
load(qt_build_config)
TEMPLATE = subdirs
diff --git a/mkspecs/unsupported/macx-ios-clang/Info.plist.app b/mkspecs/unsupported/macx-ios-clang/Info.plist.app
index bcf7f41f27..c7d660b8d1 100755
--- a/mkspecs/unsupported/macx-ios-clang/Info.plist.app
+++ b/mkspecs/unsupported/macx-ios-clang/Info.plist.app
@@ -14,6 +14,14 @@
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.@BUNDLEIDENTIFIER@</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
</dict>
diff --git a/mkspecs/unsupported/macx-ios-clang/qmake.conf b/mkspecs/unsupported/macx-ios-clang/qmake.conf
index 32d10a06ed..833e22e3bd 100644
--- a/mkspecs/unsupported/macx-ios-clang/qmake.conf
+++ b/mkspecs/unsupported/macx-ios-clang/qmake.conf
@@ -15,9 +15,6 @@ DEFINES += DARWIN_NO_CARBON QT_NO_CORESERVICES QT_NO_PRINTER QT_N
# Universal target (iPhone and iPad)
QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2
-include(../../common/xcode.conf)
-lessThan(QMAKE_XCODE_VERSION, "4.3"): error("This mkspec requires Xcode 4.3 or later")
-
include(../../common/ios.conf)
include(../../common/gcc-base-mac.conf)
include(../../common/clang.conf)
@@ -25,4 +22,6 @@ include(../../common/clang-mac.conf)
include(../../common/ios/clang.conf)
include(../../common/ios/qmake.conf)
+lessThan(QMAKE_XCODE_VERSION, "4.3"): error("This mkspec requires Xcode 4.3 or later")
+
load(qt_config)
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 69a8c809ac..d095bdf83d 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -3271,10 +3271,10 @@ MakefileGenerator::writePkgConfigFile()
t << "Cflags: "
// << var("QMAKE_CXXFLAGS") << " "
<< varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
- << project->values("PRL_EXPORT_CXXFLAGS").join(' ')
- << project->values("QMAKE_PKGCONFIG_CFLAGS").join(' ')
+ << varGlue("PRL_EXPORT_CXXFLAGS", "", " ", " ")
+ << varGlue("QMAKE_PKGCONFIG_CFLAGS", "", " ", " ")
// << varGlue("DEFINES","-D"," -D"," ")
- << " -I${includedir}" << endl;
+ << "-I${includedir}" << endl;
// requires
const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(' ');
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 400908bc91..9cb63ce539 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -579,7 +579,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t"
<< "-$(DEL_FILE) " << destdir << "$(TARGET1)\n\t"
<< "-$(DEL_FILE) " << destdir << "$(TARGET2)\n\t"
- << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << destdir;
+ << "-$(MOVE) $(TARGET) " << destdir << "\n\t"
+ << "-$(MOVE) $(TARGET0) " << destdir << "\n\t"
+ << "-$(MOVE) $(TARGET1) " << destdir << "\n\t"
+ << "-$(MOVE) $(TARGET2) " << destdir << "\n\t";
if(!project->isEmpty("QMAKE_POST_LINK"))
t << "\n\t" << var("QMAKE_POST_LINK");
t << endl << endl;
@@ -592,7 +595,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\n\t"
<< "-$(DEL_FILE) " << destdir << "$(TARGET)\n\t"
<< "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t"
- << "-$(MOVE) $(TARGET) $(TARGET0) " << destdir;
+ << "-$(MOVE) $(TARGET) " << destdir << "\n\t"
+ << "-$(MOVE) $(TARGET0) " << destdir << "\n\t";
if(!project->isEmpty("QMAKE_POST_LINK"))
t << "\n\t" << var("QMAKE_POST_LINK");
t << endl << endl;
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index ee53f94d90..e2c9fdbf37 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -307,7 +307,6 @@ void NmakeMakefileGenerator::init()
project->values("QMAKE_CLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk");
project->values("QMAKE_CLEAN").append("vc*.pdb");
project->values("QMAKE_CLEAN").append("vc*.idb");
- project->values("DEFINES").removeAll("NDEBUG");
} else {
ProStringList &defines = project->values("DEFINES");
if (!defines.contains("NDEBUG"))
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 793c2ad1ad..d3187bacb5 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -981,12 +981,8 @@ void VcprojGenerator::initConfiguration()
initDeploymentTool();
initPreLinkEventTools();
- // Set definite values in both configurations
- if (isDebug) {
- conf.compiler.PreprocessorDefinitions.removeAll("NDEBUG");
- } else {
+ if (!isDebug)
conf.compiler.PreprocessorDefinitions += "NDEBUG";
- }
}
void VcprojGenerator::initCompilerTool()
diff --git a/src/3rdparty/angle/.gitignore b/src/3rdparty/angle/.gitignore
index cfa07de1ee..c53d356b04 100644
--- a/src/3rdparty/angle/.gitignore
+++ b/src/3rdparty/angle/.gitignore
@@ -19,17 +19,24 @@ DEPS
codereview.settings
# Generated by flex/bison
-src/compiler/preprocessor/new/Tokenizer.cpp
-src/compiler/preprocessor/new/ExpressionParser.cpp
+src/compiler/preprocessor/Tokenizer.cpp
+src/compiler/preprocessor/ExpressionParser.cpp
src/compiler/glslang_lex.cpp
src/compiler/glslang_tab.cpp
src/compiler/glslang_tab.h
# Generated by FXC
-src/libGLESv2/shaders/standardvs.h
-src/libGLESv2/shaders/flipyvs.h
-src/libGLESv2/shaders/luminanceps.h
-src/libGLESv2/shaders/componentmaskps.h
-src/libGLESv2/shaders/passthroughps.h
+src/libGLESv2/renderer/shaders/compiled/standardvs.h
+src/libGLESv2/renderer/shaders/compiled/flipyvs.h
+src/libGLESv2/renderer/shaders/compiled/luminanceps.h
+src/libGLESv2/renderer/shaders/compiled/componentmaskps.h
+src/libGLESv2/renderer/shaders/compiled/passthroughps.h
+src/libGLESv2/renderer/shaders/compiled/PassthroughRGBA11ps.h
+src/libGLESv2/renderer/shaders/compiled/PassthroughRGB11ps.h
+src/libGLESv2/renderer/shaders/compiled/PassthroughLumAlpha11ps.h
+src/libGLESv2/renderer/shaders/compiled/PassthroughLum11ps.h
+src/libGLESv2/renderer/shaders/compiled/Passthrough11vs.h
+src/libGLESv2/renderer/shaders/compiled/Clear11ps.h
+src/libGLESv2/renderer/shaders/compiled/Clear11vs.h
diff --git a/src/3rdparty/angle/include/GLES2/gl2ext.h b/src/3rdparty/angle/include/GLES2/gl2ext.h
index e297fbfe87..bad50f9ccb 100644
--- a/src/3rdparty/angle/include/GLES2/gl2ext.h
+++ b/src/3rdparty/angle/include/GLES2/gl2ext.h
@@ -556,6 +556,44 @@ typedef void* GLeglImageOES;
#define GL_COLOR_ATTACHMENT15_NV 0x8CEF
#endif
+/* GL_EXT_draw_buffers */
+#ifndef GL_EXT_draw_buffers
+#define GL_MAX_DRAW_BUFFERS_EXT 0x8824
+#define GL_DRAW_BUFFER0_EXT 0x8825
+#define GL_DRAW_BUFFER1_EXT 0x8826
+#define GL_DRAW_BUFFER2_EXT 0x8827
+#define GL_DRAW_BUFFER3_EXT 0x8828
+#define GL_DRAW_BUFFER4_EXT 0x8829
+#define GL_DRAW_BUFFER5_EXT 0x882A
+#define GL_DRAW_BUFFER6_EXT 0x882B
+#define GL_DRAW_BUFFER7_EXT 0x882C
+#define GL_DRAW_BUFFER8_EXT 0x882D
+#define GL_DRAW_BUFFER9_EXT 0x882E
+#define GL_DRAW_BUFFER10_EXT 0x882F
+#define GL_DRAW_BUFFER11_EXT 0x8830
+#define GL_DRAW_BUFFER12_EXT 0x8831
+#define GL_DRAW_BUFFER13_EXT 0x8832
+#define GL_DRAW_BUFFER14_EXT 0x8833
+#define GL_DRAW_BUFFER15_EXT 0x8834
+#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
+#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
+#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
+#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
+#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
+#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
+#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
+#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
+#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
+#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
+#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
+#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
+#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
+#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
+#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
+#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
+#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
+#endif
+
/* GL_NV_fbo_color_attachments */
#ifndef GL_NV_fbo_color_attachments
#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
@@ -1331,6 +1369,14 @@ GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
#endif
+#ifndef GL_EXT_draw_buffers
+#define GL_EXT_draw_buffers 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs);
+#endif
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
+#endif
+
/* GL_NV_fbo_color_attachments */
#ifndef GL_NV_fbo_color_attachments
#define GL_NV_fbo_color_attachments 1
diff --git a/src/3rdparty/angle/include/GLSLANG/ShaderLang.h b/src/3rdparty/angle/include/GLSLANG/ShaderLang.h
index d925029a2c..da0f87aed9 100644
--- a/src/3rdparty/angle/include/GLSLANG/ShaderLang.h
+++ b/src/3rdparty/angle/include/GLSLANG/ShaderLang.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 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.
//
@@ -23,6 +23,9 @@
#define COMPILER_EXPORT
#endif
+#include "KHR/khrplatform.h"
+#include <stddef.h>
+
//
// This is the platform independent interface between an OGL driver
// and the shading language compiler.
@@ -34,7 +37,7 @@ extern "C" {
// Version number for shader translation API.
// It is incremented everytime the API changes.
-#define SH_VERSION 107
+#define ANGLE_SH_VERSION 110
//
// The names of the following enums have been derived by replacing GL prefix
@@ -75,9 +78,11 @@ typedef enum {
} ShShaderSpec;
typedef enum {
- SH_ESSL_OUTPUT = 0x8B45,
- SH_GLSL_OUTPUT = 0x8B46,
- SH_HLSL_OUTPUT = 0x8B47
+ SH_ESSL_OUTPUT = 0x8B45,
+ SH_GLSL_OUTPUT = 0x8B46,
+ SH_HLSL_OUTPUT = 0x8B47,
+ SH_HLSL9_OUTPUT = 0x8B47,
+ SH_HLSL11_OUTPUT = 0x8B48
} ShShaderOutput;
typedef enum {
@@ -110,7 +115,11 @@ typedef enum {
SH_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87,
SH_ACTIVE_ATTRIBUTES = 0x8B89,
SH_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A,
- SH_MAPPED_NAME_MAX_LENGTH = 0x8B8B
+ SH_MAPPED_NAME_MAX_LENGTH = 0x6000,
+ SH_NAME_MAX_LENGTH = 0x6001,
+ SH_HASHED_NAME_MAX_LENGTH = 0x6002,
+ SH_HASHED_NAMES_COUNT = 0x6003,
+ SH_ACTIVE_UNIFORMS_ARRAY = 0x6004
} ShShaderInfo;
// Compile options.
@@ -146,8 +155,25 @@ typedef enum {
// Enforce the GLSL 1.017 Appendix A section 7 packing restrictions.
SH_ENFORCE_PACKING_RESTRICTIONS = 0x0800,
+
+ // This flag ensures all indirect (expression-based) array indexing
+ // is clamped to the bounds of the array. This ensures, for example,
+ // that you cannot read off the end of a uniform, whether an array
+ // vec234, or mat234 type. The ShArrayIndexClampingStrategy enum,
+ // specified in the ShBuiltInResources when constructing the
+ // compiler, selects the strategy for the clamping implementation.
+ SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x1000
} ShCompileOptions;
+// Defines alternate strategies for implementing array index clamping.
+typedef enum {
+ // Use the clamp intrinsic for array index clamping.
+ SH_CLAMP_WITH_CLAMP_INTRINSIC = 1,
+
+ // Use a user-defined function for array index clamping.
+ SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION
+} ShArrayIndexClampingStrategy;
+
//
// Driver must call this first, once, before doing any other
// compiler operations.
@@ -160,6 +186,10 @@ COMPILER_EXPORT int ShInitialize();
//
COMPILER_EXPORT int ShFinalize();
+// The 64 bits hash function. The first parameter is the input string; the
+// second parameter is the string length.
+typedef khronos_uint64_t (*ShHashFunction64)(const char*, size_t);
+
//
// Implementation dependent built-in resources (constants and extensions).
// The names for these resources has been obtained by stripping gl_/GL_.
@@ -181,6 +211,20 @@ typedef struct
int OES_standard_derivatives;
int OES_EGL_image_external;
int ARB_texture_rectangle;
+ int EXT_draw_buffers;
+
+ // Set to 1 if highp precision is supported in the fragment language.
+ // Default is 0.
+ int FragmentPrecisionHigh;
+
+ // Name Hashing.
+ // Set a 64 bit hash function to enable user-defined name hashing.
+ // Default is NULL.
+ ShHashFunction64 HashFunction;
+
+ // Selects a strategy to use when implementing array index clamping.
+ // Default is SH_CLAMP_WITH_CLAMP_INTRINSIC.
+ ShArrayIndexClampingStrategy ArrayIndexClampingStrategy;
} ShBuiltInResources;
//
@@ -207,7 +251,7 @@ typedef void* ShHandle;
// spec: Specifies the language spec the compiler must conform to -
// SH_GLES2_SPEC or SH_WEBGL_SPEC.
// output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT,
-// or SH_HLSL_OUTPUT.
+// SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT.
// resources: Specifies the built-in resources.
COMPILER_EXPORT ShHandle ShConstructCompiler(
ShShaderType type,
@@ -244,7 +288,7 @@ COMPILER_EXPORT void ShDestruct(ShHandle handle);
COMPILER_EXPORT int ShCompile(
const ShHandle handle,
const char* const shaderStrings[],
- const int numStrings,
+ size_t numStrings,
int compileOptions
);
@@ -267,11 +311,16 @@ COMPILER_EXPORT int ShCompile(
// termination character.
// SH_MAPPED_NAME_MAX_LENGTH: the length of the mapped variable name including
// the null termination character.
-//
+// SH_NAME_MAX_LENGTH: the max length of a user-defined name including the
+// null termination character.
+// SH_HASHED_NAME_MAX_LENGTH: the max length of a hashed name including the
+// null termination character.
+// SH_HASHED_NAMES_COUNT: the number of hashed names from the latest compile.
+//
// params: Requested parameter
COMPILER_EXPORT void ShGetInfo(const ShHandle handle,
ShShaderInfo pname,
- int* params);
+ size_t* params);
// Returns nul-terminated information log for a compiled shader.
// Parameters:
@@ -314,7 +363,7 @@ COMPILER_EXPORT void ShGetObjectCode(const ShHandle handle, char* objCode);
// mappedName are the same.
COMPILER_EXPORT void ShGetActiveAttrib(const ShHandle handle,
int index,
- int* length,
+ size_t* length,
int* size,
ShDataType* type,
char* name,
@@ -341,12 +390,42 @@ COMPILER_EXPORT void ShGetActiveAttrib(const ShHandle handle,
// mappedName are the same.
COMPILER_EXPORT void ShGetActiveUniform(const ShHandle handle,
int index,
- int* length,
+ size_t* length,
int* size,
ShDataType* type,
char* name,
char* mappedName);
+// Returns information about a name hashing entry from the latest compile.
+// Parameters:
+// handle: Specifies the compiler
+// index: Specifies the index of the name hashing entry to be queried.
+// name: Returns a null terminated string containing the user defined name.
+// It is assumed that name has enough memory to accomodate the name.
+// The size of the buffer required to store the user defined name can
+// be obtained by calling ShGetInfo with SH_NAME_MAX_LENGTH.
+// hashedName: Returns a null terminated string containing the hashed name of
+// the uniform variable, It is assumed that hashedName has enough
+// memory to accomodate the name. The size of the buffer required
+// to store the name can be obtained by calling ShGetInfo with
+// SH_HASHED_NAME_MAX_LENGTH.
+COMPILER_EXPORT void ShGetNameHashingEntry(const ShHandle handle,
+ int index,
+ char* name,
+ char* hashedName);
+
+// Returns a parameter from a compiled shader.
+// Parameters:
+// handle: Specifies the compiler
+// pname: Specifies the parameter to query.
+// The following parameters are defined:
+// SH_ACTIVE_UNIFORMS_ARRAY: an STL vector of active uniforms. Valid only for
+// HLSL output.
+// params: Requested parameter
+COMPILER_EXPORT void ShGetInfoPointer(const ShHandle handle,
+ ShShaderInfo pname,
+ void** params);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/3rdparty/angle/src/common/angleutils.h b/src/3rdparty/angle/src/common/angleutils.h
index ff9730c4da..31ac559279 100644
--- a/src/3rdparty/angle/src/common/angleutils.h
+++ b/src/3rdparty/angle/src/common/angleutils.h
@@ -15,6 +15,31 @@
TypeName(const TypeName&); \
void operator=(const TypeName&)
+template <typename T, unsigned int N>
+inline unsigned int ArraySize(T(&)[N])
+{
+ return N;
+}
+
+template <typename T, unsigned int N>
+void SafeRelease(T (&resourceBlock)[N])
+{
+ for (unsigned int i = 0; i < N; i++)
+ {
+ SafeRelease(resourceBlock[i]);
+ }
+}
+
+template <typename T>
+void SafeRelease(T& resource)
+{
+ if (resource)
+ {
+ resource->Release();
+ resource = NULL;
+ }
+}
+
#if defined(_MSC_VER)
#define snprintf _snprintf
#endif
@@ -23,4 +48,7 @@
#define VENDOR_ID_INTEL 0x8086
#define VENDOR_ID_NVIDIA 0x10DE
+#define GL_BGRA4_ANGLEX 0x6ABC
+#define GL_BGR5_A1_ANGLEX 0x6ABD
+
#endif // COMMON_ANGLEUTILS_H_
diff --git a/src/3rdparty/angle/src/common/debug.cpp b/src/3rdparty/angle/src/common/debug.cpp
index b2238f9708..438d3975e8 100644
--- a/src/3rdparty/angle/src/common/debug.cpp
+++ b/src/3rdparty/angle/src/common/debug.cpp
@@ -7,11 +7,12 @@
// debug.cpp: Debugging utilities.
#include "common/debug.h"
-
-#include <stdio.h>
-#include <stdarg.h>
+#include "common/system.h"
+#ifdef ANGLE_ENABLE_D3D11
+typedef DWORD D3DCOLOR;
+#else
#include <d3d9.h>
-#include <windows.h>
+#endif
namespace gl
{
@@ -84,6 +85,12 @@ bool perfActive()
ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
{
#if !defined(ANGLE_DISABLE_PERF)
+#if defined(ANGLE_DISABLE_TRACE)
+ if (!perfActive())
+ {
+ return;
+ }
+#endif
va_list vararg;
va_start(vararg, format);
output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg);
diff --git a/src/3rdparty/angle/src/common/debug.h b/src/3rdparty/angle/src/common/debug.h
index 5f8f60fe61..23ee26d23b 100644
--- a/src/3rdparty/angle/src/common/debug.h
+++ b/src/3rdparty/angle/src/common/debug.h
@@ -99,6 +99,13 @@ 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))
+#define HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast<type >(obj) != NULL)
+#else
+#define HAS_DYNAMIC_TYPE(type, obj) true
+#endif
+
// A macro functioning as a compile-time assert to validate constant conditions
#define META_ASSERT(condition) typedef int COMPILE_TIME_ASSERT_##__LINE__[static_cast<bool>(condition)?1:-1]
diff --git a/src/3rdparty/angle/src/common/system.h b/src/3rdparty/angle/src/common/system.h
new file mode 100644
index 0000000000..5eb140bccd
--- /dev/null
+++ b/src/3rdparty/angle/src/common/system.h
@@ -0,0 +1,26 @@
+//
+// 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 fec98a15c9..7913851e6a 100644
--- a/src/3rdparty/angle/src/common/version.h
+++ b/src/3rdparty/angle/src/common/version.h
@@ -1,10 +1,12 @@
#define MAJOR_VERSION 1
-#define MINOR_VERSION 0
+#define MINOR_VERSION 1
#define BUILD_VERSION 0
-#define BUILD_REVISION 1318
+#define BUILD_REVISION 2037
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
#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 VERSION_DWORD ((MAJOR_VERSION << 24) | (MINOR_VERSION << 16) | BUILD_REVISION)
diff --git a/src/3rdparty/angle/src/compiler/BaseTypes.h b/src/3rdparty/angle/src/compiler/BaseTypes.h
index 5f83185304..af4c7e3ed9 100644
--- a/src/3rdparty/angle/src/compiler/BaseTypes.h
+++ b/src/3rdparty/angle/src/compiler/BaseTypes.h
@@ -16,7 +16,7 @@ enum TPrecision
EbpUndefined,
EbpLow,
EbpMedium,
- EbpHigh,
+ EbpHigh
};
inline const char* getPrecisionString(TPrecision p)
@@ -47,7 +47,7 @@ enum TBasicType
EbtGuardSamplerEnd, // non type: see implementation of IsSampler()
EbtStruct,
EbtAddress, // should be deprecated??
- EbtInvariant, // used as a type when qualifying a previously declared variable as being invariant
+ EbtInvariant // used as a type when qualifying a previously declared variable as being invariant
};
inline const char* getBasicString(TBasicType t)
@@ -114,7 +114,7 @@ enum TQualifier
EvqFragData,
// end of list
- EvqLast,
+ EvqLast
};
//
diff --git a/src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp b/src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp
index f46ff66d40..637ccc5e37 100644
--- a/src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 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.
//
@@ -14,9 +14,11 @@
TCompiler* ConstructCompiler(
ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
{
- switch (output) {
- case SH_HLSL_OUTPUT:
- return new TranslatorHLSL(type, spec);
+ switch (output)
+ {
+ 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/Compiler.cpp b/src/3rdparty/angle/src/compiler/Compiler.cpp
index 9e7f75c33a..c8c79e7147 100644
--- a/src/3rdparty/angle/src/compiler/Compiler.cpp
+++ b/src/3rdparty/angle/src/compiler/Compiler.cpp
@@ -19,6 +19,7 @@
#include "compiler/depgraph/DependencyGraphOutput.h"
#include "compiler/timing/RestrictFragmentShaderTiming.h"
#include "compiler/timing/RestrictVertexShaderTiming.h"
+#include "third_party/compiler/ArrayBoundsClamper.h"
bool isWebGLBasedSpec(ShShaderSpec spec)
{
@@ -37,6 +38,7 @@ bool InitializeSymbolTable(
// The builtins deliberately don't specify precisions for the function
// arguments and return types. For that reason we don't try to check them.
TParseContext parseContext(symbolTable, extBehavior, intermediate, type, spec, 0, false, NULL, infoSink);
+ parseContext.fragmentPrecisionHigh = resources.FragmentPrecisionHigh == 1;
GlobalParseContext = &parseContext;
@@ -101,6 +103,8 @@ TShHandleBase::~TShHandleBase() {
TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
: shaderType(type),
shaderSpec(spec),
+ fragmentPrecisionHigh(false),
+ clampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC),
builtInFunctionEmulator(type)
{
longNameMap = LongNameMap::GetInstance();
@@ -123,12 +127,18 @@ bool TCompiler::Init(const ShBuiltInResources& resources)
if (!InitBuiltInSymbolTable(resources))
return false;
InitExtensionBehavior(resources, extensionBehavior);
+ fragmentPrecisionHigh = resources.FragmentPrecisionHigh == 1;
+
+ arrayBoundsClamper.SetClampingStrategy(resources.ArrayIndexClampingStrategy);
+ clampingStrategy = resources.ArrayIndexClampingStrategy;
+
+ hashFunction = resources.HashFunction;
return true;
}
bool TCompiler::compile(const char* const shaderStrings[],
- const int numStrings,
+ size_t numStrings,
int compileOptions)
{
TScopedPoolAllocator scopedAlloc(&allocator, true);
@@ -143,7 +153,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
// First string is path of source file if flag is set. The actual source follows.
const char* sourcePath = NULL;
- int firstSource = 0;
+ size_t firstSource = 0;
if (compileOptions & SH_SOURCE_PATH)
{
sourcePath = shaderStrings[0];
@@ -154,6 +164,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
TParseContext parseContext(symbolTable, extensionBehavior, intermediate,
shaderType, shaderSpec, compileOptions, true,
sourcePath, infoSink);
+ parseContext.fragmentPrecisionHigh = fragmentPrecisionHigh;
GlobalParseContext = &parseContext;
// We preserve symbols at the built-in level from compile-to-compile.
@@ -190,10 +201,15 @@ bool TCompiler::compile(const char* const shaderStrings[],
if (success && (compileOptions & SH_EMULATE_BUILT_IN_FUNCTIONS))
builtInFunctionEmulator.MarkBuiltInFunctionsForEmulation(root);
+ // Clamping uniform array bounds needs to happen after validateLimitations pass.
+ if (success && (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS))
+ arrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root);
+
// Call mapLongVariableNames() before collectAttribsUniforms() so in
// collectAttribsUniforms() we already have the mapped symbol names and
// we could composite mapped and original variable names.
- if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES))
+ // Also, if we hash all the names, then no need to do this for long names.
+ if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) && hashFunction == NULL)
mapLongVariableNames(root);
if (success && (compileOptions & SH_ATTRIBUTES_UNIFORMS)) {
@@ -227,6 +243,7 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources& resources)
{
TBuiltIns builtIns;
+ compileResources = resources;
builtIns.initialize(shaderType, shaderSpec, resources);
return InitializeSymbolTable(builtIns.getBuiltInStrings(),
shaderType, shaderSpec, resources, infoSink, symbolTable);
@@ -234,6 +251,7 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources& resources)
void TCompiler::clearResults()
{
+ arrayBoundsClamper.Cleanup();
infoSink.info.erase();
infoSink.obj.erase();
infoSink.debug.erase();
@@ -242,6 +260,8 @@ void TCompiler::clearResults()
uniforms.clear();
builtInFunctionEmulator.Cleanup();
+
+ nameMap.clear();
}
bool TCompiler::detectRecursion(TIntermNode* root)
@@ -317,7 +337,7 @@ bool TCompiler::enforceVertexShaderTimingRestrictions(TIntermNode* root)
void TCompiler::collectAttribsUniforms(TIntermNode* root)
{
- CollectAttribsUniforms collect(attribs, uniforms);
+ CollectAttribsUniforms collect(attribs, uniforms, hashFunction);
root->traverse(&collect);
}
@@ -344,6 +364,21 @@ const TExtensionBehavior& TCompiler::getExtensionBehavior() const
return extensionBehavior;
}
+const ShBuiltInResources& TCompiler::getResources() const
+{
+ return compileResources;
+}
+
+const ArrayBoundsClamper& TCompiler::getArrayBoundsClamper() const
+{
+ return arrayBoundsClamper;
+}
+
+ShArrayIndexClampingStrategy TCompiler::getArrayIndexClampingStrategy() const
+{
+ return clampingStrategy;
+}
+
const BuiltInFunctionEmulator& TCompiler::getBuiltInFunctionEmulator() const
{
return builtInFunctionEmulator;
diff --git a/src/3rdparty/angle/src/compiler/ConstantUnion.h b/src/3rdparty/angle/src/compiler/ConstantUnion.h
index fd9d94dc5a..32af4d38b0 100644
--- a/src/3rdparty/angle/src/compiler/ConstantUnion.h
+++ b/src/3rdparty/angle/src/compiler/ConstantUnion.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 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.
//
@@ -14,6 +14,7 @@ public:
ConstantUnion()
{
iConst = 0;
+ type = EbtVoid;
}
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
diff --git a/src/3rdparty/angle/src/compiler/DetectDiscontinuity.cpp b/src/3rdparty/angle/src/compiler/DetectDiscontinuity.cpp
index 472232a75d..7c3b68a0b3 100644
--- a/src/3rdparty/angle/src/compiler/DetectDiscontinuity.cpp
+++ b/src/3rdparty/angle/src/compiler/DetectDiscontinuity.cpp
@@ -16,11 +16,26 @@ namespace sh
{
bool DetectLoopDiscontinuity::traverse(TIntermNode *node)
{
+ mLoopDepth = 0;
mLoopDiscontinuity = false;
node->traverse(this);
return mLoopDiscontinuity;
}
+bool DetectLoopDiscontinuity::visitLoop(Visit visit, TIntermLoop *loop)
+{
+ if (visit == PreVisit)
+ {
+ ++mLoopDepth;
+ }
+ else if (visit == PostVisit)
+ {
+ --mLoopDepth;
+ }
+
+ return true;
+}
+
bool DetectLoopDiscontinuity::visitBranch(Visit visit, TIntermBranch *node)
{
if (mLoopDiscontinuity)
@@ -28,14 +43,19 @@ bool DetectLoopDiscontinuity::visitBranch(Visit visit, TIntermBranch *node)
return false;
}
+ if (!mLoopDepth)
+ {
+ return true;
+ }
+
switch (node->getFlowOp())
{
case EOpKill:
break;
case EOpBreak:
case EOpContinue:
- mLoopDiscontinuity = true;
case EOpReturn:
+ mLoopDiscontinuity = true;
break;
default: UNREACHABLE();
}
diff --git a/src/3rdparty/angle/src/compiler/DetectDiscontinuity.h b/src/3rdparty/angle/src/compiler/DetectDiscontinuity.h
index 8bda4c3dea..e5520bd5b0 100644
--- a/src/3rdparty/angle/src/compiler/DetectDiscontinuity.h
+++ b/src/3rdparty/angle/src/compiler/DetectDiscontinuity.h
@@ -23,8 +23,10 @@ class DetectLoopDiscontinuity : public TIntermTraverser
protected:
bool visitBranch(Visit visit, TIntermBranch *node);
+ bool visitLoop(Visit visit, TIntermLoop *loop);
bool visitAggregate(Visit visit, TIntermAggregate *node);
+ int mLoopDepth;
bool mLoopDiscontinuity;
};
diff --git a/src/3rdparty/angle/src/compiler/Diagnostics.cpp b/src/3rdparty/angle/src/compiler/Diagnostics.cpp
index 8aa1cb6b24..06f370dbe5 100644
--- a/src/3rdparty/angle/src/compiler/Diagnostics.cpp
+++ b/src/3rdparty/angle/src/compiler/Diagnostics.cpp
@@ -8,7 +8,7 @@
#include "compiler/debug.h"
#include "compiler/InfoSink.h"
-#include "compiler/preprocessor/new/SourceLocation.h"
+#include "compiler/preprocessor/SourceLocation.h"
TDiagnostics::TDiagnostics(TInfoSink& infoSink) :
mInfoSink(infoSink),
diff --git a/src/3rdparty/angle/src/compiler/Diagnostics.h b/src/3rdparty/angle/src/compiler/Diagnostics.h
index 3670414b03..cb71bb1204 100644
--- a/src/3rdparty/angle/src/compiler/Diagnostics.h
+++ b/src/3rdparty/angle/src/compiler/Diagnostics.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_DIAGNOSTICS_H_
#define COMPILER_DIAGNOSTICS_H_
-#include "compiler/preprocessor/new/Diagnostics.h"
+#include "compiler/preprocessor/DiagnosticsBase.h"
class TInfoSink;
diff --git a/src/3rdparty/angle/src/compiler/DirectiveHandler.h b/src/3rdparty/angle/src/compiler/DirectiveHandler.h
index 21d3dfc315..95ca59d6fe 100644
--- a/src/3rdparty/angle/src/compiler/DirectiveHandler.h
+++ b/src/3rdparty/angle/src/compiler/DirectiveHandler.h
@@ -9,7 +9,7 @@
#include "compiler/ExtensionBehavior.h"
#include "compiler/Pragma.h"
-#include "compiler/preprocessor/new/DirectiveHandler.h"
+#include "compiler/preprocessor/DirectiveHandlerBase.h"
class TDiagnostics;
diff --git a/src/3rdparty/angle/src/compiler/ExtensionBehavior.h b/src/3rdparty/angle/src/compiler/ExtensionBehavior.h
index 6040980837..5c1595fb21 100644
--- a/src/3rdparty/angle/src/compiler/ExtensionBehavior.h
+++ b/src/3rdparty/angle/src/compiler/ExtensionBehavior.h
@@ -16,7 +16,7 @@ typedef enum
EBhEnable,
EBhWarn,
EBhDisable,
- EBhUndefined,
+ EBhUndefined
} TBehavior;
inline const char* getBehaviorString(TBehavior b)
diff --git a/src/3rdparty/angle/src/compiler/ForLoopUnroll.cpp b/src/3rdparty/angle/src/compiler/ForLoopUnroll.cpp
index fdc3f44431..27a13eabab 100644
--- a/src/3rdparty/angle/src/compiler/ForLoopUnroll.cpp
+++ b/src/3rdparty/angle/src/compiler/ForLoopUnroll.cpp
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2011 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.
//
@@ -210,6 +210,6 @@ int ForLoopUnroll::getLoopIncrement(TIntermLoop* node)
int ForLoopUnroll::evaluateIntConstant(TIntermConstantUnion* node)
{
ASSERT((node != NULL) && (node->getUnionArrayPointer() != NULL));
- return node->getUnionArrayPointer()->getIConst();
+ return node->getIConst(0);
}
diff --git a/src/3rdparty/angle/src/compiler/HashNames.h b/src/3rdparty/angle/src/compiler/HashNames.h
new file mode 100644
index 0000000000..d2141e2d85
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/HashNames.h
@@ -0,0 +1,19 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_HASH_NAMES_H_
+#define COMPILER_HASH_NAMES_H_
+
+#include <map>
+
+#include "compiler/intermediate.h"
+#include "GLSLANG/ShaderLang.h"
+
+#define HASHED_NAME_PREFIX "webgl_"
+
+typedef std::map<TPersistString, TPersistString> NameMap;
+
+#endif // COMPILER_HASH_NAMES_H_
diff --git a/src/3rdparty/angle/src/compiler/Initialize.cpp b/src/3rdparty/angle/src/compiler/Initialize.cpp
index 3e94ce7ba8..97b46f898e 100644
--- a/src/3rdparty/angle/src/compiler/Initialize.cpp
+++ b/src/3rdparty/angle/src/compiler/Initialize.cpp
@@ -654,4 +654,6 @@ void InitExtensionBehavior(const ShBuiltInResources& resources,
extBehavior["GL_OES_EGL_image_external"] = EBhUndefined;
if (resources.ARB_texture_rectangle)
extBehavior["GL_ARB_texture_rectangle"] = EBhUndefined;
+ if (resources.EXT_draw_buffers)
+ extBehavior["GL_EXT_draw_buffers"] = EBhUndefined;
}
diff --git a/src/3rdparty/angle/src/compiler/Intermediate.cpp b/src/3rdparty/angle/src/compiler/Intermediate.cpp
index 92c450530e..edf279ef67 100644
--- a/src/3rdparty/angle/src/compiler/Intermediate.cpp
+++ b/src/3rdparty/angle/src/compiler/Intermediate.cpp
@@ -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.
//
@@ -12,6 +12,7 @@
#include <limits.h>
#include <algorithm>
+#include "compiler/HashNames.h"
#include "compiler/localintermediate.h"
#include "compiler/QualifierAlive.h"
#include "compiler/RemoveTree.h"
@@ -592,7 +593,7 @@ TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nod
//
if (cond->getAsTyped() && cond->getAsTyped()->getAsConstantUnion()) {
- if (cond->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->getBConst() == true)
+ if (cond->getAsConstantUnion()->getBConst(0) == true)
return nodePair.node1 ? setAggregateOperator(nodePair.node1, EOpSequence, nodePair.node1->getLine()) : NULL;
else
return nodePair.node2 ? setAggregateOperator(nodePair.node2, EOpSequence, nodePair.node2->getLine()) : NULL;
@@ -646,7 +647,7 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
//
if (cond->getAsConstantUnion() && trueBlock->getAsConstantUnion() && falseBlock->getAsConstantUnion()) {
- if (cond->getAsConstantUnion()->getUnionArrayPointer()->getBConst())
+ if (cond->getAsConstantUnion()->getBConst(0))
return trueBlock;
else
return falseBlock;
@@ -845,6 +846,7 @@ bool TIntermUnary::promote(TInfoSink&)
}
setType(operand->getType());
+ type.setQualifier(EvqTemporary);
return true;
}
@@ -1161,7 +1163,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
case EbtFloat:
if (rightUnionArray[i] == 0.0f) {
infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
- tempConstArray[i].setFConst(FLT_MAX);
+ tempConstArray[i].setFConst(unionArray[i].getFConst() < 0 ? -FLT_MAX : FLT_MAX);
} else
tempConstArray[i].setFConst(unionArray[i].getFConst() / rightUnionArray[i].getFConst());
break;
@@ -1376,7 +1378,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermConstantUnion* node)
{
- ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
int size = node->getType().getObjectSize();
ConstantUnion *leftUnionArray = new ConstantUnion[size];
@@ -1387,13 +1388,13 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
case EbtFloat:
switch (node->getType().getBasicType()) {
case EbtInt:
- leftUnionArray[i].setFConst(static_cast<float>(rightUnionArray[i].getIConst()));
+ leftUnionArray[i].setFConst(static_cast<float>(node->getIConst(i)));
break;
case EbtBool:
- leftUnionArray[i].setFConst(static_cast<float>(rightUnionArray[i].getBConst()));
+ leftUnionArray[i].setFConst(static_cast<float>(node->getBConst(i)));
break;
case EbtFloat:
- leftUnionArray[i] = rightUnionArray[i];
+ leftUnionArray[i].setFConst(static_cast<float>(node->getFConst(i)));
break;
default:
infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
@@ -1403,13 +1404,13 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
case EbtInt:
switch (node->getType().getBasicType()) {
case EbtInt:
- leftUnionArray[i] = rightUnionArray[i];
+ leftUnionArray[i].setIConst(static_cast<int>(node->getIConst(i)));
break;
case EbtBool:
- leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getBConst()));
+ leftUnionArray[i].setIConst(static_cast<int>(node->getBConst(i)));
break;
case EbtFloat:
- leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getFConst()));
+ leftUnionArray[i].setIConst(static_cast<int>(node->getFConst(i)));
break;
default:
infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
@@ -1419,13 +1420,13 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
case EbtBool:
switch (node->getType().getBasicType()) {
case EbtInt:
- leftUnionArray[i].setBConst(rightUnionArray[i].getIConst() != 0);
+ leftUnionArray[i].setBConst(node->getIConst(i) != 0);
break;
case EbtBool:
- leftUnionArray[i] = rightUnionArray[i];
+ leftUnionArray[i].setBConst(node->getBConst(i));
break;
case EbtFloat:
- leftUnionArray[i].setBConst(rightUnionArray[i].getFConst() != 0.0f);
+ leftUnionArray[i].setBConst(node->getFConst(i) != 0.0f);
break;
default:
infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
@@ -1445,3 +1446,14 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
return addConstantUnion(leftUnionArray, TType(promoteTo, t.getPrecision(), t.getQualifier(), t.getNominalSize(), t.isMatrix(), t.isArray()), node->getLine());
}
+// static
+TString TIntermTraverser::hash(const TString& name, ShHashFunction64 hashFunction)
+{
+ if (hashFunction == NULL || name.empty())
+ return name;
+ khronos_uint64_t number = (*hashFunction)(name.c_str(), name.length());
+ TStringStream stream;
+ stream << HASHED_NAME_PREFIX << std::hex << number;
+ TString hashedName = stream.str();
+ return hashedName;
+}
diff --git a/src/3rdparty/angle/src/compiler/MapLongVariableNames.cpp b/src/3rdparty/angle/src/compiler/MapLongVariableNames.cpp
index a50310154d..a41d20f4e8 100644
--- a/src/3rdparty/angle/src/compiler/MapLongVariableNames.cpp
+++ b/src/3rdparty/angle/src/compiler/MapLongVariableNames.cpp
@@ -8,7 +8,7 @@
namespace {
-TString mapLongName(int id, const TString& name, bool isGlobal)
+TString mapLongName(size_t id, const TString& name, bool isGlobal)
{
ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE);
TStringStream stream;
@@ -70,7 +70,7 @@ void LongNameMap::Insert(const char* originalName, const char* mappedName)
originalName, mappedName));
}
-int LongNameMap::Size() const
+size_t LongNameMap::Size() const
{
return mLongNameMap.size();
}
@@ -115,7 +115,7 @@ TString MapLongVariableNames::mapGlobalLongName(const TString& name)
const char* mappedName = mGlobalMap->Find(name.c_str());
if (mappedName != NULL)
return mappedName;
- int id = mGlobalMap->Size();
+ size_t id = mGlobalMap->Size();
TString rt = mapLongName(id, name, true);
mGlobalMap->Insert(name.c_str(), rt.c_str());
return rt;
diff --git a/src/3rdparty/angle/src/compiler/MapLongVariableNames.h b/src/3rdparty/angle/src/compiler/MapLongVariableNames.h
index fb2c7e81cb..d6352acb4b 100644
--- a/src/3rdparty/angle/src/compiler/MapLongVariableNames.h
+++ b/src/3rdparty/angle/src/compiler/MapLongVariableNames.h
@@ -31,7 +31,7 @@ public:
void Insert(const char* originalName, const char* mappedName);
// Return the number of entries in the map.
- int Size() const;
+ size_t Size() const;
private:
LongNameMap();
diff --git a/src/3rdparty/angle/src/compiler/OutputESSL.cpp b/src/3rdparty/angle/src/compiler/OutputESSL.cpp
index 64ee92d44e..c2048f1cec 100644
--- a/src/3rdparty/angle/src/compiler/OutputESSL.cpp
+++ b/src/3rdparty/angle/src/compiler/OutputESSL.cpp
@@ -6,8 +6,12 @@
#include "compiler/OutputESSL.h"
-TOutputESSL::TOutputESSL(TInfoSinkBase& objSink)
- : TOutputGLSLBase(objSink)
+TOutputESSL::TOutputESSL(TInfoSinkBase& objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap& nameMap,
+ TSymbolTable& symbolTable)
+ : TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable)
{
}
diff --git a/src/3rdparty/angle/src/compiler/OutputESSL.h b/src/3rdparty/angle/src/compiler/OutputESSL.h
index 4fa73c8047..05db96e497 100644
--- a/src/3rdparty/angle/src/compiler/OutputESSL.h
+++ b/src/3rdparty/angle/src/compiler/OutputESSL.h
@@ -12,7 +12,11 @@
class TOutputESSL : public TOutputGLSLBase
{
public:
- TOutputESSL(TInfoSinkBase& objSink);
+ TOutputESSL(TInfoSinkBase& objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap& nameMap,
+ TSymbolTable& symbolTable);
protected:
virtual bool writeVariablePrecision(TPrecision precision);
diff --git a/src/3rdparty/angle/src/compiler/OutputGLSL.cpp b/src/3rdparty/angle/src/compiler/OutputGLSL.cpp
index dd31b4b58b..206f403408 100644
--- a/src/3rdparty/angle/src/compiler/OutputGLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/OutputGLSL.cpp
@@ -6,8 +6,12 @@
#include "compiler/OutputGLSL.h"
-TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink)
- : TOutputGLSLBase(objSink)
+TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap& nameMap,
+ TSymbolTable& symbolTable)
+ : TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable)
{
}
diff --git a/src/3rdparty/angle/src/compiler/OutputGLSL.h b/src/3rdparty/angle/src/compiler/OutputGLSL.h
index 0fe2356eb7..199b6f3e46 100644
--- a/src/3rdparty/angle/src/compiler/OutputGLSL.h
+++ b/src/3rdparty/angle/src/compiler/OutputGLSL.h
@@ -12,7 +12,11 @@
class TOutputGLSL : public TOutputGLSLBase
{
public:
- TOutputGLSL(TInfoSinkBase& objSink);
+ TOutputGLSL(TInfoSinkBase& objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap& nameMap,
+ TSymbolTable& symbolTable);
protected:
virtual bool writeVariablePrecision(TPrecision);
diff --git a/src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp b/src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp
index 552fa5066d..1b9a10deaa 100644
--- a/src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp
+++ b/src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp
@@ -7,37 +7,10 @@
#include "compiler/OutputGLSLBase.h"
#include "compiler/debug.h"
+#include <cfloat>
+
namespace
{
-TString getTypeName(const TType& type)
-{
- TInfoSinkBase out;
- if (type.isMatrix())
- {
- out << "mat";
- out << type.getNominalSize();
- }
- else if (type.isVector())
- {
- switch (type.getBasicType())
- {
- case EbtFloat: out << "vec"; break;
- case EbtInt: out << "ivec"; break;
- case EbtBool: out << "bvec"; break;
- default: UNREACHABLE(); break;
- }
- out << type.getNominalSize();
- }
- else
- {
- if (type.getBasicType() == EbtStruct)
- out << type.getTypeName();
- else
- out << type.getBasicString();
- }
- return TString(out.c_str());
-}
-
TString arrayBrackets(const TType& type)
{
ASSERT(type.isArray());
@@ -66,10 +39,18 @@ bool isSingleStatement(TIntermNode* node) {
}
} // namespace
-TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase& objSink)
+TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase& objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap& nameMap,
+ TSymbolTable& symbolTable)
: TIntermTraverser(true, true, true),
mObjSink(objSink),
- mDeclaringVariables(false)
+ mDeclaringVariables(false),
+ mClampingStrategy(clampingStrategy),
+ mHashFunction(hashFunction),
+ mNameMap(nameMap),
+ mSymbolTable(symbolTable)
{
}
@@ -101,7 +82,7 @@ void TOutputGLSLBase::writeVariableType(const TType& type)
if ((type.getBasicType() == EbtStruct) &&
(mDeclaredStructs.find(type.getTypeName()) == mDeclaredStructs.end()))
{
- out << "struct " << type.getTypeName() << "{\n";
+ out << "struct " << hashName(type.getTypeName()) << "{\n";
const TTypeList* structure = type.getStruct();
ASSERT(structure != NULL);
for (size_t i = 0; i < structure->size(); ++i)
@@ -110,7 +91,7 @@ void TOutputGLSLBase::writeVariableType(const TType& type)
ASSERT(fieldType != NULL);
if (writeVariablePrecision(fieldType->getPrecision()))
out << " ";
- out << getTypeName(*fieldType) << " " << fieldType->getFieldName();
+ out << getTypeName(*fieldType) << " " << hashName(fieldType->getFieldName());
if (fieldType->isArray())
out << arrayBrackets(*fieldType);
out << ";\n";
@@ -140,7 +121,7 @@ void TOutputGLSLBase::writeFunctionParameters(const TIntermSequence& args)
const TString& name = arg->getSymbol();
if (!name.empty())
- out << " " << name;
+ out << " " << hashName(name);
if (type.isArray())
out << arrayBrackets(type);
@@ -157,7 +138,7 @@ const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType& type,
if (type.getBasicType() == EbtStruct)
{
- out << type.getTypeName() << "(";
+ out << hashName(type.getTypeName()) << "(";
const TTypeList* structure = type.getStruct();
ASSERT(structure != NULL);
for (size_t i = 0; i < structure->size(); ++i)
@@ -178,7 +159,7 @@ const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType& type,
{
switch (pConstUnion->getType())
{
- case EbtFloat: out << pConstUnion->getFConst(); break;
+ case EbtFloat: out << std::min(FLT_MAX, std::max(-FLT_MAX, pConstUnion->getFConst())); break;
case EbtInt: out << pConstUnion->getIConst(); break;
case EbtBool: out << pConstUnion->getBConst(); break;
default: UNREACHABLE();
@@ -196,7 +177,7 @@ void TOutputGLSLBase::visitSymbol(TIntermSymbol* node)
if (mLoopUnroll.NeedsToReplaceSymbolWithValue(node))
out << mLoopUnroll.GetLoopIndexValue(node);
else
- out << node->getSymbol();
+ out << hashVariableName(node->getSymbol());
if (mDeclaringVariables && node->getType().isArray())
out << arrayBrackets(node->getType());
@@ -235,15 +216,59 @@ bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary* node)
break;
case EOpIndexDirect:
- case EOpIndexIndirect:
writeTriplet(visit, NULL, "[", "]");
break;
+ case EOpIndexIndirect:
+ if (node->getAddIndexClamp())
+ {
+ if (visit == InVisit)
+ {
+ if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC) {
+ out << "[int(clamp(float(";
+ } else {
+ out << "[webgl_int_clamp(";
+ }
+ }
+ else if (visit == PostVisit)
+ {
+ int maxSize;
+ TIntermTyped *left = node->getLeft();
+ TType leftType = left->getType();
+
+ if (left->isArray())
+ {
+ // The shader will fail validation if the array length is not > 0.
+ maxSize = leftType.getArraySize() - 1;
+ }
+ else
+ {
+ maxSize = leftType.getNominalSize() - 1;
+ }
+
+ if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC) {
+ out << "), 0.0, float(" << maxSize << ")))]";
+ } else {
+ out << ", 0, " << maxSize << ")]";
+ }
+ }
+ }
+ else
+ {
+ writeTriplet(visit, NULL, "[", "]");
+ }
+ break;
case EOpIndexDirectStruct:
if (visit == InVisit)
{
out << ".";
// TODO(alokp): ASSERT
- out << node->getType().getFieldName();
+ TString fieldName = node->getType().getFieldName();
+
+ const TType& structType = node->getLeft()->getType();
+ if (!mSymbolTable.findBuiltIn(structType.getTypeName()))
+ fieldName = hashName(fieldName);
+
+ out << fieldName;
visitChildren = false;
}
break;
@@ -467,7 +492,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
// Function declaration.
ASSERT(visit == PreVisit);
writeVariableType(node->getType());
- out << " " << node->getName();
+ out << " " << hashName(node->getName());
out << "(";
writeFunctionParameters(node->getSequence());
@@ -480,7 +505,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
// Function definition.
ASSERT(visit == PreVisit);
writeVariableType(node->getType());
- out << " " << TFunction::unmangleName(node->getName());
+ out << " " << hashFunctionName(node->getName());
incrementDepth();
// Function definition node contains one or two children nodes
@@ -510,8 +535,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
// Function call.
if (visit == PreVisit)
{
- TString functionName = TFunction::unmangleName(node->getName());
- out << functionName << "(";
+ out << hashFunctionName(node->getName()) << "(";
}
else if (visit == InVisit)
{
@@ -572,7 +596,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
{
const TType& type = node->getType();
ASSERT(type.getBasicType() == EbtStruct);
- out << type.getTypeName() << "(";
+ out << hashName(type.getTypeName()) << "(";
}
else if (visit == InVisit)
{
@@ -718,3 +742,59 @@ void TOutputGLSLBase::visitCodeBlock(TIntermNode* node) {
out << "{\n}\n"; // Empty code block.
}
}
+
+TString TOutputGLSLBase::getTypeName(const TType& type)
+{
+ TInfoSinkBase out;
+ if (type.isMatrix())
+ {
+ out << "mat";
+ out << type.getNominalSize();
+ }
+ else if (type.isVector())
+ {
+ switch (type.getBasicType())
+ {
+ case EbtFloat: out << "vec"; break;
+ case EbtInt: out << "ivec"; break;
+ case EbtBool: out << "bvec"; break;
+ default: UNREACHABLE(); break;
+ }
+ out << type.getNominalSize();
+ }
+ else
+ {
+ if (type.getBasicType() == EbtStruct)
+ out << hashName(type.getTypeName());
+ else
+ out << type.getBasicString();
+ }
+ return TString(out.c_str());
+}
+
+TString TOutputGLSLBase::hashName(const TString& name)
+{
+ if (mHashFunction == NULL || name.empty())
+ return name;
+ NameMap::const_iterator it = mNameMap.find(name.c_str());
+ if (it != mNameMap.end())
+ return it->second.c_str();
+ TString hashedName = TIntermTraverser::hash(name, mHashFunction);
+ mNameMap[name.c_str()] = hashedName.c_str();
+ return hashedName;
+}
+
+TString TOutputGLSLBase::hashVariableName(const TString& name)
+{
+ if (mSymbolTable.findBuiltIn(name) != NULL)
+ return name;
+ return hashName(name);
+}
+
+TString TOutputGLSLBase::hashFunctionName(const TString& mangled_name)
+{
+ TString name = TFunction::unmangleName(mangled_name);
+ if (mSymbolTable.findBuiltIn(mangled_name) != NULL || name == "main")
+ return name;
+ return hashName(name);
+}
diff --git a/src/3rdparty/angle/src/compiler/OutputGLSLBase.h b/src/3rdparty/angle/src/compiler/OutputGLSLBase.h
index efd0b5fc2d..c9f72d5631 100644
--- a/src/3rdparty/angle/src/compiler/OutputGLSLBase.h
+++ b/src/3rdparty/angle/src/compiler/OutputGLSLBase.h
@@ -16,7 +16,11 @@
class TOutputGLSLBase : public TIntermTraverser
{
public:
- TOutputGLSLBase(TInfoSinkBase& objSink);
+ TOutputGLSLBase(TInfoSinkBase& objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap& nameMap,
+ TSymbolTable& symbolTable);
protected:
TInfoSinkBase& objSink() { return mObjSink; }
@@ -25,6 +29,7 @@ protected:
virtual bool writeVariablePrecision(TPrecision precision) = 0;
void writeFunctionParameters(const TIntermSequence& args);
const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
+ TString getTypeName(const TType& type);
virtual void visitSymbol(TIntermSymbol* node);
virtual void visitConstantUnion(TIntermConstantUnion* node);
@@ -37,6 +42,15 @@ protected:
void visitCodeBlock(TIntermNode* node);
+
+ // Return the original name if hash function pointer is NULL;
+ // otherwise return the hashed name.
+ TString hashName(const TString& name);
+ // Same as hashName(), but without hashing built-in variables.
+ TString hashVariableName(const TString& name);
+ // Same as hashName(), but without hashing built-in functions.
+ TString hashFunctionName(const TString& mangled_name);
+
private:
TInfoSinkBase& mObjSink;
bool mDeclaringVariables;
@@ -48,6 +62,15 @@ private:
DeclaredStructs mDeclaredStructs;
ForLoopUnroll mLoopUnroll;
+
+ ShArrayIndexClampingStrategy mClampingStrategy;
+
+ // name hashing.
+ ShHashFunction64 mHashFunction;
+
+ NameMap& mNameMap;
+
+ TSymbolTable& mSymbolTable;
};
#endif // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
diff --git a/src/3rdparty/angle/src/compiler/OutputHLSL.cpp b/src/3rdparty/angle/src/compiler/OutputHLSL.cpp
index a430695744..f6a984148b 100644
--- a/src/3rdparty/angle/src/compiler/OutputHLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/OutputHLSL.cpp
@@ -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.
//
@@ -8,13 +8,14 @@
#include "common/angleutils.h"
#include "compiler/debug.h"
+#include "compiler/DetectDiscontinuity.h"
#include "compiler/InfoSink.h"
-#include "compiler/UnfoldShortCircuit.h"
#include "compiler/SearchSymbol.h"
-#include "compiler/DetectDiscontinuity.h"
+#include "compiler/UnfoldShortCircuit.h"
-#include <stdio.h>
#include <algorithm>
+#include <cfloat>
+#include <stdio.h>
namespace sh
{
@@ -26,7 +27,8 @@ TString str(int i)
return buffer;
}
-OutputHLSL::OutputHLSL(TParseContext &context) : TIntermTraverser(true, true, true), mContext(context)
+OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType)
+ : TIntermTraverser(true, true, true), mContext(context), mOutputType(outputType)
{
mUnfoldShortCircuit = new UnfoldShortCircuit(context, this);
mInsideFunction = false;
@@ -46,6 +48,8 @@ OutputHLSL::OutputHLSL(TParseContext &context) : TIntermTraverser(true, true, tr
mUsesTexture2DProjLod0_bias = false;
mUsesTextureCubeLod0 = false;
mUsesTextureCubeLod0_bias = false;
+ mUsesFragColor = false;
+ mUsesFragData = false;
mUsesDepthRange = false;
mUsesFragCoord = false;
mUsesPointCoord = false;
@@ -80,6 +84,8 @@ OutputHLSL::OutputHLSL(TParseContext &context) : TIntermTraverser(true, true, tr
mUsesAtan2_3 = false;
mUsesAtan2_4 = false;
+ mNumRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
+
mScopeDepth = 0;
mUniqueIndex = 0;
@@ -89,6 +95,24 @@ OutputHLSL::OutputHLSL(TParseContext &context) : TIntermTraverser(true, true, tr
mInsideDiscontinuousLoop = false;
mExcessiveLoopIndex = NULL;
+
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ if (mContext.shaderType == SH_FRAGMENT_SHADER)
+ {
+ mUniformRegister = 3; // Reserve registers for dx_DepthRange, dx_ViewCoords and dx_DepthFront
+ }
+ else
+ {
+ mUniformRegister = 2; // Reserve registers for dx_DepthRange and dx_ViewAdjust
+ }
+ }
+ else
+ {
+ mUniformRegister = 0;
+ }
+
+ mSamplerRegister = 0;
}
OutputHLSL::~OutputHLSL()
@@ -98,7 +122,7 @@ OutputHLSL::~OutputHLSL()
void OutputHLSL::output()
{
- mContainsLoopDiscontinuity = containsLoopDiscontinuity(mContext.treeRoot);
+ mContainsLoopDiscontinuity = mContext.shaderType == SH_FRAGMENT_SHADER && containsLoopDiscontinuity(mContext.treeRoot);
mContext.treeRoot->traverse(this); // Output the body first to determine what has to go in the header
header();
@@ -112,6 +136,11 @@ TInfoSinkBase &OutputHLSL::getBodyStream()
return mBody;
}
+const ActiveUniforms &OutputHLSL::getUniforms()
+{
+ return mActiveUniforms;
+}
+
int OutputHLSL::vectorSize(const TType &type) const
{
int elementSize = type.isMatrix() ? type.getNominalSize() : 1;
@@ -135,58 +164,71 @@ void OutputHLSL::header()
out << *constructor;
}
- if (shaderType == SH_FRAGMENT_SHADER)
+ TString uniforms;
+ TString varyings;
+ TString attributes;
+
+ for (ReferencedSymbols::const_iterator uniform = mReferencedUniforms.begin(); uniform != mReferencedUniforms.end(); uniform++)
{
- TString uniforms;
- TString varyings;
+ const TType &type = uniform->second->getType();
+ const TString &name = uniform->second->getSymbol();
- TSymbolTableLevel *symbols = mContext.symbolTable.getGlobalLevel();
- int semanticIndex = 0;
+ if (mOutputType == SH_HLSL11_OUTPUT && IsSampler(type.getBasicType())) // Also declare the texture
+ {
+ int index = samplerRegister(mReferencedUniforms[name]);
+
+ uniforms += "uniform SamplerState sampler_" + decorateUniform(name, type) + arrayString(type) +
+ " : register(s" + str(index) + ");\n";
- for (TSymbolTableLevel::const_iterator namedSymbol = symbols->begin(); namedSymbol != symbols->end(); namedSymbol++)
+ uniforms += "uniform " + textureString(type) + " texture_" + decorateUniform(name, type) + arrayString(type) +
+ " : register(t" + str(index) + ");\n";
+ }
+ else
{
- const TSymbol *symbol = (*namedSymbol).second;
- const TString &name = symbol->getName();
+ uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type) + arrayString(type) +
+ " : register(" + registerString(mReferencedUniforms[name]) + ");\n";
+ }
+ }
- if (symbol->isVariable())
- {
- const TVariable *variable = static_cast<const TVariable*>(symbol);
- const TType &type = variable->getType();
- TQualifier qualifier = type.getQualifier();
+ for (ReferencedSymbols::const_iterator varying = mReferencedVaryings.begin(); varying != mReferencedVaryings.end(); varying++)
+ {
+ const TType &type = varying->second->getType();
+ const TString &name = varying->second->getSymbol();
- if (qualifier == EvqUniform)
- {
- if (mReferencedUniforms.find(name.c_str()) != mReferencedUniforms.end())
- {
- uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type) + arrayString(type) + ";\n";
- }
- }
- else if (qualifier == EvqVaryingIn || qualifier == EvqInvariantVaryingIn)
- {
- if (mReferencedVaryings.find(name.c_str()) != mReferencedVaryings.end())
- {
- // Program linking depends on this exact format
- varyings += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
+ // Program linking depends on this exact format
+ varyings += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
+ }
- semanticIndex += type.isArray() ? type.getArraySize() : 1;
- }
- }
- else if (qualifier == EvqGlobal || qualifier == EvqTemporary)
- {
- // Globals are declared and intialized as an aggregate node
- }
- else if (qualifier == EvqConst)
- {
- // Constants are repeated as literals where used
- }
- else UNREACHABLE();
- }
- }
+ for (ReferencedSymbols::const_iterator attribute = mReferencedAttributes.begin(); attribute != mReferencedAttributes.end(); attribute++)
+ {
+ const TType &type = attribute->second->getType();
+ const TString &name = attribute->second->getSymbol();
+
+ attributes += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
+ }
+
+ if (shaderType == SH_FRAGMENT_SHADER)
+ {
+ TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find("GL_EXT_draw_buffers");
+ bool usingMRTExtension = iter != mContext.extensionBehavior().end() && iter->second == EBhEnable;
+
+ unsigned int numColorValues = usingMRTExtension ? mNumRenderTargets : 1;
out << "// Varyings\n";
out << varyings;
out << "\n"
- "static float4 gl_Color[1] = {float4(0, 0, 0, 0)};\n";
+ "static float4 gl_Color[" << numColorValues << "] =\n"
+ "{\n";
+ for (unsigned int i = 0; i < numColorValues; i++)
+ {
+ out << " float4(0, 0, 0, 0)";
+ if (i + 1 != numColorValues)
+ {
+ out << ",";
+ }
+ out << "\n";
+ }
+ out << "};\n";
if (mUsesFragCoord)
{
@@ -205,205 +247,379 @@ void OutputHLSL::header()
out << "\n";
- if (mUsesFragCoord)
+ if (mUsesDepthRange)
+ {
+ out << "struct gl_DepthRangeParameters\n"
+ "{\n"
+ " float near;\n"
+ " float far;\n"
+ " float diff;\n"
+ "};\n"
+ "\n";
+ }
+
+ if (mOutputType == SH_HLSL11_OUTPUT)
{
- out << "uniform float4 dx_Coord;\n"
- "uniform float2 dx_Depth;\n";
+ out << "cbuffer DriverConstants : register(b1)\n"
+ "{\n";
+
+ if (mUsesDepthRange)
+ {
+ out << " float3 dx_DepthRange : packoffset(c0);\n";
+ }
+
+ if (mUsesFragCoord)
+ {
+ out << " float4 dx_ViewCoords : packoffset(c1);\n";
+ }
+
+ if (mUsesFragCoord || mUsesFrontFacing)
+ {
+ out << " float3 dx_DepthFront : packoffset(c2);\n";
+ }
+
+ out << "};\n";
}
+ else
+ {
+ if (mUsesDepthRange)
+ {
+ out << "uniform float3 dx_DepthRange : register(c0);";
+ }
- if (mUsesFrontFacing)
+ if (mUsesFragCoord)
+ {
+ out << "uniform float4 dx_ViewCoords : register(c1);\n";
+ }
+
+ if (mUsesFragCoord || mUsesFrontFacing)
+ {
+ out << "uniform float3 dx_DepthFront : register(c2);\n";
+ }
+ }
+
+ out << "\n";
+
+ if (mUsesDepthRange)
{
- out << "uniform bool dx_PointsOrLines;\n"
- "uniform bool dx_FrontCCW;\n";
+ out << "static gl_DepthRangeParameters gl_DepthRange = {dx_DepthRange.x, dx_DepthRange.y, dx_DepthRange.z};\n"
+ "\n";
}
- out << "\n";
out << uniforms;
out << "\n";
if (mUsesTexture2D)
{
- out << "float4 gl_texture2D(sampler2D s, float2 t)\n"
- "{\n"
- " return tex2D(s, t);\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_texture2D(sampler2D s, float2 t)\n"
+ "{\n"
+ " return tex2D(s, t);\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_texture2D(Texture2D t, SamplerState s, float2 uv)\n"
+ "{\n"
+ " return t.Sample(s, uv);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
if (mUsesTexture2D_bias)
{
- out << "float4 gl_texture2D(sampler2D s, float2 t, float bias)\n"
- "{\n"
- " return tex2Dbias(s, float4(t.x, t.y, 0, bias));\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_texture2D(sampler2D s, float2 t, float bias)\n"
+ "{\n"
+ " return tex2Dbias(s, float4(t.x, t.y, 0, bias));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_texture2D(Texture2D t, SamplerState s, float2 uv, float bias)\n"
+ "{\n"
+ " return t.SampleBias(s, uv, bias);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
if (mUsesTexture2DProj)
{
- out << "float4 gl_texture2DProj(sampler2D s, float3 t)\n"
- "{\n"
- " return tex2Dproj(s, float4(t.x, t.y, 0, t.z));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(sampler2D s, float4 t)\n"
- "{\n"
- " return tex2Dproj(s, t);\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_texture2DProj(sampler2D s, float3 t)\n"
+ "{\n"
+ " return tex2Dproj(s, float4(t.x, t.y, 0, t.z));\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProj(sampler2D s, float4 t)\n"
+ "{\n"
+ " return tex2Dproj(s, t);\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw)\n"
+ "{\n"
+ " return t.Sample(s, float2(uvw.x / uvw.z, uvw.y / uvw.z));\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw)\n"
+ "{\n"
+ " return t.Sample(s, float2(uvw.x / uvw.w, uvw.y / uvw.w));\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
if (mUsesTexture2DProj_bias)
{
- out << "float4 gl_texture2DProj(sampler2D s, float3 t, float bias)\n"
- "{\n"
- " return tex2Dbias(s, float4(t.x / t.z, t.y / t.z, 0, bias));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(sampler2D s, float4 t, float bias)\n"
- "{\n"
- " return tex2Dbias(s, float4(t.x / t.w, t.y / t.w, 0, bias));\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_texture2DProj(sampler2D s, float3 t, float bias)\n"
+ "{\n"
+ " return tex2Dbias(s, float4(t.x / t.z, t.y / t.z, 0, bias));\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProj(sampler2D s, float4 t, float bias)\n"
+ "{\n"
+ " return tex2Dbias(s, float4(t.x / t.w, t.y / t.w, 0, bias));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw, float bias)\n"
+ "{\n"
+ " return t.SampleBias(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), bias);\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw, float bias)\n"
+ "{\n"
+ " return t.SampleBias(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), bias);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
if (mUsesTextureCube)
{
- out << "float4 gl_textureCube(samplerCUBE s, float3 t)\n"
- "{\n"
- " return texCUBE(s, t);\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_textureCube(samplerCUBE s, float3 t)\n"
+ "{\n"
+ " return texCUBE(s, t);\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_textureCube(TextureCube t, SamplerState s, float3 uvw)\n"
+ "{\n"
+ " return t.Sample(s, uvw);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
if (mUsesTextureCube_bias)
{
- out << "float4 gl_textureCube(samplerCUBE s, float3 t, float bias)\n"
- "{\n"
- " return texCUBEbias(s, float4(t.x, t.y, t.z, bias));\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_textureCube(samplerCUBE s, float3 t, float bias)\n"
+ "{\n"
+ " return texCUBEbias(s, float4(t.x, t.y, t.z, bias));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_textureCube(TextureCube t, SamplerState s, float3 uvw, float bias)\n"
+ "{\n"
+ " return t.SampleBias(s, uvw, bias);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
// These *Lod0 intrinsics are not available in GL fragment shaders.
// They are used to sample using discontinuous texture coordinates.
if (mUsesTexture2DLod0)
{
- out << "float4 gl_texture2DLod0(sampler2D s, float2 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_texture2DLod0(sampler2D s, float2 t)\n"
+ "{\n"
+ " return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_texture2DLod0(Texture2D t, SamplerState s, float2 uv)\n"
+ "{\n"
+ " return t.SampleLevel(s, uv, 0);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
if (mUsesTexture2DLod0_bias)
{
- out << "float4 gl_texture2DLod0(sampler2D s, float2 t, float bias)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_texture2DLod0(sampler2D s, float2 t, float bias)\n"
+ "{\n"
+ " return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_texture2DLod0(Texture2D t, SamplerState s, float2 uv, float bias)\n"
+ "{\n"
+ " return t.SampleLevel(s, uv, 0);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
if (mUsesTexture2DProjLod0)
{
- out << "float4 gl_texture2DProjLod0(sampler2D s, float3 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod(sampler2D s, float4 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_texture2DProjLod0(sampler2D s, float3 t)\n"
+ "{\n"
+ " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProjLod(sampler2D s, float4 t)\n"
+ "{\n"
+ " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_texture2DProjLod0(Texture2D t, SamplerState s, float3 uvw)\n"
+ "{\n"
+ " return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), 0);\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProjLod0(Texture2D t, SamplerState s, float4 uvw)\n"
+ "{\n"
+ " return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), 0);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
if (mUsesTexture2DProjLod0_bias)
{
- out << "float4 gl_texture2DProjLod0_bias(sampler2D s, float3 t, float bias)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod_bias(sampler2D s, float4 t, float bias)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_texture2DProjLod0_bias(sampler2D s, float3 t, float bias)\n"
+ "{\n"
+ " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProjLod_bias(sampler2D s, float4 t, float bias)\n"
+ "{\n"
+ " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_texture2DProjLod_bias(Texture2D t, SamplerState s, float3 uvw, float bias)\n"
+ "{\n"
+ " return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), 0);\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProjLod_bias(Texture2D t, SamplerState s, float4 uvw, float bias)\n"
+ "{\n"
+ " return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), 0);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
if (mUsesTextureCubeLod0)
{
- out << "float4 gl_textureCubeLod0(samplerCUBE s, float3 t)\n"
- "{\n"
- " return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_textureCubeLod0(samplerCUBE s, float3 t)\n"
+ "{\n"
+ " return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_textureCubeLod0(TextureCube t, SamplerState s, float3 uvw)\n"
+ "{\n"
+ " return t.SampleLevel(s, uvw, 0);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
if (mUsesTextureCubeLod0_bias)
{
- out << "float4 gl_textureCubeLod0(samplerCUBE s, float3 t, float bias)\n"
- "{\n"
- " return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_textureCubeLod0(samplerCUBE s, float3 t, float bias)\n"
+ "{\n"
+ " return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_textureCubeLod0(TextureCube t, SamplerState s, float3 uvw, float bias)\n"
+ "{\n"
+ " return t.SampleLevel(s, uvw, 0);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
- }
- else // Vertex shader
- {
- TString uniforms;
- TString attributes;
- TString varyings;
- TSymbolTableLevel *symbols = mContext.symbolTable.getGlobalLevel();
-
- for (TSymbolTableLevel::const_iterator namedSymbol = symbols->begin(); namedSymbol != symbols->end(); namedSymbol++)
+ if (usingMRTExtension && mNumRenderTargets > 1)
{
- const TSymbol *symbol = (*namedSymbol).second;
- const TString &name = symbol->getName();
-
- if (symbol->isVariable())
- {
- const TVariable *variable = static_cast<const TVariable*>(symbol);
- const TType &type = variable->getType();
- TQualifier qualifier = type.getQualifier();
+ out << "#define GL_USES_MRT\n";
+ }
- if (qualifier == EvqUniform)
- {
- if (mReferencedUniforms.find(name.c_str()) != mReferencedUniforms.end())
- {
- uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type) + arrayString(type) + ";\n";
- }
- }
- else if (qualifier == EvqAttribute)
- {
- if (mReferencedAttributes.find(name.c_str()) != mReferencedAttributes.end())
- {
- attributes += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
- }
- }
- else if (qualifier == EvqVaryingOut || qualifier == EvqInvariantVaryingOut)
- {
- if (mReferencedVaryings.find(name.c_str()) != mReferencedVaryings.end())
- {
- // Program linking depends on this exact format
- varyings += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
- }
- }
- else if (qualifier == EvqGlobal || qualifier == EvqTemporary)
- {
- // Globals are declared and intialized as an aggregate node
- }
- else if (qualifier == EvqConst)
- {
- // Constants are repeated as literals where used
- }
- else UNREACHABLE();
- }
+ if (mUsesFragColor)
+ {
+ out << "#define GL_USES_FRAG_COLOR\n";
}
+ if (mUsesFragData)
+ {
+ out << "#define GL_USES_FRAG_DATA\n";
+ }
+ }
+ else // Vertex shader
+ {
out << "// Attributes\n";
out << attributes;
out << "\n"
@@ -417,74 +633,194 @@ void OutputHLSL::header()
out << "\n"
"// Varyings\n";
out << varyings;
- out << "\n"
- "uniform float2 dx_HalfPixelSize;\n"
- "\n";
- out << uniforms;
out << "\n";
-
- if (mUsesTexture2D)
+
+ if (mUsesDepthRange)
{
- out << "float4 gl_texture2D(sampler2D s, float2 t)\n"
+ out << "struct gl_DepthRangeParameters\n"
"{\n"
- " return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
- "}\n"
+ " float near;\n"
+ " float far;\n"
+ " float diff;\n"
+ "};\n"
"\n";
}
- if (mUsesTexture2DLod)
+ if (mOutputType == SH_HLSL11_OUTPUT)
{
- out << "float4 gl_texture2DLod(sampler2D s, float2 t, float lod)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x, t.y, 0, lod));\n"
- "}\n"
+ if (mUsesDepthRange)
+ {
+ out << "cbuffer DriverConstants : register(b1)\n"
+ "{\n"
+ " float3 dx_DepthRange : packoffset(c0);\n"
+ "};\n"
+ "\n";
+ }
+ }
+ else
+ {
+ if (mUsesDepthRange)
+ {
+ out << "uniform float3 dx_DepthRange : register(c0);\n";
+ }
+
+ out << "uniform float4 dx_ViewAdjust : register(c1);\n"
"\n";
}
- if (mUsesTexture2DProj)
+ if (mUsesDepthRange)
{
- out << "float4 gl_texture2DProj(sampler2D s, float3 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(sampler2D s, float4 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
- "}\n"
+ out << "static gl_DepthRangeParameters gl_DepthRange = {dx_DepthRange.x, dx_DepthRange.y, dx_DepthRange.z};\n"
"\n";
}
+ out << uniforms;
+ out << "\n";
+
+ if (mUsesTexture2D)
+ {
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_texture2D(sampler2D s, float2 t)\n"
+ "{\n"
+ " return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_texture2D(Texture2D t, SamplerState s, float2 uv)\n"
+ "{\n"
+ " return t.SampleLevel(s, uv, 0);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
+ }
+
+ if (mUsesTexture2DLod)
+ {
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_texture2DLod(sampler2D s, float2 t, float lod)\n"
+ "{\n"
+ " return tex2Dlod(s, float4(t.x, t.y, 0, lod));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_texture2DLod(Texture2D t, SamplerState s, float2 uv, float lod)\n"
+ "{\n"
+ " return t.SampleLevel(s, uv, lod);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
+ }
+
+ if (mUsesTexture2DProj)
+ {
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_texture2DProj(sampler2D s, float3 t)\n"
+ "{\n"
+ " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProj(sampler2D s, float4 t)\n"
+ "{\n"
+ " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw)\n"
+ "{\n"
+ " return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), 0);\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw)\n"
+ "{\n"
+ " return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), 0);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
+ }
+
if (mUsesTexture2DProjLod)
{
- out << "float4 gl_texture2DProjLod(sampler2D s, float3 t, float lod)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, lod));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod(sampler2D s, float4 t, float lod)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, lod));\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_texture2DProjLod(sampler2D s, float3 t, float lod)\n"
+ "{\n"
+ " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, lod));\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProjLod(sampler2D s, float4 t, float lod)\n"
+ "{\n"
+ " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, lod));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_texture2DProj(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"
+ "{\n"
+ " return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), lod);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
if (mUsesTextureCube)
{
- out << "float4 gl_textureCube(samplerCUBE s, float3 t)\n"
- "{\n"
- " return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_textureCube(samplerCUBE s, float3 t)\n"
+ "{\n"
+ " return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_textureCube(TextureCube t, SamplerState s, float3 uvw)\n"
+ "{\n"
+ " return t.SampleLevel(s, uvw, 0);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
if (mUsesTextureCubeLod)
{
- out << "float4 gl_textureCubeLod(samplerCUBE s, float3 t, float lod)\n"
- "{\n"
- " return texCUBElod(s, float4(t.x, t.y, t.z, lod));\n"
- "}\n"
- "\n";
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ out << "float4 gl_textureCubeLod(samplerCUBE s, float3 t, float lod)\n"
+ "{\n"
+ " return texCUBElod(s, float4(t.x, t.y, t.z, lod));\n"
+ "}\n"
+ "\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "float4 gl_textureCubeLod(TextureCube t, SamplerState s, float3 uvw, float lod)\n"
+ "{\n"
+ " return t.SampleLevel(s, uvw, lod);\n"
+ "}\n"
+ "\n";
+ }
+ else UNREACHABLE();
}
}
@@ -508,20 +844,6 @@ void OutputHLSL::header()
out << "#define GL_USES_POINT_SIZE\n";
}
- if (mUsesDepthRange)
- {
- out << "struct gl_DepthRangeParameters\n"
- "{\n"
- " float near;\n"
- " float far;\n"
- " float diff;\n"
- "};\n"
- "\n"
- "uniform float3 dx_DepthRange;"
- "static gl_DepthRangeParameters gl_DepthRange = {dx_DepthRange.x, dx_DepthRange.y, dx_DepthRange.z};\n"
- "\n";
- }
-
if (mUsesXor)
{
out << "bool xor(bool p, bool q)\n"
@@ -812,10 +1134,12 @@ void OutputHLSL::visitSymbol(TIntermSymbol *node)
if (name == "gl_FragColor")
{
out << "gl_Color[0]";
+ mUsesFragColor = true;
}
else if (name == "gl_FragData")
{
out << "gl_Color";
+ mUsesFragData = true;
}
else if (name == "gl_DepthRange")
{
@@ -848,17 +1172,17 @@ void OutputHLSL::visitSymbol(TIntermSymbol *node)
if (qualifier == EvqUniform)
{
- mReferencedUniforms.insert(name.c_str());
+ mReferencedUniforms[name] = node;
out << decorateUniform(name, node->getType());
}
else if (qualifier == EvqAttribute)
{
- mReferencedAttributes.insert(name.c_str());
+ mReferencedAttributes[name] = node;
out << decorate(name);
}
else if (qualifier == EvqVaryingOut || qualifier == EvqInvariantVaryingOut || qualifier == EvqVaryingIn || qualifier == EvqInvariantVaryingIn)
{
- mReferencedVaryings.insert(name.c_str());
+ mReferencedVaryings[name] = node;
out << decorate(name);
}
else
@@ -973,7 +1297,7 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
if (element)
{
- int i = element->getUnionArrayPointer()[0].getIConst();
+ int i = element->getIConst(0);
switch (i)
{
@@ -1276,7 +1600,6 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
{
TIntermSequence &sequence = node->getSequence();
TIntermTyped *variable = sequence[0]->getAsTyped();
- bool visit = true;
if (variable && (variable->getQualifier() == EvqTemporary || variable->getQualifier() == EvqGlobal))
{
@@ -1309,19 +1632,11 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
(*sit)->traverse(this);
}
- if (visit && this->inVisit)
+ if (*sit != sequence.back())
{
- if (*sit != sequence.back())
- {
- visit = this->visitAggregate(InVisit, node);
- }
+ out << ", ";
}
}
-
- if (visit && this->postVisit)
- {
- this->visitAggregate(PostVisit, node);
- }
}
else if (variable->getAsSymbolNode() && variable->getAsSymbolNode()->getSymbol() == "") // Type (struct) declaration
{
@@ -1329,7 +1644,24 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
}
else UNREACHABLE();
}
-
+ else if (variable && (variable->getQualifier() == EvqVaryingOut || variable->getQualifier() == EvqInvariantVaryingOut))
+ {
+ for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
+ {
+ TIntermSymbol *symbol = (*sit)->getAsSymbolNode();
+
+ if (symbol)
+ {
+ // Vertex (output) varyings which are declared but not written to should still be declared to allow successful linking
+ mReferencedVaryings[symbol->getSymbol()] = symbol;
+ }
+ else
+ {
+ (*sit)->traverse(this);
+ }
+ }
+ }
+
return false;
}
else if (visit == InVisit)
@@ -1440,151 +1772,163 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
break;
case EOpFunctionCall:
{
- if (visit == PreVisit)
- {
- TString name = TFunction::unmangleName(node->getName());
- bool lod0 = mInsideDiscontinuousLoop || mOutputLod0Function;
+ TString name = TFunction::unmangleName(node->getName());
+ bool lod0 = mInsideDiscontinuousLoop || mOutputLod0Function;
- if (node->isUserDefined())
- {
- out << decorate(name) << (lod0 ? "Lod0(" : "(");
- }
- else
+ if (node->isUserDefined())
+ {
+ out << decorate(name) << (lod0 ? "Lod0(" : "(");
+ }
+ else
+ {
+ if (name == "texture2D")
{
- if (name == "texture2D")
+ if (!lod0)
{
- if (!lod0)
+ if (node->getSequence().size() == 2)
{
- if (node->getSequence().size() == 2)
- {
- mUsesTexture2D = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTexture2D_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_texture2D(";
+ mUsesTexture2D = true;
}
- else
+ else if (node->getSequence().size() == 3)
{
- if (node->getSequence().size() == 2)
- {
- mUsesTexture2DLod0 = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTexture2DLod0_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_texture2DLod0(";
+ mUsesTexture2D_bias = true;
}
+ else UNREACHABLE();
+
+ out << "gl_texture2D(";
}
- else if (name == "texture2DProj")
+ else
{
- if (!lod0)
+ if (node->getSequence().size() == 2)
{
- if (node->getSequence().size() == 2)
- {
- mUsesTexture2DProj = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTexture2DProj_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_texture2DProj(";
+ mUsesTexture2DLod0 = true;
}
- else
+ else if (node->getSequence().size() == 3)
{
- if (node->getSequence().size() == 2)
- {
- mUsesTexture2DProjLod0 = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTexture2DProjLod0_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_texture2DProjLod0(";
+ mUsesTexture2DLod0_bias = true;
}
+ else UNREACHABLE();
+
+ out << "gl_texture2DLod0(";
}
- else if (name == "textureCube")
+ }
+ else if (name == "texture2DProj")
+ {
+ if (!lod0)
{
- if (!lod0)
+ if (node->getSequence().size() == 2)
{
- if (node->getSequence().size() == 2)
- {
- mUsesTextureCube = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTextureCube_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_textureCube(";
+ mUsesTexture2DProj = true;
}
- else
+ else if (node->getSequence().size() == 3)
{
- if (node->getSequence().size() == 2)
- {
- mUsesTextureCubeLod0 = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTextureCubeLod0_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_textureCubeLod0(";
+ mUsesTexture2DProj_bias = true;
}
+ else UNREACHABLE();
+
+ out << "gl_texture2DProj(";
}
- else if (name == "texture2DLod")
+ else
{
- if (node->getSequence().size() == 3)
+ if (node->getSequence().size() == 2)
+ {
+ mUsesTexture2DProjLod0 = true;
+ }
+ else if (node->getSequence().size() == 3)
{
- mUsesTexture2DLod = true;
+ mUsesTexture2DProjLod0_bias = true;
}
else UNREACHABLE();
- out << "gl_texture2DLod(";
+ out << "gl_texture2DProjLod0(";
}
- else if (name == "texture2DProjLod")
+ }
+ else if (name == "textureCube")
+ {
+ if (!lod0)
{
- if (node->getSequence().size() == 3)
+ if (node->getSequence().size() == 2)
+ {
+ mUsesTextureCube = true;
+ }
+ else if (node->getSequence().size() == 3)
{
- mUsesTexture2DProjLod = true;
+ mUsesTextureCube_bias = true;
}
else UNREACHABLE();
- out << "gl_texture2DProjLod(";
+ out << "gl_textureCube(";
}
- else if (name == "textureCubeLod")
+ else
{
- if (node->getSequence().size() == 3)
+ if (node->getSequence().size() == 2)
{
- mUsesTextureCubeLod = true;
+ mUsesTextureCubeLod0 = true;
+ }
+ else if (node->getSequence().size() == 3)
+ {
+ mUsesTextureCubeLod0_bias = true;
}
else UNREACHABLE();
- out << "gl_textureCubeLod(";
+ out << "gl_textureCubeLod0(";
+ }
+ }
+ else if (name == "texture2DLod")
+ {
+ if (node->getSequence().size() == 3)
+ {
+ mUsesTexture2DLod = true;
+ }
+ else UNREACHABLE();
+
+ out << "gl_texture2DLod(";
+ }
+ else if (name == "texture2DProjLod")
+ {
+ if (node->getSequence().size() == 3)
+ {
+ mUsesTexture2DProjLod = true;
}
else UNREACHABLE();
+
+ out << "gl_texture2DProjLod(";
}
+ else if (name == "textureCubeLod")
+ {
+ if (node->getSequence().size() == 3)
+ {
+ mUsesTextureCubeLod = true;
+ }
+ else UNREACHABLE();
+
+ out << "gl_textureCubeLod(";
+ }
+ else UNREACHABLE();
}
- else if (visit == InVisit)
- {
- out << ", ";
- }
- else
+
+ TIntermSequence &arguments = node->getSequence();
+
+ for (TIntermSequence::iterator arg = arguments.begin(); arg != arguments.end(); arg++)
{
- out << ")";
+ if (mOutputType == SH_HLSL11_OUTPUT && IsSampler((*arg)->getAsTyped()->getBasicType()))
+ {
+ out << "texture_";
+ (*arg)->traverse(this);
+ out << ", sampler_";
+ }
+
+ (*arg)->traverse(this);
+
+ if (arg < arguments.end() - 1)
+ {
+ out << ", ";
+ }
}
+
+ out << ")";
+
+ return false;
}
break;
case EOpParameters: outputTriplet(visit, "(", ", ", ")\n{\n"); break;
@@ -1778,14 +2122,17 @@ bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
{
bool wasDiscontinuous = mInsideDiscontinuousLoop;
- if (!mInsideDiscontinuousLoop)
+ if (mContainsLoopDiscontinuity && !mInsideDiscontinuousLoop)
{
mInsideDiscontinuousLoop = containsLoopDiscontinuity(node);
}
- if (handleExcessiveLoop(node))
+ if (mOutputType == SH_HLSL9_OUTPUT)
{
- return false;
+ if (handleExcessiveLoop(node))
+ {
+ return false;
+ }
}
TInfoSinkBase &out = mBody;
@@ -1976,7 +2323,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
{
index = symbol;
- initial = constant->getUnionArrayPointer()[0].getIConst();
+ initial = constant->getIConst(0);
}
}
}
@@ -1998,7 +2345,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
{
comparator = test->getOp();
- limit = constant->getUnionArrayPointer()[0].getIConst();
+ limit = constant->getIConst(0);
}
}
}
@@ -2019,7 +2366,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
{
if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
{
- int value = constant->getUnionArrayPointer()[0].getIConst();
+ int value = constant->getIConst(0);
switch (op)
{
@@ -2191,6 +2538,12 @@ TString OutputHLSL::argumentString(const TIntermSymbol *symbol)
name = decorate(name);
}
+ if (mOutputType == SH_HLSL11_OUTPUT && IsSampler(type.getBasicType()))
+ {
+ return qualifierString(qualifier) + " " + textureString(type) + " texture_" + name + arrayString(type) + ", " +
+ qualifierString(qualifier) + " SamplerState sampler_" + name + arrayString(type);
+ }
+
return qualifierString(qualifier) + " " + typeString(type) + " " + name + arrayString(type);
}
@@ -2285,10 +2638,28 @@ TString OutputHLSL::typeString(const TType &type)
}
}
- UNIMPLEMENTED(); // FIXME
+ UNREACHABLE();
return "<unknown type>";
}
+TString OutputHLSL::textureString(const TType &type)
+{
+ switch (type.getBasicType())
+ {
+ case EbtSampler2D:
+ return "Texture2D";
+ case EbtSamplerCube:
+ return "TextureCube";
+ case EbtSamplerExternalOES:
+ return "Texture2D";
+ default:
+ break;
+ }
+
+ UNREACHABLE();
+ return "<unknown texture type>";
+}
+
TString OutputHLSL::arrayString(const TType &type)
{
if (!type.isArray())
@@ -2565,7 +2936,7 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con
{
switch (constUnion->getType())
{
- case EbtFloat: out << constUnion->getFConst(); break;
+ case EbtFloat: out << std::min(FLT_MAX, std::max(-FLT_MAX, constUnion->getFConst())); break;
case EbtInt: out << constUnion->getIConst(); break;
case EbtBool: out << constUnion->getBConst(); break;
default: UNREACHABLE();
@@ -2640,11 +3011,7 @@ TString OutputHLSL::decorate(const TString &string)
TString OutputHLSL::decorateUniform(const TString &string, const TType &type)
{
- if (type.isArray())
- {
- return "ar_" + string; // Allows identifying arrays of size 1
- }
- else if (type.getBasicType() == EbtSamplerExternalOES)
+ if (type.getBasicType() == EbtSamplerExternalOES)
{
return "ex_" + string;
}
@@ -2661,4 +3028,197 @@ TString OutputHLSL::decorateField(const TString &string, const TType &structure)
return string;
}
+
+TString OutputHLSL::registerString(TIntermSymbol *operand)
+{
+ ASSERT(operand->getQualifier() == EvqUniform);
+
+ if (IsSampler(operand->getBasicType()))
+ {
+ return "s" + str(samplerRegister(operand));
+ }
+
+ return "c" + str(uniformRegister(operand));
+}
+
+int OutputHLSL::samplerRegister(TIntermSymbol *sampler)
+{
+ const TType &type = sampler->getType();
+ ASSERT(IsSampler(type.getBasicType()));
+
+ int index = mSamplerRegister;
+ mSamplerRegister += sampler->totalRegisterCount();
+
+ declareUniform(type, sampler->getSymbol(), index);
+
+ return index;
+}
+
+int OutputHLSL::uniformRegister(TIntermSymbol *uniform)
+{
+ const TType &type = uniform->getType();
+ ASSERT(!IsSampler(type.getBasicType()));
+
+ int index = mUniformRegister;
+ mUniformRegister += uniform->totalRegisterCount();
+
+ declareUniform(type, uniform->getSymbol(), index);
+
+ return index;
+}
+
+void OutputHLSL::declareUniform(const TType &type, const TString &name, int index)
+{
+ const TTypeList *structure = type.getStruct();
+
+ if (!structure)
+ {
+ mActiveUniforms.push_back(Uniform(glVariableType(type), glVariablePrecision(type), name.c_str(), type.getArraySize(), index));
+ }
+ else
+ {
+ if (type.isArray())
+ {
+ int elementIndex = index;
+
+ for (int i = 0; i < type.getArraySize(); i++)
+ {
+ for (size_t j = 0; j < structure->size(); j++)
+ {
+ const TType &fieldType = *(*structure)[j].type;
+ const TString &fieldName = fieldType.getFieldName();
+
+ const TString uniformName = name + "[" + str(i) + "]." + fieldName;
+ declareUniform(fieldType, uniformName, elementIndex);
+ elementIndex += fieldType.totalRegisterCount();
+ }
+ }
+ }
+ else
+ {
+ int fieldIndex = index;
+
+ for (size_t i = 0; i < structure->size(); i++)
+ {
+ const TType &fieldType = *(*structure)[i].type;
+ const TString &fieldName = fieldType.getFieldName();
+
+ const TString uniformName = name + "." + fieldName;
+ declareUniform(fieldType, uniformName, fieldIndex);
+ fieldIndex += fieldType.totalRegisterCount();
+ }
+ }
+ }
+}
+
+GLenum OutputHLSL::glVariableType(const TType &type)
+{
+ if (type.getBasicType() == EbtFloat)
+ {
+ if (type.isScalar())
+ {
+ return GL_FLOAT;
+ }
+ else if (type.isVector())
+ {
+ switch(type.getNominalSize())
+ {
+ case 2: return GL_FLOAT_VEC2;
+ case 3: return GL_FLOAT_VEC3;
+ case 4: return GL_FLOAT_VEC4;
+ default: UNREACHABLE();
+ }
+ }
+ else if (type.isMatrix())
+ {
+ switch(type.getNominalSize())
+ {
+ case 2: return GL_FLOAT_MAT2;
+ case 3: return GL_FLOAT_MAT3;
+ case 4: return GL_FLOAT_MAT4;
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+ }
+ else if (type.getBasicType() == EbtInt)
+ {
+ if (type.isScalar())
+ {
+ return GL_INT;
+ }
+ else if (type.isVector())
+ {
+ switch(type.getNominalSize())
+ {
+ case 2: return GL_INT_VEC2;
+ case 3: return GL_INT_VEC3;
+ case 4: return GL_INT_VEC4;
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+ }
+ else if (type.getBasicType() == EbtBool)
+ {
+ if (type.isScalar())
+ {
+ return GL_BOOL;
+ }
+ else if (type.isVector())
+ {
+ switch(type.getNominalSize())
+ {
+ case 2: return GL_BOOL_VEC2;
+ case 3: return GL_BOOL_VEC3;
+ case 4: return GL_BOOL_VEC4;
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+ }
+ else if (type.getBasicType() == EbtSampler2D)
+ {
+ return GL_SAMPLER_2D;
+ }
+ else if (type.getBasicType() == EbtSamplerCube)
+ {
+ return GL_SAMPLER_CUBE;
+ }
+ else UNREACHABLE();
+
+ return GL_NONE;
+}
+
+GLenum OutputHLSL::glVariablePrecision(const TType &type)
+{
+ if (type.getBasicType() == EbtFloat)
+ {
+ switch (type.getPrecision())
+ {
+ case EbpHigh: return GL_HIGH_FLOAT;
+ case EbpMedium: return GL_MEDIUM_FLOAT;
+ case EbpLow: return GL_LOW_FLOAT;
+ case EbpUndefined:
+ // Should be defined as the default precision by the parser
+ default: UNREACHABLE();
+ }
+ }
+ else if (type.getBasicType() == EbtInt)
+ {
+ switch (type.getPrecision())
+ {
+ case EbpHigh: return GL_HIGH_INT;
+ case EbpMedium: return GL_MEDIUM_INT;
+ case EbpLow: return GL_LOW_INT;
+ case EbpUndefined:
+ // Should be defined as the default precision by the parser
+ default: UNREACHABLE();
+ }
+ }
+
+ // Other types (boolean, sampler) don't have a precision
+ return GL_NONE;
+}
+
}
diff --git a/src/3rdparty/angle/src/compiler/OutputHLSL.h b/src/3rdparty/angle/src/compiler/OutputHLSL.h
index dc843fb366..749a3461b3 100644
--- a/src/3rdparty/angle/src/compiler/OutputHLSL.h
+++ b/src/3rdparty/angle/src/compiler/OutputHLSL.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,14 @@
#include <list>
#include <set>
+#include <map>
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
#include "compiler/intermediate.h"
#include "compiler/ParseHelper.h"
+#include "compiler/Uniform.h"
namespace sh
{
@@ -20,14 +25,16 @@ class UnfoldShortCircuit;
class OutputHLSL : public TIntermTraverser
{
public:
- explicit OutputHLSL(TParseContext &context);
+ OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType);
~OutputHLSL();
void output();
TInfoSinkBase &getBodyStream();
+ const ActiveUniforms &getUniforms();
TString typeString(const TType &type);
+ TString textureString(const TType &type);
static TString qualifierString(TQualifier qualifier);
static TString arrayString(const TType &type);
static TString initializer(const TType &type);
@@ -64,6 +71,7 @@ class OutputHLSL : public TIntermTraverser
TString structLookup(const TString &typeName);
TParseContext &mContext;
+ const ShShaderOutput mOutputType;
UnfoldShortCircuit *mUnfoldShortCircuit;
bool mInsideFunction;
@@ -72,9 +80,10 @@ class OutputHLSL : public TIntermTraverser
TInfoSinkBase mBody;
TInfoSinkBase mFooter;
- std::set<std::string> mReferencedUniforms;
- std::set<std::string> mReferencedAttributes;
- std::set<std::string> mReferencedVaryings;
+ typedef std::map<TString, TIntermSymbol*> ReferencedSymbols;
+ ReferencedSymbols mReferencedUniforms;
+ ReferencedSymbols mReferencedAttributes;
+ ReferencedSymbols mReferencedVaryings;
// Parameters determining what goes in the header output
bool mUsesTexture2D;
@@ -92,6 +101,8 @@ class OutputHLSL : public TIntermTraverser
bool mUsesTexture2DProjLod0_bias;
bool mUsesTextureCubeLod0;
bool mUsesTextureCubeLod0_bias;
+ bool mUsesFragColor;
+ bool mUsesFragData;
bool mUsesDepthRange;
bool mUsesFragCoord;
bool mUsesPointCoord;
@@ -126,6 +137,8 @@ class OutputHLSL : public TIntermTraverser
bool mUsesAtan2_3;
bool mUsesAtan2_4;
+ int mNumRenderTargets;
+
typedef std::set<TString> Constructors;
Constructors mConstructors;
@@ -146,6 +159,18 @@ class OutputHLSL : public TIntermTraverser
bool mInsideDiscontinuousLoop;
TIntermSymbol *mExcessiveLoopIndex;
+
+ int mUniformRegister;
+ int mSamplerRegister;
+
+ TString registerString(TIntermSymbol *operand);
+ int samplerRegister(TIntermSymbol *sampler);
+ int uniformRegister(TIntermSymbol *uniform);
+ void declareUniform(const TType &type, const TString &name, int index);
+ static GLenum glVariableType(const TType &type);
+ static GLenum glVariablePrecision(const TType &type);
+
+ ActiveUniforms mActiveUniforms;
};
}
diff --git a/src/3rdparty/angle/src/compiler/ParseHelper.cpp b/src/3rdparty/angle/src/compiler/ParseHelper.cpp
index 508f1726a7..441ff35e00 100644
--- a/src/3rdparty/angle/src/compiler/ParseHelper.cpp
+++ b/src/3rdparty/angle/src/compiler/ParseHelper.cpp
@@ -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.
//
@@ -10,7 +10,7 @@
#include <stdio.h>
#include "compiler/glslang.h"
-#include "compiler/preprocessor/new/SourceLocation.h"
+#include "compiler/preprocessor/SourceLocation.h"
///////////////////////////////////////////////////////////////////////
//
@@ -33,7 +33,7 @@ bool TParseContext::parseVectorFields(const TString& compString, int vecSize, TV
enum {
exyzw,
ergba,
- estpq,
+ estpq
} fieldSet[4];
for (int i = 0; i < fields.num; ++i) {
@@ -286,7 +286,7 @@ bool TParseContext::lValueErrorCheck(int line, const char* op, TIntermTyped* nod
for (TIntermSequence::iterator p = aggrNode->getSequence().begin();
p != aggrNode->getSequence().end(); p++) {
- int value = (*p)->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->getIConst();
+ int value = (*p)->getAsTyped()->getAsConstantUnion()->getIConst(0);
offset[value]++;
if (offset[value] > 1) {
error(line, " l-value of swizzle cannot have duplicate components", op);
@@ -493,7 +493,7 @@ bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction
bool overFull = false;
bool matrixInMatrix = false;
bool arrayArg = false;
- for (int i = 0; i < function.getParamCount(); ++i) {
+ for (size_t i = 0; i < function.getParamCount(); ++i) {
const TParameter& param = function.getParam(i);
size += param.type->getObjectSize();
@@ -512,7 +512,7 @@ bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction
if (constType)
type->setQualifier(EvqConst);
- if (type->isArray() && type->getArraySize() != function.getParamCount()) {
+ if (type->isArray() && static_cast<size_t>(type->getArraySize()) != function.getParamCount()) {
error(line, "array constructor needs one argument per array element", "constructor");
return true;
}
@@ -680,7 +680,7 @@ bool TParseContext::arraySizeErrorCheck(int line, TIntermTyped* expr, int& size)
return true;
}
- size = constant->getUnionArrayPointer()->getIConst();
+ size = constant->getIConst(0);
if (size <= 0) {
error(line, "array size must be a positive integer", "");
@@ -1313,7 +1313,6 @@ TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTy
ConstantUnion *unionArray;
if (tempConstantNode) {
unionArray = tempConstantNode->getUnionArrayPointer();
- ASSERT(unionArray);
if (!unionArray) {
return node;
@@ -1507,7 +1506,7 @@ bool TParseContext::structNestingErrorCheck(TSourceLoc line, const TType& fieldT
//
// Returns 0 for success.
//
-int PaParseStrings(int count, const char* const string[], const int length[],
+int PaParseStrings(size_t count, const char* const string[], const int length[],
TParseContext* context) {
if ((count == 0) || (string == NULL))
return 1;
diff --git a/src/3rdparty/angle/src/compiler/ParseHelper.h b/src/3rdparty/angle/src/compiler/ParseHelper.h
index 824ee00f39..26a3ea1308 100644
--- a/src/3rdparty/angle/src/compiler/ParseHelper.h
+++ b/src/3rdparty/angle/src/compiler/ParseHelper.h
@@ -9,7 +9,7 @@
#include "compiler/Diagnostics.h"
#include "compiler/DirectiveHandler.h"
#include "compiler/localintermediate.h"
-#include "compiler/preprocessor/new/Preprocessor.h"
+#include "compiler/preprocessor/Preprocessor.h"
#include "compiler/ShHandle.h"
#include "compiler/SymbolTable.h"
@@ -58,6 +58,7 @@ struct TParseContext {
const TType* currentFunctionType; // the return type of the function that's currently being parsed
bool functionReturnsValue; // true if a non-void function has a return
bool checksPrecisionErrors; // true if an error will be generated when a variable is declared without precision, explicit or implicit.
+ bool fragmentPrecisionHigh; // true if highp precision is supported in the fragment language.
TString HashErrMsg;
bool AfterEOF;
TDiagnostics diagnostics;
@@ -134,7 +135,7 @@ struct TParseContext {
bool structNestingErrorCheck(TSourceLoc line, const TType& fieldType);
};
-int PaParseStrings(int count, const char* const string[], const int length[],
+int PaParseStrings(size_t count, const char* const string[], const int length[],
TParseContext* context);
#endif // _PARSER_HELPER_INCLUDED_
diff --git a/src/3rdparty/angle/src/compiler/ShHandle.h b/src/3rdparty/angle/src/compiler/ShHandle.h
index 6ba302ad04..28049305e0 100644
--- a/src/3rdparty/angle/src/compiler/ShHandle.h
+++ b/src/3rdparty/angle/src/compiler/ShHandle.h
@@ -18,13 +18,16 @@
#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 "third_party/compiler/ArrayBoundsClamper.h"
class LongNameMap;
class TCompiler;
class TDependencyGraph;
+class TranslatorHLSL;
//
// Helper function to identify specs that are based on the WebGL spec,
@@ -40,6 +43,7 @@ public:
TShHandleBase();
virtual ~TShHandleBase();
virtual TCompiler* getAsCompiler() { return 0; }
+ virtual TranslatorHLSL* getAsTranslatorHLSL() { return 0; }
protected:
// Memory allocator. Allocates and tracks memory required by the compiler.
@@ -59,7 +63,7 @@ public:
bool Init(const ShBuiltInResources& resources);
bool compile(const char* const shaderStrings[],
- const int numStrings,
+ size_t numStrings,
int compileOptions);
// Get results of the last compilation.
@@ -68,6 +72,10 @@ public:
const TVariableInfoList& getUniforms() const { return uniforms; }
int getMappedNameMaxLength() const;
+ ShHashFunction64 getHashFunction() const { return hashFunction; }
+ NameMap& getNameMap() { return nameMap; }
+ TSymbolTable& getSymbolTable() { return symbolTable; }
+
protected:
ShShaderType getShaderType() const { return shaderType; }
ShShaderSpec getShaderSpec() const { return shaderSpec; }
@@ -100,7 +108,11 @@ protected:
bool enforceFragmentShaderTimingRestrictions(const TDependencyGraph& graph);
// Get built-in extensions with default behavior.
const TExtensionBehavior& getExtensionBehavior() const;
+ // Get the resources set by InitBuiltInSymbolTable
+ const ShBuiltInResources& getResources() const;
+ const ArrayBoundsClamper& getArrayBoundsClamper() const;
+ ShArrayIndexClampingStrategy getArrayIndexClampingStrategy() const;
const BuiltInFunctionEmulator& getBuiltInFunctionEmulator() const;
private:
@@ -109,12 +121,17 @@ private:
int maxUniformVectors;
+ ShBuiltInResources compileResources;
+
// Built-in symbol table for the given language, spec, and resources.
// It is preserved from compile-to-compile.
TSymbolTable symbolTable;
// Built-in extensions with default behavior.
TExtensionBehavior extensionBehavior;
+ bool fragmentPrecisionHigh;
+ ArrayBoundsClamper arrayBoundsClamper;
+ ShArrayIndexClampingStrategy clampingStrategy;
BuiltInFunctionEmulator builtInFunctionEmulator;
// Results of compilation.
@@ -124,6 +141,10 @@ private:
// Cached copy of the ref-counted singleton.
LongNameMap* longNameMap;
+
+ // name hashing.
+ ShHashFunction64 hashFunction;
+ NameMap nameMap;
};
//
diff --git a/src/3rdparty/angle/src/compiler/ShaderLang.cpp b/src/3rdparty/angle/src/compiler/ShaderLang.cpp
index 56f5c7f2ec..92f39311c2 100644
--- a/src/3rdparty/angle/src/compiler/ShaderLang.cpp
+++ b/src/3rdparty/angle/src/compiler/ShaderLang.cpp
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// 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.
//
@@ -14,6 +14,7 @@
#include "compiler/InitializeDll.h"
#include "compiler/preprocessor/length_limits.h"
#include "compiler/ShHandle.h"
+#include "compiler/TranslatorHLSL.h"
//
// This is the platform independent interface between an OGL driver
@@ -21,18 +22,18 @@
//
static bool checkActiveUniformAndAttribMaxLengths(const ShHandle handle,
- int expectedValue)
+ size_t expectedValue)
{
- int activeUniformLimit = 0;
+ size_t activeUniformLimit = 0;
ShGetInfo(handle, SH_ACTIVE_UNIFORM_MAX_LENGTH, &activeUniformLimit);
- int activeAttribLimit = 0;
+ size_t activeAttribLimit = 0;
ShGetInfo(handle, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, &activeAttribLimit);
return (expectedValue == activeUniformLimit && expectedValue == activeAttribLimit);
}
-static bool checkMappedNameMaxLength(const ShHandle handle, int expectedValue)
+static bool checkMappedNameMaxLength(const ShHandle handle, size_t expectedValue)
{
- int mappedNameMaxLength = 0;
+ size_t mappedNameMaxLength = 0;
ShGetInfo(handle, SH_MAPPED_NAME_MAX_LENGTH, &mappedNameMaxLength);
return (expectedValue == mappedNameMaxLength);
}
@@ -40,7 +41,7 @@ static bool checkMappedNameMaxLength(const ShHandle handle, int expectedValue)
static void getVariableInfo(ShShaderInfo varType,
const ShHandle handle,
int index,
- int* length,
+ size_t* length,
int* size,
ShDataType* type,
char* name,
@@ -69,14 +70,14 @@ static void getVariableInfo(ShShaderInfo varType,
// This size must match that queried by
// SH_ACTIVE_UNIFORM_MAX_LENGTH and SH_ACTIVE_ATTRIBUTE_MAX_LENGTH
// in ShGetInfo, below.
- int activeUniformAndAttribLength = 1 + MAX_SYMBOL_NAME_LEN;
+ size_t activeUniformAndAttribLength = 1 + MAX_SYMBOL_NAME_LEN;
ASSERT(checkActiveUniformAndAttribMaxLengths(handle, activeUniformAndAttribLength));
strncpy(name, varInfo.name.c_str(), activeUniformAndAttribLength);
name[activeUniformAndAttribLength - 1] = 0;
if (mappedName) {
// This size must match that queried by
// SH_MAPPED_NAME_MAX_LENGTH in ShGetInfo, below.
- int maxMappedNameLength = 1 + MAX_SYMBOL_NAME_LEN;
+ size_t maxMappedNameLength = 1 + MAX_SYMBOL_NAME_LEN;
ASSERT(checkMappedNameMaxLength(handle, maxMappedNameLength));
strncpy(mappedName, varInfo.mappedName.c_str(), maxMappedNameLength);
mappedName[maxMappedNameLength - 1] = 0;
@@ -125,6 +126,15 @@ void ShInitBuiltInResources(ShBuiltInResources* resources)
resources->OES_standard_derivatives = 0;
resources->OES_EGL_image_external = 0;
resources->ARB_texture_rectangle = 0;
+ resources->EXT_draw_buffers = 0;
+
+ // Disable highp precision in fragment shader by default.
+ resources->FragmentPrecisionHigh = 0;
+
+ // Disable name hashing by default.
+ resources->HashFunction = NULL;
+
+ resources->ArrayIndexClampingStrategy = SH_CLAMP_WITH_CLAMP_INTRINSIC;
}
//
@@ -172,7 +182,7 @@ void ShDestruct(ShHandle handle)
int ShCompile(
const ShHandle handle,
const char* const shaderStrings[],
- const int numStrings,
+ size_t numStrings,
int compileOptions)
{
if (!InitThread())
@@ -190,7 +200,7 @@ int ShCompile(
return success ? 1 : 0;
}
-void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params)
+void ShGetInfo(const ShHandle handle, ShShaderInfo pname, size_t* params)
{
if (!handle || !params)
return;
@@ -224,6 +234,22 @@ void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params)
// handle array and struct dereferences.
*params = 1 + MAX_SYMBOL_NAME_LEN;
break;
+ case SH_NAME_MAX_LENGTH:
+ *params = 1 + MAX_SYMBOL_NAME_LEN;
+ break;
+ case SH_HASHED_NAME_MAX_LENGTH:
+ if (compiler->getHashFunction() == NULL) {
+ *params = 0;
+ } else {
+ // 64 bits hashing output requires 16 bytes for hex
+ // representation.
+ const char HashedNamePrefix[] = HASHED_NAME_PREFIX;
+ *params = 16 + sizeof(HashedNamePrefix);
+ }
+ break;
+ case SH_HASHED_NAMES_COUNT:
+ *params = compiler->getNameMap().size();
+ break;
default: UNREACHABLE();
}
}
@@ -262,7 +288,7 @@ void ShGetObjectCode(const ShHandle handle, char* objCode)
void ShGetActiveAttrib(const ShHandle handle,
int index,
- int* length,
+ size_t* length,
int* size,
ShDataType* type,
char* name,
@@ -274,7 +300,7 @@ void ShGetActiveAttrib(const ShHandle handle,
void ShGetActiveUniform(const ShHandle handle,
int index,
- int* length,
+ size_t* length,
int* size,
ShDataType* type,
char* name,
@@ -283,3 +309,64 @@ void ShGetActiveUniform(const ShHandle handle,
getVariableInfo(SH_ACTIVE_UNIFORMS,
handle, index, length, size, type, name, mappedName);
}
+
+void ShGetNameHashingEntry(const ShHandle handle,
+ int index,
+ char* name,
+ char* hashedName)
+{
+ if (!handle || !name || !hashedName || index < 0)
+ return;
+
+ TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+ TCompiler* compiler = base->getAsCompiler();
+ if (!compiler) return;
+
+ const NameMap& nameMap = compiler->getNameMap();
+ if (index >= static_cast<int>(nameMap.size()))
+ return;
+
+ NameMap::const_iterator it = nameMap.begin();
+ for (int i = 0; i < index; ++i)
+ ++it;
+
+ size_t len = it->first.length() + 1;
+ size_t max_len = 0;
+ ShGetInfo(handle, SH_NAME_MAX_LENGTH, &max_len);
+ if (len > max_len) {
+ ASSERT(false);
+ len = max_len;
+ }
+ strncpy(name, it->first.c_str(), len);
+ // To be on the safe side in case the source is longer than expected.
+ name[len - 1] = '\0';
+
+ len = it->second.length() + 1;
+ max_len = 0;
+ ShGetInfo(handle, SH_HASHED_NAME_MAX_LENGTH, &max_len);
+ if (len > max_len) {
+ ASSERT(false);
+ len = max_len;
+ }
+ strncpy(hashedName, it->second.c_str(), len);
+ // To be on the safe side in case the source is longer than expected.
+ hashedName[len - 1] = '\0';
+}
+
+void ShGetInfoPointer(const ShHandle handle, ShShaderInfo pname, void** params)
+{
+ if (!handle || !params)
+ return;
+
+ TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+ TranslatorHLSL* translator = base->getAsTranslatorHLSL();
+ if (!translator) return;
+
+ switch(pname)
+ {
+ case SH_ACTIVE_UNIFORMS_ARRAY:
+ *params = (void*)&translator->getUniforms();
+ break;
+ default: UNREACHABLE();
+ }
+}
diff --git a/src/3rdparty/angle/src/compiler/SymbolTable.h b/src/3rdparty/angle/src/compiler/SymbolTable.h
index a89499e4f4..d27aa332b7 100644
--- a/src/3rdparty/angle/src/compiler/SymbolTable.h
+++ b/src/3rdparty/angle/src/compiler/SymbolTable.h
@@ -169,8 +169,8 @@ public:
void setDefined() { defined = true; }
bool isDefined() { return defined; }
- int getParamCount() const { return static_cast<int>(parameters.size()); }
- const TParameter& getParam(int i) const { return parameters[i]; }
+ size_t getParamCount() const { return parameters.size(); }
+ const TParameter& getParam(size_t i) const { return parameters[i]; }
virtual void dump(TInfoSink &infoSink) const;
TFunction(const TFunction&, TStructureMap& remapper);
@@ -323,10 +323,16 @@ public:
void dump(TInfoSink &infoSink) const;
void copyTable(const TSymbolTable& copyOf);
- void setDefaultPrecision( TBasicType type, TPrecision prec ){
- if( type != EbtFloat && type != EbtInt ) return; // Only set default precision for int/float
+ bool setDefaultPrecision( const TPublicType& type, TPrecision prec ){
+ if (IsSampler(type.type))
+ return true; // Skip sampler types for the time being
+ if (type.type != EbtFloat && type.type != EbtInt)
+ return false; // Only set default precision for int/float
+ if (type.size != 1 || type.matrix || type.array)
+ return false; // Not allowed to set for aggregate types
int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1;
- precisionStack[indexOfLastElement][type] = prec; // Uses map operator [], overwrites the current value
+ precisionStack[indexOfLastElement][type.type] = prec; // Uses map operator [], overwrites the current value
+ return true;
}
// Searches down the precisionStack for a precision qualifier for the specified TBasicType
diff --git a/src/3rdparty/angle/src/compiler/TranslatorESSL.cpp b/src/3rdparty/angle/src/compiler/TranslatorESSL.cpp
index e3a2c2a802..2900f8a8ed 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorESSL.cpp
+++ b/src/3rdparty/angle/src/compiler/TranslatorESSL.cpp
@@ -22,8 +22,11 @@ void TranslatorESSL::translate(TIntermNode* root) {
getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
sink, getShaderType() == SH_FRAGMENT_SHADER);
+ // Write array bounds clamping emulation if needed.
+ getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
+
// Write translated shader.
- TOutputESSL outputESSL(sink);
+ TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable());
root->traverse(&outputESSL);
}
diff --git a/src/3rdparty/angle/src/compiler/TranslatorGLSL.cpp b/src/3rdparty/angle/src/compiler/TranslatorGLSL.cpp
index bb07a1eb4e..7ca4341dcd 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorGLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/TranslatorGLSL.cpp
@@ -35,7 +35,10 @@ void TranslatorGLSL::translate(TIntermNode* root) {
getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
sink, false);
+ // Write array bounds clamping emulation if needed.
+ getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
+
// Write translated shader.
- TOutputGLSL outputGLSL(sink);
+ TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable());
root->traverse(&outputGLSL);
}
diff --git a/src/3rdparty/angle/src/compiler/TranslatorHLSL.cpp b/src/3rdparty/angle/src/compiler/TranslatorHLSL.cpp
index f41decd48c..37408a07c4 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorHLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/TranslatorHLSL.cpp
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 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,15 +9,16 @@
#include "compiler/InitializeParseContext.h"
#include "compiler/OutputHLSL.h"
-TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec)
- : TCompiler(type, spec)
+TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
+ : TCompiler(type, spec), mOutputType(output)
{
}
void TranslatorHLSL::translate(TIntermNode *root)
{
TParseContext& parseContext = *GetGlobalParseContext();
- sh::OutputHLSL outputHLSL(parseContext);
+ sh::OutputHLSL outputHLSL(parseContext, getResources(), mOutputType);
outputHLSL.output();
+ mActiveUniforms = outputHLSL.getUniforms();
}
diff --git a/src/3rdparty/angle/src/compiler/TranslatorHLSL.h b/src/3rdparty/angle/src/compiler/TranslatorHLSL.h
index c3f672ba91..9550e15e8e 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorHLSL.h
+++ b/src/3rdparty/angle/src/compiler/TranslatorHLSL.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 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.
//
@@ -8,13 +8,20 @@
#define COMPILER_TRANSLATORHLSL_H_
#include "compiler/ShHandle.h"
+#include "compiler/Uniform.h"
class TranslatorHLSL : public TCompiler {
public:
- TranslatorHLSL(ShShaderType type, ShShaderSpec spec);
+ TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
+
+ virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; }
+ const sh::ActiveUniforms &getUniforms() { return mActiveUniforms; }
protected:
virtual void translate(TIntermNode* root);
+
+ sh::ActiveUniforms mActiveUniforms;
+ ShShaderOutput mOutputType;
};
#endif // COMPILER_TRANSLATORHLSL_H_
diff --git a/src/3rdparty/angle/src/compiler/Types.h b/src/3rdparty/angle/src/compiler/Types.h
index d4576673b1..854bb44c07 100644
--- a/src/3rdparty/angle/src/compiler/Types.h
+++ b/src/3rdparty/angle/src/compiler/Types.h
@@ -136,6 +136,43 @@ public:
return totalSize;
}
+ int elementRegisterCount() const
+ {
+ TTypeList *structure = getStruct();
+
+ if (structure)
+ {
+ int registerCount = 0;
+
+ for (size_t i = 0; i < structure->size(); i++)
+ {
+ registerCount += (*structure)[i].type->totalRegisterCount();
+ }
+
+ return registerCount;
+ }
+ else if (isMatrix())
+ {
+ return getNominalSize();
+ }
+ else
+ {
+ return 1;
+ }
+ }
+
+ int totalRegisterCount() const
+ {
+ if (array)
+ {
+ return arraySize * elementRegisterCount();
+ }
+ else
+ {
+ return elementRegisterCount();
+ }
+ }
+
bool isMatrix() const { return matrix ? true : false; }
void setMatrix(bool m) { matrix = m; }
diff --git a/src/3rdparty/angle/src/compiler/UnfoldShortCircuit.cpp b/src/3rdparty/angle/src/compiler/UnfoldShortCircuit.cpp
index 1782ebc90c..47f0afca6a 100644
--- a/src/3rdparty/angle/src/compiler/UnfoldShortCircuit.cpp
+++ b/src/3rdparty/angle/src/compiler/UnfoldShortCircuit.cpp
@@ -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.
//
@@ -95,9 +95,9 @@ bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node)
mTemporaryIndex = i + 1;
}
return false;
+ default:
+ return true;
}
-
- return true;
}
bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
@@ -111,6 +111,8 @@ bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
out << mOutputHLSL->typeString(node->getType()) << " s" << i << ";\n";
+ out << "{\n";
+
mTemporaryIndex = i + 1;
node->getCondition()->traverse(this);
out << "if(";
@@ -135,6 +137,8 @@ bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
out << ";\n"
"}\n";
+ out << "}\n";
+
mTemporaryIndex = i + 1;
}
diff --git a/src/3rdparty/angle/src/compiler/Uniform.cpp b/src/3rdparty/angle/src/compiler/Uniform.cpp
new file mode 100644
index 0000000000..f367db2be8
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/Uniform.cpp
@@ -0,0 +1,21 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/Uniform.h"
+
+namespace sh
+{
+
+Uniform::Uniform(GLenum type, GLenum precision, const char *name, int arraySize, int registerIndex)
+{
+ this->type = type;
+ this->precision = precision;
+ this->name = name;
+ this->arraySize = arraySize;
+ this->registerIndex = registerIndex;
+}
+
+}
diff --git a/src/3rdparty/angle/src/compiler/Uniform.h b/src/3rdparty/angle/src/compiler/Uniform.h
new file mode 100644
index 0000000000..4c53ffa7d2
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/Uniform.h
@@ -0,0 +1,35 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_UNIFORM_H_
+#define COMPILER_UNIFORM_H_
+
+#include <string>
+#include <vector>
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+
+namespace sh
+{
+
+struct Uniform
+{
+ Uniform(GLenum type, GLenum precision, const char *name, int arraySize, int registerIndex);
+
+ GLenum type;
+ GLenum precision;
+ std::string name;
+ unsigned int arraySize;
+
+ int registerIndex;
+};
+
+typedef std::vector<Uniform> ActiveUniforms;
+
+}
+
+#endif // COMPILER_UNIFORM_H_
diff --git a/src/3rdparty/angle/src/compiler/ValidateLimitations.cpp b/src/3rdparty/angle/src/compiler/ValidateLimitations.cpp
index d69ec6bbaa..a5562d09a4 100644
--- a/src/3rdparty/angle/src/compiler/ValidateLimitations.cpp
+++ b/src/3rdparty/angle/src/compiler/ValidateLimitations.cpp
@@ -421,7 +421,7 @@ bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
return true;
// List of param indices for which loop indices are used as argument.
- typedef std::vector<int> ParamIndex;
+ typedef std::vector<size_t> ParamIndex;
ParamIndex pIndex;
TIntermSequence& params = node->getSequence();
for (TIntermSequence::size_type i = 0; i < params.size(); ++i) {
diff --git a/src/3rdparty/angle/src/compiler/VariableInfo.cpp b/src/3rdparty/angle/src/compiler/VariableInfo.cpp
index 3ff283627b..eb6bea9b0f 100644
--- a/src/3rdparty/angle/src/compiler/VariableInfo.cpp
+++ b/src/3rdparty/angle/src/compiler/VariableInfo.cpp
@@ -77,23 +77,25 @@ static void getBuiltInVariableInfo(const TType& type,
static void getUserDefinedVariableInfo(const TType& type,
const TString& name,
const TString& mappedName,
- TVariableInfoList& infoList);
+ TVariableInfoList& infoList,
+ ShHashFunction64 hashFunction);
// Returns info for an attribute or uniform.
static void getVariableInfo(const TType& type,
const TString& name,
const TString& mappedName,
- TVariableInfoList& infoList)
+ TVariableInfoList& infoList,
+ ShHashFunction64 hashFunction)
{
if (type.getBasicType() == EbtStruct) {
if (type.isArray()) {
for (int i = 0; i < type.getArraySize(); ++i) {
TString lname = name + arrayBrackets(i);
TString lmappedName = mappedName + arrayBrackets(i);
- getUserDefinedVariableInfo(type, lname, lmappedName, infoList);
+ getUserDefinedVariableInfo(type, lname, lmappedName, infoList, hashFunction);
}
} else {
- getUserDefinedVariableInfo(type, name, mappedName, infoList);
+ getUserDefinedVariableInfo(type, name, mappedName, infoList, hashFunction);
}
} else {
getBuiltInVariableInfo(type, name, mappedName, infoList);
@@ -124,7 +126,8 @@ void getBuiltInVariableInfo(const TType& type,
void getUserDefinedVariableInfo(const TType& type,
const TString& name,
const TString& mappedName,
- TVariableInfoList& infoList)
+ TVariableInfoList& infoList,
+ ShHashFunction64 hashFunction)
{
ASSERT(type.getBasicType() == EbtStruct);
@@ -133,8 +136,9 @@ void getUserDefinedVariableInfo(const TType& type,
const TType* fieldType = (*structure)[i].type;
getVariableInfo(*fieldType,
name + "." + fieldType->getFieldName(),
- mappedName + "." + fieldType->getFieldName(),
- infoList);
+ mappedName + "." + TIntermTraverser::hash(fieldType->getFieldName(), hashFunction),
+ infoList,
+ hashFunction);
}
}
@@ -149,9 +153,11 @@ TVariableInfo::TVariableInfo(ShDataType type, int size)
}
CollectAttribsUniforms::CollectAttribsUniforms(TVariableInfoList& attribs,
- TVariableInfoList& uniforms)
+ TVariableInfoList& uniforms,
+ ShHashFunction64 hashFunction)
: mAttribs(attribs),
- mUniforms(uniforms)
+ mUniforms(uniforms),
+ mHashFunction(hashFunction)
{
}
@@ -206,10 +212,16 @@ bool CollectAttribsUniforms::visitAggregate(Visit, TIntermAggregate* node)
// cannot be initialized in a shader, we must have only
// TIntermSymbol nodes in the sequence.
ASSERT(variable != NULL);
+ TString processedSymbol;
+ if (mHashFunction == NULL)
+ processedSymbol = variable->getSymbol();
+ else
+ processedSymbol = TIntermTraverser::hash(variable->getOriginalSymbol(), mHashFunction);
getVariableInfo(variable->getType(),
variable->getOriginalSymbol(),
- variable->getSymbol(),
- infoList);
+ processedSymbol,
+ infoList,
+ mHashFunction);
}
}
break;
diff --git a/src/3rdparty/angle/src/compiler/VariableInfo.h b/src/3rdparty/angle/src/compiler/VariableInfo.h
index fdcc08f5b5..4130a589f5 100644
--- a/src/3rdparty/angle/src/compiler/VariableInfo.h
+++ b/src/3rdparty/angle/src/compiler/VariableInfo.h
@@ -27,7 +27,8 @@ typedef std::vector<TVariableInfo> TVariableInfoList;
class CollectAttribsUniforms : public TIntermTraverser {
public:
CollectAttribsUniforms(TVariableInfoList& attribs,
- TVariableInfoList& uniforms);
+ TVariableInfoList& uniforms,
+ ShHashFunction64 hashFunction);
virtual void visitSymbol(TIntermSymbol*);
virtual void visitConstantUnion(TIntermConstantUnion*);
@@ -41,6 +42,8 @@ public:
private:
TVariableInfoList& mAttribs;
TVariableInfoList& mUniforms;
+
+ ShHashFunction64 mHashFunction;
};
#endif // COMPILER_VARIABLE_INFO_H_
diff --git a/src/3rdparty/angle/src/compiler/VariablePacker.cpp b/src/3rdparty/angle/src/compiler/VariablePacker.cpp
index 2f0c4bc2a2..8957287763 100644
--- a/src/3rdparty/angle/src/compiler/VariablePacker.cpp
+++ b/src/3rdparty/angle/src/compiler/VariablePacker.cpp
@@ -85,7 +85,7 @@ int VariablePacker::GetNumRows(ShDataType type)
case SH_FLOAT_MAT3:
return 3;
case SH_FLOAT_MAT2:
- return 1;
+ return 2;
case SH_FLOAT_VEC4:
case SH_INT_VEC4:
case SH_BOOL_VEC4:
diff --git a/src/3rdparty/angle/src/compiler/glslang.h b/src/3rdparty/angle/src/compiler/glslang.h
index 3a45daf3a4..f221199093 100644
--- a/src/3rdparty/angle/src/compiler/glslang.h
+++ b/src/3rdparty/angle/src/compiler/glslang.h
@@ -8,7 +8,7 @@ struct TParseContext;
extern int glslang_initialize(TParseContext* context);
extern int glslang_finalize(TParseContext* context);
-extern int glslang_scan(int count,
+extern int glslang_scan(size_t count,
const char* const string[],
const int length[],
TParseContext* context);
diff --git a/src/3rdparty/angle/src/compiler/glslang.l b/src/3rdparty/angle/src/compiler/glslang.l
index e0483e2ea9..140a9aeb2d 100644
--- a/src/3rdparty/angle/src/compiler/glslang.l
+++ b/src/3rdparty/angle/src/compiler/glslang.l
@@ -38,7 +38,7 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
%{
#include "compiler/glslang.h"
#include "compiler/ParseHelper.h"
-#include "compiler/preprocessor/new/Token.h"
+#include "compiler/preprocessor/Token.h"
#include "compiler/util.h"
#include "glslang_tab.h"
@@ -51,7 +51,7 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
#define YY_INPUT(buf, result, max_size) \
result = string_input(buf, max_size, yyscanner);
-static int string_input(char* buf, int max_size, yyscan_t yyscanner);
+static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner);
static int check_type(yyscan_t yyscanner);
static int reserved_word(yyscan_t yyscanner);
%}
@@ -203,10 +203,10 @@ O [0-7]
return check_type(yyscanner);
}
-0[xX]{H}+ { yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
-0{O}+ { yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
+0[xX]{H}+ { yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return(INTCONSTANT); }
+0{O}+ { yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return(INTCONSTANT); }
0{D}+ { context->error(yylineno, "Invalid Octal number.", yytext); context->recover(); return 0;}
-{D}+ { yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
+{D}+ { yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return(INTCONSTANT); }
{D}+{E} { yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
{D}+"."{D}*({E})? { yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
@@ -272,146 +272,13 @@ O [0-7]
%%
-// Old preprocessor interface.
-extern "C" {
-#include "compiler/preprocessor/preprocess.h"
-
-extern int InitPreprocessor();
-extern int FinalizePreprocessor();
-extern void PredefineIntMacro(const char *name, int value);
-
-#define SETUP_CONTEXT(pp) \
- TParseContext* context = (TParseContext*) pp->pC; \
- struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
-
-// Preprocessor callbacks.
-void CPPDebugLogMsg(const char *msg)
-{
- SETUP_CONTEXT(cpp);
- context->trace(msg);
-}
-
-void CPPWarningToInfoLog(const char *msg)
-{
- SETUP_CONTEXT(cpp);
- context->warning(yylineno, msg, "");
-}
-
-void CPPShInfoLogMsg(const char *msg)
-{
- SETUP_CONTEXT(cpp);
- context->error(yylineno, msg, "");
- context->recover();
-}
-
-void CPPErrorToInfoLog(const char *msg)
-{
- SETUP_CONTEXT(cpp);
- context->error(yylineno, msg, "");
- context->recover();
-}
-
-void SetLineNumber(int line)
-{
- SETUP_CONTEXT(cpp);
- int string = 0;
- DecodeSourceLoc(yylineno, &string, NULL);
- yylineno = EncodeSourceLoc(string, line);
-}
-
-void SetStringNumber(int string)
-{
- SETUP_CONTEXT(cpp);
- int line = 0;
- DecodeSourceLoc(yylineno, NULL, &line);
- yylineno = EncodeSourceLoc(string, line);
-}
-
-int GetStringNumber()
-{
- SETUP_CONTEXT(cpp);
- int string = 0;
- DecodeSourceLoc(yylineno, &string, NULL);
- return string;
-}
-
-int GetLineNumber()
-{
- SETUP_CONTEXT(cpp);
- int line = 0;
- DecodeSourceLoc(yylineno, NULL, &line);
- return line;
-}
-
-void IncLineNumber()
-{
- SETUP_CONTEXT(cpp);
- int string = 0, line = 0;
- DecodeSourceLoc(yylineno, &string, &line);
- yylineno = EncodeSourceLoc(string, ++line);
-}
-
-void DecLineNumber()
-{
- SETUP_CONTEXT(cpp);
- int string = 0, line = 0;
- DecodeSourceLoc(yylineno, &string, &line);
- yylineno = EncodeSourceLoc(string, --line);
-}
-
-void HandlePragma(const char **tokens, int numTokens)
-{
- SETUP_CONTEXT(cpp);
-
- if (numTokens != 4) return;
- if (strcmp(tokens[1], "(") != 0) return;
- if (strcmp(tokens[3], ")") != 0) return;
-
- context->handlePragmaDirective(yylineno, tokens[0], tokens[2]);
-}
-
-void StoreStr(const char *string)
-{
- SETUP_CONTEXT(cpp);
- TString strSrc;
- strSrc = TString(string);
-
- context->HashErrMsg = context->HashErrMsg + " " + strSrc;
-}
-
-const char* GetStrfromTStr(void)
-{
- SETUP_CONTEXT(cpp);
- cpp->ErrMsg = context->HashErrMsg.c_str();
- return cpp->ErrMsg;
-}
-
-void ResetTString(void)
-{
- SETUP_CONTEXT(cpp);
- context->HashErrMsg = "";
-}
-
-void updateExtensionBehavior(const char* extName, const char* behavior)
-{
- SETUP_CONTEXT(cpp);
- context->handleExtensionDirective(yylineno, extName, behavior);
-}
-} // extern "C"
-
-int string_input(char* buf, int max_size, yyscan_t yyscanner) {
- int len = 0;
-
-#if ANGLE_USE_NEW_PREPROCESSOR
+yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
pp::Token token;
yyget_extra(yyscanner)->preprocessor.lex(&token);
- len = token.type == pp::Token::LAST ? 0 : token.text.size();
- if ((len > 0) && (len < max_size))
+ yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size();
+ if (len < max_size)
memcpy(buf, token.text.c_str(), len);
yyset_lineno(EncodeSourceLoc(token.location.file, token.location.line), yyscanner);
-#else
- len = yylex_CPP(buf, max_size);
-#endif // ANGLE_USE_NEW_PREPROCESSOR
if (len >= max_size)
YY_FATAL_ERROR("Input buffer overflow");
@@ -471,41 +338,28 @@ int glslang_finalize(TParseContext* context) {
context->scanner = NULL;
yylex_destroy(scanner);
-#if !ANGLE_USE_NEW_PREPROCESSOR
- FinalizePreprocessor();
-#endif
return 0;
}
-int glslang_scan(int count, const char* const string[], const int length[],
+int glslang_scan(size_t count, const char* const string[], const int length[],
TParseContext* context) {
yyrestart(NULL, context->scanner);
yyset_lineno(EncodeSourceLoc(0, 1), context->scanner);
context->AfterEOF = false;
// Initialize preprocessor.
-#if ANGLE_USE_NEW_PREPROCESSOR
if (!context->preprocessor.init(count, string, length))
return 1;
-#else
- if (InitPreprocessor())
- return 1;
- cpp->pC = context;
- cpp->pastFirstStatement = 0;
- if (InitScannerInput(cpp, count, string, length))
- return 1;
-#endif // ANGLE_USE_NEW_PREPROCESSOR
// Define extension macros.
const TExtensionBehavior& extBehavior = context->extensionBehavior();
for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
iter != extBehavior.end(); ++iter) {
-#if ANGLE_USE_NEW_PREPROCESSOR
context->preprocessor.predefineMacro(iter->first.c_str(), 1);
-#else
- PredefineIntMacro(iter->first.c_str(), 1);
-#endif
}
+ if (context->fragmentPrecisionHigh)
+ context->preprocessor.predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
+
return 0;
}
diff --git a/src/3rdparty/angle/src/compiler/glslang.y b/src/3rdparty/angle/src/compiler/glslang.y
index 39c9cee26e..8dbcee32ef 100644
--- a/src/3rdparty/angle/src/compiler/glslang.y
+++ b/src/3rdparty/angle/src/compiler/glslang.y
@@ -1,6 +1,6 @@
/*
//
-// Copyright (c) 2002-2010 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.
//
@@ -38,6 +38,9 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
#include "compiler/ParseHelper.h"
#include "GLSLANG/ShaderLang.h"
+#define YYENABLE_NLS 0
+#define YYLTYPE_IS_TRIVIAL 1
+
#define YYLEX_PARAM context->scanner
%}
@@ -242,36 +245,36 @@ postfix_expression
}
if ($1->getType().getQualifier() == EvqConst && $3->getQualifier() == EvqConst) {
if ($1->isArray()) { // constant folding for arrays
- $$ = context->addConstArrayNode($3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), $1, $2.line);
+ $$ = context->addConstArrayNode($3->getAsConstantUnion()->getIConst(0), $1, $2.line);
} else if ($1->isVector()) { // constant folding for vectors
TVectorFields fields;
fields.num = 1;
- fields.offsets[0] = $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
+ fields.offsets[0] = $3->getAsConstantUnion()->getIConst(0); // need to do it this way because v.xy sends fields integer array
$$ = context->addConstVectorNode(fields, $1, $2.line);
} else if ($1->isMatrix()) { // constant folding for matrices
- $$ = context->addConstMatrixNode($3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), $1, $2.line);
+ $$ = context->addConstMatrixNode($3->getAsConstantUnion()->getIConst(0), $1, $2.line);
}
} else {
if ($3->getQualifier() == EvqConst) {
- if (($1->isVector() || $1->isMatrix()) && $1->getType().getNominalSize() <= $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() && !$1->isArray() ) {
+ if (($1->isVector() || $1->isMatrix()) && $1->getType().getNominalSize() <= $3->getAsConstantUnion()->getIConst(0) && !$1->isArray() ) {
std::stringstream extraInfoStream;
- extraInfoStream << "field selection out of range '" << $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'";
+ extraInfoStream << "field selection out of range '" << $3->getAsConstantUnion()->getIConst(0) << "'";
std::string extraInfo = extraInfoStream.str();
context->error($2.line, "", "[", extraInfo.c_str());
context->recover();
} else {
if ($1->isArray()) {
if ($1->getType().getArraySize() == 0) {
- if ($1->getType().getMaxArraySize() <= $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
- if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, $2.line))
+ if ($1->getType().getMaxArraySize() <= $3->getAsConstantUnion()->getIConst(0)) {
+ if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), $3->getAsConstantUnion()->getIConst(0), true, $2.line))
context->recover();
} else {
if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), 0, false, $2.line))
context->recover();
}
- } else if ( $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= $1->getType().getArraySize()) {
+ } else if ( $3->getAsConstantUnion()->getIConst(0) >= $1->getType().getArraySize()) {
std::stringstream extraInfoStream;
- extraInfoStream << "array index out of range '" << $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'";
+ extraInfoStream << "array index out of range '" << $3->getAsConstantUnion()->getIConst(0) << "'";
std::string extraInfo = extraInfoStream.str();
context->error($2.line, "", "[", extraInfo.c_str());
context->recover();
@@ -521,7 +524,7 @@ function_call
$$->getAsAggregate()->setName(fnCandidate->getMangledName());
TQualifier qual;
- for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
+ for (size_t i = 0; i < fnCandidate->getParamCount(); ++i) {
qual = fnCandidate->getParam(i).type->getQualifier();
if (qual == EvqOut || qual == EvqInOut) {
if (context->lValueErrorCheck($$->getLine(), "assign", $$->getAsAggregate()->getSequence()[i]->getAsTyped())) {
@@ -962,7 +965,7 @@ declaration
prototype->setType(function.getReturnType());
prototype->setName(function.getName());
- for (int i = 0; i < function.getParamCount(); i++)
+ for (size_t i = 0; i < function.getParamCount(); i++)
{
const TParameter &param = function.getParam(i);
if (param.name != 0)
@@ -988,7 +991,14 @@ declaration
$$ = $1.intermAggregate;
}
| PRECISION precision_qualifier type_specifier_no_prec SEMICOLON {
- context->symbolTable.setDefaultPrecision( $3.type, $2 );
+ if (($2 == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
+ context->error($1.line, "precision is not supported in fragment shader", "highp");
+ context->recover();
+ }
+ if (!context->symbolTable.setDefaultPrecision( $3, $2 )) {
+ context->error($1.line, "illegal type argument for default precision qualifier", getBasicString($3.type));
+ context->recover();
+ }
$$ = 0;
}
;
@@ -1009,7 +1019,7 @@ function_prototype
context->error($2.line, "overloaded functions must have the same return type", $1->getReturnType().getBasicString());
context->recover();
}
- for (int i = 0; i < prevDec->getParamCount(); ++i) {
+ for (size_t i = 0; i < prevDec->getParamCount(); ++i) {
if (prevDec->getParam(i).type->getQualifier() != $1->getParam(i).type->getQualifier()) {
context->error($2.line, "overloaded functions must have the same parameter qualifiers", $1->getParam(i).type->getQualifierString());
context->recover();
@@ -2079,7 +2089,7 @@ function_definition
// knows where to find parameters.
//
TIntermAggregate* paramNodes = new TIntermAggregate;
- for (int i = 0; i < function->getParamCount(); i++) {
+ for (size_t i = 0; i < function->getParamCount(); i++) {
const TParameter& param = function->getParam(i);
if (param.name != 0) {
TVariable *variable = new TVariable(param.name, *param.type);
@@ -2139,4 +2149,3 @@ function_definition
int glslang_parse(TParseContext* context) {
return yyparse(context);
}
-
diff --git a/src/3rdparty/angle/src/compiler/intermOut.cpp b/src/3rdparty/angle/src/compiler/intermOut.cpp
index e83c7b72f2..f48a049c63 100644
--- a/src/3rdparty/angle/src/compiler/intermOut.cpp
+++ b/src/3rdparty/angle/src/compiler/intermOut.cpp
@@ -42,7 +42,7 @@ TString TType::getCompleteString() const
if (qualifier != EvqTemporary && qualifier != EvqGlobal)
stream << getQualifierString() << " " << getPrecisionString() << " ";
if (array)
- stream << "array of ";
+ stream << "array[" << getArraySize() << "] of ";
if (matrix)
stream << size << "X" << size << " matrix of ";
else if (size > 1)
diff --git a/src/3rdparty/angle/src/compiler/intermediate.h b/src/3rdparty/angle/src/compiler/intermediate.h
index af78fa00ef..8e76ef921f 100644
--- a/src/3rdparty/angle/src/compiler/intermediate.h
+++ b/src/3rdparty/angle/src/compiler/intermediate.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 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.
//
@@ -16,6 +16,8 @@
#ifndef __INTERMEDIATE_H
#define __INTERMEDIATE_H
+#include "GLSLANG/ShaderLang.h"
+
#include "compiler/Common.h"
#include "compiler/Types.h"
#include "compiler/ConstantUnion.h"
@@ -181,7 +183,7 @@ enum TOperator {
EOpVectorTimesScalarAssign,
EOpMatrixTimesScalarAssign,
EOpMatrixTimesMatrixAssign,
- EOpDivAssign,
+ EOpDivAssign
};
extern const char* getOperatorString(TOperator op);
@@ -257,6 +259,10 @@ public:
const char* getQualifierString() const { return type.getQualifierString(); }
TString getCompleteString() const { return type.getCompleteString(); }
+ int totalRegisterCount() const { return type.totalRegisterCount(); }
+ int elementRegisterCount() const { return type.elementRegisterCount(); }
+ int getArraySize() const { return type.getArraySize(); }
+
protected:
TType type;
};
@@ -267,7 +273,7 @@ protected:
enum TLoopType {
ELoopFor,
ELoopWhile,
- ELoopDoWhile,
+ ELoopDoWhile
};
class TIntermLoop : public TIntermNode {
@@ -356,7 +362,10 @@ public:
TIntermConstantUnion(ConstantUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
- void setUnionArrayPointer(ConstantUnion *c) { unionArrayPointer = c; }
+
+ 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; }
virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
virtual void traverse(TIntermTraverser*);
@@ -389,7 +398,7 @@ protected:
//
class TIntermBinary : public TIntermOperator {
public:
- TIntermBinary(TOperator o) : TIntermOperator(o) {}
+ TIntermBinary(TOperator o) : TIntermOperator(o), addIndexClamp(false) {}
virtual TIntermBinary* getAsBinaryNode() { return this; }
virtual void traverse(TIntermTraverser*);
@@ -400,9 +409,15 @@ public:
TIntermTyped* getRight() const { return right; }
bool promote(TInfoSink&);
+ void setAddIndexClamp() { addIndexClamp = true; }
+ bool getAddIndexClamp() { return addIndexClamp; }
+
protected:
TIntermTyped* left;
TIntermTyped* right;
+
+ // If set to true, wrap any EOpIndexIndirect with a clamp to bounds.
+ bool addIndexClamp;
};
//
@@ -545,6 +560,10 @@ public:
void incrementDepth() {depth++;}
void decrementDepth() {depth--;}
+ // Return the original name if hash function pointer is NULL;
+ // otherwise return the hashed name.
+ static TString hash(const TString& name, ShHashFunction64 hashFunction);
+
const bool preVisit;
const bool inVisit;
const bool postVisit;
diff --git a/src/3rdparty/angle/src/compiler/osinclude.h b/src/3rdparty/angle/src/compiler/osinclude.h
index 1d95907b79..d8bb1a797c 100644
--- a/src/3rdparty/angle/src/compiler/osinclude.h
+++ b/src/3rdparty/angle/src/compiler/osinclude.h
@@ -24,9 +24,7 @@
#error Unsupported platform.
#endif
-#if defined(ANGLE_USE_NSPR)
-#include "prthread.h"
-#elif defined(ANGLE_OS_WIN)
+#if defined(ANGLE_OS_WIN)
#define STRICT
#define VC_EXTRALEAN 1
#include <windows.h>
@@ -34,7 +32,7 @@
#include <pthread.h>
#include <semaphore.h>
#include <errno.h>
-#endif // ANGLE_USE_NSPR
+#endif // ANGLE_OS_WIN
#include "compiler/debug.h"
@@ -42,16 +40,13 @@
//
// Thread Local Storage Operations
//
-#if defined(ANGLE_USE_NSPR)
-typedef PRUintn OS_TLSIndex;
-#define OS_INVALID_TLS_INDEX 0xFFFFFFFF
-#elif defined(ANGLE_OS_WIN)
+#if defined(ANGLE_OS_WIN)
typedef DWORD OS_TLSIndex;
#define OS_INVALID_TLS_INDEX (TLS_OUT_OF_INDEXES)
#elif defined(ANGLE_OS_POSIX)
-typedef unsigned int OS_TLSIndex;
-#define OS_INVALID_TLS_INDEX 0xFFFFFFFF
-#endif // ANGLE_USE_NSPR
+typedef pthread_key_t OS_TLSIndex;
+#define OS_INVALID_TLS_INDEX (static_cast<OS_TLSIndex>(-1))
+#endif // ANGLE_OS_WIN
OS_TLSIndex OS_AllocTLSIndex();
bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);
@@ -60,9 +55,7 @@ bool OS_FreeTLSIndex(OS_TLSIndex nIndex);
inline void* OS_GetTLSValue(OS_TLSIndex nIndex)
{
ASSERT(nIndex != OS_INVALID_TLS_INDEX);
-#if defined(ANGLE_USE_NSPR)
- return PR_GetThreadPrivate(nIndex);
-#elif defined(ANGLE_OS_WIN)
+#if defined(ANGLE_OS_WIN)
return TlsGetValue(nIndex);
#elif defined(ANGLE_OS_POSIX)
return pthread_getspecific(nIndex);
diff --git a/src/3rdparty/angle/src/compiler/ossource_nspr.cpp b/src/3rdparty/angle/src/compiler/ossource_nspr.cpp
deleted file mode 100644
index f63d81e5d5..0000000000
--- a/src/3rdparty/angle/src/compiler/ossource_nspr.cpp
+++ /dev/null
@@ -1,43 +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.
-//
-
-//
-// This file contains the nspr specific functions
-//
-#include "compiler/osinclude.h"
-
-//
-// Thread Local Storage Operations
-//
-OS_TLSIndex OS_AllocTLSIndex()
-{
- PRUintn index;
- PRStatus status = PR_NewThreadPrivateIndex(&index, NULL);
-
- if (status) {
- assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
- return OS_INVALID_TLS_INDEX;
- }
-
- return index;
-}
-
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
-{
- if (nIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
- return false;
- }
-
- return PR_SetThreadPrivate(nIndex, lpvValue) == 0;
-}
-
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
-{
- // Can't delete TLS keys with nspr
- return true;
-}
-
diff --git a/src/3rdparty/angle/src/compiler/parseConst.cpp b/src/3rdparty/angle/src/compiler/parseConst.cpp
index 9a8a50c31c..421d31f586 100644
--- a/src/3rdparty/angle/src/compiler/parseConst.cpp
+++ b/src/3rdparty/angle/src/compiler/parseConst.cpp
@@ -151,6 +151,13 @@ bool TConstTraverser::visitSelection(Visit visit, TIntermSelection* node)
void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
{
+ if (!node->getUnionArrayPointer())
+ {
+ // The constant was not initialized, this should already have been logged
+ assert(infoSink.info.size() != 0);
+ return;
+ }
+
ConstantUnion* leftUnionArray = unionArray;
int instanceSize = type.getObjectSize();
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Diagnostics.cpp b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
index 3f50dfc98a..3e22e1f1c5 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Diagnostics.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "Diagnostics.h"
+#include "DiagnosticsBase.h"
#include <cassert>
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Diagnostics.h b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
index 07bc411846..07bc411846 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Diagnostics.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/DirectiveHandler.cpp b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.cpp
index ca91e1c71b..ef35c6ed50 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/DirectiveHandler.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "DirectiveHandler.h"
+#include "DirectiveHandlerBase.h"
namespace pp
{
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/DirectiveHandler.h b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.h
index 2aaeec2818..2aaeec2818 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/DirectiveHandler.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveHandlerBase.h
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/DirectiveParser.cpp b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
index f2e42d06bf..94dfdf513d 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/DirectiveParser.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
@@ -10,8 +10,8 @@
#include <cstdlib>
#include <sstream>
-#include "Diagnostics.h"
-#include "DirectiveHandler.h"
+#include "DiagnosticsBase.h"
+#include "DirectiveHandlerBase.h"
#include "ExpressionParser.h"
#include "MacroExpander.h"
#include "Token.h"
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/DirectiveParser.h b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.h
index 8a7f0072ba..8a7f0072ba 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/DirectiveParser.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.h
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/ExpressionParser.h b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.h
index 092d059413..092d059413 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/ExpressionParser.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.h
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/ExpressionParser.y b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
index 832ad4001e..b6d3143e60 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/ExpressionParser.y
+++ b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
@@ -22,7 +22,11 @@ WHICH GENERATES THE GLSL ES preprocessor expression parser.
#if defined(__GNUC__)
// Triggered by the auto-generated pplval variable.
+#if !defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#else
#pragma GCC diagnostic ignored "-Wuninitialized"
+#endif
#elif defined(_MSC_VER)
#pragma warning(disable: 4065 4701)
#endif
@@ -32,7 +36,7 @@ WHICH GENERATES THE GLSL ES preprocessor expression parser.
#include <cassert>
#include <sstream>
-#include "Diagnostics.h"
+#include "DiagnosticsBase.h"
#include "Lexer.h"
#include "Token.h"
@@ -42,6 +46,8 @@ typedef __int64 YYSTYPE;
#include <stdint.h>
typedef intmax_t YYSTYPE;
#endif // _MSC_VER
+#define YYENABLE_NLS 0
+#define YYLTYPE_IS_TRIVIAL 1
#define YYSTYPE_IS_TRIVIAL 1
#define YYSTYPE_IS_DECLARED 1
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Input.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Input.cpp
index c3de95f313..b4d970a97d 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Input.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Input.cpp
@@ -17,27 +17,26 @@ Input::Input() : mCount(0), mString(0)
{
}
-Input::Input(int count, const char* const string[], const int length[]) :
+Input::Input(size_t count, const char* const string[], const int length[]) :
mCount(count),
mString(string)
{
- assert(mCount >= 0);
mLength.reserve(mCount);
- for (int i = 0; i < mCount; ++i)
+ for (size_t i = 0; i < mCount; ++i)
{
int len = length ? length[i] : -1;
- mLength.push_back(len < 0 ? strlen(mString[i]) : len);
+ mLength.push_back(len < 0 ? std::strlen(mString[i]) : len);
}
}
-int Input::read(char* buf, int maxSize)
+size_t Input::read(char* buf, size_t maxSize)
{
- int nRead = 0;
+ size_t nRead = 0;
while ((nRead < maxSize) && (mReadLoc.sIndex < mCount))
{
- int size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex;
+ size_t size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex;
size = std::min(size, maxSize);
- memcpy(buf + nRead, mString[mReadLoc.sIndex] + mReadLoc.cIndex, size);
+ std::memcpy(buf + nRead, mString[mReadLoc.sIndex] + mReadLoc.cIndex, size);
nRead += size;
mReadLoc.cIndex += size;
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Input.h b/src/3rdparty/angle/src/compiler/preprocessor/Input.h
index dac734b68d..14b7597cb4 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Input.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Input.h
@@ -7,6 +7,7 @@
#ifndef COMPILER_PREPROCESSOR_INPUT_H_
#define COMPILER_PREPROCESSOR_INPUT_H_
+#include <stddef.h>
#include <vector>
namespace pp
@@ -17,18 +18,18 @@ class Input
{
public:
Input();
- Input(int count, const char* const string[], const int length[]);
+ Input(size_t count, const char* const string[], const int length[]);
- int count() const { return mCount; }
- const char* string(int index) const { return mString[index]; }
- int length(int index) const { return mLength[index]; }
+ size_t count() const { return mCount; }
+ const char* string(size_t index) const { return mString[index]; }
+ size_t length(size_t index) const { return mLength[index]; }
- int read(char* buf, int maxSize);
+ size_t read(char* buf, size_t maxSize);
struct Location
{
- int sIndex; // String index;
- int cIndex; // Char index.
+ size_t sIndex; // String index;
+ size_t cIndex; // Char index.
Location() : sIndex(0), cIndex(0) { }
};
@@ -36,9 +37,9 @@ class Input
private:
// Input.
- int mCount;
+ size_t mCount;
const char* const* mString;
- std::vector<int> mLength;
+ std::vector<size_t> mLength;
Location mReadLoc;
};
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Lexer.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Lexer.cpp
index 7c663ee761..7c663ee761 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Lexer.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Lexer.cpp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Lexer.h b/src/3rdparty/angle/src/compiler/preprocessor/Lexer.h
index eb85cea873..eb85cea873 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Lexer.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Lexer.h
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Macro.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp
index b2e3088e32..b2e3088e32 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Macro.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Macro.h b/src/3rdparty/angle/src/compiler/preprocessor/Macro.h
index 7ec0149116..7ec0149116 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Macro.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Macro.h
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/MacroExpander.cpp b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
index 701cec9a4b..1116c516ff 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/MacroExpander.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
@@ -9,7 +9,7 @@
#include <algorithm>
#include <sstream>
-#include "Diagnostics.h"
+#include "DiagnosticsBase.h"
#include "Token.h"
namespace pp
@@ -57,7 +57,7 @@ MacroExpander::MacroExpander(Lexer* lexer,
MacroExpander::~MacroExpander()
{
- for (size_t i = 0; i < mContextStack.size(); ++i)
+ for (std::size_t i = 0; i < mContextStack.size(); ++i)
{
delete mContextStack[i];
}
@@ -224,7 +224,7 @@ bool MacroExpander::expandMacro(const Macro& macro,
replaceMacroParams(macro, args, replacements);
}
- for (size_t i = 0; i < replacements->size(); ++i)
+ for (std::size_t i = 0; i < replacements->size(); ++i)
{
Token& repl = replacements->at(i);
if (i == 0)
@@ -311,7 +311,7 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
// Pre-expand each argument before substitution.
// This step expands each argument individually before they are
// inserted into the macro body.
- for (size_t i = 0; i < args->size(); ++i)
+ for (std::size_t i = 0; i < args->size(); ++i)
{
MacroArg& arg = args->at(i);
TokenLexer lexer(&arg);
@@ -332,7 +332,7 @@ void MacroExpander::replaceMacroParams(const Macro& macro,
const std::vector<MacroArg>& args,
std::vector<Token>* replacements)
{
- for (size_t i = 0; i < macro.replacements.size(); ++i)
+ for (std::size_t i = 0; i < macro.replacements.size(); ++i)
{
const Token& repl = macro.replacements[i];
if (repl.type != Token::IDENTIFIER)
@@ -352,13 +352,13 @@ void MacroExpander::replaceMacroParams(const Macro& macro,
continue;
}
- size_t iArg = std::distance(macro.parameters.begin(), iter);
+ std::size_t iArg = std::distance(macro.parameters.begin(), iter);
const MacroArg& arg = args[iArg];
if (arg.empty())
{
continue;
}
- size_t iRepl = replacements->size();
+ std::size_t iRepl = replacements->size();
replacements->insert(replacements->end(), arg.begin(), arg.end());
// The replacement token inherits padding properties from
// macro replacement token.
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/MacroExpander.h b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.h
index 7c5c543871..21b67571f1 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/MacroExpander.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.h
@@ -53,7 +53,7 @@ class MacroExpander : public Lexer
struct MacroContext
{
const Macro* macro;
- size_t index;
+ std::size_t index;
std::vector<Token> replacements;
MacroContext() : macro(0), index(0) { }
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Preprocessor.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
index ffa7225a8f..5ffc6420bc 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Preprocessor.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
@@ -9,7 +9,7 @@
#include <cassert>
#include <sstream>
-#include "Diagnostics.h"
+#include "DiagnosticsBase.h"
#include "DirectiveParser.h"
#include "Macro.h"
#include "MacroExpander.h"
@@ -48,7 +48,7 @@ Preprocessor::~Preprocessor()
delete mImpl;
}
-bool Preprocessor::init(int count,
+bool Preprocessor::init(size_t count,
const char* const string[],
const int length[])
{
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Preprocessor.h b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.h
index 5fe35b27bd..7b70180fc8 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Preprocessor.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.h
@@ -7,6 +7,8 @@
#ifndef COMPILER_PREPROCESSOR_PREPROCESSOR_H_
#define COMPILER_PREPROCESSOR_PREPROCESSOR_H_
+#include <stddef.h>
+
#include "pp_utils.h"
namespace pp
@@ -32,7 +34,7 @@ class Preprocessor
// Each element in the length array may contain the length of the
// corresponding string or a value less than 0 to indicate that the string
// is null terminated.
- bool init(int count, const char* const string[], const int length[]);
+ bool init(size_t count, const char* const string[], const int length[]);
// Adds a pre-defined macro.
void predefineMacro(const char* name, int value);
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/SourceLocation.h b/src/3rdparty/angle/src/compiler/preprocessor/SourceLocation.h
index 6982613ac7..6982613ac7 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/SourceLocation.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/SourceLocation.h
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Token.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Token.cpp
index 67f50aa32c..67f50aa32c 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Token.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Token.cpp
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Token.h b/src/3rdparty/angle/src/compiler/preprocessor/Token.h
index 8b553aecb6..8b553aecb6 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Token.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Token.h
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Tokenizer.h b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.h
index a594d2d865..7a6fa87b04 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Tokenizer.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.h
@@ -32,12 +32,12 @@ class Tokenizer : public Lexer
bool leadingSpace;
bool lineStart;
};
- static const size_t kMaxTokenLength;
+ static const std::size_t kMaxTokenLength;
Tokenizer(Diagnostics* diagnostics);
~Tokenizer();
- bool init(int count, const char* const string[], const int length[]);
+ bool init(size_t count, const char* const string[], const int length[]);
void setFileNumber(int file);
void setLineNumber(int line);
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/Tokenizer.l b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
index 9762988350..fc81d84f37 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/Tokenizer.l
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
@@ -1,6 +1,6 @@
/*
//
-// Copyright (c) 2002-2011 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.
//
@@ -14,7 +14,7 @@ IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
%top{
//
-// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2011-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -25,7 +25,7 @@ IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
%{
#include "Tokenizer.h"
-#include "Diagnostics.h"
+#include "DiagnosticsBase.h"
#include "Token.h"
#if defined(__GNUC__)
@@ -229,6 +229,8 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
return '\n';
}
+\\{NEWLINE} { ++yylineno; }
+
. {
yylval->assign(1, yytext[0]);
return pp::Token::PP_OTHER;
@@ -239,13 +241,14 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
// Set the location for EOF token manually.
pp::Input* input = &yyextra->input;
pp::Input::Location* scanLoc = &yyextra->scanLoc;
- int sIndexMax = std::max(0, input->count() - 1);
+ yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
if (scanLoc->sIndex != sIndexMax)
{
// We can only reach here if there are empty strings at the
// end of the input.
scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
- yyfileno = sIndexMax; yylineno = 1;
+ // FIXME: this is not 64-bit clean.
+ yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
}
yylloc->file = yyfileno;
yylloc->line = yylineno;
@@ -278,9 +281,8 @@ Tokenizer::~Tokenizer()
destroyScanner();
}
-bool Tokenizer::init(int count, const char* const string[], const int length[])
+bool Tokenizer::init(size_t count, const char* const string[], const int length[])
{
- if (count < 0) return false;
if ((count > 0) && (string == 0)) return false;
mContext.input = Input(count, string, length);
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/atom.c b/src/3rdparty/angle/src/compiler/preprocessor/atom.c
deleted file mode 100644
index 39158d2fa1..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/atom.c
+++ /dev/null
@@ -1,737 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-
-//
-// atom.c
-//
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "common/angleutils.h"
-#include "compiler/debug.h"
-#include "compiler/preprocessor/slglobals.h"
-
-#undef malloc
-#undef realloc
-#undef free
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////// String table: //////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-static const struct {
- int val;
- const char *str;
-} tokens[] = {
- { CPP_AND_OP, "&&" },
- { CPP_AND_ASSIGN, "&=" },
- { CPP_SUB_ASSIGN, "-=" },
- { CPP_MOD_ASSIGN, "%=" },
- { CPP_ADD_ASSIGN, "+=" },
- { CPP_DIV_ASSIGN, "/=" },
- { CPP_MUL_ASSIGN, "*=" },
- { CPP_RIGHT_BRACKET, ":>" },
- { CPP_EQ_OP, "==" },
- { CPP_XOR_OP, "^^" },
- { CPP_XOR_ASSIGN, "^=" },
- { CPP_FLOATCONSTANT, "<float-const>" },
- { CPP_GE_OP, ">=" },
- { CPP_RIGHT_OP, ">>" },
- { CPP_RIGHT_ASSIGN, ">>=" },
- { CPP_IDENTIFIER, "<ident>" },
- { CPP_INTCONSTANT, "<int-const>" },
- { CPP_LE_OP, "<=" },
- { CPP_LEFT_OP, "<<" },
- { CPP_LEFT_ASSIGN, "<<=" },
- { CPP_LEFT_BRACKET, "<:" },
- { CPP_LEFT_BRACE, "<%" },
- { CPP_DEC_OP, "--" },
- { CPP_RIGHT_BRACE, "%>" },
- { CPP_NE_OP, "!=" },
- { CPP_OR_OP, "||" },
- { CPP_OR_ASSIGN, "|=" },
- { CPP_INC_OP, "++" },
- { CPP_STRCONSTANT, "<string-const>" },
- { CPP_TYPEIDENTIFIER, "<type-ident>" },
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////// String table: //////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-#define INIT_STRING_TABLE_SIZE 16384
-
-typedef struct StringTable_Rec {
- char *strings;
- int nextFree;
- int size;
-} StringTable;
-
-/*
- * InitStringTable() - Initialize the string table.
- *
- */
-
-static int InitStringTable(StringTable *stable)
-{
- stable->strings = (char *) malloc(INIT_STRING_TABLE_SIZE);
- if (!stable->strings)
- return 0;
- // Zero-th offset means "empty" so don't use it.
- stable->nextFree = 1;
- stable->size = INIT_STRING_TABLE_SIZE;
- return 1;
-} // InitStringTable
-
-/*
- * FreeStringTable() - Free the string table.
- *
- */
-
-static void FreeStringTable(StringTable *stable)
-{
- if (stable->strings)
- free(stable->strings);
- stable->strings = NULL;
- stable->nextFree = 0;
- stable->size = 0;
-} // FreeStringTable
-
-/*
- * HashString() - Hash a string with the base hash function.
- *
- */
-
-static int HashString(const char *s)
-{
- int hval = 0;
-
- while (*s) {
- hval = (hval*13507 + *s*197) ^ (hval >> 2);
- s++;
- }
- return hval & 0x7fffffff;
-} // HashString
-
-/*
- * HashString2() - Hash a string with the incrimenting hash function.
- *
- */
-
-static int HashString2(const char *s)
-{
- int hval = 0;
-
- while (*s) {
- hval = (hval*729 + *s*37) ^ (hval >> 1);
- s++;
- }
- return hval;
-} // HashString2
-
-/*
- * AddString() - Add a string to a string table. Return it's offset.
- *
- */
-
-static int AddString(StringTable *stable, const char *s)
-{
- int len, loc;
- char *str;
-
- len = (int) strlen(s);
- while (stable->nextFree + len + 1 >= stable->size) {
- assert(stable->size < 1000000);
- str = (char *) malloc(stable->size*2);
- memcpy(str, stable->strings, stable->size);
- free(stable->strings);
- stable->strings = str;
- stable->size = stable->size*2;
- }
- loc = stable->nextFree;
- strcpy(&stable->strings[loc], s);
- stable->nextFree += len + 1;
- return loc;
-} // AddString
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////// Hash table: ///////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-#define INIT_HASH_TABLE_SIZE 2047
-#define HASH_TABLE_MAX_COLLISIONS 3
-
-typedef struct HashEntry_Rec {
- int index; // String table offset of string representation
- int value; // Atom (symbol) value
-} HashEntry;
-
-typedef struct HashTable_Rec {
- HashEntry *entry;
- int size;
- int entries;
- int counts[HASH_TABLE_MAX_COLLISIONS + 1];
-} HashTable;
-
-/*
- * InitHashTable() - Initialize the hash table.
- *
- */
-
-static int InitHashTable(HashTable *htable, int fsize)
-{
- int ii;
-
- htable->entry = (HashEntry *) malloc(sizeof(HashEntry)*fsize);
- if (!htable->entry)
- return 0;
- htable->size = fsize;
- for (ii = 0; ii < fsize; ii++) {
- htable->entry[ii].index = 0;
- htable->entry[ii].value = 0;
- }
- htable->entries = 0;
- for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++)
- htable->counts[ii] = 0;
- return 1;
-} // InitHashTable
-
-/*
- * FreeHashTable() - Free the hash table.
- *
- */
-
-static void FreeHashTable(HashTable *htable)
-{
- if (htable->entry)
- free(htable->entry);
- htable->entry = NULL;
- htable->size = 0;
- htable->entries = 0;
-} // FreeHashTable
-
-/*
- * Empty() - See if a hash table entry is empty.
- *
- */
-
-static int Empty(HashTable *htable, int hashloc)
-{
- assert(hashloc >= 0 && hashloc < htable->size);
- if (htable->entry[hashloc].index == 0) {
- return 1;
- } else {
- return 0;
- }
-} // Empty
-
-/*
- * Match() - See if a hash table entry is matches a string.
- *
- */
-
-static int Match(HashTable *htable, StringTable *stable, const char *s, int hashloc)
-{
- int strloc;
-
- strloc = htable->entry[hashloc].index;
- if (!strcmp(s, &stable->strings[strloc])) {
- return 1;
- } else {
- return 0;
- }
-} // Match
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////// Atom table: ///////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-#define INIT_ATOM_TABLE_SIZE 1024
-
-
-struct AtomTable_Rec {
- StringTable stable; // String table.
- HashTable htable; // Hashes string to atom number and token value. Multiple strings can
- // have the same token value but each unique string is a unique atom.
- int *amap; // Maps atom value to offset in string table. Atoms all map to unique
- // strings except for some undefined values in the lower, fixed part
- // of the atom table that map to "<undefined>". The lowest 256 atoms
- // correspond to single character ASCII values except for alphanumeric
- // characters and '_', which can be other tokens. Next come the
- // language tokens with their atom values equal to the token value.
- // Then come predefined atoms, followed by user specified identifiers.
- int *arev; // Reversed atom for symbol table use.
- int nextFree;
- int size;
-};
-
-static AtomTable latable = { { NULL, 0, 0 }, { NULL, 0, 0, {0} }, NULL, NULL, 0, 0 };
-AtomTable *atable = &latable;
-
-static int AddAtomFixed(AtomTable *atable, const char *s, int atom);
-
-/*
- * GrowAtomTable() - Grow the atom table to at least "size" if it's smaller.
- *
- */
-
-static int GrowAtomTable(AtomTable *atable, int size)
-{
- int *newmap, *newrev;
-
- if (atable->size < size) {
- if (atable->amap) {
- newmap = realloc(atable->amap, sizeof(int)*size);
- newrev = realloc(atable->arev, sizeof(int)*size);
- } else {
- newmap = malloc(sizeof(int)*size);
- newrev = malloc(sizeof(int)*size);
- atable->size = 0;
- }
- if (!newmap || !newrev) {
- /* failed to grow -- error */
- if (newmap)
- atable->amap = newmap;
- if (newrev)
- atable->arev = newrev;
- return -1;
- }
- memset(&newmap[atable->size], 0, (size - atable->size) * sizeof(int));
- memset(&newrev[atable->size], 0, (size - atable->size) * sizeof(int));
- atable->amap = newmap;
- atable->arev = newrev;
- atable->size = size;
- }
- return 0;
-} // GrowAtomTable
-
-/*
- * lReverse() - Reverse the bottom 20 bits of a 32 bit int.
- *
- */
-
-static int lReverse(int fval)
-{
- unsigned int in = fval;
- int result = 0, cnt = 0;
-
- while(in) {
- result <<= 1;
- result |= in&1;
- in >>= 1;
- cnt++;
- }
-
- // Don't use all 31 bits. One million atoms is plenty and sometimes the
- // upper bits are used for other things.
-
- if (cnt < 20)
- result <<= 20 - cnt;
- return result;
-} // lReverse
-
-/*
- * AllocateAtom() - Allocate a new atom. Associated with the "undefined" value of -1.
- *
- */
-
-static int AllocateAtom(AtomTable *atable)
-{
- if (atable->nextFree >= atable->size)
- GrowAtomTable(atable, atable->nextFree*2);
- atable->amap[atable->nextFree] = -1;
- atable->arev[atable->nextFree] = lReverse(atable->nextFree);
- atable->nextFree++;
- return atable->nextFree - 1;
-} // AllocateAtom
-
-/*
- * SetAtomValue() - Allocate a new atom associated with "hashindex".
- *
- */
-
-static void SetAtomValue(AtomTable *atable, int atomnumber, int hashindex)
-{
- atable->amap[atomnumber] = atable->htable.entry[hashindex].index;
- atable->htable.entry[hashindex].value = atomnumber;
-} // SetAtomValue
-
-/*
- * FindHashLoc() - Find the hash location for this string. Return -1 it hash table is full.
- *
- */
-
-static int FindHashLoc(AtomTable *atable, const char *s)
-{
- int hashloc, hashdelta, count;
- int FoundEmptySlot = 0;
- int collision[HASH_TABLE_MAX_COLLISIONS + 1];
-
- hashloc = HashString(s) % atable->htable.size;
- if (!Empty(&atable->htable, hashloc)) {
- if (Match(&atable->htable, &atable->stable, s, hashloc))
- return hashloc;
- collision[0] = hashloc;
- hashdelta = HashString2(s);
- count = 0;
- while (count < HASH_TABLE_MAX_COLLISIONS) {
- hashloc = ((hashloc + hashdelta) & 0x7fffffff) % atable->htable.size;
- if (!Empty(&atable->htable, hashloc)) {
- if (Match(&atable->htable, &atable->stable, s, hashloc)) {
- return hashloc;
- }
- } else {
- FoundEmptySlot = 1;
- break;
- }
- count++;
- collision[count] = hashloc;
- }
-
- if (!FoundEmptySlot) {
- if (cpp->options.DumpAtomTable) {
- int ii;
- char str[200];
- snprintf(str, sizeof(str), "*** Hash failed with more than %d collisions. Must increase hash table size. ***",
- HASH_TABLE_MAX_COLLISIONS);
- CPPShInfoLogMsg(str);
-
- snprintf(str, sizeof(str), "*** New string \"%s\", hash=%04x, delta=%04x", s, collision[0], hashdelta);
- CPPShInfoLogMsg(str);
- for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++) {
- snprintf(str, sizeof(str), "*** Collides on try %d at hash entry %04x with \"%s\"",
- ii + 1, collision[ii], GetAtomString(atable, atable->htable.entry[collision[ii]].value));
- CPPShInfoLogMsg(str);
- }
- }
- return -1;
- } else {
- atable->htable.counts[count]++;
- }
- }
- return hashloc;
-} // FindHashLoc
-
-/*
- * IncreaseHashTableSize()
- *
- */
-
-static int IncreaseHashTableSize(AtomTable *atable)
-{
- int ii, strloc, oldhashloc, value, size;
- AtomTable oldtable;
- char *s;
-
- // Save the old atom table and create a new one:
-
- oldtable = *atable;
- size = oldtable.htable.size*2 + 1;
- if (!InitAtomTable(atable, size))
- return 0;
-
- // Add all the existing values to the new atom table preserving their atom values:
-
- for (ii = atable->nextFree; ii < oldtable.nextFree; ii++) {
- strloc = oldtable.amap[ii];
- s = &oldtable.stable.strings[strloc];
- oldhashloc = FindHashLoc(&oldtable, s);
- assert(oldhashloc >= 0);
- value = oldtable.htable.entry[oldhashloc].value;
- AddAtomFixed(atable, s, value);
- }
- FreeAtomTable(&oldtable);
- return 1;
-} // IncreaseHashTableSize
-
-/*
- * LookUpAddStringHash() - Lookup a string in the hash table. If it's not there, add it and
- * initialize the atom value in the hash table to 0. Return the hash table index.
- */
-
-static int LookUpAddStringHash(AtomTable *atable, const char *s)
-{
- int hashloc, strloc;
-
- while(1) {
- hashloc = FindHashLoc(atable, s);
- if (hashloc >= 0)
- break;
- IncreaseHashTableSize(atable);
- }
-
- if (Empty(&atable->htable, hashloc)) {
- atable->htable.entries++;
- strloc = AddString(&atable->stable, s);
- atable->htable.entry[hashloc].index = strloc;
- atable->htable.entry[hashloc].value = 0;
- }
- return hashloc;
-} // LookUpAddStringHash
-
-/*
- * LookUpAddString() - Lookup a string in the hash table. If it's not there, add it and
- * initialize the atom value in the hash table to the next atom number.
- * Return the atom value of string.
- */
-
-int LookUpAddString(AtomTable *atable, const char *s)
-{
- int hashindex, atom;
-
- hashindex = LookUpAddStringHash(atable, s);
- atom = atable->htable.entry[hashindex].value;
- if (atom == 0) {
- atom = AllocateAtom(atable);
- SetAtomValue(atable, atom, hashindex);
- }
- return atom;
-} // LookUpAddString
-
-/*
- * GetAtomString()
- *
- */
-
-const char *GetAtomString(AtomTable *atable, int atom)
-{
- int soffset;
-
- if (atom > 0 && atom < atable->nextFree) {
- soffset = atable->amap[atom];
- if (soffset > 0 && soffset < atable->stable.nextFree) {
- return &atable->stable.strings[soffset];
- } else {
- return "<internal error: bad soffset>";
- }
- } else {
- if (atom == 0) {
- return "<null atom>";
- } else {
- if (atom == EOF) {
- return "<EOF>";
- } else {
- return "<invalid atom>";
- }
- }
- }
-} // GetAtomString
-
-/*
- * GetReversedAtom()
- *
- */
-
-int GetReversedAtom(AtomTable *atable, int atom)
-{
- if (atom > 0 && atom < atable->nextFree) {
- return atable->arev[atom];
- } else {
- return 0;
- }
-} // GetReversedAtom
-
-/*
- * AddAtom() - Add a string to the atom, hash and string tables if it isn't already there.
- * Return it's atom index.
- */
-
-int AddAtom(AtomTable *atable, const char *s)
-{
- int atom;
-
- atom = LookUpAddString(atable, s);
- return atom;
-} // AddAtom
-
-/*
- * AddAtomFixed() - Add an atom to the hash and string tables if it isn't already there.
- * Assign it the atom value of "atom".
- */
-
-static int AddAtomFixed(AtomTable *atable, const char *s, int atom)
-{
- int hashindex, lsize;
-
- hashindex = LookUpAddStringHash(atable, s);
- if (atable->nextFree >= atable->size || atom >= atable->size) {
- lsize = atable->size*2;
- if (lsize <= atom)
- lsize = atom + 1;
- GrowAtomTable(atable, lsize);
- }
- atable->amap[atom] = atable->htable.entry[hashindex].index;
- atable->htable.entry[hashindex].value = atom;
- //if (atom >= atable->nextFree)
- // atable->nextFree = atom + 1;
- while (atom >= atable->nextFree) {
- atable->arev[atable->nextFree] = lReverse(atable->nextFree);
- atable->nextFree++;
- }
- return atom;
-} // AddAtomFixed
-
-/*
- * InitAtomTable() - Initialize the atom table.
- *
- */
-
-int InitAtomTable(AtomTable *atable, int htsize)
-{
- unsigned int ii;
-
- htsize = htsize <= 0 ? INIT_HASH_TABLE_SIZE : htsize;
- if (!InitStringTable(&atable->stable))
- return 0;
- if (!InitHashTable(&atable->htable, htsize))
- return 0;
-
- atable->nextFree = 0;
- atable->amap = NULL;
- atable->size = 0;
- GrowAtomTable(atable, INIT_ATOM_TABLE_SIZE);
- if (!atable->amap)
- return 0;
-
- // Initialize lower part of atom table to "<undefined>" atom:
-
- AddAtomFixed(atable, "<undefined>", 0);
- for (ii = 0; ii < FIRST_USER_TOKEN_SY; ii++)
- atable->amap[ii] = atable->amap[0];
-
- // Add single character tokens to the atom table:
-
- {
- const char *s = "~!%^&*()-+=|,.<>/?;:[]{}#";
- char t[2];
-
- t[1] = '\0';
- while (*s) {
- t[0] = *s;
- AddAtomFixed(atable, t, s[0]);
- s++;
- }
- }
-
- // Add multiple character scanner tokens :
-
- for (ii = 0; ii < sizeof(tokens)/sizeof(tokens[0]); ii++)
- AddAtomFixed(atable, tokens[ii].str, tokens[ii].val);
-
- // Add error symbol if running in error mode:
-
- if (cpp->options.ErrorMode)
- AddAtomFixed(atable, "error", ERROR_SY);
-
- AddAtom(atable, "<*** end fixed atoms ***>");
-
- return 1;
-} // InitAtomTable
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////// Debug Printing Functions: //////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-/*
- * PrintAtomTable()
- *
- */
-
-void PrintAtomTable(AtomTable *atable)
-{
- int ii;
- char str[200];
-
- for (ii = 0; ii < atable->nextFree; ii++) {
- snprintf(str, sizeof(str), "%d: \"%s\"", ii, &atable->stable.strings[atable->amap[ii]]);
- CPPDebugLogMsg(str);
- }
- snprintf(str, sizeof(str), "Hash table: size=%d, entries=%d, collisions=",
- atable->htable.size, atable->htable.entries);
- CPPDebugLogMsg(str);
- for (ii = 0; ii < HASH_TABLE_MAX_COLLISIONS; ii++) {
- snprintf(str, sizeof(str), " %d", atable->htable.counts[ii]);
- CPPDebugLogMsg(str);
- }
-
-} // PrintAtomTable
-
-
-/*
- * GetStringOfAtom()
- *
- */
-
-char* GetStringOfAtom(AtomTable *atable, int atom)
-{
- char* chr_str;
- chr_str=&atable->stable.strings[atable->amap[atom]];
- return chr_str;
-} // GetStringOfAtom
-
-/*
- * FreeAtomTable() - Free the atom table and associated memory
- *
- */
-
-void FreeAtomTable(AtomTable *atable)
-{
- FreeStringTable(&atable->stable);
- FreeHashTable(&atable->htable);
- if (atable->amap)
- free(atable->amap);
- if (atable->arev)
- free(atable->arev);
- atable->amap = NULL;
- atable->arev = NULL;
- atable->nextFree = 0;
- atable->size = 0;
-} // FreeAtomTable
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////// End of atom.c ///////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/atom.h b/src/3rdparty/angle/src/compiler/preprocessor/atom.h
deleted file mode 100644
index 1d84c32515..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/atom.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-// atom.h
-//
-
-#if !defined(__ATOM_H)
-#define __ATOM_H 1
-
-typedef struct AtomTable_Rec AtomTable;
-
-extern AtomTable *atable;
-
-int InitAtomTable(AtomTable *atable, int htsize);
-void FreeAtomTable(AtomTable *atable);
-int AddAtom(AtomTable *atable, const char *s);
-void PrintAtomTable(AtomTable *atable);
-int LookUpAddString(AtomTable *atable, const char *s);
-const char *GetAtomString(AtomTable *atable, int atom);
-int GetReversedAtom(AtomTable *atable, int atom);
-char* GetStringOfAtom(AtomTable *atable, int atom);
-#endif // !defined(__ATOM_H)
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/compile.h b/src/3rdparty/angle/src/compiler/preprocessor/compile.h
deleted file mode 100644
index 11808531cc..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/compile.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-// compile.h
-//
-
-#if !defined(__COMPILE_H)
-#define __COMPILE_H 1
-
-int InitCPPStruct(void);
-
-typedef struct Options_Rec{
- const char *profileString;
- int ErrorMode;
- int Quiet;
-
- // Debug The Compiler options:
- int DumpAtomTable;
-} Options;
-
-#define MAX_IF_NESTING 64
-struct CPPStruct_Rec {
- // Public members
- SourceLoc *pLastSourceLoc; // Set at the start of each statement by the tree walkers
- Options options; // Compile options and parameters
-
- // Private members
- SourceLoc lastSourceLoc;
-
- // Scanner data:
-
- SourceLoc *tokenLoc; // Source location of most recent token seen by the scanner
- int mostRecentToken; // Most recent token seen by the scanner
- InputSrc *currentInput;
- int previous_token;
- int pastFirstStatement; // used to make sure that #version is the first statement seen in the file, if present
-
- void *pC; // storing the parseContext of the compile object in cpp.
-
- // Private members:
- SourceLoc ltokenLoc;
- int ifdepth; //current #if-#else-#endif nesting in the cpp.c file (pre-processor)
- int elsedepth[MAX_IF_NESTING];//Keep a track of #if depth..Max allowed is 64.
- int elsetracker; //#if-#else and #endif constructs...Counter.
- const char *ErrMsg;
- int CompileError; //Indicate compile error when #error, #else,#elif mismatch.
-
- //
- // Globals used to communicate between PaParseStrings() and yy_input()and
- // also across the files.(gen_glslang.cpp and scanner.c)
- //
- int PaWhichStr; // which string we're parsing
- const int* PaStrLen; // array of lengths of the PaArgv strings
- int PaArgc; // count of strings in the array
- const char* const* PaArgv; // our array of strings to parse
- unsigned int tokensBeforeEOF : 1;
-};
-
-#endif // !defined(__COMPILE_H)
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/cpp.c b/src/3rdparty/angle/src/compiler/preprocessor/cpp.c
deleted file mode 100644
index 8a1076b9df..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/cpp.c
+++ /dev/null
@@ -1,1118 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-// cpp.c
-//
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "common/angleutils.h"
-#include "compiler/preprocessor/slglobals.h"
-
-#if defined(_MSC_VER)
-#pragma warning(disable: 4054)
-#pragma warning(disable: 4152)
-#pragma warning(disable: 4706)
-#endif
-
-static int CPPif(yystypepp * yylvalpp);
-
-/* Don't use memory.c's replacements, as we clean up properly here */
-#undef malloc
-#undef free
-
-static int bindAtom = 0;
-static int constAtom = 0;
-static int defaultAtom = 0;
-static int defineAtom = 0;
-static int definedAtom = 0;
-static int elseAtom = 0;
-static int elifAtom = 0;
-static int endifAtom = 0;
-static int ifAtom = 0;
-static int ifdefAtom = 0;
-static int ifndefAtom = 0;
-static int includeAtom = 0;
-static int lineAtom = 0;
-static int pragmaAtom = 0;
-static int texunitAtom = 0;
-static int undefAtom = 0;
-static int errorAtom = 0;
-static int __LINE__Atom = 0;
-static int __FILE__Atom = 0;
-static int __VERSION__Atom = 0;
-static int versionAtom = 0;
-static int extensionAtom = 0;
-
-static Scope *macros = 0;
-#define MAX_MACRO_ARGS 64
-
-static SourceLoc ifloc; /* outermost #if */
-
-int InitCPP(void)
-{
- char buffer[64], *t;
- const char *f;
-
- // Add various atoms needed by the CPP line scanner:
- bindAtom = LookUpAddString(atable, "bind");
- constAtom = LookUpAddString(atable, "const");
- defaultAtom = LookUpAddString(atable, "default");
- defineAtom = LookUpAddString(atable, "define");
- definedAtom = LookUpAddString(atable, "defined");
- elifAtom = LookUpAddString(atable, "elif");
- elseAtom = LookUpAddString(atable, "else");
- endifAtom = LookUpAddString(atable, "endif");
- ifAtom = LookUpAddString(atable, "if");
- ifdefAtom = LookUpAddString(atable, "ifdef");
- ifndefAtom = LookUpAddString(atable, "ifndef");
- includeAtom = LookUpAddString(atable, "include");
- lineAtom = LookUpAddString(atable, "line");
- pragmaAtom = LookUpAddString(atable, "pragma");
- texunitAtom = LookUpAddString(atable, "texunit");
- undefAtom = LookUpAddString(atable, "undef");
- errorAtom = LookUpAddString(atable, "error");
- __LINE__Atom = LookUpAddString(atable, "__LINE__");
- __FILE__Atom = LookUpAddString(atable, "__FILE__");
- __VERSION__Atom = LookUpAddString(atable, "__VERSION__");
- versionAtom = LookUpAddString(atable, "version");
- extensionAtom = LookUpAddString(atable, "extension");
- macros = NewScopeInPool(mem_CreatePool(0, 0));
- strcpy(buffer, "PROFILE_");
- t = buffer + strlen(buffer);
- f = cpp->options.profileString;
- while ((isalnum(*f) || *f == '_') && t < buffer + sizeof(buffer) - 1)
- *t++ = toupper(*f++);
- *t = 0;
-
- PredefineIntMacro("GL_ES", 1);
- PredefineIntMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
-
- return 1;
-} // InitCPP
-
-int FreeCPP(void)
-{
- if (macros)
- {
- mem_FreePool(macros->pool);
- macros = 0;
- }
-
- return 1;
-}
-
-int FinalCPP(void)
-{
- if (cpp->ifdepth)
- CPPErrorToInfoLog("#if mismatch");
- return 1;
-}
-
-static int CPPdefine(yystypepp * yylvalpp)
-{
- int token, name, args[MAX_MACRO_ARGS], argc;
- const char *message;
- MacroSymbol mac;
- Symbol *symb;
- SourceLoc dummyLoc;
- memset(&mac, 0, sizeof(mac));
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != CPP_IDENTIFIER) {
- CPPErrorToInfoLog("#define");
- return token;
- }
- name = yylvalpp->sc_ident;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '(' && !yylvalpp->sc_int) {
- // gather arguments
- argc = 0;
- do {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (argc == 0 && token == ')') break;
- if (token != CPP_IDENTIFIER) {
- CPPErrorToInfoLog("#define");
- return token;
- }
- if (argc < MAX_MACRO_ARGS)
- args[argc++] = yylvalpp->sc_ident;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- } while (token == ',');
- if (token != ')') {
- CPPErrorToInfoLog("#define");
- return token;
- }
- mac.argc = argc;
- mac.args = mem_Alloc(macros->pool, argc * sizeof(int));
- memcpy(mac.args, args, argc * sizeof(int));
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- mac.body = NewTokenStream(GetAtomString(atable, name), macros->pool);
- while (token != '\n') {
- if (token == '\\') {
- CPPErrorToInfoLog("The line continuation character (\\) is not part of the OpenGL ES Shading Language");
- return token;
- } else if (token <= 0) { // EOF or error
- CPPErrorToInfoLog("unexpected end of input in #define preprocessor directive - expected a newline");
- return 0;
- }
- RecordToken(mac.body, token, yylvalpp);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- };
-
- symb = LookUpSymbol(macros, name);
- if (symb) {
- if (!symb->details.mac.undef) {
- // already defined -- need to make sure they are identical
- if (symb->details.mac.argc != mac.argc) goto error;
- for (argc=0; argc < mac.argc; argc++)
- if (symb->details.mac.args[argc] != mac.args[argc])
- goto error;
- RewindTokenStream(symb->details.mac.body);
- RewindTokenStream(mac.body);
- do {
- int old_lval, old_token;
- old_token = ReadToken(symb->details.mac.body, yylvalpp);
- old_lval = yylvalpp->sc_int;
- token = ReadToken(mac.body, yylvalpp);
- if (token != old_token || yylvalpp->sc_int != old_lval) {
- error:
- StoreStr("Macro Redefined");
- StoreStr(GetStringOfAtom(atable,name));
- message=GetStrfromTStr();
- DecLineNumber();
- CPPShInfoLogMsg(message);
- IncLineNumber();
- ResetTString();
- break; }
- } while (token > 0);
- }
- //FreeMacro(&symb->details.mac);
- } else {
- dummyLoc.file = 0;
- dummyLoc.line = 0;
- symb = AddSymbol(&dummyLoc, macros, name, MACRO_S);
- }
- symb->details.mac = mac;
- return '\n';
-} // CPPdefine
-
-static int CPPundef(yystypepp * yylvalpp)
-{
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- Symbol *symb;
- if(token == '\n'){
- CPPErrorToInfoLog("#undef");
- return token;
- }
- if (token != CPP_IDENTIFIER)
- goto error;
- symb = LookUpSymbol(macros, yylvalpp->sc_ident);
- if (symb) {
- symb->details.mac.undef = 1;
- }
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != '\n') {
- error:
- CPPErrorToInfoLog("#undef");
- }
- return token;
-} // CPPundef
-
-/* CPPelse -- skip forward to appropriate spot. This is actually used
-** to skip to and #endif after seeing an #else, AND to skip to a #else,
-** #elif, or #endif after a #if/#ifdef/#ifndef/#elif test was false
-*/
-
-static int CPPelse(int matchelse, yystypepp * yylvalpp)
-{
- int atom,depth=0;
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- while (token > 0) {
- if (token != '#') {
- while (token != '\n') {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token <= 0) { // EOF or error
- CPPErrorToInfoLog("unexpected end of input in #else preprocessor directive - expected a newline");
- return 0;
- }
- }
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- continue;
- }
- if ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) != CPP_IDENTIFIER)
- continue;
- atom = yylvalpp->sc_ident;
- if (atom == ifAtom || atom == ifdefAtom || atom == ifndefAtom){
- depth++; cpp->ifdepth++; cpp->elsetracker++;
- if (cpp->ifdepth > MAX_IF_NESTING) {
- CPPErrorToInfoLog("max #if nesting depth exceeded");
- cpp->CompileError = 1;
- return 0;
- }
- // sanity check elsetracker
- if (cpp->elsetracker < 0 || cpp->elsetracker >= MAX_IF_NESTING) {
- CPPErrorToInfoLog("mismatched #if/#endif statements");
- cpp->CompileError = 1;
- return 0;
- }
- cpp->elsedepth[cpp->elsetracker] = 0;
- }
- else if (atom == endifAtom) {
- if(--depth<0){
- if (cpp->elsetracker)
- --cpp->elsetracker;
- if (cpp->ifdepth)
- --cpp->ifdepth;
- break;
- }
- --cpp->elsetracker;
- --cpp->ifdepth;
- }
- else if (((int)(matchelse) != 0)&& depth==0) {
- if (atom == elseAtom ) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != '\n') {
- CPPWarningToInfoLog("unexpected tokens following #else preprocessor directive - expected a newline");
- while (token != '\n') {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token <= 0) { // EOF or error
- CPPErrorToInfoLog("unexpected end of input following #else preprocessor directive - expected a newline");
- return 0;
- }
- }
- }
- break;
- }
- else if (atom == elifAtom) {
- /* we decrement cpp->ifdepth here, because CPPif will increment
- * it and we really want to leave it alone */
- if (cpp->ifdepth){
- --cpp->ifdepth;
- --cpp->elsetracker;
- }
- return CPPif(yylvalpp);
- }
- }
- else if((atom==elseAtom) && (!ChkCorrectElseNesting())){
- CPPErrorToInfoLog("#else after a #else");
- cpp->CompileError=1;
- return 0;
- }
- };
- return token;
-}
-
-enum eval_prec {
- MIN_PREC,
- COND, LOGOR, LOGAND, OR, XOR, AND, EQUAL, RELATION, SHIFT, ADD, MUL, UNARY,
- MAX_PREC
-};
-
-static int op_logor(int a, int b) { return a || b; }
-static int op_logand(int a, int b) { return a && b; }
-static int op_or(int a, int b) { return a | b; }
-static int op_xor(int a, int b) { return a ^ b; }
-static int op_and(int a, int b) { return a & b; }
-static int op_eq(int a, int b) { return a == b; }
-static int op_ne(int a, int b) { return a != b; }
-static int op_ge(int a, int b) { return a >= b; }
-static int op_le(int a, int b) { return a <= b; }
-static int op_gt(int a, int b) { return a > b; }
-static int op_lt(int a, int b) { return a < b; }
-static int op_shl(int a, int b) { return a << b; }
-static int op_shr(int a, int b) { return a >> b; }
-static int op_add(int a, int b) { return a + b; }
-static int op_sub(int a, int b) { return a - b; }
-static int op_mul(int a, int b) { return a * b; }
-static int op_div(int a, int b) { return a / b; }
-static int op_mod(int a, int b) { return a % b; }
-static int op_pos(int a) { return a; }
-static int op_neg(int a) { return -a; }
-static int op_cmpl(int a) { return ~a; }
-static int op_not(int a) { return !a; }
-
-struct {
- int token, prec, (*op)(int, int);
-} binop[] = {
- { CPP_OR_OP, LOGOR, op_logor },
- { CPP_AND_OP, LOGAND, op_logand },
- { '|', OR, op_or },
- { '^', XOR, op_xor },
- { '&', AND, op_and },
- { CPP_EQ_OP, EQUAL, op_eq },
- { CPP_NE_OP, EQUAL, op_ne },
- { '>', RELATION, op_gt },
- { CPP_GE_OP, RELATION, op_ge },
- { '<', RELATION, op_lt },
- { CPP_LE_OP, RELATION, op_le },
- { CPP_LEFT_OP, SHIFT, op_shl },
- { CPP_RIGHT_OP, SHIFT, op_shr },
- { '+', ADD, op_add },
- { '-', ADD, op_sub },
- { '*', MUL, op_mul },
- { '/', MUL, op_div },
- { '%', MUL, op_mod },
-};
-
-struct {
- int token, (*op)(int);
-} unop[] = {
- { '+', op_pos },
- { '-', op_neg },
- { '~', op_cmpl },
- { '!', op_not },
-};
-
-#define ALEN(A) (sizeof(A)/sizeof(A[0]))
-
-static int eval(int token, int prec, int *res, int *err, yystypepp * yylvalpp)
-{
- int i, val;
- Symbol *s;
- if (token == CPP_IDENTIFIER) {
- if (yylvalpp->sc_ident == definedAtom) {
- int needclose = 0;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '(') {
- needclose = 1;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- if (token != CPP_IDENTIFIER)
- goto error;
- *res = (s = LookUpSymbol(macros, yylvalpp->sc_ident))
- ? !s->details.mac.undef : 0;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (needclose) {
- if (token != ')')
- goto error;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- } else if (MacroExpand(yylvalpp->sc_ident, yylvalpp)) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- return eval(token, prec, res, err, yylvalpp);
- } else {
- goto error;
- }
- } else if (token == CPP_INTCONSTANT) {
- *res = yylvalpp->sc_int;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- } else if (token == '(') {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- token = eval(token, MIN_PREC, res, err, yylvalpp);
- if (!*err) {
- if (token != ')')
- goto error;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- } else {
- for (i = ALEN(unop) - 1; i >= 0; i--) {
- if (unop[i].token == token)
- break;
- }
- if (i >= 0) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- token = eval(token, UNARY, res, err, yylvalpp);
- *res = unop[i].op(*res);
- } else {
- goto error;
- }
- }
- while (!*err) {
- if (token == ')' || token == '\n') break;
- for (i = ALEN(binop) - 1; i >= 0; i--) {
- if (binop[i].token == token)
- break;
- }
- if (i < 0 || binop[i].prec <= prec)
- break;
- val = *res;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- token = eval(token, binop[i].prec, res, err, yylvalpp);
-
- if (binop[i].op == op_div || binop[i].op == op_mod)
- {
- if (*res == 0)
- {
- CPPErrorToInfoLog("preprocessor divide or modulo by zero");
- *err = 1;
- return token;
- }
- }
-
- *res = binop[i].op(val, *res);
- }
- return token;
-error:
- CPPErrorToInfoLog("incorrect preprocessor directive");
- *err = 1;
- *res = 0;
- return token;
-} // eval
-
-static int CPPif(yystypepp * yylvalpp) {
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- int res = 0, err = 0;
-
- if (!cpp->ifdepth++)
- ifloc = *cpp->tokenLoc;
- if(cpp->ifdepth > MAX_IF_NESTING){
- CPPErrorToInfoLog("max #if nesting depth exceeded");
- cpp->CompileError = 1;
- return 0;
- }
- cpp->elsetracker++;
- // sanity check elsetracker
- if (cpp->elsetracker < 0 || cpp->elsetracker >= MAX_IF_NESTING) {
- CPPErrorToInfoLog("mismatched #if/#endif statements");
- cpp->CompileError = 1;
- return 0;
- }
- cpp->elsedepth[cpp->elsetracker] = 0;
-
- token = eval(token, MIN_PREC, &res, &err, yylvalpp);
- if (token != '\n') {
- CPPWarningToInfoLog("unexpected tokens following #if preprocessor directive - expected a newline");
- while (token != '\n') {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token <= 0) { // EOF or error
- CPPErrorToInfoLog("unexpected end of input in #if preprocessor directive - expected a newline");
- return 0;
- }
- }
- }
- if (!res && !err) {
- token = CPPelse(1, yylvalpp);
- }
-
- return token;
-} // CPPif
-
-static int CPPifdef(int defined, yystypepp * yylvalpp)
-{
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- int name = yylvalpp->sc_ident;
- if(++cpp->ifdepth > MAX_IF_NESTING){
- CPPErrorToInfoLog("max #if nesting depth exceeded");
- cpp->CompileError = 1;
- return 0;
- }
- cpp->elsetracker++;
- // sanity check elsetracker
- if (cpp->elsetracker < 0 || cpp->elsetracker >= MAX_IF_NESTING) {
- CPPErrorToInfoLog("mismatched #if/#endif statements");
- cpp->CompileError = 1;
- return 0;
- }
- cpp->elsedepth[cpp->elsetracker] = 0;
-
- if (token != CPP_IDENTIFIER) {
- defined ? CPPErrorToInfoLog("ifdef"):CPPErrorToInfoLog("ifndef");
- } else {
- Symbol *s = LookUpSymbol(macros, name);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != '\n') {
- CPPWarningToInfoLog("unexpected tokens following #ifdef preprocessor directive - expected a newline");
- while (token != '\n') {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token <= 0) { // EOF or error
- CPPErrorToInfoLog("unexpected end of input in #ifdef preprocessor directive - expected a newline");
- return 0;
- }
- }
- }
- if (((s && !s->details.mac.undef) ? 1 : 0) != defined)
- token = CPPelse(1, yylvalpp);
- }
- return token;
-} // CPPifdef
-
-static int CPPline(yystypepp * yylvalpp)
-{
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if(token=='\n'){
- DecLineNumber();
- CPPErrorToInfoLog("#line");
- IncLineNumber();
- return token;
- }
- else if (token == CPP_INTCONSTANT) {
- yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
- SetLineNumber(yylvalpp->sc_int);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- if (token == CPP_INTCONSTANT) {
- yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
- SetStringNumber(yylvalpp->sc_int);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if(token!='\n')
- CPPErrorToInfoLog("#line");
- }
- else if (token == '\n'){
- return token;
- }
- else{
- CPPErrorToInfoLog("#line");
- }
- }
- else{
- CPPErrorToInfoLog("#line");
- }
- return token;
-}
-
-static int CPPerror(yystypepp * yylvalpp) {
-
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- const char *message;
-
- while (token != '\n') {
- if (token <= 0){
- CPPErrorToInfoLog("unexpected end of input in #error preprocessor directive - expected a newline");
- return 0;
- }else if (token == CPP_FLOATCONSTANT || token == CPP_INTCONSTANT){
- StoreStr(yylvalpp->symbol_name);
- }else if(token == CPP_IDENTIFIER || token == CPP_STRCONSTANT){
- StoreStr(GetStringOfAtom(atable,yylvalpp->sc_ident));
- }else {
- StoreStr(GetStringOfAtom(atable,token));
- }
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- DecLineNumber();
- //store this msg into the shader's information log..set the Compile Error flag!!!!
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- cpp->CompileError=1;
- IncLineNumber();
- return '\n';
-}//CPPerror
-
-static int CPPpragma(yystypepp * yylvalpp)
-{
- char SrcStrName[2];
- char** allTokens;
- int tokenCount = 0;
- int maxTokenCount = 10;
- const char* SrcStr;
- int i;
-
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- if (token=='\n') {
- DecLineNumber();
- CPPErrorToInfoLog("#pragma");
- IncLineNumber();
- return token;
- }
-
- allTokens = (char**)malloc(sizeof(char*) * maxTokenCount);
-
- while (token != '\n') {
- if (tokenCount >= maxTokenCount) {
- maxTokenCount *= 2;
- allTokens = (char**)realloc((char**)allTokens, sizeof(char*) * maxTokenCount);
- }
- switch (token) {
- case CPP_IDENTIFIER:
- SrcStr = GetAtomString(atable, yylvalpp->sc_ident);
- allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);
- strcpy(allTokens[tokenCount++], SrcStr);
- break;
- case CPP_INTCONSTANT:
- SrcStr = yylvalpp->symbol_name;
- allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);
- strcpy(allTokens[tokenCount++], SrcStr);
- break;
- case CPP_FLOATCONSTANT:
- SrcStr = yylvalpp->symbol_name;
- allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);
- strcpy(allTokens[tokenCount++], SrcStr);
- break;
- case -1:
- // EOF
- CPPShInfoLogMsg("#pragma directive must end with a newline");
- goto freeMemoryAndReturnToken;
- default:
- SrcStrName[0] = token;
- SrcStrName[1] = '\0';
- allTokens[tokenCount] = (char*)malloc(2);
- strcpy(allTokens[tokenCount++], SrcStrName);
- }
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
-
- HandlePragma((const char**)allTokens, tokenCount);
-
-freeMemoryAndReturnToken:
- for (i = 0; i < tokenCount; ++i) {
- free (allTokens[i]);
- }
- free (allTokens);
-
- return token;
-} // CPPpragma
-
-#define ESSL_VERSION_NUMBER 100
-#define ESSL_VERSION_STRING "100"
-
-static int CPPversion(yystypepp * yylvalpp)
-{
-
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- if (cpp->pastFirstStatement == 1)
- CPPShInfoLogMsg("#version must occur before any other statement in the program");
-
- if(token=='\n'){
- DecLineNumber();
- CPPErrorToInfoLog("#version");
- IncLineNumber();
- return token;
- }
- if (token != CPP_INTCONSTANT)
- CPPErrorToInfoLog("#version");
-
- yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
- //SetVersionNumber(yylvalpp->sc_int);
-
- if (yylvalpp->sc_int != ESSL_VERSION_NUMBER)
- CPPShInfoLogMsg("Version number not supported by ESSL");
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- if (token == '\n'){
- return token;
- }
- else{
- CPPErrorToInfoLog("#version");
- }
- return token;
-} // CPPversion
-
-static int CPPextension(yystypepp * yylvalpp)
-{
-
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- char extensionName[MAX_SYMBOL_NAME_LEN + 1];
-
- if(token=='\n'){
- DecLineNumber();
- CPPShInfoLogMsg("extension name not specified");
- IncLineNumber();
- return token;
- }
-
- if (token != CPP_IDENTIFIER)
- CPPErrorToInfoLog("#extension");
-
- strncpy(extensionName, GetAtomString(atable, yylvalpp->sc_ident), MAX_SYMBOL_NAME_LEN);
- extensionName[MAX_SYMBOL_NAME_LEN] = '\0';
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != ':') {
- CPPShInfoLogMsg("':' missing after extension name");
- return token;
- }
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != CPP_IDENTIFIER) {
- CPPShInfoLogMsg("behavior for extension not specified");
- return token;
- }
-
- updateExtensionBehavior(extensionName, GetAtomString(atable, yylvalpp->sc_ident));
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '\n'){
- return token;
- }
- else{
- CPPErrorToInfoLog("#extension");
- }
- return token;
-} // CPPextension
-
-int readCPPline(yystypepp * yylvalpp)
-{
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- const char *message;
-
- if (token == CPP_IDENTIFIER) {
- if (yylvalpp->sc_ident == defineAtom) {
- token = CPPdefine(yylvalpp);
- } else if (yylvalpp->sc_ident == elseAtom) {
- if(ChkCorrectElseNesting()){
- if (!cpp->ifdepth ){
- CPPErrorToInfoLog("#else mismatch");
- cpp->CompileError=1;
- return 0;
- }
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != '\n') {
- CPPWarningToInfoLog("unexpected tokens following #else preprocessor directive - expected a newline");
- while (token != '\n') {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token <= 0) { // EOF or error
- CPPErrorToInfoLog("unexpected end of input in #ifdef preprocessor directive - expected a newline");
- return 0;
- }
- }
- }
- token = CPPelse(0, yylvalpp);
- }else{
- CPPErrorToInfoLog("#else after a #else");
- cpp->ifdepth = 0;
- cpp->elsetracker = 0;
- cpp->pastFirstStatement = 1;
- cpp->CompileError = 1;
- return 0;
- }
- } else if (yylvalpp->sc_ident == elifAtom) {
- if (!cpp->ifdepth){
- CPPErrorToInfoLog("#elif mismatch");
- cpp->CompileError=1;
- return 0;
- }
- // this token is really a dont care, but we still need to eat the tokens
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- while (token != '\n') {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token <= 0) { // EOF or error
- CPPErrorToInfoLog("unexpect tokens following #elif preprocessor directive - expected a newline");
- cpp->CompileError = 1;
- return 0;
- }
- }
- token = CPPelse(0, yylvalpp);
- } else if (yylvalpp->sc_ident == endifAtom) {
- if (!cpp->ifdepth){
- CPPErrorToInfoLog("#endif mismatch");
- cpp->CompileError=1;
- return 0;
- }
- else
- --cpp->ifdepth;
-
- if (cpp->elsetracker)
- --cpp->elsetracker;
-
- } else if (yylvalpp->sc_ident == ifAtom) {
- token = CPPif(yylvalpp);
- } else if (yylvalpp->sc_ident == ifdefAtom) {
- token = CPPifdef(1, yylvalpp);
- } else if (yylvalpp->sc_ident == ifndefAtom) {
- token = CPPifdef(0, yylvalpp);
- } else if (yylvalpp->sc_ident == lineAtom) {
- token = CPPline(yylvalpp);
- } else if (yylvalpp->sc_ident == pragmaAtom) {
- token = CPPpragma(yylvalpp);
- } else if (yylvalpp->sc_ident == undefAtom) {
- token = CPPundef(yylvalpp);
- } else if (yylvalpp->sc_ident == errorAtom) {
- token = CPPerror(yylvalpp);
- } else if (yylvalpp->sc_ident == versionAtom) {
- token = CPPversion(yylvalpp);
- } else if (yylvalpp->sc_ident == extensionAtom) {
- token = CPPextension(yylvalpp);
- } else {
- StoreStr("Invalid Directive");
- StoreStr(GetStringOfAtom(atable,yylvalpp->sc_ident));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- }
- }
- while (token != '\n' && token != 0 && token != EOF) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
-
- cpp->pastFirstStatement = 1;
-
- return token;
-} // readCPPline
-
-void FreeMacro(MacroSymbol *s) {
- DeleteTokenStream(s->body);
-}
-
-void PredefineIntMacro(const char *name, int value) {
- SourceLoc location = {0, 0};
- Symbol *symbol = NULL;
- MacroSymbol macro = {0, NULL, NULL, 0, 0};
- yystypepp val = {0, 0.0, 0, {0}};
- int atom = 0;
-
- macro.body = NewTokenStream(name, macros->pool);
- val.sc_int = value;
- snprintf(val.symbol_name, MAX_SYMBOL_NAME_LEN+1, "%d", value);
- RecordToken(macro.body, CPP_INTCONSTANT, &val);
- atom = LookUpAddString(atable, name);
- symbol = AddSymbol(&location, macros, atom, MACRO_S);
- symbol->details.mac = macro;
-}
-
-static int eof_scan(InputSrc *in, yystypepp * yylvalpp) { return -1; }
-static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) { }
-
-static void PushEofSrc() {
- InputSrc *in = malloc(sizeof(InputSrc));
- memset(in, 0, sizeof(InputSrc));
- in->scan = eof_scan;
- in->getch = eof_scan;
- in->ungetch = noop;
- in->prev = cpp->currentInput;
- cpp->currentInput = in;
-}
-
-static void PopEofSrc() {
- if (cpp->currentInput->scan == eof_scan) {
- InputSrc *in = cpp->currentInput;
- cpp->currentInput = in->prev;
- free(in);
- }
-}
-
-static TokenStream *PrescanMacroArg(TokenStream *a, yystypepp * yylvalpp) {
- int token;
- TokenStream *n;
- RewindTokenStream(a);
- do {
- token = ReadToken(a, yylvalpp);
- if (token == CPP_IDENTIFIER && LookUpSymbol(macros, yylvalpp->sc_ident))
- break;
- } while (token > 0);
- if (token <= 0) return a;
- n = NewTokenStream("macro arg", 0);
- PushEofSrc();
- ReadFromTokenStream(a, 0, 0);
- while ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) > 0) {
- if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp->sc_ident, yylvalpp))
- continue;
- RecordToken(n, token, yylvalpp);
- }
- PopEofSrc();
- DeleteTokenStream(a);
- return n;
-} // PrescanMacroArg
-
-typedef struct MacroInputSrc {
- InputSrc base;
- MacroSymbol *mac;
- TokenStream **args;
-} MacroInputSrc;
-
-/* macro_scan ---
-** return the next token for a macro expanion, handling macro args
-*/
-static int macro_scan(MacroInputSrc *in, yystypepp * yylvalpp) {
- int i;
- int token = ReadToken(in->mac->body, yylvalpp);
- if (token == CPP_IDENTIFIER) {
- for (i = in->mac->argc-1; i>=0; i--)
- if (in->mac->args[i] == yylvalpp->sc_ident) break;
- if (i >= 0) {
- ReadFromTokenStream(in->args[i], yylvalpp->sc_ident, 0);
- return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- }
- if (token > 0) return token;
- in->mac->busy = 0;
- cpp->currentInput = in->base.prev;
- if (in->args) {
- for (i=in->mac->argc-1; i>=0; i--)
- DeleteTokenStream(in->args[i]);
- free(in->args);
- }
- free(in);
- return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-} // macro_scan
-
-/* MacroExpand
-** check an identifier (atom) to see if it a macro that should be expanded.
-** If it is, push an InputSrc that will produce the appropriate expansion
-** and return TRUE. If not, return FALSE.
-*/
-
-int MacroExpand(int atom, yystypepp * yylvalpp)
-{
- Symbol *sym = LookUpSymbol(macros, atom);
- MacroInputSrc *in;
- int i,j, token, depth=0;
- const char *message;
- if (atom == __LINE__Atom) {
- yylvalpp->sc_int = GetLineNumber();
- snprintf(yylvalpp->symbol_name, MAX_SYMBOL_NAME_LEN+1, "%d", yylvalpp->sc_int);
- UngetToken(CPP_INTCONSTANT, yylvalpp);
- return 1;
- }
- if (atom == __FILE__Atom) {
- yylvalpp->sc_int = GetStringNumber();
- snprintf(yylvalpp->symbol_name, MAX_SYMBOL_NAME_LEN+1, "%d", yylvalpp->sc_int);
- UngetToken(CPP_INTCONSTANT, yylvalpp);
- return 1;
- }
- if (atom == __VERSION__Atom) {
- strcpy(yylvalpp->symbol_name,ESSL_VERSION_STRING);
- yylvalpp->sc_int = atoi(yylvalpp->symbol_name);
- UngetToken(CPP_INTCONSTANT, yylvalpp);
- return 1;
- }
- if (!sym || sym->details.mac.undef) return 0;
- if (sym->details.mac.busy) return 0; // no recursive expansions
- in = malloc(sizeof(*in));
- memset(in, 0, sizeof(*in));
- in->base.scan = (void *)macro_scan;
- in->base.line = cpp->currentInput->line;
- in->base.name = cpp->currentInput->name;
- in->mac = &sym->details.mac;
- if (sym->details.mac.args) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != '(') {
- UngetToken(token, yylvalpp);
- yylvalpp->sc_ident = atom;
- return 0;
- }
- in->args = malloc(in->mac->argc * sizeof(TokenStream *));
- for (i=0; i<in->mac->argc; i++)
- in->args[i] = NewTokenStream("macro arg", 0);
- i=0;j=0;
- do{
- depth = 0;
- while(1) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token <= 0) {
- StoreStr("EOF in Macro ");
- StoreStr(GetStringOfAtom(atable,atom));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- return 1;
- }
- if((in->mac->argc==0) && (token!=')')) break;
- if (depth == 0 && (token == ',' || token == ')')) break;
- if (token == '(') depth++;
- if (token == ')') depth--;
- RecordToken(in->args[i], token, yylvalpp);
- j=1;
- }
- if (token == ')') {
- if((in->mac->argc==1) &&j==0)
- break;
- i++;
- break;
- }
- i++;
- }while(i < in->mac->argc);
-
- if (i < in->mac->argc) {
- StoreStr("Too few args in Macro ");
- StoreStr(GetStringOfAtom(atable,atom));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- } else if (token != ')') {
- depth=0;
- while (token >= 0 && (depth > 0 || token != ')')) {
- if (token == ')') depth--;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '(') depth++;
- }
-
- if (token <= 0) {
- StoreStr("EOF in Macro ");
- StoreStr(GetStringOfAtom(atable,atom));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- return 1;
- }
- StoreStr("Too many args in Macro ");
- StoreStr(GetStringOfAtom(atable,atom));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- }
- for (i=0; i<in->mac->argc; i++) {
- in->args[i] = PrescanMacroArg(in->args[i], yylvalpp);
- }
- }
-#if 0
- printf(" <%s:%d>found macro %s\n", GetAtomString(atable, loc.file),
- loc.line, GetAtomString(atable, atom));
- for (i=0; i<in->mac->argc; i++) {
- printf("\targ %s = '", GetAtomString(atable, in->mac->args[i]));
- DumpTokenStream(stdout, in->args[i]);
- printf("'\n");
- }
-#endif
- /*retain the input source*/
- in->base.prev = cpp->currentInput;
- sym->details.mac.busy = 1;
- RewindTokenStream(sym->details.mac.body);
- cpp->currentInput = &in->base;
- return 1;
-} // MacroExpand
-
-int ChkCorrectElseNesting(void)
-{
- // sanity check to make sure elsetracker is in a valid range
- if (cpp->elsetracker < 0 || cpp->elsetracker >= MAX_IF_NESTING) {
- return 0;
- }
-
- if (cpp->elsedepth[cpp->elsetracker] == 0) {
- cpp->elsedepth[cpp->elsetracker] = 1;
- return 1;
- }
- return 0;
-}
-
-
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/cpp.h b/src/3rdparty/angle/src/compiler/preprocessor/cpp.h
deleted file mode 100644
index 802e23ef07..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/cpp.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-// cpp.h
-//
-
-#if !defined(__CPP_H)
-#define __CPP_H 1
-
-#include "compiler/preprocessor/parser.h"
-#include "compiler/preprocessor/tokens.h"
-
-int InitCPP(void);
-int FinalCPP(void);
-int readCPPline(yystypepp * yylvalpp);
-int MacroExpand(int atom, yystypepp * yylvalpp);
-int ChkCorrectElseNesting(void);
-
-typedef struct MacroSymbol {
- int argc;
- int *args;
- TokenStream *body;
- unsigned busy:1;
- unsigned undef:1;
-} MacroSymbol;
-
-void FreeMacro(MacroSymbol *);
-void PredefineIntMacro(const char *name, int value);
-
-void CPPDebugLogMsg(const char *msg); // Prints information into debug log
-void CPPShInfoLogMsg(const char*); // Store cpp Err Msg into Sh.Info.Log
-void CPPWarningToInfoLog(const char *msg); // Prints warning messages into info log
-void HandlePragma(const char**, int numTokens); // #pragma directive container.
-void ResetTString(void); // #error Message as TString.
-void CPPErrorToInfoLog(const char*); // Stick all cpp errors into Sh.Info.log.
-void StoreStr(const char*); // Store the TString in Parse Context.
-void SetLineNumber(int); // Set line number.
-void SetStringNumber(int); // Set string number.
-int GetLineNumber(void); // Get the current String Number.
-int GetStringNumber(void); // Get the current String Number.
-const char* GetStrfromTStr(void); // Convert TString to String.
-void updateExtensionBehavior(const char* extName, const char* behavior);
-int FreeCPP(void);
-
-#endif // !(defined(__CPP_H)
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/cppstruct.c b/src/3rdparty/angle/src/compiler/preprocessor/cppstruct.c
deleted file mode 100644
index 58cff31091..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/cppstruct.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-// cppstruct.c
-//
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "compiler/preprocessor/slglobals.h"
-
-CPPStruct *cpp = NULL;
-static int refCount = 0;
-
-int InitPreprocessor(void);
-int ResetPreprocessor(void);
-int FreeCPPStruct(void);
-int FinalizePreprocessor(void);
-
-/*
- * InitCPPStruct() - Initilaize the CPP structure.
- *
- */
-
-int InitCPPStruct(void)
-{
- int len;
- char *p;
-
- cpp = (CPPStruct *) malloc(sizeof(CPPStruct));
- if (cpp == NULL)
- return 0;
-
- refCount++;
-
- // Initialize public members:
- cpp->pLastSourceLoc = &cpp->lastSourceLoc;
-
- p = (char *) &cpp->options;
- len = sizeof(cpp->options);
- while (--len >= 0)
- p[len] = 0;
-
- ResetPreprocessor();
- return 1;
-} // InitCPPStruct
-
-int ResetPreprocessor(void)
-{
- // Initialize private members:
-
- cpp->lastSourceLoc.file = 0;
- cpp->lastSourceLoc.line = 0;
- cpp->pC = 0;
- cpp->CompileError = 0;
- cpp->ifdepth = 0;
- for(cpp->elsetracker = 0; cpp->elsetracker < MAX_IF_NESTING; cpp->elsetracker++)
- cpp->elsedepth[cpp->elsetracker] = 0;
- cpp->elsetracker = 0;
- cpp->tokensBeforeEOF = 0;
- return 1;
-}
-
-//Intializing the Preprocessor.
-
-int InitPreprocessor(void)
-{
- # define CPP_STUFF true
- # ifdef CPP_STUFF
- FreeCPPStruct();
- InitCPPStruct();
- cpp->options.Quiet = 1;
- cpp->options.profileString = "generic";
- if (!InitAtomTable(atable, 0))
- return 1;
- if (!InitScanner(cpp))
- return 1;
- # endif
- return 0;
-}
-
-//FreeCPPStruct() - Free the CPP structure.
-
-int FreeCPPStruct(void)
-{
- if (refCount)
- {
- free(cpp);
- refCount--;
- }
-
- return 1;
-}
-
-//Finalizing the Preprocessor.
-
-int FinalizePreprocessor(void)
-{
- # define CPP_STUFF true
- # ifdef CPP_STUFF
- FreeAtomTable(atable);
- FreeCPPStruct();
- FreeScanner();
- # endif
- return 0;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////// End of cppstruct.c //////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/memory.c b/src/3rdparty/angle/src/compiler/preprocessor/memory.c
deleted file mode 100644
index 029521a559..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/memory.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifndef _MSC_VER
-#include <stdint.h>
-#endif
-
-#include "compiler/preprocessor/memory.h"
-
-#if defined(_MSC_VER)
-#pragma warning(disable: 4706)
-#endif
-
-// default alignment and chunksize, if called with 0 arguments
-#define CHUNKSIZE (64*1024)
-#define ALIGN 8
-
-// we need to call the `real' malloc and free, not our replacements
-#undef malloc
-#undef free
-
-struct chunk {
- struct chunk *next;
-};
-
-struct cleanup {
- struct cleanup *next;
- void (*fn)(void *);
- void *arg;
-};
-
-struct MemoryPool_rec {
- struct chunk *next;
- uintptr_t free, end;
- size_t chunksize;
- uintptr_t alignmask;
- struct cleanup *cleanup;
-};
-
-MemoryPool *mem_CreatePool(size_t chunksize, unsigned int align)
-{
- MemoryPool *pool;
-
- if (align == 0) align = ALIGN;
- if (chunksize == 0) chunksize = CHUNKSIZE;
- if (align & (align-1)) return 0;
- if (chunksize < sizeof(MemoryPool)) return 0;
- if (chunksize & (align-1)) return 0;
- if (!(pool = malloc(chunksize))) return 0;
- pool->next = 0;
- pool->chunksize = chunksize;
- pool->alignmask = (uintptr_t)(align)-1;
- pool->free = ((uintptr_t)(pool + 1) + pool->alignmask) & ~pool->alignmask;
- pool->end = (uintptr_t)pool + chunksize;
- pool->cleanup = 0;
- return pool;
-}
-
-void mem_FreePool(MemoryPool *pool)
-{
- struct cleanup *cleanup;
- struct chunk *p, *next;
-
- for (cleanup = pool->cleanup; cleanup; cleanup = cleanup->next) {
- cleanup->fn(cleanup->arg);
- }
- for (p = (struct chunk *)pool; p; p = next) {
- next = p->next;
- free(p);
- }
-}
-
-void *mem_Alloc(MemoryPool *pool, size_t size)
-{
- struct chunk *ch;
- void *rv = (void *)pool->free;
- size = (size + pool->alignmask) & ~pool->alignmask;
- if (size <= 0) size = pool->alignmask;
- pool->free += size;
- if (pool->free > pool->end || pool->free < (uintptr_t)rv) {
- size_t minreq = (size + sizeof(struct chunk) + pool->alignmask)
- & ~pool->alignmask;
- pool->free = (uintptr_t)rv;
- if (minreq >= pool->chunksize) {
- // request size is too big for the chunksize, so allocate it as
- // a single chunk of the right size
- ch = malloc(minreq);
- if (!ch) return 0;
- } else {
- ch = malloc(pool->chunksize);
- if (!ch) return 0;
- pool->free = (uintptr_t)ch + minreq;
- pool->end = (uintptr_t)ch + pool->chunksize;
- }
- ch->next = pool->next;
- pool->next = ch;
- rv = (void *)(((uintptr_t)(ch+1) + pool->alignmask) & ~pool->alignmask);
- }
- return rv;
-}
-
-int mem_AddCleanup(MemoryPool *pool, void (*fn)(void *), void *arg) {
- struct cleanup *cleanup;
-
- pool->free = (pool->free + sizeof(void *) - 1) & ~(sizeof(void *)-1);
- cleanup = mem_Alloc(pool, sizeof(struct cleanup));
- if (!cleanup) return -1;
- cleanup->next = pool->cleanup;
- cleanup->fn = fn;
- cleanup->arg = arg;
- pool->cleanup = cleanup;
- return 0;
-}
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/memory.h b/src/3rdparty/angle/src/compiler/preprocessor/memory.h
deleted file mode 100644
index 5fcadb32f6..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/memory.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-#ifndef __MEMORY_H
-#define __MEMORY_H
-
-#include <stddef.h>
-
-typedef struct MemoryPool_rec MemoryPool;
-
-extern MemoryPool *mem_CreatePool(size_t chunksize, unsigned int align);
-extern void mem_FreePool(MemoryPool *);
-extern void *mem_Alloc(MemoryPool *p, size_t size);
-extern void *mem_Realloc(MemoryPool *p, void *old, size_t oldsize, size_t newsize);
-extern int mem_AddCleanup(MemoryPool *p, void (*fn)(void *), void *arg);
-
-#endif /* __MEMORY_H */
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/numeric_lex.h b/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h
index b04125d230..b04125d230 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/numeric_lex.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/parser.h b/src/3rdparty/angle/src/compiler/preprocessor/parser.h
deleted file mode 100644
index f67342b670..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/parser.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-
-#ifndef BISON_PARSER_H
-# define BISON_PARSER_H
-
-#ifndef yystypepp
-typedef struct {
- int sc_int;
- float sc_fval;
- int sc_ident;
- char symbol_name[MAX_SYMBOL_NAME_LEN+1];
-} yystypepp;
-
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-# define CPP_AND_OP 257
-# define CPP_SUB_ASSIGN 259
-# define CPP_MOD_ASSIGN 260
-# define CPP_ADD_ASSIGN 261
-# define CPP_DIV_ASSIGN 262
-# define CPP_MUL_ASSIGN 263
-# define CPP_EQ_OP 264
-# define CPP_XOR_OP 265
-# define ERROR_SY 266
-# define CPP_FLOATCONSTANT 267
-# define CPP_GE_OP 268
-# define CPP_RIGHT_OP 269
-# define CPP_IDENTIFIER 270
-# define CPP_INTCONSTANT 271
-# define CPP_LE_OP 272
-# define CPP_LEFT_OP 273
-# define CPP_DEC_OP 274
-# define CPP_NE_OP 275
-# define CPP_OR_OP 276
-# define CPP_INC_OP 277
-# define CPP_STRCONSTANT 278
-# define CPP_TYPEIDENTIFIER 279
-
-# define FIRST_USER_TOKEN_SY 289
-
-# define CPP_RIGHT_ASSIGN 280
-# define CPP_LEFT_ASSIGN 281
-# define CPP_AND_ASSIGN 282
-# define CPP_OR_ASSIGN 283
-# define CPP_XOR_ASSIGN 284
-# define CPP_LEFT_BRACKET 285
-# define CPP_RIGHT_BRACKET 286
-# define CPP_LEFT_BRACE 287
-# define CPP_RIGHT_BRACE 288
-
-#endif /* not BISON_PARSER_H */
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/new/pp_utils.h b/src/3rdparty/angle/src/compiler/preprocessor/pp_utils.h
index 17164ea8b0..17164ea8b0 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/new/pp_utils.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/pp_utils.h
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/preprocess.h b/src/3rdparty/angle/src/compiler/preprocessor/preprocess.h
deleted file mode 100644
index 15056da2c9..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/preprocess.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-
-#include "compiler/preprocessor/slglobals.h"
-extern CPPStruct *cpp;
-int InitCPPStruct(void);
-int InitScanner(CPPStruct *cpp);
-int InitAtomTable(AtomTable *atable, int htsize);
-char* GetStringOfAtom(AtomTable *atable, int atom);
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/scanner.c b/src/3rdparty/angle/src/compiler/preprocessor/scanner.c
deleted file mode 100644
index fde853c1e0..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/scanner.c
+++ /dev/null
@@ -1,698 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-// scanner.c
-//
-
-#include <assert.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if 0
- #include <ieeefp.h>
-#else
- #define isinff(x) (((*(int *)&(x) & 0x7f800000L)==0x7f800000L) && \
- ((*(int *)&(x) & 0x007fffffL)==0000000000L))
-#endif
-
-#include "compiler/preprocessor/slglobals.h"
-#include "compiler/util.h"
-
-typedef struct StringInputSrc {
- InputSrc base;
- char *p;
-} StringInputSrc;
-
-static int ScanFromString(const char *s);
-
-static int eof_scan(InputSrc *is, yystypepp * yylvalpp)
-{
- return EOF;
-} // eof_scan
-
-static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) {}
-
-static InputSrc eof_inputsrc = { 0, &eof_scan, &eof_scan, &noop, 0, 0 };
-
-static int byte_scan(InputSrc *, yystypepp * yylvalpp);
-
-#define EOL_SY '\n'
-
-#if defined(_MSC_VER)
- #define DBG_BREAKPOINT() __asm int 3
-#elif defined(_M_AMD64)
- #define DBG_BREAKPOINT() assert(!"Dbg_Breakpoint");
-#else
- #define DBG_BREAKPOINT()
-#endif
-
-#if defined(_MSC_VER) && !defined(_M_AMD64)
- __int64 RDTSC ( void ) {
-
- __int64 v;
-
- __asm __emit 0x0f
- __asm __emit 0x31
- __asm mov dword ptr v, eax
- __asm mov dword ptr v+4, edx
-
- return v;
- }
-#endif
-
-
-int InitScanner(CPPStruct *cpp)
-{
- // Add various atoms needed by the CPP line scanner:
- if (!InitCPP())
- return 0;
-
- cpp->mostRecentToken = 0;
- cpp->tokenLoc = &cpp->ltokenLoc;
-
- cpp->ltokenLoc.file = 0;
- cpp->ltokenLoc.line = 0;
-
- cpp->currentInput = &eof_inputsrc;
- cpp->previous_token = '\n';
- cpp->pastFirstStatement = 0;
-
- return 1;
-} // InitScanner
-
-int FreeScanner(void)
-{
- return (FreeCPP());
-}
-
-int InitScannerInput(CPPStruct *cpp, int count, const char* const string[], const int length[])
-{
- cpp->PaWhichStr = 0;
- cpp->PaArgv = string;
- cpp->PaArgc = count;
- cpp->PaStrLen = length;
- ScanFromString(string[0]);
- return 0;
-}
-
-/*
- * str_getch()
- * takes care of reading from multiple strings.
- * returns the next-char from the input stream.
- * returns EOF when the complete shader is parsed.
- */
-static int str_getch(StringInputSrc *in)
-{
- for(;;){
- if (*in->p){
- if (*in->p == '\n') {
- in->base.line++;
- IncLineNumber();
- }
- return *in->p++;
- }
- if(++(cpp->PaWhichStr) < cpp->PaArgc){
- free(in);
- SetStringNumber(cpp->PaWhichStr);
- SetLineNumber(1);
- ScanFromString(cpp->PaArgv[cpp->PaWhichStr]);
- in=(StringInputSrc*)cpp->currentInput;
- continue;
- }
- else{
- cpp->currentInput = in->base.prev;
- cpp->PaWhichStr=0;
- free(in);
- return EOF;
- }
- }
-} // str_getch
-
-static void str_ungetch(StringInputSrc *in, int ch, yystypepp *type) {
- if (in->p[-1] == ch)in->p--;
- else {
- *(in->p)='\0'; //this would take care of shifting to the previous string.
- cpp->PaWhichStr--;
- }
- if (ch == '\n') {
- in->base.line--;
- DecLineNumber();
- }
-} // str_ungetch
-
-int ScanFromString(const char *s)
-{
-
- StringInputSrc *in = malloc(sizeof(StringInputSrc));
- memset(in, 0, sizeof(StringInputSrc));
- in->p = (char*) s;
- in->base.line = 1;
- in->base.scan = byte_scan;
- in->base.getch = (int (*)(InputSrc *, yystypepp *))str_getch;
- in->base.ungetch = (void (*)(InputSrc *, int, yystypepp *))str_ungetch;
- in->base.prev = cpp->currentInput;
- cpp->currentInput = &in->base;
-
- return 1;
-} // ScanFromString;
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////// Floating point constants: /////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-#define APPEND_CHAR_S(ch, str, len, max_len) \
- if (len < max_len) { \
- str[len++] = ch; \
- } else if (!alreadyComplained) { \
- CPPErrorToInfoLog("BUFFER OVERFLOW"); \
- alreadyComplained = 1; \
- }
-
-/*
- * lFloatConst() - Scan a floating point constant. Assumes that the scanner
- * has seen at least one digit, followed by either a decimal '.' or the
- * letter 'e'.
- * ch - '.' or 'e'
- * len - length of string already copied into yylvalpp->symbol_name.
- */
-
-static int lFloatConst(int ch, int len, yystypepp * yylvalpp)
-{
- int alreadyComplained = 0;
- assert((ch == '.') || (ch == 'e') || (ch == 'E'));
-
- if (ch == '.') {
- do {
- APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } while (ch >= '0' && ch <= '9');
- }
-
- // Exponent:
- if (ch == 'e' || ch == 'E') {
- APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '+') {
- APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } else if (ch == '-') {
- APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- if (ch >= '0' && ch <= '9') {
- while (ch >= '0' && ch <= '9') {
- APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- } else {
- CPPErrorToInfoLog("EXPONENT INVALID");
- }
- }
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-
- assert(len <= MAX_SYMBOL_NAME_LEN);
- yylvalpp->symbol_name[len] = '\0';
- yylvalpp->sc_fval = (float) atof_dot(yylvalpp->symbol_name);
- if (isinff(yylvalpp->sc_fval)) {
- CPPErrorToInfoLog("FLOAT CONSTANT OVERFLOW");
- }
- return CPP_FLOATCONSTANT;
-} // lFloatConst
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////// Normal Scanner //////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-static int byte_scan(InputSrc *in, yystypepp * yylvalpp)
-{
- char string_val[MAX_STRING_LEN + 1];
- int alreadyComplained = 0;
- int len, ch, ii, ival = 0;
-
- for (;;) {
- yylvalpp->sc_int = 0;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-
- while (ch == ' ' || ch == '\t' || ch == '\r') {
- yylvalpp->sc_int = 1;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
-
- cpp->ltokenLoc.file = cpp->currentInput->name;
- cpp->ltokenLoc.line = cpp->currentInput->line;
- alreadyComplained = 0;
- len = 0;
- switch (ch) {
- default:
- return ch; // Single character token
- case EOF:
- return -1;
- case 'A': case 'B': case 'C': case 'D': case 'E':
- case 'F': case 'G': case 'H': case 'I': case 'J':
- case 'K': case 'L': case 'M': case 'N': case 'O':
- case 'P': case 'Q': case 'R': case 'S': case 'T':
- case 'U': case 'V': case 'W': case 'X': case 'Y':
- case 'Z': case '_':
- case 'a': case 'b': case 'c': case 'd': case 'e':
- case 'f': case 'g': case 'h': case 'i': case 'j':
- case 'k': case 'l': case 'm': case 'n': case 'o':
- case 'p': case 'q': case 'r': case 's': case 't':
- case 'u': case 'v': case 'w': case 'x': case 'y':
- case 'z':
- do {
- APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } while ((ch >= 'a' && ch <= 'z') ||
- (ch >= 'A' && ch <= 'Z') ||
- (ch >= '0' && ch <= '9') ||
- ch == '_');
- assert(len <= MAX_SYMBOL_NAME_LEN);
- yylvalpp->symbol_name[len] = '\0';
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- yylvalpp->sc_ident = LookUpAddString(atable, yylvalpp->symbol_name);
- return CPP_IDENTIFIER;
- break;
- case '0':
- APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == 'x' || ch == 'X') { // hexadecimal integer constants
- APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if ((ch >= '0' && ch <= '9') ||
- (ch >= 'A' && ch <= 'F') ||
- (ch >= 'a' && ch <= 'f'))
- {
- ival = 0;
- do {
- if ((ival <= 0x0fffffff) && (len < MAX_SYMBOL_NAME_LEN)) {
- yylvalpp->symbol_name[len++] = ch;
- if (ch >= '0' && ch <= '9') {
- ii = ch - '0';
- } else if (ch >= 'A' && ch <= 'F') {
- ii = ch - 'A' + 10;
- } else {
- ii = ch - 'a' + 10;
- }
- ival = (ival << 4) | ii;
- } else if (!alreadyComplained) {
- CPPErrorToInfoLog("HEX CONSTANT OVERFLOW");
- alreadyComplained = 1;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } while ((ch >= '0' && ch <= '9') ||
- (ch >= 'A' && ch <= 'F') ||
- (ch >= 'a' && ch <= 'f'));
- } else {
- CPPErrorToInfoLog("HEX CONSTANT INVALID");
- }
- assert(len <= MAX_SYMBOL_NAME_LEN);
- yylvalpp->symbol_name[len] = '\0';
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- yylvalpp->sc_int = ival;
- return CPP_INTCONSTANT;
- } else if (ch >= '0' && ch <= '7') { // octal integer constants
- ival = 0;
- do {
- if ((ival <= 0x1fffffff) && (len < MAX_SYMBOL_NAME_LEN)) {
- yylvalpp->symbol_name[len++] = ch;
- ii = ch - '0';
- ival = (ival << 3) | ii;
- } else if (!alreadyComplained) {
- CPPErrorToInfoLog("OCT CONSTANT OVERFLOW");
- alreadyComplained = 1;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } while (ch >= '0' && ch <= '7');
- if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'h' || ch == 'x'|| ch == 'E')
- return lFloatConst(ch, len, yylvalpp);
- assert(len <= MAX_SYMBOL_NAME_LEN);
- yylvalpp->symbol_name[len] = '\0';
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- yylvalpp->sc_int = ival;
- return CPP_INTCONSTANT;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- ch = '0';
- }
- // Fall through...
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- do {
- APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } while (ch >= '0' && ch <= '9');
- if (ch == '.' || ch == 'e' || ch == 'E') {
- return lFloatConst(ch, len, yylvalpp);
- } else {
- assert(len <= MAX_SYMBOL_NAME_LEN);
- yylvalpp->symbol_name[len] = '\0';
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- ival = 0;
- for (ii = 0; ii < len; ii++) {
- ch = yylvalpp->symbol_name[ii] - '0';
- ival = ival*10 + ch;
- if ((ival > 214748364) || (ival == 214748364 && ch >= 8)) {
- CPPErrorToInfoLog("INTEGER CONSTANT OVERFLOW");
- break;
- }
- }
- yylvalpp->sc_int = ival;
- if(ival==0)
- strcpy(yylvalpp->symbol_name,"0");
- return CPP_INTCONSTANT;
- }
- break;
- case '-':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '-') {
- return CPP_DEC_OP;
- } else if (ch == '=') {
- return CPP_SUB_ASSIGN;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '-';
- }
- case '+':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '+') {
- return CPP_INC_OP;
- } else if (ch == '=') {
- return CPP_ADD_ASSIGN;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '+';
- }
- case '*':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '=') {
- return CPP_MUL_ASSIGN;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '*';
- }
- case '%':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '=') {
- return CPP_MOD_ASSIGN;
- } else if (ch == '>'){
- return CPP_RIGHT_BRACE;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '%';
- }
- case ':':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '>') {
- return CPP_RIGHT_BRACKET;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return ':';
- }
- case '^':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '^') {
- return CPP_XOR_OP;
- } else {
- if (ch == '=')
- return CPP_XOR_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '^';
- }
- }
-
- case '=':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '=') {
- return CPP_EQ_OP;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '=';
- }
- case '!':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '=') {
- return CPP_NE_OP;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '!';
- }
- case '|':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '|') {
- return CPP_OR_OP;
- } else {
- if (ch == '=')
- return CPP_OR_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '|';
- }
- }
- case '&':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '&') {
- return CPP_AND_OP;
- } else {
- if (ch == '=')
- return CPP_AND_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '&';
- }
- }
- case '<':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '<') {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if(ch == '=')
- return CPP_LEFT_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return CPP_LEFT_OP;
- }
- } else {
- if (ch == '=') {
- return CPP_LE_OP;
- } else {
- if (ch == '%')
- return CPP_LEFT_BRACE;
- else if (ch == ':')
- return CPP_LEFT_BRACKET;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '<';
- }
- }
- }
- case '>':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '>') {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if(ch == '=')
- return CPP_RIGHT_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return CPP_RIGHT_OP;
- }
- } else {
- if (ch == '=') {
- return CPP_GE_OP;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '>';
- }
- }
- case '.':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch >= '0' && ch <= '9') {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return lFloatConst('.', 0, yylvalpp);
- } else {
- if (ch == '.') {
- return -1; // Special EOF hack
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '.';
- }
- }
- case '/':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '/') {
- do {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } while (ch != '\n' && ch != EOF);
- if (ch == EOF)
- return -1;
- return '\n';
- } else if (ch == '*') {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- do {
- while (ch != '*') {
- if (ch == EOF) {
- CPPErrorToInfoLog("EOF IN COMMENT");
- return -1;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == EOF) {
- CPPErrorToInfoLog("EOF IN COMMENT");
- return -1;
- }
- } while (ch != '/');
- // Go try it again...
- } else if (ch == '=') {
- return CPP_DIV_ASSIGN;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '/';
- }
- break;
- case '"':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- while (ch != '"' && ch != '\n' && ch != EOF) {
- if (ch == '\\') {
- CPPErrorToInfoLog("The line continuation character (\\) is not part of the OpenGL ES Shading Language");
- return -1;
- }
- APPEND_CHAR_S(ch, string_val, len, MAX_STRING_LEN);
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- };
- assert(len <= MAX_STRING_LEN);
- string_val[len] = '\0';
- if (ch == '"') {
- yylvalpp->sc_ident = LookUpAddString(atable, string_val);
- return CPP_STRCONSTANT;
- } else {
- CPPErrorToInfoLog("EOL IN STRING");
- return ERROR_SY;
- }
- break;
- }
- }
-} // byte_scan
-
-int yylex_CPP(char* buf, int maxSize)
-{
- yystypepp yylvalpp;
- int token = '\n';
-
- for(;;) {
-
- char* tokenString = 0;
- token = cpp->currentInput->scan(cpp->currentInput, &yylvalpp);
- if(check_EOF(token))
- return 0;
- if (token < 0) {
- // This check may need to be improved to support UTF-8
- // characters in comments.
- CPPErrorToInfoLog("preprocessor encountered non-ASCII character in shader source");
- return 0;
- }
- if (token == '#') {
- if (cpp->previous_token == '\n'|| cpp->previous_token == 0) {
- token = readCPPline(&yylvalpp);
- if(check_EOF(token))
- return 0;
- continue;
- } else {
- CPPErrorToInfoLog("preprocessor command must not be preceded by any other statement in that line");
- return 0;
- }
- }
- cpp->previous_token = token;
- // expand macros
- if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp.sc_ident, &yylvalpp)) {
- cpp->pastFirstStatement = 1;
- continue;
- }
-
- if (token == '\n')
- continue;
- cpp->pastFirstStatement = 1;
-
- if (token == CPP_IDENTIFIER) {
- tokenString = GetStringOfAtom(atable,yylvalpp.sc_ident);
- } else if (token == CPP_FLOATCONSTANT || token == CPP_INTCONSTANT){
- tokenString = yylvalpp.symbol_name;
- } else {
- tokenString = GetStringOfAtom(atable,token);
- }
-
- if (tokenString) {
- int len = strlen(tokenString);
- cpp->tokensBeforeEOF = 1;
- if (len >= maxSize) {
- return maxSize;
- } else if (len > 0) {
- strcpy(buf, tokenString);
- return len;
- }
-
- return 0;
- }
- }
-} // yylex
-
-//Checks if the token just read is EOF or not.
-int check_EOF(int token)
-{
- if(token==-1){
- if(cpp->ifdepth >0){
- CPPErrorToInfoLog("#endif missing!! Compilation stopped");
- cpp->CompileError=1;
- }
- return 1;
- }
- return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////// End of scanner.c //////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/scanner.h b/src/3rdparty/angle/src/compiler/preprocessor/scanner.h
deleted file mode 100644
index b67c1d644e..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/scanner.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-// scanner.h
-//
-
-#if !defined(__SCANNER_H)
-#define __SCANNER_H 1
-
-#include "compiler/preprocessor/length_limits.h"
-#include "compiler/preprocessor/parser.h"
-
-// Not really atom table stuff but needed first...
-
-typedef struct SourceLoc_Rec {
- unsigned short file, line;
-} SourceLoc;
-
-int yylex_CPP(char* buf, int maxSize);
-
-typedef struct InputSrc {
- struct InputSrc *prev;
- int (*scan)(struct InputSrc *, yystypepp *);
- int (*getch)(struct InputSrc *, yystypepp *);
- void (*ungetch)(struct InputSrc *, int, yystypepp *);
- int name; /* atom */
- int line;
-} InputSrc;
-
-int InitScanner(CPPStruct *cpp); // Intialise the cpp scanner.
-int InitScannerInput(CPPStruct *cpp, int count, const char* const string[], const int length[]);
-int check_EOF(int); // check if we hit a EOF abruptly
-void CPPErrorToInfoLog(const char *); // sticking the msg,line into the Shader's.Info.log
-void SetLineNumber(int);
-void SetStringNumber(int);
-void IncLineNumber(void);
-void DecLineNumber(void);
-int FreeScanner(void); // Free the cpp scanner
-#endif // !(defined(__SCANNER_H)
-
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/slglobals.h b/src/3rdparty/angle/src/compiler/preprocessor/slglobals.h
deleted file mode 100644
index 4634626643..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/slglobals.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-// slglobals.h
-//
-
-#if !defined(__SLGLOBALS_H)
-#define __SLGLOBALS_H 1
-
-typedef struct CPPStruct_Rec CPPStruct;
-
-extern CPPStruct *cpp;
-
-#undef CPPC_DEBUG_THE_COMPILER
-#if defined(_DEBUG)
-#define CPPC_DEBUG_THE_COMPILER 1
-#endif
-
-#undef CPPC_ENABLE_TOOLS
-#define CPPC_ENABLE_TOOLS 1
-
-#include "compiler/preprocessor/memory.h"
-#include "compiler/preprocessor/atom.h"
-#include "compiler/preprocessor/scanner.h"
-#include "compiler/preprocessor/cpp.h"
-#include "compiler/preprocessor/tokens.h"
-#include "compiler/preprocessor/symbols.h"
-#include "compiler/preprocessor/compile.h"
-#if !defined(NO_PARSER)
-#include "compiler/preprocessor/parser.h"
-#endif
-
-#if !defined(NULL)
-#define NULL 0
-#endif
-
-#endif // !(defined(__SLGLOBALS_H)
-
-
-
-
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/symbols.c b/src/3rdparty/angle/src/compiler/preprocessor/symbols.c
deleted file mode 100644
index f18b2569b3..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/symbols.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-// symbols.c
-//
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "compiler/preprocessor/slglobals.h"
-
-#if defined(_MSC_VER)
-#pragma warning(disable: 4706)
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////// Symbol Table Variables: ///////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-Scope *ScopeList = NULL;
-Scope *CurrentScope = NULL;
-Scope *GlobalScope = NULL;
-
-static void unlinkScope(void *_scope) {
- Scope *scope = _scope;
-
- if (scope->next)
- scope->next->prev = scope->prev;
- if (scope->prev)
- scope->prev->next = scope->next;
- else
- ScopeList = scope->next;
-}
-
-/*
- * NewScope()
- *
- */
-Scope *NewScopeInPool(MemoryPool *pool)
-{
- Scope *lScope;
-
- lScope = mem_Alloc(pool, sizeof(Scope));
- lScope->pool = pool;
- lScope->parent = NULL;
- lScope->funScope = NULL;
- lScope->symbols = NULL;
-
- lScope->level = 0;
-
- lScope->programs = NULL;
- if ((lScope->next = ScopeList))
- ScopeList->prev = lScope;
- lScope->prev = 0;
- ScopeList = lScope;
- mem_AddCleanup(pool, unlinkScope, lScope);
- return lScope;
-} // NewScope
-
-/*
- * PushScope()
- *
- */
-
-void PushScope(Scope *fScope)
-{
- Scope *lScope;
-
- if (CurrentScope) {
- fScope->level = CurrentScope->level + 1;
- if (fScope->level == 1) {
- if (!GlobalScope) {
- /* HACK - CTD -- if GlobalScope==NULL and level==1, we're
- * defining a function in the superglobal scope. Things
- * will break if we leave the level as 1, so we arbitrarily
- * set it to 2 */
- fScope->level = 2;
- }
- }
- if (fScope->level >= 2) {
- lScope = fScope;
- while (lScope->level > 2)
- lScope = lScope->next;
- fScope->funScope = lScope;
- }
- } else {
- fScope->level = 0;
- }
- fScope->parent = CurrentScope;
- CurrentScope = fScope;
-} // PushScope
-
-/*
- * PopScope()
- *
- */
-
-Scope *PopScope(void)
-{
- Scope *lScope;
-
- lScope = CurrentScope;
- if (CurrentScope)
- CurrentScope = CurrentScope->parent;
- return lScope;
-} // PopScope
-
-/*
- * NewSymbol() - Allocate a new symbol node;
- *
- */
-
-Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind)
-{
- Symbol *lSymb;
- char *pch;
- unsigned int ii;
-
- lSymb = (Symbol *) mem_Alloc(fScope->pool, sizeof(Symbol));
- lSymb->left = NULL;
- lSymb->right = NULL;
- lSymb->next = NULL;
- lSymb->name = name;
- lSymb->loc = *loc;
- lSymb->kind = kind;
-
- // Clear union area:
-
- pch = (char *) &lSymb->details;
- for (ii = 0; ii < sizeof(lSymb->details); ii++)
- *pch++ = 0;
- return lSymb;
-} // NewSymbol
-
-/*
- * lAddToTree() - Using a binary tree is not a good idea for basic atom values because they
- * are generated in order. We'll fix this later (by reversing the bit pattern).
- */
-
-static void lAddToTree(Symbol **fSymbols, Symbol *fSymb)
-{
- Symbol *lSymb;
- int lrev, frev;
-
- lSymb = *fSymbols;
- if (lSymb) {
- frev = GetReversedAtom(atable, fSymb->name);
- while (lSymb) {
- lrev = GetReversedAtom(atable, lSymb->name);
- if (lrev == frev) {
- CPPErrorToInfoLog("GetAtomString(atable, fSymb->name)");
- break;
- } else {
- if (lrev > frev) {
- if (lSymb->left) {
- lSymb = lSymb->left;
- } else {
- lSymb->left = fSymb;
- break;
- }
- } else {
- if (lSymb->right) {
- lSymb = lSymb->right;
- } else {
- lSymb->right = fSymb;
- break;
- }
- }
- }
- }
- } else {
- *fSymbols = fSymb;
- }
-} // lAddToTree
-
-
-/*
- * AddSymbol() - Add a variable, type, or function name to a scope.
- *
- */
-
-Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind)
-{
- Symbol *lSymb;
-
- if (!fScope)
- fScope = CurrentScope;
- lSymb = NewSymbol(loc, fScope, atom, kind);
- lAddToTree(&fScope->symbols, lSymb);
- return lSymb;
-} // AddSymbol
-
-
-/*********************************************************************************************/
-/************************************ Symbol Semantic Functions ******************************/
-/*********************************************************************************************/
-
-/*
- * LookUpLocalSymbol()
- *
- */
-
-Symbol *LookUpLocalSymbol(Scope *fScope, int atom)
-{
- Symbol *lSymb;
- int rname, ratom;
-
- ratom = GetReversedAtom(atable, atom);
- if (!fScope)
- fScope = CurrentScope;
- lSymb = fScope->symbols;
- while (lSymb) {
- rname = GetReversedAtom(atable, lSymb->name);
- if (rname == ratom) {
- return lSymb;
- } else {
- if (rname > ratom) {
- lSymb = lSymb->left;
- } else {
- lSymb = lSymb->right;
- }
- }
- }
- return NULL;
-} // LookUpLocalSymbol
-
-/*
- * LookUpSymbol()
- *
- */
-
-Symbol *LookUpSymbol(Scope *fScope, int atom)
-{
- Symbol *lSymb;
-
- if (!fScope)
- fScope = CurrentScope;
- while (fScope) {
- lSymb = LookUpLocalSymbol(fScope, atom);
- if (lSymb)
- return lSymb;
- fScope = fScope->parent;
- }
- return NULL;
-} // LookUpSymbol
-
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/symbols.h b/src/3rdparty/angle/src/compiler/preprocessor/symbols.h
deleted file mode 100644
index e7d0b075fa..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/symbols.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-// symbols.h
-//
-
-#if !defined(__SYMBOLS_H)
-#define __SYMBOLS_H 1
-
-#include "compiler/preprocessor/memory.h"
-
-typedef enum symbolkind {
- MACRO_S
-} symbolkind;
-
-// Typedefs for things defined here in "symbols.h":
-
-typedef struct Scope_Rec Scope;
-typedef struct Symbol_Rec Symbol;
-
-typedef struct SymbolList_Rec {
- struct SymbolList_Rec *next;
- Symbol *symb;
-} SymbolList;
-
-struct Scope_Rec {
- Scope *next, *prev; // doubly-linked list of all scopes
- Scope *parent;
- Scope *funScope; // Points to base scope of enclosing function
- MemoryPool *pool; // pool used for allocation in this scope
- Symbol *symbols;
-
- int level; // 0 = super globals, 1 = globals, etc.
-
- // Only used at global scope (level 1):
- SymbolList *programs; // List of programs for this compilation.
-};
-
-
-// Symbol table is a simple binary tree.
-
-#include "compiler/preprocessor/cpp.h" // to get MacroSymbol def
-
-struct Symbol_Rec {
- Symbol *left, *right;
- Symbol *next;
- int name; // Name atom
- SourceLoc loc;
- symbolkind kind;
- union {
- MacroSymbol mac;
- } details;
-};
-
-extern Scope *CurrentScope;
-extern Scope *GlobalScope;
-extern Scope *ScopeList;
-
-Scope *NewScopeInPool(MemoryPool *);
-#define NewScope() NewScopeInPool(CurrentScope->pool)
-void PushScope(Scope *fScope);
-Scope *PopScope(void);
-Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind);
-Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind);
-Symbol *LookUpLocalSymbol(Scope *fScope, int atom);
-Symbol *LookUpSymbol(Scope *fScope, int atom);
-
-
-#endif // !defined(__SYMBOLS_H)
-
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/tokens.c b/src/3rdparty/angle/src/compiler/preprocessor/tokens.c
deleted file mode 100644
index b94c05ebd4..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/tokens.c
+++ /dev/null
@@ -1,467 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-// tokens.c
-//
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "common/angleutils.h"
-#include "compiler/debug.h"
-#include "compiler/preprocessor/slglobals.h"
-#include "compiler/util.h"
-
-#if defined(_MSC_VER)
-#pragma warning(disable: 4054)
-#pragma warning(disable: 4152)
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////// Preprocessor and Token Recorder and Playback: ////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-/*
- * idstr()
- * Copy a string to a malloc'ed block and convert it into something suitable
- * for an ID
- *
- */
-
-static char *idstr(const char *fstr, MemoryPool *pool)
-{
- size_t len;
- char *str, *t;
- const char *f;
-
- len = strlen(fstr);
- if (!pool)
- str = (char *) malloc(len + 1);
- else
- str = (char *) mem_Alloc(pool, len + 1);
-
- for (f=fstr, t=str; *f; f++) {
- if (isalnum(*f)) *t++ = *f;
- else if (*f == '.' || *f == '/') *t++ = '_';
- }
- *t = 0;
- return str;
-} // idstr
-
-
-/*
- * lNewBlock()
- *
- */
-
-static TokenBlock *lNewBlock(TokenStream *fTok, MemoryPool *pool)
-{
- TokenBlock *lBlock;
-
- if (!pool)
- lBlock = (TokenBlock *) malloc(sizeof(TokenBlock) + 256);
- else
- lBlock = (TokenBlock *) mem_Alloc(pool, sizeof(TokenBlock) + 256);
- lBlock->count = 0;
- lBlock->current = 0;
- lBlock->data = (unsigned char *) lBlock + sizeof(TokenBlock);
- lBlock->max = 256;
- lBlock->next = NULL;
- if (fTok->head) {
- fTok->current->next = lBlock;
- } else {
- fTok->head = lBlock;
- }
- fTok->current = lBlock;
- return lBlock;
-} // lNewBlock
-
-/*
- * lAddByte()
- *
- */
-
-static void lAddByte(TokenStream *fTok, unsigned char fVal)
-{
- TokenBlock *lBlock;
- lBlock = fTok->current;
- if (lBlock->count >= lBlock->max)
- lBlock = lNewBlock(fTok, 0);
- lBlock->data[lBlock->count++] = fVal;
-} // lAddByte
-
-
-
-/*
- * lReadByte() - Get the next byte from a stream.
- *
- */
-
-static int lReadByte(TokenStream *pTok)
-{
- TokenBlock *lBlock;
- int lval = -1;
-
- lBlock = pTok->current;
- if (lBlock) {
- if (lBlock->current >= lBlock->count) {
- lBlock = lBlock->next;
- if (lBlock)
- lBlock->current = 0;
- pTok->current = lBlock;
- }
- if (lBlock)
- lval = lBlock->data[lBlock->current++];
- }
- return lval;
-} // lReadByte
-
-/////////////////////////////////////// Global Functions://////////////////////////////////////
-
-/*
- * NewTokenStream()
- *
- */
-
-TokenStream *NewTokenStream(const char *name, MemoryPool *pool)
-{
- TokenStream *pTok;
-
- if (!pool)
- pTok = (TokenStream *) malloc(sizeof(TokenStream));
- else
- pTok = (TokenStream*)mem_Alloc(pool, sizeof(TokenStream));
- pTok->next = NULL;
- pTok->name = idstr(name, pool);
- pTok->head = NULL;
- pTok->current = NULL;
- lNewBlock(pTok, pool);
- return pTok;
-} // NewTokenStream
-
-/*
- * DeleteTokenStream()
- *
- */
-
-void DeleteTokenStream(TokenStream *pTok)
-{
- TokenBlock *pBlock, *nBlock;
-
- if (pTok) {
- pBlock = pTok->head;
- while (pBlock) {
- nBlock = pBlock->next;
- free(pBlock);
- pBlock = nBlock;
- }
- if (pTok->name)
- free(pTok->name);
- free(pTok);
- }
-} // DeleteTokenStream
-
-/*
- * RecordToken() - Add a token to the end of a list for later playback or printout.
- *
- */
-
-void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp)
-{
- const char *s;
- char *str=NULL;
-
- if (token > 256)
- lAddByte(pTok, (unsigned char)((token & 0x7f) + 0x80));
- else
- lAddByte(pTok, (unsigned char)(token & 0x7f));
- switch (token) {
- case CPP_IDENTIFIER:
- case CPP_TYPEIDENTIFIER:
- case CPP_STRCONSTANT:
- s = GetAtomString(atable, yylvalpp->sc_ident);
- while (*s)
- lAddByte(pTok, (unsigned char) *s++);
- lAddByte(pTok, 0);
- break;
- case CPP_FLOATCONSTANT:
- case CPP_INTCONSTANT:
- str=yylvalpp->symbol_name;
- while (*str){
- lAddByte(pTok, (unsigned char) *str++);
- }
- lAddByte(pTok, 0);
- break;
- case '(':
- lAddByte(pTok, (unsigned char)(yylvalpp->sc_int ? 1 : 0));
- default:
- break;
- }
-} // RecordToken
-
-/*
- * RewindTokenStream() - Reset a token stream in preperation for reading.
- *
- */
-
-void RewindTokenStream(TokenStream *pTok)
-{
- if (pTok->head) {
- pTok->current = pTok->head;
- pTok->current->current = 0;
- }
-} // RewindTokenStream
-
-/*
- * ReadToken() - Read the next token from a stream.
- *
- */
-
-int ReadToken(TokenStream *pTok, yystypepp * yylvalpp)
-{
- char symbol_name[MAX_SYMBOL_NAME_LEN + 1];
- char string_val[MAX_STRING_LEN + 1];
- int ltoken, len;
- char ch;
- int base, accum;
- char ch_val;
-
- ltoken = lReadByte(pTok);
- if (ltoken >= 0) {
- if (ltoken > 127)
- ltoken += 128;
- switch (ltoken) {
- case CPP_IDENTIFIER:
- case CPP_TYPEIDENTIFIER:
- len = 0;
- ch = lReadByte(pTok);
- while ((ch >= 'a' && ch <= 'z') ||
- (ch >= 'A' && ch <= 'Z') ||
- (ch >= '0' && ch <= '9') ||
- ch == '_')
- {
- if (len < MAX_SYMBOL_NAME_LEN) {
- symbol_name[len++] = ch;
- ch = lReadByte(pTok);
- }
- }
- symbol_name[len] = '\0';
- assert(ch == '\0');
- yylvalpp->sc_ident = LookUpAddString(atable, symbol_name);
- return CPP_IDENTIFIER;
- break;
- case CPP_STRCONSTANT:
- len = 0;
- while ((ch = lReadByte(pTok)) != 0)
- if (len < MAX_STRING_LEN)
- string_val[len++] = ch;
- string_val[len] = '\0';
- yylvalpp->sc_ident = LookUpAddString(atable, string_val);
- break;
- case CPP_FLOATCONSTANT:
- len = 0;
- ch = lReadByte(pTok);
- while ((ch >= '0' && ch <= '9')||(ch=='e'||ch=='E'||ch=='.')||(ch=='+'||ch=='-'))
- {
- if (len < MAX_SYMBOL_NAME_LEN) {
- symbol_name[len++] = ch;
- ch = lReadByte(pTok);
- }
- }
- symbol_name[len] = '\0';
- assert(ch == '\0');
- strcpy(yylvalpp->symbol_name,symbol_name);
- yylvalpp->sc_fval=(float)atof_dot(yylvalpp->symbol_name);
- break;
- case CPP_INTCONSTANT:
- len = 0;
- accum = 0;
- ch = lReadByte(pTok);
- if (ch == '0') {
- symbol_name[len++] = ch;
- ch = lReadByte(pTok);
- if (ch == 'x' || ch == 'X') {
- symbol_name[len++] = ch;
- base = 16;
- ch = lReadByte(pTok);
- } else {
- base = 8;
- }
- } else {
- base = 10;
- }
-
- while (len < MAX_SYMBOL_NAME_LEN)
- {
- ch_val = -1;
- if (isdigit(ch))
- ch_val = ch - '0';
- else if (isxdigit(ch))
- ch_val = tolower(ch) - 'a' + 10;
-
- if (ch_val < 0 || ch_val >= base)
- break;
-
- symbol_name[len++] = ch;
- accum = accum * base + ch_val;
- ch = lReadByte(pTok);
- }
- symbol_name[len] = '\0';
- assert(ch == '\0');
- strcpy(yylvalpp->symbol_name, symbol_name);
- yylvalpp->sc_int = accum;
- break;
- case '(':
- yylvalpp->sc_int = lReadByte(pTok);
- break;
- }
- return ltoken;
- }
- return EOF_SY;
-} // ReadToken
-
-typedef struct TokenInputSrc {
- InputSrc base;
- TokenStream *tokens;
- int (*final)(CPPStruct *);
-} TokenInputSrc;
-
-static int scan_token(TokenInputSrc *in, yystypepp * yylvalpp)
-{
- int token = ReadToken(in->tokens, yylvalpp);
- int (*final)(CPPStruct *);
- cpp->tokenLoc->file = cpp->currentInput->name;
- cpp->tokenLoc->line = cpp->currentInput->line;
- if (token == '\n') {
- in->base.line++;
- return token;
- }
- if (token > 0) return token;
- cpp->currentInput = in->base.prev;
- final = in->final;
- free(in);
- if (final && !final(cpp)) return -1;
- return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-}
-
-int ReadFromTokenStream(TokenStream *ts, int name, int (*final)(CPPStruct *))
-{
- TokenInputSrc *in = malloc(sizeof(TokenInputSrc));
- memset(in, 0, sizeof(TokenInputSrc));
- in->base.name = name;
- in->base.prev = cpp->currentInput;
- in->base.scan = (int (*)(InputSrc *, yystypepp *))scan_token;
- in->base.line = 1;
- in->tokens = ts;
- in->final = final;
- RewindTokenStream(ts);
- cpp->currentInput = &in->base;
- return 1;
-}
-
-typedef struct UngotToken {
- InputSrc base;
- int token;
- yystypepp lval;
-} UngotToken;
-
-static int reget_token(UngotToken *t, yystypepp * yylvalpp)
-{
- int token = t->token;
- *yylvalpp = t->lval;
- cpp->currentInput = t->base.prev;
- free(t);
- return token;
-}
-
-void UngetToken(int token, yystypepp * yylvalpp) {
- UngotToken *t = malloc(sizeof(UngotToken));
- memset(t, 0, sizeof(UngotToken));
- t->token = token;
- t->lval = *yylvalpp;
- t->base.scan = (void *)reget_token;
- t->base.prev = cpp->currentInput;
- t->base.name = cpp->currentInput->name;
- t->base.line = cpp->currentInput->line;
- cpp->currentInput = &t->base;
-}
-
-
-void DumpTokenStream(FILE *fp, TokenStream *s, yystypepp * yylvalpp) {
- int token;
- char str[100];
-
- if (fp == 0) fp = stdout;
- RewindTokenStream(s);
- while ((token = ReadToken(s, yylvalpp)) > 0) {
- switch (token) {
- case CPP_IDENTIFIER:
- case CPP_TYPEIDENTIFIER:
- snprintf(str, sizeof(str), "%s ", GetAtomString(atable, yylvalpp->sc_ident));
- break;
- case CPP_STRCONSTANT:
- snprintf(str, sizeof(str), "\"%s\"", GetAtomString(atable, yylvalpp->sc_ident));
- break;
- case CPP_FLOATCONSTANT:
- //printf("%g9.6 ", yylvalpp->sc_fval);
- break;
- case CPP_INTCONSTANT:
- //printf("%d ", yylvalpp->sc_int);
- break;
- default:
- if (token >= 127)
- snprintf(str, sizeof(str), "%s ", GetAtomString(atable, token));
- else
- snprintf(str, sizeof(str), "%c", token);
- break;
- }
- CPPDebugLogMsg(str);
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////// End of tokens.c ///////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/tokens.h b/src/3rdparty/angle/src/compiler/preprocessor/tokens.h
deleted file mode 100644
index dbf4a2ccfe..0000000000
--- a/src/3rdparty/angle/src/compiler/preprocessor/tokens.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************\
-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.
-\****************************************************************************/
-//
-// tokens.h
-//
-
-#if !defined(__TOKENS_H)
-#define __TOKENS_H 1
-
-#include <stdio.h>
-#include "compiler/preprocessor/parser.h"
-
-#define EOF_SY (-1)
-
-typedef struct TokenBlock_Rec TokenBlock;
-
-typedef struct TokenStream_Rec {
- struct TokenStream_Rec *next;
- char *name;
- TokenBlock *head;
- TokenBlock *current;
-} TokenStream;
-
-struct TokenBlock_Rec {
- TokenBlock *next;
- int current;
- int count;
- int max;
- unsigned char *data;
-};
-
-extern TokenStream stdlib_cpp_stream;
-
-
-TokenStream *NewTokenStream(const char *name, MemoryPool *pool);
-void DeleteTokenStream(TokenStream *pTok);
-void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp);
-void RewindTokenStream(TokenStream *pTok);
-int ReadToken(TokenStream *pTok, yystypepp * yylvalpp);
-int ReadFromTokenStream(TokenStream *pTok, int name, int (*final)(CPPStruct *));
-void UngetToken(int, yystypepp * yylvalpp);
-
-#if defined(CPPC_ENABLE_TOOLS)
-
-void DumpTokenStream(FILE *, TokenStream *, yystypepp * yylvalpp);
-
-#endif // defined(CPPC_ENABLE_TOOLS)
-
-#endif // !defined(__TOKENS_H)
diff --git a/src/3rdparty/angle/src/libEGL/Config.cpp b/src/3rdparty/angle/src/libEGL/Config.cpp
index 89bc8d89f4..5488cb6f4f 100644
--- a/src/3rdparty/angle/src/libEGL/Config.cpp
+++ b/src/3rdparty/angle/src/libEGL/Config.cpp
@@ -13,76 +13,30 @@
#include <algorithm>
#include <vector>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
#include "common/debug.h"
using namespace std;
namespace egl
{
-Config::Config(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight)
- : mDisplayMode(displayMode), mRenderTargetFormat(renderTargetFormat), mDepthStencilFormat(depthStencilFormat), mMultiSample(multiSample)
-{
- set(displayMode, minInterval, maxInterval, renderTargetFormat, depthStencilFormat, multiSample, texWidth, texHeight);
-}
-
-void Config::setDefaults()
-{
- mBufferSize = 0;
- mRedSize = 0;
- mGreenSize = 0;
- mBlueSize = 0;
- mLuminanceSize = 0;
- mAlphaSize = 0;
- mAlphaMaskSize = 0;
- mBindToTextureRGB = EGL_DONT_CARE;
- mBindToTextureRGBA = EGL_DONT_CARE;
- mColorBufferType = EGL_RGB_BUFFER;
- mConfigCaveat = EGL_DONT_CARE;
- mConfigID = EGL_DONT_CARE;
- mConformant = 0;
- mDepthSize = 0;
- mLevel = 0;
- mMatchNativePixmap = EGL_NONE;
- mMaxPBufferWidth = 0;
- mMaxPBufferHeight = 0;
- mMaxPBufferPixels = 0;
- mMaxSwapInterval = EGL_DONT_CARE;
- mMinSwapInterval = EGL_DONT_CARE;
- mNativeRenderable = EGL_DONT_CARE;
- mNativeVisualID = 0;
- mNativeVisualType = EGL_DONT_CARE;
- mRenderableType = EGL_OPENGL_ES_BIT;
- mSampleBuffers = 0;
- mSamples = 0;
- mStencilSize = 0;
- mSurfaceType = EGL_WINDOW_BIT;
- mTransparentType = EGL_NONE;
- mTransparentRedValue = EGL_DONT_CARE;
- mTransparentGreenValue = EGL_DONT_CARE;
- mTransparentBlueValue = EGL_DONT_CARE;
-}
-
-void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight)
+Config::Config(rx::ConfigDesc desc, EGLint minInterval, EGLint maxInterval, EGLint texWidth, EGLint texHeight)
+ : mRenderTargetFormat(desc.renderTargetFormat), mDepthStencilFormat(desc.depthStencilFormat), mMultiSample(desc.multiSample)
{
mBindToTextureRGB = EGL_FALSE;
mBindToTextureRGBA = EGL_FALSE;
- switch (renderTargetFormat)
+ switch (desc.renderTargetFormat)
{
- case D3DFMT_A1R5G5B5:
+ case GL_RGB5_A1:
mBufferSize = 16;
mRedSize = 5;
mGreenSize = 5;
mBlueSize = 5;
mAlphaSize = 1;
break;
- case D3DFMT_A2R10G10B10:
- mBufferSize = 32;
- mRedSize = 10;
- mGreenSize = 10;
- mBlueSize = 10;
- mAlphaSize = 2;
- break;
- case D3DFMT_A8R8G8B8:
+ case GL_RGBA8_OES:
mBufferSize = 32;
mRedSize = 8;
mGreenSize = 8;
@@ -90,14 +44,14 @@ void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInter
mAlphaSize = 8;
mBindToTextureRGBA = true;
break;
- case D3DFMT_R5G6B5:
+ case GL_RGB565:
mBufferSize = 16;
mRedSize = 5;
mGreenSize = 6;
mBlueSize = 5;
mAlphaSize = 0;
break;
- case D3DFMT_X8R8G8B8:
+ case GL_RGB8_OES:
mBufferSize = 32;
mRedSize = 8;
mGreenSize = 8;
@@ -105,6 +59,14 @@ void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInter
mAlphaSize = 0;
mBindToTextureRGB = true;
break;
+ case GL_BGRA8_EXT:
+ mBufferSize = 32;
+ mRedSize = 8;
+ mGreenSize = 8;
+ mBlueSize = 8;
+ mAlphaSize = 8;
+ mBindToTextureRGBA = true;
+ break;
default:
UNREACHABLE(); // Other formats should not be valid
}
@@ -112,52 +74,32 @@ void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInter
mLuminanceSize = 0;
mAlphaMaskSize = 0;
mColorBufferType = EGL_RGB_BUFFER;
- mConfigCaveat = (displayMode.Format == renderTargetFormat) ? EGL_NONE : EGL_SLOW_CONFIG;
+ mConfigCaveat = (desc.fastConfig) ? EGL_NONE : EGL_SLOW_CONFIG;
mConfigID = 0;
mConformant = EGL_OPENGL_ES2_BIT;
- switch (depthStencilFormat)
+ switch (desc.depthStencilFormat)
{
- case D3DFMT_UNKNOWN:
+ case GL_NONE:
mDepthSize = 0;
mStencilSize = 0;
break;
-// case D3DFMT_D16_LOCKABLE:
-// mDepthSize = 16;
-// mStencilSize = 0;
-// break;
- case D3DFMT_D32:
+ case GL_DEPTH_COMPONENT32_OES:
mDepthSize = 32;
mStencilSize = 0;
break;
- case D3DFMT_D15S1:
- mDepthSize = 15;
- mStencilSize = 1;
- break;
- case D3DFMT_D24S8:
+ case GL_DEPTH24_STENCIL8_OES:
mDepthSize = 24;
mStencilSize = 8;
break;
- case D3DFMT_D24X8:
+ case GL_DEPTH_COMPONENT24_OES:
mDepthSize = 24;
mStencilSize = 0;
break;
- case D3DFMT_D24X4S4:
- mDepthSize = 24;
- mStencilSize = 4;
- break;
- case D3DFMT_D16:
+ case GL_DEPTH_COMPONENT16:
mDepthSize = 16;
mStencilSize = 0;
break;
-// case D3DFMT_D32F_LOCKABLE:
-// mDepthSize = 32;
-// mStencilSize = 0;
-// break;
-// case D3DFMT_D24FS8:
-// mDepthSize = 24;
-// mStencilSize = 8;
-// break;
default:
UNREACHABLE();
}
@@ -173,8 +115,8 @@ void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInter
mNativeVisualID = 0;
mNativeVisualType = 0;
mRenderableType = EGL_OPENGL_ES2_BIT;
- mSampleBuffers = multiSample ? 1 : 0;
- mSamples = multiSample;
+ mSampleBuffers = desc.multiSample ? 1 : 0;
+ mSamples = desc.multiSample;
mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
mTransparentType = EGL_NONE;
mTransparentRedValue = 0;
@@ -288,10 +230,9 @@ ConfigSet::ConfigSet()
{
}
-void ConfigSet::add(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight)
+void ConfigSet::add(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight)
{
- Config config(displayMode, minSwapInterval, maxSwapInterval, renderTargetFormat, depthStencilFormat, multiSample, texWidth, texHeight);
-
+ Config config(desc, minSwapInterval, maxSwapInterval, texWidth, texHeight);
mSet.insert(config);
}
diff --git a/src/3rdparty/angle/src/libEGL/Config.h b/src/3rdparty/angle/src/libEGL/Config.h
index 95626ed1ad..680337b700 100644
--- a/src/3rdparty/angle/src/libEGL/Config.h
+++ b/src/3rdparty/angle/src/libEGL/Config.h
@@ -13,10 +13,10 @@
#define EGLAPI
#include <EGL/egl.h>
-#include <d3d9.h>
#include <set>
+#include "libGLESv2/renderer/Renderer.h"
#include "common/angleutils.h"
namespace egl
@@ -26,16 +26,13 @@ class Display;
class Config
{
public:
- Config(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
+ Config(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight);
- void setDefaults();
- void set(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
EGLConfig getHandle() const;
- const D3DDISPLAYMODE mDisplayMode;
- const D3DFORMAT mRenderTargetFormat;
- const D3DFORMAT mDepthStencilFormat;
- const EGLint mMultiSample;
+ const GLenum mRenderTargetFormat;
+ const GLenum mDepthStencilFormat;
+ const GLint mMultiSample;
EGLint mBufferSize; // Depth of the color buffer
EGLint mRedSize; // Bits of Red in the color buffer
@@ -99,7 +96,7 @@ class ConfigSet
public:
ConfigSet();
- void add(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
+ void add(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight);
size_t size() const;
bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
const egl::Config *get(EGLConfig configHandle);
diff --git a/src/3rdparty/angle/src/libEGL/Display.cpp b/src/3rdparty/angle/src/libEGL/Display.cpp
index a2dee6d964..d5d0f0f831 100644
--- a/src/3rdparty/angle/src/libEGL/Display.cpp
+++ b/src/3rdparty/angle/src/libEGL/Display.cpp
@@ -16,20 +16,12 @@
#include "common/debug.h"
#include "libGLESv2/mathutil.h"
-#include "libGLESv2/utilities.h"
+#include "libGLESv2/main.h"
+#include "libGLESv2/Context.h"
+#include "libGLESv2/renderer/SwapChain.h"
#include "libEGL/main.h"
-
-// Can also be enabled by defining FORCE_REF_RAST in the project's predefined macros
-#define REF_RAST 0
-
-// The "Debug This Pixel..." feature in PIX often fails when using the
-// D3D9Ex interfaces. In order to get debug pixel to work on a Vista/Win 7
-// machine, define "ANGLE_ENABLE_D3D9EX=0" in your project file.
-#if !defined(ANGLE_ENABLE_D3D9EX)
-// Enables use of the IDirect3D9Ex interface, when available
-#define ANGLE_ENABLE_D3D9EX 1
-#endif // !defined(ANGLE_ENABLE_D3D9EX)
+#include "libEGL/Surface.h"
namespace egl
{
@@ -69,27 +61,10 @@ egl::Display *Display::getDisplay(EGLNativeDisplayType displayId)
Display::Display(EGLNativeDisplayType displayId, HDC deviceContext, bool software) : mDc(deviceContext)
{
- mD3d9Module = NULL;
-
- mD3d9 = NULL;
- mD3d9Ex = NULL;
- mDevice = NULL;
- mDeviceEx = NULL;
- mDeviceWindow = NULL;
-
- mAdapter = D3DADAPTER_DEFAULT;
-
- #if REF_RAST == 1 || defined(FORCE_REF_RAST)
- mDeviceType = D3DDEVTYPE_REF;
- #else
- mDeviceType = D3DDEVTYPE_HAL;
- #endif
-
- mMinSwapInterval = 1;
- mMaxSwapInterval = 1;
+
mSoftwareDevice = software;
mDisplayId = displayId;
- mDeviceLost = false;
+ mRenderer = NULL;
}
Display::~Display()
@@ -100,7 +75,7 @@ Display::~Display()
if (thisDisplay != displays.end())
{
- displays.erase(thisDisplay);
+ displays.erase(thisDisplay);
}
}
@@ -111,197 +86,48 @@ bool Display::initialize()
return true;
}
- if (mSoftwareDevice)
- {
- mD3d9Module = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
- }
- else
- {
- mD3d9Module = GetModuleHandle(TEXT("d3d9.dll"));
- }
- if (mD3d9Module == NULL)
+ mRenderer = glCreateRenderer(this, mDc, mSoftwareDevice);
+
+ if (!mRenderer)
{
terminate();
- return false;
- }
-
- typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex**);
- Direct3DCreate9ExFunc Direct3DCreate9ExPtr = reinterpret_cast<Direct3DCreate9ExFunc>(GetProcAddress(mD3d9Module, "Direct3DCreate9Ex"));
-
- // Use Direct3D9Ex if available. Among other things, this version is less
- // inclined to report a lost context, for example when the user switches
- // desktop. Direct3D9Ex is available in Windows Vista and later if suitable drivers are available.
- if (ANGLE_ENABLE_D3D9EX && Direct3DCreate9ExPtr && SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &mD3d9Ex)))
- {
- ASSERT(mD3d9Ex);
- mD3d9Ex->QueryInterface(IID_IDirect3D9, reinterpret_cast<void**>(&mD3d9));
- ASSERT(mD3d9);
- }
- else
- {
- mD3d9 = Direct3DCreate9(D3D_SDK_VERSION);
+ return error(EGL_NOT_INITIALIZED, false);
}
- if (mD3d9)
- {
- if (mDc != NULL)
- {
- // UNIMPLEMENTED(); // FIXME: Determine which adapter index the device context corresponds to
- }
-
- HRESULT result;
-
- // Give up on getting device caps after about one second.
- for (int i = 0; i < 10; ++i)
- {
- result = mD3d9->GetDeviceCaps(mAdapter, mDeviceType, &mDeviceCaps);
-
- if (SUCCEEDED(result))
- {
- break;
- }
- else if (result == D3DERR_NOTAVAILABLE)
- {
- Sleep(100); // Give the driver some time to initialize/recover
- }
- else if (FAILED(result)) // D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY, D3DERR_INVALIDDEVICE, or another error we can't recover from
- {
- terminate();
- return error(EGL_BAD_ALLOC, false);
- }
- }
-
- if (mDeviceCaps.PixelShaderVersion < D3DPS_VERSION(2, 0))
- {
- terminate();
- return error(EGL_NOT_INITIALIZED, false);
- }
-
- // When DirectX9 is running with an older DirectX8 driver, a StretchRect from a regular texture to a render target texture is not supported.
- // This is required by Texture2D::convertToRenderTarget.
- if ((mDeviceCaps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES) == 0)
- {
- terminate();
- return error(EGL_NOT_INITIALIZED, false);
- }
-
- mMinSwapInterval = 4;
- mMaxSwapInterval = 0;
-
- if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE) {mMinSwapInterval = std::min(mMinSwapInterval, 0); mMaxSwapInterval = std::max(mMaxSwapInterval, 0);}
- if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_ONE) {mMinSwapInterval = std::min(mMinSwapInterval, 1); mMaxSwapInterval = std::max(mMaxSwapInterval, 1);}
- if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_TWO) {mMinSwapInterval = std::min(mMinSwapInterval, 2); mMaxSwapInterval = std::max(mMaxSwapInterval, 2);}
- if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_THREE) {mMinSwapInterval = std::min(mMinSwapInterval, 3); mMaxSwapInterval = std::max(mMaxSwapInterval, 3);}
- if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_FOUR) {mMinSwapInterval = std::min(mMinSwapInterval, 4); mMaxSwapInterval = std::max(mMaxSwapInterval, 4);}
-
- mD3d9->GetAdapterIdentifier(mAdapter, 0, &mAdapterIdentifier);
+ EGLint minSwapInterval = mRenderer->getMinSwapInterval();
+ EGLint maxSwapInterval = mRenderer->getMaxSwapInterval();
+ EGLint maxTextureWidth = mRenderer->getMaxTextureWidth();
+ EGLint maxTextureHeight = mRenderer->getMaxTextureHeight();
- // ATI cards on XP have problems with non-power-of-two textures.
- mSupportsNonPower2Textures = !(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_POW2) &&
- !(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP_POW2) &&
- !(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) &&
- !(getComparableOSVersion() < versionWindowsVista && mAdapterIdentifier.VendorId == VENDOR_ID_AMD);
-
- const D3DFORMAT renderTargetFormats[] =
- {
- D3DFMT_A1R5G5B5,
- // D3DFMT_A2R10G10B10, // The color_ramp conformance test uses ReadPixels with UNSIGNED_BYTE causing it to think that rendering skipped a colour value.
- D3DFMT_A8R8G8B8,
- D3DFMT_R5G6B5,
- // D3DFMT_X1R5G5B5, // Has no compatible OpenGL ES renderbuffer format
- D3DFMT_X8R8G8B8
- };
-
- const D3DFORMAT depthStencilFormats[] =
- {
- D3DFMT_UNKNOWN,
- // D3DFMT_D16_LOCKABLE,
- D3DFMT_D32,
- // D3DFMT_D15S1,
- D3DFMT_D24S8,
- D3DFMT_D24X8,
- // D3DFMT_D24X4S4,
- D3DFMT_D16,
- // D3DFMT_D32F_LOCKABLE,
- // D3DFMT_D24FS8
- };
-
- D3DDISPLAYMODE currentDisplayMode;
- mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
- ConfigSet configSet;
-
- for (int formatIndex = 0; formatIndex < sizeof(renderTargetFormats) / sizeof(D3DFORMAT); formatIndex++)
- {
- D3DFORMAT renderTargetFormat = renderTargetFormats[formatIndex];
+ rx::ConfigDesc *descList;
+ int numConfigs = mRenderer->generateConfigs(&descList);
+ ConfigSet configSet;
- HRESULT result = mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, renderTargetFormat);
+ for (int i = 0; i < numConfigs; ++i)
+ configSet.add(descList[i], minSwapInterval, maxSwapInterval,
+ maxTextureWidth, maxTextureHeight);
- if (SUCCEEDED(result))
- {
- for (int depthStencilIndex = 0; depthStencilIndex < sizeof(depthStencilFormats) / sizeof(D3DFORMAT); depthStencilIndex++)
- {
- D3DFORMAT depthStencilFormat = depthStencilFormats[depthStencilIndex];
- HRESULT result = D3D_OK;
-
- if(depthStencilFormat != D3DFMT_UNKNOWN)
- {
- result = mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, depthStencilFormat);
- }
-
- if (SUCCEEDED(result))
- {
- if(depthStencilFormat != D3DFMT_UNKNOWN)
- {
- result = mD3d9->CheckDepthStencilMatch(mAdapter, mDeviceType, currentDisplayMode.Format, renderTargetFormat, depthStencilFormat);
- }
-
- if (SUCCEEDED(result))
- {
- // FIXME: enumerate multi-sampling
-
- configSet.add(currentDisplayMode, mMinSwapInterval, mMaxSwapInterval, renderTargetFormat, depthStencilFormat, 0,
- mDeviceCaps.MaxTextureWidth, mDeviceCaps.MaxTextureHeight);
- }
- }
- }
- }
- }
-
- // Give the sorted configs a unique ID and store them internally
- EGLint index = 1;
- for (ConfigSet::Iterator config = configSet.mSet.begin(); config != configSet.mSet.end(); config++)
- {
- Config configuration = *config;
- configuration.mConfigID = index;
- index++;
-
- mConfigSet.mSet.insert(configuration);
- }
- }
-
- if (!isInitialized())
+ // Give the sorted configs a unique ID and store them internally
+ EGLint index = 1;
+ for (ConfigSet::Iterator config = configSet.mSet.begin(); config != configSet.mSet.end(); config++)
{
- terminate();
+ Config configuration = *config;
+ configuration.mConfigID = index;
+ index++;
- return false;
+ mConfigSet.mSet.insert(configuration);
}
- initExtensionString();
-
- static const TCHAR windowName[] = TEXT("AngleHiddenWindow");
- static const TCHAR className[] = TEXT("STATIC");
-
- mDeviceWindow = CreateWindowEx(WS_EX_NOACTIVATE, className, windowName, WS_DISABLED | WS_POPUP, 0, 0, 1, 1, HWND_MESSAGE, NULL, GetModuleHandle(NULL), NULL);
+ mRenderer->deleteConfigs(descList);
+ descList = NULL;
- if (!createDevice())
+ if (!isInitialized())
{
terminate();
return false;
}
- mVertexShaderCache.initialize(mDevice);
- mPixelShaderCache.initialize(mDevice);
+ initExtensionString();
return true;
}
@@ -318,79 +144,8 @@ void Display::terminate()
destroyContext(*mContextSet.begin());
}
- while (!mEventQueryPool.empty())
- {
- mEventQueryPool.back()->Release();
- mEventQueryPool.pop_back();
- }
-
- mVertexShaderCache.clear();
- mPixelShaderCache.clear();
-
- if (mDevice)
- {
- // If the device is lost, reset it first to prevent leaving the driver in an unstable state
- if (testDeviceLost())
- {
- resetDevice();
- }
-
- mDevice->Release();
- mDevice = NULL;
- }
-
- if (mDeviceEx)
- {
- mDeviceEx->Release();
- mDeviceEx = NULL;
- }
-
- if (mD3d9)
- {
- mD3d9->Release();
- mD3d9 = NULL;
- }
-
- if (mDeviceWindow)
- {
- DestroyWindow(mDeviceWindow);
- mDeviceWindow = NULL;
- }
-
- if (mD3d9Ex)
- {
- mD3d9Ex->Release();
- mD3d9Ex = NULL;
- }
-
- if (mD3d9Module)
- {
- mD3d9Module = NULL;
- }
-}
-
-void Display::startScene()
-{
- if (!mSceneStarted)
- {
- long result = mDevice->BeginScene();
- if (SUCCEEDED(result)) {
- // This is defensive checking against the device being
- // lost at unexpected times.
- mSceneStarted = true;
- }
- }
-}
-
-void Display::endScene()
-{
- if (mSceneStarted)
- {
- // EndScene can fail if the device was lost, for example due
- // to a TDR during a draw call.
- mDevice->EndScene();
- mSceneStarted = false;
- }
+ glDestroyRenderer(mRenderer);
+ mRenderer = NULL;
}
bool Display::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig)
@@ -443,107 +198,7 @@ bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
return true;
}
-bool Display::createDevice()
-{
- D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
- DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES;
-
- HRESULT result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, &presentParameters, &mDevice);
-
- if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DEVICELOST)
- {
- return error(EGL_BAD_ALLOC, false);
- }
-
- if (FAILED(result))
- {
- result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentParameters, &mDevice);
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_NOTAVAILABLE || result == D3DERR_DEVICELOST);
- return error(EGL_BAD_ALLOC, false);
- }
- }
-
- if (mD3d9Ex)
- {
- result = mDevice->QueryInterface(IID_IDirect3DDevice9Ex, (void**) &mDeviceEx);
- ASSERT(SUCCEEDED(result));
- }
-
- initializeDevice();
-
- return true;
-}
-
-// do any one-time device initialization
-// NOTE: this is also needed after a device lost/reset
-// to reset the scene status and ensure the default states are reset.
-void Display::initializeDevice()
-{
- // Permanent non-default states
- mDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE);
- mDevice->SetRenderState(D3DRS_LASTPIXEL, FALSE);
-
- if (mDeviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0))
- {
- mDevice->SetRenderState(D3DRS_POINTSIZE_MAX, (DWORD&)mDeviceCaps.MaxPointSize);
- }
- else
- {
- mDevice->SetRenderState(D3DRS_POINTSIZE_MAX, 0x3F800000); // 1.0f
- }
-
- mSceneStarted = false;
-}
-
-bool Display::resetDevice()
-{
- D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
-
- HRESULT result = D3D_OK;
- bool lost = testDeviceLost();
- int attempts = 3;
-
- while (lost && attempts > 0)
- {
- if (mDeviceEx)
- {
- Sleep(500); // Give the graphics driver some CPU time
- result = mDeviceEx->ResetEx(&presentParameters, NULL);
- }
- else
- {
- result = mDevice->TestCooperativeLevel();
-
- while (result == D3DERR_DEVICELOST)
- {
- Sleep(100); // Give the graphics driver some CPU time
- result = mDevice->TestCooperativeLevel();
- }
-
- if (result == D3DERR_DEVICENOTRESET)
- {
- result = mDevice->Reset(&presentParameters);
- }
- }
-
- lost = testDeviceLost();
- attempts --;
- }
-
- if (FAILED(result))
- {
- ERR("Reset/ResetEx failed multiple times: 0x%08X", result);
- return error(EGL_BAD_ALLOC, false);
- }
-
- // reset device defaults
- initializeDevice();
- return true;
-}
EGLSurface Display::createWindowSurface(HWND window, EGLConfig config, const EGLint *attribList)
{
@@ -587,7 +242,7 @@ EGLSurface Display::createWindowSurface(HWND window, EGLConfig config, const EGL
return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
- if (testDeviceLost())
+ if (mRenderer->testDeviceLost(false))
{
if (!restoreLostDevice())
return EGL_NO_SURFACE;
@@ -678,7 +333,7 @@ EGLSurface Display::createOffscreenSurface(EGLConfig config, HANDLE shareHandle,
return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
}
- if (textureFormat != EGL_NO_TEXTURE && !getNonPower2TextureSupport() && (!gl::isPow2(width) || !gl::isPow2(height)))
+ if (textureFormat != EGL_NO_TEXTURE && !mRenderer->getNonPower2TextureSupport() && (!gl::isPow2(width) || !gl::isPow2(height)))
{
return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
}
@@ -700,7 +355,7 @@ EGLSurface Display::createOffscreenSurface(EGLConfig config, HANDLE shareHandle,
return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
}
- if (testDeviceLost())
+ if (mRenderer->testDeviceLost(false))
{
if (!restoreLostDevice())
return EGL_NO_SURFACE;
@@ -721,24 +376,18 @@ EGLSurface Display::createOffscreenSurface(EGLConfig config, HANDLE shareHandle,
EGLContext Display::createContext(EGLConfig configHandle, const gl::Context *shareContext, bool notifyResets, bool robustAccess)
{
- if (!mDevice)
+ if (!mRenderer)
{
- if (!createDevice())
- {
- return NULL;
- }
+ return NULL;
}
- else if (testDeviceLost()) // Lost device
+ else if (mRenderer->testDeviceLost(false)) // Lost device
{
if (!restoreLostDevice())
return NULL;
}
- const egl::Config *config = mConfigSet.get(configHandle);
-
- gl::Context *context = glCreateContext(config, shareContext, notifyResets, robustAccess);
+ gl::Context *context = glCreateContext(shareContext, mRenderer, notifyResets, robustAccess);
mContextSet.insert(context);
- mDeviceLost = false;
return context;
}
@@ -757,18 +406,9 @@ bool Display::restoreLostDevice()
(*surface)->release();
}
- while (!mEventQueryPool.empty())
- {
- mEventQueryPool.back()->Release();
- mEventQueryPool.pop_back();
- }
-
- mVertexShaderCache.clear();
- mPixelShaderCache.clear();
-
- if (!resetDevice())
+ if (!mRenderer->resetDevice())
{
- return false;
+ return error(EGL_BAD_ALLOC, false);
}
// Restore any surfaces that may have been lost
@@ -799,18 +439,20 @@ void Display::notifyDeviceLost()
{
(*context)->markContextLost();
}
- mDeviceLost = true;
- error(EGL_CONTEXT_LOST);
+ egl::error(EGL_CONTEXT_LOST);
}
-bool Display::isDeviceLost()
+void Display::recreateSwapChains()
{
- return mDeviceLost;
+ for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
+ {
+ (*surface)->getSwapChain()->recreate();
+ }
}
bool Display::isInitialized() const
{
- return mD3d9 != NULL && mConfigSet.size() > 0;
+ return mRenderer != NULL && mConfigSet.size() > 0;
}
bool Display::isValidConfig(EGLConfig config)
@@ -841,352 +483,10 @@ bool Display::hasExistingWindowSurface(HWND window)
return false;
}
-EGLint Display::getMinSwapInterval()
-{
- return mMinSwapInterval;
-}
-
-EGLint Display::getMaxSwapInterval()
-{
- return mMaxSwapInterval;
-}
-
-IDirect3DDevice9 *Display::getDevice()
-{
- if (!mDevice)
- {
- if (!createDevice())
- {
- return NULL;
- }
- }
-
- return mDevice;
-}
-
-D3DCAPS9 Display::getDeviceCaps()
-{
- return mDeviceCaps;
-}
-
-D3DADAPTER_IDENTIFIER9 *Display::getAdapterIdentifier()
-{
- return &mAdapterIdentifier;
-}
-
-bool Display::testDeviceLost()
-{
- if (mDeviceEx)
- {
- return FAILED(mDeviceEx->CheckDeviceState(NULL));
- }
- else if (mDevice)
- {
- return FAILED(mDevice->TestCooperativeLevel());
- }
-
- return false; // No device yet, so no reset required
-}
-
-bool Display::testDeviceResettable()
-{
- HRESULT status = D3D_OK;
-
- if (mDeviceEx)
- {
- status = mDeviceEx->CheckDeviceState(NULL);
- }
- else if (mDevice)
- {
- status = mDevice->TestCooperativeLevel();
- }
-
- switch (status)
- {
- case D3DERR_DEVICENOTRESET:
- case D3DERR_DEVICEHUNG:
- return true;
- default:
- return false;
- }
-}
-
-void Display::sync(bool block)
-{
- HRESULT result;
-
- IDirect3DQuery9* query = allocateEventQuery();
- if (!query)
- {
- return;
- }
-
- result = query->Issue(D3DISSUE_END);
- ASSERT(SUCCEEDED(result));
-
- do
- {
- result = query->GetData(NULL, 0, D3DGETDATA_FLUSH);
-
- if(block && result == S_FALSE)
- {
- // Keep polling, but allow other threads to do something useful first
- Sleep(0);
- // explicitly check for device loss
- // some drivers seem to return S_FALSE even if the device is lost
- // instead of D3DERR_DEVICELOST like they should
- if (testDeviceLost())
- {
- result = D3DERR_DEVICELOST;
- }
- }
- }
- while(block && result == S_FALSE);
-
- freeEventQuery(query);
-
- if (isDeviceLostError(result))
- {
- notifyDeviceLost();
- }
-}
-
-IDirect3DQuery9* Display::allocateEventQuery()
-{
- IDirect3DQuery9 *query = NULL;
-
- if (mEventQueryPool.empty())
- {
- HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &query);
- ASSERT(SUCCEEDED(result));
- }
- else
- {
- query = mEventQueryPool.back();
- mEventQueryPool.pop_back();
- }
-
- return query;
-}
-
-void Display::freeEventQuery(IDirect3DQuery9* query)
-{
- if (mEventQueryPool.size() > 1000)
- {
- query->Release();
- }
- else
- {
- mEventQueryPool.push_back(query);
- }
-}
-
-void Display::getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray)
-{
- for (int multiSampleIndex = 0; multiSampleIndex <= D3DMULTISAMPLE_16_SAMPLES; multiSampleIndex++)
- {
- HRESULT result = mD3d9->CheckDeviceMultiSampleType(mAdapter, mDeviceType, format,
- TRUE, (D3DMULTISAMPLE_TYPE)multiSampleIndex, NULL);
-
- multiSampleArray[multiSampleIndex] = SUCCEEDED(result);
- }
-}
-
-bool Display::getDXT1TextureSupport()
-{
- D3DDISPLAYMODE currentDisplayMode;
- mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
- return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT1));
-}
-
-bool Display::getDXT3TextureSupport()
-{
- D3DDISPLAYMODE currentDisplayMode;
- mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
- return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT3));
-}
-
-bool Display::getDXT5TextureSupport()
-{
- D3DDISPLAYMODE currentDisplayMode;
- mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
- return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT5));
-}
-
-// we use INTZ for depth textures in Direct3D9
-// we also want NULL texture support to ensure the we can make depth-only FBOs
-// see http://aras-p.info/texts/D3D9GPUHacks.html
-bool Display::getDepthTextureSupport() const
-{
- D3DDISPLAYMODE currentDisplayMode;
- mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
- bool intz = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format,
- D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_INTZ));
- bool null = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format,
- D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, D3DFMT_NULL));
-
- return intz && null;
-}
-
-bool Display::getFloat32TextureSupport(bool *filtering, bool *renderable)
-{
- D3DDISPLAYMODE currentDisplayMode;
- mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
- *filtering = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
- D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F)) &&
- SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
- D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
-
- *renderable = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
- D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F))&&
- SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
- D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
-
- if (!*filtering && !*renderable)
- {
- return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
- D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F)) &&
- SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
- D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
- }
- else
- {
- return true;
- }
-}
-
-bool Display::getFloat16TextureSupport(bool *filtering, bool *renderable)
-{
- D3DDISPLAYMODE currentDisplayMode;
- mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
- *filtering = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
- D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)) &&
- SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
- D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
-
- *renderable = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
- D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)) &&
- SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
- D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
-
- if (!*filtering && !*renderable)
- {
- return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
- D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)) &&
- SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
- D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
- }
- else
- {
- return true;
- }
-}
-
-bool Display::getLuminanceTextureSupport()
-{
- D3DDISPLAYMODE currentDisplayMode;
- mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
- return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_L8));
-}
-
-bool Display::getLuminanceAlphaTextureSupport()
-{
- D3DDISPLAYMODE currentDisplayMode;
- mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
- return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_A8L8));
-}
-
-float Display::getTextureFilterAnisotropySupport() const
-{
- // Must support a minimum of 2:1 anisotropy for max anisotropy to be considered supported, per the spec
- if ((mDeviceCaps.RasterCaps & D3DPRASTERCAPS_ANISOTROPY) && (mDeviceCaps.MaxAnisotropy >= 2))
- {
- return mDeviceCaps.MaxAnisotropy;
- }
- return 1.0f;
-}
-
-D3DPOOL Display::getBufferPool(DWORD usage) const
-{
- if (mD3d9Ex != NULL)
- {
- return D3DPOOL_DEFAULT;
- }
- else
- {
- if (!(usage & D3DUSAGE_DYNAMIC))
- {
- return D3DPOOL_MANAGED;
- }
- }
-
- return D3DPOOL_DEFAULT;
-}
-
-D3DPOOL Display::getTexturePool(DWORD usage) const
-{
- if (mD3d9Ex != NULL)
- {
- return D3DPOOL_DEFAULT;
- }
- else
- {
- if (!(usage & (D3DUSAGE_DEPTHSTENCIL | D3DUSAGE_RENDERTARGET)))
- {
- return D3DPOOL_MANAGED;
- }
- }
-
- return D3DPOOL_DEFAULT;
-}
-
-bool Display::getEventQuerySupport()
-{
- IDirect3DQuery9 *query = allocateEventQuery();
- if (query)
- {
- freeEventQuery(query);
- return true;
- }
- else
- {
- return false;
- }
-}
-
-D3DPRESENT_PARAMETERS Display::getDefaultPresentParameters()
-{
- D3DPRESENT_PARAMETERS presentParameters = {0};
-
- // The default swap chain is never actually used. Surface will create a new swap chain with the proper parameters.
- presentParameters.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
- presentParameters.BackBufferCount = 1;
- presentParameters.BackBufferFormat = D3DFMT_UNKNOWN;
- presentParameters.BackBufferWidth = 1;
- presentParameters.BackBufferHeight = 1;
- presentParameters.EnableAutoDepthStencil = FALSE;
- presentParameters.Flags = 0;
- presentParameters.hDeviceWindow = mDeviceWindow;
- presentParameters.MultiSampleQuality = 0;
- presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE;
- presentParameters.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
- presentParameters.Windowed = TRUE;
-
- return presentParameters;
-}
-
void Display::initExtensionString()
{
HMODULE swiftShader = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
+ bool shareHandleSupported = mRenderer->getShareHandleSupport();
mExtensionString = "";
@@ -1194,7 +494,7 @@ void Display::initExtensionString()
mExtensionString += "EGL_EXT_create_context_robustness ";
// ANGLE-specific extensions
- if (shareHandleSupported())
+ if (shareHandleSupported)
{
mExtensionString += "EGL_ANGLE_d3d_share_handle_client_buffer ";
}
@@ -1206,12 +506,15 @@ void Display::initExtensionString()
mExtensionString += "EGL_ANGLE_software_display ";
}
- if (shareHandleSupported())
+ if (shareHandleSupported)
{
mExtensionString += "EGL_ANGLE_surface_d3d_texture_2d_share_handle ";
}
- mExtensionString += "EGL_NV_post_sub_buffer";
+ if (mRenderer->getPostSubBufferSupport())
+ {
+ mExtensionString += "EGL_NV_post_sub_buffer";
+ }
std::string::size_type end = mExtensionString.find_last_not_of(' ');
if (end != std::string::npos)
@@ -1225,68 +528,5 @@ const char *Display::getExtensionString() const
return mExtensionString.c_str();
}
-bool Display::shareHandleSupported() const
-{
- // PIX doesn't seem to support using share handles, so disable them.
- return isD3d9ExDevice() && !gl::perfActive();
-}
-
-IDirect3DVertexShader9 *Display::createVertexShader(const DWORD *function, size_t length)
-{
- return mVertexShaderCache.create(function, length);
-}
-
-IDirect3DPixelShader9 *Display::createPixelShader(const DWORD *function, size_t length)
-{
- return mPixelShaderCache.create(function, length);
-}
-
-// Only Direct3D 10 ready devices support all the necessary vertex texture formats.
-// We test this using D3D9 by checking support for the R16F format.
-bool Display::getVertexTextureSupport() const
-{
- if (!isInitialized() || mDeviceCaps.PixelShaderVersion < D3DPS_VERSION(3, 0))
- {
- return false;
- }
-
- D3DDISPLAYMODE currentDisplayMode;
- mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
- HRESULT result = mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R16F);
-
- return SUCCEEDED(result);
-}
-
-bool Display::getNonPower2TextureSupport() const
-{
- return mSupportsNonPower2Textures;
-}
-
-bool Display::getOcclusionQuerySupport() const
-{
- if (!isInitialized())
- {
- return false;
- }
-
- IDirect3DQuery9 *query = NULL;
- HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, &query);
-
- if (SUCCEEDED(result) && query)
- {
- query->Release();
- return true;
- }
- else
- {
- return false;
- }
-}
-
-bool Display::getInstancingSupport() const
-{
- return mDeviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0);
-}
}
diff --git a/src/3rdparty/angle/src/libEGL/Display.h b/src/3rdparty/angle/src/libEGL/Display.h
index 23b57b74c6..8c71e51b7a 100644
--- a/src/3rdparty/angle/src/libEGL/Display.h
+++ b/src/3rdparty/angle/src/libEGL/Display.h
@@ -11,36 +11,22 @@
#ifndef LIBEGL_DISPLAY_H_
#define LIBEGL_DISPLAY_H_
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-#include <d3d9.h>
+#include "common/system.h"
#include <set>
#include <vector>
-#include "libGLESv2/Context.h"
-
#include "libEGL/Config.h"
-#include "libEGL/ShaderCache.h"
-#include "libEGL/Surface.h"
-
-const int versionWindowsVista = MAKEWORD(0x00, 0x06);
-const int versionWindows7 = MAKEWORD(0x01, 0x06);
-// Return the version of the operating system in a format suitable for ordering
-// comparison.
-inline int getComparableOSVersion()
+namespace gl
{
- DWORD version = GetVersion();
- int majorVersion = LOBYTE(LOWORD(version));
- int minorVersion = HIBYTE(LOWORD(version));
- return MAKEWORD(minorVersion, majorVersion);
+class Context;
}
namespace egl
{
+class Surface;
+
class Display
{
public:
@@ -49,9 +35,6 @@ class Display
bool initialize();
void terminate();
- virtual void startScene();
- virtual void endScene();
-
static egl::Display *getDisplay(EGLNativeDisplayType displayId);
bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
@@ -70,81 +53,25 @@ class Display
bool isValidSurface(egl::Surface *surface);
bool hasExistingWindowSurface(HWND window);
- EGLint getMinSwapInterval();
- EGLint getMaxSwapInterval();
-
- virtual IDirect3DDevice9 *getDevice();
- virtual D3DCAPS9 getDeviceCaps();
- virtual D3DADAPTER_IDENTIFIER9 *getAdapterIdentifier();
- virtual bool testDeviceLost();
- virtual bool testDeviceResettable();
- virtual void sync(bool block);
- virtual IDirect3DQuery9* allocateEventQuery();
- virtual void freeEventQuery(IDirect3DQuery9* query);
- virtual void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray);
- virtual bool getDXT1TextureSupport();
- virtual bool getDXT3TextureSupport();
- virtual bool getDXT5TextureSupport();
- virtual bool getEventQuerySupport();
- virtual bool getFloat32TextureSupport(bool *filtering, bool *renderable);
- virtual bool getFloat16TextureSupport(bool *filtering, bool *renderable);
- virtual bool getLuminanceTextureSupport();
- virtual bool getLuminanceAlphaTextureSupport();
- virtual bool getVertexTextureSupport() const;
- virtual bool getNonPower2TextureSupport() const;
- virtual bool getDepthTextureSupport() const;
- virtual bool getOcclusionQuerySupport() const;
- virtual bool getInstancingSupport() const;
- virtual float getTextureFilterAnisotropySupport() const;
- virtual D3DPOOL getBufferPool(DWORD usage) const;
- virtual D3DPOOL getTexturePool(DWORD usage) const;
+ rx::Renderer *getRenderer() { return mRenderer; };
+ // exported methods must be virtual
virtual void notifyDeviceLost();
- bool isDeviceLost();
+ virtual void recreateSwapChains();
- bool isD3d9ExDevice() const { return mD3d9Ex != NULL; }
const char *getExtensionString() const;
- bool shareHandleSupported() const;
-
- virtual IDirect3DVertexShader9 *createVertexShader(const DWORD *function, size_t length);
- virtual IDirect3DPixelShader9 *createPixelShader(const DWORD *function, size_t length);
private:
DISALLOW_COPY_AND_ASSIGN(Display);
Display(EGLNativeDisplayType displayId, HDC deviceContext, bool software);
- D3DPRESENT_PARAMETERS getDefaultPresentParameters();
-
bool restoreLostDevice();
EGLNativeDisplayType mDisplayId;
const HDC mDc;
- HMODULE mD3d9Module;
-
- UINT mAdapter;
- D3DDEVTYPE mDeviceType;
- IDirect3D9 *mD3d9; // Always valid after successful initialization.
- IDirect3D9Ex *mD3d9Ex; // Might be null if D3D9Ex is not supported.
- IDirect3DDevice9 *mDevice;
- IDirect3DDevice9Ex *mDeviceEx; // Might be null if D3D9Ex is not supported.
-
- // A pool of event queries that are currently unused.
- std::vector<IDirect3DQuery9*> mEventQueryPool;
-
- VertexShaderCache mVertexShaderCache;
- PixelShaderCache mPixelShaderCache;
-
- D3DCAPS9 mDeviceCaps;
- D3DADAPTER_IDENTIFIER9 mAdapterIdentifier;
- HWND mDeviceWindow;
-
- bool mSceneStarted;
- EGLint mMaxSwapInterval;
- EGLint mMinSwapInterval;
bool mSoftwareDevice;
- bool mSupportsNonPower2Textures;
typedef std::set<Surface*> SurfaceSet;
SurfaceSet mSurfaceSet;
@@ -153,11 +80,8 @@ class Display
typedef std::set<gl::Context*> ContextSet;
ContextSet mContextSet;
- bool mDeviceLost;
- bool createDevice();
- void initializeDevice();
- bool resetDevice();
+ rx::Renderer *mRenderer;
void initExtensionString();
std::string mExtensionString;
diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp
index d9e1887e85..a430a3530f 100644
--- a/src/3rdparty/angle/src/libEGL/Surface.cpp
+++ b/src/3rdparty/angle/src/libEGL/Surface.cpp
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// 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.
//
@@ -14,6 +14,8 @@
#include "common/debug.h"
#include "libGLESv2/Texture.h"
+#include "libGLESv2/renderer/SwapChain.h"
+#include "libGLESv2/main.h"
#include "libEGL/main.h"
#include "libEGL/Display.h"
@@ -23,14 +25,11 @@
namespace egl
{
-Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported)
+Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported)
: mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported)
{
+ mRenderer = mDisplay->getRenderer();
mSwapChain = NULL;
- mBackBuffer = NULL;
- mDepthStencil = NULL;
- mRenderTarget = NULL;
- mOffscreenTexture = NULL;
mShareHandle = NULL;
mTexture = NULL;
mTextureFormat = EGL_NO_TEXTURE;
@@ -40,6 +39,8 @@ Surface::Surface(Display *display, const Config *config, HWND window, EGLint pos
mRenderBuffer = EGL_BACK_BUFFER;
mSwapBehavior = EGL_BUFFER_PRESERVED;
mSwapInterval = -1;
+ mWidth = -1;
+ mHeight = -1;
setSwapInterval(1);
subclassWindow();
@@ -48,11 +49,8 @@ Surface::Surface(Display *display, const Config *config, HWND window, EGLint pos
Surface::Surface(Display *display, const Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureType)
: mDisplay(display), mWindow(NULL), mConfig(config), mShareHandle(shareHandle), mWidth(width), mHeight(height), mPostSubBufferSupported(EGL_FALSE)
{
+ mRenderer = mDisplay->getRenderer();
mSwapChain = NULL;
- mBackBuffer = NULL;
- mDepthStencil = NULL;
- mRenderTarget = NULL;
- mOffscreenTexture = NULL;
mWindowSubclassed = false;
mTexture = NULL;
mTextureFormat = textureFormat;
@@ -76,8 +74,6 @@ bool Surface::initialize()
typedef HRESULT (STDAPICALLTYPE *PtrDwmIsCompositionEnabled)(BOOL*);
typedef HRESULT (STDAPICALLTYPE *PtrDwmSetPresentParameters)(HWND, DWM_PRESENT_PARAMETERS *);
- ASSERT(!mSwapChain && !mOffscreenTexture && !mDepthStencil);
-
if (!resetSwapChain())
return false;
@@ -118,260 +114,113 @@ bool Surface::initialize()
void Surface::release()
{
- if (mSwapChain)
- {
- mSwapChain->Release();
- mSwapChain = NULL;
- }
-
- if (mBackBuffer)
- {
- mBackBuffer->Release();
- mBackBuffer = NULL;
- }
-
- if (mDepthStencil)
- {
- mDepthStencil->Release();
- mDepthStencil = NULL;
- }
-
- if (mRenderTarget)
- {
- mRenderTarget->Release();
- mRenderTarget = NULL;
- }
-
- if (mOffscreenTexture)
- {
- mOffscreenTexture->Release();
- mOffscreenTexture = NULL;
- }
+ delete mSwapChain;
+ mSwapChain = NULL;
if (mTexture)
{
mTexture->releaseTexImage();
mTexture = NULL;
}
-
- mShareHandle = NULL;
}
bool Surface::resetSwapChain()
{
- if (!mWindow)
- {
- return resetSwapChain(mWidth, mHeight);
- }
-
- RECT windowRect;
- if (!GetClientRect(getWindowHandle(), &windowRect))
- {
- ASSERT(false);
+ ASSERT(!mSwapChain);
- ERR("Could not retrieve the window dimensions");
- return false;
- }
-
- return resetSwapChain(windowRect.right - windowRect.left, windowRect.bottom - windowRect.top);
-}
+ int width;
+ int height;
-bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
-{
- IDirect3DDevice9 *device = mDisplay->getDevice();
-
- if (device == NULL)
+ if (mWindow)
{
- return false;
- }
-
- // Evict all non-render target textures to system memory and release all resources
- // before reallocating them to free up as much video memory as possible.
- device->EvictManagedResources();
+ RECT windowRect;
+ if (!GetClientRect(getWindowHandle(), &windowRect))
+ {
+ ASSERT(false);
- HRESULT result;
+ ERR("Could not retrieve the window dimensions");
+ return error(EGL_BAD_SURFACE, false);
+ }
- // 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;
+ width = windowRect.right - windowRect.left;
+ height = windowRect.bottom - windowRect.top;
}
-
- if (mBackBuffer)
+ else
{
- mBackBuffer->Release();
- mBackBuffer = NULL;
+ // non-window surface - size is determined at creation
+ width = mWidth;
+ height = mHeight;
}
- if (mOffscreenTexture)
+ mSwapChain = mRenderer->createSwapChain(mWindow, mShareHandle,
+ mConfig->mRenderTargetFormat,
+ mConfig->mDepthStencilFormat);
+ if (!mSwapChain)
{
- mOffscreenTexture->Release();
- mOffscreenTexture = NULL;
+ return error(EGL_BAD_ALLOC, false);
}
- if (mDepthStencil)
+ if (!resetSwapChain(width, height))
{
- mDepthStencil->Release();
- mDepthStencil = NULL;
+ delete mSwapChain;
+ mSwapChain = NULL;
+ return false;
}
- HANDLE *pShareHandle = NULL;
- if (!mWindow && mDisplay->shareHandleSupported())
- {
- pShareHandle = &mShareHandle;
- }
+ return true;
+}
- // CreateTexture will fail on zero dimensions, so just release old target
- if (!backbufferWidth || !backbufferHeight)
- {
- if (mRenderTarget)
- {
- mRenderTarget->Release();
- mRenderTarget = NULL;
- }
+bool Surface::resizeSwapChain(int backbufferWidth, int backbufferHeight)
+{
+ ASSERT(mSwapChain);
+ // Prevent bad swap chain resize by calling reset if size is invalid
+ if (backbufferWidth < 1 || backbufferHeight < 1)
+ {
mWidth = backbufferWidth;
mHeight = backbufferHeight;
- mPresentIntervalDirty = false;
-
- return true;
+ return mSwapChain->reset(0, 0, mSwapInterval) == EGL_SUCCESS;
}
- result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
- mConfig->mRenderTargetFormat, D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle);
- if (FAILED(result))
- {
- ERR("Could not create offscreen texture: %08lX", result);
- release();
+ EGLint status = mSwapChain->resize(backbufferWidth, backbufferHeight);
- if(isDeviceLostError(result))
- {
- mDisplay->notifyDeviceLost();
- return false;
- }
- else
- {
- return error(EGL_BAD_ALLOC, false);
- }
+ if (status == EGL_CONTEXT_LOST)
+ {
+ mDisplay->notifyDeviceLost();
+ return false;
}
-
- IDirect3DSurface9 *oldRenderTarget = mRenderTarget;
-
- result = mOffscreenTexture->GetSurfaceLevel(0, &mRenderTarget);
- ASSERT(SUCCEEDED(result));
-
- if (oldRenderTarget)
+ else if (status != EGL_SUCCESS)
{
- RECT rect =
- {
- 0, 0,
- mWidth, mHeight
- };
-
- if (rect.right > static_cast<LONG>(backbufferWidth))
- {
- rect.right = backbufferWidth;
- }
+ return error(status, false);
+ }
- if (rect.bottom > static_cast<LONG>(backbufferHeight))
- {
- rect.bottom = backbufferHeight;
- }
+ mWidth = backbufferWidth;
+ mHeight = backbufferHeight;
- mDisplay->endScene();
+ return true;
+}
- result = device->StretchRect(oldRenderTarget, &rect, mRenderTarget, &rect, D3DTEXF_NONE);
- ASSERT(SUCCEEDED(result));
+bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
+{
+ ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
+ ASSERT(mSwapChain);
- oldRenderTarget->Release();
- }
+ EGLint status = mSwapChain->reset(backbufferWidth, backbufferHeight, mSwapInterval);
- if (mWindow)
+ if (status == EGL_CONTEXT_LOST)
{
- D3DPRESENT_PARAMETERS presentParameters = {0};
- presentParameters.AutoDepthStencilFormat = mConfig->mDepthStencilFormat;
- presentParameters.BackBufferCount = 1;
- presentParameters.BackBufferFormat = mConfig->mRenderTargetFormat;
- presentParameters.EnableAutoDepthStencil = FALSE;
- presentParameters.Flags = 0;
- presentParameters.hDeviceWindow = getWindowHandle();
- presentParameters.MultiSampleQuality = 0; // FIXME: Unimplemented
- presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE; // FIXME: Unimplemented
- presentParameters.PresentationInterval = mPresentInterval;
- presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
- presentParameters.Windowed = TRUE;
- presentParameters.BackBufferWidth = backbufferWidth;
- presentParameters.BackBufferHeight = backbufferHeight;
-
- // http://crbug.com/140239
- // http://crbug.com/143434
- //
- // Some AMD/Intel switchable systems / drivers appear to round swap chain surfaces to a multiple of 64 pixels in width
- // when using the integrated Intel. This rounds the width up rather than down.
- //
- // Some non-switchable AMD GPUs / drivers do not respect the source rectangle to Present. Therefore, when the vendor ID
- // is not Intel, the back buffer width must be exactly the same width as the window or horizontal scaling will occur.
- D3DADAPTER_IDENTIFIER9* adapterIdentifier = mDisplay->getAdapterIdentifier();
- if (adapterIdentifier->VendorId == VENDOR_ID_INTEL)
- {
- presentParameters.BackBufferWidth = (presentParameters.BackBufferWidth + 63) / 64 * 64;
- }
-
- result = device->CreateAdditionalSwapChain(&presentParameters, &mSwapChain);
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_INVALIDCALL || result == D3DERR_DEVICELOST);
-
- ERR("Could not create additional swap chains or offscreen surfaces: %08lX", result);
- release();
-
- if(isDeviceLostError(result))
- {
- mDisplay->notifyDeviceLost();
- return false;
- }
- else
- {
- return error(EGL_BAD_ALLOC, false);
- }
- }
-
- result = mSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &mBackBuffer);
- ASSERT(SUCCEEDED(result));
- InvalidateRect(mWindow, NULL, FALSE);
+ mRenderer->notifyDeviceLost();
+ return false;
}
-
- if (mConfig->mDepthStencilFormat != D3DFMT_UNKNOWN)
+ else if (status != EGL_SUCCESS)
{
- result = device->CreateDepthStencilSurface(backbufferWidth, backbufferHeight, mConfig->mDepthStencilFormat, D3DMULTISAMPLE_NONE,
- 0, FALSE, &mDepthStencil, NULL);
-
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_INVALIDCALL);
-
- ERR("Could not create depthstencil surface for new swap chain: 0x%08X", result);
- release();
-
- if(isDeviceLostError(result))
- {
- mDisplay->notifyDeviceLost();
- return false;
- }
- else
- {
- return error(EGL_BAD_ALLOC, false);
- }
- }
+ return error(status, false);
}
mWidth = backbufferWidth;
mHeight = backbufferHeight;
+ mSwapIntervalDirty = false;
- mPresentIntervalDirty = false;
return true;
}
@@ -397,86 +246,18 @@ bool Surface::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
return true;
}
- IDirect3DDevice9 *device = mDisplay->getDevice();
-
- // Disable all pipeline operations
- device->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
- device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
- device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
- device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
- device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
- device->SetRenderState(D3DRS_STENCILENABLE, FALSE);
- device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
- device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
- device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
- device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
- device->SetPixelShader(NULL);
- device->SetVertexShader(NULL);
-
- device->SetRenderTarget(0, mBackBuffer);
- device->SetDepthStencilSurface(NULL);
-
- device->SetTexture(0, mOffscreenTexture);
- device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
- device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- device->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
- device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
- device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
- device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
- device->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
-
- D3DVIEWPORT9 viewport = {0, 0, mWidth, mHeight, 0.0f, 1.0f};
- device->SetViewport(&viewport);
-
- float x1 = x - 0.5f;
- float y1 = (mHeight - y - height) - 0.5f;
- float x2 = (x + width) - 0.5f;
- float y2 = (mHeight - y) - 0.5f;
-
- float u1 = x / float(mWidth);
- float v1 = y / float(mHeight);
- float u2 = (x + width) / float(mWidth);
- float v2 = (y + height) / float(mHeight);
-
- float quad[4][6] = {{x1, y1, 0.0f, 1.0f, u1, v2},
- {x2, y1, 0.0f, 1.0f, u2, v2},
- {x2, y2, 0.0f, 1.0f, u2, v1},
- {x1, y2, 0.0f, 1.0f, u1, v1}}; // x, y, z, rhw, u, v
-
- mDisplay->startScene();
- device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, quad, 6 * sizeof(float));
- mDisplay->endScene();
-
- device->SetTexture(0, NULL);
-
- RECT rect =
- {
- x, mHeight - y - height,
- x + width, mHeight - y
- };
-
- HRESULT result = mSwapChain->Present(&rect, &rect, NULL, NULL, 0);
+ EGLint status = mSwapChain->swapRect(x, y, width, height);
- gl::Context *context = static_cast<gl::Context*>(glGetCurrentContext());
- if (context)
+ if (status == EGL_CONTEXT_LOST)
{
- context->markAllStateDirty();
- }
-
- if (isDeviceLostError(result))
- {
- mDisplay->notifyDeviceLost();
+ mRenderer->notifyDeviceLost();
return false;
}
-
- if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR)
+ else if (status != EGL_SUCCESS)
{
- return error(EGL_BAD_ALLOC, false);
+ return error(status, false);
}
- ASSERT(SUCCEEDED(result));
-
checkForOutOfDateSwapChain();
return true;
@@ -572,9 +353,17 @@ bool Surface::checkForOutOfDateSwapChain()
int clientHeight = client.bottom - client.top;
bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
- if (sizeDirty || mPresentIntervalDirty)
+ if (mSwapIntervalDirty)
{
resetSwapChain(clientWidth, clientHeight);
+ }
+ else if (sizeDirty)
+ {
+ resizeSwapChain(clientWidth, clientHeight);
+ }
+
+ if (mSwapIntervalDirty || sizeDirty)
+ {
if (static_cast<egl::Surface*>(getCurrentDrawSurface()) == this)
{
glMakeCurrent(glGetCurrentContext(), static_cast<egl::Display*>(getCurrentDisplay()), this);
@@ -582,22 +371,8 @@ bool Surface::checkForOutOfDateSwapChain()
return true;
}
- return false;
-}
-
-DWORD Surface::convertInterval(EGLint interval)
-{
- switch(interval)
- {
- case 0: return D3DPRESENT_INTERVAL_IMMEDIATE;
- case 1: return D3DPRESENT_INTERVAL_ONE;
- case 2: return D3DPRESENT_INTERVAL_TWO;
- case 3: return D3DPRESENT_INTERVAL_THREE;
- case 4: return D3DPRESENT_INTERVAL_FOUR;
- default: UNREACHABLE();
- }
- return D3DPRESENT_INTERVAL_DEFAULT;
+ return false;
}
bool Surface::swap()
@@ -631,38 +406,9 @@ EGLint Surface::isPostSubBufferSupported() const
return mPostSubBufferSupported;
}
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *Surface::getRenderTarget()
-{
- if (mRenderTarget)
- {
- mRenderTarget->AddRef();
- }
-
- return mRenderTarget;
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *Surface::getDepthStencil()
-{
- if (mDepthStencil)
- {
- mDepthStencil->AddRef();
- }
-
- return mDepthStencil;
-}
-
-IDirect3DTexture9 *Surface::getOffscreenTexture()
+rx::SwapChain *Surface::getSwapChain() const
{
- if (mOffscreenTexture)
- {
- mOffscreenTexture->AddRef();
- }
-
- return mOffscreenTexture;
+ return mSwapChain;
}
void Surface::setSwapInterval(EGLint interval)
@@ -673,11 +419,10 @@ void Surface::setSwapInterval(EGLint interval)
}
mSwapInterval = interval;
- mSwapInterval = std::max(mSwapInterval, mDisplay->getMinSwapInterval());
- mSwapInterval = std::min(mSwapInterval, mDisplay->getMaxSwapInterval());
+ mSwapInterval = std::max(mSwapInterval, mRenderer->getMinSwapInterval());
+ mSwapInterval = std::min(mSwapInterval, mRenderer->getMaxSwapInterval());
- mPresentInterval = convertInterval(mSwapInterval);
- mPresentIntervalDirty = true;
+ mSwapIntervalDirty = true;
}
EGLenum Surface::getTextureFormat() const
@@ -700,7 +445,7 @@ gl::Texture2D *Surface::getBoundTexture() const
return mTexture;
}
-D3DFORMAT Surface::getFormat() const
+EGLenum Surface::getFormat() const
{
return mConfig->mRenderTargetFormat;
}
diff --git a/src/3rdparty/angle/src/libEGL/Surface.h b/src/3rdparty/angle/src/libEGL/Surface.h
index 40bd7028ab..938b800cdd 100644
--- a/src/3rdparty/angle/src/libEGL/Surface.h
+++ b/src/3rdparty/angle/src/libEGL/Surface.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// 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.
//
@@ -8,12 +8,11 @@
// such as the client area of a window, including any back buffers.
// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
-#ifndef INCLUDE_SURFACE_H_
-#define INCLUDE_SURFACE_H_
+#ifndef LIBEGL_SURFACE_H_
+#define LIBEGL_SURFACE_H_
#define EGLAPI
#include <EGL/egl.h>
-#include <d3d9.h>
#include "common/angleutils.h"
@@ -21,6 +20,11 @@ namespace gl
{
class Texture2D;
}
+namespace rx
+{
+class Renderer;
+class SwapChain;
+}
namespace egl
{
@@ -48,18 +52,14 @@ class Surface
virtual EGLint isPostSubBufferSupported() const;
- virtual IDirect3DSurface9 *getRenderTarget();
- virtual IDirect3DSurface9 *getDepthStencil();
- virtual IDirect3DTexture9 *getOffscreenTexture();
-
- HANDLE getShareHandle() { return mShareHandle; }
+ virtual rx::SwapChain *getSwapChain() const;
void setSwapInterval(EGLint interval);
bool checkForOutOfDateSwapChain(); // Returns true if swapchain changed due to resize or interval update
virtual EGLenum getTextureFormat() const;
virtual EGLenum getTextureTarget() const;
- virtual D3DFORMAT getFormat() const;
+ virtual EGLenum getFormat() const;
virtual void setBoundTexture(gl::Texture2D *texture);
virtual gl::Texture2D *getBoundTexture() const;
@@ -68,19 +68,16 @@ private:
DISALLOW_COPY_AND_ASSIGN(Surface);
Display *const mDisplay;
- IDirect3DSwapChain9 *mSwapChain;
- IDirect3DSurface9 *mBackBuffer;
- IDirect3DSurface9 *mDepthStencil;
- IDirect3DSurface9* mRenderTarget;
- IDirect3DTexture9* mOffscreenTexture;
+ rx::Renderer *mRenderer;
HANDLE mShareHandle;
+ rx::SwapChain *mSwapChain;
void subclassWindow();
void unsubclassWindow();
+ bool resizeSwapChain(int backbufferWidth, int backbufferHeight);
bool resetSwapChain(int backbufferWidth, int backbufferHeight);
bool swapRect(EGLint x, EGLint y, EGLint width, EGLint height);
- static DWORD convertInterval(EGLint interval);
const HWND mWindow; // Window that the surface is created for.
bool mWindowSubclassed; // Indicates whether we successfully subclassed mWindow for WM_RESIZE hooking
@@ -103,10 +100,9 @@ private:
EGLint mSwapInterval;
EGLint mPostSubBufferSupported;
- DWORD mPresentInterval;
- bool mPresentIntervalDirty;
+ bool mSwapIntervalDirty;
gl::Texture2D *mTexture;
};
}
-#endif // INCLUDE_SURFACE_H_
+#endif // LIBEGL_SURFACE_H_
diff --git a/src/3rdparty/angle/src/libEGL/libEGL.cpp b/src/3rdparty/angle/src/libEGL/libEGL.cpp
index 25df1c8c24..7fca456cf5 100644
--- a/src/3rdparty/angle/src/libEGL/libEGL.cpp
+++ b/src/3rdparty/angle/src/libEGL/libEGL.cpp
@@ -12,21 +12,23 @@
#include "common/version.h"
#include "libGLESv2/Context.h"
#include "libGLESv2/Texture.h"
+#include "libGLESv2/main.h"
+#include "libGLESv2/renderer/SwapChain.h"
#include "libEGL/main.h"
#include "libEGL/Display.h"
-
+#include "libEGL/Surface.h"
bool validateDisplay(egl::Display *display)
{
if (display == EGL_NO_DISPLAY)
{
- return error(EGL_BAD_DISPLAY, false);
+ return egl::error(EGL_BAD_DISPLAY, false);
}
if (!display->isInitialized())
{
- return error(EGL_NOT_INITIALIZED, false);
+ return egl::error(EGL_NOT_INITIALIZED, false);
}
return true;
@@ -41,7 +43,7 @@ bool validateConfig(egl::Display *display, EGLConfig config)
if (!display->isValidConfig(config))
{
- return error(EGL_BAD_CONFIG, false);
+ return egl::error(EGL_BAD_CONFIG, false);
}
return true;
@@ -56,7 +58,7 @@ bool validateContext(egl::Display *display, gl::Context *context)
if (!display->isValidContext(context))
{
- return error(EGL_BAD_CONTEXT, false);
+ return egl::error(EGL_BAD_CONTEXT, false);
}
return true;
@@ -71,7 +73,7 @@ bool validateSurface(egl::Display *display, egl::Surface *surface)
if (!display->isValidSurface(surface))
{
- return error(EGL_BAD_SURFACE, false);
+ return egl::error(EGL_BAD_SURFACE, false);
}
return true;
@@ -103,7 +105,7 @@ EGLDisplay __stdcall eglGetDisplay(EGLNativeDisplayType display_id)
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
+ return egl::error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
}
}
@@ -116,24 +118,24 @@ EGLBoolean __stdcall eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
{
if (dpy == EGL_NO_DISPLAY)
{
- return error(EGL_BAD_DISPLAY, EGL_FALSE);
+ return egl::error(EGL_BAD_DISPLAY, EGL_FALSE);
}
egl::Display *display = static_cast<egl::Display*>(dpy);
if (!display->initialize())
{
- return error(EGL_NOT_INITIALIZED, EGL_FALSE);
+ return egl::error(EGL_NOT_INITIALIZED, EGL_FALSE);
}
if (major) *major = 1;
if (minor) *minor = 4;
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -145,18 +147,18 @@ EGLBoolean __stdcall eglTerminate(EGLDisplay dpy)
{
if (dpy == EGL_NO_DISPLAY)
{
- return error(EGL_BAD_DISPLAY, EGL_FALSE);
+ return egl::error(EGL_BAD_DISPLAY, EGL_FALSE);
}
egl::Display *display = static_cast<egl::Display*>(dpy);
display->terminate();
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -176,20 +178,20 @@ const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
switch (name)
{
case EGL_CLIENT_APIS:
- return success("OpenGL_ES");
+ return egl::success("OpenGL_ES");
case EGL_EXTENSIONS:
return display->getExtensionString();
case EGL_VENDOR:
- return success("Google Inc.");
+ return egl::success("Google Inc.");
case EGL_VERSION:
- return success("1.4 (ANGLE " VERSION_STRING ")");
+ return egl::success("1.4 (ANGLE " VERSION_STRING ")");
}
- return error(EGL_BAD_PARAMETER, (const char*)NULL);
+ return egl::error(EGL_BAD_PARAMETER, (const char*)NULL);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, (const char*)NULL);
+ return egl::error(EGL_BAD_ALLOC, (const char*)NULL);
}
}
@@ -210,21 +212,21 @@ EGLBoolean __stdcall eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint co
if (!num_config)
{
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
+ return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);
}
const EGLint attribList[] = {EGL_NONE};
if (!display->getConfigs(configs, attribList, config_size, num_config))
{
- return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
+ return egl::error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
}
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -245,7 +247,7 @@ EGLBoolean __stdcall eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
if (!num_config)
{
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
+ return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);
}
const EGLint attribList[] = {EGL_NONE};
@@ -257,11 +259,11 @@ EGLBoolean __stdcall eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
display->getConfigs(configs, attrib_list, config_size, num_config);
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -281,14 +283,14 @@ EGLBoolean __stdcall eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint
if (!display->getConfigAttrib(config, attribute, value))
{
- return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
+ return egl::error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
}
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -310,14 +312,14 @@ EGLSurface __stdcall eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EG
if (!IsWindow(window))
{
- return error(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
+ return egl::error(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
}
return display->createWindowSurface(window, config, attrib_list);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
}
@@ -339,7 +341,7 @@ EGLSurface __stdcall eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, c
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
}
@@ -359,11 +361,11 @@ EGLSurface __stdcall eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EG
UNIMPLEMENTED(); // FIXME
- return success(EGL_NO_SURFACE);
+ return egl::success(EGL_NO_SURFACE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
}
@@ -383,16 +385,16 @@ EGLBoolean __stdcall eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
if (surface == EGL_NO_SURFACE)
{
- return error(EGL_BAD_SURFACE, EGL_FALSE);
+ return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
}
display->destroySurface((egl::Surface*)surface);
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -413,7 +415,7 @@ EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint
if (surface == EGL_NO_SURFACE)
{
- return error(EGL_BAD_SURFACE, EGL_FALSE);
+ return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
}
switch (attribute)
@@ -470,14 +472,14 @@ EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint
*value = eglSurface->isPostSubBufferSupported();
break;
default:
- return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
+ return egl::error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
}
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -498,23 +500,26 @@ EGLBoolean __stdcall eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surf
if (surface == EGL_NO_SURFACE)
{
- return error(EGL_BAD_SURFACE, EGL_FALSE);
+ return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
}
switch (attribute)
{
case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
- *value = (void*) eglSurface->getShareHandle();
+ {
+ rx::SwapChain *swapchain = eglSurface->getSwapChain();
+ *value = (void*) (swapchain ? swapchain->getShareHandle() : NULL);
+ }
break;
default:
- return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
+ return egl::error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
}
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -528,20 +533,20 @@ EGLBoolean __stdcall eglBindAPI(EGLenum api)
{
case EGL_OPENGL_API:
case EGL_OPENVG_API:
- return error(EGL_BAD_PARAMETER, EGL_FALSE); // Not supported by this implementation
+ return egl::error(EGL_BAD_PARAMETER, EGL_FALSE); // Not supported by this implementation
case EGL_OPENGL_ES_API:
break;
default:
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
+ return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);
}
egl::setCurrentAPI(api);
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -553,11 +558,11 @@ EGLenum __stdcall eglQueryAPI(void)
{
EGLenum API = egl::getCurrentAPI();
- return success(API);
+ return egl::success(API);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -569,11 +574,11 @@ EGLBoolean __stdcall eglWaitClient(void)
{
UNIMPLEMENTED(); // FIXME
- return success(0);
+ return egl::success(0);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -585,11 +590,11 @@ EGLBoolean __stdcall eglReleaseThread(void)
{
eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -610,14 +615,14 @@ EGLSurface __stdcall eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum bu
if (buftype != EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE || !buffer)
{
- return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
+ return egl::error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
}
return display->createOffscreenSurface(config, (HANDLE)buffer, attrib_list);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
}
@@ -638,11 +643,11 @@ EGLBoolean __stdcall eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint
UNIMPLEMENTED(); // FIXME
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -662,34 +667,34 @@ EGLBoolean __stdcall eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint
if (buffer != EGL_BACK_BUFFER)
{
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
+ return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);
}
if (surface == EGL_NO_SURFACE || eglSurface->getWindowHandle())
{
- return error(EGL_BAD_SURFACE, EGL_FALSE);
+ return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
}
if (eglSurface->getBoundTexture())
{
- return error(EGL_BAD_ACCESS, EGL_FALSE);
+ return egl::error(EGL_BAD_ACCESS, EGL_FALSE);
}
if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE)
{
- return error(EGL_BAD_MATCH, EGL_FALSE);
+ return egl::error(EGL_BAD_MATCH, EGL_FALSE);
}
if (!glBindTexImage(eglSurface))
{
- return error(EGL_BAD_MATCH, EGL_FALSE);
+ return egl::error(EGL_BAD_MATCH, EGL_FALSE);
}
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -709,17 +714,17 @@ EGLBoolean __stdcall eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLi
if (buffer != EGL_BACK_BUFFER)
{
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
+ return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);
}
if (surface == EGL_NO_SURFACE || eglSurface->getWindowHandle())
{
- return error(EGL_BAD_SURFACE, EGL_FALSE);
+ return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
}
if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE)
{
- return error(EGL_BAD_MATCH, EGL_FALSE);
+ return egl::error(EGL_BAD_MATCH, EGL_FALSE);
}
gl::Texture2D *texture = eglSurface->getBoundTexture();
@@ -729,11 +734,11 @@ EGLBoolean __stdcall eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLi
texture->releaseTexImage();
}
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -754,16 +759,16 @@ EGLBoolean __stdcall eglSwapInterval(EGLDisplay dpy, EGLint interval)
if (draw_surface == NULL)
{
- return error(EGL_BAD_SURFACE, EGL_FALSE);
+ return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
}
draw_surface->setSwapInterval(interval);
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -791,32 +796,32 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte
case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT:
if (attribute[1] == EGL_TRUE)
{
- return error(EGL_BAD_CONFIG, EGL_NO_CONTEXT); // Unimplemented
+ return egl::error(EGL_BAD_CONFIG, EGL_NO_CONTEXT); // Unimplemented
// robust_access = true;
}
else if (attribute[1] != EGL_FALSE)
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
+ return egl::error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
break;
case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT:
if (attribute[1] == EGL_LOSE_CONTEXT_ON_RESET_EXT)
reset_notification = true;
else if (attribute[1] != EGL_NO_RESET_NOTIFICATION_EXT)
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
+ return egl::error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
break;
default:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
+ return egl::error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
}
}
}
if (client_version != 2)
{
- return error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
+ return egl::error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
}
if (share_context && static_cast<gl::Context*>(share_context)->isResetNotificationEnabled() != reset_notification)
{
- return error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
+ return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
}
egl::Display *display = static_cast<egl::Display*>(dpy);
@@ -829,13 +834,13 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte
EGLContext context = display->createContext(config, static_cast<gl::Context*>(share_context), reset_notification, robust_access);
if (context)
- return success(context);
+ return egl::success(context);
else
- return error(EGL_CONTEXT_LOST, EGL_NO_CONTEXT);
+ return egl::error(EGL_CONTEXT_LOST, EGL_NO_CONTEXT);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
+ return egl::error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
}
}
@@ -855,16 +860,16 @@ EGLBoolean __stdcall eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
if (ctx == EGL_NO_CONTEXT)
{
- return error(EGL_BAD_CONTEXT, EGL_FALSE);
+ return egl::error(EGL_BAD_CONTEXT, EGL_FALSE);
}
display->destroyContext(context);
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -877,22 +882,21 @@ EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface
{
egl::Display *display = static_cast<egl::Display*>(dpy);
gl::Context *context = static_cast<gl::Context*>(ctx);
- IDirect3DDevice9 *device = display->getDevice();
- if (!device || display->testDeviceLost())
+ if (ctx != EGL_NO_CONTEXT && !validateContext(display, context))
{
- display->notifyDeviceLost();
return EGL_FALSE;
}
- if (display->isDeviceLost())
+ rx::Renderer *renderer = display->getRenderer();
+ if (renderer->testDeviceLost(true))
{
- return error(EGL_CONTEXT_LOST, EGL_FALSE);
+ return EGL_FALSE;
}
- if (ctx != EGL_NO_CONTEXT && !validateContext(display, context))
+ if (renderer->isDeviceLost())
{
- return EGL_FALSE;
+ return egl::error(EGL_CONTEXT_LOST, EGL_FALSE);
}
if ((draw != EGL_NO_SURFACE && !validateSurface(display, static_cast<egl::Surface*>(draw))) ||
@@ -912,11 +916,11 @@ EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface
glMakeCurrent(context, display, static_cast<egl::Surface*>(draw));
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -928,11 +932,11 @@ EGLContext __stdcall eglGetCurrentContext(void)
{
EGLContext context = glGetCurrentContext();
- return success(context);
+ return egl::success(context);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
+ return egl::error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
}
}
@@ -945,21 +949,21 @@ EGLSurface __stdcall eglGetCurrentSurface(EGLint readdraw)
if (readdraw == EGL_READ)
{
EGLSurface read = egl::getCurrentReadSurface();
- return success(read);
+ return egl::success(read);
}
else if (readdraw == EGL_DRAW)
{
EGLSurface draw = egl::getCurrentDrawSurface();
- return success(draw);
+ return egl::success(draw);
}
else
{
- return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
+ return egl::error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
}
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
}
@@ -971,11 +975,11 @@ EGLDisplay __stdcall eglGetCurrentDisplay(void)
{
EGLDisplay dpy = egl::getCurrentDisplay();
- return success(dpy);
+ return egl::success(dpy);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
+ return egl::error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
}
}
@@ -996,11 +1000,11 @@ EGLBoolean __stdcall eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attr
UNIMPLEMENTED(); // FIXME
- return success(0);
+ return egl::success(0);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -1012,11 +1016,11 @@ EGLBoolean __stdcall eglWaitGL(void)
{
UNIMPLEMENTED(); // FIXME
- return success(0);
+ return egl::success(0);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -1028,11 +1032,11 @@ EGLBoolean __stdcall eglWaitNative(EGLint engine)
{
UNIMPLEMENTED(); // FIXME
- return success(0);
+ return egl::success(0);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -1050,24 +1054,24 @@ EGLBoolean __stdcall eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
return EGL_FALSE;
}
- if (display->isDeviceLost())
+ if (display->getRenderer()->isDeviceLost())
{
- return error(EGL_CONTEXT_LOST, EGL_FALSE);
+ return egl::error(EGL_CONTEXT_LOST, EGL_FALSE);
}
if (surface == EGL_NO_SURFACE)
{
- return error(EGL_BAD_SURFACE, EGL_FALSE);
+ return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
}
if (eglSurface->swap())
{
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
return EGL_FALSE;
@@ -1087,18 +1091,18 @@ EGLBoolean __stdcall eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativ
return EGL_FALSE;
}
- if (display->isDeviceLost())
+ if (display->getRenderer()->isDeviceLost())
{
- return error(EGL_CONTEXT_LOST, EGL_FALSE);
+ return egl::error(EGL_CONTEXT_LOST, EGL_FALSE);
}
UNIMPLEMENTED(); // FIXME
- return success(0);
+ return egl::success(0);
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
}
@@ -1110,7 +1114,7 @@ EGLBoolean __stdcall eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLi
{
if (x < 0 || y < 0 || width < 0 || height < 0)
{
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
+ return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);
}
egl::Display *display = static_cast<egl::Display*>(dpy);
@@ -1121,24 +1125,24 @@ EGLBoolean __stdcall eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLi
return EGL_FALSE;
}
- if (display->isDeviceLost())
+ if (display->getRenderer()->isDeviceLost())
{
- return error(EGL_CONTEXT_LOST, EGL_FALSE);
+ return egl::error(EGL_CONTEXT_LOST, EGL_FALSE);
}
if (surface == EGL_NO_SURFACE)
{
- return error(EGL_BAD_SURFACE, EGL_FALSE);
+ return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
}
if (eglSurface->postSubBuffer(x, y, width, height))
{
- return success(EGL_TRUE);
+ return egl::success(EGL_TRUE);
}
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, EGL_FALSE);
+ return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
return EGL_FALSE;
@@ -1163,7 +1167,7 @@ __eglMustCastToProperFunctionPointerType __stdcall eglGetProcAddress(const char
{"", NULL},
};
- for (int ext = 0; ext < sizeof(eglExtensions) / sizeof(Extension); ext++)
+ for (unsigned int ext = 0; ext < ArraySize(eglExtensions); ext++)
{
if (strcmp(procname, eglExtensions[ext].name) == 0)
{
@@ -1175,7 +1179,7 @@ __eglMustCastToProperFunctionPointerType __stdcall eglGetProcAddress(const char
}
catch(std::bad_alloc&)
{
- return error(EGL_BAD_ALLOC, (__eglMustCastToProperFunctionPointerType)NULL);
+ return egl::error(EGL_BAD_ALLOC, (__eglMustCastToProperFunctionPointerType)NULL);
}
}
}
diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp
index 614bcf67ad..7ba77f08d1 100644
--- a/src/3rdparty/angle/src/libEGL/main.cpp
+++ b/src/3rdparty/angle/src/libEGL/main.cpp
@@ -155,9 +155,10 @@ EGLSurface getCurrentReadSurface()
{
return current()->readSurface;
}
-}
void error(EGLint errorCode)
{
egl::setCurrentError(errorCode);
}
+
+}
diff --git a/src/3rdparty/angle/src/libEGL/main.h b/src/3rdparty/angle/src/libEGL/main.h
index d09d9e6bc3..77da8f0f8e 100644
--- a/src/3rdparty/angle/src/libEGL/main.h
+++ b/src/3rdparty/angle/src/libEGL/main.h
@@ -38,7 +38,6 @@ EGLSurface getCurrentDrawSurface();
void setCurrentReadSurface(EGLSurface surface);
EGLSurface getCurrentReadSurface();
-}
void error(EGLint errorCode);
@@ -58,4 +57,6 @@ const T &success(const T &returnValue)
return returnValue;
}
+}
+
#endif // LIBEGL_MAIN_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/BinaryStream.h b/src/3rdparty/angle/src/libGLESv2/BinaryStream.h
index 5f7213b8da..21c2f86ce8 100644
--- a/src/3rdparty/angle/src/libGLESv2/BinaryStream.h
+++ b/src/3rdparty/angle/src/libGLESv2/BinaryStream.h
@@ -9,9 +9,6 @@
#ifndef LIBGLESV2_BINARYSTREAM_H_
#define LIBGLESV2_BINARYSTREAM_H_
-#include <string>
-#include <vector>
-
#include "common/angleutils.h"
namespace gl
diff --git a/src/3rdparty/angle/src/libGLESv2/Buffer.cpp b/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
index dd12e3c077..8d5b4ef2a1 100644
--- a/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
@@ -1,5 +1,6 @@
+#include "precompiled.h"
//
-// Copyright (c) 2002-2010 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.
//
@@ -10,19 +11,20 @@
#include "libGLESv2/Buffer.h"
-#include "libGLESv2/main.h"
-#include "libGLESv2/VertexDataManager.h"
-#include "libGLESv2/IndexDataManager.h"
+#include "libGLESv2/renderer/VertexBuffer.h"
+#include "libGLESv2/renderer/IndexBuffer.h"
+#include "libGLESv2/renderer/BufferStorage.h"
+#include "libGLESv2/renderer/Renderer.h"
namespace gl
{
-Buffer::Buffer(GLuint id) : RefCountObject(id)
+Buffer::Buffer(rx::Renderer *renderer, GLuint id) : RefCountObject(id)
{
- mContents = NULL;
- mSize = 0;
+ mRenderer = renderer;
mUsage = GL_DYNAMIC_DRAW;
+ mBufferStorage = renderer->createBufferStorage();
mStaticVertexBuffer = NULL;
mStaticIndexBuffer = NULL;
mUnmodifiedDataUse = 0;
@@ -30,47 +32,32 @@ Buffer::Buffer(GLuint id) : RefCountObject(id)
Buffer::~Buffer()
{
- delete[] mContents;
+ delete mBufferStorage;
delete mStaticVertexBuffer;
delete mStaticIndexBuffer;
}
void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
{
- if (size == 0)
- {
- delete[] mContents;
- mContents = NULL;
- }
- else if (size != mSize)
- {
- delete[] mContents;
- mContents = new GLubyte[size];
- memset(mContents, 0, size);
- }
+ mBufferStorage->clear();
+ mBufferStorage->setData(data, size, 0);
- if (data != NULL && size > 0)
- {
- memcpy(mContents, data, size);
- }
-
- mSize = size;
mUsage = usage;
invalidateStaticData();
if (usage == GL_STATIC_DRAW)
{
- mStaticVertexBuffer = new StaticVertexBuffer(getDevice());
- mStaticIndexBuffer = new StaticIndexBuffer(getDevice());
+ mStaticVertexBuffer = new rx::StaticVertexBufferInterface(mRenderer);
+ mStaticIndexBuffer = new rx::StaticIndexBufferInterface(mRenderer);
}
}
void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
{
- memcpy(mContents + offset, data, size);
-
- if ((mStaticVertexBuffer && mStaticVertexBuffer->size() != 0) || (mStaticIndexBuffer && mStaticIndexBuffer->size() != 0))
+ mBufferStorage->setData(data, size, offset);
+
+ if ((mStaticVertexBuffer && mStaticVertexBuffer->getBufferSize() != 0) || (mStaticIndexBuffer && mStaticIndexBuffer->getBufferSize() != 0))
{
invalidateStaticData();
}
@@ -78,12 +65,27 @@ void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
mUnmodifiedDataUse = 0;
}
-StaticVertexBuffer *Buffer::getStaticVertexBuffer()
+rx::BufferStorage *Buffer::getStorage() const
+{
+ return mBufferStorage;
+}
+
+unsigned int Buffer::size()
+{
+ return mBufferStorage->getSize();
+}
+
+GLenum Buffer::usage() const
+{
+ return mUsage;
+}
+
+rx::StaticVertexBufferInterface *Buffer::getStaticVertexBuffer()
{
return mStaticVertexBuffer;
}
-StaticIndexBuffer *Buffer::getStaticIndexBuffer()
+rx::StaticIndexBufferInterface *Buffer::getStaticIndexBuffer()
{
return mStaticIndexBuffer;
}
@@ -106,10 +108,10 @@ void Buffer::promoteStaticUsage(int dataSize)
{
mUnmodifiedDataUse += dataSize;
- if (mUnmodifiedDataUse > 3 * mSize)
+ if (mUnmodifiedDataUse > 3 * mBufferStorage->getSize())
{
- mStaticVertexBuffer = new StaticVertexBuffer(getDevice());
- mStaticIndexBuffer = new StaticIndexBuffer(getDevice());
+ mStaticVertexBuffer = new rx::StaticVertexBufferInterface(mRenderer);
+ mStaticIndexBuffer = new rx::StaticIndexBufferInterface(mRenderer);
}
}
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Buffer.h b/src/3rdparty/angle/src/libGLESv2/Buffer.h
index 7019c4e160..4376ada5c0 100644
--- a/src/3rdparty/angle/src/libGLESv2/Buffer.h
+++ b/src/3rdparty/angle/src/libGLESv2/Buffer.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 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.
//
@@ -11,49 +11,51 @@
#ifndef LIBGLESV2_BUFFER_H_
#define LIBGLESV2_BUFFER_H_
-#include <cstddef>
-#include <vector>
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-
#include "common/angleutils.h"
#include "common/RefCountObject.h"
+namespace rx
+{
+class Renderer;
+class BufferStorage;
+class StaticIndexBufferInterface;
+class StaticVertexBufferInterface;
+};
+
namespace gl
{
-class StaticVertexBuffer;
-class StaticIndexBuffer;
class Buffer : public RefCountObject
{
public:
- explicit Buffer(GLuint id);
+ Buffer(rx::Renderer *renderer, GLuint id);
virtual ~Buffer();
void bufferData(const void *data, GLsizeiptr size, GLenum usage);
void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
- void *data() { return mContents; }
- size_t size() const { return mSize; }
- GLenum usage() const { return mUsage; }
+ GLenum usage() const;
+
+ rx::BufferStorage *getStorage() const;
+ unsigned int size();
- StaticVertexBuffer *getStaticVertexBuffer();
- StaticIndexBuffer *getStaticIndexBuffer();
+ rx::StaticVertexBufferInterface *getStaticVertexBuffer();
+ rx::StaticIndexBufferInterface *getStaticIndexBuffer();
void invalidateStaticData();
void promoteStaticUsage(int dataSize);
private:
DISALLOW_COPY_AND_ASSIGN(Buffer);
- GLubyte *mContents;
- GLsizeiptr mSize;
+ rx::Renderer *mRenderer;
GLenum mUsage;
- StaticVertexBuffer *mStaticVertexBuffer;
- StaticIndexBuffer *mStaticIndexBuffer;
- GLsizeiptr mUnmodifiedDataUse;
+ rx::BufferStorage *mBufferStorage;
+
+ rx::StaticVertexBufferInterface *mStaticVertexBuffer;
+ rx::StaticIndexBufferInterface *mStaticIndexBuffer;
+ unsigned int mUnmodifiedDataUse;
};
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Context.cpp b/src/3rdparty/angle/src/libGLESv2/Context.cpp
index 414bfa968d..90ba2539d8 100644
--- a/src/3rdparty/angle/src/libGLESv2/Context.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Context.cpp
@@ -1,5 +1,6 @@
+#include "precompiled.h"
//
-// 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,38 +10,41 @@
#include "libGLESv2/Context.h"
-#include <algorithm>
-
-#include "libEGL/Display.h"
-
#include "libGLESv2/main.h"
-#include "libGLESv2/mathutil.h"
#include "libGLESv2/utilities.h"
-#include "libGLESv2/Blit.h"
-#include "libGLESv2/ResourceManager.h"
#include "libGLESv2/Buffer.h"
#include "libGLESv2/Fence.h"
#include "libGLESv2/Framebuffer.h"
+#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/Program.h"
#include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/Query.h"
-#include "libGLESv2/Renderbuffer.h"
-#include "libGLESv2/Shader.h"
#include "libGLESv2/Texture.h"
-#include "libGLESv2/VertexDataManager.h"
-#include "libGLESv2/IndexDataManager.h"
+#include "libGLESv2/ResourceManager.h"
+#include "libGLESv2/renderer/IndexDataManager.h"
+#include "libGLESv2/renderer/RenderTarget.h"
+#include "libGLESv2/renderer/Renderer.h"
+
+#include "libEGL/Surface.h"
#undef near
#undef far
namespace gl
{
-Context::Context(const egl::Config *config, const gl::Context *shareContext, bool notifyResets, bool robustAccess) : mConfig(config)
+static const char* makeStaticString(const std::string& str)
{
- ASSERT(robustAccess == false); // Unimplemented
+ static std::set<std::string> strings;
+ std::set<std::string>::iterator it = strings.find(str);
+ if (it != strings.end())
+ return it->c_str();
+
+ return strings.insert(str).first->c_str();
+}
- mDisplay = NULL;
- mDevice = NULL;
+Context::Context(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess) : mRenderer(renderer)
+{
+ ASSERT(robustAccess == false); // Unimplemented
mFenceHandleAllocator.setBaseHandle(0);
@@ -49,68 +53,73 @@ Context::Context(const egl::Config *config, const gl::Context *shareContext, boo
mState.depthClearValue = 1.0f;
mState.stencilClearValue = 0;
- mState.cullFace = false;
- mState.cullMode = GL_BACK;
- mState.frontFace = GL_CCW;
- mState.depthTest = false;
- mState.depthFunc = GL_LESS;
- mState.blend = false;
- mState.sourceBlendRGB = GL_ONE;
- mState.sourceBlendAlpha = GL_ONE;
- mState.destBlendRGB = GL_ZERO;
- mState.destBlendAlpha = GL_ZERO;
- mState.blendEquationRGB = GL_FUNC_ADD;
- mState.blendEquationAlpha = GL_FUNC_ADD;
+ mState.rasterizer.cullFace = false;
+ mState.rasterizer.cullMode = GL_BACK;
+ mState.rasterizer.frontFace = GL_CCW;
+ mState.rasterizer.polygonOffsetFill = false;
+ mState.rasterizer.polygonOffsetFactor = 0.0f;
+ mState.rasterizer.polygonOffsetUnits = 0.0f;
+ mState.rasterizer.pointDrawMode = false;
+ mState.scissorTest = false;
+ mState.scissor.x = 0;
+ mState.scissor.y = 0;
+ mState.scissor.width = 0;
+ mState.scissor.height = 0;
+
+ mState.blend.blend = false;
+ mState.blend.sourceBlendRGB = GL_ONE;
+ mState.blend.sourceBlendAlpha = GL_ONE;
+ mState.blend.destBlendRGB = GL_ZERO;
+ mState.blend.destBlendAlpha = GL_ZERO;
+ mState.blend.blendEquationRGB = GL_FUNC_ADD;
+ mState.blend.blendEquationAlpha = GL_FUNC_ADD;
+ mState.blend.sampleAlphaToCoverage = false;
+ mState.blend.dither = true;
+
mState.blendColor.red = 0;
mState.blendColor.green = 0;
mState.blendColor.blue = 0;
mState.blendColor.alpha = 0;
- mState.stencilTest = false;
- mState.stencilFunc = GL_ALWAYS;
+
+ mState.depthStencil.depthTest = false;
+ mState.depthStencil.depthFunc = GL_LESS;
+ mState.depthStencil.depthMask = true;
+ mState.depthStencil.stencilTest = false;
+ mState.depthStencil.stencilFunc = GL_ALWAYS;
+ mState.depthStencil.stencilMask = -1;
+ mState.depthStencil.stencilWritemask = -1;
+ mState.depthStencil.stencilBackFunc = GL_ALWAYS;
+ mState.depthStencil.stencilBackMask = - 1;
+ mState.depthStencil.stencilBackWritemask = -1;
+ mState.depthStencil.stencilFail = GL_KEEP;
+ mState.depthStencil.stencilPassDepthFail = GL_KEEP;
+ mState.depthStencil.stencilPassDepthPass = GL_KEEP;
+ mState.depthStencil.stencilBackFail = GL_KEEP;
+ mState.depthStencil.stencilBackPassDepthFail = GL_KEEP;
+ mState.depthStencil.stencilBackPassDepthPass = GL_KEEP;
+
mState.stencilRef = 0;
- mState.stencilMask = -1;
- mState.stencilWritemask = -1;
- mState.stencilBackFunc = GL_ALWAYS;
mState.stencilBackRef = 0;
- mState.stencilBackMask = - 1;
- mState.stencilBackWritemask = -1;
- mState.stencilFail = GL_KEEP;
- mState.stencilPassDepthFail = GL_KEEP;
- mState.stencilPassDepthPass = GL_KEEP;
- mState.stencilBackFail = GL_KEEP;
- mState.stencilBackPassDepthFail = GL_KEEP;
- mState.stencilBackPassDepthPass = GL_KEEP;
- mState.polygonOffsetFill = false;
- mState.polygonOffsetFactor = 0.0f;
- mState.polygonOffsetUnits = 0.0f;
- mState.sampleAlphaToCoverage = false;
+
mState.sampleCoverage = false;
mState.sampleCoverageValue = 1.0f;
mState.sampleCoverageInvert = false;
- mState.scissorTest = false;
- mState.dither = true;
mState.generateMipmapHint = GL_DONT_CARE;
mState.fragmentShaderDerivativeHint = GL_DONT_CARE;
mState.lineWidth = 1.0f;
- mState.viewportX = 0;
- mState.viewportY = 0;
- mState.viewportWidth = config->mDisplayMode.Width;
- mState.viewportHeight = config->mDisplayMode.Height;
+ mState.viewport.x = 0;
+ mState.viewport.y = 0;
+ mState.viewport.width = 0;
+ mState.viewport.height = 0;
mState.zNear = 0.0f;
mState.zFar = 1.0f;
- mState.scissorX = 0;
- mState.scissorY = 0;
- mState.scissorWidth = config->mDisplayMode.Width;
- mState.scissorHeight = config->mDisplayMode.Height;
-
- mState.colorMaskRed = true;
- mState.colorMaskGreen = true;
- mState.colorMaskBlue = true;
- mState.colorMaskAlpha = true;
- mState.depthMask = true;
+ mState.blend.colorMaskRed = true;
+ mState.blend.colorMaskGreen = true;
+ mState.blend.colorMaskBlue = true;
+ mState.blend.colorMaskAlpha = true;
if (shareContext != NULL)
{
@@ -119,7 +128,7 @@ Context::Context(const egl::Config *config, const gl::Context *shareContext, boo
}
else
{
- mResourceManager = new ResourceManager();
+ mResourceManager = new ResourceManager(mRenderer);
}
// [OpenGL ES 2.0.24] section 3.7 page 83:
@@ -128,8 +137,8 @@ Context::Context(const egl::Config *config, const gl::Context *shareContext, boo
// In order that access to these initial textures not be lost, they are treated as texture
// objects all of whose names are 0.
- mTexture2DZero.set(new Texture2D(0));
- mTextureCubeMapZero.set(new TextureCubeMap(0));
+ mTexture2DZero.set(new Texture2D(mRenderer, 0));
+ mTextureCubeMapZero.set(new TextureCubeMap(mRenderer, 0));
mState.activeSampler = 0;
bindArrayBuffer(0);
@@ -147,10 +156,8 @@ Context::Context(const egl::Config *config, const gl::Context *shareContext, boo
mState.unpackAlignment = 4;
mState.packReverseRowOrder = false;
- mVertexDataManager = NULL;
- mIndexDataManager = NULL;
- mBlit = NULL;
- mLineLoopIB = NULL;
+ mExtensionString = NULL;
+ mRendererString = NULL;
mInvalidEnum = false;
mInvalidValue = false;
@@ -164,15 +171,13 @@ Context::Context