summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure45
-rw-r--r--dist/changes-5.4.07
-rw-r--r--doc/global/externalsites/qt-webpages.qdoc6
-rw-r--r--examples/gui/doc/src/openglwindow.qdoc4
-rw-r--r--examples/json/savegame/doc/src/savegame.qdoc2
-rw-r--r--examples/opengl/doc/src/cube.qdoc6
-rw-r--r--examples/opengl/qopenglwidget/glwidget.cpp5
-rw-r--r--examples/opengl/qopenglwidget/mainwindow.cpp25
-rw-r--r--examples/opengl/qopenglwidget/mainwindow.h5
-rw-r--r--examples/widgets/doc/src/echoplugin.qdoc2
-rw-r--r--examples/widgets/doc/src/styleplugin.qdoc2
-rw-r--r--examples/widgets/doc/src/tooltips.qdoc2
-rw-r--r--examples/widgets/widgets/mousebuttons/mousebuttons.pro2
-rw-r--r--header.LGPL328
-rw-r--r--mkspecs/features/create_cmake.prf15
-rw-r--r--mkspecs/features/java.prf2
-rw-r--r--mkspecs/features/qt.prf6
-rw-r--r--mkspecs/features/qt_functions.prf14
-rw-r--r--mkspecs/features/qt_module.prf2
-rw-r--r--mkspecs/features/qt_module_headers.prf2
-rw-r--r--mkspecs/features/resolve_config.prf7
-rw-r--r--mkspecs/features/win32/console.prf6
-rw-r--r--mkspecs/features/win32/windows.prf7
-rw-r--r--mkspecs/macx-clang-32/Info.plist.lib2
-rw-r--r--mkspecs/macx-clang/Info.plist.lib2
-rw-r--r--mkspecs/macx-g++-32/Info.plist.lib2
-rw-r--r--mkspecs/macx-g++/Info.plist.lib2
-rw-r--r--mkspecs/macx-g++40/Info.plist.lib2
-rw-r--r--mkspecs/macx-g++42/Info.plist.lib2
-rw-r--r--mkspecs/macx-icc/Info.plist.lib2
-rwxr-xr-xmkspecs/macx-ios-clang/Info.plist.app7
-rw-r--r--mkspecs/macx-ios-clang/Info.plist.lib2
-rw-r--r--mkspecs/macx-llvm/Info.plist.lib2
-rw-r--r--mkspecs/wince60standard-armv4i-msvc2005/qmake.conf2
-rw-r--r--mkspecs/wince60standard-x86-msvc2005/qmake.conf2
-rw-r--r--mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf2
-rw-r--r--mkspecs/wince70embedded-x86-msvc2008/qmake.conf2
-rw-r--r--qmake/doc/src/qmake-manual.qdoc2
-rw-r--r--qmake/generators/unix/unixmake.cpp2
-rw-r--r--qmake/generators/unix/unixmake2.cpp256
-rw-r--r--qmake/generators/win32/cesdkhandler.cpp2
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp98
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.h20
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp59
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h9
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp8
-rw-r--r--src/3rdparty/angle/AUTHORS1
-rw-r--r--src/3rdparty/angle/CONTRIBUTORS4
-rw-r--r--src/3rdparty/angle/include/GLSLANG/ShaderLang.h43
-rw-r--r--src/3rdparty/angle/include/GLSLANG/ShaderVars.h123
-rw-r--r--src/3rdparty/angle/include/angle_gl.h3
-rw-r--r--src/3rdparty/angle/src/commit.h4
-rw-r--r--src/3rdparty/angle/src/common/RefCountObject.h4
-rw-r--r--src/3rdparty/angle/src/common/angleutils.cpp37
-rw-r--r--src/3rdparty/angle/src/common/angleutils.h8
-rw-r--r--src/3rdparty/angle/src/common/blocklayout.cpp44
-rw-r--r--src/3rdparty/angle/src/common/blocklayout.h7
-rw-r--r--src/3rdparty/angle/src/common/debug.cpp26
-rw-r--r--src/3rdparty/angle/src/common/debug.h4
-rw-r--r--src/3rdparty/angle/src/common/event_tracer.cpp49
-rw-r--r--src/3rdparty/angle/src/common/event_tracer.h43
-rw-r--r--src/3rdparty/angle/src/common/mathutil.cpp1
-rw-r--r--src/3rdparty/angle/src/common/mathutil.h18
-rw-r--r--src/3rdparty/angle/src/common/platform.h20
-rw-r--r--src/3rdparty/angle/src/common/shadervars.h157
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BaseTypes.h33
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Compiler.cpp26
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Compiler.h13
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DetectCallDepth.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/HashNames.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Initialize.cpp2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeVariables.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermNode.cpp1107
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermNode.h772
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Intermediate.cpp1093
-rw-r--r--src/3rdparty/angle/src/compiler/translator/LoopInfo.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/NodeSearch.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp14
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp74
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputHLSL.h16
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ParseContext.cpp75
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ParseContext.h7
-rw-r--r--src/3rdparty/angle/src/compiler/translator/QualifierAlive.cpp2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.cpp82
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.h40
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveTree.cpp2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RenameFunction.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp11
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h12
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SearchSymbol.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp124
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ShaderVars.cpp166
-rw-r--r--src/3rdparty/angle/src/compiler/translator/StructureHLSL.cpp35
-rw-r--r--src/3rdparty/angle/src/compiler/translator/StructureHLSL.h13
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp8
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SymbolTable.h14
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp8
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h1
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Types.cpp32
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Types.h11
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UniformHLSL.cpp76
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UniformHLSL.h9
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateOutputs.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariableInfo.cpp197
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariableInfo.h37
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp8
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp3
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VersionGLSL.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/glslang.y58
-rw-r--r--src/3rdparty/angle/src/compiler/translator/intermOut.cpp3
-rw-r--r--src/3rdparty/angle/src/compiler/translator/intermediate.h806
-rw-r--r--src/3rdparty/angle/src/compiler/translator/localintermediate.h67
-rw-r--r--src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/util.cpp53
-rw-r--r--src/3rdparty/angle/src/compiler/translator/util.h28
-rw-r--r--src/3rdparty/angle/src/libEGL/Display.cpp5
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGL.cpp12
-rw-r--r--src/3rdparty/angle/src/libEGL/main.cpp4
-rw-r--r--src/3rdparty/angle/src/libEGL/main.h2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/BinaryStream.h4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Buffer.cpp67
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Buffer.h22
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Caps.cpp94
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Caps.h53
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Context.cpp974
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Context.h114
-rw-r--r--src/3rdparty/angle/src/libGLESv2/DynamicHLSL.h96
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Error.cpp48
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Error.h39
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Fence.cpp3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Float16ToFloat32.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Framebuffer.cpp163
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Framebuffer.h28
-rw-r--r--src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.cpp385
-rw-r--r--src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.h157
-rw-r--r--src/3rdparty/angle/src/libGLESv2/HandleAllocator.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/HandleAllocator.h4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ImageIndex.cpp57
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ImageIndex.h41
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Program.cpp23
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Program.h22
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp822
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ProgramBinary.h133
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Query.cpp33
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Query.h17
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Renderbuffer.cpp35
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Renderbuffer.h6
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ResourceManager.cpp31
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ResourceManager.h12
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Sampler.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Shader.cpp476
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Shader.h135
-rw-r--r--src/3rdparty/angle/src/libGLESv2/State.cpp124
-rw-r--r--src/3rdparty/angle/src/libGLESv2/State.h24
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Texture.cpp787
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Texture.h154
-rw-r--r--src/3rdparty/angle/src/libGLESv2/TransformFeedback.cpp10
-rw-r--r--src/3rdparty/angle/src/libGLESv2/TransformFeedback.h9
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Uniform.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Uniform.h12
-rw-r--r--src/3rdparty/angle/src/libGLESv2/VertexArray.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/VertexArray.h2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/VertexAttribute.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/angletypes.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/angletypes.h12
-rw-r--r--src/3rdparty/angle/src/libGLESv2/constants.h4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/formatutils.cpp1581
-rw-r--r--src/3rdparty/angle/src/libGLESv2/formatutils.h98
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp3334
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2.def3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2_mingw32.def3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2d.def3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2d_mingw32.def3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/main.cpp44
-rw-r--r--src/3rdparty/angle/src/libGLESv2/main.h4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/precompiled.cpp9
-rw-r--r--src/3rdparty/angle/src/libGLESv2/precompiled.h32
-rw-r--r--src/3rdparty/angle/src/libGLESv2/queryconversions.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferImpl.h10
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Image.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Image.h2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/IndexRangeCache.cpp57
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/IndexRangeCache.h17
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/ProgramImpl.h58
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/QueryImpl.h21
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp10
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h126
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable.h3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/ShaderImpl.h54
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h8
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/TextureImpl.h134
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/TransformFeedbackImpl.h31
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/copyimage.cpp11
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/copyimage.h25
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/copyimage.inl32
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/copyvertex.h298
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/copyvertex.inl288
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/BufferD3D.cpp3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/BufferD3D.h4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/DynamicHLSL.cpp (renamed from src/3rdparty/angle/src/libGLESv2/DynamicHLSL.cpp)190
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/DynamicHLSL.h104
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp25
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/ImageD3D.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/ImageD3D.h21
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/IndexBuffer.cpp41
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/IndexBuffer.h27
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/IndexDataManager.cpp296
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/IndexDataManager.h17
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/MemoryBuffer.cpp2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/MemoryBuffer.h1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/ProgramD3D.cpp205
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/ProgramD3D.h87
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/ShaderD3D.cpp457
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/ShaderD3D.h94
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/TextureD3D.cpp990
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/TextureD3D.h221
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/TextureStorage.cpp160
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/TextureStorage.h114
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/TransformFeedbackD3D.cpp38
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/TransformFeedbackD3D.h32
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/VertexBuffer.cpp101
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/VertexBuffer.h40
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/VertexDataManager.cpp357
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/VertexDataManager.h29
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp48
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Blit11.h7
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Buffer11.cpp231
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Buffer11.h15
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp93
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Clear11.h6
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Fence11.cpp3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Image11.cpp203
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Image11.h24
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/IndexBuffer11.cpp99
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/IndexBuffer11.h10
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/InputLayoutCache.cpp21
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/InputLayoutCache.h10
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/PixelTransfer11.cpp19
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/PixelTransfer11.h4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Query11.cpp129
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Query11.h15
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/RenderStateCache.cpp86
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/RenderStateCache.h11
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/RenderTarget11.cpp48
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp1051
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h143
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/ShaderExecutable11.cpp2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp51
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/TextureStorage11.cpp682
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/TextureStorage11.h85
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/VertexBuffer11.cpp152
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/VertexBuffer11.h14
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/formatutils11.cpp1723
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/formatutils11.h81
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp564
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.h12
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Blit9.cpp23
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Blit9.h9
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Buffer9.cpp51
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Buffer9.h11
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Fence9.cpp3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Image9.cpp119
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Image9.h14
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/IndexBuffer9.cpp120
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/IndexBuffer9.h10
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Query9.cpp103
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Query9.h14
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/RenderTarget9.cpp32
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp851
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.h138
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/ShaderCache.h4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/ShaderExecutable9.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/SwapChain9.cpp16
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/TextureStorage9.cpp80
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/TextureStorage9.h15
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/VertexBuffer9.cpp189
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/VertexBuffer9.h20
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/VertexDeclarationCache.cpp47
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/VertexDeclarationCache.h3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/formatutils9.cpp734
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/formatutils9.h71
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/renderer9_utils.cpp165
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/renderer9_utils.h20
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/loadimage.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/loadimageSSE2.cpp1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/vertexconversion.h22
-rw-r--r--src/3rdparty/angle/src/libGLESv2/validationES.cpp757
-rw-r--r--src/3rdparty/angle/src/libGLESv2/validationES.h67
-rw-r--r--src/3rdparty/angle/src/libGLESv2/validationES2.cpp314
-rw-r--r--src/3rdparty/angle/src/libGLESv2/validationES2.h10
-rw-r--r--src/3rdparty/angle/src/libGLESv2/validationES3.cpp785
-rw-r--r--src/3rdparty/angle/src/libGLESv2/validationES3.h18
-rw-r--r--src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h2
-rw-r--r--src/3rdparty/angle/src/third_party/trace_event/trace_event.h828
-rw-r--r--src/android/jar/jar.pri5
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java3
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java28
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtNative.java5
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtPopupMenu.java74
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtPopupMenu14.java77
-rw-r--r--src/angle/patches/0000-General-fixes-for-ANGLE-2.1.patch1437
-rw-r--r--src/angle/patches/0001-Fix-compilation-for-MSVC-2008-and-std-tuple.patch10
-rw-r--r--src/angle/patches/0002-Fix-compilation-of-ANGLE-with-mingw-tdm64-gcc-4.8.1.patch17
-rw-r--r--src/angle/patches/0003-Fix-compilation-with-MinGW-gcc-64-bit.patch35
-rw-r--r--src/angle/patches/0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch12
-rw-r--r--src/angle/patches/0005-Fix-build-when-SSE2-is-not-available.patch18
-rw-r--r--src/angle/patches/0006-Fix-compilation-of-libGLESv2-with-older-MinGW-w64-he.patch12
-rw-r--r--src/angle/patches/0007-Fix-ANGLE-build-with-Microsoft-Visual-Studio-14-CTP.patch14
-rw-r--r--src/angle/patches/0008-ANGLE-Dynamically-load-D3D-compiler-from-a-list-or-t.patch24
-rw-r--r--src/angle/patches/0009-ANGLE-Support-WinRT.patch198
-rw-r--r--src/angle/patches/0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch358
-rw-r--r--src/angle/patches/0011-ANGLE-Fix-compilation-error-on-MinGW-caused-by-trace.patch38
-rw-r--r--src/angle/patches/0012-ANGLE-fix-semantic-index-lookup.patch16
-rw-r--r--src/angle/patches/0013-ANGLE-Add-support-for-querying-platform-device.patch12
-rw-r--r--src/angle/patches/0014-Let-ANGLE-use-multithreaded-devices-if-necessary.patch26
-rw-r--r--src/angle/patches/0015-ANGLE-Fix-angle-d3d11-on-MSVC2010.patch254
-rw-r--r--src/angle/patches/0016-ANGLE-Fix-compilation-with-MinGW-D3D11.patch296
-rw-r--r--src/angle/src/common/common.pri3
-rw-r--r--src/angle/src/compiler/translator.pro8
-rw-r--r--src/angle/src/libGLESv2/libGLESv2.pro19
-rw-r--r--src/corelib/arch/qatomic_mips.h2
-rw-r--r--src/corelib/doc/snippets/code/doc_src_plugins-howto.cpp67
-rw-r--r--src/corelib/doc/snippets/code/doc_src_plugins-howto.pro61
-rw-r--r--src/corelib/doc/snippets/code/doc_src_plugins-howto.qdoc43
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qbitarray.cpp7
-rw-r--r--src/corelib/doc/snippets/plugins/extrafiltersplugin.h65
-rw-r--r--src/corelib/doc/snippets/plugins/interfaces.h114
-rw-r--r--src/corelib/doc/snippets/qprocess-environment/main.cpp2
-rw-r--r--src/corelib/doc/src/objectmodel/properties.qdoc2
-rw-r--r--src/corelib/doc/src/objectmodel/signalsandslots.qdoc11
-rw-r--r--src/corelib/doc/src/plugin-classes.qdoc39
-rw-r--r--src/corelib/doc/src/plugins-howto.qdoc333
-rw-r--r--src/corelib/global/qcompilerdetection.h2
-rw-r--r--src/corelib/global/qglobalstatic.cpp6
-rw-r--r--src/corelib/global/qlogging.cpp112
-rw-r--r--src/corelib/global/qlogging.h29
-rw-r--r--src/corelib/io/qdatastream.cpp6
-rw-r--r--src/corelib/io/qfileselector.cpp4
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.mm1
-rw-r--r--src/corelib/io/qfsfileengine.cpp27
-rw-r--r--src/corelib/io/qloggingcategory.cpp8
-rw-r--r--src/corelib/io/qloggingcategory.h7
-rw-r--r--src/corelib/io/qloggingregistry.cpp6
-rw-r--r--src/corelib/io/qprocess.cpp17
-rw-r--r--src/corelib/io/qsettings.cpp12
-rw-r--r--src/corelib/io/qstorageinfo_unix.cpp12
-rw-r--r--src/corelib/io/qstorageinfo_win.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp11
-rw-r--r--src/corelib/kernel/qvariant.h3
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp12
-rw-r--r--src/corelib/thread/qfuture.qdoc2
-rw-r--r--src/corelib/thread/qthread.cpp2
-rw-r--r--src/corelib/tools/qalgorithms.qdoc2
-rw-r--r--src/corelib/tools/qbitarray.cpp13
-rw-r--r--src/corelib/tools/qdatetime.cpp4
-rw-r--r--src/corelib/tools/qelapsedtimer.cpp2
-rw-r--r--src/corelib/tools/qlist.cpp2
-rw-r--r--src/corelib/tools/qregularexpression.cpp18
-rw-r--r--src/corelib/tools/qscopedpointer.cpp2
-rw-r--r--src/corelib/tools/qshareddata.cpp2
-rw-r--r--src/corelib/tools/qsharedpointer.cpp2
-rw-r--r--src/corelib/tools/qstring.h4
-rw-r--r--src/corelib/tools/qstringiterator.qdoc4
-rw-r--r--src/corelib/tools/qstringlist.cpp6
-rw-r--r--src/corelib/tools/qtimezone.cpp4
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp4
-rw-r--r--src/corelib/xml/qxmlstream.cpp4
-rw-r--r--src/dbus/doc/src/dbus-adaptors.qdoc6
-rw-r--r--src/gui/accessible/qaccessible.cpp15
-rw-r--r--src/gui/doc/src/qtgui.qdoc4
-rw-r--r--src/gui/image/qimage_conversions.cpp3
-rw-r--r--src/gui/kernel/qevent.cpp2
-rw-r--r--src/gui/kernel/qguiapplication.cpp2
-rw-r--r--src/gui/kernel/qopenglcontext.cpp6
-rw-r--r--src/gui/kernel/qwindow.cpp10
-rw-r--r--src/gui/opengl/qopengldebug.cpp10
-rw-r--r--src/gui/opengl/qopenglextensions_p.h15
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp18
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp12
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp6
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.cpp4
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject_p.h10
-rw-r--r--src/gui/painting/qbrush.cpp12
-rw-r--r--src/gui/painting/qpagelayout.cpp2
-rw-r--r--src/gui/painting/qpagesize.cpp6
-rw-r--r--src/gui/painting/qpainter.cpp15
-rw-r--r--src/gui/painting/qregion.cpp33
-rw-r--r--src/gui/painting/qregion.h4
-rw-r--r--src/gui/painting/qtransform.cpp4
-rw-r--r--src/gui/painting/qtransform.h10
-rw-r--r--src/gui/text/qcssparser_p.h111
-rw-r--r--src/gui/text/qglyphrun_p.h7
-rw-r--r--src/gui/text/qtextengine.cpp1
-rw-r--r--src/gui/text/qtextlayout.cpp79
-rw-r--r--src/gui/util/qdesktopservices.cpp2
-rw-r--r--src/network/access/qnetworkaccesscachebackend.cpp6
-rw-r--r--src/network/access/qnetworkaccesscachebackend_p.h1
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp2
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp11
-rw-r--r--src/network/access/qnetworkreplyhttpimpl_p.h1
-rw-r--r--src/network/bearer/qnetworkconfiguration.cpp2
-rw-r--r--src/network/doc/src/network-programming.qdoc2
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp4
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp2
-rw-r--r--src/network/ssl/qsslcertificate_qt.cpp8
-rw-r--r--src/opengl/qglshaderprogram.cpp6
-rw-r--r--src/platformheaders/doc/src/qtplatformheaders.qdoc5
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformintegration.cpp4
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm6
-rw-r--r--src/platformsupport/linuxaccessibility/application.cpp14
-rw-r--r--src/platformsupport/services/genericunix/qgenericunixservices.cpp2
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp21
-rw-r--r--src/plugins/bearer/android/src/main.cpp2
-rw-r--r--src/plugins/bearer/blackberry/main.cpp2
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp4
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp2
-rw-r--r--src/plugins/bearer/connman/qofonoservice_linux.cpp2
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp8
-rw-r--r--src/plugins/platforminputcontexts/compose/main.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/main.cpp2
-rw-r--r--src/plugins/platforms/android/android.pro4
-rw-r--r--src/plugins/platforms/android/androidjnimenu.cpp63
-rw-r--r--src/plugins/platforms/android/androidjnimenu.h4
-rw-r--r--src/plugins/platforms/android/extract-dummy.cpp55
-rw-r--r--src/plugins/platforms/android/extract.cpp21
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp12
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp6
-rw-r--r--src/plugins/platforms/android/qandroidplatformmenu.cpp5
-rw-r--r--src/plugins/platforms/android/qandroidplatformmenu.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm59
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.h7
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm20
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm16
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm46
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.mm2
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm4
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dplatformplugin.cpp2
-rw-r--r--src/plugins/platforms/ios/qiosscreen.h3
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm44
-rw-r--r--src/plugins/platforms/ios/qiostheme.h3
-rw-r--r--src/plugins/platforms/ios/qiostheme.mm10
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.h3
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.mm62
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm3
-rw-r--r--src/plugins/platforms/ios/quiview.h9
-rw-r--r--src/plugins/platforms/ios/quiview.mm13
-rw-r--r--src/plugins/platforms/kms/qkmsbackingstore.cpp1
-rw-r--r--src/plugins/platforms/kms/qkmsbackingstore.h2
-rw-r--r--src/plugins/platforms/kms/qkmscontext.cpp35
-rw-r--r--src/plugins/platforms/kms/qkmscursor.cpp32
-rw-r--r--src/plugins/platforms/kms/qkmscursor.h1
-rw-r--r--src/plugins/platforms/kms/qkmsintegration.cpp42
-rw-r--r--src/plugins/platforms/kms/qkmsintegration.h21
-rw-r--r--src/plugins/platforms/kms/qkmsscreen.cpp3
-rw-r--r--src/plugins/platforms/kms/qkmsscreen.h4
-rw-r--r--src/plugins/platforms/kms/qkmswindow.cpp5
-rw-r--r--src/plugins/platforms/kms/qkmswindow.h3
-rw-r--r--src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxnativeinterface.cpp4
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp2
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp2
-rw-r--r--src/plugins/platforms/windows/main.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp20
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.cpp22
-rw-r--r--src/plugins/platforms/windows/qwindowsscaling.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsservices.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp10
-rw-r--r--src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp1
-rw-r--r--src/plugins/printsupport/cups/main.cpp2
-rw-r--r--src/plugins/printsupport/windows/main.cpp2
-rw-r--r--src/printsupport/kernel/qprint_p.h4
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp3
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp2
-rw-r--r--src/testlib/doc/src/qttestlib-manual.qdoc2
-rw-r--r--src/testlib/qplaintestlogger.cpp4
-rw-r--r--src/testlib/qtestcase.cpp4
-rw-r--r--src/testlib/qtestelementattribute.cpp2
-rw-r--r--src/tools/moc/generator.cpp14
-rw-r--r--src/tools/qdoc/config.cpp2
-rw-r--r--src/tools/qdoc/cppcodeparser.cpp2
-rw-r--r--src/tools/qdoc/doc/qdoc-guide/qtwritingstyle-cpp.qdoc2
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-DITA.qdoc6
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-intro.qdoc2
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc4
-rw-r--r--src/tools/qdoc/helpprojectwriter.cpp8
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp16
-rw-r--r--src/tools/rcc/main.cpp4
-rw-r--r--src/tools/uic/qclass_lib_map.h1
-rw-r--r--src/tools/uic/ui4.cpp14
-rw-r--r--src/tools/uic/uic.cpp2
-rw-r--r--src/widgets/accessible/qaccessiblemenu.cpp2
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp23
-rw-r--r--src/widgets/dialogs/qwizard.cpp2
-rw-r--r--src/widgets/doc/qtwidgets.qdocconf9
-rw-r--r--src/widgets/doc/src/model-view-programming.qdoc22
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/styles.qdoc2
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc8
-rw-r--r--src/widgets/doc/src/widgets-tutorial.qdoc6
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.cpp2
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp3
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp8
-rw-r--r--src/widgets/kernel/qshortcut.cpp2
-rw-r--r--src/widgets/kernel/qsizepolicy.h1
-rw-r--r--src/widgets/kernel/qwidget.cpp16
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp7
-rw-r--r--src/widgets/styles/qandroidstyle.cpp2
-rw-r--r--src/widgets/styles/qfusionstyle.cpp7
-rw-r--r--src/widgets/styles/qgtkstyle.cpp5
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm171
-rw-r--r--src/widgets/styles/qmacstyle_mac_p_p.h16
-rw-r--r--src/widgets/styles/qstyle.cpp5
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp6
-rw-r--r--src/widgets/styles/qwindowscestyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp4
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.cpp2
-rw-r--r--src/widgets/widgets/qmdiarea.cpp7
-rw-r--r--src/widgets/widgets/qmenu.cpp2
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp2
-rw-r--r--tests/auto/corelib/global/qlogging/app/app.pro1
-rw-r--r--tests/auto/corelib/global/qlogging/test/test.pro1
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp73
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp18
-rw-r--r--tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp12
-rw-r--r--tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp13
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp2
-rw-r--r--tests/auto/network/access/spdy/tst_spdy.cpp3
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp98
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp39
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp4
-rw-r--r--tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp2
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/qmdiarea.pro2
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp51
-rw-r--r--tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp25
-rw-r--r--tests/manual/qnetworkreply/main.cpp3
-rw-r--r--tools/configure/configureapp.cpp29
560 files changed, 20464 insertions, 18734 deletions
diff --git a/configure b/configure
index d610759ae2..bfca4fab40 100755
--- a/configure
+++ b/configure
@@ -627,6 +627,7 @@ CFG_PPS=auto
CFG_QNX_IMF=auto
CFG_LGMON=auto
CFG_SYSTEM_PROXIES=no
+CFG_ANDROID_STYLE_ASSETS=yes
# Target architecture
CFG_ARCH=
@@ -699,8 +700,8 @@ RPATH_FLAGS=
W_FLAGS=
QCONFIG_FLAGS=
XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++"
-XPLATFORM_MAC=no
-XPLATFORM_IOS=no
+XPLATFORM_MAC=no # Whether target platform is OS X or iOS
+XPLATFORM_IOS=no # Whether target platform is iOS
XPLATFORM_ANDROID=no
XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*)
XPLATFORM_QNX=no
@@ -2169,6 +2170,13 @@ while [ "$#" -gt 0 ]; do
android-toolchain-version)
CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION="$VAL"
;;
+ android-style-assets)
+ if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+ CFG_ANDROID_STYLE_ASSETS="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
l*) # -lfoo
if [ "$VAL" = "yes" ]; then
L_FLAGS="$L_FLAGS -l\"${VAR#l}\""
@@ -2592,6 +2600,14 @@ Android options:
-android-toolchain-version ..... Sets the android toolchain version
(default $CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION)
+
+ -no-android-style-assets ....... Do not compile in the code which automatically extracts
+ style assets from the run-time device. Setting this will
+ make the Android style behave incorrectly, but will enable
+ compatibility with the LGPL2.1 license.
+ * -android-style-assets .......... Compile the code which automatically extracts style assets
+ from the run-time device. This option will make the
+ Android platform plugin incompatible with the LGPL2.1.
EOF
exit 0
@@ -2853,15 +2869,20 @@ fi
if [ "$Edition" = "OpenSource" ]; then
while true; do
- echo "You are licensed to use this software under the terms of"
- echo "the Lesser GNU General Public License (LGPL) versions 2.1."
- if [ -f "$relpath/LICENSE.LGPLv3" ]; then
+ if [ "$CFG_ANDROID_STYLE_ASSETS" = "no" ] || [ "$XPLATFORM_ANDROID" = "no" ]; then
+ echo "You are licensed to use this software under the terms of"
+ echo "the Lesser GNU General Public License (LGPL) versions 2.1."
echo "You are also licensed to use this software under the terms of"
echo "the GNU Lesser General Public License (LGPL) versions 3."
affix="either"
+ showLGPL2="yes"
else
+ echo "You are licensed to use this software under the terms of"
+ echo "the GNU Lesser General Public License (LGPL) versions 3."
+ showLGPL2="no"
affix="the"
fi
+
echo
if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
echo "You have already accepted the terms of the $EditionString license."
@@ -2870,7 +2891,9 @@ if [ "$Edition" = "OpenSource" ]; then
if [ -f "$relpath/LICENSE.LGPLv3" ]; then
echo "Type '3' to view the GNU Lesser General Public License version 3."
fi
- echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
+ if [ "$showLGPL2" = "yes" ]; then
+ echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
+ fi
echo "Type 'yes' to accept this license offer."
echo "Type 'no' to decline this license offer."
echo
@@ -2886,7 +2909,7 @@ if [ "$Edition" = "OpenSource" ]; then
exit 1
elif [ "$acceptance" = "3" ]; then
more "$relpath/LICENSE.LGPLv3"
- elif [ "$acceptance" = "L" ]; then
+ elif [ "$acceptance" = "L" ] && [ "$showLGPL2" = "yes" ]; then
more "$relpath/LICENSE.LGPLv21"
fi
done
@@ -3147,9 +3170,12 @@ if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG force_debug_info"
fi
+if [ "$XPLATFORM_MAC" = "yes" ]; then
+ [ "$CFG_PKGCONFIG" = "auto" ] && CFG_PKGCONFIG="no"
+fi
+
if [ "$XPLATFORM_IOS" = "yes" ]; then
CFG_RPATH="no"
- CFG_PKGCONFIG="no"
CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS examples"
CFG_SHARED="no" # iOS builds should be static to be able to submit to the App Store
CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtconnectivity qtdoc qtmacextras qtserialport qtwebkit qtwebkit-examples"
@@ -3195,6 +3221,9 @@ if [ "$XPLATFORM_ANDROID" = "yes" ] ; then
esac
QMAKE_CONF_COMPILER=$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/$ANDROID_NDK_TOOLS_PREFIX-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST/bin/$ANDROID_NDK_TOOLS_PREFIX-g++
TEST_COMPILER="$QMAKE_CONF_COMPILER --sysroot=$CFG_DEFAULT_ANDROID_NDK_ROOT/platforms/$CFG_DEFAULT_ANDROID_PLATFORM/$ANDROID_PLATFORM_ARCH/"
+ if [ "$CFG_ANDROID_STYLE_ASSETS" = "yes" ]; then
+ QMAKE_CONFIG="$QMAKE_CONFIG android-style-assets"
+ fi
fi
if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
diff --git a/dist/changes-5.4.0 b/dist/changes-5.4.0
index c26e205bc0..f36145cd90 100644
--- a/dist/changes-5.4.0
+++ b/dist/changes-5.4.0
@@ -24,3 +24,10 @@ QtCore
- Added QEnableSharedFromThis, a class that allows obtaining a
QSharedPointer for an object already managed by a shared pointer.
+
+
+QtSql
+-----
+
+ - qsql ibase: fix memory corruption due to LONG being 4 bytes in firebird.
+ - QSqlDriver::dbmsType(): New method reports DBMS type. Especially useful when using ODBC.
diff --git a/doc/global/externalsites/qt-webpages.qdoc b/doc/global/externalsites/qt-webpages.qdoc
index e94aee0980..fabead9747 100644
--- a/doc/global/externalsites/qt-webpages.qdoc
+++ b/doc/global/externalsites/qt-webpages.qdoc
@@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
- \externalpage http://qt-project.org/
+ \externalpage http://qt.io/
\title Qt Homepage
*/
/*!
@@ -33,11 +33,11 @@
\title Qt Bug Tracker
*/
/*!
- \externalpage http://qt-project.org/downloads
+ \externalpage http://qt.io/download
\title Downloads
*/
/*!
- \externalpage http://qt.digia.com/licensing/
+ \externalpage http://qt.io/licensing/
\title Qt Licensing Overview
*/
/*!
diff --git a/examples/gui/doc/src/openglwindow.qdoc b/examples/gui/doc/src/openglwindow.qdoc
index 614f5060c4..524ed908e8 100644
--- a/examples/gui/doc/src/openglwindow.qdoc
+++ b/examples/gui/doc/src/openglwindow.qdoc
@@ -34,7 +34,7 @@
\image openglwindow-example.png Screenshot of the OpenGLWindow example
- \section1 OpenGLWindow super class
+ \section1 OpenGLWindow Super Class
Our OpenGLWindow class acts as an API which is then subclassed to do the
actual rendering. It has functions to make a request for render() to be
@@ -118,7 +118,7 @@
\snippet openglwindow/openglwindow.cpp 5
- \section1 Example OpenGL rendering sub class
+ \section1 Example OpenGL Rendering Sub Class
Here we sub class OpenGLWindow to show how to do OpenGL to render a
rotating triangle. By indirectly sub classing QOpenGLFunctions we gain
diff --git a/examples/json/savegame/doc/src/savegame.qdoc b/examples/json/savegame/doc/src/savegame.qdoc
index 586c100399..872f2faf42 100644
--- a/examples/json/savegame/doc/src/savegame.qdoc
+++ b/examples/json/savegame/doc/src/savegame.qdoc
@@ -43,7 +43,7 @@
In this example, we'll demonstrate how to save and load a simple game to
and from JSON and binary formats.
- \section1 The Character class
+ \section1 The Character Class
The Character class represents a non-player character (NPC) in our game, and
stores the player's name, level, and class type.
diff --git a/examples/opengl/doc/src/cube.qdoc b/examples/opengl/doc/src/cube.qdoc
index ed1390db1a..23c15f9c43 100644
--- a/examples/opengl/doc/src/cube.qdoc
+++ b/examples/opengl/doc/src/cube.qdoc
@@ -90,7 +90,7 @@
\snippet cube/mainwidget.cpp 2
- \section1 Loading textures from Qt Resource files
+ \section1 Loading Textures from Qt Resource Files
\c QGLWidget interface implements methods for loading textures from QImage to GL
texture memory. We still need to use OpenGL provided functions for specifying
@@ -133,14 +133,14 @@
\snippet cube/geometryengine.cpp 2
- \section1 Perspective projection
+ \section1 Perspective Projection
Using \c QMatrix4x4 helper methods it's really easy to calculate perpective
projection matrix. This matrix is used to project vertices to screen space.
\snippet cube/mainwidget.cpp 5
- \section1 Orientation of the 3D object
+ \section1 Orientation of the 3D Object
Quaternions are handy way to represent orientation of the 3D object. Quaternions
involve quite complex mathematics but fortunately all the necessary mathematics
diff --git a/examples/opengl/qopenglwidget/glwidget.cpp b/examples/opengl/qopenglwidget/glwidget.cpp
index de581f8d47..d39e1992a7 100644
--- a/examples/opengl/qopenglwidget/glwidget.cpp
+++ b/examples/opengl/qopenglwidget/glwidget.cpp
@@ -394,6 +394,11 @@ void GLWidget::paintGL()
}
m_fAngle += 1.0f;
++m_frames;
+
+ // When requested, follow the ideal way to animate: Rely on
+ // blocking swap and just schedule updates continuously.
+ if (!m_mainWindow->timerEnabled())
+ update();
}
void GLWidget::createBubbles(int number)
diff --git a/examples/opengl/qopenglwidget/mainwindow.cpp b/examples/opengl/qopenglwidget/mainwindow.cpp
index 7645c75d8c..a3c8d5edcf 100644
--- a/examples/opengl/qopenglwidget/mainwindow.cpp
+++ b/examples/opengl/qopenglwidget/mainwindow.cpp
@@ -54,6 +54,7 @@ MainWindow::MainWindow()
: m_nextX(1), m_nextY(1)
{
GLWidget *glwidget = new GLWidget(this, true, qRgb(20, 20, 50));
+ m_glWidgets << glwidget;
QLabel *label = new QLabel(this);
m_timer = new QTimer(this);
QSlider *slider = new QSlider(this);
@@ -67,12 +68,19 @@ MainWindow::MainWindow()
"Note that on most systems the swap will block to wait for vsync\n"
"and therefore an interval < 16 ms will likely lead to a 60 FPS update rate.");
QGroupBox *updateGroupBox = new QGroupBox(this);
+ QCheckBox *timerBased = new QCheckBox("Use timer", this);
+ timerBased->setChecked(true);
+ timerBased->setToolTip("Toggles using a timer to trigger update().\n"
+ "When not set, each paintGL() schedules the next update immediately,\n"
+ "expecting the blocking swap to throttle the thread.\n"
+ "This shows how unnecessary the timer is in most cases.");
QCheckBox *transparent = new QCheckBox("Transparent background", this);
transparent->setToolTip("Toggles Qt::WA_AlwaysStackOnTop and transparent clear color for glClear().\n"
"Note how the button on top stacks incorrectly when enabling this.");
QHBoxLayout *updateLayout = new QHBoxLayout;
updateLayout->addWidget(updateLabel);
updateLayout->addWidget(updateInterval);
+ updateLayout->addWidget(timerBased);
updateLayout->addWidget(transparent);
updateGroupBox->setLayout(updateLayout);
@@ -123,6 +131,8 @@ MainWindow::MainWindow()
connect(transparent, &QCheckBox::toggled, glwidget, &GLWidget::setTransparent);
connect(updateInterval, SIGNAL(valueChanged(int)), this, SLOT(updateIntervalChanged(int)));
+ connect(timerBased, &QCheckBox::toggled, this, &MainWindow::timerUsageChanged);
+ connect(timerBased, &QCheckBox::toggled, updateInterval, &QWidget::setEnabled);
m_timer->start();
}
@@ -130,7 +140,8 @@ MainWindow::MainWindow()
void MainWindow::updateIntervalChanged(int value)
{
m_timer->setInterval(value);
- m_timer->start();
+ if (m_timer->isActive())
+ m_timer->start();
}
void MainWindow::addNew()
@@ -138,6 +149,7 @@ void MainWindow::addNew()
if (m_nextY == 4)
return;
GLWidget *w = new GLWidget(this, false, qRgb(qrand() % 256, qrand() % 256, qrand() % 256));
+ m_glWidgets << w;
connect(m_timer, SIGNAL(timeout()), w, SLOT(update()));
m_layout->addWidget(w, m_nextY, m_nextX, 1, 1);
if (m_nextX == 3) {
@@ -147,3 +159,14 @@ void MainWindow::addNew()
++m_nextX;
}
}
+
+void MainWindow::timerUsageChanged(bool enabled)
+{
+ if (enabled) {
+ m_timer->start();
+ } else {
+ m_timer->stop();
+ foreach (QOpenGLWidget *w, m_glWidgets)
+ w->update();
+ }
+}
diff --git a/examples/opengl/qopenglwidget/mainwindow.h b/examples/opengl/qopenglwidget/mainwindow.h
index 9db3e8cbec..353586c42c 100644
--- a/examples/opengl/qopenglwidget/mainwindow.h
+++ b/examples/opengl/qopenglwidget/mainwindow.h
@@ -45,6 +45,8 @@
#include <QTimer>
#include <QGridLayout>
+QT_FORWARD_DECLARE_CLASS(QOpenGLWidget)
+
class MainWindow : public QMainWindow
{
Q_OBJECT
@@ -52,15 +54,18 @@ class MainWindow : public QMainWindow
public:
MainWindow();
void addNew();
+ bool timerEnabled() const { return m_timer->isActive(); }
private slots:
void updateIntervalChanged(int value);
+ void timerUsageChanged(bool enabled);
private:
QTimer *m_timer;
QGridLayout *m_layout;
int m_nextX;
int m_nextY;
+ QVector<QOpenGLWidget *> m_glWidgets;
};
#endif
diff --git a/examples/widgets/doc/src/echoplugin.qdoc b/examples/widgets/doc/src/echoplugin.qdoc
index 103a51cf93..1e10ac3006 100644
--- a/examples/widgets/doc/src/echoplugin.qdoc
+++ b/examples/widgets/doc/src/echoplugin.qdoc
@@ -192,7 +192,7 @@
the platform. By convention the target should have the same name
as the plugin (set with Q_EXPORT_PLUGIN2)
- \section1 Further reading and examples
+ \section1 Further Reading and Examples
The \l {qtplugin-defining-plugins}{Defining Plugins} page presents an overview of the macros needed to
create plugins.
diff --git a/examples/widgets/doc/src/styleplugin.qdoc b/examples/widgets/doc/src/styleplugin.qdoc
index e65ded36a4..2eae6017a5 100644
--- a/examples/widgets/doc/src/styleplugin.qdoc
+++ b/examples/widgets/doc/src/styleplugin.qdoc
@@ -123,7 +123,7 @@
styles folder under stylewindow because this is a path in which Qt
will search for style plugins.
- \section1 Related articles and examples
+ \section1 Related Articles and Examples
In addition to the plugin \l{How to Create Qt Plugins}{overview
document}, we have other examples and articles that concern
diff --git a/examples/widgets/doc/src/tooltips.qdoc b/examples/widgets/doc/src/tooltips.qdoc
index bba19aeac7..4212e62b14 100644
--- a/examples/widgets/doc/src/tooltips.qdoc
+++ b/examples/widgets/doc/src/tooltips.qdoc
@@ -61,7 +61,7 @@
First we will review the \c SortingBox class, then we will take a
look at the \c ShapeItem class.
- \section1 SortingBox Class Definition
+ \section1 SortingBox Class Definition
\snippet widgets/tooltips/sortingbox.h 0
diff --git a/examples/widgets/widgets/mousebuttons/mousebuttons.pro b/examples/widgets/widgets/mousebuttons/mousebuttons.pro
index 99ab9f68ae..e1f4b9527d 100644
--- a/examples/widgets/widgets/mousebuttons/mousebuttons.pro
+++ b/examples/widgets/widgets/mousebuttons/mousebuttons.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
-TARGET = buttontester
+TARGET = mousebuttons
TEMPLATE = app
SOURCES += \
diff --git a/header.LGPL3 b/header.LGPL3
new file mode 100644
index 0000000000..d58f2fe2b2
--- /dev/null
+++ b/header.LGPL3
@@ -0,0 +1,28 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the FOO module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index f9747bb329..8beeba3f39 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -133,11 +133,16 @@ contains(CONFIG, plugin) {
CMAKE_PLUGIN_NAME = $$PLUGIN_CLASS_NAME
win32 {
- isEmpty(CMAKE_STATIC_TYPE): CMAKE_PlUGIN_EXT = .dll
- else: CMAKE_PlUGIN_EXT = .lib
-
- CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}$${CMAKE_PlUGIN_EXT}
- CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d$${CMAKE_PlUGIN_EXT}
+ isEmpty(CMAKE_STATIC_TYPE) {
+ CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}.dll
+ CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d.dll
+ } else:mingw {
+ CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${TARGET}.a
+ CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${TARGET}d.a
+ } else { # MSVC static
+ CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}.lib
+ CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d.lib
+ }
} else {
mac {
isEmpty(CMAKE_STATIC_TYPE): CMAKE_PlUGIN_EXT = .dylib
diff --git a/mkspecs/features/java.prf b/mkspecs/features/java.prf
index 1c55b8974e..1b9754da8a 100644
--- a/mkspecs/features/java.prf
+++ b/mkspecs/features/java.prf
@@ -30,7 +30,7 @@ CONFIG += plugin no_plugin_name_prefix
javac.input = JAVASOURCES
javac.output = $$CLASS_DIR
javac.CONFIG += combine
-javac.commands = javac -source 6 -target 6 -Xlint:unchecked -bootclasspath $$ANDROID_JAR_FILE -cp $$shell_quote($$system_path($$join(JAVACLASSPATH, $$DIRLIST_SEP))) -d $$shell_quote($$CLASS_DIR) ${QMAKE_FILE_IN}
+javac.commands = javac -source 6 -target 6 -Xlint:unchecked -bootclasspath $$ANDROID_JAR_FILE -cp $$shell_quote($$system_path($$join(JAVACLASSPATH, $$DIRLIST_SEPARATOR))) -d $$shell_quote($$CLASS_DIR) ${QMAKE_FILE_IN}
# Force rebuild every time, because we don't know the paths of the destination files
# as they depend on the code.
javac.depends = FORCE
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 71dfcf2912..b1fc248ea0 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -89,12 +89,12 @@ contains(qt_module_deps, qml): \
}
# run qmlimportscanner
- qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner, _SYS)
+ qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner, , system)
for (QMLPATH, QMLPATHS): \
IMPORTPATHS += -importPath $$QMLPATH
- #message(run $$QMLIMPORTSCANNER_SYS $$_PRO_FILE_PWD_ $$IMPORTPATHS)
- JSON = $$system($$QMLIMPORTSCANNER_SYS $$_PRO_FILE_PWD_ $$IMPORTPATHS)
+ #message(run $$QMLIMPORTSCANNER $$_PRO_FILE_PWD_ $$IMPORTPATHS)
+ JSON = $$system($$QMLIMPORTSCANNER $$_PRO_FILE_PWD_ $$IMPORTPATHS)
parseJson(JSON, IMPORTS)| error("Failed to parse qmlimportscanner output.")
diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
index 709248ac1d..a9a622dd1d 100644
--- a/mkspecs/features/qt_functions.prf
+++ b/mkspecs/features/qt_functions.prf
@@ -187,7 +187,7 @@ defineTest(qtAddRpathLink) {
export(QMAKE_RPATHLINKDIR)
}
-# variable, default, [suffix for variable for system() use]
+# variable, default, [suffix for variable for system() use], [prepare primary variable for system() use]
defineTest(qtPrepareTool) {
cmd = $$eval(QT_TOOL.$${2}.binary)
isEmpty(cmd) {
@@ -204,16 +204,18 @@ defineTest(qtPrepareTool) {
}
}
QT_TOOL_ENV += $$eval(QT_TOOL.$${2}.envvars)
- !isEmpty(3) {
+ !isEmpty(3)|!isEmpty(4) {
$$1$$3 =
for (arg, cmd): \
$$1$$3 += $$system_quote($$arg)
qtAddTargetEnv($$1$$3, QT_TOOL.$${2}.depends, system)
}
- $$1 =
- for (arg, cmd): \
- $$1 += $$shell_quote($$arg)
- qtAddTargetEnv($$1, QT_TOOL.$${2}.depends, )
+ isEmpty(4) {
+ $$1 =
+ for (arg, cmd): \
+ $$1 += $$shell_quote($$arg)
+ qtAddTargetEnv($$1, QT_TOOL.$${2}.depends, )
+ }
}
# target variable, list of env var names, [non-empty: prepare for system(), not make]
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index 6ab826771d..8599a47ecd 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -101,8 +101,10 @@ mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) {
FRAMEWORK_HEADERS.version = Versions
FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
FRAMEWORK_HEADERS.path = Headers
+ FRAMEWORK_PRIVATE_HEADERS.version = Versions
FRAMEWORK_PRIVATE_HEADERS.files = $$SYNCQT.PRIVATE_HEADER_FILES
FRAMEWORK_PRIVATE_HEADERS.path = Headers/$$VERSION/$$MODULE_INCNAME/private
+ FRAMEWORK_QPA_HEADERS.version = Versions
FRAMEWORK_QPA_HEADERS.files = $$SYNCQT.QPA_HEADER_FILES
FRAMEWORK_QPA_HEADERS.path = Headers/$$VERSION/$$MODULE_INCNAME/qpa
QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS FRAMEWORK_PRIVATE_HEADERS FRAMEWORK_QPA_HEADERS
diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf
index efa964ca14..baeb22d9b4 100644
--- a/mkspecs/features/qt_module_headers.prf
+++ b/mkspecs/features/qt_module_headers.prf
@@ -12,7 +12,7 @@
load(qt_build_paths)
!build_pass:git_build {
- qtPrepareTool(QMAKE_SYNCQT, syncqt)
+ qtPrepareTool(QMAKE_SYNCQT, syncqt, , system)
minimal_syncqt {
QMAKE_SYNCQT += -minimal $$QMAKE_SYNCQT_OPTIONS
} else {
diff --git a/mkspecs/features/resolve_config.prf b/mkspecs/features/resolve_config.prf
index 7835fe4f7c..b712a2b58e 100644
--- a/mkspecs/features/resolve_config.prf
+++ b/mkspecs/features/resolve_config.prf
@@ -25,10 +25,13 @@ CONFIG(static, static|shared) {
!macx-xcode: \
addExclusiveBuilds(shared, static)
-CONFIG(debug, debug|release): \
+CONFIG(debug, debug|release) {
CONFIG -= release
-else: \
+ !force_debug_plist:debug_and_release: \
+ CONFIG += no_plist
+} else {
CONFIG -= debug
+}
!macx-xcode {
addExclusiveBuilds(debug, release)
diff --git a/mkspecs/features/win32/console.prf b/mkspecs/features/win32/console.prf
index 568d1b1eb5..629f3af59b 100644
--- a/mkspecs/features/win32/console.prf
+++ b/mkspecs/features/win32/console.prf
@@ -1,6 +1,6 @@
CONFIG -= windows
+QMAKE_LFLAGS += $$replace(QMAKE_LFLAGS_CONSOLE, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX)
contains(TEMPLATE, ".*app") {
- QMAKE_LFLAGS += \
- $$replace(QMAKE_LFLAGS_CONSOLE, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX) \
- $$QMAKE_LFLAGS_EXE
+ wince: QMAKE_LFLAGS += /ENTRY:mainACRTStartup
+ QMAKE_LFLAGS += $$QMAKE_LFLAGS_EXE
}
diff --git a/mkspecs/features/win32/windows.prf b/mkspecs/features/win32/windows.prf
index f19a42b7e2..6ea9756f9a 100644
--- a/mkspecs/features/win32/windows.prf
+++ b/mkspecs/features/win32/windows.prf
@@ -1,8 +1,7 @@
CONFIG -= console
-contains(TEMPLATE, ".*app"){
- QMAKE_LFLAGS += \
- $$replace(QMAKE_LFLAGS_WINDOWS, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX) \
- $$QMAKE_LFLAGS_EXE
+QMAKE_LFLAGS += $$replace(QMAKE_LFLAGS_WINDOWS, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX)
+contains(TEMPLATE, ".*app") {
+ QMAKE_LFLAGS += $$QMAKE_LFLAGS_EXE
mingw:DEFINES += QT_NEEDS_QMAIN
qt:for(entryLib, $$list($$unique(QMAKE_LIBS_QT_ENTRY))) {
diff --git a/mkspecs/macx-clang-32/Info.plist.lib b/mkspecs/macx-clang-32/Info.plist.lib
index 63f1a945c2..2a44d1721e 100644
--- a/mkspecs/macx-clang-32/Info.plist.lib
+++ b/mkspecs/macx-clang-32/Info.plist.lib
@@ -6,6 +6,8 @@
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
+ <key>CFBundleVersion</key>
+ <string>@FULL_VERSION@</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
diff --git a/mkspecs/macx-clang/Info.plist.lib b/mkspecs/macx-clang/Info.plist.lib
index 63f1a945c2..2a44d1721e 100644
--- a/mkspecs/macx-clang/Info.plist.lib
+++ b/mkspecs/macx-clang/Info.plist.lib
@@ -6,6 +6,8 @@
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
+ <key>CFBundleVersion</key>
+ <string>@FULL_VERSION@</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
diff --git a/mkspecs/macx-g++-32/Info.plist.lib b/mkspecs/macx-g++-32/Info.plist.lib
index 63f1a945c2..2a44d1721e 100644
--- a/mkspecs/macx-g++-32/Info.plist.lib
+++ b/mkspecs/macx-g++-32/Info.plist.lib
@@ -6,6 +6,8 @@
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
+ <key>CFBundleVersion</key>
+ <string>@FULL_VERSION@</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
diff --git a/mkspecs/macx-g++/Info.plist.lib b/mkspecs/macx-g++/Info.plist.lib
index 63f1a945c2..2a44d1721e 100644
--- a/mkspecs/macx-g++/Info.plist.lib
+++ b/mkspecs/macx-g++/Info.plist.lib
@@ -6,6 +6,8 @@
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
+ <key>CFBundleVersion</key>
+ <string>@FULL_VERSION@</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
diff --git a/mkspecs/macx-g++40/Info.plist.lib b/mkspecs/macx-g++40/Info.plist.lib
index 63f1a945c2..2a44d1721e 100644
--- a/mkspecs/macx-g++40/Info.plist.lib
+++ b/mkspecs/macx-g++40/Info.plist.lib
@@ -6,6 +6,8 @@
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
+ <key>CFBundleVersion</key>
+ <string>@FULL_VERSION@</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
diff --git a/mkspecs/macx-g++42/Info.plist.lib b/mkspecs/macx-g++42/Info.plist.lib
index 63f1a945c2..2a44d1721e 100644
--- a/mkspecs/macx-g++42/Info.plist.lib
+++ b/mkspecs/macx-g++42/Info.plist.lib
@@ -6,6 +6,8 @@
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
+ <key>CFBundleVersion</key>
+ <string>@FULL_VERSION@</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
diff --git a/mkspecs/macx-icc/Info.plist.lib b/mkspecs/macx-icc/Info.plist.lib
index 63f1a945c2..2a44d1721e 100644
--- a/mkspecs/macx-icc/Info.plist.lib
+++ b/mkspecs/macx-icc/Info.plist.lib
@@ -6,6 +6,8 @@
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
+ <key>CFBundleVersion</key>
+ <string>@FULL_VERSION@</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
diff --git a/mkspecs/macx-ios-clang/Info.plist.app b/mkspecs/macx-ios-clang/Info.plist.app
index 0c4220e38f..2987804e33 100755
--- a/mkspecs/macx-ios-clang/Info.plist.app
+++ b/mkspecs/macx-ios-clang/Info.plist.app
@@ -24,6 +24,13 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
</dict>
diff --git a/mkspecs/macx-ios-clang/Info.plist.lib b/mkspecs/macx-ios-clang/Info.plist.lib
index 63f1a945c2..2a44d1721e 100644
--- a/mkspecs/macx-ios-clang/Info.plist.lib
+++ b/mkspecs/macx-ios-clang/Info.plist.lib
@@ -6,6 +6,8 @@
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
+ <key>CFBundleVersion</key>
+ <string>@FULL_VERSION@</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
diff --git a/mkspecs/macx-llvm/Info.plist.lib b/mkspecs/macx-llvm/Info.plist.lib
index 63f1a945c2..2a44d1721e 100644
--- a/mkspecs/macx-llvm/Info.plist.lib
+++ b/mkspecs/macx-llvm/Info.plist.lib
@@ -6,6 +6,8 @@
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
+ <key>CFBundleVersion</key>
+ <string>@FULL_VERSION@</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
diff --git a/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf b/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf
index 3460e28fa4..fb16348487 100644
--- a/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf
+++ b/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf
@@ -12,7 +12,7 @@ CE_ARCH = ARMV4I
DEFINES += STANDARDSHELL_UI_MODEL _WIN32_WCE=0x600 $$CE_ARCH _ARMV4I_ armv4i _ARM_ ARM _M_ARM ARM _WIN32 __arm__
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB /ENTRY:mainACRTStartup
+QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB
QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB /DLL /SAFESEH:NO
QMAKE_LIBFLAGS_RELEASE = /LTCG
diff --git a/mkspecs/wince60standard-x86-msvc2005/qmake.conf b/mkspecs/wince60standard-x86-msvc2005/qmake.conf
index 4314483f7f..417de0d688 100644
--- a/mkspecs/wince60standard-x86-msvc2005/qmake.conf
+++ b/mkspecs/wince60standard-x86-msvc2005/qmake.conf
@@ -12,7 +12,7 @@ CE_ARCH = x86
DEFINES += STANDARDSHELL_UI_MODEL _WIN32_WCE=0x600 $$CE_ARCH _X86_ _M_IX86
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86 /ENTRY:mainACRTStartup
+QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86
QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86 /DLL /SAFESEH:NO
QMAKE_LIBFLAGS_RELEASE = /LTCG
diff --git a/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf b/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf
index fa00f24716..772a514b89 100644
--- a/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf
+++ b/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf
@@ -10,7 +10,7 @@ CE_ARCH = armv4i
DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x700 $$CE_ARCH _AMRV7_ armv7 _ARM_
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB /ENTRY:mainACRTStartup
+QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB
QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB /DLL /SAFESEH:NO
QMAKE_LIBFLAGS_RELEASE = /LTCG
diff --git a/mkspecs/wince70embedded-x86-msvc2008/qmake.conf b/mkspecs/wince70embedded-x86-msvc2008/qmake.conf
index 156f767182..4d995db332 100644
--- a/mkspecs/wince70embedded-x86-msvc2008/qmake.conf
+++ b/mkspecs/wince70embedded-x86-msvc2008/qmake.conf
@@ -9,7 +9,7 @@ CE_ARCH = _TGTCPU
DEFINES += QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x700 $$CE_ARCH _X86_ _M_IX86
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86 /ENTRY:mainACRTStartup
+QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86
QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86 /DLL /SAFESEH:NO
QMAKE_LIBFLAGS_RELEASE = /LTCG
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index dedb491959..cdac770c9d 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -4328,7 +4328,7 @@
This tutorial teaches you the basics of qmake. The other topics in this
manual contain more detailed information about using qmake.
- \section1 Starting off Simple
+ \section1 Starting Off Simple
Let's assume that you have just finished a basic implementation of
your application, and you have created the following files:
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 4c262125a2..e54ddf8ad7 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -306,8 +306,6 @@ UnixMakefileGenerator::init()
}
if(!bundle.isEmpty()) {
project->values("QMAKE_BUNDLE") = ProStringList(bundle);
- project->values("ALL_DEPS") += project->first("QMAKE_PKGINFO");
- project->values("ALL_DEPS") += project->first("QMAKE_BUNDLE_RESOURCE_FILE");
} else {
project->values("QMAKE_BUNDLE").clear();
project->values("QMAKE_BUNDLE_LOCATION").clear();
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 989ec626d3..d9b0e10057 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -430,6 +430,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
}
}
+ QString allDeps;
if (!project->values("QMAKE_APP_FLAG").isEmpty() || project->first("TEMPLATE") == "aux") {
QString destdir = project->first("DESTDIR").toQString();
if(!project->isEmpty("QMAKE_BUNDLE")) {
@@ -490,8 +491,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
deps.prepend(incr_target_dir + " ");
incr_deps = "$(OBJECTS)";
}
- t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << "$(TARGET)"
- << endl << endl;
//real target
t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps << " " << target_deps
@@ -505,9 +504,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\n\t" << var("QMAKE_POST_LINK");
t << endl << endl;
} else {
- t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << "$(TARGET)"
- << endl << endl;
-
t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) "
<< target_deps << " " << var("POST_TARGETDEPS") << "\n\t";
if (project->first("TEMPLATE") != "aux") {
@@ -521,6 +517,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
t << endl << endl;
}
+ allDeps = " $(TARGET)";
} else if(!project->isActiveConfig("staticlib")) {
QString destdir = unescapeFilePath(project->first("DESTDIR").toQString()), incr_deps;
if(!project->isEmpty("QMAKE_BUNDLE")) {
@@ -580,19 +577,15 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
incr_deps = "$(OBJECTS)";
}
- t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ")
- << " " << destdir << "$(TARGET)\n\n";
-
//real target
t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS") << " "
<< incr_deps << " $(SUBLIBS) " << target_deps << " " << var("POST_TARGETDEPS");
} else {
- t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << " " <<
- destdir << "$(TARGET)\n\n";
t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS")
<< " $(OBJECTS) $(SUBLIBS) $(OBJCOMP) " << target_deps
<< " " << var("POST_TARGETDEPS");
}
+ allDeps = ' ' + destdir + "$(TARGET)";
if(!destdir.isEmpty())
t << "\n\t" << mkdir_p_asstring(destdir, false);
if(!project->isEmpty("QMAKE_PRE_LINK"))
@@ -695,9 +688,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
} else {
QString destdir = project->first("DESTDIR").toQString();
- t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << destdir << "$(TARGET) "
- << varGlue("QMAKE_AR_SUBLIBS", destdir, " " + destdir, "") << "\n\n"
- << "staticlib: " << destdir << "$(TARGET)\n\n";
+ allDeps = ' ' + destdir + "$(TARGET)"
+ + varGlue("QMAKE_AR_SUBLIBS", ' ' + destdir, ' ' + destdir, "");
+ t << "staticlib: " << destdir << "$(TARGET)\n\n";
if(project->isEmpty("QMAKE_AR_SUBLIBS")) {
t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS")
<< " $(OBJECTS) $(OBJCOMP) " << var("POST_TARGETDEPS") << "\n\t";
@@ -763,85 +756,111 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< "@$(QMAKE) -prl " << buildArgs() << " " << project->projectFile() << endl;
}
- if(!project->first("QMAKE_PKGINFO").isEmpty()) {
- ProString pkginfo = escapeFilePath(project->first("QMAKE_PKGINFO"));
- QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents";
- t << pkginfo << ": \n\t";
- if(!destdir.isEmpty())
+ if (!project->isEmpty("QMAKE_BUNDLE")) {
+ QHash<QString, QString> symlinks;
+ ProStringList &alldeps = project->values("ALL_DEPS");
+ QString bundle_dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/";
+ if (!project->first("QMAKE_PKGINFO").isEmpty()) {
+ ProString pkginfo = escapeFilePath(project->first("QMAKE_PKGINFO"));
+ bundledFiles << pkginfo;
+ alldeps << pkginfo;
+ QString destdir = bundle_dir + "Contents";
+ t << pkginfo << ": \n\t";
+ if (!destdir.isEmpty())
+ t << mkdir_p_asstring(destdir) << "\n\t";
+ t << "@$(DEL_FILE) " << pkginfo << "\n\t"
+ << "@echo \"APPL"
+ << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO")
+ ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4))
+ << "\" >" << pkginfo << endl;
+ }
+ if (!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) {
+ ProString resources = escapeFilePath(project->first("QMAKE_BUNDLE_RESOURCE_FILE"));
+ bundledFiles << resources;
+ alldeps << resources;
+ QString destdir = bundle_dir + "Contents/Resources";
+ t << resources << ": \n\t";
t << mkdir_p_asstring(destdir) << "\n\t";
- t << "@$(DEL_FILE) " << pkginfo << "\n\t"
- << "@echo \"APPL"
- << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4))
- << "\" >" << pkginfo << endl;
- }
- if(!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) {
- ProString resources = escapeFilePath(project->first("QMAKE_BUNDLE_RESOURCE_FILE"));
- bundledFiles << resources;
- QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources";
- t << resources << ": \n\t";
- t << mkdir_p_asstring(destdir) << "\n\t";
- t << "@touch " << resources << "\n\t\n";
- }
- if(!project->isEmpty("QMAKE_BUNDLE")) {
+ t << "@touch " << resources << "\n\t\n";
+ }
//copy the plist
- QString info_plist = escapeFilePath(fileFixify(project->first("QMAKE_INFO_PLIST").toQString())),
- info_plist_out = escapeFilePath(project->first("QMAKE_INFO_PLIST_OUT").toQString());
- if (info_plist.isEmpty())
- info_plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
- bundledFiles << info_plist_out;
- QString destdir = info_plist_out.section(Option::dir_sep, 0, -2);
- t << info_plist_out << ": \n\t";
- if(!destdir.isEmpty())
- t << mkdir_p_asstring(destdir, false) << "\n\t";
- ProStringList commonSedArgs;
- if (!project->values("VERSION").isEmpty())
- commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" ";
- commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
- QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" ";
- if(project->first("TEMPLATE") == "app") {
- QString icon = fileFixify(var("ICON"));
- QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
- if (bundlePrefix.isEmpty())
- bundlePrefix = "com.yourcompany";
- if (bundlePrefix.endsWith("."))
- bundlePrefix.chop(1);
- QString bundleIdentifier = bundlePrefix + "." + var("QMAKE_BUNDLE");
- if (bundleIdentifier.endsWith(".app"))
- bundleIdentifier.chop(4);
- t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
- << "@sed ";
- foreach (const ProString &arg, commonSedArgs)
- t << arg;
- t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" "
- << "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" "
- << "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" "
- << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
- QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
- << "" << info_plist << " >" << info_plist_out << endl;
- //copy the icon
- if(!project->isEmpty("ICON")) {
- QString dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources/";
- const QString icon_path = escapeFilePath(dir + icon.section(Option::dir_sep, -1));
- bundledFiles << icon_path;
- t << icon_path << ": " << icon << "\n\t"
- << mkdir_p_asstring(dir) << "\n\t"
- << "@$(DEL_FILE) " << icon_path << "\n\t"
- << "@$(COPY_FILE) " << escapeFilePath(icon) << " " << icon_path << endl;
+ while (!project->isActiveConfig("no_plist")) { // 'while' just to be able to 'break'
+ QString info_plist = escapeFilePath(fileFixify(project->first("QMAKE_INFO_PLIST").toQString()));
+ if (info_plist.isEmpty())
+ info_plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
+ if (!exists(Option::fixPathToLocalOS(info_plist))) {
+ warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.",
+ info_plist.toLatin1().constData());
+ break;
}
- } else {
- t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
- << "@sed ";
- foreach (const ProString &arg, commonSedArgs)
- t << arg;
- t << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" "
- << "-e \"s,@TYPEINFO@,"
- << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
- QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
- << "" << info_plist << " >" << info_plist_out << endl;
- }
+ bool isApp = (project->first("TEMPLATE") == "app");
+ QString info_plist_out = escapeFilePath(
+ bundle_dir + (isApp ? "Contents/Info.plist"
+ : "Versions/" + project->first("QMAKE_FRAMEWORK_VERSION")
+ + "/Resources/Info.plist"));
+ bundledFiles << info_plist_out;
+ alldeps << info_plist_out;
+ QString destdir = info_plist_out.section(Option::dir_sep, 0, -2);
+ t << info_plist_out << ": \n\t";
+ if (!destdir.isEmpty())
+ t << mkdir_p_asstring(destdir, false) << "\n\t";
+ ProStringList commonSedArgs;
+ if (!project->values("VERSION").isEmpty()) {
+ commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "."
+ << project->first("VER_MIN") << ",g\" ";
+ commonSedArgs << "-e \"s,@FULL_VERSION@," << project->first("VER_MAJ") << "."
+ << project->first("VER_MIN") << "."
+ << project->first("VER_PAT") << ",g\" ";
+ }
+ commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
+ QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" ";
+ if (isApp) {
+ QString icon = fileFixify(var("ICON"));
+ QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
+ if (bundlePrefix.isEmpty())
+ bundlePrefix = "com.yourcompany";
+ if (bundlePrefix.endsWith("."))
+ bundlePrefix.chop(1);
+ QString bundleIdentifier = bundlePrefix + "." + var("QMAKE_BUNDLE");
+ if (bundleIdentifier.endsWith(".app"))
+ bundleIdentifier.chop(4);
+ t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
+ << "@sed ";
+ foreach (const ProString &arg, commonSedArgs)
+ t << arg;
+ t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" "
+ << "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" "
+ << "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" "
+ << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
+ QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
+ << "" << info_plist << " >" << info_plist_out << endl;
+ //copy the icon
+ if (!project->isEmpty("ICON")) {
+ QString dir = bundle_dir + "Contents/Resources/";
+ const QString icon_path = escapeFilePath(dir + icon.section(Option::dir_sep, -1));
+ bundledFiles << icon_path;
+ alldeps << icon_path;
+ t << icon_path << ": " << icon << "\n\t"
+ << mkdir_p_asstring(dir) << "\n\t"
+ << "@$(DEL_FILE) " << icon_path << "\n\t"
+ << "@$(COPY_FILE) " << escapeFilePath(icon) << " " << icon_path << endl;
+ }
+ } else {
+ symlinks[bundle_dir + "Resources"] = "Versions/Current/Resources";
+ t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
+ << "@sed ";
+ foreach (const ProString &arg, commonSedArgs)
+ t << arg;
+ t << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" "
+ << "-e \"s,@TYPEINFO@,"
+ << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
+ QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
+ << "" << info_plist << " >" << info_plist_out << endl;
+ }
+ break;
+ } // project->isActiveConfig("no_plist")
//copy other data
if(!project->isEmpty("QMAKE_BUNDLE_DATA")) {
- QString bundle_dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/";
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
for(int i = 0; i < bundle_data.count(); i++) {
const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files"));
@@ -851,11 +870,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (!project->isEmpty(vkey)) {
QString version = project->first(vkey) + "/" +
project->first("QMAKE_FRAMEWORK_VERSION") + "/";
- QString link = Option::fixPathToLocalOS(path + project->first(pkey));
- bundledFiles << link;
- t << link << ": \n\t"
- << mkdir_p_asstring(path) << "\n\t"
- << "@$(SYMLINK) " << version << project->first(pkey) << " " << path << endl;
+ ProString name = project->first(pkey);
+ int pos = name.indexOf('/');
+ if (pos > 0)
+ name = name.mid(0, pos);
+ symlinks[Option::fixPathToLocalOS(path + name)] =
+ project->first(vkey) + "/Current/" + name;
path += version;
}
path += project->first(pkey).toQString();
@@ -868,6 +888,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
src = escapeFilePath(src);
const QString dst = escapeFilePath(path + Option::dir_sep + fileInfo(fn).fileName());
bundledFiles << dst;
+ alldeps << dst;
t << dst << ": " << src << "\n\t"
<< mkdir_p_asstring(path) << "\n\t";
QFileInfo fi(fileInfo(fn));
@@ -880,8 +901,21 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
}
}
+ QHash<QString, QString>::ConstIterator symIt = symlinks.constBegin(),
+ symEnd = symlinks.constEnd();
+ for (; symIt != symEnd; ++symIt) {
+ bundledFiles << symIt.key();
+ alldeps << symIt.key();
+ t << symIt.key() << ":\n\t"
+ << mkdir_p_asstring(bundle_dir) << "\n\t"
+ << "@$(SYMLINK) " << symIt.value() << " " << bundle_dir << endl;
+ }
}
+ t << endl << "all: " << escapeDependencyPath(deps)
+ << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")), " \\\n\t\t", " \\\n\t\t", "")
+ << allDeps << endl << endl;
+
t << "dist: distdir FORCE\n\t";
t << "(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar)"
" && $(MOVE) `dirname $(DISTDIR)`" << Option::dir_sep << "$(DISTNAME).tar.gz ."
@@ -1315,44 +1349,6 @@ void UnixMakefileGenerator::init2()
project->values("QMAKE_CFLAGS") += MD_flag;
project->values("QMAKE_CXXFLAGS") += MD_flag;
}
-
- if(!project->isEmpty("QMAKE_BUNDLE")) {
- QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString(), qmake_getpwd());
- if(plist.isEmpty())
- plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
- if(exists(Option::fixPathToLocalOS(plist))) {
- project->values("QMAKE_INFO_PLIST_OUT").append(project->first("DESTDIR") +
- project->first("QMAKE_BUNDLE") +
- "/Contents/Info.plist");
- project->values("ALL_DEPS") += project->first("QMAKE_INFO_PLIST_OUT");
- if(!project->isEmpty("ICON") && project->first("TEMPLATE") == "app")
- project->values("ALL_DEPS") += project->first("DESTDIR") +
- project->first("QMAKE_BUNDLE") +
- "/Contents/Resources/" + project->first("ICON").toQString().section('/', -1);
- if(!project->isEmpty("QMAKE_BUNDLE_DATA")) {
- QString bundle_dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/";
- ProStringList &alldeps = project->values("ALL_DEPS");
- const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
- for(int i = 0; i < bundle_data.count(); i++) {
- const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files"));
- QString path = bundle_dir;
- const ProKey vkey(bundle_data[i] + ".version");
- const ProKey pkey(bundle_data[i] + ".path");
- if (!project->isEmpty(vkey)) {
- alldeps += Option::fixPathToLocalOS(path + Option::dir_sep + project->first(pkey));
- path += project->first(vkey) + "/" +
- project->first("QMAKE_FRAMEWORK_VERSION") + "/";
- }
- path += project->first(pkey);
- path = Option::fixPathToLocalOS(path);
- for(int file = 0; file < files.count(); file++)
- alldeps += path + Option::dir_sep + fileInfo(files[file].toQString()).fileName();
- }
- }
- } else {
- warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.", plist.toLatin1().constData());
- }
- }
}
QString
diff --git a/qmake/generators/win32/cesdkhandler.cpp b/qmake/generators/win32/cesdkhandler.cpp
index 97ee4eca09..f2e6758704 100644
--- a/qmake/generators/win32/cesdkhandler.cpp
+++ b/qmake/generators/win32/cesdkhandler.cpp
@@ -97,7 +97,7 @@ bool CeSdkHandler::parse()
return false;
}
- return m_list.size() > 0 ? true : false;
+ return m_list.size() > 0;
}
QString CeSdkHandler::fixPaths(QString path) const
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index 6311128d70..6751dc0f6b 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -341,7 +341,8 @@ static QStringList unquote(const QStringList &values)
}
// Tree file generation ---------------------------------------------
-void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter) {
+void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName,
+ VCProject &tool, const QString &filter, const QString &filterId) {
if (children.size()) {
// Filter
@@ -362,38 +363,39 @@ void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString
if ((*it)->children.size())
{
if ( !tempFilterName.isEmpty() )
- (*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName);
+ (*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName, filterId);
else
- (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter);
+ (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter, filterId);
}
// Second round, do leafs
for (it = children.constBegin(); it != end; ++it)
if (!(*it)->children.size())
{
if ( !tempFilterName.isEmpty() )
- (*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName);
+ (*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName, filterId);
else
- (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter);
+ (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter, filterId);
}
} else {
// Leaf
xml << tag(_ItemGroup);
xmlFilter << tag(_ItemGroup);
- VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, info, filter);
+ VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, info, filter, filterId);
xmlFilter << closetag();
xml << closetag();
}
}
// Flat file generation ---------------------------------------------
-void XFlatNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &/*tagName*/, VCProject &tool, const QString &filter) {
+void XFlatNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &/*tagName*/,
+ VCProject &tool, const QString &filter, const QString &filterId) {
if (children.size()) {
ChildrenMapFlat::ConstIterator it = children.constBegin();
ChildrenMapFlat::ConstIterator end = children.constEnd();
xml << tag(_ItemGroup);
xmlFilter << tag(_ItemGroup);
for (; it != end; ++it) {
- VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, (*it), filter);
+ VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, (*it), filter, filterId);
}
xml << closetag();
xmlFilter << closetag();
@@ -1836,22 +1838,47 @@ void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutpu
if (!root->hasElements())
return;
- root->generateXML(xml, xmlFilter, "", project, filtername); // output root tree
+ root->generateXML(xml, xmlFilter, "", project, filtername, filtername); // output root tree
}
// Output all configurations (by filtername) for a file (by info)
// A filters config output is in VCFilter.outputFileConfig()
-void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername)
+void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter,
+ const VCFilterFile &info, const QString &filtername,
+ const QString &filterId)
{
// We need to check if the file has any custom build step.
// If there is one then it has to be included with "CustomBuild Include"
- bool fileAdded = false;
+ bool hasCustomBuildStep = false;
+ QVarLengthArray<OutputFilterData> data(project.SingleProjects.count());
+ for (int i = 0; i < project.SingleProjects.count(); ++i) {
+ data[i].filter = project.SingleProjects.at(i).filterByName(filterId);
+ if (!data[i].filter.Config) // only if the filter is not empty
+ continue;
+ VCFilter &filter = data[i].filter;
+
+ // Clearing each filter tool
+ filter.useCustomBuildTool = false;
+ filter.useCompilerTool = false;
+ filter.CustomBuildTool = VCCustomBuildTool();
+ filter.CustomBuildTool.config = filter.Config;
+ filter.CompilerTool = VCCLCompilerTool();
+ filter.CompilerTool.config = filter.Config;
+ VCFilterFile fileInFilter = filter.findFile(info.file, &data[i].inBuild);
+ data[i].inBuild &= !fileInFilter.excludeFromBuild;
+ if (data[i].inBuild && filter.addExtraCompiler(fileInFilter))
+ hasCustomBuildStep = true;
+ }
+
+ bool fileAdded = false;
for (int i = 0; i < project.SingleProjects.count(); ++i) {
- const VCFilter &filter = project.SingleProjects.at(i).filterByName(filtername);
- if (filter.Config) // only if the filter is not empty
- if (outputFileConfig(filter, xml, xmlFilter, info.file, fileAdded)) // only add it once.
- fileAdded = true;
+ const VCFilter &filter = project.SingleProjects.at(i).filterByName(filterId);
+ if (!filter.Config) // only if the filter is not empty
+ continue;
+ if (outputFileConfig(&data[i], xml, xmlFilter, info.file, fileAdded,
+ hasCustomBuildStep))
+ fileAdded = true;
}
if ( !fileAdded )
@@ -1861,42 +1888,25 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml
xmlFilter << closetag();
}
-bool VCXProjectWriter::outputFileConfig(VCFilter filter, XmlOutput &xml, XmlOutput &xmlFilter,
- const QString &filename, bool fileAdded)
+bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter,
+ const QString &filename, bool fileAdded,
+ bool hasCustomBuildStep)
{
- // Clearing each filter tool
- filter.useCustomBuildTool = false;
- filter.useCompilerTool = false;
- filter.CustomBuildTool = VCCustomBuildTool();
- filter.CustomBuildTool.config = filter.Config;
- filter.CompilerTool = VCCLCompilerTool();
- filter.CompilerTool.config = filter.Config;
-
- bool inBuild = false;
- VCFilterFile info;
- for (int i = 0; i < filter.Files.count(); ++i) {
- if (filter.Files.at(i).file == filename) {
- info = filter.Files.at(i);
- inBuild = true;
- }
- }
- inBuild &= !info.excludeFromBuild;
-
- if (inBuild) {
- filter.addExtraCompiler(info);
+ VCFilter &filter = d->filter;
+ if (d->inBuild) {
if (filter.Project->usePCH)
- filter.modifyPCHstage(info.file);
+ filter.modifyPCHstage(filename);
} else {
// Excluded files uses an empty compiler stage
- if(info.excludeFromBuild)
+ if (d->info.excludeFromBuild)
filter.useCompilerTool = true;
}
// Actual XML output ----------------------------------
- if (filter.useCustomBuildTool || filter.useCompilerTool
- || !inBuild || filter.Name.startsWith("Deployment Files")) {
+ if (hasCustomBuildStep || filter.useCompilerTool
+ || !d->inBuild || filter.Name.startsWith("Deployment Files")) {
- if (filter.useCustomBuildTool)
+ if (hasCustomBuildStep)
{
if (!fileAdded) {
fileAdded = true;
@@ -1925,13 +1935,13 @@ bool VCXProjectWriter::outputFileConfig(VCFilter filter, XmlOutput &xml, XmlOutp
}
const QString condition = generateCondition(*filter.Config);
- if(!inBuild) {
+ if (!d->inBuild) {
xml << tag("ExcludedFromBuild")
<< attrTag("Condition", condition)
<< valueTag("true");
}
- if (filter.Name.startsWith("Deployment Files") && inBuild) {
+ if (filter.Name.startsWith("Deployment Files") && d->inBuild) {
xml << tag("DeploymentContent")
<< attrTag("Condition", condition)
<< valueTag("true");
diff --git a/qmake/generators/win32/msbuild_objectmodel.h b/qmake/generators/win32/msbuild_objectmodel.h
index c44897c96a..a562cc364b 100644
--- a/qmake/generators/win32/msbuild_objectmodel.h
+++ b/qmake/generators/win32/msbuild_objectmodel.h
@@ -56,7 +56,8 @@ public:
}
virtual void addElement(const QString &filepath, const VCFilterFile &allInfo) = 0;
virtual void removeElements()= 0;
- virtual void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter) = 0;
+ virtual void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName,
+ VCProject &tool, const QString &filter, const QString &filterId) = 0;
virtual bool hasElements() = 0;
};
@@ -106,7 +107,8 @@ public:
children.clear();
}
- void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter);
+ void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool,
+ const QString &filter, const QString &filterId);
bool hasElements() {
return children.size() != 0;
}
@@ -146,7 +148,8 @@ public:
children.clear();
}
- void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &proj, const QString &filter);
+ void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &proj,
+ const QString &filter, const QString &filterId);
bool hasElements() {
return children.size() != 0;
}
@@ -171,10 +174,17 @@ public:
void write(XmlOutput &, VCFilter &);
private:
+ struct OutputFilterData
+ {
+ VCFilter filter;
+ VCFilterFile info;
+ bool inBuild;
+ };
+
static void addFilters(VCProject &project, XmlOutput &xmlFilter, const QString &filterName);
static void outputFilter(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filtername);
- static void outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername);
- static bool outputFileConfig(VCFilter filter, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, bool fileAdded);
+ static void outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername, const QString &filterId);
+ static bool outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, bool fileAdded, bool hasCustomBuildStep);
static void outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QString &fileName, const QString &filterName);
static QString generateCondition(const VCConfiguration &config);
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 75134d9182..f8e67718f7 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -2241,6 +2241,19 @@ void VCFilter::modifyPCHstage(QString str)
CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)");
}
+VCFilterFile VCFilter::findFile(const QString &filePath, bool *found) const
+{
+ for (int i = 0; i < Files.count(); ++i) {
+ const VCFilterFile &f = Files.at(i);
+ if (f.file == filePath) {
+ *found = true;
+ return f;
+ }
+ }
+ *found = false;
+ return VCFilterFile();
+}
+
bool VCFilter::addExtraCompiler(const VCFilterFile &info)
{
const QStringList &extraCompilers = Project->extraCompilerSources.value(info.file);
@@ -2508,14 +2521,14 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
// XML output functionality
VCProject tempProj;
tempProj.SingleProjects += tool;
- outputFilter(tempProj, xml, "Sources");
- outputFilter(tempProj, xml, "Headers");
- outputFilter(tempProj, xml, "GeneratedFiles");
- outputFilter(tempProj, xml, "LexYaccFiles");
- outputFilter(tempProj, xml, "TranslationFiles");
- outputFilter(tempProj, xml, "FormFiles");
- outputFilter(tempProj, xml, "ResourceFiles");
- outputFilter(tempProj, xml, "DeploymentFiles");
+ outputFilter(tempProj, xml, "Source Files");
+ outputFilter(tempProj, xml, "Header Files");
+ outputFilter(tempProj, xml, "Generated Files");
+ outputFilter(tempProj, xml, "LexYacc Files");
+ outputFilter(tempProj, xml, "Translation Files");
+ outputFilter(tempProj, xml, "Form Files");
+ outputFilter(tempProj, xml, "Resource Files");
+ outputFilter(tempProj, xml, "Deployment Files");
QSet<QString> extraCompilersInProject;
for (int i = 0; i < tool.ExtraCompilersFiles.count(); ++i) {
@@ -2529,7 +2542,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) {
outputFilter(tempProj, xml, tempProj.ExtraCompilers.at(x));
}
- outputFilter(tempProj, xml, "RootFiles");
+ outputFilter(tempProj, xml, "Root Files");
xml << closetag(q_Files)
<< tag(_Globals)
<< data(); // No "/>" end tag
@@ -2561,18 +2574,18 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool)
write(xml, tool.SingleProjects.at(i).Configuration);
xml << closetag(_Configurations)
<< tag(q_Files);
- outputFilter(tool, xml, "Sources");
- outputFilter(tool, xml, "Headers");
- outputFilter(tool, xml, "GeneratedFiles");
- outputFilter(tool, xml, "LexYaccFiles");
- outputFilter(tool, xml, "TranslationFiles");
- outputFilter(tool, xml, "FormFiles");
- outputFilter(tool, xml, "ResourceFiles");
- outputFilter(tool, xml, "DeploymentFiles");
+ outputFilter(tool, xml, "Source Files");
+ outputFilter(tool, xml, "Header Files");
+ outputFilter(tool, xml, "Generated Files");
+ outputFilter(tool, xml, "LexYacc Files");
+ outputFilter(tool, xml, "Translation Files");
+ outputFilter(tool, xml, "Form Files");
+ outputFilter(tool, xml, "Resource Files");
+ outputFilter(tool, xml, "Deployment Files");
for (int x = 0; x < tool.ExtraCompilers.count(); ++x) {
outputFilter(tool, xml, tool.ExtraCompilers.at(x));
}
- outputFilter(tool, xml, "RootFiles");
+ outputFilter(tool, xml, "Root Files");
xml << closetag(q_Files)
<< tag(_Globals)
<< data(); // No "/>" end tag
@@ -2974,14 +2987,8 @@ void VCProjectWriter::outputFileConfig(VCFilter &filter, XmlOutput &xml, const Q
filter.CompilerTool.WarningLevel = warningLevelUnknown;
filter.CompilerTool.config = filter.Config;
- bool inBuild = false;
- VCFilterFile info;
- for (int i = 0; i < filter.Files.count(); ++i) {
- if (filter.Files.at(i).file == filename) {
- info = filter.Files.at(i);
- inBuild = true;
- }
- }
+ bool inBuild;
+ VCFilterFile info = filter.findFile(filename, &inBuild);
inBuild &= !info.excludeFromBuild;
if (inBuild) {
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index ed07b1cca4..850f5f0f57 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -72,12 +72,6 @@ enum DotNET {
forcing the tool to utilize default values.
False/True values will be in the output...
*/
-enum customBuildCheck {
- none,
- mocSrc,
- mocHdr,
- lexyacc
-};
enum triState {
unset = -1,
_False = 0,
@@ -958,6 +952,7 @@ public:
void addFiles(const ProStringList& fileList);
bool addExtraCompiler(const VCFilterFile &info);
void modifyPCHstage(QString str);
+ VCFilterFile findFile(const QString &filePath, bool *found) const;
// Variables
QString Name;
@@ -968,8 +963,6 @@ public:
VCConfiguration* Config;
QList<VCFilterFile> Files;
- customBuildCheck CustomBuild;
-
bool useCustomBuildTool;
VCCustomBuildTool CustomBuildTool;
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 739b5cbb3c..24421c6c28 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -1346,7 +1346,6 @@ void VcprojGenerator::initDeploymentTool()
if (conf.WinRT) {
vcProject.DeploymentFiles.Project = this;
vcProject.DeploymentFiles.Config = &(vcProject.Configuration);
- vcProject.DeploymentFiles.CustomBuild = none;
}
}
}
@@ -1385,7 +1384,6 @@ void VcprojGenerator::initRootFiles()
vcProject.RootFiles.Project = this;
vcProject.RootFiles.Config = &(vcProject.Configuration);
- vcProject.RootFiles.CustomBuild = none;
}
void VcprojGenerator::initSourceFiles()
@@ -1398,7 +1396,6 @@ void VcprojGenerator::initSourceFiles()
vcProject.SourceFiles.Project = this;
vcProject.SourceFiles.Config = &(vcProject.Configuration);
- vcProject.SourceFiles.CustomBuild = none;
}
void VcprojGenerator::initHeaderFiles()
@@ -1450,7 +1447,6 @@ void VcprojGenerator::initLexYaccFiles()
vcProject.LexYaccFiles.Project = this;
vcProject.LexYaccFiles.Config = &(vcProject.Configuration);
- vcProject.LexYaccFiles.CustomBuild = lexyacc;
}
void VcprojGenerator::initTranslationFiles()
@@ -1464,7 +1460,6 @@ void VcprojGenerator::initTranslationFiles()
vcProject.TranslationFiles.Project = this;
vcProject.TranslationFiles.Config = &(vcProject.Configuration);
- vcProject.TranslationFiles.CustomBuild = none;
}
void VcprojGenerator::initFormFiles()
@@ -1476,7 +1471,6 @@ void VcprojGenerator::initFormFiles()
vcProject.FormFiles.addFiles(project->values("FORMS"));
vcProject.FormFiles.Project = this;
vcProject.FormFiles.Config = &(vcProject.Configuration);
- vcProject.FormFiles.CustomBuild = none;
}
void VcprojGenerator::initResourceFiles()
@@ -1526,7 +1520,6 @@ void VcprojGenerator::initResourceFiles()
vcProject.ResourceFiles.Project = this;
vcProject.ResourceFiles.Config = &(vcProject.Configuration);
- vcProject.ResourceFiles.CustomBuild = none;
}
void VcprojGenerator::initExtraCompilerOutputs()
@@ -1603,7 +1596,6 @@ void VcprojGenerator::initExtraCompilerOutputs()
}
extraCompile.Project = this;
extraCompile.Config = &(vcProject.Configuration);
- extraCompile.CustomBuild = none;
vcProject.ExtraCompilersFiles.append(extraCompile);
}
diff --git a/src/3rdparty/angle/AUTHORS b/src/3rdparty/angle/AUTHORS
index 0bdb65ee9a..b79bb5d161 100644
--- a/src/3rdparty/angle/AUTHORS
+++ b/src/3rdparty/angle/AUTHORS
@@ -20,6 +20,7 @@ Intel Corporation
Mozilla Corporation
Turbulenz
Klarälvdalens Datakonsult AB
+Microsoft Open Technologies, Inc.
Jacek Caban
Mark Callow
diff --git a/src/3rdparty/angle/CONTRIBUTORS b/src/3rdparty/angle/CONTRIBUTORS
index 7d152e7abf..0cae10a0f6 100644
--- a/src/3rdparty/angle/CONTRIBUTORS
+++ b/src/3rdparty/angle/CONTRIBUTORS
@@ -59,6 +59,7 @@ Intel Corporation
Jin Yang
Andy Chen
Josh Triplett
+ Sudarsana Nagineni
Klarälvdalens Datakonsult AB
Milian Wolff
@@ -78,3 +79,6 @@ Ulrik Persson (ddefrostt)
Mark Banner (standard8mbp)
David Kilzer
+Microsoft Open Technologies, Inc.
+Cooper Partin
+Austin Kinross
diff --git a/src/3rdparty/angle/include/GLSLANG/ShaderLang.h b/src/3rdparty/angle/include/GLSLANG/ShaderLang.h
index 4b69fb1fb0..b7989f5f7e 100644
--- a/src/3rdparty/angle/include/GLSLANG/ShaderLang.h
+++ b/src/3rdparty/angle/include/GLSLANG/ShaderLang.h
@@ -23,9 +23,10 @@
#define COMPILER_EXPORT
#endif
-#include "KHR/khrplatform.h"
#include <stddef.h>
+#include "KHR/khrplatform.h"
+
//
// This is the platform independent interface between an OGL driver
// and the shading language compiler.
@@ -37,13 +38,17 @@ namespace sh
typedef unsigned int GLenum;
}
+// Must be included after GLenum proxy typedef
+// Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h
+#include "ShaderVars.h"
+
#ifdef __cplusplus
extern "C" {
#endif
// Version number for shader translation API.
// It is incremented every time the API changes.
-#define ANGLE_SH_VERSION 128
+#define ANGLE_SH_VERSION 130
typedef enum {
SH_GLES2_SPEC = 0x8B40,
@@ -100,14 +105,9 @@ typedef enum {
SH_NAME_MAX_LENGTH = 0x6001,
SH_HASHED_NAME_MAX_LENGTH = 0x6002,
SH_HASHED_NAMES_COUNT = 0x6003,
- SH_ACTIVE_UNIFORMS_ARRAY = 0x6004,
- SH_SHADER_VERSION = 0x6005,
- SH_ACTIVE_INTERFACE_BLOCKS_ARRAY = 0x6006,
- SH_ACTIVE_OUTPUT_VARIABLES_ARRAY = 0x6007,
- SH_ACTIVE_ATTRIBUTES_ARRAY = 0x6008,
- SH_ACTIVE_VARYINGS_ARRAY = 0x6009,
- SH_RESOURCES_STRING_LENGTH = 0x600A,
- SH_OUTPUT_TYPE = 0x600B
+ SH_SHADER_VERSION = 0x6004,
+ SH_RESOURCES_STRING_LENGTH = 0x6005,
+ SH_OUTPUT_TYPE = 0x6006
} ShShaderInfo;
// Compile options.
@@ -189,6 +189,11 @@ typedef enum {
// This flag scalarizes vec/ivec/bvec/mat constructor args.
// It is intended as a workaround for Linux/Mac driver bugs.
SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS = 0x40000,
+
+ // This flag overwrites a struct name with a unique prefix.
+ // It is intended as a workaround for drivers that do not handle
+ // struct scopes correctly, including all Mac drivers and Linux AMD.
+ SH_REGENERATE_STRUCT_NAMES = 0x80000,
} ShCompileOptions;
// Defines alternate strategies for implementing array index clamping.
@@ -453,17 +458,17 @@ COMPILER_EXPORT void ShGetNameHashingEntry(const ShHandle handle,
char* name,
char* hashedName);
-// Returns a parameter from a compiled shader.
+// Shader variable inspection.
+// Returns a pointer to a list of variables of the designated type.
+// (See ShaderVars.h for type definitions, included above)
+// Returns NULL on failure.
// Parameters:
// handle: Specifies the compiler
-// 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);
+COMPILER_EXPORT const std::vector<sh::Uniform> *ShGetUniforms(const ShHandle handle);
+COMPILER_EXPORT const std::vector<sh::Varying> *ShGetVaryings(const ShHandle handle);
+COMPILER_EXPORT const std::vector<sh::Attribute> *ShGetAttributes(const ShHandle handle);
+COMPILER_EXPORT const std::vector<sh::Attribute> *ShGetOutputVariables(const ShHandle handle);
+COMPILER_EXPORT const std::vector<sh::InterfaceBlock> *ShGetInterfaceBlocks(const ShHandle handle);
typedef struct
{
diff --git a/src/3rdparty/angle/include/GLSLANG/ShaderVars.h b/src/3rdparty/angle/include/GLSLANG/ShaderVars.h
new file mode 100644
index 0000000000..9c38647dda
--- /dev/null
+++ b/src/3rdparty/angle/include/GLSLANG/ShaderVars.h
@@ -0,0 +1,123 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ShaderVars.h:
+// Types to represent GL variables (varyings, uniforms, etc)
+//
+
+#ifndef _COMPILER_INTERFACE_VARIABLES_
+#define _COMPILER_INTERFACE_VARIABLES_
+
+#include <string>
+#include <vector>
+#include <algorithm>
+
+// Assume ShaderLang.h is included before ShaderVars.h, for sh::GLenum
+// Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h
+
+namespace sh
+{
+
+// Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec
+enum InterpolationType
+{
+ INTERPOLATION_SMOOTH,
+ INTERPOLATION_CENTROID,
+ INTERPOLATION_FLAT
+};
+
+// Uniform block layout qualifier, see section 4.3.8.3 of the ESSL 3.00.4 spec
+enum BlockLayoutType
+{
+ BLOCKLAYOUT_STANDARD,
+ BLOCKLAYOUT_PACKED,
+ BLOCKLAYOUT_SHARED
+};
+
+// Base class for all variables defined in shaders, including Varyings, Uniforms, etc
+// Note: we must override the copy constructor and assignment operator so we can
+// work around excessive GCC binary bloating:
+// See https://code.google.com/p/angleproject/issues/detail?id=697
+struct COMPILER_EXPORT ShaderVariable
+{
+ ShaderVariable();
+ ShaderVariable(GLenum typeIn, unsigned int arraySizeIn);
+ ~ShaderVariable();
+ ShaderVariable(const ShaderVariable &other);
+ ShaderVariable &operator=(const ShaderVariable &other);
+
+ bool isArray() const { return arraySize > 0; }
+ unsigned int elementCount() const { return std::max(1u, arraySize); }
+ bool isStruct() const { return !fields.empty(); }
+
+ GLenum type;
+ GLenum precision;
+ std::string name;
+ std::string mappedName;
+ unsigned int arraySize;
+ bool staticUse;
+ std::vector<ShaderVariable> fields;
+ std::string structName;
+};
+
+struct COMPILER_EXPORT Uniform : public ShaderVariable
+{
+ Uniform();
+ ~Uniform();
+ Uniform(const Uniform &other);
+ Uniform &operator=(const Uniform &other);
+};
+
+struct COMPILER_EXPORT Attribute : public ShaderVariable
+{
+ Attribute();
+ ~Attribute();
+ Attribute(const Attribute &other);
+ Attribute &operator=(const Attribute &other);
+
+ int location;
+};
+
+struct COMPILER_EXPORT InterfaceBlockField : public ShaderVariable
+{
+ InterfaceBlockField();
+ ~InterfaceBlockField();
+ InterfaceBlockField(const InterfaceBlockField &other);
+ InterfaceBlockField &operator=(const InterfaceBlockField &other);
+
+ bool isRowMajorLayout;
+};
+
+struct COMPILER_EXPORT Varying : public ShaderVariable
+{
+ Varying();
+ ~Varying();
+ Varying(const Varying &other);
+ Varying &operator=(const Varying &other);
+
+ InterpolationType interpolation;
+ bool isInvariant;
+};
+
+struct COMPILER_EXPORT InterfaceBlock
+{
+ InterfaceBlock();
+ ~InterfaceBlock();
+ InterfaceBlock(const InterfaceBlock &other);
+ InterfaceBlock &operator=(const InterfaceBlock &other);
+
+ std::string name;
+ std::string mappedName;
+ std::string instanceName;
+ unsigned int arraySize;
+ BlockLayoutType layout;
+ bool isRowMajorLayout;
+ bool staticUse;
+ std::vector<InterfaceBlockField> fields;
+};
+
+}
+
+#endif // _COMPILER_INTERFACE_VARIABLES_
diff --git a/src/3rdparty/angle/include/angle_gl.h b/src/3rdparty/angle/include/angle_gl.h
index 663aa259ea..d093f75ee2 100644
--- a/src/3rdparty/angle/include/angle_gl.h
+++ b/src/3rdparty/angle/include/angle_gl.h
@@ -10,9 +10,6 @@
#ifndef ANGLE_GL_H_
#define ANGLE_GL_H_
-#define GL_GLEXT_PROTOTYPES
-#define GL_APICALL
-
#include "GLES2/gl2.h"
#include "GLES2/gl2ext.h"
#include "GLES3/gl3.h"
diff --git a/src/3rdparty/angle/src/commit.h b/src/3rdparty/angle/src/commit.h
index e1378309a4..a2e761b131 100644
--- a/src/3rdparty/angle/src/commit.h
+++ b/src/3rdparty/angle/src/commit.h
@@ -7,6 +7,6 @@
// This is a default commit hash header, when git is not available.
//
-#define ANGLE_COMMIT_HASH "07d49ef5350a"
+#define ANGLE_COMMIT_HASH "abce76206141"
#define ANGLE_COMMIT_HASH_SIZE 12
-#define ANGLE_COMMIT_DATE "2014-07-25 16:01:42 +0000"
+#define ANGLE_COMMIT_DATE "2014-09-23 19:37:05 +0000"
diff --git a/src/3rdparty/angle/src/common/RefCountObject.h b/src/3rdparty/angle/src/common/RefCountObject.h
index 8635aa59d8..6eeaee1928 100644
--- a/src/3rdparty/angle/src/common/RefCountObject.h
+++ b/src/3rdparty/angle/src/common/RefCountObject.h
@@ -12,11 +12,11 @@
#ifndef COMMON_REFCOUNTOBJECT_H_
#define COMMON_REFCOUNTOBJECT_H_
-#include <cstddef>
+#include "common/debug.h"
#include "angle_gl.h"
-#include "common/debug.h"
+#include <cstddef>
class RefCountObject
{
diff --git a/src/3rdparty/angle/src/common/angleutils.cpp b/src/3rdparty/angle/src/common/angleutils.cpp
new file mode 100644
index 0000000000..2673abf30a
--- /dev/null
+++ b/src/3rdparty/angle/src/common/angleutils.cpp
@@ -0,0 +1,37 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "common/angleutils.h"
+
+#include <vector>
+
+std::string FormatString(const char *fmt, va_list vararg)
+{
+ static std::vector<char> buffer(512);
+
+ // Attempt to just print to the current buffer
+ int len = vsnprintf(&buffer[0], buffer.size(), fmt, vararg);
+ if (len < 0 || static_cast<size_t>(len) >= buffer.size())
+ {
+ // Buffer was not large enough, calculate the required size and resize the buffer
+ len = vsnprintf(NULL, 0, fmt, vararg);
+ buffer.resize(len + 1);
+
+ // Print again
+ vsnprintf(&buffer[0], buffer.size(), fmt, vararg);
+ }
+
+ return std::string(buffer.data(), len);
+}
+
+std::string FormatString(const char *fmt, ...)
+{
+ va_list vararg;
+ va_start(vararg, fmt);
+ std::string result = FormatString(fmt, vararg);
+ va_end(vararg);
+ return result;
+}
diff --git a/src/3rdparty/angle/src/common/angleutils.h b/src/3rdparty/angle/src/common/angleutils.h
index d94b4f5ff9..ddbbd5f501 100644
--- a/src/3rdparty/angle/src/common/angleutils.h
+++ b/src/3rdparty/angle/src/common/angleutils.h
@@ -16,6 +16,7 @@
#include <string>
#include <set>
#include <sstream>
+#include <cstdarg>
// A macro to disallow the copy constructor and operator= functions
// This must be used in the private: declarations for a class
@@ -23,8 +24,8 @@
TypeName(const TypeName&); \
void operator=(const TypeName&)
-template <typename T, unsigned int N>
-inline unsigned int ArraySize(T(&)[N])
+template <typename T, size_t N>
+inline size_t ArraySize(T(&)[N])
{
return N;
}
@@ -131,6 +132,9 @@ inline std::string Str(int i)
return strstr.str();
}
+std::string FormatString(const char *fmt, va_list vararg);
+std::string FormatString(const char *fmt, ...);
+
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
diff --git a/src/3rdparty/angle/src/common/blocklayout.cpp b/src/3rdparty/angle/src/common/blocklayout.cpp
index 7db6e980f1..e3b2d43566 100644
--- a/src/3rdparty/angle/src/common/blocklayout.cpp
+++ b/src/3rdparty/angle/src/common/blocklayout.cpp
@@ -8,7 +8,6 @@
//
#include "common/blocklayout.h"
-#include "common/shadervars.h"
#include "common/mathutil.h"
#include "common/utilities.h"
@@ -20,46 +19,7 @@ BlockLayoutEncoder::BlockLayoutEncoder()
{
}
-void BlockLayoutEncoder::encodeInterfaceBlockFields(const std::vector<InterfaceBlockField> &fields)
-{
- for (unsigned int fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
- {
- const InterfaceBlockField &variable = fields[fieldIndex];
-
- if (variable.fields.size() > 0)
- {
- const unsigned int elementCount = std::max(1u, variable.arraySize);
-
- for (unsigned int elementIndex = 0; elementIndex < elementCount; elementIndex++)
- {
- enterAggregateType();
- encodeInterfaceBlockFields(variable.fields);
- exitAggregateType();
- }
- }
- else
- {
- encodeInterfaceBlockField(variable);
- }
- }
-}
-
-BlockMemberInfo BlockLayoutEncoder::encodeInterfaceBlockField(const InterfaceBlockField &field)
-{
- int arrayStride;
- int matrixStride;
-
- ASSERT(field.fields.empty());
- getBlockLayoutInfo(field.type, field.arraySize, field.isRowMajorMatrix, &arrayStride, &matrixStride);
-
- const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, field.isRowMajorMatrix);
-
- advanceOffset(field.type, field.arraySize, field.isRowMajorMatrix, arrayStride, matrixStride);
-
- return memberInfo;
-}
-
-void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix)
+BlockMemberInfo BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix)
{
int arrayStride;
int matrixStride;
@@ -69,6 +29,8 @@ void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool is
const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, isRowMajorMatrix);
advanceOffset(type, arraySize, isRowMajorMatrix, arrayStride, matrixStride);
+
+ return memberInfo;
}
void BlockLayoutEncoder::nextRegister()
diff --git a/src/3rdparty/angle/src/common/blocklayout.h b/src/3rdparty/angle/src/common/blocklayout.h
index 3a1ab5ccb0..d46ac6e547 100644
--- a/src/3rdparty/angle/src/common/blocklayout.h
+++ b/src/3rdparty/angle/src/common/blocklayout.h
@@ -10,10 +10,11 @@
#ifndef COMMON_BLOCKLAYOUT_H_
#define COMMON_BLOCKLAYOUT_H_
+#include <cstddef>
#include <vector>
+
#include "angle_gl.h"
#include <GLSLANG/ShaderLang.h>
-#include <cstddef>
namespace sh
{
@@ -48,9 +49,7 @@ class BlockLayoutEncoder
public:
BlockLayoutEncoder();
- void encodeInterfaceBlockFields(const std::vector<InterfaceBlockField> &fields);
- BlockMemberInfo encodeInterfaceBlockField(const InterfaceBlockField &field);
- void encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix);
+ BlockMemberInfo encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix);
size_t getBlockSize() const { return mCurrentOffset * BytesPerComponent; }
size_t getCurrentRegister() const { return mCurrentOffset / ComponentsPerRegister; }
diff --git a/src/3rdparty/angle/src/common/debug.cpp b/src/3rdparty/angle/src/common/debug.cpp
index d6eecf7157..dcad327564 100644
--- a/src/3rdparty/angle/src/common/debug.cpp
+++ b/src/3rdparty/angle/src/common/debug.cpp
@@ -8,6 +8,7 @@
#include "common/debug.h"
#include "common/platform.h"
+#include "common/angleutils.h"
#include <stdarg.h>
#include <vector>
@@ -25,22 +26,7 @@ typedef void (*PerfOutputFunction)(unsigned int, const wchar_t*);
static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
{
#if defined(ANGLE_ENABLE_PERF) || defined(ANGLE_ENABLE_TRACE)
- static std::vector<char> asciiMessageBuffer(512);
-
- // Attempt to just print to the current buffer
- int len = vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
- if (len < 0 || static_cast<size_t>(len) >= asciiMessageBuffer.size())
- {
- // Buffer was not large enough, calculate the required size and resize the buffer
- len = vsnprintf(NULL, 0, format, vararg);
- asciiMessageBuffer.resize(len + 1);
-
- // Print again
- vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
- }
-
- // NULL terminate the buffer to be safe
- asciiMessageBuffer[len] = '\0';
+ std::string formattedMessage = FormatString(format, vararg);
#endif
#if defined(ANGLE_ENABLE_PERF)
@@ -48,12 +34,12 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c
{
// The perf function only accepts wide strings, widen the ascii message
static std::wstring wideMessage;
- if (wideMessage.capacity() < asciiMessageBuffer.size())
+ if (wideMessage.capacity() < formattedMessage.length())
{
- wideMessage.reserve(asciiMessageBuffer.size());
+ wideMessage.reserve(formattedMessage.size());
}
- wideMessage.assign(asciiMessageBuffer.begin(), asciiMessageBuffer.begin() + len);
+ wideMessage.assign(formattedMessage.begin(), formattedMessage.end());
perfFunc(0, wideMessage.c_str());
}
@@ -70,7 +56,7 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c
static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
if (file)
{
- file.write(&asciiMessageBuffer[0], len);
+ file.write(formattedMessage.c_str(), formattedMessage.length());
file.flush();
}
diff --git a/src/3rdparty/angle/src/common/debug.h b/src/3rdparty/angle/src/common/debug.h
index 997ebca6be..bf2bca8f24 100644
--- a/src/3rdparty/angle/src/common/debug.h
+++ b/src/3rdparty/angle/src/common/debug.h
@@ -91,6 +91,10 @@ namespace gl
// A macro to indicate unimplemented functionality
+#if defined (ANGLE_TEST_CONFIG)
+#define NOASSERT_UNIMPLEMENTED 1
+#endif
+
// Define NOASSERT_UNIMPLEMENTED to non zero to skip the assert fail in the unimplemented checks
// This will allow us to test with some automated test suites (eg dEQP) without crashing
#ifndef NOASSERT_UNIMPLEMENTED
diff --git a/src/3rdparty/angle/src/common/event_tracer.cpp b/src/3rdparty/angle/src/common/event_tracer.cpp
deleted file mode 100644
index 353c69d05c..0000000000
--- a/src/3rdparty/angle/src/common/event_tracer.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "common/event_tracer.h"
-
-namespace gl
-{
-
-GetCategoryEnabledFlagFunc g_getCategoryEnabledFlag;
-AddTraceEventFunc g_addTraceEvent;
-
-} // namespace gl
-
-extern "C" {
-
-void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
- AddTraceEventFunc addTraceEvent)
-{
- gl::g_getCategoryEnabledFlag = getCategoryEnabledFlag;
- gl::g_addTraceEvent = addTraceEvent;
-}
-
-} // extern "C"
-
-namespace gl
-{
-
-const unsigned char* TraceGetTraceCategoryEnabledFlag(const char* name)
-{
- if (g_getCategoryEnabledFlag)
- {
- return g_getCategoryEnabledFlag(name);
- }
- static unsigned char disabled = 0;
- return &disabled;
-}
-
-void TraceAddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name, unsigned long long id,
- int numArgs, const char** argNames, const unsigned char* argTypes,
- const unsigned long long* argValues, unsigned char flags)
-{
- if (g_addTraceEvent)
- {
- g_addTraceEvent(phase, categoryGroupEnabled, name, id, numArgs, argNames, argTypes, argValues, flags);
- }
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/common/event_tracer.h b/src/3rdparty/angle/src/common/event_tracer.h
deleted file mode 100644
index fa97435faa..0000000000
--- a/src/3rdparty/angle/src/common/event_tracer.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMMON_EVENT_TRACER_H_
-#define COMMON_EVENT_TRACER_H_
-
-#include "common/platform.h"
-
-#if !defined(TRACE_ENTRY)
-# ifdef ANGLE_PLATFORM_WINDOWS
-# define TRACE_ENTRY __stdcall
-# else
-# define TRACE_ENTRY
-# endif // ANGLE_PLATFORM_WINDOWS
-#endif //TRACE_ENTRY
-
-extern "C" {
-
-typedef const unsigned char* (*GetCategoryEnabledFlagFunc)(const char* name);
-typedef void (*AddTraceEventFunc)(char phase, const unsigned char* categoryGroupEnabled, const char* name,
- unsigned long long id, int numArgs, const char** argNames,
- const unsigned char* argTypes, const unsigned long long* argValues,
- unsigned char flags);
-
-// extern "C" so that it has a reasonable name for GetProcAddress.
-void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc get_category_enabled_flag,
- AddTraceEventFunc add_trace_event_func);
-
-}
-
-namespace gl
-{
-
-const unsigned char* TraceGetTraceCategoryEnabledFlag(const char* name);
-
-void TraceAddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name, unsigned long long id,
- int numArgs, const char** argNames, const unsigned char* argTypes,
- const unsigned long long* argValues, unsigned char flags);
-
-}
-
-#endif // COMMON_EVENT_TRACER_H_
diff --git a/src/3rdparty/angle/src/common/mathutil.cpp b/src/3rdparty/angle/src/common/mathutil.cpp
index 20b3f0c113..496633632b 100644
--- a/src/3rdparty/angle/src/common/mathutil.cpp
+++ b/src/3rdparty/angle/src/common/mathutil.cpp
@@ -7,6 +7,7 @@
// mathutil.cpp: Math and bit manipulation functions.
#include "common/mathutil.h"
+
#include <algorithm>
#include <math.h>
diff --git a/src/3rdparty/angle/src/common/mathutil.h b/src/3rdparty/angle/src/common/mathutil.h
index f32663fa02..52f2bc1c0e 100644
--- a/src/3rdparty/angle/src/common/mathutil.h
+++ b/src/3rdparty/angle/src/common/mathutil.h
@@ -505,21 +505,33 @@ inline unsigned int averageFloat10(unsigned int a, unsigned int b)
namespace rx
{
+template <typename T>
struct Range
{
Range() {}
- Range(int lo, int hi) : start(lo), end(hi) { ASSERT(lo <= hi); }
+ Range(T lo, T hi) : start(lo), end(hi) { ASSERT(lo <= hi); }
+
+ T start;
+ T end;
- int start;
- int end;
+ T length() const { return end - start; }
};
+typedef Range<int> RangeI;
+typedef Range<unsigned int> RangeUI;
+
template <typename T>
T roundUp(const T value, const T alignment)
{
return value + alignment - 1 - (value - 1) % alignment;
}
+inline unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor)
+{
+ unsigned int divided = value / divisor;
+ return (divided + ((value % divisor == 0) ? 0 : 1));
+}
+
template <class T>
inline bool IsUnsignedAdditionSafe(T lhs, T rhs)
{
diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
index 44c5c7c03b..b53394f337 100644
--- a/src/3rdparty/angle/src/common/platform.h
+++ b/src/3rdparty/angle/src/common/platform.h
@@ -52,6 +52,9 @@
# if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_PERF)
# include <d3d9.h>
+# if !defined(COMPILER_IMPLEMENTATION)
+# include <d3dcompiler.h>
+# endif
# endif
# if defined(ANGLE_ENABLE_D3D11)
@@ -61,16 +64,25 @@
# include <dxgi.h>
# if _MSC_VER >= 1700
# include <dxgi1_2.h>
+# endif
+# if !defined(COMPILER_IMPLEMENTATION)
# include <d3dcompiler.h>
# endif
+# if defined(__MINGW32__)
+typedef enum D3D11_MAP_FLAG
+{
+ D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000L
+} D3D11_MAP_FLAG;
+typedef struct D3D11_QUERY_DATA_SO_STATISTICS
+{
+ UINT64 NumPrimitivesWritten;
+ UINT64 PrimitivesStorageNeeded;
+} D3D11_QUERY_DATA_SO_STATISTICS;
+# endif
# endif
# undef near
# undef far
-# undef NEAR
-# define NEAR
-# undef FAR
-# define FAR
#endif
#endif // COMMON_PLATFORM_H_
diff --git a/src/3rdparty/angle/src/common/shadervars.h b/src/3rdparty/angle/src/common/shadervars.h
deleted file mode 100644
index 0442d81500..0000000000
--- a/src/3rdparty/angle/src/common/shadervars.h
+++ /dev/null
@@ -1,157 +0,0 @@
-//
-// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// shadervars.h:
-// Types to represent GL variables (varyings, uniforms, etc)
-//
-
-#ifndef COMMON_SHADERVARIABLE_H_
-#define COMMON_SHADERVARIABLE_H_
-
-#include <string>
-#include <vector>
-#include <algorithm>
-#include "GLSLANG/ShaderLang.h"
-
-namespace sh
-{
-
-// Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec
-enum InterpolationType
-{
- INTERPOLATION_SMOOTH,
- INTERPOLATION_CENTROID,
- INTERPOLATION_FLAT
-};
-
-// Uniform block layout qualifier, see section 4.3.8.3 of the ESSL 3.00.4 spec
-enum BlockLayoutType
-{
- BLOCKLAYOUT_STANDARD,
- BLOCKLAYOUT_PACKED,
- BLOCKLAYOUT_SHARED
-};
-
-// Base class for all variables defined in shaders, including Varyings, Uniforms, etc
-struct ShaderVariable
-{
- ShaderVariable()
- : type(0),
- precision(0),
- arraySize(0),
- staticUse(false)
- {}
-
- ShaderVariable(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn)
- : type(typeIn),
- precision(precisionIn),
- name(nameIn),
- arraySize(arraySizeIn),
- staticUse(false)
- {}
-
- bool isArray() const { return arraySize > 0; }
- unsigned int elementCount() const { return std::max(1u, arraySize); }
-
- GLenum type;
- GLenum precision;
- std::string name;
- std::string mappedName;
- unsigned int arraySize;
- bool staticUse;
-};
-
-struct Uniform : public ShaderVariable
-{
- Uniform()
- {}
-
- Uniform(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn)
- : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn)
- {}
-
- bool isStruct() const { return !fields.empty(); }
-
- std::vector<Uniform> fields;
-};
-
-struct Attribute : public ShaderVariable
-{
- Attribute()
- : location(-1)
- {}
-
- Attribute(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, int locationIn)
- : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
- location(locationIn)
- {}
-
- int location;
-};
-
-struct InterfaceBlockField : public ShaderVariable
-{
- InterfaceBlockField()
- : isRowMajorMatrix(false)
- {}
-
- InterfaceBlockField(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, bool isRowMajorMatrix)
- : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
- isRowMajorMatrix(isRowMajorMatrix)
- {}
-
- bool isStruct() const { return !fields.empty(); }
-
- bool isRowMajorMatrix;
- std::vector<InterfaceBlockField> fields;
-};
-
-struct Varying : public ShaderVariable
-{
- Varying()
- : interpolation(INTERPOLATION_SMOOTH)
- {}
-
- Varying(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, InterpolationType interpolationIn)
- : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
- interpolation(interpolationIn)
- {}
-
- bool isStruct() const { return !fields.empty(); }
-
- InterpolationType interpolation;
- std::vector<Varying> fields;
- std::string structName;
-};
-
-struct InterfaceBlock
-{
- InterfaceBlock()
- : arraySize(0),
- layout(BLOCKLAYOUT_PACKED),
- isRowMajorLayout(false),
- staticUse(false)
- {}
-
- InterfaceBlock(const char *name, unsigned int arraySize)
- : name(name),
- arraySize(arraySize),
- layout(BLOCKLAYOUT_SHARED),
- isRowMajorLayout(false),
- staticUse(false)
- {}
-
- std::string name;
- std::string mappedName;
- unsigned int arraySize;
- BlockLayoutType layout;
- bool isRowMajorLayout;
- bool staticUse;
- std::vector<InterfaceBlockField> fields;
-};
-
-}
-
-#endif // COMMON_SHADERVARIABLE_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/BaseTypes.h b/src/3rdparty/angle/src/compiler/translator/BaseTypes.h
index ba9ef5e609..324b0669f4 100644
--- a/src/3rdparty/angle/src/compiler/translator/BaseTypes.h
+++ b/src/3rdparty/angle/src/compiler/translator/BaseTypes.h
@@ -69,40 +69,9 @@ enum TBasicType
EbtStruct,
EbtInterfaceBlock,
EbtAddress, // should be deprecated??
- EbtInvariant // used as a type when qualifying a previously declared variable as being invariant
};
-inline const char* getBasicString(TBasicType t)
-{
- switch (t)
- {
- case EbtVoid: return "void"; break;
- case EbtFloat: return "float"; break;
- case EbtInt: return "int"; break;
- case EbtUInt: return "uint"; break;
- case EbtBool: return "bool"; break;
- case EbtSampler2D: return "sampler2D"; break;
- case EbtSampler3D: return "sampler3D"; break;
- case EbtSamplerCube: return "samplerCube"; break;
- case EbtSamplerExternalOES: return "samplerExternalOES"; break;
- case EbtSampler2DRect: return "sampler2DRect"; break;
- case EbtSampler2DArray: return "sampler2DArray"; break;
- case EbtISampler2D: return "isampler2D"; break;
- case EbtISampler3D: return "isampler3D"; break;
- case EbtISamplerCube: return "isamplerCube"; break;
- case EbtISampler2DArray: return "isampler2DArray"; break;
- case EbtUSampler2D: return "usampler2D"; break;
- case EbtUSampler3D: return "usampler3D"; break;
- case EbtUSamplerCube: return "usamplerCube"; break;
- case EbtUSampler2DArray: return "usampler2DArray"; break;
- case EbtSampler2DShadow: return "sampler2DShadow"; break;
- case EbtSamplerCubeShadow: return "samplerCubeShadow"; break;
- case EbtSampler2DArrayShadow: return "sampler2DArrayShadow"; break;
- case EbtStruct: return "structure"; break;
- case EbtInterfaceBlock: return "interface block"; break;
- default: return "unknown type";
- }
-}
+const char* getBasicString(TBasicType t);
inline bool IsSampler(TBasicType type)
{
diff --git a/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h
index 926b6bed69..c6bf77c386 100644
--- a/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h
+++ b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h
@@ -8,7 +8,7 @@
#define COMPILIER_BUILT_IN_FUNCTION_EMULATOR_H_
#include "compiler/translator/InfoSink.h"
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
//
// This class decides which built-in functions need to be replaced with the
diff --git a/src/3rdparty/angle/src/compiler/translator/Compiler.cpp b/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
index 0606c72e39..368cd2ae4a 100644
--- a/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
@@ -12,6 +12,7 @@
#include "compiler/translator/InitializeParseContext.h"
#include "compiler/translator/InitializeVariables.h"
#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/RegenerateStructNames.h"
#include "compiler/translator/RenameFunction.h"
#include "compiler/translator/ScalarizeVecAndMatConstructorArgs.h"
#include "compiler/translator/UnfoldShortCircuitAST.h"
@@ -257,10 +258,17 @@ bool TCompiler::compile(const char* const shaderStrings[],
if (success && (compileOptions & SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS))
{
- ScalarizeVecAndMatConstructorArgs scalarizer;
+ ScalarizeVecAndMatConstructorArgs scalarizer(
+ shaderType, fragmentPrecisionHigh);
root->traverse(&scalarizer);
}
+ if (success && (compileOptions & SH_REGENERATE_STRUCT_NAMES))
+ {
+ RegenerateStructNames gen(symbolTable, shaderVersion);
+ root->traverse(&gen);
+ }
+
if (success && (compileOptions & SH_INTERMEDIATE_TREE))
intermediate.outputTree(root);
@@ -494,18 +502,18 @@ bool TCompiler::enforceVertexShaderTimingRestrictions(TIntermNode* root)
void TCompiler::collectVariables(TIntermNode* root)
{
- CollectVariables collect(&attributes,
- &outputVariables,
- &uniforms,
- &varyings,
- &interfaceBlocks,
- hashFunction);
+ sh::CollectVariables collect(&attributes,
+ &outputVariables,
+ &uniforms,
+ &varyings,
+ &interfaceBlocks,
+ hashFunction);
root->traverse(&collect);
// For backwards compatiblity with ShGetVariableInfo, expand struct
// uniforms and varyings into separate variables for each field.
- ExpandVariables(uniforms, &expandedUniforms);
- ExpandVariables(varyings, &expandedVaryings);
+ sh::ExpandVariables(uniforms, &expandedUniforms);
+ sh::ExpandVariables(varyings, &expandedVaryings);
}
bool TCompiler::enforcePackingRestrictions()
diff --git a/src/3rdparty/angle/src/compiler/translator/Compiler.h b/src/3rdparty/angle/src/compiler/translator/Compiler.h
index 5eac2d89d1..ca0c157884 100644
--- a/src/3rdparty/angle/src/compiler/translator/Compiler.h
+++ b/src/3rdparty/angle/src/compiler/translator/Compiler.h
@@ -71,9 +71,9 @@ class TCompiler : public TShHandleBase
const std::vector<sh::Attribute> &getAttributes() const { return attributes; }
const std::vector<sh::Attribute> &getOutputVariables() const { return outputVariables; }
const std::vector<sh::Uniform> &getUniforms() const { return uniforms; }
- const std::vector<sh::Uniform> &getExpandedUniforms() const { return expandedUniforms; }
+ const std::vector<sh::ShaderVariable> &getExpandedUniforms() const { return expandedUniforms; }
const std::vector<sh::Varying> &getVaryings() const { return varyings; }
- const std::vector<sh::Varying> &getExpandedVaryings() const { return expandedVaryings; }
+ const std::vector<sh::ShaderVariable> &getExpandedVaryings() const { return expandedVaryings; }
const std::vector<sh::InterfaceBlock> &getInterfaceBlocks() const { return interfaceBlocks; }
ShHashFunction64 getHashFunction() const { return hashFunction; }
@@ -83,6 +83,9 @@ class TCompiler : public TShHandleBase
ShShaderOutput getOutputType() const { return outputType; }
std::string getBuiltInResourcesString() const { return builtInResourcesString; }
+ // Get the resources set by InitBuiltInSymbolTable
+ const ShBuiltInResources& getResources() const;
+
protected:
sh::GLenum getShaderType() const { return shaderType; }
// Initialize symbol-table with built-in symbols.
@@ -128,8 +131,6 @@ class TCompiler : public TShHandleBase
bool limitExpressionComplexity(TIntermNode* root);
// 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;
@@ -138,9 +139,9 @@ class TCompiler : public TShHandleBase
std::vector<sh::Attribute> attributes;
std::vector<sh::Attribute> outputVariables;
std::vector<sh::Uniform> uniforms;
- std::vector<sh::Uniform> expandedUniforms;
+ std::vector<sh::ShaderVariable> expandedUniforms;
std::vector<sh::Varying> varyings;
- std::vector<sh::Varying> expandedVaryings;
+ std::vector<sh::ShaderVariable> expandedVaryings;
std::vector<sh::InterfaceBlock> interfaceBlocks;
private:
diff --git a/src/3rdparty/angle/src/compiler/translator/DetectCallDepth.h b/src/3rdparty/angle/src/compiler/translator/DetectCallDepth.h
index cb76f1de02..86810650dc 100644
--- a/src/3rdparty/angle/src/compiler/translator/DetectCallDepth.h
+++ b/src/3rdparty/angle/src/compiler/translator/DetectCallDepth.h
@@ -8,7 +8,7 @@
#define COMPILER_DETECT_RECURSION_H_
#include <limits.h>
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#include "compiler/translator/VariableInfo.h"
class TInfoSink;
diff --git a/src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.h b/src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.h
index 1dd8be9233..35d66cbc2e 100644
--- a/src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.h
+++ b/src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.h
@@ -11,7 +11,7 @@
#ifndef COMPILER_DETECTDISCONTINUITY_H_
#define COMPILER_DETECTDISCONTINUITY_H_
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.h b/src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.h
index 610205eb92..c93a6f808e 100644
--- a/src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.h
+++ b/src/3rdparty/angle/src/compiler/translator/FlagStd140Structs.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_FLAGSTD140STRUCTS_H_
#define COMPILER_FLAGSTD140STRUCTS_H_
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/translator/HashNames.h b/src/3rdparty/angle/src/compiler/translator/HashNames.h
index 85161428b2..26546a3e7b 100644
--- a/src/3rdparty/angle/src/compiler/translator/HashNames.h
+++ b/src/3rdparty/angle/src/compiler/translator/HashNames.h
@@ -9,7 +9,7 @@
#include <map>
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#define HASHED_NAME_PREFIX "webgl_"
diff --git a/src/3rdparty/angle/src/compiler/translator/Initialize.cpp b/src/3rdparty/angle/src/compiler/translator/Initialize.cpp
index e91d64f43b..10b21e6d28 100644
--- a/src/3rdparty/angle/src/compiler/translator/Initialize.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Initialize.cpp
@@ -12,7 +12,7 @@
#include "compiler/translator/Initialize.h"
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#include "angle_gl.h"
void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
diff --git a/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h b/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h
index 81ab9fe90f..59c3ea0a39 100644
--- a/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_INITIALIZE_VARIABLES_H_
#define COMPILER_INITIALIZE_VARIABLES_H_
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
class InitializeVariables : public TIntermTraverser
{
diff --git a/src/3rdparty/angle/src/compiler/translator/IntermNode.cpp b/src/3rdparty/angle/src/compiler/translator/IntermNode.cpp
new file mode 100644
index 0000000000..b155545ad2
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/IntermNode.cpp
@@ -0,0 +1,1107 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// Build the intermediate representation.
+//
+
+#include <float.h>
+#include <limits.h>
+#include <algorithm>
+
+#include "compiler/translator/HashNames.h"
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/SymbolTable.h"
+
+namespace
+{
+
+TPrecision GetHigherPrecision(TPrecision left, TPrecision right)
+{
+ return left > right ? left : right;
+}
+
+bool ValidateMultiplication(TOperator op, const TType &left, const TType &right)
+{
+ switch (op)
+ {
+ case EOpMul:
+ case EOpMulAssign:
+ return left.getNominalSize() == right.getNominalSize() &&
+ left.getSecondarySize() == right.getSecondarySize();
+ case EOpVectorTimesScalar:
+ case EOpVectorTimesScalarAssign:
+ return true;
+ case EOpVectorTimesMatrix:
+ return left.getNominalSize() == right.getRows();
+ case EOpVectorTimesMatrixAssign:
+ return left.getNominalSize() == right.getRows() &&
+ left.getNominalSize() == right.getCols();
+ case EOpMatrixTimesVector:
+ return left.getCols() == right.getNominalSize();
+ case EOpMatrixTimesScalar:
+ case EOpMatrixTimesScalarAssign:
+ return true;
+ case EOpMatrixTimesMatrix:
+ return left.getCols() == right.getRows();
+ case EOpMatrixTimesMatrixAssign:
+ return left.getCols() == right.getCols() &&
+ left.getRows() == right.getRows();
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool CompareStructure(const TType& leftNodeType,
+ ConstantUnion *rightUnionArray,
+ ConstantUnion *leftUnionArray);
+
+bool CompareStruct(const TType &leftNodeType,
+ ConstantUnion *rightUnionArray,
+ ConstantUnion *leftUnionArray)
+{
+ const TFieldList &fields = leftNodeType.getStruct()->fields();
+
+ size_t structSize = fields.size();
+ size_t index = 0;
+
+ for (size_t j = 0; j < structSize; j++)
+ {
+ size_t size = fields[j]->type()->getObjectSize();
+ for (size_t i = 0; i < size; i++)
+ {
+ if (fields[j]->type()->getBasicType() == EbtStruct)
+ {
+ if (!CompareStructure(*fields[j]->type(),
+ &rightUnionArray[index],
+ &leftUnionArray[index]))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if (leftUnionArray[index] != rightUnionArray[index])
+ return false;
+ index++;
+ }
+ }
+ }
+ return true;
+}
+
+bool CompareStructure(const TType &leftNodeType,
+ ConstantUnion *rightUnionArray,
+ ConstantUnion *leftUnionArray)
+{
+ if (leftNodeType.isArray())
+ {
+ TType typeWithoutArrayness = leftNodeType;
+ typeWithoutArrayness.clearArrayness();
+
+ size_t arraySize = leftNodeType.getArraySize();
+
+ for (size_t i = 0; i < arraySize; ++i)
+ {
+ size_t offset = typeWithoutArrayness.getObjectSize() * i;
+ if (!CompareStruct(typeWithoutArrayness,
+ &rightUnionArray[offset],
+ &leftUnionArray[offset]))
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ return CompareStruct(leftNodeType, rightUnionArray, leftUnionArray);
+ }
+ return true;
+}
+
+} // namespace anonymous
+
+
+////////////////////////////////////////////////////////////////
+//
+// Member functions of the nodes used for building the tree.
+//
+////////////////////////////////////////////////////////////////
+
+#define REPLACE_IF_IS(node, type, original, replacement) \
+ if (node == original) { \
+ node = static_cast<type *>(replacement); \
+ return true; \
+ }
+
+bool TIntermLoop::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mInit, TIntermNode, original, replacement);
+ REPLACE_IF_IS(mCond, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(mExpr, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(mBody, TIntermNode, original, replacement);
+ return false;
+}
+
+void TIntermLoop::enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const
+{
+ if (mInit)
+ {
+ nodeQueue->push(mInit);
+ }
+ if (mCond)
+ {
+ nodeQueue->push(mCond);
+ }
+ if (mExpr)
+ {
+ nodeQueue->push(mExpr);
+ }
+ if (mBody)
+ {
+ nodeQueue->push(mBody);
+ }
+}
+
+bool TIntermBranch::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mExpression, TIntermTyped, original, replacement);
+ return false;
+}
+
+void TIntermBranch::enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const
+{
+ if (mExpression)
+ {
+ nodeQueue->push(mExpression);
+ }
+}
+
+bool TIntermBinary::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mLeft, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(mRight, TIntermTyped, original, replacement);
+ return false;
+}
+
+void TIntermBinary::enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const
+{
+ if (mLeft)
+ {
+ nodeQueue->push(mLeft);
+ }
+ if (mRight)
+ {
+ nodeQueue->push(mRight);
+ }
+}
+
+bool TIntermUnary::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mOperand, TIntermTyped, original, replacement);
+ return false;
+}
+
+void TIntermUnary::enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const
+{
+ if (mOperand)
+ {
+ nodeQueue->push(mOperand);
+ }
+}
+
+bool TIntermAggregate::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ for (size_t ii = 0; ii < mSequence.size(); ++ii)
+ {
+ REPLACE_IF_IS(mSequence[ii], TIntermNode, original, replacement);
+ }
+ return false;
+}
+
+void TIntermAggregate::enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const
+{
+ for (size_t childIndex = 0; childIndex < mSequence.size(); childIndex++)
+ {
+ nodeQueue->push(mSequence[childIndex]);
+ }
+}
+
+bool TIntermSelection::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mCondition, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(mTrueBlock, TIntermNode, original, replacement);
+ REPLACE_IF_IS(mFalseBlock, TIntermNode, original, replacement);
+ return false;
+}
+
+void TIntermSelection::enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const
+{
+ if (mCondition)
+ {
+ nodeQueue->push(mCondition);
+ }
+ if (mTrueBlock)
+ {
+ nodeQueue->push(mTrueBlock);
+ }
+ if (mFalseBlock)
+ {
+ nodeQueue->push(mFalseBlock);
+ }
+}
+
+//
+// Say whether or not an operation node changes the value of a variable.
+//
+bool TIntermOperator::isAssignment() const
+{
+ switch (mOp)
+ {
+ case EOpPostIncrement:
+ case EOpPostDecrement:
+ case EOpPreIncrement:
+ case EOpPreDecrement:
+ case EOpAssign:
+ case EOpAddAssign:
+ case EOpSubAssign:
+ case EOpMulAssign:
+ case EOpVectorTimesMatrixAssign:
+ case EOpVectorTimesScalarAssign:
+ case EOpMatrixTimesScalarAssign:
+ case EOpMatrixTimesMatrixAssign:
+ case EOpDivAssign:
+ return true;
+ default:
+ return false;
+ }
+}
+
+//
+// returns true if the operator is for one of the constructors
+//
+bool TIntermOperator::isConstructor() const
+{
+ switch (mOp)
+ {
+ case EOpConstructVec2:
+ case EOpConstructVec3:
+ case EOpConstructVec4:
+ case EOpConstructMat2:
+ case EOpConstructMat3:
+ case EOpConstructMat4:
+ case EOpConstructFloat:
+ case EOpConstructIVec2:
+ case EOpConstructIVec3:
+ case EOpConstructIVec4:
+ case EOpConstructInt:
+ case EOpConstructUVec2:
+ case EOpConstructUVec3:
+ case EOpConstructUVec4:
+ case EOpConstructUInt:
+ case EOpConstructBVec2:
+ case EOpConstructBVec3:
+ case EOpConstructBVec4:
+ case EOpConstructBool:
+ case EOpConstructStruct:
+ return true;
+ default:
+ return false;
+ }
+}
+
+//
+// Make sure the type of a unary operator is appropriate for its
+// combination of operation and operand type.
+//
+// Returns false in nothing makes sense.
+//
+bool TIntermUnary::promote(TInfoSink &)
+{
+ switch (mOp)
+ {
+ case EOpLogicalNot:
+ if (mOperand->getBasicType() != EbtBool)
+ return false;
+ break;
+ case EOpNegative:
+ case EOpPostIncrement:
+ case EOpPostDecrement:
+ case EOpPreIncrement:
+ case EOpPreDecrement:
+ if (mOperand->getBasicType() == EbtBool)
+ return false;
+ break;
+
+ // operators for built-ins are already type checked against their prototype
+ case EOpAny:
+ case EOpAll:
+ case EOpVectorLogicalNot:
+ return true;
+
+ default:
+ if (mOperand->getBasicType() != EbtFloat)
+ return false;
+ }
+
+ setType(mOperand->getType());
+ mType.setQualifier(EvqTemporary);
+
+ return true;
+}
+
+//
+// Establishes the type of the resultant operation, as well as
+// makes the operator the correct one for the operands.
+//
+// Returns false if operator can't work on operands.
+//
+bool TIntermBinary::promote(TInfoSink &infoSink)
+{
+ // This function only handles scalars, vectors, and matrices.
+ if (mLeft->isArray() || mRight->isArray())
+ {
+ infoSink.info.message(EPrefixInternalError, getLine(),
+ "Invalid operation for arrays");
+ return false;
+ }
+
+ // GLSL ES 2.0 does not support implicit type casting.
+ // So the basic type should always match.
+ if (mLeft->getBasicType() != mRight->getBasicType())
+ {
+ return false;
+ }
+
+ //
+ // Base assumption: just make the type the same as the left
+ // operand. Then only deviations from this need be coded.
+ //
+ setType(mLeft->getType());
+
+ // The result gets promoted to the highest precision.
+ TPrecision higherPrecision = GetHigherPrecision(
+ mLeft->getPrecision(), mRight->getPrecision());
+ getTypePointer()->setPrecision(higherPrecision);
+
+ // Binary operations results in temporary variables unless both
+ // operands are const.
+ if (mLeft->getQualifier() != EvqConst || mRight->getQualifier() != EvqConst)
+ {
+ getTypePointer()->setQualifier(EvqTemporary);
+ }
+
+ const int nominalSize =
+ std::max(mLeft->getNominalSize(), mRight->getNominalSize());
+
+ //
+ // All scalars or structs. Code after this test assumes this case is removed!
+ //
+ if (nominalSize == 1)
+ {
+ switch (mOp)
+ {
+ //
+ // Promote to conditional
+ //
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ setType(TType(EbtBool, EbpUndefined));
+ break;
+
+ //
+ // And and Or operate on conditionals
+ //
+ case EOpLogicalAnd:
+ case EOpLogicalOr:
+ // Both operands must be of type bool.
+ if (mLeft->getBasicType() != EbtBool || mRight->getBasicType() != EbtBool)
+ {
+ return false;
+ }
+ setType(TType(EbtBool, EbpUndefined));
+ break;
+
+ default:
+ break;
+ }
+ return true;
+ }
+
+ // If we reach here, at least one of the operands is vector or matrix.
+ // The other operand could be a scalar, vector, or matrix.
+ // Can these two operands be combined?
+ //
+ TBasicType basicType = mLeft->getBasicType();
+ switch (mOp)
+ {
+ case EOpMul:
+ if (!mLeft->isMatrix() && mRight->isMatrix())
+ {
+ if (mLeft->isVector())
+ {
+ mOp = EOpVectorTimesMatrix;
+ setType(TType(basicType, higherPrecision, EvqTemporary,
+ mRight->getCols(), 1));
+ }
+ else
+ {
+ mOp = EOpMatrixTimesScalar;
+ setType(TType(basicType, higherPrecision, EvqTemporary,
+ mRight->getCols(), mRight->getRows()));
+ }
+ }
+ else if (mLeft->isMatrix() && !mRight->isMatrix())
+ {
+ if (mRight->isVector())
+ {
+ mOp = EOpMatrixTimesVector;
+ setType(TType(basicType, higherPrecision, EvqTemporary,
+ mLeft->getRows(), 1));
+ }
+ else
+ {
+ mOp = EOpMatrixTimesScalar;
+ }
+ }
+ else if (mLeft->isMatrix() && mRight->isMatrix())
+ {
+ mOp = EOpMatrixTimesMatrix;
+ setType(TType(basicType, higherPrecision, EvqTemporary,
+ mRight->getCols(), mLeft->getRows()));
+ }
+ else if (!mLeft->isMatrix() && !mRight->isMatrix())
+ {
+ if (mLeft->isVector() && mRight->isVector())
+ {
+ // leave as component product
+ }
+ else if (mLeft->isVector() || mRight->isVector())
+ {
+ mOp = EOpVectorTimesScalar;
+ setType(TType(basicType, higherPrecision, EvqTemporary,
+ nominalSize, 1));
+ }
+ }
+ else
+ {
+ infoSink.info.message(EPrefixInternalError, getLine(),
+ "Missing elses");
+ return false;
+ }
+
+ if (!ValidateMultiplication(mOp, mLeft->getType(), mRight->getType()))
+ {
+ return false;
+ }
+ break;
+
+ case EOpMulAssign:
+ if (!mLeft->isMatrix() && mRight->isMatrix())
+ {
+ if (mLeft->isVector())
+ {
+ mOp = EOpVectorTimesMatrixAssign;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else if (mLeft->isMatrix() && !mRight->isMatrix())
+ {
+ if (mRight->isVector())
+ {
+ return false;
+ }
+ else
+ {
+ mOp = EOpMatrixTimesScalarAssign;
+ }
+ }
+ else if (mLeft->isMatrix() && mRight->isMatrix())
+ {
+ mOp = EOpMatrixTimesMatrixAssign;
+ setType(TType(basicType, higherPrecision, EvqTemporary,
+ mRight->getCols(), mLeft->getRows()));
+ }
+ else if (!mLeft->isMatrix() && !mRight->isMatrix())
+ {
+ if (mLeft->isVector() && mRight->isVector())
+ {
+ // leave as component product
+ }
+ else if (mLeft->isVector() || mRight->isVector())
+ {
+ if (!mLeft->isVector())
+ return false;
+ mOp = EOpVectorTimesScalarAssign;
+ setType(TType(basicType, higherPrecision, EvqTemporary,
+ mLeft->getNominalSize(), 1));
+ }
+ }
+ else
+ {
+ infoSink.info.message(EPrefixInternalError, getLine(),
+ "Missing elses");
+ return false;
+ }
+
+ if (!ValidateMultiplication(mOp, mLeft->getType(), mRight->getType()))
+ {
+ return false;
+ }
+ break;
+
+ case EOpAssign:
+ case EOpInitialize:
+ case EOpAdd:
+ case EOpSub:
+ case EOpDiv:
+ case EOpAddAssign:
+ case EOpSubAssign:
+ case EOpDivAssign:
+ if ((mLeft->isMatrix() && mRight->isVector()) ||
+ (mLeft->isVector() && mRight->isMatrix()))
+ {
+ return false;
+ }
+
+ // Are the sizes compatible?
+ if (mLeft->getNominalSize() != mRight->getNominalSize() ||
+ mLeft->getSecondarySize() != mRight->getSecondarySize())
+ {
+ // If the nominal size of operands do not match:
+ // One of them must be scalar.
+ if (!mLeft->isScalar() && !mRight->isScalar())
+ return false;
+
+ // Operator cannot be of type pure assignment.
+ if (mOp == EOpAssign || mOp == EOpInitialize)
+ return false;
+ }
+
+ {
+ const int secondarySize = std::max(
+ mLeft->getSecondarySize(), mRight->getSecondarySize());
+ setType(TType(basicType, higherPrecision, EvqTemporary,
+ nominalSize, secondarySize));
+ }
+ break;
+
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ if ((mLeft->getNominalSize() != mRight->getNominalSize()) ||
+ (mLeft->getSecondarySize() != mRight->getSecondarySize()))
+ {
+ return false;
+ }
+ setType(TType(EbtBool, EbpUndefined));
+ break;
+
+ default:
+ return false;
+ }
+ return true;
+}
+
+//
+// The fold functions see if an operation on a constant can be done in place,
+// without generating run-time code.
+//
+// Returns the node to keep using, which may or may not be the node passed in.
+//
+TIntermTyped *TIntermConstantUnion::fold(
+ TOperator op, TIntermTyped *constantNode, TInfoSink &infoSink)
+{
+ ConstantUnion *unionArray = getUnionArrayPointer();
+
+ if (!unionArray)
+ return NULL;
+
+ size_t objectSize = getType().getObjectSize();
+
+ if (constantNode)
+ {
+ // binary operations
+ TIntermConstantUnion *node = constantNode->getAsConstantUnion();
+ ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
+ TType returnType = getType();
+
+ if (!rightUnionArray)
+ return NULL;
+
+ // for a case like float f = 1.2 + vec4(2,3,4,5);
+ if (constantNode->getType().getObjectSize() == 1 && objectSize > 1)
+ {
+ rightUnionArray = new ConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; ++i)
+ {
+ rightUnionArray[i] = *node->getUnionArrayPointer();
+ }
+ returnType = getType();
+ }
+ else if (constantNode->getType().getObjectSize() > 1 && objectSize == 1)
+ {
+ // for a case like float f = vec4(2,3,4,5) + 1.2;
+ unionArray = new ConstantUnion[constantNode->getType().getObjectSize()];
+ for (size_t i = 0; i < constantNode->getType().getObjectSize(); ++i)
+ {
+ unionArray[i] = *getUnionArrayPointer();
+ }
+ returnType = node->getType();
+ objectSize = constantNode->getType().getObjectSize();
+ }
+
+ ConstantUnion *tempConstArray = NULL;
+ TIntermConstantUnion *tempNode;
+
+ bool boolNodeFlag = false;
+ switch(op)
+ {
+ case EOpAdd:
+ tempConstArray = new ConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] + rightUnionArray[i];
+ break;
+ case EOpSub:
+ tempConstArray = new ConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] - rightUnionArray[i];
+ break;
+
+ case EOpMul:
+ case EOpVectorTimesScalar:
+ case EOpMatrixTimesScalar:
+ tempConstArray = new ConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] * rightUnionArray[i];
+ break;
+
+ case EOpMatrixTimesMatrix:
+ {
+ if (getType().getBasicType() != EbtFloat ||
+ node->getBasicType() != EbtFloat)
+ {
+ infoSink.info.message(
+ EPrefixInternalError, getLine(),
+ "Constant Folding cannot be done for matrix multiply");
+ return NULL;
+ }
+
+ const int leftCols = getCols();
+ const int leftRows = getRows();
+ const int rightCols = constantNode->getType().getCols();
+ const int rightRows = constantNode->getType().getRows();
+ const int resultCols = rightCols;
+ const int resultRows = leftRows;
+
+ tempConstArray = new ConstantUnion[resultCols*resultRows];
+ for (int row = 0; row < resultRows; row++)
+ {
+ for (int column = 0; column < resultCols; column++)
+ {
+ tempConstArray[resultRows * column + row].setFConst(0.0f);
+ for (int i = 0; i < leftCols; i++)
+ {
+ tempConstArray[resultRows * column + row].setFConst(
+ tempConstArray[resultRows * column + row].getFConst() +
+ unionArray[i * leftRows + row].getFConst() *
+ rightUnionArray[column * rightRows + i].getFConst());
+ }
+ }
+ }
+
+ // update return type for matrix product
+ returnType.setPrimarySize(resultCols);
+ returnType.setSecondarySize(resultRows);
+ }
+ break;
+
+ case EOpDiv:
+ {
+ tempConstArray = new ConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ switch (getType().getBasicType())
+ {
+ case EbtFloat:
+ if (rightUnionArray[i] == 0.0f)
+ {
+ infoSink.info.message(
+ EPrefixWarning, getLine(),
+ "Divide by zero error during constant folding");
+ tempConstArray[i].setFConst(
+ unionArray[i].getFConst() < 0 ? -FLT_MAX : FLT_MAX);
+ }
+ else
+ {
+ tempConstArray[i].setFConst(
+ unionArray[i].getFConst() /
+ rightUnionArray[i].getFConst());
+ }
+ break;
+
+ case EbtInt:
+ if (rightUnionArray[i] == 0)
+ {
+ infoSink.info.message(
+ EPrefixWarning, getLine(),
+ "Divide by zero error during constant folding");
+ tempConstArray[i].setIConst(INT_MAX);
+ }
+ else
+ {
+ tempConstArray[i].setIConst(
+ unionArray[i].getIConst() /
+ rightUnionArray[i].getIConst());
+ }
+ break;
+
+ case EbtUInt:
+ if (rightUnionArray[i] == 0)
+ {
+ infoSink.info.message(
+ EPrefixWarning, getLine(),
+ "Divide by zero error during constant folding");
+ tempConstArray[i].setUConst(UINT_MAX);
+ }
+ else
+ {
+ tempConstArray[i].setUConst(
+ unionArray[i].getUConst() /
+ rightUnionArray[i].getUConst());
+ }
+ break;
+
+ default:
+ infoSink.info.message(
+ EPrefixInternalError, getLine(),
+ "Constant folding cannot be done for \"/\"");
+ return NULL;
+ }
+ }
+ }
+ break;
+
+ case EOpMatrixTimesVector:
+ {
+ if (node->getBasicType() != EbtFloat)
+ {
+ infoSink.info.message(
+ EPrefixInternalError, getLine(),
+ "Constant Folding cannot be done for matrix times vector");
+ return NULL;
+ }
+
+ const int matrixCols = getCols();
+ const int matrixRows = getRows();
+
+ tempConstArray = new ConstantUnion[matrixRows];
+
+ for (int matrixRow = 0; matrixRow < matrixRows; matrixRow++)
+ {
+ tempConstArray[matrixRow].setFConst(0.0f);
+ for (int col = 0; col < matrixCols; col++)
+ {
+ tempConstArray[matrixRow].setFConst(
+ tempConstArray[matrixRow].getFConst() +
+ unionArray[col * matrixRows + matrixRow].getFConst() *
+ rightUnionArray[col].getFConst());
+ }
+ }
+
+ returnType = node->getType();
+ returnType.setPrimarySize(matrixRows);
+
+ tempNode = new TIntermConstantUnion(tempConstArray, returnType);
+ tempNode->setLine(getLine());
+
+ return tempNode;
+ }
+
+ case EOpVectorTimesMatrix:
+ {
+ if (getType().getBasicType() != EbtFloat)
+ {
+ infoSink.info.message(
+ EPrefixInternalError, getLine(),
+ "Constant Folding cannot be done for vector times matrix");
+ return NULL;
+ }
+
+ const int matrixCols = constantNode->getType().getCols();
+ const int matrixRows = constantNode->getType().getRows();
+
+ tempConstArray = new ConstantUnion[matrixCols];
+
+ for (int matrixCol = 0; matrixCol < matrixCols; matrixCol++)
+ {
+ tempConstArray[matrixCol].setFConst(0.0f);
+ for (int matrixRow = 0; matrixRow < matrixRows; matrixRow++)
+ {
+ tempConstArray[matrixCol].setFConst(
+ tempConstArray[matrixCol].getFConst() +
+ unionArray[matrixRow].getFConst() *
+ rightUnionArray[matrixCol * matrixRows + matrixRow].getFConst());
+ }
+ }
+
+ returnType.setPrimarySize(matrixCols);
+ }
+ break;
+
+ case EOpLogicalAnd:
+ // this code is written for possible future use,
+ // will not get executed currently
+ {
+ tempConstArray = new ConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ tempConstArray[i] = unionArray[i] && rightUnionArray[i];
+ }
+ }
+ break;
+
+ case EOpLogicalOr:
+ // this code is written for possible future use,
+ // will not get executed currently
+ {
+ tempConstArray = new ConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ tempConstArray[i] = unionArray[i] || rightUnionArray[i];
+ }
+ }
+ break;
+
+ case EOpLogicalXor:
+ {
+ tempConstArray = new ConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ switch (getType().getBasicType())
+ {
+ case EbtBool:
+ tempConstArray[i].setBConst(
+ unionArray[i] == rightUnionArray[i] ? false : true);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+ }
+ break;
+
+ case EOpLessThan:
+ ASSERT(objectSize == 1);
+ tempConstArray = new ConstantUnion[1];
+ tempConstArray->setBConst(*unionArray < *rightUnionArray);
+ returnType = TType(EbtBool, EbpUndefined, EvqConst);
+ break;
+
+ case EOpGreaterThan:
+ ASSERT(objectSize == 1);
+ tempConstArray = new ConstantUnion[1];
+ tempConstArray->setBConst(*unionArray > *rightUnionArray);
+ returnType = TType(EbtBool, EbpUndefined, EvqConst);
+ break;
+
+ case EOpLessThanEqual:
+ {
+ ASSERT(objectSize == 1);
+ ConstantUnion constant;
+ constant.setBConst(*unionArray > *rightUnionArray);
+ tempConstArray = new ConstantUnion[1];
+ tempConstArray->setBConst(!constant.getBConst());
+ returnType = TType(EbtBool, EbpUndefined, EvqConst);
+ break;
+ }
+
+ case EOpGreaterThanEqual:
+ {
+ ASSERT(objectSize == 1);
+ ConstantUnion constant;
+ constant.setBConst(*unionArray < *rightUnionArray);
+ tempConstArray = new ConstantUnion[1];
+ tempConstArray->setBConst(!constant.getBConst());
+ returnType = TType(EbtBool, EbpUndefined, EvqConst);
+ break;
+ }
+
+ case EOpEqual:
+ if (getType().getBasicType() == EbtStruct)
+ {
+ if (!CompareStructure(node->getType(),
+ node->getUnionArrayPointer(),
+ unionArray))
+ {
+ boolNodeFlag = true;
+ }
+ }
+ else
+ {
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ if (unionArray[i] != rightUnionArray[i])
+ {
+ boolNodeFlag = true;
+ break; // break out of for loop
+ }
+ }
+ }
+
+ tempConstArray = new ConstantUnion[1];
+ if (!boolNodeFlag)
+ {
+ tempConstArray->setBConst(true);
+ }
+ else
+ {
+ tempConstArray->setBConst(false);
+ }
+
+ tempNode = new TIntermConstantUnion(
+ tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
+ tempNode->setLine(getLine());
+
+ return tempNode;
+
+ case EOpNotEqual:
+ if (getType().getBasicType() == EbtStruct)
+ {
+ if (CompareStructure(node->getType(),
+ node->getUnionArrayPointer(),
+ unionArray))
+ {
+ boolNodeFlag = true;
+ }
+ }
+ else
+ {
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ if (unionArray[i] == rightUnionArray[i])
+ {
+ boolNodeFlag = true;
+ break; // break out of for loop
+ }
+ }
+ }
+
+ tempConstArray = new ConstantUnion[1];
+ if (!boolNodeFlag)
+ {
+ tempConstArray->setBConst(true);
+ }
+ else
+ {
+ tempConstArray->setBConst(false);
+ }
+
+ tempNode = new TIntermConstantUnion(
+ tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
+ tempNode->setLine(getLine());
+
+ return tempNode;
+
+ default:
+ infoSink.info.message(
+ EPrefixInternalError, getLine(),
+ "Invalid operator for constant folding");
+ return NULL;
+ }
+ tempNode = new TIntermConstantUnion(tempConstArray, returnType);
+ tempNode->setLine(getLine());
+
+ return tempNode;
+ }
+ else
+ {
+ //
+ // Do unary operations
+ //
+ TIntermConstantUnion *newNode = 0;
+ ConstantUnion* tempConstArray = new ConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ switch(op)
+ {
+ case EOpNegative:
+ switch (getType().getBasicType())
+ {
+ case EbtFloat:
+ tempConstArray[i].setFConst(-unionArray[i].getFConst());
+ break;
+ case EbtInt:
+ tempConstArray[i].setIConst(-unionArray[i].getIConst());
+ break;
+ case EbtUInt:
+ tempConstArray[i].setUConst(static_cast<unsigned int>(
+ -static_cast<int>(unionArray[i].getUConst())));
+ break;
+ default:
+ infoSink.info.message(
+ EPrefixInternalError, getLine(),
+ "Unary operation not folded into constant");
+ return NULL;
+ }
+ break;
+
+ case EOpLogicalNot:
+ // this code is written for possible future use,
+ // will not get executed currently
+ switch (getType().getBasicType())
+ {
+ case EbtBool:
+ tempConstArray[i].setBConst(!unionArray[i].getBConst());
+ break;
+ default:
+ infoSink.info.message(
+ EPrefixInternalError, getLine(),
+ "Unary operation not folded into constant");
+ return NULL;
+ }
+ break;
+
+ default:
+ return NULL;
+ }
+ }
+ newNode = new TIntermConstantUnion(tempConstArray, getType());
+ newNode->setLine(getLine());
+ return newNode;
+ }
+}
+
+// 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/translator/IntermNode.h b/src/3rdparty/angle/src/compiler/translator/IntermNode.h
new file mode 100644
index 0000000000..ec440da010
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/IntermNode.h
@@ -0,0 +1,772 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// Definition of the in-memory high-level intermediate representation
+// of shaders. This is a tree that parser creates.
+//
+// Nodes in the tree are defined as a hierarchy of classes derived from
+// TIntermNode. Each is a node in a tree. There is no preset branching factor;
+// each node can have it's own type of list of children.
+//
+
+#ifndef COMPILER_TRANSLATOR_INTERMEDIATE_H_
+#define COMPILER_TRANSLATOR_INTERMEDIATE_H_
+
+#include "GLSLANG/ShaderLang.h"
+
+#include <algorithm>
+#include <queue>
+
+#include "compiler/translator/Common.h"
+#include "compiler/translator/Types.h"
+#include "compiler/translator/ConstantUnion.h"
+
+//
+// Operators used by the high-level (parse tree) representation.
+//
+enum TOperator
+{
+ EOpNull, // if in a node, should only mean a node is still being built
+ EOpSequence, // denotes a list of statements, or parameters, etc.
+ EOpFunctionCall,
+ EOpFunction, // For function definition
+ EOpParameters, // an aggregate listing the parameters to a function
+
+ EOpDeclaration,
+ EOpInvariantDeclaration, // Specialized declarations for attributing invariance
+ EOpPrototype,
+
+ //
+ // Unary operators
+ //
+
+ EOpNegative,
+ EOpLogicalNot,
+ EOpVectorLogicalNot,
+
+ EOpPostIncrement,
+ EOpPostDecrement,
+ EOpPreIncrement,
+ EOpPreDecrement,
+
+ //
+ // binary operations
+ //
+
+ EOpAdd,
+ EOpSub,
+ EOpMul,
+ EOpDiv,
+ EOpEqual,
+ EOpNotEqual,
+ EOpVectorEqual,
+ EOpVectorNotEqual,
+ EOpLessThan,
+ EOpGreaterThan,
+ EOpLessThanEqual,
+ EOpGreaterThanEqual,
+ EOpComma,
+
+ EOpVectorTimesScalar,
+ EOpVectorTimesMatrix,
+ EOpMatrixTimesVector,
+ EOpMatrixTimesScalar,
+
+ EOpLogicalOr,
+ EOpLogicalXor,
+ EOpLogicalAnd,
+
+ EOpIndexDirect,
+ EOpIndexIndirect,
+ EOpIndexDirectStruct,
+ EOpIndexDirectInterfaceBlock,
+
+ EOpVectorSwizzle,
+
+ //
+ // Built-in functions potentially mapped to operators
+ //
+
+ EOpRadians,
+ EOpDegrees,
+ EOpSin,
+ EOpCos,
+ EOpTan,
+ EOpAsin,
+ EOpAcos,
+ EOpAtan,
+
+ EOpPow,
+ EOpExp,
+ EOpLog,
+ EOpExp2,
+ EOpLog2,
+ EOpSqrt,
+ EOpInverseSqrt,
+
+ EOpAbs,
+ EOpSign,
+ EOpFloor,
+ EOpCeil,
+ EOpFract,
+ EOpMod,
+ EOpMin,
+ EOpMax,
+ EOpClamp,
+ EOpMix,
+ EOpStep,
+ EOpSmoothStep,
+
+ EOpLength,
+ EOpDistance,
+ EOpDot,
+ EOpCross,
+ EOpNormalize,
+ EOpFaceForward,
+ EOpReflect,
+ EOpRefract,
+
+ EOpDFdx, // Fragment only, OES_standard_derivatives extension
+ EOpDFdy, // Fragment only, OES_standard_derivatives extension
+ EOpFwidth, // Fragment only, OES_standard_derivatives extension
+
+ EOpMatrixTimesMatrix,
+
+ EOpAny,
+ EOpAll,
+
+ //
+ // Branch
+ //
+
+ EOpKill, // Fragment only
+ EOpReturn,
+ EOpBreak,
+ EOpContinue,
+
+ //
+ // Constructors
+ //
+
+ EOpConstructInt,
+ EOpConstructUInt,
+ EOpConstructBool,
+ EOpConstructFloat,
+ EOpConstructVec2,
+ EOpConstructVec3,
+ EOpConstructVec4,
+ EOpConstructBVec2,
+ EOpConstructBVec3,
+ EOpConstructBVec4,
+ EOpConstructIVec2,
+ EOpConstructIVec3,
+ EOpConstructIVec4,
+ EOpConstructUVec2,
+ EOpConstructUVec3,
+ EOpConstructUVec4,
+ EOpConstructMat2,
+ EOpConstructMat3,
+ EOpConstructMat4,
+ EOpConstructStruct,
+
+ //
+ // moves
+ //
+
+ EOpAssign,
+ EOpInitialize,
+ EOpAddAssign,
+ EOpSubAssign,
+ EOpMulAssign,
+ EOpVectorTimesMatrixAssign,
+ EOpVectorTimesScalarAssign,
+ EOpMatrixTimesScalarAssign,
+ EOpMatrixTimesMatrixAssign,
+ EOpDivAssign
+};
+
+class TIntermTraverser;
+class TIntermAggregate;
+class TIntermBinary;
+class TIntermUnary;
+class TIntermConstantUnion;
+class TIntermSelection;
+class TIntermTyped;
+class TIntermSymbol;
+class TIntermLoop;
+class TInfoSink;
+class TIntermRaw;
+
+//
+// Base class for the tree nodes
+//
+class TIntermNode
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE();
+ TIntermNode()
+ {
+ // TODO: Move this to TSourceLoc constructor
+ // after getting rid of TPublicType.
+ mLine.first_file = mLine.last_file = 0;
+ mLine.first_line = mLine.last_line = 0;
+ }
+ virtual ~TIntermNode() { }
+
+ const TSourceLoc &getLine() const { return mLine; }
+ void setLine(const TSourceLoc &l) { mLine = l; }
+
+ virtual void traverse(TIntermTraverser *) = 0;
+ virtual TIntermTyped *getAsTyped() { return 0; }
+ virtual TIntermConstantUnion *getAsConstantUnion() { return 0; }
+ virtual TIntermAggregate *getAsAggregate() { return 0; }
+ virtual TIntermBinary *getAsBinaryNode() { return 0; }
+ virtual TIntermUnary *getAsUnaryNode() { return 0; }
+ virtual TIntermSelection *getAsSelectionNode() { return 0; }
+ virtual TIntermSymbol *getAsSymbolNode() { return 0; }
+ virtual TIntermLoop *getAsLoopNode() { return 0; }
+ virtual TIntermRaw *getAsRawNode() { return 0; }
+
+ // Replace a child node. Return true if |original| is a child
+ // node and it is replaced; otherwise, return false.
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement) = 0;
+
+ // For traversing a tree in no particular order, but using
+ // heap memory.
+ virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const = 0;
+
+ protected:
+ TSourceLoc mLine;
+};
+
+//
+// This is just to help yacc.
+//
+struct TIntermNodePair
+{
+ TIntermNode *node1;
+ TIntermNode *node2;
+};
+
+//
+// Intermediate class for nodes that have a type.
+//
+class TIntermTyped : public TIntermNode
+{
+ public:
+ TIntermTyped(const TType &t) : mType(t) { }
+ virtual TIntermTyped *getAsTyped() { return this; }
+
+ virtual bool hasSideEffects() const = 0;
+
+ void setType(const TType &t) { mType = t; }
+ const TType &getType() const { return mType; }
+ TType *getTypePointer() { return &mType; }
+
+ TBasicType getBasicType() const { return mType.getBasicType(); }
+ TQualifier getQualifier() const { return mType.getQualifier(); }
+ TPrecision getPrecision() const { return mType.getPrecision(); }
+ int getCols() const { return mType.getCols(); }
+ int getRows() const { return mType.getRows(); }
+ int getNominalSize() const { return mType.getNominalSize(); }
+ int getSecondarySize() const { return mType.getSecondarySize(); }
+
+ bool isInterfaceBlock() const { return mType.isInterfaceBlock(); }
+ bool isMatrix() const { return mType.isMatrix(); }
+ bool isArray() const { return mType.isArray(); }
+ bool isVector() const { return mType.isVector(); }
+ bool isScalar() const { return mType.isScalar(); }
+ bool isScalarInt() const { return mType.isScalarInt(); }
+ const char *getBasicString() const { return mType.getBasicString(); }
+ const char *getQualifierString() const { return mType.getQualifierString(); }
+ TString getCompleteString() const { return mType.getCompleteString(); }
+
+ int getArraySize() const { return mType.getArraySize(); }
+
+ protected:
+ TType mType;
+};
+
+//
+// Handle for, do-while, and while loops.
+//
+enum TLoopType
+{
+ ELoopFor,
+ ELoopWhile,
+ ELoopDoWhile
+};
+
+class TIntermLoop : public TIntermNode
+{
+ public:
+ TIntermLoop(TLoopType type,
+ TIntermNode *init, TIntermTyped *cond, TIntermTyped *expr,
+ TIntermNode *body)
+ : mType(type),
+ mInit(init),
+ mCond(cond),
+ mExpr(expr),
+ mBody(body),
+ mUnrollFlag(false) { }
+
+ virtual TIntermLoop *getAsLoopNode() { return this; }
+ virtual void traverse(TIntermTraverser *);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ TLoopType getType() const { return mType; }
+ TIntermNode *getInit() { return mInit; }
+ TIntermTyped *getCondition() { return mCond; }
+ TIntermTyped *getExpression() { return mExpr; }
+ TIntermNode *getBody() { return mBody; }
+
+ void setUnrollFlag(bool flag) { mUnrollFlag = flag; }
+ bool getUnrollFlag() const { return mUnrollFlag; }
+
+ virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
+
+ protected:
+ TLoopType mType;
+ TIntermNode *mInit; // for-loop initialization
+ TIntermTyped *mCond; // loop exit condition
+ TIntermTyped *mExpr; // for-loop expression
+ TIntermNode *mBody; // loop body
+
+ bool mUnrollFlag; // Whether the loop should be unrolled or not.
+};
+
+//
+// Handle break, continue, return, and kill.
+//
+class TIntermBranch : public TIntermNode
+{
+ public:
+ TIntermBranch(TOperator op, TIntermTyped *e)
+ : mFlowOp(op),
+ mExpression(e) { }
+
+ virtual void traverse(TIntermTraverser *);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ TOperator getFlowOp() { return mFlowOp; }
+ TIntermTyped* getExpression() { return mExpression; }
+
+ virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
+
+protected:
+ TOperator mFlowOp;
+ TIntermTyped *mExpression; // non-zero except for "return exp;" statements
+};
+
+//
+// Nodes that correspond to symbols or constants in the source code.
+//
+class TIntermSymbol : public TIntermTyped
+{
+ public:
+ // if symbol is initialized as symbol(sym), the memory comes from the poolallocator of sym.
+ // If sym comes from per process globalpoolallocator, then it causes increased memory usage
+ // per compile it is essential to use "symbol = sym" to assign to symbol
+ TIntermSymbol(int id, const TString &symbol, const TType &type)
+ : TIntermTyped(type),
+ mId(id)
+ {
+ mSymbol = symbol;
+ }
+
+ virtual bool hasSideEffects() const { return false; }
+
+ int getId() const { return mId; }
+ const TString &getSymbol() const { return mSymbol; }
+
+ void setId(int newId) { mId = newId; }
+
+ virtual void traverse(TIntermTraverser *);
+ virtual TIntermSymbol *getAsSymbolNode() { return this; }
+ virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
+
+ virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const {}
+
+ protected:
+ int mId;
+ TString mSymbol;
+};
+
+// A Raw node stores raw code, that the translator will insert verbatim
+// into the output stream. Useful for transformation operations that make
+// complex code that might not fit naturally into the GLSL model.
+class TIntermRaw : public TIntermTyped
+{
+ public:
+ TIntermRaw(const TType &type, const TString &rawText)
+ : TIntermTyped(type),
+ mRawText(rawText) { }
+
+ virtual bool hasSideEffects() const { return false; }
+
+ TString getRawText() const { return mRawText; }
+
+ virtual void traverse(TIntermTraverser *);
+
+ virtual TIntermRaw *getAsRawNode() { return this; }
+ virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
+ virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const {}
+
+ protected:
+ TString mRawText;
+};
+
+class TIntermConstantUnion : public TIntermTyped
+{
+ public:
+ TIntermConstantUnion(ConstantUnion *unionPointer, const TType &type)
+ : TIntermTyped(type),
+ mUnionArrayPointer(unionPointer) { }
+
+ virtual bool hasSideEffects() const { return false; }
+
+ ConstantUnion *getUnionArrayPointer() const { return mUnionArrayPointer; }
+
+ int getIConst(size_t index) const
+ {
+ return mUnionArrayPointer ? mUnionArrayPointer[index].getIConst() : 0;
+ }
+ unsigned int getUConst(size_t index) const
+ {
+ return mUnionArrayPointer ? mUnionArrayPointer[index].getUConst() : 0;
+ }
+ float getFConst(size_t index) const
+ {
+ return mUnionArrayPointer ? mUnionArrayPointer[index].getFConst() : 0.0f;
+ }
+ bool getBConst(size_t index) const
+ {
+ return mUnionArrayPointer ? mUnionArrayPointer[index].getBConst() : false;
+ }
+
+ virtual TIntermConstantUnion *getAsConstantUnion() { return this; }
+ virtual void traverse(TIntermTraverser *);
+ virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
+
+ TIntermTyped *fold(TOperator, TIntermTyped *, TInfoSink &);
+
+ virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const {}
+
+ protected:
+ ConstantUnion *mUnionArrayPointer;
+};
+
+//
+// Intermediate class for node types that hold operators.
+//
+class TIntermOperator : public TIntermTyped
+{
+ public:
+ TOperator getOp() const { return mOp; }
+ void setOp(TOperator op) { mOp = op; }
+
+ bool isAssignment() const;
+ bool isConstructor() const;
+
+ virtual bool hasSideEffects() const { return isAssignment(); }
+
+ protected:
+ TIntermOperator(TOperator op)
+ : TIntermTyped(TType(EbtFloat, EbpUndefined)),
+ mOp(op) {}
+ TIntermOperator(TOperator op, const TType &type)
+ : TIntermTyped(type),
+ mOp(op) {}
+
+ TOperator mOp;
+};
+
+//
+// Nodes for all the basic binary math operators.
+//
+class TIntermBinary : public TIntermOperator
+{
+ public:
+ TIntermBinary(TOperator op)
+ : TIntermOperator(op),
+ mAddIndexClamp(false) {}
+
+ virtual TIntermBinary *getAsBinaryNode() { return this; }
+ virtual void traverse(TIntermTraverser *);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ virtual bool hasSideEffects() const
+ {
+ return isAssignment() || mLeft->hasSideEffects() || mRight->hasSideEffects();
+ }
+
+ void setLeft(TIntermTyped *node) { mLeft = node; }
+ void setRight(TIntermTyped *node) { mRight = node; }
+ TIntermTyped *getLeft() const { return mLeft; }
+ TIntermTyped *getRight() const { return mRight; }
+ bool promote(TInfoSink &);
+
+ void setAddIndexClamp() { mAddIndexClamp = true; }
+ bool getAddIndexClamp() { return mAddIndexClamp; }
+
+ virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
+
+ protected:
+ TIntermTyped* mLeft;
+ TIntermTyped* mRight;
+
+ // If set to true, wrap any EOpIndexIndirect with a clamp to bounds.
+ bool mAddIndexClamp;
+};
+
+//
+// Nodes for unary math operators.
+//
+class TIntermUnary : public TIntermOperator
+{
+ public:
+ TIntermUnary(TOperator op, const TType &type)
+ : TIntermOperator(op, type),
+ mOperand(NULL),
+ mUseEmulatedFunction(false) {}
+ TIntermUnary(TOperator op)
+ : TIntermOperator(op),
+ mOperand(NULL),
+ mUseEmulatedFunction(false) {}
+
+ virtual void traverse(TIntermTraverser *);
+ virtual TIntermUnary *getAsUnaryNode() { return this; }
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ virtual bool hasSideEffects() const
+ {
+ return isAssignment() || mOperand->hasSideEffects();
+ }
+
+ void setOperand(TIntermTyped *operand) { mOperand = operand; }
+ TIntermTyped *getOperand() { return mOperand; }
+ bool promote(TInfoSink &);
+
+ void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
+ bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
+
+ virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
+
+ protected:
+ TIntermTyped *mOperand;
+
+ // If set to true, replace the built-in function call with an emulated one
+ // to work around driver bugs.
+ bool mUseEmulatedFunction;
+};
+
+typedef TVector<TIntermNode *> TIntermSequence;
+typedef TVector<int> TQualifierList;
+
+//
+// Nodes that operate on an arbitrary sized set of children.
+//
+class TIntermAggregate : public TIntermOperator
+{
+ public:
+ TIntermAggregate()
+ : TIntermOperator(EOpNull),
+ mUserDefined(false),
+ mUseEmulatedFunction(false) { }
+ TIntermAggregate(TOperator op)
+ : TIntermOperator(op),
+ mUseEmulatedFunction(false) { }
+ ~TIntermAggregate() { }
+
+ virtual TIntermAggregate *getAsAggregate() { return this; }
+ virtual void traverse(TIntermTraverser *);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ // Conservatively assume function calls and other aggregate operators have side-effects
+ virtual bool hasSideEffects() const { return true; }
+
+ TIntermSequence *getSequence() { return &mSequence; }
+
+ void setName(const TString &name) { mName = name; }
+ const TString &getName() const { return mName; }
+
+ void setUserDefined() { mUserDefined = true; }
+ bool isUserDefined() const { return mUserDefined; }
+
+ void setOptimize(bool optimize) { mOptimize = optimize; }
+ bool getOptimize() const { return mOptimize; }
+ void setDebug(bool debug) { mDebug = debug; }
+ bool getDebug() const { return mDebug; }
+
+ void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
+ bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
+
+ virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
+
+ protected:
+ TIntermAggregate(const TIntermAggregate &); // disallow copy constructor
+ TIntermAggregate &operator=(const TIntermAggregate &); // disallow assignment operator
+ TIntermSequence mSequence;
+ TString mName;
+ bool mUserDefined; // used for user defined function names
+
+ bool mOptimize;
+ bool mDebug;
+
+ // If set to true, replace the built-in function call with an emulated one
+ // to work around driver bugs.
+ bool mUseEmulatedFunction;
+};
+
+//
+// For if tests. Simplified since there is no switch statement.
+//
+class TIntermSelection : public TIntermTyped
+{
+ public:
+ TIntermSelection(TIntermTyped *cond, TIntermNode *trueB, TIntermNode *falseB)
+ : TIntermTyped(TType(EbtVoid, EbpUndefined)),
+ mCondition(cond),
+ mTrueBlock(trueB),
+ mFalseBlock(falseB) {}
+ TIntermSelection(TIntermTyped *cond, TIntermNode *trueB, TIntermNode *falseB,
+ const TType &type)
+ : TIntermTyped(type),
+ mCondition(cond),
+ mTrueBlock(trueB),
+ mFalseBlock(falseB) {}
+
+ virtual void traverse(TIntermTraverser *);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ // Conservatively assume selections have side-effects
+ virtual bool hasSideEffects() const { return true; }
+
+ bool usesTernaryOperator() const { return getBasicType() != EbtVoid; }
+ TIntermNode *getCondition() const { return mCondition; }
+ TIntermNode *getTrueBlock() const { return mTrueBlock; }
+ TIntermNode *getFalseBlock() const { return mFalseBlock; }
+ TIntermSelection *getAsSelectionNode() { return this; }
+
+ virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
+
+protected:
+ TIntermTyped *mCondition;
+ TIntermNode *mTrueBlock;
+ TIntermNode *mFalseBlock;
+};
+
+enum Visit
+{
+ PreVisit,
+ InVisit,
+ PostVisit
+};
+
+//
+// For traversing the tree. User should derive from this,
+// put their traversal specific data in it, and then pass
+// it to a Traverse method.
+//
+// When using this, just fill in the methods for nodes you want visited.
+// Return false from a pre-visit to skip visiting that node's subtree.
+//
+class TIntermTraverser
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE();
+ // TODO(zmo): remove default values.
+ TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false,
+ bool rightToLeft = false)
+ : preVisit(preVisit),
+ inVisit(inVisit),
+ postVisit(postVisit),
+ rightToLeft(rightToLeft),
+ mDepth(0),
+ mMaxDepth(0) {}
+ virtual ~TIntermTraverser() {}
+
+ virtual void visitSymbol(TIntermSymbol *) {}
+ virtual void visitRaw(TIntermRaw *) {}
+ virtual void visitConstantUnion(TIntermConstantUnion *) {}
+ virtual bool visitBinary(Visit, TIntermBinary *) { return true; }
+ virtual bool visitUnary(Visit, TIntermUnary *) { return true; }
+ virtual bool visitSelection(Visit, TIntermSelection *) { return true; }
+ virtual bool visitAggregate(Visit, TIntermAggregate *) { return true; }
+ virtual bool visitLoop(Visit, TIntermLoop *) { return true; }
+ virtual bool visitBranch(Visit, TIntermBranch *) { return true; }
+
+ int getMaxDepth() const { return mMaxDepth; }
+
+ void incrementDepth(TIntermNode *current)
+ {
+ mDepth++;
+ mMaxDepth = std::max(mMaxDepth, mDepth);
+ mPath.push_back(current);
+ }
+
+ void decrementDepth()
+ {
+ mDepth--;
+ mPath.pop_back();
+ }
+
+ TIntermNode *getParentNode()
+ {
+ return mPath.size() == 0 ? NULL : mPath.back();
+ }
+
+ // 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;
+ const bool rightToLeft;
+
+ protected:
+ int mDepth;
+ int mMaxDepth;
+
+ // All the nodes from root to the current node's parent during traversing.
+ TVector<TIntermNode *> mPath;
+};
+
+//
+// For traversing the tree, and computing max depth.
+// Takes a maximum depth limit to prevent stack overflow.
+//
+class TMaxDepthTraverser : public TIntermTraverser
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE();
+ TMaxDepthTraverser(int depthLimit)
+ : TIntermTraverser(true, true, false, false),
+ mDepthLimit(depthLimit) { }
+
+ virtual bool visitBinary(Visit, TIntermBinary *) { return depthCheck(); }
+ virtual bool visitUnary(Visit, TIntermUnary *) { return depthCheck(); }
+ virtual bool visitSelection(Visit, TIntermSelection *) { return depthCheck(); }
+ virtual bool visitAggregate(Visit, TIntermAggregate *) { return depthCheck(); }
+ virtual bool visitLoop(Visit, TIntermLoop *) { return depthCheck(); }
+ virtual bool visitBranch(Visit, TIntermBranch *) { return depthCheck(); }
+
+protected:
+ bool depthCheck() const { return mMaxDepth < mDepthLimit; }
+
+ int mDepthLimit;
+};
+
+#endif // COMPILER_TRANSLATOR_INTERMEDIATE_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp b/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp
index 48d2013cc5..72b2033fb3 100644
--- a/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
//
// Traverse the intermediate representation tree, and
diff --git a/src/3rdparty/angle/src/compiler/translator/Intermediate.cpp b/src/3rdparty/angle/src/compiler/translator/Intermediate.cpp
index fa0c9f7748..ef4f83307c 100644
--- a/src/3rdparty/angle/src/compiler/translator/Intermediate.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Intermediate.cpp
@@ -12,122 +12,10 @@
#include <limits.h>
#include <algorithm>
-#include "compiler/translator/HashNames.h"
-#include "compiler/translator/localintermediate.h"
-#include "compiler/translator/QualifierAlive.h"
+#include "compiler/translator/Intermediate.h"
#include "compiler/translator/RemoveTree.h"
#include "compiler/translator/SymbolTable.h"
-namespace
-{
-
-TPrecision GetHigherPrecision(TPrecision left, TPrecision right)
-{
- return left > right ? left : right;
-}
-
-bool ValidateMultiplication(TOperator op, const TType &left, const TType &right)
-{
- switch (op)
- {
- case EOpMul:
- case EOpMulAssign:
- return left.getNominalSize() == right.getNominalSize() &&
- left.getSecondarySize() == right.getSecondarySize();
- case EOpVectorTimesScalar:
- case EOpVectorTimesScalarAssign:
- return true;
- case EOpVectorTimesMatrix:
- return left.getNominalSize() == right.getRows();
- case EOpVectorTimesMatrixAssign:
- return left.getNominalSize() == right.getRows() &&
- left.getNominalSize() == right.getCols();
- case EOpMatrixTimesVector:
- return left.getCols() == right.getNominalSize();
- case EOpMatrixTimesScalar:
- case EOpMatrixTimesScalarAssign:
- return true;
- case EOpMatrixTimesMatrix:
- return left.getCols() == right.getRows();
- case EOpMatrixTimesMatrixAssign:
- return left.getCols() == right.getCols() &&
- left.getRows() == right.getRows();
-
- default:
- UNREACHABLE();
- return false;
- }
-}
-
-bool CompareStructure(const TType& leftNodeType,
- ConstantUnion *rightUnionArray,
- ConstantUnion *leftUnionArray);
-
-bool CompareStruct(const TType &leftNodeType,
- ConstantUnion *rightUnionArray,
- ConstantUnion *leftUnionArray)
-{
- const TFieldList &fields = leftNodeType.getStruct()->fields();
-
- size_t structSize = fields.size();
- size_t index = 0;
-
- for (size_t j = 0; j < structSize; j++)
- {
- size_t size = fields[j]->type()->getObjectSize();
- for (size_t i = 0; i < size; i++)
- {
- if (fields[j]->type()->getBasicType() == EbtStruct)
- {
- if (!CompareStructure(*fields[j]->type(),
- &rightUnionArray[index],
- &leftUnionArray[index]))
- {
- return false;
- }
- }
- else
- {
- if (leftUnionArray[index] != rightUnionArray[index])
- return false;
- index++;
- }
- }
- }
- return true;
-}
-
-bool CompareStructure(const TType &leftNodeType,
- ConstantUnion *rightUnionArray,
- ConstantUnion *leftUnionArray)
-{
- if (leftNodeType.isArray())
- {
- TType typeWithoutArrayness = leftNodeType;
- typeWithoutArrayness.clearArrayness();
-
- size_t arraySize = leftNodeType.getArraySize();
-
- for (size_t i = 0; i < arraySize; ++i)
- {
- size_t offset = typeWithoutArrayness.getObjectSize() * i;
- if (!CompareStruct(typeWithoutArrayness,
- &rightUnionArray[offset],
- &leftUnionArray[offset]))
- {
- return false;
- }
- }
- }
- else
- {
- return CompareStruct(leftNodeType, rightUnionArray, leftUnionArray);
- }
- return true;
-}
-
-} // namespace anonymous
-
////////////////////////////////////////////////////////////////////////////
//
// First set of functions are to help build the intermediate representation.
@@ -630,982 +518,3 @@ void TIntermediate::remove(TIntermNode *root)
if (root)
RemoveAllTreeNodes(root);
}
-
-////////////////////////////////////////////////////////////////
-//
-// Member functions of the nodes used for building the tree.
-//
-////////////////////////////////////////////////////////////////
-
-#define REPLACE_IF_IS(node, type, original, replacement) \
- if (node == original) { \
- node = static_cast<type *>(replacement); \
- return true; \
- }
-
-bool TIntermLoop::replaceChildNode(
- TIntermNode *original, TIntermNode *replacement)
-{
- REPLACE_IF_IS(mInit, TIntermNode, original, replacement);
- REPLACE_IF_IS(mCond, TIntermTyped, original, replacement);
- REPLACE_IF_IS(mExpr, TIntermTyped, original, replacement);
- REPLACE_IF_IS(mBody, TIntermNode, original, replacement);
- return false;
-}
-
-void TIntermLoop::enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const
-{
- if (mInit)
- {
- nodeQueue->push(mInit);
- }
- if (mCond)
- {
- nodeQueue->push(mCond);
- }
- if (mExpr)
- {
- nodeQueue->push(mExpr);
- }
- if (mBody)
- {
- nodeQueue->push(mBody);
- }
-}
-
-bool TIntermBranch::replaceChildNode(
- TIntermNode *original, TIntermNode *replacement)
-{
- REPLACE_IF_IS(mExpression, TIntermTyped, original, replacement);
- return false;
-}
-
-void TIntermBranch::enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const
-{
- if (mExpression)
- {
- nodeQueue->push(mExpression);
- }
-}
-
-bool TIntermBinary::replaceChildNode(
- TIntermNode *original, TIntermNode *replacement)
-{
- REPLACE_IF_IS(mLeft, TIntermTyped, original, replacement);
- REPLACE_IF_IS(mRight, TIntermTyped, original, replacement);
- return false;
-}
-
-void TIntermBinary::enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const
-{
- if (mLeft)
- {
- nodeQueue->push(mLeft);
- }
- if (mRight)
- {
- nodeQueue->push(mRight);
- }
-}
-
-bool TIntermUnary::replaceChildNode(
- TIntermNode *original, TIntermNode *replacement)
-{
- REPLACE_IF_IS(mOperand, TIntermTyped, original, replacement);
- return false;
-}
-
-void TIntermUnary::enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const
-{
- if (mOperand)
- {
- nodeQueue->push(mOperand);
- }
-}
-
-bool TIntermAggregate::replaceChildNode(
- TIntermNode *original, TIntermNode *replacement)
-{
- for (size_t ii = 0; ii < mSequence.size(); ++ii)
- {
- REPLACE_IF_IS(mSequence[ii], TIntermNode, original, replacement);
- }
- return false;
-}
-
-void TIntermAggregate::enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const
-{
- for (size_t childIndex = 0; childIndex < mSequence.size(); childIndex++)
- {
- nodeQueue->push(mSequence[childIndex]);
- }
-}
-
-bool TIntermSelection::replaceChildNode(
- TIntermNode *original, TIntermNode *replacement)
-{
- REPLACE_IF_IS(mCondition, TIntermTyped, original, replacement);
- REPLACE_IF_IS(mTrueBlock, TIntermNode, original, replacement);
- REPLACE_IF_IS(mFalseBlock, TIntermNode, original, replacement);
- return false;
-}
-
-void TIntermSelection::enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const
-{
- if (mCondition)
- {
- nodeQueue->push(mCondition);
- }
- if (mTrueBlock)
- {
- nodeQueue->push(mTrueBlock);
- }
- if (mFalseBlock)
- {
- nodeQueue->push(mFalseBlock);
- }
-}
-
-//
-// Say whether or not an operation node changes the value of a variable.
-//
-bool TIntermOperator::isAssignment() const
-{
- switch (mOp)
- {
- case EOpPostIncrement:
- case EOpPostDecrement:
- case EOpPreIncrement:
- case EOpPreDecrement:
- case EOpAssign:
- case EOpAddAssign:
- case EOpSubAssign:
- case EOpMulAssign:
- case EOpVectorTimesMatrixAssign:
- case EOpVectorTimesScalarAssign:
- case EOpMatrixTimesScalarAssign:
- case EOpMatrixTimesMatrixAssign:
- case EOpDivAssign:
- return true;
- default:
- return false;
- }
-}
-
-//
-// returns true if the operator is for one of the constructors
-//
-bool TIntermOperator::isConstructor() const
-{
- switch (mOp)
- {
- case EOpConstructVec2:
- case EOpConstructVec3:
- case EOpConstructVec4:
- case EOpConstructMat2:
- case EOpConstructMat3:
- case EOpConstructMat4:
- case EOpConstructFloat:
- case EOpConstructIVec2:
- case EOpConstructIVec3:
- case EOpConstructIVec4:
- case EOpConstructInt:
- case EOpConstructUVec2:
- case EOpConstructUVec3:
- case EOpConstructUVec4:
- case EOpConstructUInt:
- case EOpConstructBVec2:
- case EOpConstructBVec3:
- case EOpConstructBVec4:
- case EOpConstructBool:
- case EOpConstructStruct:
- return true;
- default:
- return false;
- }
-}
-
-//
-// Make sure the type of a unary operator is appropriate for its
-// combination of operation and operand type.
-//
-// Returns false in nothing makes sense.
-//
-bool TIntermUnary::promote(TInfoSink &)
-{
- switch (mOp)
- {
- case EOpLogicalNot:
- if (mOperand->getBasicType() != EbtBool)
- return false;
- break;
- case EOpNegative:
- case EOpPostIncrement:
- case EOpPostDecrement:
- case EOpPreIncrement:
- case EOpPreDecrement:
- if (mOperand->getBasicType() == EbtBool)
- return false;
- break;
-
- // operators for built-ins are already type checked against their prototype
- case EOpAny:
- case EOpAll:
- case EOpVectorLogicalNot:
- return true;
-
- default:
- if (mOperand->getBasicType() != EbtFloat)
- return false;
- }
-
- setType(mOperand->getType());
- mType.setQualifier(EvqTemporary);
-
- return true;
-}
-
-//
-// Establishes the type of the resultant operation, as well as
-// makes the operator the correct one for the operands.
-//
-// Returns false if operator can't work on operands.
-//
-bool TIntermBinary::promote(TInfoSink &infoSink)
-{
- // This function only handles scalars, vectors, and matrices.
- if (mLeft->isArray() || mRight->isArray())
- {
- infoSink.info.message(EPrefixInternalError, getLine(),
- "Invalid operation for arrays");
- return false;
- }
-
- // GLSL ES 2.0 does not support implicit type casting.
- // So the basic type should always match.
- if (mLeft->getBasicType() != mRight->getBasicType())
- {
- return false;
- }
-
- //
- // Base assumption: just make the type the same as the left
- // operand. Then only deviations from this need be coded.
- //
- setType(mLeft->getType());
-
- // The result gets promoted to the highest precision.
- TPrecision higherPrecision = GetHigherPrecision(
- mLeft->getPrecision(), mRight->getPrecision());
- getTypePointer()->setPrecision(higherPrecision);
-
- // Binary operations results in temporary variables unless both
- // operands are const.
- if (mLeft->getQualifier() != EvqConst || mRight->getQualifier() != EvqConst)
- {
- getTypePointer()->setQualifier(EvqTemporary);
- }
-
- const int nominalSize =
- std::max(mLeft->getNominalSize(), mRight->getNominalSize());
-
- //
- // All scalars or structs. Code after this test assumes this case is removed!
- //
- if (nominalSize == 1)
- {
- switch (mOp)
- {
- //
- // Promote to conditional
- //
- case EOpEqual:
- case EOpNotEqual:
- case EOpLessThan:
- case EOpGreaterThan:
- case EOpLessThanEqual:
- case EOpGreaterThanEqual:
- setType(TType(EbtBool, EbpUndefined));
- break;
-
- //
- // And and Or operate on conditionals
- //
- case EOpLogicalAnd:
- case EOpLogicalOr:
- // Both operands must be of type bool.
- if (mLeft->getBasicType() != EbtBool || mRight->getBasicType() != EbtBool)
- {
- return false;
- }
- setType(TType(EbtBool, EbpUndefined));
- break;
-
- default:
- break;
- }
- return true;
- }
-
- // If we reach here, at least one of the operands is vector or matrix.
- // The other operand could be a scalar, vector, or matrix.
- // Can these two operands be combined?
- //
- TBasicType basicType = mLeft->getBasicType();
- switch (mOp)
- {
- case EOpMul:
- if (!mLeft->isMatrix() && mRight->isMatrix())
- {
- if (mLeft->isVector())
- {
- mOp = EOpVectorTimesMatrix;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- mRight->getCols(), 1));
- }
- else
- {
- mOp = EOpMatrixTimesScalar;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- mRight->getCols(), mRight->getRows()));
- }
- }
- else if (mLeft->isMatrix() && !mRight->isMatrix())
- {
- if (mRight->isVector())
- {
- mOp = EOpMatrixTimesVector;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- mLeft->getRows(), 1));
- }
- else
- {
- mOp = EOpMatrixTimesScalar;
- }
- }
- else if (mLeft->isMatrix() && mRight->isMatrix())
- {
- mOp = EOpMatrixTimesMatrix;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- mRight->getCols(), mLeft->getRows()));
- }
- else if (!mLeft->isMatrix() && !mRight->isMatrix())
- {
- if (mLeft->isVector() && mRight->isVector())
- {
- // leave as component product
- }
- else if (mLeft->isVector() || mRight->isVector())
- {
- mOp = EOpVectorTimesScalar;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- nominalSize, 1));
- }
- }
- else
- {
- infoSink.info.message(EPrefixInternalError, getLine(),
- "Missing elses");
- return false;
- }
-
- if (!ValidateMultiplication(mOp, mLeft->getType(), mRight->getType()))
- {
- return false;
- }
- break;
-
- case EOpMulAssign:
- if (!mLeft->isMatrix() && mRight->isMatrix())
- {
- if (mLeft->isVector())
- {
- mOp = EOpVectorTimesMatrixAssign;
- }
- else
- {
- return false;
- }
- }
- else if (mLeft->isMatrix() && !mRight->isMatrix())
- {
- if (mRight->isVector())
- {
- return false;
- }
- else
- {
- mOp = EOpMatrixTimesScalarAssign;
- }
- }
- else if (mLeft->isMatrix() && mRight->isMatrix())
- {
- mOp = EOpMatrixTimesMatrixAssign;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- mRight->getCols(), mLeft->getRows()));
- }
- else if (!mLeft->isMatrix() && !mRight->isMatrix())
- {
- if (mLeft->isVector() && mRight->isVector())
- {
- // leave as component product
- }
- else if (mLeft->isVector() || mRight->isVector())
- {
- if (!mLeft->isVector())
- return false;
- mOp = EOpVectorTimesScalarAssign;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- mLeft->getNominalSize(), 1));
- }
- }
- else
- {
- infoSink.info.message(EPrefixInternalError, getLine(),
- "Missing elses");
- return false;
- }
-
- if (!ValidateMultiplication(mOp, mLeft->getType(), mRight->getType()))
- {
- return false;
- }
- break;
-
- case EOpAssign:
- case EOpInitialize:
- case EOpAdd:
- case EOpSub:
- case EOpDiv:
- case EOpAddAssign:
- case EOpSubAssign:
- case EOpDivAssign:
- if ((mLeft->isMatrix() && mRight->isVector()) ||
- (mLeft->isVector() && mRight->isMatrix()))
- {
- return false;
- }
-
- // Are the sizes compatible?
- if (mLeft->getNominalSize() != mRight->getNominalSize() ||
- mLeft->getSecondarySize() != mRight->getSecondarySize())
- {
- // If the nominal size of operands do not match:
- // One of them must be scalar.
- if (!mLeft->isScalar() && !mRight->isScalar())
- return false;
-
- // Operator cannot be of type pure assignment.
- if (mOp == EOpAssign || mOp == EOpInitialize)
- return false;
- }
-
- {
- const int secondarySize = std::max(
- mLeft->getSecondarySize(), mRight->getSecondarySize());
- setType(TType(basicType, higherPrecision, EvqTemporary,
- nominalSize, secondarySize));
- }
- break;
-
- case EOpEqual:
- case EOpNotEqual:
- case EOpLessThan:
- case EOpGreaterThan:
- case EOpLessThanEqual:
- case EOpGreaterThanEqual:
- if ((mLeft->getNominalSize() != mRight->getNominalSize()) ||
- (mLeft->getSecondarySize() != mRight->getSecondarySize()))
- {
- return false;
- }
- setType(TType(EbtBool, EbpUndefined));
- break;
-
- default:
- return false;
- }
- return true;
-}
-
-//
-// The fold functions see if an operation on a constant can be done in place,
-// without generating run-time code.
-//
-// Returns the node to keep using, which may or may not be the node passed in.
-//
-TIntermTyped *TIntermConstantUnion::fold(
- TOperator op, TIntermTyped *constantNode, TInfoSink &infoSink)
-{
- ConstantUnion *unionArray = getUnionArrayPointer();
-
- if (!unionArray)
- return NULL;
-
- size_t objectSize = getType().getObjectSize();
-
- if (constantNode)
- {
- // binary operations
- TIntermConstantUnion *node = constantNode->getAsConstantUnion();
- ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
- TType returnType = getType();
-
- if (!rightUnionArray)
- return NULL;
-
- // for a case like float f = 1.2 + vec4(2,3,4,5);
- if (constantNode->getType().getObjectSize() == 1 && objectSize > 1)
- {
- rightUnionArray = new ConstantUnion[objectSize];
- for (size_t i = 0; i < objectSize; ++i)
- {
- rightUnionArray[i] = *node->getUnionArrayPointer();
- }
- returnType = getType();
- }
- else if (constantNode->getType().getObjectSize() > 1 && objectSize == 1)
- {
- // for a case like float f = vec4(2,3,4,5) + 1.2;
- unionArray = new ConstantUnion[constantNode->getType().getObjectSize()];
- for (size_t i = 0; i < constantNode->getType().getObjectSize(); ++i)
- {
- unionArray[i] = *getUnionArrayPointer();
- }
- returnType = node->getType();
- objectSize = constantNode->getType().getObjectSize();
- }
-
- ConstantUnion *tempConstArray = NULL;
- TIntermConstantUnion *tempNode;
-
- bool boolNodeFlag = false;
- switch(op)
- {
- case EOpAdd:
- tempConstArray = new ConstantUnion[objectSize];
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] + rightUnionArray[i];
- break;
- case EOpSub:
- tempConstArray = new ConstantUnion[objectSize];
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] - rightUnionArray[i];
- break;
-
- case EOpMul:
- case EOpVectorTimesScalar:
- case EOpMatrixTimesScalar:
- tempConstArray = new ConstantUnion[objectSize];
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] * rightUnionArray[i];
- break;
-
- case EOpMatrixTimesMatrix:
- {
- if (getType().getBasicType() != EbtFloat ||
- node->getBasicType() != EbtFloat)
- {
- infoSink.info.message(
- EPrefixInternalError, getLine(),
- "Constant Folding cannot be done for matrix multiply");
- return NULL;
- }
-
- const int leftCols = getCols();
- const int leftRows = getRows();
- const int rightCols = constantNode->getType().getCols();
- const int rightRows = constantNode->getType().getRows();
- const int resultCols = rightCols;
- const int resultRows = leftRows;
-
- tempConstArray = new ConstantUnion[resultCols*resultRows];
- for (int row = 0; row < resultRows; row++)
- {
- for (int column = 0; column < resultCols; column++)
- {
- tempConstArray[resultRows * column + row].setFConst(0.0f);
- for (int i = 0; i < leftCols; i++)
- {
- tempConstArray[resultRows * column + row].setFConst(
- tempConstArray[resultRows * column + row].getFConst() +
- unionArray[i * leftRows + row].getFConst() *
- rightUnionArray[column * rightRows + i].getFConst());
- }
- }
- }
-
- // update return type for matrix product
- returnType.setPrimarySize(resultCols);
- returnType.setSecondarySize(resultRows);
- }
- break;
-
- case EOpDiv:
- {
- tempConstArray = new ConstantUnion[objectSize];
- for (size_t i = 0; i < objectSize; i++)
- {
- switch (getType().getBasicType())
- {
- case EbtFloat:
- if (rightUnionArray[i] == 0.0f)
- {
- infoSink.info.message(
- EPrefixWarning, getLine(),
- "Divide by zero error during constant folding");
- tempConstArray[i].setFConst(
- unionArray[i].getFConst() < 0 ? -FLT_MAX : FLT_MAX);
- }
- else
- {
- tempConstArray[i].setFConst(
- unionArray[i].getFConst() /
- rightUnionArray[i].getFConst());
- }
- break;
-
- case EbtInt:
- if (rightUnionArray[i] == 0)
- {
- infoSink.info.message(
- EPrefixWarning, getLine(),
- "Divide by zero error during constant folding");
- tempConstArray[i].setIConst(INT_MAX);
- }
- else
- {
- tempConstArray[i].setIConst(
- unionArray[i].getIConst() /
- rightUnionArray[i].getIConst());
- }
- break;
-
- case EbtUInt:
- if (rightUnionArray[i] == 0)
- {
- infoSink.info.message(
- EPrefixWarning, getLine(),
- "Divide by zero error during constant folding");
- tempConstArray[i].setUConst(UINT_MAX);
- }
- else
- {
- tempConstArray[i].setUConst(
- unionArray[i].getUConst() /
- rightUnionArray[i].getUConst());
- }
- break;
-
- default:
- infoSink.info.message(
- EPrefixInternalError, getLine(),
- "Constant folding cannot be done for \"/\"");
- return NULL;
- }
- }
- }
- break;
-
- case EOpMatrixTimesVector:
- {
- if (node->getBasicType() != EbtFloat)
- {
- infoSink.info.message(
- EPrefixInternalError, getLine(),
- "Constant Folding cannot be done for matrix times vector");
- return NULL;
- }
-
- const int matrixCols = getCols();
- const int matrixRows = getRows();
-
- tempConstArray = new ConstantUnion[matrixRows];
-
- for (int matrixRow = 0; matrixRow < matrixRows; matrixRow++)
- {
- tempConstArray[matrixRow].setFConst(0.0f);
- for (int col = 0; col < matrixCols; col++)
- {
- tempConstArray[matrixRow].setFConst(
- tempConstArray[matrixRow].getFConst() +
- unionArray[col * matrixRows + matrixRow].getFConst() *
- rightUnionArray[col].getFConst());
- }
- }
-
- returnType = node->getType();
- returnType.setPrimarySize(matrixRows);
-
- tempNode = new TIntermConstantUnion(tempConstArray, returnType);
- tempNode->setLine(getLine());
-
- return tempNode;
- }
-
- case EOpVectorTimesMatrix:
- {
- if (getType().getBasicType() != EbtFloat)
- {
- infoSink.info.message(
- EPrefixInternalError, getLine(),
- "Constant Folding cannot be done for vector times matrix");
- return NULL;
- }
-
- const int matrixCols = constantNode->getType().getCols();
- const int matrixRows = constantNode->getType().getRows();
-
- tempConstArray = new ConstantUnion[matrixCols];
-
- for (int matrixCol = 0; matrixCol < matrixCols; matrixCol++)
- {
- tempConstArray[matrixCol].setFConst(0.0f);
- for (int matrixRow = 0; matrixRow < matrixRows; matrixRow++)
- {
- tempConstArray[matrixCol].setFConst(
- tempConstArray[matrixCol].getFConst() +
- unionArray[matrixRow].getFConst() *
- rightUnionArray[matrixCol * matrixRows + matrixRow].getFConst());
- }
- }
-
- returnType.setPrimarySize(matrixCols);
- }
- break;
-
- case EOpLogicalAnd:
- // this code is written for possible future use,
- // will not get executed currently
- {
- tempConstArray = new ConstantUnion[objectSize];
- for (size_t i = 0; i < objectSize; i++)
- {
- tempConstArray[i] = unionArray[i] && rightUnionArray[i];
- }
- }
- break;
-
- case EOpLogicalOr:
- // this code is written for possible future use,
- // will not get executed currently
- {
- tempConstArray = new ConstantUnion[objectSize];
- for (size_t i = 0; i < objectSize; i++)
- {
- tempConstArray[i] = unionArray[i] || rightUnionArray[i];
- }
- }
- break;
-
- case EOpLogicalXor:
- {
- tempConstArray = new ConstantUnion[objectSize];
- for (size_t i = 0; i < objectSize; i++)
- {
- switch (getType().getBasicType())
- {
- case EbtBool:
- tempConstArray[i].setBConst(
- unionArray[i] == rightUnionArray[i] ? false : true);
- break;
- default:
- UNREACHABLE();
- break;
- }
- }
- }
- break;
-
- case EOpLessThan:
- ASSERT(objectSize == 1);
- tempConstArray = new ConstantUnion[1];
- tempConstArray->setBConst(*unionArray < *rightUnionArray);
- returnType = TType(EbtBool, EbpUndefined, EvqConst);
- break;
-
- case EOpGreaterThan:
- ASSERT(objectSize == 1);
- tempConstArray = new ConstantUnion[1];
- tempConstArray->setBConst(*unionArray > *rightUnionArray);
- returnType = TType(EbtBool, EbpUndefined, EvqConst);
- break;
-
- case EOpLessThanEqual:
- {
- ASSERT(objectSize == 1);
- ConstantUnion constant;
- constant.setBConst(*unionArray > *rightUnionArray);
- tempConstArray = new ConstantUnion[1];
- tempConstArray->setBConst(!constant.getBConst());
- returnType = TType(EbtBool, EbpUndefined, EvqConst);
- break;
- }
-
- case EOpGreaterThanEqual:
- {
- ASSERT(objectSize == 1);
- ConstantUnion constant;
- constant.setBConst(*unionArray < *rightUnionArray);
- tempConstArray = new ConstantUnion[1];
- tempConstArray->setBConst(!constant.getBConst());
- returnType = TType(EbtBool, EbpUndefined, EvqConst);
- break;
- }
-
- case EOpEqual:
- if (getType().getBasicType() == EbtStruct)
- {
- if (!CompareStructure(node->getType(),
- node->getUnionArrayPointer(),
- unionArray))
- {
- boolNodeFlag = true;
- }
- }
- else
- {
- for (size_t i = 0; i < objectSize; i++)
- {
- if (unionArray[i] != rightUnionArray[i])
- {
- boolNodeFlag = true;
- break; // break out of for loop
- }
- }
- }
-
- tempConstArray = new ConstantUnion[1];
- if (!boolNodeFlag)
- {
- tempConstArray->setBConst(true);
- }
- else
- {
- tempConstArray->setBConst(false);
- }
-
- tempNode = new TIntermConstantUnion(
- tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
- tempNode->setLine(getLine());
-
- return tempNode;
-
- case EOpNotEqual:
- if (getType().getBasicType() == EbtStruct)
- {
- if (CompareStructure(node->getType(),
- node->getUnionArrayPointer(),
- unionArray))
- {
- boolNodeFlag = true;
- }
- }
- else
- {
- for (size_t i = 0; i < objectSize; i++)
- {
- if (unionArray[i] == rightUnionArray[i])
- {
- boolNodeFlag = true;
- break; // break out of for loop
- }
- }
- }
-
- tempConstArray = new ConstantUnion[1];
- if (!boolNodeFlag)
- {
- tempConstArray->setBConst(true);
- }
- else
- {
- tempConstArray->setBConst(false);
- }
-
- tempNode = new TIntermConstantUnion(
- tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
- tempNode->setLine(getLine());
-
- return tempNode;
-
- default:
- infoSink.info.message(
- EPrefixInternalError, getLine(),
- "Invalid operator for constant folding");
- return NULL;
- }
- tempNode = new TIntermConstantUnion(tempConstArray, returnType);
- tempNode->setLine(getLine());
-
- return tempNode;
- }
- else
- {
- //
- // Do unary operations
- //
- TIntermConstantUnion *newNode = 0;
- ConstantUnion* tempConstArray = new ConstantUnion[objectSize];
- for (size_t i = 0; i < objectSize; i++)
- {
- switch(op)
- {
- case EOpNegative:
- switch (getType().getBasicType())
- {
- case EbtFloat:
- tempConstArray[i].setFConst(-unionArray[i].getFConst());
- break;
- case EbtInt:
- tempConstArray[i].setIConst(-unionArray[i].getIConst());
- break;
- case EbtUInt:
- tempConstArray[i].setUConst(static_cast<unsigned int>(
- -static_cast<int>(unionArray[i].getUConst())));
- break;
- default:
- infoSink.info.message(
- EPrefixInternalError, getLine(),
- "Unary operation not folded into constant");
- return NULL;
- }
- break;
-
- case EOpLogicalNot:
- // this code is written for possible future use,
- // will not get executed currently
- switch (getType().getBasicType())
- {
- case EbtBool:
- tempConstArray[i].setBConst(!unionArray[i].getBConst());
- break;
- default:
- infoSink.info.message(
- EPrefixInternalError, getLine(),
- "Unary operation not folded into constant");
- return NULL;
- }
- break;
-
- default:
- return NULL;
- }
- }
- newNode = new TIntermConstantUnion(tempConstArray, getType());
- newNode->setLine(getLine());
- return newNode;
- }
-}
-
-// 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/translator/LoopInfo.h b/src/3rdparty/angle/src/compiler/translator/LoopInfo.h
index 5a140c339e..5f72a6e944 100644
--- a/src/3rdparty/angle/src/compiler/translator/LoopInfo.h
+++ b/src/3rdparty/angle/src/compiler/translator/LoopInfo.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_TRANSLATOR_LOOP_INFO_H_
#define COMPILER_TRANSLATOR_LOOP_INFO_H_
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
class TLoopIndexInfo
{
diff --git a/src/3rdparty/angle/src/compiler/translator/NodeSearch.h b/src/3rdparty/angle/src/compiler/translator/NodeSearch.h
index b58c7ec689..60070c9d33 100644
--- a/src/3rdparty/angle/src/compiler/translator/NodeSearch.h
+++ b/src/3rdparty/angle/src/compiler/translator/NodeSearch.h
@@ -9,7 +9,7 @@
#ifndef TRANSLATOR_NODESEARCH_H_
#define TRANSLATOR_NODESEARCH_H_
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp
index 7839c04852..6d07cccc04 100644
--- a/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp
@@ -81,9 +81,10 @@ void TOutputGLSLBase::writeVariableType(const TType &type)
{
TInfoSinkBase &out = objSink();
TQualifier qualifier = type.getQualifier();
- // TODO(alokp): Validate qualifier for variable declarations.
if (qualifier != EvqTemporary && qualifier != EvqGlobal)
+ {
out << type.getQualifierString() << " ";
+ }
// Declare the struct if we have not done so already.
if (type.getBasicType() == EbtStruct && !structDeclared(type.getStruct()))
{
@@ -648,6 +649,17 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
mDeclaringVariables = false;
}
break;
+ case EOpInvariantDeclaration: {
+ // Invariant declaration.
+ ASSERT(visit == PreVisit);
+ const TIntermSequence *sequence = node->getSequence();
+ ASSERT(sequence && sequence->size() == 1);
+ const TIntermSymbol *symbol = sequence->front()->getAsSymbolNode();
+ ASSERT(symbol);
+ out << "invariant " << symbol->getSymbol() << ";";
+ visitChildren = false;
+ break;
+ }
case EOpConstructFloat:
writeTriplet(visit, "float(", NULL, ")");
break;
diff --git a/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h
index 42364de6f5..e5174f5660 100644
--- a/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h
+++ b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h
@@ -9,7 +9,7 @@
#include <set>
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#include "compiler/translator/LoopInfo.h"
#include "compiler/translator/ParseContext.h"
diff --git a/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
index 1bf1181af0..a5ea71599d 100644
--- a/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
@@ -21,6 +21,7 @@
#include "compiler/translator/util.h"
#include "compiler/translator/UniformHLSL.h"
#include "compiler/translator/StructureHLSL.h"
+#include "compiler/translator/TranslatorHLSL.h"
#include <algorithm>
#include <cfloat>
@@ -93,8 +94,10 @@ bool OutputHLSL::TextureFunction::operator<(const TextureFunction &rhs) const
return false;
}
-OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType)
- : TIntermTraverser(true, true, true), mContext(context), mOutputType(outputType)
+OutputHLSL::OutputHLSL(TParseContext &context, TranslatorHLSL *parentTranslator)
+ : TIntermTraverser(true, true, true),
+ mContext(context),
+ mOutputType(parentTranslator->getOutputType())
{
mUnfoldShortCircuit = new UnfoldShortCircuit(context, this);
mInsideFunction = false;
@@ -126,6 +129,7 @@ OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resourc
mUsesDiscardRewriting = false;
mUsesNestedBreak = false;
+ const ShBuiltInResources &resources = parentTranslator->getResources();
mNumRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
mUniqueIndex = 0;
@@ -138,7 +142,7 @@ OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resourc
mExcessiveLoopIndex = NULL;
mStructureHLSL = new StructureHLSL;
- mUniformHLSL = new UniformHLSL(mStructureHLSL, mOutputType);
+ mUniformHLSL = new UniformHLSL(mStructureHLSL, parentTranslator);
if (mOutputType == SH_HLSL9_OUTPUT)
{
@@ -212,31 +216,6 @@ TInfoSinkBase &OutputHLSL::getBodyStream()
return mBody;
}
-const std::vector<sh::Uniform> &OutputHLSL::getUniforms()
-{
- return mUniformHLSL->getUniforms();
-}
-
-const std::vector<sh::InterfaceBlock> &OutputHLSL::getInterfaceBlocks() const
-{
- return mUniformHLSL->getInterfaceBlocks();
-}
-
-const std::vector<sh::Attribute> &OutputHLSL::getOutputVariables() const
-{
- return mActiveOutputVariables;
-}
-
-const std::vector<sh::Attribute> &OutputHLSL::getAttributes() const
-{
- return mActiveAttributes;
-}
-
-const std::vector<sh::Varying> &OutputHLSL::getVaryings() const
-{
- return mActiveVaryings;
-}
-
const std::map<std::string, unsigned int> &OutputHLSL::getInterfaceBlockRegisterMap() const
{
return mUniformHLSL->getInterfaceBlockRegisterMap();
@@ -324,8 +303,6 @@ void OutputHLSL::header()
// Program linking depends on this exact format
varyings += "static " + InterpolationString(type.getQualifier()) + " " + TypeString(type) + " " +
Decorate(name) + ArrayString(type) + " = " + initializer(type) + ";\n";
-
- declareVaryingToList(type, type.getQualifier(), name, mActiveVaryings);
}
for (ReferencedSymbols::const_iterator attribute = mReferencedAttributes.begin(); attribute != mReferencedAttributes.end(); attribute++)
@@ -334,10 +311,6 @@ void OutputHLSL::header()
const TString &name = attribute->second->getSymbol();
attributes += "static " + TypeString(type) + " " + Decorate(name) + ArrayString(type) + " = " + initializer(type) + ";\n";
-
- sh::Attribute attributeVar(GLVariableType(type), GLVariablePrecision(type), name.c_str(),
- (unsigned int)type.getArraySize(), type.getLayoutQualifier().location);
- mActiveAttributes.push_back(attributeVar);
}
out << mStructureHLSL->structsHeader();
@@ -370,14 +343,9 @@ void OutputHLSL::header()
{
const TString &variableName = outputVariableIt->first;
const TType &variableType = outputVariableIt->second->getType();
- const TLayoutQualifier &layoutQualifier = variableType.getLayoutQualifier();
out << "static " + TypeString(variableType) + " out_" + variableName + ArrayString(variableType) +
" = " + initializer(variableType) + ";\n";
-
- sh::Attribute outputVar(GLVariableType(variableType), GLVariablePrecision(variableType), variableName.c_str(),
- (unsigned int)variableType.getArraySize(), layoutQualifier.location);
- mActiveOutputVariables.push_back(outputVar);
}
}
else
@@ -1951,6 +1919,9 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
out << ", ";
}
break;
+ case EOpInvariantDeclaration:
+ // Do not do any translation
+ return false;
case EOpPrototype:
if (visit == PreVisit)
{
@@ -2910,29 +2881,4 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con
return constUnion;
}
-class DeclareVaryingTraverser : public GetVariableTraverser<Varying>
-{
- public:
- DeclareVaryingTraverser(std::vector<Varying> *output,
- InterpolationType interpolation)
- : GetVariableTraverser(output),
- mInterpolation(interpolation)
- {}
-
- private:
- void visitVariable(Varying *varying)
- {
- varying->interpolation = mInterpolation;
- }
-
- InterpolationType mInterpolation;
-};
-
-void OutputHLSL::declareVaryingToList(const TType &type, TQualifier baseTypeQualifier,
- const TString &name, std::vector<Varying> &fieldsOut)
-{
- DeclareVaryingTraverser traverser(&fieldsOut, GetInterpolationType(baseTypeQualifier));
- traverser.traverse(type, name);
-}
-
}
diff --git a/src/3rdparty/angle/src/compiler/translator/OutputHLSL.h b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.h
index 78bb741a11..bec02479bb 100644
--- a/src/3rdparty/angle/src/compiler/translator/OutputHLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.h
@@ -12,9 +12,9 @@
#include <map>
#include "angle_gl.h"
-#include "compiler/translator/intermediate.h"
+
+#include "compiler/translator/IntermNode.h"
#include "compiler/translator/ParseContext.h"
-#include "common/shadervars.h"
namespace sh
{
@@ -27,17 +27,12 @@ typedef std::map<TString, TIntermSymbol*> ReferencedSymbols;
class OutputHLSL : public TIntermTraverser
{
public:
- OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType);
+ OutputHLSL(TParseContext &context, TranslatorHLSL *parentTranslator);
~OutputHLSL();
void output();
TInfoSinkBase &getBodyStream();
- const std::vector<sh::Uniform> &getUniforms();
- const std::vector<sh::InterfaceBlock> &getInterfaceBlocks() const;
- const std::vector<sh::Attribute> &getOutputVariables() const;
- const std::vector<sh::Attribute> &getAttributes() const;
- const std::vector<sh::Varying> &getVaryings() const;
const std::map<std::string, unsigned int> &getInterfaceBlockRegisterMap() const;
const std::map<std::string, unsigned int> &getUniformRegisterMap() const;
@@ -155,13 +150,8 @@ class OutputHLSL : public TIntermTraverser
TIntermSymbol *mExcessiveLoopIndex;
- void declareVaryingToList(const TType &type, TQualifier baseTypeQualifier, const TString &name, std::vector<sh::Varying>& fieldsOut);
-
TString structInitializerString(int indent, const TStructure &structure, const TString &rhsStructName);
- std::vector<sh::Attribute> mActiveOutputVariables;
- std::vector<sh::Attribute> mActiveAttributes;
- std::vector<sh::Varying> mActiveVaryings;
std::map<TIntermTyped*, TString> mFlaggedStructMappedNames;
std::map<TIntermTyped*, TString> mFlaggedStructOriginalNames;
diff --git a/src/3rdparty/angle/src/compiler/translator/ParseContext.cpp b/src/3rdparty/angle/src/compiler/translator/ParseContext.cpp
index 605612ac37..ff0a49667c 100644
--- a/src/3rdparty/angle/src/compiler/translator/ParseContext.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ParseContext.cpp
@@ -1018,6 +1018,45 @@ void TParseContext::handlePragmaDirective(const TSourceLoc& loc, const char* nam
//
/////////////////////////////////////////////////////////////////////////////////
+const TVariable *TParseContext::getNamedVariable(const TSourceLoc &location,
+ const TString *name,
+ const TSymbol *symbol)
+{
+ const TVariable *variable = NULL;
+
+ if (!symbol)
+ {
+ error(location, "undeclared identifier", name->c_str());
+ recover();
+ }
+ else if (!symbol->isVariable())
+ {
+ error(location, "variable expected", name->c_str());
+ recover();
+ }
+ else
+ {
+ variable = static_cast<const TVariable*>(symbol);
+
+ if (symbolTable.findBuiltIn(variable->getName(), shaderVersion) &&
+ !variable->getExtension().empty() &&
+ extensionErrorCheck(location, variable->getExtension()))
+ {
+ recover();
+ }
+ }
+
+ if (!variable)
+ {
+ TType type(EbtFloat, EbpUndefined);
+ TVariable *fakeVariable = new TVariable(name, type);
+ symbolTable.declare(fakeVariable);
+ variable = fakeVariable;
+ }
+
+ return variable;
+}
+
//
// Look up a function name in the symbol table, and make sure it is a function.
//
@@ -1050,6 +1089,8 @@ const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction*
// Initializers show up in several places in the grammar. Have one set of
// code to handle them here.
//
+// Returns true on error, false if no error
+//
bool TParseContext::executeInitializer(const TSourceLoc& line, const TString& identifier, TPublicType& pType,
TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable)
{
@@ -1308,14 +1349,40 @@ TIntermAggregate* TParseContext::parseSingleInitDeclaration(TPublicType &publicT
}
}
-TIntermAggregate* TParseContext::parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc& identifierLocation, const TString &identifier)
+TIntermAggregate* TParseContext::parseInvariantDeclaration(const TSourceLoc &invariantLoc,
+ const TSourceLoc &identifierLoc,
+ const TString *identifier,
+ const TSymbol *symbol)
{
- if (publicType.type == EbtInvariant && !identifierSymbol)
+ // invariant declaration
+ if (globalErrorCheck(invariantLoc, symbolTable.atGlobalLevel(), "invariant varying"))
+ {
+ recover();
+ }
+
+ if (!symbol)
{
- error(identifierLocation, "undeclared identifier declared as invariant", identifier.c_str());
+ error(identifierLoc, "undeclared identifier declared as invariant", identifier->c_str());
recover();
+
+ return NULL;
}
+ else
+ {
+ const TVariable *variable = getNamedVariable(identifierLoc, identifier, symbol);
+ ASSERT(variable);
+ const TType &type = variable->getType();
+ TIntermSymbol *intermSymbol = intermediate.addSymbol(variable->getUniqueId(),
+ *identifier, type, identifierLoc);
+ TIntermAggregate *aggregate = intermediate.makeAggregate(intermSymbol, identifierLoc);
+ aggregate->setOp(EOpInvariantDeclaration);
+ return aggregate;
+ }
+}
+
+TIntermAggregate* TParseContext::parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc& identifierLocation, const TString &identifier)
+{
TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierLocation);
TIntermAggregate* intermAggregate = intermediate.growAggregate(aggregateDeclaration, symbol, identifierLocation);
@@ -1548,7 +1615,7 @@ TIntermTyped *TParseContext::addConstructor(TIntermNode *arguments, const TType
for (size_t i = 0; i < fields.size(); i++)
{
- if ((*args)[i]->getAsTyped()->getType() != *fields[i]->type())
+ if (i >= args->size() || (*args)[i]->getAsTyped()->getType() != *fields[i]->type())
{
error(line, "Structure constructor arguments do not match structure fields", "Error");
recover();
diff --git a/src/3rdparty/angle/src/compiler/translator/ParseContext.h b/src/3rdparty/angle/src/compiler/translator/ParseContext.h
index a402eec78e..1f4cbdeba9 100644
--- a/src/3rdparty/angle/src/compiler/translator/ParseContext.h
+++ b/src/3rdparty/angle/src/compiler/translator/ParseContext.h
@@ -9,7 +9,7 @@
#include "compiler/translator/Compiler.h"
#include "compiler/translator/Diagnostics.h"
#include "compiler/translator/DirectiveHandler.h"
-#include "compiler/translator/localintermediate.h"
+#include "compiler/translator/Intermediate.h"
#include "compiler/translator/SymbolTable.h"
#include "compiler/preprocessor/Preprocessor.h"
@@ -77,6 +77,9 @@ struct TParseContext {
void trace(const char* str);
void recover();
+ // This method is guaranteed to succeed, even if no variable with 'name' exists.
+ const TVariable *getNamedVariable(const TSourceLoc &location, const TString *name, const TSymbol *symbol);
+
bool parseVectorFields(const TString&, int vecSize, TVectorFields&, const TSourceLoc& line);
bool parseMatrixFields(const TString&, int matCols, int matRows, TMatrixFields&, const TSourceLoc& line);
@@ -126,6 +129,8 @@ struct TParseContext {
TIntermAggregate* parseSingleDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier);
TIntermAggregate* parseSingleArrayDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& indexLocation, TIntermTyped *indexExpression);
TIntermAggregate* parseSingleInitDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer);
+ TIntermAggregate* parseInvariantDeclaration(const TSourceLoc &invariantLoc, const TSourceLoc &identifierLoc, const TString *identifier, const TSymbol *symbol);
+
TIntermAggregate* parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc& identifierLocation, const TString &identifier);
TIntermAggregate* parseArrayDeclarator(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& arrayLocation, TIntermNode *declaratorList, TIntermTyped *indexExpression);
TIntermAggregate* parseInitDeclarator(TPublicType &publicType, TIntermAggregate *declaratorList, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer);
diff --git a/src/3rdparty/angle/src/compiler/translator/QualifierAlive.cpp b/src/3rdparty/angle/src/compiler/translator/QualifierAlive.cpp
index 1ba087e176..1f6fb75821 100644
--- a/src/3rdparty/angle/src/compiler/translator/QualifierAlive.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/QualifierAlive.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
class TAliveTraverser : public TIntermTraverser {
public:
diff --git a/src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.cpp b/src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.cpp
new file mode 100644
index 0000000000..767b18085c
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.cpp
@@ -0,0 +1,82 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/RegenerateStructNames.h"
+#include "compiler/translator/compilerdebug.h"
+
+void RegenerateStructNames::visitSymbol(TIntermSymbol *symbol)
+{
+ ASSERT(symbol);
+ TType *type = symbol->getTypePointer();
+ ASSERT(type);
+ TStructure *userType = type->getStruct();
+ if (!userType)
+ return;
+
+ if (mSymbolTable.findBuiltIn(userType->name(), mShaderVersion))
+ {
+ // Built-in struct, do not touch it.
+ return;
+ }
+
+ int uniqueId = userType->uniqueId();
+
+ ASSERT(mScopeDepth > 0);
+ if (mScopeDepth == 1)
+ {
+ // If a struct is defined at global scope, we don't map its name.
+ // This is because at global level, the struct might be used to
+ // declare a uniform, so the same name needs to stay the same for
+ // vertex/fragment shaders. However, our mapping uses internal ID,
+ // which will be different for the same struct in vertex/fragment
+ // shaders.
+ // This is OK because names for any structs defined in other scopes
+ // will begin with "_webgl", which is reserved. So there will be
+ // no conflicts among unmapped struct names from global scope and
+ // mapped struct names from other scopes.
+ // However, we need to keep track of these global structs, so if a
+ // variable is used in a local scope, we don't try to modify the
+ // struct name through that variable.
+ mDeclaredGlobalStructs.insert(uniqueId);
+ return;
+ }
+ if (mDeclaredGlobalStructs.count(uniqueId) > 0)
+ return;
+ // Map {name} to _webgl_struct_{uniqueId}_{name}.
+ const char kPrefix[] = "_webgl_struct_";
+ if (userType->name().find(kPrefix) == 0)
+ {
+ // The name has already been regenerated.
+ return;
+ }
+ std::string id = Str(uniqueId);
+ TString tmp = kPrefix + TString(id.c_str());
+ tmp += "_" + userType->name();
+ userType->setName(tmp);
+}
+
+bool RegenerateStructNames::visitAggregate(Visit, TIntermAggregate *aggregate)
+{
+ ASSERT(aggregate);
+ switch (aggregate->getOp())
+ {
+ case EOpSequence:
+ ++mScopeDepth;
+ {
+ TIntermSequence &sequence = *(aggregate->getSequence());
+ for (size_t ii = 0; ii < sequence.size(); ++ii)
+ {
+ TIntermNode *node = sequence[ii];
+ ASSERT(node != NULL);
+ node->traverse(this);
+ }
+ }
+ --mScopeDepth;
+ return false;
+ default:
+ return true;
+ }
+}
diff --git a/src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.h b/src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.h
new file mode 100644
index 0000000000..ac87600347
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.h
@@ -0,0 +1,40 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_REGENERATE_STRUCT_NAMES_H_
+#define COMPILER_TRANSLATOR_REGENERATE_STRUCT_NAMES_H_
+
+#include "compiler/translator/Intermediate.h"
+#include "compiler/translator/SymbolTable.h"
+
+#include <set>
+
+class RegenerateStructNames : public TIntermTraverser
+{
+ public:
+ RegenerateStructNames(const TSymbolTable &symbolTable,
+ int shaderVersion)
+ : mSymbolTable(symbolTable),
+ mShaderVersion(shaderVersion),
+ mScopeDepth(0) {}
+
+ protected:
+ virtual void visitSymbol(TIntermSymbol *);
+ virtual bool visitAggregate(Visit, TIntermAggregate *);
+
+ private:
+ const TSymbolTable &mSymbolTable;
+ int mShaderVersion;
+
+ // Indicating the depth of the current scope.
+ // The global scope is 1.
+ int mScopeDepth;
+
+ // If a struct's declared globally, push its ID in this set.
+ std::set<int> mDeclaredGlobalStructs;
+};
+
+#endif // COMPILER_TRANSLATOR_REGENERATE_STRUCT_NAMES_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/RemoveTree.cpp b/src/3rdparty/angle/src/compiler/translator/RemoveTree.cpp
index e381c32690..0cf6910aa2 100644
--- a/src/3rdparty/angle/src/compiler/translator/RemoveTree.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/RemoveTree.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#include "compiler/translator/RemoveTree.h"
//
diff --git a/src/3rdparty/angle/src/compiler/translator/RenameFunction.h b/src/3rdparty/angle/src/compiler/translator/RenameFunction.h
index 1f7fb16c45..d43e6ef7be 100644
--- a/src/3rdparty/angle/src/compiler/translator/RenameFunction.h
+++ b/src/3rdparty/angle/src/compiler/translator/RenameFunction.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_RENAME_FUNCTION
#define COMPILER_RENAME_FUNCTION
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
//
// Renames a function, including its declaration and any calls to it.
diff --git a/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h b/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h
index 39963d6a82..d87baea0fe 100644
--- a/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h
+++ b/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h
@@ -10,7 +10,7 @@
#ifndef COMPILER_REWRITE_ELSE_BLOCKS_H_
#define COMPILER_REWRITE_ELSE_BLOCKS_H_
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp b/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp
index 3a179f7499..8857ad59bd 100644
--- a/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp
@@ -9,6 +9,7 @@
#include <algorithm>
+#include "angle_gl.h"
#include "common/angleutils.h"
namespace
@@ -249,6 +250,16 @@ TString ScalarizeVecAndMatConstructorArgs::createTempVariable(TIntermTyped *orig
TType type = original->getType();
type.setQualifier(EvqTemporary);
+ if (mShaderType == GL_FRAGMENT_SHADER &&
+ type.getBasicType() == EbtFloat &&
+ type.getPrecision() == EbpUndefined)
+ {
+ // We use the highest available precision for the temporary variable
+ // to avoid computing the actual precision using the rules defined
+ // in GLSL ES 1.0 Section 4.5.2.
+ type.setPrecision(mFragmentPrecisionHigh ? EbpHigh : EbpMedium);
+ }
+
TIntermBinary *init = new TIntermBinary(EOpInitialize);
TIntermSymbol *symbolNode = new TIntermSymbol(-1, tempVarName, type);
init->setLeft(symbolNode);
diff --git a/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h b/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h
index 6aeb0c4f60..7c6d09c1bb 100644
--- a/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h
+++ b/src/3rdparty/angle/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h
@@ -7,13 +7,16 @@
#ifndef COMPILER_TRANSLATOR_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS_H_
#define COMPILER_TRANSLATOR_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS_H_
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
class ScalarizeVecAndMatConstructorArgs : public TIntermTraverser
{
public:
- ScalarizeVecAndMatConstructorArgs()
- : mTempVarCount(0) {}
+ ScalarizeVecAndMatConstructorArgs(sh::GLenum shaderType,
+ bool fragmentPrecisionHigh)
+ : mTempVarCount(0),
+ mShaderType(shaderType),
+ mFragmentPrecisionHigh(fragmentPrecisionHigh) {}
protected:
virtual bool visitAggregate(Visit visit, TIntermAggregate *node);
@@ -36,6 +39,9 @@ class ScalarizeVecAndMatConstructorArgs : public TIntermTraverser
std::vector<TIntermSequence> mSequenceStack;
int mTempVarCount;
+
+ sh::GLenum mShaderType;
+ bool mFragmentPrecisionHigh;
};
#endif // COMPILER_TRANSLATOR_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/SearchSymbol.h b/src/3rdparty/angle/src/compiler/translator/SearchSymbol.h
index 8ddd3cb1ac..029ac30b9a 100644
--- a/src/3rdparty/angle/src/compiler/translator/SearchSymbol.h
+++ b/src/3rdparty/angle/src/compiler/translator/SearchSymbol.h
@@ -9,7 +9,7 @@
#ifndef COMPILER_SEARCHSYMBOL_H_
#define COMPILER_SEARCHSYMBOL_H_
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#include "compiler/translator/ParseContext.h"
namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp b/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp
index 6a801eacfe..20ce71605c 100644
--- a/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp
@@ -18,14 +18,26 @@
#include "compiler/translator/VariablePacker.h"
#include "angle_gl.h"
-static bool isInitialized = false;
+namespace
+{
+
+enum ShaderVariableType
+{
+ SHADERVAR_UNIFORM,
+ SHADERVAR_VARYING,
+ SHADERVAR_ATTRIBUTE,
+ SHADERVAR_OUTPUTVARIABLE,
+ SHADERVAR_INTERFACEBLOCK
+};
+
+bool isInitialized = false;
//
// This is the platform independent interface between an OGL driver
// and the shading language compiler.
//
-static bool checkVariableMaxLengths(const ShHandle handle,
+static bool CheckVariableMaxLengths(const ShHandle handle,
size_t expectedValue)
{
size_t activeUniformLimit = 0;
@@ -39,7 +51,7 @@ static bool checkVariableMaxLengths(const ShHandle handle,
expectedValue == varyingLimit);
}
-static bool checkMappedNameMaxLength(const ShHandle handle, size_t expectedValue)
+bool CheckMappedNameMaxLength(const ShHandle handle, size_t expectedValue)
{
size_t mappedNameMaxLength = 0;
ShGetInfo(handle, SH_MAPPED_NAME_MAX_LENGTH, &mappedNameMaxLength);
@@ -47,7 +59,7 @@ static bool checkMappedNameMaxLength(const ShHandle handle, size_t expectedValue
}
template <typename VarT>
-static const sh::ShaderVariable *ReturnVariable(const std::vector<VarT> &infoList, int index)
+const sh::ShaderVariable *ReturnVariable(const std::vector<VarT> &infoList, int index)
{
if (index < 0 || static_cast<size_t>(index) >= infoList.size())
{
@@ -57,7 +69,7 @@ static const sh::ShaderVariable *ReturnVariable(const std::vector<VarT> &infoLis
return &infoList[index];
}
-static const sh::ShaderVariable *GetVariable(const TCompiler *compiler, ShShaderInfo varType, int index)
+const sh::ShaderVariable *GetVariable(const TCompiler *compiler, ShShaderInfo varType, int index)
{
switch (varType)
{
@@ -73,7 +85,7 @@ static const sh::ShaderVariable *GetVariable(const TCompiler *compiler, ShShader
}
}
-static ShPrecisionType ConvertPrecision(sh::GLenum precision)
+ShPrecisionType ConvertPrecision(sh::GLenum precision)
{
switch (precision)
{
@@ -91,6 +103,55 @@ static ShPrecisionType ConvertPrecision(sh::GLenum precision)
}
}
+template <typename VarT>
+const std::vector<VarT> *GetVariableList(const TCompiler *compiler, ShaderVariableType variableType);
+
+template <>
+const std::vector<sh::Uniform> *GetVariableList(const TCompiler *compiler, ShaderVariableType)
+{
+ return &compiler->getUniforms();
+}
+
+template <>
+const std::vector<sh::Varying> *GetVariableList(const TCompiler *compiler, ShaderVariableType)
+{
+ return &compiler->getVaryings();
+}
+
+template <>
+const std::vector<sh::Attribute> *GetVariableList(const TCompiler *compiler, ShaderVariableType variableType)
+{
+ return (variableType == SHADERVAR_ATTRIBUTE ?
+ &compiler->getAttributes() :
+ &compiler->getOutputVariables());
+}
+
+template <>
+const std::vector<sh::InterfaceBlock> *GetVariableList(const TCompiler *compiler, ShaderVariableType)
+{
+ return &compiler->getInterfaceBlocks();
+}
+
+template <typename VarT>
+const std::vector<VarT> *GetShaderVariables(const ShHandle handle, ShaderVariableType variableType)
+{
+ if (!handle)
+ {
+ return NULL;
+ }
+
+ TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+ TCompiler* compiler = base->getAsCompiler();
+ if (!compiler)
+ {
+ return NULL;
+ }
+
+ return GetVariableList<VarT>(compiler, variableType);
+}
+
+}
+
//
// Driver must call this first, once, before doing any other compiler operations.
// Subsequent calls to this function are no-op.
@@ -372,7 +433,7 @@ void ShGetVariableInfo(const ShHandle handle,
// SH_ACTIVE_UNIFORM_MAX_LENGTH, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, SH_VARYING_MAX_LENGTH
// in ShGetInfo, below.
size_t variableLength = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
- ASSERT(checkVariableMaxLengths(handle, variableLength));
+ ASSERT(CheckVariableMaxLengths(handle, variableLength));
strncpy(name, varInfo->name.c_str(), variableLength);
name[variableLength - 1] = 0;
if (mappedName)
@@ -380,7 +441,7 @@ void ShGetVariableInfo(const ShHandle handle,
// This size must match that queried by
// SH_MAPPED_NAME_MAX_LENGTH in ShGetInfo, below.
size_t maxMappedNameLength = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
- ASSERT(checkMappedNameMaxLength(handle, maxMappedNameLength));
+ ASSERT(CheckMappedNameMaxLength(handle, maxMappedNameLength));
strncpy(mappedName, varInfo->mappedName.c_str(), maxMappedNameLength);
mappedName[maxMappedNameLength - 1] = 0;
}
@@ -429,34 +490,29 @@ void ShGetNameHashingEntry(const ShHandle handle,
hashedName[len - 1] = '\0';
}
-void ShGetInfoPointer(const ShHandle handle, ShShaderInfo pname, void** params)
+const std::vector<sh::Uniform> *ShGetUniforms(const ShHandle handle)
{
- if (!handle || !params)
- return;
+ return GetShaderVariables<sh::Uniform>(handle, SHADERVAR_UNIFORM);
+}
- TShHandleBase* base = static_cast<TShHandleBase*>(handle);
- TranslatorHLSL* translator = base->getAsTranslatorHLSL();
- if (!translator) return;
+const std::vector<sh::Varying> *ShGetVaryings(const ShHandle handle)
+{
+ return GetShaderVariables<sh::Varying>(handle, SHADERVAR_VARYING);
+}
- switch(pname)
- {
- case SH_ACTIVE_UNIFORMS_ARRAY:
- *params = (void*)&translator->getUniforms();
- break;
- case SH_ACTIVE_INTERFACE_BLOCKS_ARRAY:
- *params = (void*)&translator->getInterfaceBlocks();
- break;
- case SH_ACTIVE_OUTPUT_VARIABLES_ARRAY:
- *params = (void*)&translator->getOutputVariables();
- break;
- case SH_ACTIVE_ATTRIBUTES_ARRAY:
- *params = (void*)&translator->getAttributes();
- break;
- case SH_ACTIVE_VARYINGS_ARRAY:
- *params = (void*)&translator->getVaryings();
- break;
- default: UNREACHABLE();
- }
+const std::vector<sh::Attribute> *ShGetAttributes(const ShHandle handle)
+{
+ return GetShaderVariables<sh::Attribute>(handle, SHADERVAR_ATTRIBUTE);
+}
+
+const std::vector<sh::Attribute> *ShGetOutputVariables(const ShHandle handle)
+{
+ return GetShaderVariables<sh::Attribute>(handle, SHADERVAR_OUTPUTVARIABLE);
+}
+
+const std::vector<sh::InterfaceBlock> *ShGetInterfaceBlocks(const ShHandle handle)
+{
+ return GetShaderVariables<sh::InterfaceBlock>(handle, SHADERVAR_INTERFACEBLOCK);
}
int ShCheckVariablesWithinPackingLimits(
@@ -468,7 +524,7 @@ int ShCheckVariablesWithinPackingLimits(
std::vector<sh::ShaderVariable> variables;
for (size_t ii = 0; ii < varInfoArraySize; ++ii)
{
- sh::ShaderVariable var(varInfoArray[ii].type, (sh::GLenum)0, "", varInfoArray[ii].size);
+ sh::ShaderVariable var(varInfoArray[ii].type, varInfoArray[ii].size);
variables.push_back(var);
}
VariablePacker packer;
diff --git a/src/3rdparty/angle/src/compiler/translator/ShaderVars.cpp b/src/3rdparty/angle/src/compiler/translator/ShaderVars.cpp
new file mode 100644
index 0000000000..822c558c9b
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/ShaderVars.cpp
@@ -0,0 +1,166 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ShaderVars.cpp:
+// Methods for GL variable types (varyings, uniforms, etc)
+//
+
+#include <GLSLANG/ShaderLang.h>
+
+namespace sh
+{
+
+ShaderVariable::ShaderVariable()
+ : type(0),
+ precision(0),
+ arraySize(0),
+ staticUse(false)
+{}
+
+ShaderVariable::ShaderVariable(GLenum typeIn, unsigned int arraySizeIn)
+ : type(typeIn),
+ precision(0),
+ arraySize(arraySizeIn),
+ staticUse(false)
+{}
+
+ShaderVariable::~ShaderVariable()
+{}
+
+ShaderVariable::ShaderVariable(const ShaderVariable &other)
+ : type(other.type),
+ precision(other.precision),
+ name(other.name),
+ mappedName(other.mappedName),
+ arraySize(other.arraySize),
+ staticUse(other.staticUse),
+ fields(other.fields),
+ structName(other.structName)
+{}
+
+ShaderVariable &ShaderVariable::operator=(const ShaderVariable &other)
+{
+ type = other.type;
+ precision = other.precision;
+ name = other.name;
+ mappedName = other.mappedName;
+ arraySize = other.arraySize;
+ staticUse = other.staticUse;
+ fields = other.fields;
+ structName = other.structName;
+ return *this;
+}
+
+Uniform::Uniform()
+{}
+
+Uniform::~Uniform()
+{}
+
+Uniform::Uniform(const Uniform &other)
+ : ShaderVariable(other)
+{}
+
+Uniform &Uniform::operator=(const Uniform &other)
+{
+ ShaderVariable::operator=(other);
+ return *this;
+}
+
+Attribute::Attribute()
+ : location(-1)
+{}
+
+Attribute::~Attribute()
+{}
+
+Attribute::Attribute(const Attribute &other)
+ : ShaderVariable(other),
+ location(other.location)
+{}
+
+Attribute &Attribute::operator=(const Attribute &other)
+{
+ ShaderVariable::operator=(other);
+ location = other.location;
+ return *this;
+}
+
+InterfaceBlockField::InterfaceBlockField()
+ : isRowMajorLayout(false)
+{}
+
+InterfaceBlockField::~InterfaceBlockField()
+{}
+
+InterfaceBlockField::InterfaceBlockField(const InterfaceBlockField &other)
+ : ShaderVariable(other),
+ isRowMajorLayout(other.isRowMajorLayout)
+{}
+
+InterfaceBlockField &InterfaceBlockField::operator=(const InterfaceBlockField &other)
+{
+ ShaderVariable::operator=(other);
+ isRowMajorLayout = other.isRowMajorLayout;
+ return *this;
+}
+
+Varying::Varying()
+ : interpolation(INTERPOLATION_SMOOTH),
+ isInvariant(false)
+{}
+
+Varying::~Varying()
+{}
+
+Varying::Varying(const Varying &other)
+ : ShaderVariable(other),
+ interpolation(other.interpolation),
+ isInvariant(other.isInvariant)
+{}
+
+Varying &Varying::operator=(const Varying &other)
+{
+ ShaderVariable::operator=(other);
+ interpolation = other.interpolation;
+ isInvariant = other.isInvariant;
+ return *this;
+}
+
+InterfaceBlock::InterfaceBlock()
+ : arraySize(0),
+ layout(BLOCKLAYOUT_PACKED),
+ isRowMajorLayout(false),
+ staticUse(false)
+{}
+
+InterfaceBlock::~InterfaceBlock()
+{}
+
+InterfaceBlock::InterfaceBlock(const InterfaceBlock &other)
+ : name(other.name),
+ mappedName(other.mappedName),
+ instanceName(other.instanceName),
+ arraySize(other.arraySize),
+ layout(other.layout),
+ isRowMajorLayout(other.isRowMajorLayout),
+ staticUse(other.staticUse),
+ fields(other.fields)
+{}
+
+InterfaceBlock &InterfaceBlock::operator=(const InterfaceBlock &other)
+{
+ name = other.name;
+ mappedName = other.mappedName;
+ instanceName = other.instanceName;
+ arraySize = other.arraySize;
+ layout = other.layout;
+ isRowMajorLayout = other.isRowMajorLayout;
+ staticUse = other.staticUse;
+ fields = other.fields;
+ return *this;
+}
+
+}
diff --git a/src/3rdparty/angle/src/compiler/translator/StructureHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/StructureHLSL.cpp
index 365985c852..48929affe6 100644
--- a/src/3rdparty/angle/src/compiler/translator/StructureHLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/StructureHLSL.cpp
@@ -17,12 +17,19 @@
namespace sh
{
-Std140PaddingHelper::Std140PaddingHelper(const std::map<TString, int> &structElementIndexes)
- : mPaddingCounter(0),
+Std140PaddingHelper::Std140PaddingHelper(const std::map<TString, int> &structElementIndexes,
+ unsigned *uniqueCounter)
+ : mPaddingCounter(uniqueCounter),
mElementIndex(0),
mStructElementIndexes(structElementIndexes)
{}
+TString Std140PaddingHelper::next()
+{
+ unsigned value = (*mPaddingCounter)++;
+ return str(value);
+}
+
int Std140PaddingHelper::prePadding(const TType &type)
{
if (type.getBasicType() == EbtStruct || type.isMatrix() || type.isArray())
@@ -68,7 +75,7 @@ TString Std140PaddingHelper::prePaddingString(const TType &type)
for (int paddingIndex = 0; paddingIndex < paddingCount; paddingIndex++)
{
- padding += " float pad_" + str(mPaddingCounter++) + ";\n";
+ padding += " float pad_" + next() + ";\n";
}
return padding;
@@ -116,19 +123,25 @@ TString Std140PaddingHelper::postPaddingString(const TType &type, bool useHLSLRo
TString padding;
for (int paddingOffset = numComponents; paddingOffset < 4; paddingOffset++)
{
- padding += " float pad_" + str(mPaddingCounter++) + ";\n";
+ padding += " float pad_" + next() + ";\n";
}
return padding;
}
StructureHLSL::StructureHLSL()
+ : mUniquePaddingCounter(0)
{}
+Std140PaddingHelper StructureHLSL::getPaddingHelper()
+{
+ return Std140PaddingHelper(mStd140StructElementIndexes, &mUniquePaddingCounter);
+}
+
TString StructureHLSL::defineQualified(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing)
{
if (useStd140Packing)
{
- Std140PaddingHelper padHelper(mStd140StructElementIndexes);
+ Std140PaddingHelper padHelper = getPaddingHelper();
return define(structure, useHLSLRowMajorPacking, useStd140Packing, &padHelper);
}
else
@@ -291,9 +304,9 @@ void StructureHLSL::addConstructor(const TType &type, const TString &name, const
if (parameter.isScalar())
{
- for (int row = 0; row < rows; row++)
+ for (int col = 0; col < cols; col++)
{
- for (int col = 0; col < cols; col++)
+ for (int row = 0; row < rows; row++)
{
constructor += TString((row == col) ? "x0" : "0.0");
@@ -306,13 +319,13 @@ void StructureHLSL::addConstructor(const TType &type, const TString &name, const
}
else if (parameter.isMatrix())
{
- for (int row = 0; row < rows; row++)
+ for (int col = 0; col < cols; col++)
{
- for (int col = 0; col < cols; col++)
+ for (int row = 0; row < rows; row++)
{
if (row < parameter.getRows() && col < parameter.getCols())
{
- constructor += TString("x0") + "[" + str(row) + "][" + str(col) + "]";
+ constructor += TString("x0") + "[" + str(col) + "][" + str(row) + "]";
}
else
{
@@ -461,7 +474,7 @@ std::string StructureHLSL::structsHeader() const
void StructureHLSL::storeStd140ElementIndex(const TStructure &structure, bool useHLSLRowMajorPacking)
{
- Std140PaddingHelper padHelper(mStd140StructElementIndexes);
+ Std140PaddingHelper padHelper = getPaddingHelper();
const TFieldList &fields = structure.fields();
for (unsigned int i = 0; i < fields.size(); i++)
diff --git a/src/3rdparty/angle/src/compiler/translator/StructureHLSL.h b/src/3rdparty/angle/src/compiler/translator/StructureHLSL.h
index 63fbaaaf8e..ed002fef30 100644
--- a/src/3rdparty/angle/src/compiler/translator/StructureHLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/StructureHLSL.h
@@ -11,7 +11,7 @@
#define TRANSLATOR_STRUCTUREHLSL_H_
#include "compiler/translator/Common.h"
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#include <set>
@@ -26,7 +26,8 @@ namespace sh
class Std140PaddingHelper
{
public:
- explicit Std140PaddingHelper(const std::map<TString, int> &structElementIndexes);
+ explicit Std140PaddingHelper(const std::map<TString, int> &structElementIndexes,
+ unsigned *uniqueCounter);
int elementIndex() const { return mElementIndex; }
int prePadding(const TType &type);
@@ -34,7 +35,9 @@ class Std140PaddingHelper
TString postPaddingString(const TType &type, bool useHLSLRowMajorPacking);
private:
- int mPaddingCounter;
+ TString next();
+
+ unsigned *mPaddingCounter;
int mElementIndex;
const std::map<TString, int> &mStructElementIndexes;
};
@@ -50,9 +53,11 @@ class StructureHLSL
TString defineQualified(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing);
static TString defineNameless(const TStructure &structure);
- Std140PaddingHelper getPaddingHelper() const { return Std140PaddingHelper(mStd140StructElementIndexes); }
+ Std140PaddingHelper getPaddingHelper();
private:
+ unsigned mUniquePaddingCounter;
+
std::map<TString, int> mStd140StructElementIndexes;
typedef std::set<TString> StructNames;
diff --git a/src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp b/src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp
index ae4fcaa6c3..028da21151 100644
--- a/src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp
@@ -98,7 +98,8 @@ TSymbol::TSymbol(const TSymbol &copyOf)
uniqueId = copyOf.uniqueId;
}
-TSymbol *TSymbolTable::find(const TString &name, int shaderVersion, bool *builtIn, bool *sameScope)
+TSymbol *TSymbolTable::find(const TString &name, int shaderVersion,
+ bool *builtIn, bool *sameScope) const
{
int level = currentLevel();
TSymbol *symbol;
@@ -122,7 +123,8 @@ TSymbol *TSymbolTable::find(const TString &name, int shaderVersion, bool *builtI
return symbol;
}
-TSymbol *TSymbolTable::findBuiltIn(const TString &name, int shaderVersion)
+TSymbol *TSymbolTable::findBuiltIn(
+ const TString &name, int shaderVersion) const
{
for (int level = LAST_BUILTIN_LEVEL; level >= 0; level--)
{
@@ -210,7 +212,7 @@ void TSymbolTable::insertBuiltIn(
insert(level, function);
}
-TPrecision TSymbolTable::getDefaultPrecision(TBasicType type)
+TPrecision TSymbolTable::getDefaultPrecision(TBasicType type) const
{
if (!SupportsPrecision(type))
return EbpUndefined;
diff --git a/src/3rdparty/angle/src/compiler/translator/SymbolTable.h b/src/3rdparty/angle/src/compiler/translator/SymbolTable.h
index d3ddf19e34..6b0e0c0a03 100644
--- a/src/3rdparty/angle/src/compiler/translator/SymbolTable.h
+++ b/src/3rdparty/angle/src/compiler/translator/SymbolTable.h
@@ -34,7 +34,7 @@
#include "common/angleutils.h"
#include "compiler/translator/InfoSink.h"
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
// Symbol base class. (Can build functions or variables out of these...)
class TSymbol
@@ -323,15 +323,15 @@ class TSymbolTable
// When the symbol table is initialized with the built-ins, there should
// 'push' calls, so that built-ins are at level 0 and the shader
// globals are at level 1.
- bool isEmpty()
+ bool isEmpty() const
{
return table.empty();
}
- bool atBuiltInLevel()
+ bool atBuiltInLevel() const
{
return currentLevel() <= LAST_BUILTIN_LEVEL;
}
- bool atGlobalLevel()
+ bool atGlobalLevel() const
{
return currentLevel() <= GLOBAL_LEVEL;
}
@@ -373,8 +373,8 @@ class TSymbolTable
TType *ptype4 = 0, TType *ptype5 = 0);
TSymbol *find(const TString &name, int shaderVersion,
- bool *builtIn = NULL, bool *sameScope = NULL);
- TSymbol *findBuiltIn(const TString &name, int shaderVersion);
+ bool *builtIn = NULL, bool *sameScope = NULL) const;
+ TSymbol *findBuiltIn(const TString &name, int shaderVersion) const;
TSymbolTableLevel *getOuterLevel()
{
@@ -406,7 +406,7 @@ class TSymbolTable
// Searches down the precisionStack for a precision qualifier
// for the specified TBasicType
- TPrecision getDefaultPrecision(TBasicType type);
+ TPrecision getDefaultPrecision(TBasicType type) const;
static int nextUniqueId()
{
diff --git a/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp
index 52588e4626..22bf60e86e 100644
--- a/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp
@@ -17,16 +17,10 @@ TranslatorHLSL::TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutpu
void TranslatorHLSL::translate(TIntermNode *root)
{
TParseContext& parseContext = *GetGlobalParseContext();
- sh::OutputHLSL outputHLSL(parseContext, getResources(), getOutputType());
+ sh::OutputHLSL outputHLSL(parseContext, this);
outputHLSL.output();
- attributes = outputHLSL.getAttributes();
- outputVariables = outputHLSL.getOutputVariables();
- uniforms = outputHLSL.getUniforms();
- varyings = outputHLSL.getVaryings();
- interfaceBlocks = outputHLSL.getInterfaceBlocks();
-
mInterfaceBlockRegisterMap = outputHLSL.getInterfaceBlockRegisterMap();
mUniformRegisterMap = outputHLSL.getUniformRegisterMap();
}
diff --git a/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h
index 598c8a7b30..11a042d83a 100644
--- a/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h
@@ -8,7 +8,6 @@
#define COMPILER_TRANSLATORHLSL_H_
#include "compiler/translator/Compiler.h"
-#include "common/shadervars.h"
class TranslatorHLSL : public TCompiler
{
diff --git a/src/3rdparty/angle/src/compiler/translator/Types.cpp b/src/3rdparty/angle/src/compiler/translator/Types.cpp
index bafad0d64f..d36936fb23 100644
--- a/src/3rdparty/angle/src/compiler/translator/Types.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Types.cpp
@@ -13,6 +13,38 @@
#include <algorithm>
#include <climits>
+const char* getBasicString(TBasicType t)
+{
+ switch (t)
+ {
+ case EbtVoid: return "void"; break;
+ case EbtFloat: return "float"; break;
+ case EbtInt: return "int"; break;
+ case EbtUInt: return "uint"; break;
+ case EbtBool: return "bool"; break;
+ case EbtSampler2D: return "sampler2D"; break;
+ case EbtSampler3D: return "sampler3D"; break;
+ case EbtSamplerCube: return "samplerCube"; break;
+ case EbtSamplerExternalOES: return "samplerExternalOES"; break;
+ case EbtSampler2DRect: return "sampler2DRect"; break;
+ case EbtSampler2DArray: return "sampler2DArray"; break;
+ case EbtISampler2D: return "isampler2D"; break;
+ case EbtISampler3D: return "isampler3D"; break;
+ case EbtISamplerCube: return "isamplerCube"; break;
+ case EbtISampler2DArray: return "isampler2DArray"; break;
+ case EbtUSampler2D: return "usampler2D"; break;
+ case EbtUSampler3D: return "usampler3D"; break;
+ case EbtUSamplerCube: return "usamplerCube"; break;
+ case EbtUSampler2DArray: return "usampler2DArray"; break;
+ case EbtSampler2DShadow: return "sampler2DShadow"; break;
+ case EbtSamplerCubeShadow: return "samplerCubeShadow"; break;
+ case EbtSampler2DArrayShadow: return "sampler2DArrayShadow"; break;
+ case EbtStruct: return "structure"; break;
+ case EbtInterfaceBlock: return "interface block"; break;
+ default: UNREACHABLE(); return "unknown type";
+ }
+}
+
TType::TType(const TPublicType &p)
: type(p.type), precision(p.precision), qualifier(p.qualifier), layoutQualifier(p.layoutQualifier),
primarySize(p.primarySize), secondarySize(p.secondarySize), array(p.array), arraySize(p.arraySize),
diff --git a/src/3rdparty/angle/src/compiler/translator/Types.h b/src/3rdparty/angle/src/compiler/translator/Types.h
index bc50a4dc64..075196daa3 100644
--- a/src/3rdparty/angle/src/compiler/translator/Types.h
+++ b/src/3rdparty/angle/src/compiler/translator/Types.h
@@ -140,6 +140,17 @@ class TStructure : public TFieldListCollection
private:
DISALLOW_COPY_AND_ASSIGN(TStructure);
+
+ // TODO(zmo): Find a way to get rid of the const_cast in function
+ // setName(). At the moment keep this function private so only
+ // friend class RegenerateStructNames may call it.
+ friend class RegenerateStructNames;
+ void setName(const TString &name)
+ {
+ TString *mutableName = const_cast<TString *>(mName);
+ *mutableName = name;
+ }
+
virtual TString mangledNamePrefix() const
{
return "struct-";
diff --git a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.h b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.h
index 1e416bc04c..6fd3b457bd 100644
--- a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.h
+++ b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.h
@@ -9,7 +9,7 @@
#ifndef COMPILER_UNFOLDSHORTCIRCUIT_H_
#define COMPILER_UNFOLDSHORTCIRCUIT_H_
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#include "compiler/translator/ParseContext.h"
namespace sh
diff --git a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h
index 24c14a60e3..3acaf7ee7c 100644
--- a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h
+++ b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h
@@ -11,7 +11,7 @@
#define COMPILER_UNFOLD_SHORT_CIRCUIT_AST_H_
#include "common/angleutils.h"
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
// This traverser identifies all the short circuit binary nodes that need to
// be replaced, and creates the corresponding replacement nodes. However,
diff --git a/src/3rdparty/angle/src/compiler/translator/UniformHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/UniformHLSL.cpp
index 41a7d2c10b..61b6ed7455 100644
--- a/src/3rdparty/angle/src/compiler/translator/UniformHLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/UniformHLSL.cpp
@@ -14,6 +14,7 @@
#include "compiler/translator/StructureHLSL.h"
#include "compiler/translator/util.h"
#include "compiler/translator/UtilsHLSL.h"
+#include "compiler/translator/TranslatorHLSL.h"
namespace sh
{
@@ -30,18 +31,6 @@ static const char *UniformRegisterPrefix(const TType &type)
}
}
-static TString InterfaceBlockFieldName(const TInterfaceBlock &interfaceBlock, const TField &field)
-{
- if (interfaceBlock.hasInstanceName())
- {
- return interfaceBlock.name() + "." + field.name();
- }
- else
- {
- return field.name();
- }
-}
-
static TString InterfaceBlockFieldTypeString(const TField &field, TLayoutBlockStorage blockStorage)
{
const TType &fieldType = *field.type();
@@ -72,12 +61,13 @@ static TString InterfaceBlockStructName(const TInterfaceBlock &interfaceBlock)
return DecoratePrivate(interfaceBlock.name()) + "_type";
}
-UniformHLSL::UniformHLSL(StructureHLSL *structureHLSL, ShShaderOutput outputType)
+UniformHLSL::UniformHLSL(StructureHLSL *structureHLSL, TranslatorHLSL *translator)
: mUniformRegister(0),
mInterfaceBlockRegister(0),
mSamplerRegister(0),
mStructureHLSL(structureHLSL),
- mOutputType(outputType)
+ mOutputType(translator->getOutputType()),
+ mUniforms(translator->getUniforms())
{}
void UniformHLSL::reserveUniformRegisters(unsigned int registerCount)
@@ -90,18 +80,32 @@ void UniformHLSL::reserveInterfaceBlockRegisters(unsigned int registerCount)
mInterfaceBlockRegister = registerCount;
}
+const Uniform *UniformHLSL::findUniformByName(const TString &name) const
+{
+ for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); ++uniformIndex)
+ {
+ if (mUniforms[uniformIndex].name == name.c_str())
+ {
+ return &mUniforms[uniformIndex];
+ }
+ }
+
+ UNREACHABLE();
+ return NULL;
+}
+
unsigned int UniformHLSL::declareUniformAndAssignRegister(const TType &type, const TString &name)
{
unsigned int registerIndex = (IsSampler(type.getBasicType()) ? mSamplerRegister : mUniformRegister);
- GetVariableTraverser<Uniform> traverser(&mActiveUniforms);
- traverser.traverse(type, name);
+ const Uniform *uniform = findUniformByName(name);
+ ASSERT(uniform);
- const sh::Uniform &activeUniform = mActiveUniforms.back();
- mUniformRegisterMap[activeUniform.name] = registerIndex;
+ mUniformRegisterMap[uniform->name] = registerIndex;
- unsigned int registerCount = HLSLVariableRegisterCount(activeUniform, mOutputType);
- if (IsSampler(type.getBasicType()))
+ unsigned int registerCount = HLSLVariableRegisterCount(*uniform, mOutputType);
+
+ if (gl::IsSampler(uniform->type))
{
mSamplerRegister += registerCount;
}
@@ -137,7 +141,12 @@ TString UniformHLSL::uniformsHeader(ShShaderOutput outputType, const ReferencedS
else
{
const TStructure *structure = type.getStruct();
- const TString &typeName = (structure ? QualifiedStructNameString(*structure, false, false) : TypeString(type));
+ // If this is a nameless struct, we need to use its full definition, rather than its (empty) name.
+ // TypeString() will invoke defineNameless in this case; qualifier prefixes are unnecessary for
+ // nameless structs in ES, as nameless structs cannot be used anywhere that layout qualifiers are
+ // permitted.
+ const TString &typeName = ((structure && !structure->name().empty()) ?
+ QualifiedStructNameString(*structure, false, false) : TypeString(type));
const TString &registerString = TString("register(") + UniformRegisterPrefix(type) + str(registerIndex) + ")";
@@ -157,33 +166,14 @@ TString UniformHLSL::interfaceBlocksHeader(const ReferencedSymbols &referencedIn
{
const TType &nodeType = interfaceBlockIt->second->getType();
const TInterfaceBlock &interfaceBlock = *nodeType.getInterfaceBlock();
- const TFieldList &fieldList = interfaceBlock.fields();
unsigned int arraySize = static_cast<unsigned int>(interfaceBlock.arraySize());
unsigned int activeRegister = mInterfaceBlockRegister;
- InterfaceBlock activeBlock(interfaceBlock.name().c_str(), arraySize);
- for (unsigned int typeIndex = 0; typeIndex < fieldList.size(); typeIndex++)
- {
- const TField &field = *fieldList[typeIndex];
- const TString &fullFieldName = InterfaceBlockFieldName(interfaceBlock, field);
-
- bool isRowMajor = (field.type()->getLayoutQualifier().matrixPacking == EmpRowMajor);
- GetInterfaceBlockFieldTraverser traverser(&activeBlock.fields, isRowMajor);
- traverser.traverse(*field.type(), fullFieldName);
- }
-
- mInterfaceBlockRegisterMap[activeBlock.name] = activeRegister;
+ mInterfaceBlockRegisterMap[interfaceBlock.name().c_str()] = activeRegister;
mInterfaceBlockRegister += std::max(1u, arraySize);
- activeBlock.layout = GetBlockLayoutType(interfaceBlock.blockStorage());
-
- if (interfaceBlock.matrixPacking() == EmpRowMajor)
- {
- activeBlock.isRowMajorLayout = true;
- }
-
- mActiveInterfaceBlocks.push_back(activeBlock);
+ // FIXME: interface block field names
if (interfaceBlock.hasInstanceName())
{
@@ -261,7 +251,7 @@ TString UniformHLSL::interfaceBlockMembersString(const TInterfaceBlock &interfac
if (blockStorage == EbsStd140)
{
// 2 and 3 component vector types in some cases need pre-padding
- hlsl += padHelper.prePadding(fieldType);
+ hlsl += padHelper.prePaddingString(fieldType);
}
hlsl += " " + InterfaceBlockFieldTypeString(field, blockStorage) +
diff --git a/src/3rdparty/angle/src/compiler/translator/UniformHLSL.h b/src/3rdparty/angle/src/compiler/translator/UniformHLSL.h
index 835b1ef2c8..91fa51588b 100644
--- a/src/3rdparty/angle/src/compiler/translator/UniformHLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/UniformHLSL.h
@@ -10,7 +10,6 @@
#ifndef TRANSLATOR_UNIFORMHLSL_H_
#define TRANSLATOR_UNIFORMHLSL_H_
-#include "common/shadervars.h"
#include "compiler/translator/Types.h"
namespace sh
@@ -20,7 +19,7 @@ class StructureHLSL;
class UniformHLSL
{
public:
- UniformHLSL(StructureHLSL *structureHLSL, ShShaderOutput outputType);
+ UniformHLSL(StructureHLSL *structureHLSL, TranslatorHLSL *translator);
void reserveUniformRegisters(unsigned int registerCount);
void reserveInterfaceBlockRegisters(unsigned int registerCount);
@@ -30,8 +29,6 @@ class UniformHLSL
// Used for direct index references
static TString interfaceBlockInstanceString(const TInterfaceBlock& interfaceBlock, unsigned int arrayIndex);
- const std::vector<Uniform> &getUniforms() const { return mActiveUniforms; }
- const std::vector<InterfaceBlock> &getInterfaceBlocks() const { return mActiveInterfaceBlocks; }
const std::map<std::string, unsigned int> &getInterfaceBlockRegisterMap() const
{
return mInterfaceBlockRegisterMap;
@@ -45,6 +42,7 @@ class UniformHLSL
TString interfaceBlockString(const TInterfaceBlock &interfaceBlock, unsigned int registerIndex, unsigned int arrayIndex);
TString interfaceBlockMembersString(const TInterfaceBlock &interfaceBlock, TLayoutBlockStorage blockStorage);
TString interfaceBlockStructString(const TInterfaceBlock &interfaceBlock);
+ const Uniform *findUniformByName(const TString &name) const;
// Returns the uniform's register index
unsigned int declareUniformAndAssignRegister(const TType &type, const TString &name);
@@ -55,8 +53,7 @@ class UniformHLSL
StructureHLSL *mStructureHLSL;
ShShaderOutput mOutputType;
- std::vector<Uniform> mActiveUniforms;
- std::vector<InterfaceBlock> mActiveInterfaceBlocks;
+ const std::vector<Uniform> &mUniforms;
std::map<std::string, unsigned int> mInterfaceBlockRegisterMap;
std::map<std::string, unsigned int> mUniformRegisterMap;
};
diff --git a/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h b/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h
index 8c9ebf53ed..e6e8a9619f 100644
--- a/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h
+++ b/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#include "compiler/translator/LoopInfo.h"
class TInfoSinkBase;
diff --git a/src/3rdparty/angle/src/compiler/translator/ValidateOutputs.h b/src/3rdparty/angle/src/compiler/translator/ValidateOutputs.h
index e391ad9486..0f808dbb97 100644
--- a/src/3rdparty/angle/src/compiler/translator/ValidateOutputs.h
+++ b/src/3rdparty/angle/src/compiler/translator/ValidateOutputs.h
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#include <set>
diff --git a/src/3rdparty/angle/src/compiler/translator/VariableInfo.cpp b/src/3rdparty/angle/src/compiler/translator/VariableInfo.cpp
index 153455c4f1..f26c1566ac 100644
--- a/src/3rdparty/angle/src/compiler/translator/VariableInfo.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/VariableInfo.cpp
@@ -9,20 +9,46 @@
#include "compiler/translator/util.h"
#include "common/utilities.h"
-template <typename VarT>
-static void ExpandUserDefinedVariable(const VarT &variable,
- const std::string &name,
- const std::string &mappedName,
- bool markStaticUse,
- std::vector<VarT> *expanded);
+namespace sh
+{
-// Returns info for an attribute, uniform, or varying.
-template <typename VarT>
-static void ExpandVariable(const VarT &variable,
- const std::string &name,
- const std::string &mappedName,
- bool markStaticUse,
- std::vector<VarT> *expanded)
+namespace
+{
+
+TString InterfaceBlockFieldName(const TInterfaceBlock &interfaceBlock, const TField &field)
+{
+ if (interfaceBlock.hasInstanceName())
+ {
+ return interfaceBlock.name() + "." + field.name();
+ }
+ else
+ {
+ return field.name();
+ }
+}
+
+BlockLayoutType GetBlockLayoutType(TLayoutBlockStorage blockStorage)
+{
+ switch (blockStorage)
+ {
+ case EbsPacked: return BLOCKLAYOUT_PACKED;
+ case EbsShared: return BLOCKLAYOUT_SHARED;
+ case EbsStd140: return BLOCKLAYOUT_STANDARD;
+ default: UNREACHABLE(); return BLOCKLAYOUT_SHARED;
+ }
+}
+
+void ExpandUserDefinedVariable(const ShaderVariable &variable,
+ const std::string &name,
+ const std::string &mappedName,
+ bool markStaticUse,
+ std::vector<ShaderVariable> *expanded);
+
+void ExpandVariable(const ShaderVariable &variable,
+ const std::string &name,
+ const std::string &mappedName,
+ bool markStaticUse,
+ std::vector<ShaderVariable> *expanded)
{
if (variable.isStruct())
{
@@ -30,8 +56,8 @@ static void ExpandVariable(const VarT &variable,
{
for (size_t elementIndex = 0; elementIndex < variable.elementCount(); elementIndex++)
{
- std::string lname = name + ArrayString(elementIndex);
- std::string lmappedName = mappedName + ArrayString(elementIndex);
+ std::string lname = name + ::ArrayString(elementIndex);
+ std::string lmappedName = mappedName + ::ArrayString(elementIndex);
ExpandUserDefinedVariable(variable, lname, lmappedName, markStaticUse, expanded);
}
}
@@ -42,7 +68,7 @@ static void ExpandVariable(const VarT &variable,
}
else
{
- VarT expandedVar = variable;
+ ShaderVariable expandedVar = variable;
expandedVar.name = name;
expandedVar.mappedName = mappedName;
@@ -63,20 +89,19 @@ static void ExpandVariable(const VarT &variable,
}
}
-template <class VarT>
-static void ExpandUserDefinedVariable(const VarT &variable,
- const std::string &name,
- const std::string &mappedName,
- bool markStaticUse,
- std::vector<VarT> *expanded)
+void ExpandUserDefinedVariable(const ShaderVariable &variable,
+ const std::string &name,
+ const std::string &mappedName,
+ bool markStaticUse,
+ std::vector<ShaderVariable> *expanded)
{
ASSERT(variable.isStruct());
- const std::vector<VarT> &fields = variable.fields;
+ const std::vector<ShaderVariable> &fields = variable.fields;
for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
{
- const VarT &field = fields[fieldIndex];
+ const ShaderVariable &field = fields[fieldIndex];
ExpandVariable(field,
name + "." + field.name,
mappedName + "." + field.mappedName,
@@ -86,8 +111,8 @@ static void ExpandUserDefinedVariable(const VarT &variable,
}
template <class VarT>
-static VarT *FindVariable(const TString &name,
- std::vector<VarT> *infoList)
+VarT *FindVariable(const TString &name,
+ std::vector<VarT> *infoList)
{
// TODO(zmo): optimize this function.
for (size_t ii = 0; ii < infoList->size(); ++ii)
@@ -99,6 +124,8 @@ static VarT *FindVariable(const TString &name,
return NULL;
}
+}
+
CollectVariables::CollectVariables(std::vector<sh::Attribute> *attribs,
std::vector<sh::Attribute> *outputVariables,
std::vector<sh::Uniform> *uniforms,
@@ -125,14 +152,18 @@ CollectVariables::CollectVariables(std::vector<sh::Attribute> *attribs,
void CollectVariables::visitSymbol(TIntermSymbol *symbol)
{
ASSERT(symbol != NULL);
- sh::ShaderVariable *var = NULL;
+ ShaderVariable *var = NULL;
const TString &symbolName = symbol->getSymbol();
- if (sh::IsVarying(symbol->getQualifier()))
+ if (IsVarying(symbol->getQualifier()))
{
var = FindVariable(symbolName, mVaryings);
}
- else if (symbol->getType() != EbtInterfaceBlock)
+ else if (symbol->getType().getBasicType() == EbtInterfaceBlock)
+ {
+ UNREACHABLE();
+ }
+ else
{
switch (symbol->getQualifier())
{
@@ -148,12 +179,13 @@ void CollectVariables::visitSymbol(TIntermSymbol *symbol)
const TInterfaceBlock *interfaceBlock = symbol->getType().getInterfaceBlock();
if (interfaceBlock)
{
- sh::InterfaceBlock *namedBlock = FindVariable(interfaceBlock->name(), mInterfaceBlocks);
+ InterfaceBlock *namedBlock = FindVariable(interfaceBlock->name(), mInterfaceBlocks);
ASSERT(namedBlock);
var = FindVariable(symbolName, &namedBlock->fields);
// Set static use on the parent interface block here
namedBlock->staticUse = true;
+
}
else
{
@@ -167,7 +199,7 @@ void CollectVariables::visitSymbol(TIntermSymbol *symbol)
case EvqFragCoord:
if (!mFragCoordAdded)
{
- sh::Varying info;
+ Varying info;
info.name = "gl_FragCoord";
info.mappedName = "gl_FragCoord";
info.type = GL_FLOAT_VEC4;
@@ -181,7 +213,7 @@ void CollectVariables::visitSymbol(TIntermSymbol *symbol)
case EvqFrontFacing:
if (!mFrontFacingAdded)
{
- sh::Varying info;
+ Varying info;
info.name = "gl_FrontFacing";
info.mappedName = "gl_FrontFacing";
info.type = GL_BOOL;
@@ -195,7 +227,7 @@ void CollectVariables::visitSymbol(TIntermSymbol *symbol)
case EvqPointCoord:
if (!mPointCoordAdded)
{
- sh::Varying info;
+ Varying info;
info.name = "gl_PointCoord";
info.mappedName = "gl_PointCoord";
info.type = GL_FLOAT_VEC2;
@@ -216,17 +248,17 @@ void CollectVariables::visitSymbol(TIntermSymbol *symbol)
}
}
-template <typename VarT>
-class NameHashingTraverser : public sh::GetVariableTraverser<VarT>
+class NameHashingTraverser : public GetVariableTraverser
{
public:
- NameHashingTraverser(std::vector<VarT> *output, ShHashFunction64 hashFunction)
- : sh::GetVariableTraverser<VarT>(output),
- mHashFunction(hashFunction)
+ NameHashingTraverser(ShHashFunction64 hashFunction)
+ : mHashFunction(hashFunction)
{}
private:
- void visitVariable(VarT *variable)
+ DISALLOW_COPY_AND_ASSIGN(NameHashingTraverser);
+
+ virtual void visitVariable(ShaderVariable *variable)
{
TString stringName = TString(variable->name.c_str());
variable->mappedName = TIntermTraverser::hash(stringName, mHashFunction).c_str();
@@ -238,16 +270,16 @@ class NameHashingTraverser : public sh::GetVariableTraverser<VarT>
// Attributes, which cannot have struct fields, are a special case
template <>
void CollectVariables::visitVariable(const TIntermSymbol *variable,
- std::vector<sh::Attribute> *infoList) const
+ std::vector<Attribute> *infoList) const
{
ASSERT(variable);
const TType &type = variable->getType();
ASSERT(!type.getStruct());
- sh::Attribute attribute;
+ Attribute attribute;
- attribute.type = sh::GLVariableType(type);
- attribute.precision = sh::GLVariablePrecision(type);
+ attribute.type = GLVariableType(type);
+ attribute.precision = GLVariablePrecision(type);
attribute.name = variable->getSymbol().c_str();
attribute.arraySize = static_cast<unsigned int>(type.getArraySize());
attribute.mappedName = TIntermTraverser::hash(variable->getSymbol(), mHashFunction).c_str();
@@ -258,29 +290,32 @@ void CollectVariables::visitVariable(const TIntermSymbol *variable,
template <>
void CollectVariables::visitVariable(const TIntermSymbol *variable,
- std::vector<sh::InterfaceBlock> *infoList) const
+ std::vector<InterfaceBlock> *infoList) const
{
- sh::InterfaceBlock interfaceBlock;
+ InterfaceBlock interfaceBlock;
const TInterfaceBlock *blockType = variable->getType().getInterfaceBlock();
-
- bool isRowMajor = (blockType->matrixPacking() == EmpRowMajor);
+ ASSERT(blockType);
interfaceBlock.name = blockType->name().c_str();
interfaceBlock.mappedName = TIntermTraverser::hash(variable->getSymbol(), mHashFunction).c_str();
+ interfaceBlock.instanceName = (blockType->hasInstanceName() ? blockType->instanceName().c_str() : "");
interfaceBlock.arraySize = variable->getArraySize();
- interfaceBlock.isRowMajorLayout = isRowMajor;
- interfaceBlock.layout = sh::GetBlockLayoutType(blockType->blockStorage());
+ interfaceBlock.isRowMajorLayout = (blockType->matrixPacking() == EmpRowMajor);
+ interfaceBlock.layout = GetBlockLayoutType(blockType->blockStorage());
- ASSERT(blockType);
- const TFieldList &blockFields = blockType->fields();
+ // Gather field information
+ const TFieldList &fieldList = blockType->fields();
- for (size_t fieldIndex = 0; fieldIndex < blockFields.size(); fieldIndex++)
+ for (size_t fieldIndex = 0; fieldIndex < fieldList.size(); ++fieldIndex)
{
- const TField *field = blockFields[fieldIndex];
- ASSERT(field);
+ const TField &field = *fieldList[fieldIndex];
+ const TString &fullFieldName = InterfaceBlockFieldName(*blockType, field);
+ const TType &fieldType = *field.type();
- sh::GetInterfaceBlockFieldTraverser traverser(&interfaceBlock.fields, isRowMajor);
- traverser.traverse(*field->type(), field->name());
+ GetVariableTraverser traverser;
+ traverser.traverse(fieldType, fullFieldName, &interfaceBlock.fields);
+
+ interfaceBlock.fields.back().isRowMajorLayout = (fieldType.getLayoutQualifier().matrixPacking == EmpRowMajor);
}
infoList->push_back(interfaceBlock);
@@ -290,8 +325,8 @@ template <typename VarT>
void CollectVariables::visitVariable(const TIntermSymbol *variable,
std::vector<VarT> *infoList) const
{
- NameHashingTraverser<VarT> traverser(infoList, mHashFunction);
- traverser.traverse(variable->getType(), variable->getSymbol());
+ NameHashingTraverser traverser(mHashFunction);
+ traverser.traverse(variable->getType(), variable->getSymbol(), infoList);
}
template <typename VarT>
@@ -320,16 +355,19 @@ bool CollectVariables::visitAggregate(Visit, TIntermAggregate *node)
case EOpDeclaration:
{
const TIntermSequence &sequence = *(node->getSequence());
+ ASSERT(!sequence.empty());
+
const TIntermTyped &typedNode = *(sequence.front()->getAsTyped());
TQualifier qualifier = typedNode.getQualifier();
if (typedNode.getBasicType() == EbtInterfaceBlock)
{
visitInfoList(sequence, mInterfaceBlocks);
+ visitChildren = false;
}
else if (qualifier == EvqAttribute || qualifier == EvqVertexIn ||
qualifier == EvqFragmentOut || qualifier == EvqUniform ||
- sh::IsVarying(qualifier))
+ IsVarying(qualifier))
{
switch (qualifier)
{
@@ -348,10 +386,7 @@ bool CollectVariables::visitAggregate(Visit, TIntermAggregate *node)
break;
}
- if (!sequence.empty())
- {
- visitChildren = false;
- }
+ visitChildren = false;
}
break;
}
@@ -361,15 +396,43 @@ bool CollectVariables::visitAggregate(Visit, TIntermAggregate *node)
return visitChildren;
}
+bool CollectVariables::visitBinary(Visit, TIntermBinary *binaryNode)
+{
+ if (binaryNode->getOp() == EOpIndexDirectInterfaceBlock)
+ {
+ // NOTE: we do not determine static use for individual blocks of an array
+ TIntermTyped *blockNode = binaryNode->getLeft()->getAsTyped();
+ ASSERT(blockNode);
+
+ TIntermConstantUnion *constantUnion = binaryNode->getRight()->getAsConstantUnion();
+ ASSERT(constantUnion);
+
+ const TInterfaceBlock *interfaceBlock = blockNode->getType().getInterfaceBlock();
+ InterfaceBlock *namedBlock = FindVariable(interfaceBlock->name(), mInterfaceBlocks);
+ ASSERT(namedBlock);
+ namedBlock->staticUse = true;
+
+ unsigned int fieldIndex = constantUnion->getUConst(0);
+ ASSERT(fieldIndex < namedBlock->fields.size());
+ namedBlock->fields[fieldIndex].staticUse = true;
+ return false;
+ }
+
+ return true;
+}
+
template <typename VarT>
-void ExpandVariables(const std::vector<VarT> &compact, std::vector<VarT> *expanded)
+void ExpandVariables(const std::vector<VarT> &compact,
+ std::vector<ShaderVariable> *expanded)
{
for (size_t variableIndex = 0; variableIndex < compact.size(); variableIndex++)
{
- const VarT &variable = compact[variableIndex];
+ const ShaderVariable &variable = compact[variableIndex];
ExpandVariable(variable, variable.name, variable.mappedName, variable.staticUse, expanded);
}
}
-template void ExpandVariables(const std::vector<sh::Uniform> &, std::vector<sh::Uniform> *);
-template void ExpandVariables(const std::vector<sh::Varying> &, std::vector<sh::Varying> *);
+template void ExpandVariables(const std::vector<Uniform> &, std::vector<ShaderVariable> *);
+template void ExpandVariables(const std::vector<Varying> &, std::vector<ShaderVariable> *);
+
+}
diff --git a/src/3rdparty/angle/src/compiler/translator/VariableInfo.h b/src/3rdparty/angle/src/compiler/translator/VariableInfo.h
index 3771819c8b..5ac4c46baa 100644
--- a/src/3rdparty/angle/src/compiler/translator/VariableInfo.h
+++ b/src/3rdparty/angle/src/compiler/translator/VariableInfo.h
@@ -7,22 +7,27 @@
#ifndef COMPILER_VARIABLE_INFO_H_
#define COMPILER_VARIABLE_INFO_H_
-#include "compiler/translator/intermediate.h"
-#include "common/shadervars.h"
+#include <GLSLANG/ShaderLang.h>
+
+#include "compiler/translator/IntermNode.h"
+
+namespace sh
+{
// Traverses intermediate tree to collect all attributes, uniforms, varyings.
class CollectVariables : public TIntermTraverser
{
public:
- CollectVariables(std::vector<sh::Attribute> *attribs,
- std::vector<sh::Attribute> *outputVariables,
- std::vector<sh::Uniform> *uniforms,
- std::vector<sh::Varying> *varyings,
- std::vector<sh::InterfaceBlock> *interfaceBlocks,
+ CollectVariables(std::vector<Attribute> *attribs,
+ std::vector<Attribute> *outputVariables,
+ std::vector<Uniform> *uniforms,
+ std::vector<Varying> *varyings,
+ std::vector<InterfaceBlock> *interfaceBlocks,
ShHashFunction64 hashFunction);
virtual void visitSymbol(TIntermSymbol *symbol);
virtual bool visitAggregate(Visit, TIntermAggregate *node);
+ virtual bool visitBinary(Visit visit, TIntermBinary *binaryNode);
private:
template <typename VarT>
@@ -31,13 +36,13 @@ class CollectVariables : public TIntermTraverser
template <typename VarT>
void visitInfoList(const TIntermSequence &sequence, std::vector<VarT> *infoList) const;
- std::vector<sh::Attribute> *mAttribs;
- std::vector<sh::Attribute> *mOutputVariables;
- std::vector<sh::Uniform> *mUniforms;
- std::vector<sh::Varying> *mVaryings;
- std::vector<sh::InterfaceBlock> *mInterfaceBlocks;
+ std::vector<Attribute> *mAttribs;
+ std::vector<Attribute> *mOutputVariables;
+ std::vector<Uniform> *mUniforms;
+ std::vector<Varying> *mVaryings;
+ std::vector<InterfaceBlock> *mInterfaceBlocks;
- std::map<std::string, sh::InterfaceBlockField *> mInterfaceBlockFields;
+ std::map<std::string, InterfaceBlockField *> mInterfaceBlockFields;
bool mPointCoordAdded;
bool mFrontFacingAdded;
@@ -47,8 +52,10 @@ class CollectVariables : public TIntermTraverser
};
// Expand struct variables to flattened lists of split variables
-// Implemented for sh::Varying and sh::Uniform.
template <typename VarT>
-void ExpandVariables(const std::vector<VarT> &compact, std::vector<VarT> *expanded);
+void ExpandVariables(const std::vector<VarT> &compact,
+ std::vector<ShaderVariable> *expanded);
+
+}
#endif // COMPILER_VARIABLE_INFO_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp b/src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp
index faaf0115fc..e69052162a 100644
--- a/src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp
@@ -3,12 +3,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/translator/VariablePacker.h"
-#include "angle_gl.h"
-#include "common/utilities.h"
#include <algorithm>
+#include "angle_gl.h"
+
+#include "compiler/translator/VariablePacker.h"
+#include "common/utilities.h"
+
int VariablePacker::GetNumComponentsPerRow(sh::GLenum type)
{
switch (type)
diff --git a/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp
index 12dc9e0dad..8edbd009b0 100644
--- a/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp
@@ -67,6 +67,9 @@ bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate *node)
}
break;
}
+ case EOpInvariantDeclaration:
+ updateVersion(GLSL_VERSION_120);
+ break;
case EOpParameters:
{
const TIntermSequence &params = *(node->getSequence());
diff --git a/src/3rdparty/angle/src/compiler/translator/VersionGLSL.h b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.h
index de4141d38c..30f5a138a0 100644
--- a/src/3rdparty/angle/src/compiler/translator/VersionGLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_TRANSLATOR_VERSIONGLSL_H_
#define COMPILER_TRANSLATOR_VERSIONGLSL_H_
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
// Traverses the intermediate tree to return the minimum GLSL version
// required to legally access all built-in features used in the shader.
diff --git a/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.h b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.h
index 5ea1cbb837..bc25fe7cbc 100644
--- a/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.h
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_H
#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_H
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#include <set>
#include <stack>
diff --git a/src/3rdparty/angle/src/compiler/translator/glslang.y b/src/3rdparty/angle/src/compiler/translator/glslang.y
index fb2d835368..5c945ad5ad 100644
--- a/src/3rdparty/angle/src/compiler/translator/glslang.y
+++ b/src/3rdparty/angle/src/compiler/translator/glslang.y
@@ -209,38 +209,7 @@ identifier
variable_identifier
: IDENTIFIER {
// The symbol table search was done in the lexical phase
- const TSymbol *symbol = $1.symbol;
- const TVariable *variable = 0;
-
- if (!symbol)
- {
- context->error(@1, "undeclared identifier", $1.string->c_str());
- context->recover();
- }
- else if (!symbol->isVariable())
- {
- context->error(@1, "variable expected", $1.string->c_str());
- context->recover();
- }
- else
- {
- variable = static_cast<const TVariable*>(symbol);
-
- if (context->symbolTable.findBuiltIn(variable->getName(), context->shaderVersion) &&
- !variable->getExtension().empty() &&
- context->extensionErrorCheck(@1, variable->getExtension()))
- {
- context->recover();
- }
- }
-
- if (!variable)
- {
- TType type(EbtFloat, EbpUndefined);
- TVariable *fakeVariable = new TVariable($1.string, type);
- context->symbolTable.declare(fakeVariable);
- variable = fakeVariable;
- }
+ const TVariable *variable = context->getNamedVariable(@1, $1.string, $1.symbol);
if (variable->getType().getQualifier() == EvqConst)
{
@@ -816,9 +785,10 @@ declaration
context->symbolTable.pop();
}
| init_declarator_list SEMICOLON {
- if ($1.intermAggregate)
- $1.intermAggregate->setOp(EOpDeclaration);
- $$ = $1.intermAggregate;
+ TIntermAggregate *aggNode = $1.intermAggregate;
+ if (aggNode && aggNode->getOp() == EOpNull)
+ aggNode->setOp(EOpDeclaration);
+ $$ = aggNode;
}
| PRECISION precision_qualifier type_specifier_no_prec SEMICOLON {
if (($2 == EbpHigh) && (context->shaderType == GL_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
@@ -1102,22 +1072,8 @@ single_declaration
$$.intermAggregate = context->parseSingleInitDeclaration($$.type, @2, *$2.string, @3, $4);
}
| INVARIANT IDENTIFIER {
- VERTEX_ONLY("invariant declaration", @1);
- if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "invariant varying"))
- context->recover();
- $$.type.setBasic(EbtInvariant, EvqInvariantVaryingOut, @2);
- if (!$2.symbol)
- {
- context->error(@2, "undeclared identifier declared as invariant", $2.string->c_str());
- context->recover();
-
- $$.intermAggregate = 0;
- }
- else
- {
- TIntermSymbol *symbol = context->intermediate.addSymbol(0, *$2.string, TType($$.type), @2);
- $$.intermAggregate = context->intermediate.makeAggregate(symbol, @2);
- }
+ // $$.type is not used in invariant declarations.
+ $$.intermAggregate = context->parseInvariantDeclaration(@1, @2, $2.string, $2.symbol);
}
;
diff --git a/src/3rdparty/angle/src/compiler/translator/intermOut.cpp b/src/3rdparty/angle/src/compiler/translator/intermOut.cpp
index a6e7ab41a6..56340c6f9e 100644
--- a/src/3rdparty/angle/src/compiler/translator/intermOut.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/intermOut.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/translator/localintermediate.h"
+#include "compiler/translator/Intermediate.h"
#include "compiler/translator/SymbolTable.h"
namespace
@@ -342,6 +342,7 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
case EOpMul: out << "component-wise multiply"; break;
case EOpDeclaration: out << "Declaration: "; break;
+ case EOpInvariantDeclaration: out << "Invariant Declaration: "; break;
default:
out.prefix(EPrefixError);
diff --git a/src/3rdparty/angle/src/compiler/translator/intermediate.h b/src/3rdparty/angle/src/compiler/translator/intermediate.h
index 892f2849e0..3b7e7bd802 100644
--- a/src/3rdparty/angle/src/compiler/translator/intermediate.h
+++ b/src/3rdparty/angle/src/compiler/translator/intermediate.h
@@ -4,768 +4,64 @@
// found in the LICENSE file.
//
-//
-// Definition of the in-memory high-level intermediate representation
-// of shaders. This is a tree that parser creates.
-//
-// Nodes in the tree are defined as a hierarchy of classes derived from
-// TIntermNode. Each is a node in a tree. There is no preset branching factor;
-// each node can have it's own type of list of children.
-//
-
-#ifndef COMPILER_TRANSLATOR_INTERMEDIATE_H_
-#define COMPILER_TRANSLATOR_INTERMEDIATE_H_
-
-#include "GLSLANG/ShaderLang.h"
-
-#include <algorithm>
-#include <queue>
-
-#include "compiler/translator/Common.h"
-#include "compiler/translator/Types.h"
-#include "compiler/translator/ConstantUnion.h"
-
-//
-// Operators used by the high-level (parse tree) representation.
-//
-enum TOperator
-{
- EOpNull, // if in a node, should only mean a node is still being built
- EOpSequence, // denotes a list of statements, or parameters, etc.
- EOpFunctionCall,
- EOpFunction, // For function definition
- EOpParameters, // an aggregate listing the parameters to a function
-
- EOpDeclaration,
- EOpPrototype,
-
- //
- // Unary operators
- //
-
- EOpNegative,
- EOpLogicalNot,
- EOpVectorLogicalNot,
-
- EOpPostIncrement,
- EOpPostDecrement,
- EOpPreIncrement,
- EOpPreDecrement,
-
- //
- // binary operations
- //
-
- EOpAdd,
- EOpSub,
- EOpMul,
- EOpDiv,
- EOpEqual,
- EOpNotEqual,
- EOpVectorEqual,
- EOpVectorNotEqual,
- EOpLessThan,
- EOpGreaterThan,
- EOpLessThanEqual,
- EOpGreaterThanEqual,
- EOpComma,
-
- EOpVectorTimesScalar,
- EOpVectorTimesMatrix,
- EOpMatrixTimesVector,
- EOpMatrixTimesScalar,
-
- EOpLogicalOr,
- EOpLogicalXor,
- EOpLogicalAnd,
-
- EOpIndexDirect,
- EOpIndexIndirect,
- EOpIndexDirectStruct,
- EOpIndexDirectInterfaceBlock,
-
- EOpVectorSwizzle,
-
- //
- // Built-in functions potentially mapped to operators
- //
-
- EOpRadians,
- EOpDegrees,
- EOpSin,
- EOpCos,
- EOpTan,
- EOpAsin,
- EOpAcos,
- EOpAtan,
-
- EOpPow,
- EOpExp,
- EOpLog,
- EOpExp2,
- EOpLog2,
- EOpSqrt,
- EOpInverseSqrt,
-
- EOpAbs,
- EOpSign,
- EOpFloor,
- EOpCeil,
- EOpFract,
- EOpMod,
- EOpMin,
- EOpMax,
- EOpClamp,
- EOpMix,
- EOpStep,
- EOpSmoothStep,
-
- EOpLength,
- EOpDistance,
- EOpDot,
- EOpCross,
- EOpNormalize,
- EOpFaceForward,
- EOpReflect,
- EOpRefract,
-
- EOpDFdx, // Fragment only, OES_standard_derivatives extension
- EOpDFdy, // Fragment only, OES_standard_derivatives extension
- EOpFwidth, // Fragment only, OES_standard_derivatives extension
-
- EOpMatrixTimesMatrix,
-
- EOpAny,
- EOpAll,
-
- //
- // Branch
- //
-
- EOpKill, // Fragment only
- EOpReturn,
- EOpBreak,
- EOpContinue,
-
- //
- // Constructors
- //
-
- EOpConstructInt,
- EOpConstructUInt,
- EOpConstructBool,
- EOpConstructFloat,
- EOpConstructVec2,
- EOpConstructVec3,
- EOpConstructVec4,
- EOpConstructBVec2,
- EOpConstructBVec3,
- EOpConstructBVec4,
- EOpConstructIVec2,
- EOpConstructIVec3,
- EOpConstructIVec4,
- EOpConstructUVec2,
- EOpConstructUVec3,
- EOpConstructUVec4,
- EOpConstructMat2,
- EOpConstructMat3,
- EOpConstructMat4,
- EOpConstructStruct,
-
- //
- // moves
- //
-
- EOpAssign,
- EOpInitialize,
- EOpAddAssign,
- EOpSubAssign,
- EOpMulAssign,
- EOpVectorTimesMatrixAssign,
- EOpVectorTimesScalarAssign,
- EOpMatrixTimesScalarAssign,
- EOpMatrixTimesMatrixAssign,
- EOpDivAssign
-};
-
-class TIntermTraverser;
-class TIntermAggregate;
-class TIntermBinary;
-class TIntermUnary;
-class TIntermConstantUnion;
-class TIntermSelection;
-class TIntermTyped;
-class TIntermSymbol;
-class TIntermLoop;
-class TInfoSink;
-class TIntermRaw;
-
-//
-// Base class for the tree nodes
-//
-class TIntermNode
-{
- public:
- POOL_ALLOCATOR_NEW_DELETE();
- TIntermNode()
- {
- // TODO: Move this to TSourceLoc constructor
- // after getting rid of TPublicType.
- mLine.first_file = mLine.last_file = 0;
- mLine.first_line = mLine.last_line = 0;
- }
- virtual ~TIntermNode() { }
-
- const TSourceLoc &getLine() const { return mLine; }
- void setLine(const TSourceLoc &l) { mLine = l; }
-
- virtual void traverse(TIntermTraverser *) = 0;
- virtual TIntermTyped *getAsTyped() { return 0; }
- virtual TIntermConstantUnion *getAsConstantUnion() { return 0; }
- virtual TIntermAggregate *getAsAggregate() { return 0; }
- virtual TIntermBinary *getAsBinaryNode() { return 0; }
- virtual TIntermUnary *getAsUnaryNode() { return 0; }
- virtual TIntermSelection *getAsSelectionNode() { return 0; }
- virtual TIntermSymbol *getAsSymbolNode() { return 0; }
- virtual TIntermLoop *getAsLoopNode() { return 0; }
- virtual TIntermRaw *getAsRawNode() { return 0; }
-
- // Replace a child node. Return true if |original| is a child
- // node and it is replaced; otherwise, return false.
- virtual bool replaceChildNode(
- TIntermNode *original, TIntermNode *replacement) = 0;
-
- // For traversing a tree in no particular order, but using
- // heap memory.
- virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const = 0;
-
- protected:
- TSourceLoc mLine;
-};
-
-//
-// This is just to help yacc.
-//
-struct TIntermNodePair
-{
- TIntermNode *node1;
- TIntermNode *node2;
-};
-
-//
-// Intermediate class for nodes that have a type.
-//
-class TIntermTyped : public TIntermNode
-{
- public:
- TIntermTyped(const TType &t) : mType(t) { }
- virtual TIntermTyped *getAsTyped() { return this; }
+#ifndef COMPILER_TRANSLATOR_LOCAL_INTERMEDIATE_H_
+#define COMPILER_TRANSLATOR_LOCAL_INTERMEDIATE_H_
- virtual bool hasSideEffects() const = 0;
+#include "compiler/translator/IntermNode.h"
- void setType(const TType &t) { mType = t; }
- const TType &getType() const { return mType; }
- TType *getTypePointer() { return &mType; }
-
- TBasicType getBasicType() const { return mType.getBasicType(); }
- TQualifier getQualifier() const { return mType.getQualifier(); }
- TPrecision getPrecision() const { return mType.getPrecision(); }
- int getCols() const { return mType.getCols(); }
- int getRows() const { return mType.getRows(); }
- int getNominalSize() const { return mType.getNominalSize(); }
- int getSecondarySize() const { return mType.getSecondarySize(); }
-
- bool isInterfaceBlock() const { return mType.isInterfaceBlock(); }
- bool isMatrix() const { return mType.isMatrix(); }
- bool isArray() const { return mType.isArray(); }
- bool isVector() const { return mType.isVector(); }
- bool isScalar() const { return mType.isScalar(); }
- bool isScalarInt() const { return mType.isScalarInt(); }
- const char *getBasicString() const { return mType.getBasicString(); }
- const char *getQualifierString() const { return mType.getQualifierString(); }
- TString getCompleteString() const { return mType.getCompleteString(); }
-
- int getArraySize() const { return mType.getArraySize(); }
-
- protected:
- TType mType;
-};
-
-//
-// Handle for, do-while, and while loops.
-//
-enum TLoopType
+struct TVectorFields
{
- ELoopFor,
- ELoopWhile,
- ELoopDoWhile
-};
-
-class TIntermLoop : public TIntermNode
-{
- public:
- TIntermLoop(TLoopType type,
- TIntermNode *init, TIntermTyped *cond, TIntermTyped *expr,
- TIntermNode *body)
- : mType(type),
- mInit(init),
- mCond(cond),
- mExpr(expr),
- mBody(body),
- mUnrollFlag(false) { }
-
- virtual TIntermLoop *getAsLoopNode() { return this; }
- virtual void traverse(TIntermTraverser *);
- virtual bool replaceChildNode(
- TIntermNode *original, TIntermNode *replacement);
-
- TLoopType getType() const { return mType; }
- TIntermNode *getInit() { return mInit; }
- TIntermTyped *getCondition() { return mCond; }
- TIntermTyped *getExpression() { return mExpr; }
- TIntermNode *getBody() { return mBody; }
-
- void setUnrollFlag(bool flag) { mUnrollFlag = flag; }
- bool getUnrollFlag() const { return mUnrollFlag; }
-
- virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
-
- protected:
- TLoopType mType;
- TIntermNode *mInit; // for-loop initialization
- TIntermTyped *mCond; // loop exit condition
- TIntermTyped *mExpr; // for-loop expression
- TIntermNode *mBody; // loop body
-
- bool mUnrollFlag; // Whether the loop should be unrolled or not.
+ int offsets[4];
+ int num;
};
//
-// Handle break, continue, return, and kill.
+// Set of helper functions to help parse and build the tree.
//
-class TIntermBranch : public TIntermNode
-{
- public:
- TIntermBranch(TOperator op, TIntermTyped *e)
- : mFlowOp(op),
- mExpression(e) { }
-
- virtual void traverse(TIntermTraverser *);
- virtual bool replaceChildNode(
- TIntermNode *original, TIntermNode *replacement);
-
- TOperator getFlowOp() { return mFlowOp; }
- TIntermTyped* getExpression() { return mExpression; }
-
- virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
-
-protected:
- TOperator mFlowOp;
- TIntermTyped *mExpression; // non-zero except for "return exp;" statements
-};
-
-//
-// Nodes that correspond to symbols or constants in the source code.
-//
-class TIntermSymbol : public TIntermTyped
-{
- public:
- // if symbol is initialized as symbol(sym), the memory comes from the poolallocator of sym.
- // If sym comes from per process globalpoolallocator, then it causes increased memory usage
- // per compile it is essential to use "symbol = sym" to assign to symbol
- TIntermSymbol(int id, const TString &symbol, const TType &type)
- : TIntermTyped(type),
- mId(id)
- {
- mSymbol = symbol;
- }
-
- virtual bool hasSideEffects() const { return false; }
-
- int getId() const { return mId; }
- const TString &getSymbol() const { return mSymbol; }
-
- void setId(int newId) { mId = newId; }
-
- virtual void traverse(TIntermTraverser *);
- virtual TIntermSymbol *getAsSymbolNode() { return this; }
- virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
-
- virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const {}
-
- protected:
- int mId;
- TString mSymbol;
-};
-
-// A Raw node stores raw code, that the translator will insert verbatim
-// into the output stream. Useful for transformation operations that make
-// complex code that might not fit naturally into the GLSL model.
-class TIntermRaw : public TIntermTyped
-{
- public:
- TIntermRaw(const TType &type, const TString &rawText)
- : TIntermTyped(type),
- mRawText(rawText) { }
-
- virtual bool hasSideEffects() const { return false; }
-
- TString getRawText() const { return mRawText; }
-
- virtual void traverse(TIntermTraverser *);
-
- virtual TIntermRaw *getAsRawNode() { return this; }
- virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
- virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const {}
-
- protected:
- TString mRawText;
-};
-
-class TIntermConstantUnion : public TIntermTyped
-{
- public:
- TIntermConstantUnion(ConstantUnion *unionPointer, const TType &type)
- : TIntermTyped(type),
- mUnionArrayPointer(unionPointer) { }
-
- virtual bool hasSideEffects() const { return false; }
-
- ConstantUnion *getUnionArrayPointer() const { return mUnionArrayPointer; }
-
- int getIConst(size_t index) const
- {
- return mUnionArrayPointer ? mUnionArrayPointer[index].getIConst() : 0;
- }
- unsigned int getUConst(size_t index) const
- {
- return mUnionArrayPointer ? mUnionArrayPointer[index].getUConst() : 0;
- }
- float getFConst(size_t index) const
- {
- return mUnionArrayPointer ? mUnionArrayPointer[index].getFConst() : 0.0f;
- }
- bool getBConst(size_t index) const
- {
- return mUnionArrayPointer ? mUnionArrayPointer[index].getBConst() : false;
- }
-
- virtual TIntermConstantUnion *getAsConstantUnion() { return this; }
- virtual void traverse(TIntermTraverser *);
- virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
-
- TIntermTyped *fold(TOperator, TIntermTyped *, TInfoSink &);
-
- virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const {}
-
- protected:
- ConstantUnion *mUnionArrayPointer;
-};
-
-//
-// Intermediate class for node types that hold operators.
-//
-class TIntermOperator : public TIntermTyped
-{
- public:
- TOperator getOp() const { return mOp; }
- void setOp(TOperator op) { mOp = op; }
-
- bool isAssignment() const;
- bool isConstructor() const;
-
- virtual bool hasSideEffects() const { return isAssignment(); }
-
- protected:
- TIntermOperator(TOperator op)
- : TIntermTyped(TType(EbtFloat, EbpUndefined)),
- mOp(op) {}
- TIntermOperator(TOperator op, const TType &type)
- : TIntermTyped(type),
- mOp(op) {}
-
- TOperator mOp;
-};
-
-//
-// Nodes for all the basic binary math operators.
-//
-class TIntermBinary : public TIntermOperator
-{
- public:
- TIntermBinary(TOperator op)
- : TIntermOperator(op),
- mAddIndexClamp(false) {}
-
- virtual TIntermBinary *getAsBinaryNode() { return this; }
- virtual void traverse(TIntermTraverser *);
- virtual bool replaceChildNode(
- TIntermNode *original, TIntermNode *replacement);
-
- virtual bool hasSideEffects() const
- {
- return isAssignment() || mLeft->hasSideEffects() || mRight->hasSideEffects();
- }
-
- void setLeft(TIntermTyped *node) { mLeft = node; }
- void setRight(TIntermTyped *node) { mRight = node; }
- TIntermTyped *getLeft() const { return mLeft; }
- TIntermTyped *getRight() const { return mRight; }
- bool promote(TInfoSink &);
-
- void setAddIndexClamp() { mAddIndexClamp = true; }
- bool getAddIndexClamp() { return mAddIndexClamp; }
-
- virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
-
- protected:
- TIntermTyped* mLeft;
- TIntermTyped* mRight;
-
- // If set to true, wrap any EOpIndexIndirect with a clamp to bounds.
- bool mAddIndexClamp;
-};
-
-//
-// Nodes for unary math operators.
-//
-class TIntermUnary : public TIntermOperator
-{
- public:
- TIntermUnary(TOperator op, const TType &type)
- : TIntermOperator(op, type),
- mOperand(NULL),
- mUseEmulatedFunction(false) {}
- TIntermUnary(TOperator op)
- : TIntermOperator(op),
- mOperand(NULL),
- mUseEmulatedFunction(false) {}
-
- virtual void traverse(TIntermTraverser *);
- virtual TIntermUnary *getAsUnaryNode() { return this; }
- virtual bool replaceChildNode(
- TIntermNode *original, TIntermNode *replacement);
-
- virtual bool hasSideEffects() const
- {
- return isAssignment() || mOperand->hasSideEffects();
- }
-
- void setOperand(TIntermTyped *operand) { mOperand = operand; }
- TIntermTyped *getOperand() { return mOperand; }
- bool promote(TInfoSink &);
-
- void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
- bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
-
- virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
-
- protected:
- TIntermTyped *mOperand;
-
- // If set to true, replace the built-in function call with an emulated one
- // to work around driver bugs.
- bool mUseEmulatedFunction;
-};
-
-typedef TVector<TIntermNode *> TIntermSequence;
-typedef TVector<int> TQualifierList;
-
-//
-// Nodes that operate on an arbitrary sized set of children.
-//
-class TIntermAggregate : public TIntermOperator
-{
- public:
- TIntermAggregate()
- : TIntermOperator(EOpNull),
- mUserDefined(false),
- mUseEmulatedFunction(false) { }
- TIntermAggregate(TOperator op)
- : TIntermOperator(op),
- mUseEmulatedFunction(false) { }
- ~TIntermAggregate() { }
-
- virtual TIntermAggregate *getAsAggregate() { return this; }
- virtual void traverse(TIntermTraverser *);
- virtual bool replaceChildNode(
- TIntermNode *original, TIntermNode *replacement);
-
- // Conservatively assume function calls and other aggregate operators have side-effects
- virtual bool hasSideEffects() const { return true; }
-
- TIntermSequence *getSequence() { return &mSequence; }
-
- void setName(const TString &name) { mName = name; }
- const TString &getName() const { return mName; }
-
- void setUserDefined() { mUserDefined = true; }
- bool isUserDefined() const { return mUserDefined; }
-
- void setOptimize(bool optimize) { mOptimize = optimize; }
- bool getOptimize() const { return mOptimize; }
- void setDebug(bool debug) { mDebug = debug; }
- bool getDebug() const { return mDebug; }
-
- void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
- bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
-
- virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
-
- protected:
- TIntermAggregate(const TIntermAggregate &); // disallow copy constructor
- TIntermAggregate &operator=(const TIntermAggregate &); // disallow assignment operator
- TIntermSequence mSequence;
- TString mName;
- bool mUserDefined; // used for user defined function names
-
- bool mOptimize;
- bool mDebug;
-
- // If set to true, replace the built-in function call with an emulated one
- // to work around driver bugs.
- bool mUseEmulatedFunction;
-};
-
-//
-// For if tests. Simplified since there is no switch statement.
-//
-class TIntermSelection : public TIntermTyped
-{
- public:
- TIntermSelection(TIntermTyped *cond, TIntermNode *trueB, TIntermNode *falseB)
- : TIntermTyped(TType(EbtVoid, EbpUndefined)),
- mCondition(cond),
- mTrueBlock(trueB),
- mFalseBlock(falseB) {}
- TIntermSelection(TIntermTyped *cond, TIntermNode *trueB, TIntermNode *falseB,
- const TType &type)
- : TIntermTyped(type),
- mCondition(cond),
- mTrueBlock(trueB),
- mFalseBlock(falseB) {}
-
- virtual void traverse(TIntermTraverser *);
- virtual bool replaceChildNode(
- TIntermNode *original, TIntermNode *replacement);
-
- // Conservatively assume selections have side-effects
- virtual bool hasSideEffects() const { return true; }
-
- bool usesTernaryOperator() const { return getBasicType() != EbtVoid; }
- TIntermNode *getCondition() const { return mCondition; }
- TIntermNode *getTrueBlock() const { return mTrueBlock; }
- TIntermNode *getFalseBlock() const { return mFalseBlock; }
- TIntermSelection *getAsSelectionNode() { return this; }
-
- virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
-
-protected:
- TIntermTyped *mCondition;
- TIntermNode *mTrueBlock;
- TIntermNode *mFalseBlock;
-};
-
-enum Visit
-{
- PreVisit,
- InVisit,
- PostVisit
-};
-
-//
-// For traversing the tree. User should derive from this,
-// put their traversal specific data in it, and then pass
-// it to a Traverse method.
-//
-// When using this, just fill in the methods for nodes you want visited.
-// Return false from a pre-visit to skip visiting that node's subtree.
-//
-class TIntermTraverser
-{
- public:
- POOL_ALLOCATOR_NEW_DELETE();
- // TODO(zmo): remove default values.
- TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false,
- bool rightToLeft = false)
- : preVisit(preVisit),
- inVisit(inVisit),
- postVisit(postVisit),
- rightToLeft(rightToLeft),
- mDepth(0),
- mMaxDepth(0) {}
- virtual ~TIntermTraverser() {}
-
- virtual void visitSymbol(TIntermSymbol *) {}
- virtual void visitRaw(TIntermRaw *) {}
- virtual void visitConstantUnion(TIntermConstantUnion *) {}
- virtual bool visitBinary(Visit, TIntermBinary *) { return true; }
- virtual bool visitUnary(Visit, TIntermUnary *) { return true; }
- virtual bool visitSelection(Visit, TIntermSelection *) { return true; }
- virtual bool visitAggregate(Visit, TIntermAggregate *) { return true; }
- virtual bool visitLoop(Visit, TIntermLoop *) { return true; }
- virtual bool visitBranch(Visit, TIntermBranch *) { return true; }
-
- int getMaxDepth() const { return mMaxDepth; }
-
- void incrementDepth(TIntermNode *current)
- {
- mDepth++;
- mMaxDepth = std::max(mMaxDepth, mDepth);
- mPath.push_back(current);
- }
-
- void decrementDepth()
- {
- mDepth--;
- mPath.pop_back();
- }
-
- TIntermNode *getParentNode()
- {
- return mPath.size() == 0 ? NULL : mPath.back();
- }
-
- // 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;
- const bool rightToLeft;
-
- protected:
- int mDepth;
- int mMaxDepth;
-
- // All the nodes from root to the current node's parent during traversing.
- TVector<TIntermNode *> mPath;
-};
-
-//
-// For traversing the tree, and computing max depth.
-// Takes a maximum depth limit to prevent stack overflow.
-//
-class TMaxDepthTraverser : public TIntermTraverser
+class TInfoSink;
+class TIntermediate
{
public:
POOL_ALLOCATOR_NEW_DELETE();
- TMaxDepthTraverser(int depthLimit)
- : TIntermTraverser(true, true, false, false),
- mDepthLimit(depthLimit) { }
-
- virtual bool visitBinary(Visit, TIntermBinary *) { return depthCheck(); }
- virtual bool visitUnary(Visit, TIntermUnary *) { return depthCheck(); }
- virtual bool visitSelection(Visit, TIntermSelection *) { return depthCheck(); }
- virtual bool visitAggregate(Visit, TIntermAggregate *) { return depthCheck(); }
- virtual bool visitLoop(Visit, TIntermLoop *) { return depthCheck(); }
- virtual bool visitBranch(Visit, TIntermBranch *) { return depthCheck(); }
-
-protected:
- bool depthCheck() const { return mMaxDepth < mDepthLimit; }
-
- int mDepthLimit;
-};
-
-#endif // COMPILER_TRANSLATOR_INTERMEDIATE_H_
+ TIntermediate(TInfoSink &i)
+ : mInfoSink(i) { }
+
+ TIntermSymbol *addSymbol(
+ int id, const TString &, const TType &, const TSourceLoc &);
+ TIntermTyped *addBinaryMath(
+ TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &);
+ TIntermTyped *addAssign(
+ TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &);
+ TIntermTyped *addIndex(
+ TOperator op, TIntermTyped *base, TIntermTyped *index, const TSourceLoc &);
+ TIntermTyped *addUnaryMath(
+ TOperator op, TIntermNode *child, const TSourceLoc &);
+ TIntermAggregate *growAggregate(
+ TIntermNode *left, TIntermNode *right, const TSourceLoc &);
+ TIntermAggregate *makeAggregate(TIntermNode *node, const TSourceLoc &);
+ TIntermAggregate *setAggregateOperator(TIntermNode *, TOperator, const TSourceLoc &);
+ TIntermNode *addSelection(TIntermTyped *cond, TIntermNodePair code, const TSourceLoc &);
+ TIntermTyped *addSelection(
+ TIntermTyped *cond, TIntermTyped *trueBlock, TIntermTyped *falseBlock, const TSourceLoc &);
+ TIntermTyped *addComma(
+ TIntermTyped *left, TIntermTyped *right, const TSourceLoc &);
+ TIntermConstantUnion *addConstantUnion(ConstantUnion *, const TType &, const TSourceLoc &);
+ // TODO(zmo): Get rid of default value.
+ bool parseConstTree(const TSourceLoc &, TIntermNode *, ConstantUnion *,
+ TOperator, TType, bool singleConstantParam = false);
+ TIntermNode *addLoop(TLoopType, TIntermNode *, TIntermTyped *, TIntermTyped *,
+ TIntermNode *, const TSourceLoc &);
+ TIntermBranch *addBranch(TOperator, const TSourceLoc &);
+ TIntermBranch *addBranch(TOperator, TIntermTyped *, const TSourceLoc &);
+ TIntermTyped *addSwizzle(TVectorFields &, const TSourceLoc &);
+ bool postProcess(TIntermNode *);
+ void remove(TIntermNode *);
+ void outputTree(TIntermNode *);
+
+ private:
+ void operator=(TIntermediate &); // prevent assignments
+
+ TInfoSink & mInfoSink;
+};
+
+#endif // COMPILER_TRANSLATOR_LOCAL_INTERMEDIATE_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/localintermediate.h b/src/3rdparty/angle/src/compiler/translator/localintermediate.h
deleted file mode 100644
index 0809bbd362..0000000000
--- a/src/3rdparty/angle/src/compiler/translator/localintermediate.h
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_TRANSLATOR_LOCAL_INTERMEDIATE_H_
-#define COMPILER_TRANSLATOR_LOCAL_INTERMEDIATE_H_
-
-#include "compiler/translator/intermediate.h"
-
-struct TVectorFields
-{
- int offsets[4];
- int num;
-};
-
-//
-// Set of helper functions to help parse and build the tree.
-//
-class TInfoSink;
-class TIntermediate
-{
- public:
- POOL_ALLOCATOR_NEW_DELETE();
- TIntermediate(TInfoSink &i)
- : mInfoSink(i) { }
-
- TIntermSymbol *addSymbol(
- int id, const TString &, const TType &, const TSourceLoc &);
- TIntermTyped *addBinaryMath(
- TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &);
- TIntermTyped *addAssign(
- TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &);
- TIntermTyped *addIndex(
- TOperator op, TIntermTyped *base, TIntermTyped *index, const TSourceLoc &);
- TIntermTyped *addUnaryMath(
- TOperator op, TIntermNode *child, const TSourceLoc &);
- TIntermAggregate *growAggregate(
- TIntermNode *left, TIntermNode *right, const TSourceLoc &);
- TIntermAggregate *makeAggregate(TIntermNode *node, const TSourceLoc &);
- TIntermAggregate *setAggregateOperator(TIntermNode *, TOperator, const TSourceLoc &);
- TIntermNode *addSelection(TIntermTyped *cond, TIntermNodePair code, const TSourceLoc &);
- TIntermTyped *addSelection(
- TIntermTyped *cond, TIntermTyped *trueBlock, TIntermTyped *falseBlock, const TSourceLoc &);
- TIntermTyped *addComma(
- TIntermTyped *left, TIntermTyped *right, const TSourceLoc &);
- TIntermConstantUnion *addConstantUnion(ConstantUnion *, const TType &, const TSourceLoc &);
- // TODO(zmo): Get rid of default value.
- bool parseConstTree(const TSourceLoc &, TIntermNode *, ConstantUnion *,
- TOperator, TType, bool singleConstantParam = false);
- TIntermNode *addLoop(TLoopType, TIntermNode *, TIntermTyped *, TIntermTyped *,
- TIntermNode *, const TSourceLoc &);
- TIntermBranch *addBranch(TOperator, const TSourceLoc &);
- TIntermBranch *addBranch(TOperator, TIntermTyped *, const TSourceLoc &);
- TIntermTyped *addSwizzle(TVectorFields &, const TSourceLoc &);
- bool postProcess(TIntermNode *);
- void remove(TIntermNode *);
- void outputTree(TIntermNode *);
-
- private:
- void operator=(TIntermediate &); // prevent assignments
-
- TInfoSink & mInfoSink;
-};
-
-#endif // COMPILER_TRANSLATOR_LOCAL_INTERMEDIATE_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h b/src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h
index e77d8c21cb..80d5f7fa7f 100644
--- a/src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h
+++ b/src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_TIMING_RESTRICT_FRAGMENT_SHADER_TIMING_H_
#define COMPILER_TIMING_RESTRICT_FRAGMENT_SHADER_TIMING_H_
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#include "compiler/translator/depgraph/DependencyGraph.h"
class TInfoSinkBase;
diff --git a/src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h b/src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h
index d461fbdbfe..a6263567b4 100644
--- a/src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h
+++ b/src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_TIMING_RESTRICT_VERTEX_SHADER_TIMING_H_
#define COMPILER_TIMING_RESTRICT_VERTEX_SHADER_TIMING_H_
-#include "compiler/translator/intermediate.h"
+#include "compiler/translator/IntermNode.h"
#include "compiler/translator/InfoSink.h"
class TInfoSinkBase;
diff --git a/src/3rdparty/angle/src/compiler/translator/util.cpp b/src/3rdparty/angle/src/compiler/translator/util.cpp
index 561d4e007c..f74c7d1173 100644
--- a/src/3rdparty/angle/src/compiler/translator/util.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/util.cpp
@@ -9,7 +9,6 @@
#include <limits>
#include "compiler/preprocessor/numeric_lex.h"
-#include "common/shadervars.h"
#include "common/utilities.h"
bool atof_clamp(const char *str, float *value)
@@ -269,6 +268,8 @@ InterpolationType GetInterpolationType(TQualifier qualifier)
case EvqFragmentIn:
case EvqVaryingIn:
case EvqVaryingOut:
+ case EvqInvariantVaryingIn:
+ case EvqInvariantVaryingOut:
return INTERPOLATION_SMOOTH;
case EvqCentroidIn:
@@ -281,7 +282,7 @@ InterpolationType GetInterpolationType(TQualifier qualifier)
}
template <typename VarT>
-void GetVariableTraverser<VarT>::traverse(const TType &type, const TString &name)
+void GetVariableTraverser::traverse(const TType &type, const TString &name, std::vector<VarT> *output)
{
const TStructure *structure = type.getStruct();
@@ -296,61 +297,27 @@ void GetVariableTraverser<VarT>::traverse(const TType &type, const TString &name
}
else
{
+ // Note: this enum value is not exposed outside ANGLE
variable.type = GL_STRUCT_ANGLEX;
-
- mOutputStack.push(&variable.fields);
+ variable.structName = structure->name().c_str();
const TFieldList &fields = structure->fields();
for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
{
TField *field = fields[fieldIndex];
- traverse(*field->type(), field->name());
+ traverse(*field->type(), field->name(), &variable.fields);
}
-
- mOutputStack.pop();
}
visitVariable(&variable);
- ASSERT(!mOutputStack.empty());
- mOutputStack.top()->push_back(variable);
-}
-
-template <typename VarT>
-GetVariableTraverser<VarT>::GetVariableTraverser(std::vector<VarT> *output)
-{
ASSERT(output);
- mOutputStack.push(output);
+ output->push_back(variable);
}
-template class GetVariableTraverser<Uniform>;
-template class GetVariableTraverser<Varying>;
-template class GetVariableTraverser<InterfaceBlockField>;
-
-GetInterfaceBlockFieldTraverser::GetInterfaceBlockFieldTraverser(std::vector<InterfaceBlockField> *output, bool isRowMajorMatrix)
- : GetVariableTraverser(output),
- mIsRowMajorMatrix(isRowMajorMatrix)
-{
-}
-
-void GetInterfaceBlockFieldTraverser::visitVariable(InterfaceBlockField *newField)
-{
- if (gl::IsMatrixType(newField->type))
- {
- newField->isRowMajorMatrix = mIsRowMajorMatrix;
- }
-}
-
-BlockLayoutType GetBlockLayoutType(TLayoutBlockStorage blockStorage)
-{
- switch (blockStorage)
- {
- case EbsPacked: return BLOCKLAYOUT_PACKED;
- case EbsShared: return BLOCKLAYOUT_SHARED;
- case EbsStd140: return BLOCKLAYOUT_STANDARD;
- default: UNREACHABLE(); return BLOCKLAYOUT_SHARED;
- }
-}
+template void GetVariableTraverser::traverse(const TType &, const TString &, std::vector<Uniform> *);
+template void GetVariableTraverser::traverse(const TType &, const TString &, std::vector<Varying> *);
+template void GetVariableTraverser::traverse(const TType &, const TString &, std::vector<InterfaceBlockField> *);
}
diff --git a/src/3rdparty/angle/src/compiler/translator/util.h b/src/3rdparty/angle/src/compiler/translator/util.h
index 5c214dd4fb..241e2cc1c2 100644
--- a/src/3rdparty/angle/src/compiler/translator/util.h
+++ b/src/3rdparty/angle/src/compiler/translator/util.h
@@ -9,9 +9,10 @@
#include <stack>
-#include "compiler/translator/Types.h"
#include "angle_gl.h"
-#include "common/shadervars.h"
+#include <GLSLANG/ShaderLang.h>
+
+#include "compiler/translator/Types.h"
// atof_clamp is like atof but
// 1. it forces C locale, i.e. forcing '.' as decimal point.
@@ -32,33 +33,22 @@ bool IsVaryingIn(TQualifier qualifier);
bool IsVaryingOut(TQualifier qualifier);
bool IsVarying(TQualifier qualifier);
InterpolationType GetInterpolationType(TQualifier qualifier);
-BlockLayoutType GetBlockLayoutType(TLayoutBlockStorage blockStorage);
TString ArrayString(const TType &type);
-template <typename VarT>
class GetVariableTraverser
{
public:
- GetVariableTraverser(std::vector<VarT> *output);
- void traverse(const TType &type, const TString &name);
+ GetVariableTraverser() {}
+
+ template <typename VarT>
+ void traverse(const TType &type, const TString &name, std::vector<VarT> *output);
protected:
// May be overloaded
- virtual void visitVariable(VarT *newVar) {}
+ virtual void visitVariable(ShaderVariable *newVar) {}
private:
- std::stack<std::vector<VarT> *> mOutputStack;
-};
-
-struct GetInterfaceBlockFieldTraverser : public GetVariableTraverser<InterfaceBlockField>
-{
- public:
- GetInterfaceBlockFieldTraverser(std::vector<InterfaceBlockField> *output, bool isRowMajorMatrix);
-
- private:
- virtual void visitVariable(InterfaceBlockField *newField);
-
- bool mIsRowMajorMatrix;
+ DISALLOW_COPY_AND_ASSIGN(GetVariableTraverser);
};
}
diff --git a/src/3rdparty/angle/src/libEGL/Display.cpp b/src/3rdparty/angle/src/libEGL/Display.cpp
index 7cd83c3db4..5a50e4baf5 100644
--- a/src/3rdparty/angle/src/libEGL/Display.cpp
+++ b/src/3rdparty/angle/src/libEGL/Display.cpp
@@ -561,8 +561,10 @@ void Display::initDisplayExtensionString()
extensions.push_back("EGL_NV_post_sub_buffer");
}
+#if defined (ANGLE_TEST_CONFIG)
// TODO: complete support for the EGL_KHR_create_context extension
- //extensions.push_back("EGL_KHR_create_context");
+ extensions.push_back("EGL_KHR_create_context");
+#endif
std::ostringstream stream;
std::copy(extensions.begin(), extensions.end(), std::ostream_iterator<std::string>(stream, " "));
@@ -606,6 +608,7 @@ void Display::initVendorString()
{
char adapterLuidString[64];
snprintf(adapterLuidString, sizeof(adapterLuidString), " (adapter LUID: %08x%08x)", adapterLuid.HighPart, adapterLuid.LowPart);
+
mVendorString += adapterLuidString;
}
}
diff --git a/src/3rdparty/angle/src/libEGL/libEGL.cpp b/src/3rdparty/angle/src/libEGL/libEGL.cpp
index c236d52a4f..c2e0fd6d3d 100644
--- a/src/3rdparty/angle/src/libEGL/libEGL.cpp
+++ b/src/3rdparty/angle/src/libEGL/libEGL.cpp
@@ -6,6 +6,9 @@
// libEGL.cpp: Implements the exported EGL functions.
+#undef EGLAPI
+#define EGLAPI
+
#include <exception>
#include "common/debug.h"
@@ -825,12 +828,19 @@ EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface
egl::Display *display = static_cast<egl::Display*>(dpy);
gl::Context *context = static_cast<gl::Context*>(ctx);
+ bool noContext = (ctx == EGL_NO_CONTEXT);
+ bool noSurface = (draw == EGL_NO_SURFACE || read == EGL_NO_SURFACE);
+ if (noContext != noSurface)
+ {
+ return egl::error(EGL_BAD_MATCH, EGL_FALSE);
+ }
+
if (ctx != EGL_NO_CONTEXT && !validateContext(display, context))
{
return EGL_FALSE;
}
- if (dpy != EGL_NO_DISPLAY)
+ if (dpy != EGL_NO_DISPLAY && display->isInitialized())
{
rx::Renderer *renderer = display->getRenderer();
if (renderer->testDeviceLost(true))
diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp
index 5788af7827..e74737eaba 100644
--- a/src/3rdparty/angle/src/libEGL/main.cpp
+++ b/src/3rdparty/angle/src/libEGL/main.cpp
@@ -105,15 +105,15 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
break;
case DLL_THREAD_DETACH:
{
+#if !defined(ANGLE_PLATFORM_WINRT)
egl::DeallocateCurrent();
+#endif
}
break;
case DLL_PROCESS_DETACH:
{
-#if !defined(ANGLE_PLATFORM_WINRT)
egl::DeallocateCurrent();
DestroyTLSIndex(currentTLS);
-#endif
}
break;
default:
diff --git a/src/3rdparty/angle/src/libEGL/main.h b/src/3rdparty/angle/src/libEGL/main.h
index 6030fb6ad9..07f5b9e675 100644
--- a/src/3rdparty/angle/src/libEGL/main.h
+++ b/src/3rdparty/angle/src/libEGL/main.h
@@ -9,8 +9,6 @@
#ifndef LIBEGL_MAIN_H_
#define LIBEGL_MAIN_H_
-#undef EGLAPI
-#define EGLAPI
#include <EGL/egl.h>
#include <EGL/eglext.h>
diff --git a/src/3rdparty/angle/src/libGLESv2/BinaryStream.h b/src/3rdparty/angle/src/libGLESv2/BinaryStream.h
index 1cbfc6751d..4d7dde04e1 100644
--- a/src/3rdparty/angle/src/libGLESv2/BinaryStream.h
+++ b/src/3rdparty/angle/src/libGLESv2/BinaryStream.h
@@ -12,6 +12,10 @@
#include "common/angleutils.h"
#include "common/mathutil.h"
+#include <cstddef>
+#include <string>
+#include <vector>
+
namespace gl
{
diff --git a/src/3rdparty/angle/src/libGLESv2/Buffer.cpp b/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
index a47b8f402f..3b2a1a912a 100644
--- a/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
@@ -1,4 +1,3 @@
-#include "precompiled.h"
//
// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -31,59 +30,99 @@ Buffer::Buffer(rx::BufferImpl *impl, GLuint id)
Buffer::~Buffer()
{
- delete mBuffer;
+ SafeDelete(mBuffer);
}
-void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
+Error Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
{
+ gl::Error error = mBuffer->setData(data, size, usage);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ mIndexRangeCache.clear();
mUsage = usage;
mSize = size;
- mBuffer->setData(data, size, usage);
+
+ return error;
}
-void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
+Error Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
{
- mBuffer->setSubData(data, size, offset);
+ gl::Error error = mBuffer->setSubData(data, size, offset);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ mIndexRangeCache.invalidateRange(offset, size);
+
+ return error;
}
-void Buffer::copyBufferSubData(Buffer* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size)
+Error Buffer::copyBufferSubData(Buffer* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size)
{
- mBuffer->copySubData(source->getImplementation(), size, sourceOffset, destOffset);
+ gl::Error error = mBuffer->copySubData(source->getImplementation(), sourceOffset, destOffset, size);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ mIndexRangeCache.invalidateRange(destOffset, size);
+
+ return error;
}
-GLvoid *Buffer::mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access)
+Error Buffer::mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access)
{
ASSERT(!mMapped);
ASSERT(offset + length <= mSize);
- void *dataPointer = mBuffer->map(offset, length, access);
+ Error error = mBuffer->map(offset, length, access, &mMapPointer);
+ if (error.isError())
+ {
+ mMapPointer = NULL;
+ return error;
+ }
mMapped = GL_TRUE;
- mMapPointer = static_cast<GLvoid*>(static_cast<GLubyte*>(dataPointer));
mMapOffset = static_cast<GLint64>(offset);
mMapLength = static_cast<GLint64>(length);
mAccessFlags = static_cast<GLint>(access);
- return mMapPointer;
+ if ((access & GL_MAP_WRITE_BIT) > 0)
+ {
+ mIndexRangeCache.invalidateRange(offset, length);
+ }
+
+ return error;
}
-void Buffer::unmap()
+Error Buffer::unmap()
{
ASSERT(mMapped);
- mBuffer->unmap();
+ Error error = mBuffer->unmap();
+ if (error.isError())
+ {
+ return error;
+ }
mMapped = GL_FALSE;
mMapPointer = NULL;
mMapOffset = 0;
mMapLength = 0;
mAccessFlags = 0;
+
+ return error;
}
void Buffer::markTransformFeedbackUsage()
{
// TODO: Only used by the DX11 backend. Refactor to a more appropriate place.
mBuffer->markTransformFeedbackUsage();
+ mIndexRangeCache.clear();
}
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Buffer.h b/src/3rdparty/angle/src/libGLESv2/Buffer.h
index 389c3d4b00..35a6767502 100644
--- a/src/3rdparty/angle/src/libGLESv2/Buffer.h
+++ b/src/3rdparty/angle/src/libGLESv2/Buffer.h
@@ -11,8 +11,11 @@
#ifndef LIBGLESV2_BUFFER_H_
#define LIBGLESV2_BUFFER_H_
+#include "libGLESv2/Error.h"
+
#include "common/angleutils.h"
#include "common/RefCountObject.h"
+#include "libGLESv2/renderer/IndexRangeCache.h"
namespace rx
{
@@ -30,13 +33,13 @@ class Buffer : public RefCountObject
virtual ~Buffer();
- void bufferData(const void *data, GLsizeiptr size, GLenum usage);
- void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
- void copyBufferSubData(Buffer* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size);
- GLvoid *mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access);
- void unmap();
+ Error bufferData(const void *data, GLsizeiptr size, GLenum usage);
+ Error bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
+ Error copyBufferSubData(Buffer* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size);
+ Error mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access);
+ Error unmap();
- GLenum getUsage() const { return mUsage; }
+ GLenum getUsage() const { return mUsage; }
GLint getAccessFlags() const { return mAccessFlags; }
GLboolean isMapped() const { return mMapped; }
GLvoid *getMapPointer() const { return mMapPointer; }
@@ -48,18 +51,23 @@ class Buffer : public RefCountObject
void markTransformFeedbackUsage();
+ rx::IndexRangeCache *getIndexRangeCache() { return &mIndexRangeCache; }
+ const rx::IndexRangeCache *getIndexRangeCache() const { return &mIndexRangeCache; }
+
private:
DISALLOW_COPY_AND_ASSIGN(Buffer);
rx::BufferImpl *mBuffer;
GLenum mUsage;
- GLsizeiptr mSize;
+ GLint64 mSize;
GLint mAccessFlags;
GLboolean mMapped;
GLvoid *mMapPointer;
GLint64 mMapOffset;
GLint64 mMapLength;
+
+ rx::IndexRangeCache mIndexRangeCache;
};
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Caps.cpp b/src/3rdparty/angle/src/libGLESv2/Caps.cpp
index c1c4dc9ee7..983800c0e6 100644
--- a/src/3rdparty/angle/src/libGLESv2/Caps.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Caps.cpp
@@ -24,6 +24,30 @@ TextureCaps::TextureCaps()
{
}
+GLuint TextureCaps::getMaxSamples() const
+{
+ return !sampleCounts.empty() ? *sampleCounts.rbegin() : 0;
+}
+
+GLuint TextureCaps::getNearestSamples(GLuint requestedSamples) const
+{
+ if (requestedSamples == 0)
+ {
+ return 0;
+ }
+
+ for (SupportedSampleSet::const_iterator i = sampleCounts.begin(); i != sampleCounts.end(); i++)
+ {
+ GLuint samples = *i;
+ if (samples >= requestedSamples)
+ {
+ return samples;
+ }
+ }
+
+ return 0;
+}
+
void TextureCapsMap::insert(GLenum internalFormat, const TextureCaps &caps)
{
mCapsMap.insert(std::make_pair(internalFormat, caps));
@@ -158,12 +182,17 @@ std::vector<std::string> Extensions::getStrings() const
}
static bool GetFormatSupport(const TextureCapsMap &textureCaps, const std::vector<GLenum> &requiredFormats,
- bool requiresFiltering, bool requiresRendering)
+ bool requiresTexturing, bool requiresFiltering, bool requiresRendering)
{
for (size_t i = 0; i < requiredFormats.size(); i++)
{
const TextureCaps &cap = textureCaps.get(requiredFormats[i]);
+ if (requiresTexturing && !cap.texturable)
+ {
+ return false;
+ }
+
if (requiresFiltering && !cap.filterable)
{
return false;
@@ -185,7 +214,7 @@ static bool DetermineRGB8AndRGBA8TextureSupport(const TextureCapsMap &textureCap
requiredFormats.push_back(GL_RGB8);
requiredFormats.push_back(GL_RGBA8);
- return GetFormatSupport(textureCaps, requiredFormats, true, true);
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, true);
}
// Checks for GL_EXT_texture_format_BGRA8888 support
@@ -194,7 +223,7 @@ static bool DetermineBGRA8TextureSupport(const TextureCapsMap &textureCaps)
std::vector<GLenum> requiredFormats;
requiredFormats.push_back(GL_BGRA8_EXT);
- return GetFormatSupport(textureCaps, requiredFormats, true, true);
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, true);
}
// Checks for GL_OES_texture_half_float support
@@ -204,7 +233,7 @@ static bool DetermineHalfFloatTextureSupport(const TextureCapsMap &textureCaps)
requiredFormats.push_back(GL_RGB16F);
requiredFormats.push_back(GL_RGBA16F);
- return GetFormatSupport(textureCaps, requiredFormats, false, true);
+ return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
}
// Checks for GL_OES_texture_half_float_linear support
@@ -214,7 +243,7 @@ static bool DetermineHalfFloatTextureFilteringSupport(const TextureCapsMap &text
requiredFormats.push_back(GL_RGB16F);
requiredFormats.push_back(GL_RGBA16F);
- return GetFormatSupport(textureCaps, requiredFormats, true, false);
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Checks for GL_OES_texture_float support
@@ -224,7 +253,7 @@ static bool DetermineFloatTextureSupport(const TextureCapsMap &textureCaps)
requiredFormats.push_back(GL_RGB32F);
requiredFormats.push_back(GL_RGBA32F);
- return GetFormatSupport(textureCaps, requiredFormats, false, true);
+ return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
}
// Checks for GL_OES_texture_float_linear support
@@ -234,7 +263,7 @@ static bool DetermineFloatTextureFilteringSupport(const TextureCapsMap &textureC
requiredFormats.push_back(GL_RGB32F);
requiredFormats.push_back(GL_RGBA32F);
- return GetFormatSupport(textureCaps, requiredFormats, true, false);
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Checks for GL_EXT_texture_rg support
@@ -254,7 +283,7 @@ static bool DetermineRGTextureSupport(const TextureCapsMap &textureCaps, bool ch
requiredFormats.push_back(GL_RG32F);
}
- return GetFormatSupport(textureCaps, requiredFormats, true, false);
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for GL_EXT_texture_compression_dxt1
@@ -264,7 +293,7 @@ static bool DetermineDXT1TextureSupport(const TextureCapsMap &textureCaps)
requiredFormats.push_back(GL_COMPRESSED_RGB_S3TC_DXT1_EXT);
requiredFormats.push_back(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT);
- return GetFormatSupport(textureCaps, requiredFormats, true, false);
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for GL_ANGLE_texture_compression_dxt3
@@ -273,7 +302,7 @@ static bool DetermineDXT3TextureSupport(const TextureCapsMap &textureCaps)
std::vector<GLenum> requiredFormats;
requiredFormats.push_back(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE);
- return GetFormatSupport(textureCaps, requiredFormats, true, false);
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for GL_ANGLE_texture_compression_dxt5
@@ -282,7 +311,7 @@ static bool DetermineDXT5TextureSupport(const TextureCapsMap &textureCaps)
std::vector<GLenum> requiredFormats;
requiredFormats.push_back(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE);
- return GetFormatSupport(textureCaps, requiredFormats, true, false);
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
}
// Check for GL_ANGLE_texture_compression_dxt5
@@ -295,8 +324,8 @@ static bool DetermineSRGBTextureSupport(const TextureCapsMap &textureCaps)
std::vector<GLenum> requiredRenderFormats;
requiredRenderFormats.push_back(GL_SRGB8_ALPHA8);
- return GetFormatSupport(textureCaps, requiredFilterFormats, true, false) &&
- GetFormatSupport(textureCaps, requiredRenderFormats, false, true);
+ return GetFormatSupport(textureCaps, requiredFilterFormats, true, true, false) &&
+ GetFormatSupport(textureCaps, requiredRenderFormats, true, false, true);
}
// Check for GL_ANGLE_depth_texture
@@ -307,7 +336,7 @@ static bool DetermineDepthTextureSupport(const TextureCapsMap &textureCaps)
requiredFormats.push_back(GL_DEPTH_COMPONENT32_OES);
requiredFormats.push_back(GL_DEPTH24_STENCIL8_OES);
- return GetFormatSupport(textureCaps, requiredFormats, true, true);
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, true);
}
// Check for GL_EXT_color_buffer_float
@@ -322,7 +351,7 @@ static bool DetermineColorBufferFloatSupport(const TextureCapsMap &textureCaps)
requiredFormats.push_back(GL_RGBA32F);
requiredFormats.push_back(GL_R11F_G11F_B10F);
- return GetFormatSupport(textureCaps, requiredFormats, false, true);
+ return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
}
void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps)
@@ -356,7 +385,40 @@ Caps::Caps()
maxViewportHeight(0),
minAliasedPointSize(0),
maxAliasedPointSize(0),
- minAliasedLineWidth(0)
+ minAliasedLineWidth(0),
+ // Table 6.29
+ maxElementsIndices(0),
+ maxElementsVertices(0),
+ maxServerWaitTimeout(0),
+ // Table 6.31
+ maxVertexAttributes(0),
+ maxVertexUniformComponents(0),
+ maxVertexUniformVectors(0),
+ maxVertexUniformBlocks(0),
+ maxVertexOutputComponents(0),
+ maxVertexTextureImageUnits(0),
+ // Table 6.32
+ maxFragmentUniformComponents(0),
+ maxFragmentUniformVectors(0),
+ maxFragmentUniformBlocks(0),
+ maxFragmentInputComponents(0),
+ maxTextureImageUnits(0),
+ minProgramTexelOffset(0),
+ maxProgramTexelOffset(0),
+
+ maxUniformBufferBindings(0),
+ maxUniformBlockSize(0),
+ uniformBufferOffsetAlignment(0),
+ maxCombinedUniformBlocks(0),
+ maxCombinedVertexUniformComponents(0),
+ maxCombinedFragmentUniformComponents(0),
+ maxVaryingComponents(0),
+ maxVaryingVectors(0),
+ maxCombinedTextureImageUnits(0),
+
+ maxTransformFeedbackInterleavedComponents(0),
+ maxTransformFeedbackSeparateAttributes(0),
+ maxTransformFeedbackSeparateComponents(0)
{
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Caps.h b/src/3rdparty/angle/src/libGLESv2/Caps.h
index a08618ec9c..a00e554176 100644
--- a/src/3rdparty/angle/src/libGLESv2/Caps.h
+++ b/src/3rdparty/angle/src/libGLESv2/Caps.h
@@ -17,6 +17,8 @@
namespace gl
{
+typedef std::set<GLuint> SupportedSampleSet;
+
struct TextureCaps
{
TextureCaps();
@@ -30,7 +32,14 @@ struct TextureCaps
// Support for being used as a framebuffer attachment or renderbuffer format
bool renderable;
- std::set<GLuint> sampleCounts;
+ SupportedSampleSet sampleCounts;
+
+ // Get the maximum number of samples supported
+ GLuint getMaxSamples() const;
+
+ // Get the number of supported samples that is at least as many as requested. Returns 0 if
+ // there are no sample counts available
+ GLuint getNearestSamples(GLuint requestedSamples) const;
};
class TextureCapsMap
@@ -68,6 +77,7 @@ struct Extensions
// GL_OES_texture_float, GL_OES_texture_float_linear
// GL_EXT_texture_rg
// GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3, GL_ANGLE_texture_compression_dxt5
+ // GL_EXT_sRGB
// GL_ANGLE_depth_texture
// GL_EXT_color_buffer_float
void setTextureExtensionSupport(const TextureCapsMap &textureCaps);
@@ -166,6 +176,7 @@ struct Extensions
// GL_ANGLE_framebuffer_multisample
bool framebufferMultisample;
+ GLuint maxSamples;
// GL_ANGLE_instanced_arrays
bool instancedArrays;
@@ -215,6 +226,46 @@ struct Caps
GLfloat minAliasedLineWidth;
GLfloat maxAliasedLineWidth;
+ // Table 6.29, implementation dependent values (cont.)
+ GLuint maxElementsIndices;
+ GLuint maxElementsVertices;
+ std::vector<GLenum> compressedTextureFormats;
+ std::vector<GLenum> programBinaryFormats;
+ std::vector<GLenum> shaderBinaryFormats;
+ GLuint64 maxServerWaitTimeout;
+
+ // Table 6.31, implementation dependent vertex shader limits
+ GLuint maxVertexAttributes;
+ GLuint maxVertexUniformComponents;
+ GLuint maxVertexUniformVectors;
+ GLuint maxVertexUniformBlocks;
+ GLuint maxVertexOutputComponents;
+ GLuint maxVertexTextureImageUnits;
+
+ // Table 6.32, implementation dependent fragment shader limits
+ GLuint maxFragmentUniformComponents;
+ GLuint maxFragmentUniformVectors;
+ GLuint maxFragmentUniformBlocks;
+ GLuint maxFragmentInputComponents;
+ GLuint maxTextureImageUnits;
+ GLint minProgramTexelOffset;
+ GLint maxProgramTexelOffset;
+
+ // Table 6.33, implementation dependent aggregate shader limits
+ GLuint maxUniformBufferBindings;
+ GLuint64 maxUniformBlockSize;
+ GLuint uniformBufferOffsetAlignment;
+ GLuint maxCombinedUniformBlocks;
+ GLuint64 maxCombinedVertexUniformComponents;
+ GLuint64 maxCombinedFragmentUniformComponents;
+ GLuint maxVaryingComponents;
+ GLuint maxVaryingVectors;
+ GLuint maxCombinedTextureImageUnits;
+
+ // Table 6.34, implementation dependent transform feedback limits
+ GLuint maxTransformFeedbackInterleavedComponents;
+ GLuint maxTransformFeedbackSeparateAttributes;
+ GLuint maxTransformFeedbackSeparateComponents;
};
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Context.cpp b/src/3rdparty/angle/src/libGLESv2/Context.cpp
index 99df85b0d3..5342de1331 100644
--- a/src/3rdparty/angle/src/libGLESv2/Context.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Context.cpp
@@ -1,4 +1,3 @@
-#include "precompiled.h"
//
// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -12,6 +11,7 @@
#include "libGLESv2/main.h"
#include "common/utilities.h"
+#include "common/platform.h"
#include "libGLESv2/formatutils.h"
#include "libGLESv2/Buffer.h"
#include "libGLESv2/Fence.h"
@@ -24,7 +24,6 @@
#include "libGLESv2/Texture.h"
#include "libGLESv2/ResourceManager.h"
#include "libGLESv2/renderer/d3d/IndexDataManager.h"
-#include "libGLESv2/renderer/RenderTarget.h"
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/VertexArray.h"
#include "libGLESv2/Sampler.h"
@@ -33,8 +32,8 @@
#include "libEGL/Surface.h"
-#undef near
-#undef far
+#include <sstream>
+#include <iterator>
namespace gl
{
@@ -45,6 +44,7 @@ Context::Context(int clientVersion, const gl::Context *shareContext, rx::Rendere
ASSERT(robustAccess == false); // Unimplemented
initCaps(clientVersion);
+ mState.initialize(mCaps, clientVersion);
mClientVersion = clientVersion;
@@ -66,16 +66,26 @@ Context::Context(int clientVersion, const gl::Context *shareContext, rx::Rendere
// 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(mRenderer->createTexture2D(), 0));
- mTextureCubeMapZero.set(new TextureCubeMap(mRenderer->createTextureCube(), 0));
- mTexture3DZero.set(new Texture3D(mRenderer->createTexture3D(), 0));
- mTexture2DArrayZero.set(new Texture2DArray(mRenderer->createTexture2DArray(), 0));
+ mZeroTextures[GL_TEXTURE_2D].set(new Texture2D(mRenderer->createTexture(GL_TEXTURE_2D), 0));
+ bindTexture(GL_TEXTURE_2D, 0);
+
+ mZeroTextures[GL_TEXTURE_CUBE_MAP].set(new TextureCubeMap(mRenderer->createTexture(GL_TEXTURE_CUBE_MAP), 0));
+ bindTexture(GL_TEXTURE_CUBE_MAP, 0);
+
+ if (mClientVersion >= 3)
+ {
+ // TODO: These could also be enabled via extension
+ mZeroTextures[GL_TEXTURE_3D].set(new Texture3D(mRenderer->createTexture(GL_TEXTURE_3D), 0));
+ bindTexture(GL_TEXTURE_3D, 0);
+
+ mZeroTextures[GL_TEXTURE_2D_ARRAY].set(new Texture2DArray(mRenderer->createTexture(GL_TEXTURE_2D_ARRAY), 0));
+ bindTexture(GL_TEXTURE_2D_ARRAY, 0);
+ }
bindVertexArray(0);
bindArrayBuffer(0);
bindElementArrayBuffer(0);
- bindTextureCubeMap(0);
- bindTexture2D(0);
+
bindReadFramebuffer(0);
bindDrawFramebuffer(0);
bindRenderbuffer(0);
@@ -101,23 +111,15 @@ Context::Context(int clientVersion, const gl::Context *shareContext, rx::Rendere
// In the initial state, a default transform feedback object is bound and treated as
// a transform feedback object with a name of zero. That object is bound any time
// BindTransformFeedback is called with id of zero
- mTransformFeedbackZero.set(new TransformFeedback(0));
+ mTransformFeedbackZero.set(new TransformFeedback(mRenderer->createTransformFeedback(), 0));
bindTransformFeedback(0);
- mInvalidEnum = false;
- mInvalidValue = false;
- mInvalidOperation = false;
- mOutOfMemory = false;
- mInvalidFramebufferOperation = false;
-
mHasBeenCurrent = false;
mContextLost = false;
mResetStatus = GL_NO_ERROR;
mResetStrategy = (notifyResets ? GL_LOSE_CONTEXT_ON_RESET_EXT : GL_NO_RESET_NOTIFICATION_EXT);
mRobustAccess = robustAccess;
- mNumCompressedTextureFormats = 0;
-
mState.setContext(this);
}
@@ -161,15 +163,17 @@ Context::~Context()
deleteTransformFeedback(mTransformFeedbackMap.begin()->first);
}
- for (int type = 0; type < TEXTURE_TYPE_COUNT; type++)
+ for (TextureMap::iterator i = mIncompleteTextures.begin(); i != mIncompleteTextures.end(); i++)
{
- mIncompleteTextures[type].set(NULL);
+ i->second.set(NULL);
}
+ mIncompleteTextures.clear();
- mTexture2DZero.set(NULL);
- mTextureCubeMapZero.set(NULL);
- mTexture3DZero.set(NULL);
- mTexture2DArrayZero.set(NULL);
+ for (TextureMap::iterator i = mZeroTextures.begin(); i != mZeroTextures.end(); i++)
+ {
+ i->second.set(NULL);
+ }
+ mZeroTextures.clear();
mResourceManager->release();
}
@@ -178,23 +182,6 @@ void Context::makeCurrent(egl::Surface *surface)
{
if (!mHasBeenCurrent)
{
- mMajorShaderModel = mRenderer->getMajorShaderModel();
- mSupportsVertexTexture = mRenderer->getVertexTextureSupport();
-
- mNumCompressedTextureFormats = 0;
- if (mExtensions.textureCompressionDXT1)
- {
- mNumCompressedTextureFormats += 2;
- }
- if (mExtensions.textureCompressionDXT3)
- {
- mNumCompressedTextureFormats += 1;
- }
- if (mExtensions.textureCompressionDXT5)
- {
- mNumCompressedTextureFormats += 1;
- }
-
initRendererString();
initExtensionStrings();
@@ -287,7 +274,7 @@ GLuint Context::createSampler()
GLuint Context::createTransformFeedback()
{
GLuint handle = mTransformFeedbackAllocator.allocate();
- TransformFeedback *transformFeedback = new TransformFeedback(handle);
+ TransformFeedback *transformFeedback = new TransformFeedback(mRenderer->createTransformFeedback(), handle);
transformFeedback->addRef();
mTransformFeedbackMap[handle] = transformFeedback;
return handle;
@@ -528,32 +515,11 @@ void Context::bindElementArrayBuffer(unsigned int buffer)
mState.getVertexArray()->setElementArrayBuffer(getBuffer(buffer));
}
-void Context::bindTexture2D(GLuint texture)
+void Context::bindTexture(GLenum target, GLuint texture)
{
- mResourceManager->checkTextureAllocation(texture, TEXTURE_2D);
+ mResourceManager->checkTextureAllocation(texture, target);
- mState.setSamplerTexture(TEXTURE_2D, getTexture(texture));
-}
-
-void Context::bindTextureCubeMap(GLuint texture)
-{
- mResourceManager->checkTextureAllocation(texture, TEXTURE_CUBE);
-
- mState.setSamplerTexture(TEXTURE_CUBE, getTexture(texture));
-}
-
-void Context::bindTexture3D(GLuint texture)
-{
- mResourceManager->checkTextureAllocation(texture, TEXTURE_3D);
-
- mState.setSamplerTexture(TEXTURE_3D, getTexture(texture));
-}
-
-void Context::bindTexture2DArray(GLuint texture)
-{
- mResourceManager->checkTextureAllocation(texture, TEXTURE_2D_ARRAY);
-
- mState.setSamplerTexture(TEXTURE_2D_ARRAY, getTexture(texture));
+ mState.setSamplerTexture(target, getTexture(texture));
}
void Context::bindReadFramebuffer(GLuint framebuffer)
@@ -596,7 +562,7 @@ void Context::bindVertexArray(GLuint vertexArray)
void Context::bindSampler(GLuint textureUnit, GLuint sampler)
{
- ASSERT(textureUnit < IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS); // TODO: Update for backend-determined array size
+ ASSERT(textureUnit < mCaps.maxCombinedTextureImageUnits);
mResourceManager->checkSamplerAllocation(sampler);
mState.setSamplerBinding(textureUnit, getSampler(sampler));
@@ -678,7 +644,7 @@ void Context::linkProgram(GLuint program)
{
Program *programObject = mResourceManager->getProgram(program);
- bool linked = programObject->link();
+ bool linked = programObject->link(getCaps());
// if the current program was relinked successfully we
// need to install the new executables
@@ -688,11 +654,11 @@ void Context::linkProgram(GLuint program)
}
}
-void Context::setProgramBinary(GLuint program, const void *binary, GLint length)
+void Context::setProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLint length)
{
Program *programObject = mResourceManager->getProgram(program);
- bool loaded = programObject->setProgramBinary(binary, length);
+ bool loaded = programObject->setProgramBinary(binaryFormat, binary, length);
// if the current program was reloaded successfully we
// need to install the new executables
@@ -708,26 +674,35 @@ void Context::bindTransformFeedback(GLuint transformFeedback)
mState.setTransformFeedbackBinding(getTransformFeedback(transformFeedback));
}
-void Context::beginQuery(GLenum target, GLuint query)
+Error Context::beginQuery(GLenum target, GLuint query)
{
Query *queryObject = getQuery(query, true, target);
ASSERT(queryObject);
- // set query as active for specified target
+ // begin query
+ Error error = queryObject->begin();
+ if (error.isError())
+ {
+ return error;
+ }
+
+ // set query as active for specified target only if begin succeeded
mState.setActiveQuery(target, queryObject);
- // begin query
- queryObject->begin();
+ return Error(GL_NO_ERROR);
}
-void Context::endQuery(GLenum target)
+Error Context::endQuery(GLenum target)
{
Query *queryObject = mState.getActiveQuery(target);
ASSERT(queryObject);
- queryObject->end();
+ gl::Error error = queryObject->end();
+ // Always unbind the query, even if there was an error. This may delete the query object.
mState.setActiveQuery(target, NULL);
+
+ return error;
}
void Context::setFramebufferZero(Framebuffer *buffer)
@@ -755,15 +730,16 @@ void Context::setRenderbufferStorage(GLsizei width, GLsizei height, GLenum inter
RenderbufferStorage *renderbuffer = NULL;
- if (GetDepthBits(internalformat) > 0 && GetStencilBits(internalformat) > 0)
+ const InternalFormat &formatInfo = GetInternalFormatInfo(internalformat);
+ if (formatInfo.depthBits > 0 && formatInfo.stencilBits > 0)
{
renderbuffer = new gl::DepthStencilbuffer(mRenderer, width, height, samples);
}
- else if (GetDepthBits(internalformat) > 0)
+ else if (formatInfo.depthBits > 0)
{
renderbuffer = new gl::Depthbuffer(mRenderer, width, height, samples);
}
- else if (GetStencilBits(internalformat) > 0)
+ else if (formatInfo.stencilBits > 0)
{
renderbuffer = new gl::Stencilbuffer(mRenderer, width, height, samples);
}
@@ -815,7 +791,7 @@ Query *Context::getQuery(unsigned int handle, bool create, GLenum type)
{
if (!query->second && create)
{
- query->second = new Query(mRenderer, type, handle);
+ query->second = new Query(mRenderer->createQuery(type), handle);
query->second->addRef();
}
return query->second;
@@ -841,36 +817,29 @@ Texture *Context::getTargetTexture(GLenum target) const
Texture2D *Context::getTexture2D() const
{
- return static_cast<Texture2D*>(getSamplerTexture(mState.getActiveSampler(), TEXTURE_2D));
+ return static_cast<Texture2D*>(getSamplerTexture(mState.getActiveSampler(), GL_TEXTURE_2D));
}
TextureCubeMap *Context::getTextureCubeMap() const
{
- return static_cast<TextureCubeMap*>(getSamplerTexture(mState.getActiveSampler(), TEXTURE_CUBE));
+ return static_cast<TextureCubeMap*>(getSamplerTexture(mState.getActiveSampler(), GL_TEXTURE_CUBE_MAP));
}
Texture3D *Context::getTexture3D() const
{
- return static_cast<Texture3D*>(getSamplerTexture(mState.getActiveSampler(), TEXTURE_3D));
+ return static_cast<Texture3D*>(getSamplerTexture(mState.getActiveSampler(), GL_TEXTURE_3D));
}
Texture2DArray *Context::getTexture2DArray() const
{
- return static_cast<Texture2DArray*>(getSamplerTexture(mState.getActiveSampler(), TEXTURE_2D_ARRAY));
+ return static_cast<Texture2DArray*>(getSamplerTexture(mState.getActiveSampler(), GL_TEXTURE_2D_ARRAY));
}
-Texture *Context::getSamplerTexture(unsigned int sampler, TextureType type) const
+Texture *Context::getSamplerTexture(unsigned int sampler, GLenum type) const
{
if (mState.getSamplerTextureId(sampler, type) == 0)
{
- switch (type)
- {
- default: UNREACHABLE();
- case TEXTURE_2D: return mTexture2DZero.get();
- case TEXTURE_CUBE: return mTextureCubeMapZero.get();
- case TEXTURE_3D: return mTexture3DZero.get();
- case TEXTURE_2D_ARRAY: return mTexture2DArrayZero.get();
- }
+ return mZeroTextures.at(type).get();
}
else
{
@@ -921,45 +890,39 @@ void Context::getIntegerv(GLenum pname, GLint *params)
switch (pname)
{
- case GL_MAX_VERTEX_ATTRIBS: *params = gl::MAX_VERTEX_ATTRIBS; break;
- case GL_MAX_VERTEX_UNIFORM_VECTORS: *params = mRenderer->getMaxVertexUniformVectors(); break;
- case GL_MAX_VERTEX_UNIFORM_COMPONENTS: *params = mRenderer->getMaxVertexUniformVectors() * 4; break;
- case GL_MAX_VARYING_VECTORS: *params = mRenderer->getMaxVaryingVectors(); break;
- case GL_MAX_VARYING_COMPONENTS: *params = mRenderer->getMaxVaryingVectors() * 4; break;
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: *params = mRenderer->getMaxCombinedTextureImageUnits(); break;
- case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: *params = mRenderer->getMaxVertexTextureImageUnits(); break;
- case GL_MAX_TEXTURE_IMAGE_UNITS: *params = gl::MAX_TEXTURE_IMAGE_UNITS; break;
- case GL_MAX_FRAGMENT_UNIFORM_VECTORS: *params = mRenderer->getMaxFragmentUniformVectors(); break;
- case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: *params = mRenderer->getMaxFragmentUniformVectors() * 4; break;
+ case GL_MAX_VERTEX_ATTRIBS: *params = mCaps.maxVertexAttributes; break;
+ case GL_MAX_VERTEX_UNIFORM_VECTORS: *params = mCaps.maxVertexUniformVectors; break;
+ case GL_MAX_VERTEX_UNIFORM_COMPONENTS: *params = mCaps.maxVertexUniformComponents; break;
+ case GL_MAX_VARYING_VECTORS: *params = mCaps.maxVaryingVectors; break;
+ case GL_MAX_VARYING_COMPONENTS: *params = mCaps.maxVertexOutputComponents; break;
+ case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: *params = mCaps.maxCombinedTextureImageUnits; break;
+ case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: *params = mCaps.maxVertexTextureImageUnits; break;
+ case GL_MAX_TEXTURE_IMAGE_UNITS: *params = mCaps.maxTextureImageUnits; break;
+ case GL_MAX_FRAGMENT_UNIFORM_VECTORS: *params = mCaps.maxFragmentUniformVectors; break;
+ case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: *params = mCaps.maxFragmentInputComponents; break;
case GL_MAX_RENDERBUFFER_SIZE: *params = mCaps.maxRenderbufferSize; break;
case GL_MAX_COLOR_ATTACHMENTS_EXT: *params = mCaps.maxColorAttachments; break;
case GL_MAX_DRAW_BUFFERS_EXT: *params = mCaps.maxDrawBuffers; break;
- case GL_NUM_SHADER_BINARY_FORMATS: *params = 0; break;
- case GL_SHADER_BINARY_FORMATS: /* no shader binary formats are supported */ break;
//case GL_FRAMEBUFFER_BINDING: // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
case GL_SUBPIXEL_BITS: *params = 4; break;
case GL_MAX_TEXTURE_SIZE: *params = mCaps.max2DTextureSize; break;
case GL_MAX_CUBE_MAP_TEXTURE_SIZE: *params = mCaps.maxCubeMapTextureSize; break;
case GL_MAX_3D_TEXTURE_SIZE: *params = mCaps.max3DTextureSize; break;
case GL_MAX_ARRAY_TEXTURE_LAYERS: *params = mCaps.maxArrayTextureLayers; break;
- case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT: *params = getUniformBufferOffsetAlignment(); break;
- case GL_MAX_UNIFORM_BUFFER_BINDINGS: *params = getMaximumCombinedUniformBufferBindings(); break;
- case GL_MAX_VERTEX_UNIFORM_BLOCKS: *params = mRenderer->getMaxVertexShaderUniformBuffers(); break;
- case GL_MAX_FRAGMENT_UNIFORM_BLOCKS: *params = mRenderer->getMaxFragmentShaderUniformBuffers(); break;
- case GL_MAX_COMBINED_UNIFORM_BLOCKS: *params = getMaximumCombinedUniformBufferBindings(); break;
+ case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT: *params = mCaps.uniformBufferOffsetAlignment; break;
+ case GL_MAX_UNIFORM_BUFFER_BINDINGS: *params = mCaps.maxUniformBufferBindings; break;
+ case GL_MAX_VERTEX_UNIFORM_BLOCKS: *params = mCaps.maxVertexUniformBlocks; break;
+ case GL_MAX_FRAGMENT_UNIFORM_BLOCKS: *params = mCaps.maxFragmentUniformBlocks; break;
+ case GL_MAX_COMBINED_UNIFORM_BLOCKS: *params = mCaps.maxCombinedTextureImageUnits; break;
case GL_MAJOR_VERSION: *params = mClientVersion; break;
case GL_MINOR_VERSION: *params = 0; break;
- case GL_MAX_ELEMENTS_INDICES: *params = mRenderer->getMaxRecommendedElementsIndices(); break;
- case GL_MAX_ELEMENTS_VERTICES: *params = mRenderer->getMaxRecommendedElementsVertices(); break;
- case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: *params = mRenderer->getMaxTransformFeedbackInterleavedComponents(); break;
- case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: *params = mRenderer->getMaxTransformFeedbackBuffers(); break;
- case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: *params = mRenderer->getMaxTransformFeedbackSeparateComponents(); break;
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- params[0] = mNumCompressedTextureFormats;
- break;
- case GL_MAX_SAMPLES_ANGLE:
- *params = static_cast<GLint>(getMaxSupportedSamples());
- break;
+ case GL_MAX_ELEMENTS_INDICES: *params = mCaps.maxElementsIndices; break;
+ case GL_MAX_ELEMENTS_VERTICES: *params = mCaps.maxElementsVertices; break;
+ case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: *params = mCaps.maxTransformFeedbackInterleavedComponents; break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: *params = mCaps.maxTransformFeedbackSeparateAttributes; break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: *params = mCaps.maxTransformFeedbackSeparateComponents; break;
+ case GL_NUM_COMPRESSED_TEXTURE_FORMATS: *params = mCaps.compressedTextureFormats.size(); break;
+ case GL_MAX_SAMPLES_ANGLE: *params = mExtensions.maxSamples; break;
case GL_IMPLEMENTATION_COLOR_READ_TYPE:
case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
{
@@ -978,30 +941,22 @@ void Context::getIntegerv(GLenum pname, GLint *params)
}
break;
case GL_COMPRESSED_TEXTURE_FORMATS:
- {
- if (mExtensions.textureCompressionDXT1)
- {
- *params++ = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
- *params++ = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- }
- if (mExtensions.textureCompressionDXT3)
- {
- *params++ = GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE;
- }
- if (mExtensions.textureCompressionDXT5)
- {
- *params++ = GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE;
- }
- }
+ std::copy(mCaps.compressedTextureFormats.begin(), mCaps.compressedTextureFormats.end(), params);
break;
case GL_RESET_NOTIFICATION_STRATEGY_EXT:
*params = mResetStrategy;
break;
- case GL_NUM_PROGRAM_BINARY_FORMATS_OES:
- *params = 1;
+ case GL_NUM_SHADER_BINARY_FORMATS:
+ *params = mCaps.shaderBinaryFormats.size();
break;
- case GL_PROGRAM_BINARY_FORMATS_OES:
- *params = GL_PROGRAM_BINARY_ANGLE;
+ case GL_SHADER_BINARY_FORMATS:
+ std::copy(mCaps.shaderBinaryFormats.begin(), mCaps.shaderBinaryFormats.end(), params);
+ break;
+ case GL_NUM_PROGRAM_BINARY_FORMATS:
+ *params = mCaps.programBinaryFormats.size();
+ break;
+ case GL_PROGRAM_BINARY_FORMATS:
+ std::copy(mCaps.programBinaryFormats.begin(), mCaps.programBinaryFormats.end(), params);
break;
case GL_NUM_EXTENSIONS:
*params = static_cast<GLint>(mExtensionStrings.size());
@@ -1022,25 +977,16 @@ void Context::getInteger64v(GLenum pname, GLint64 *params)
*params = mCaps.maxElementIndex;
break;
case GL_MAX_UNIFORM_BLOCK_SIZE:
- *params = static_cast<GLint64>(mRenderer->getMaxUniformBufferSize());
+ *params = mCaps.maxUniformBlockSize;
break;
case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
- {
- GLint64 uniformBufferComponents = static_cast<GLint64>(mRenderer->getMaxVertexShaderUniformBuffers()) * static_cast<GLint64>(mRenderer->getMaxUniformBufferSize() / 4);
- GLint64 defaultBufferComponents = static_cast<GLint64>(mRenderer->getMaxVertexUniformVectors() * 4);
- *params = uniformBufferComponents + defaultBufferComponents;
- }
+ *params = mCaps.maxCombinedVertexUniformComponents;
break;
case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
- {
- GLint64 uniformBufferComponents = static_cast<GLint64>(mRenderer->getMaxFragmentShaderUniformBuffers()) * static_cast<GLint64>(mRenderer->getMaxUniformBufferSize() / 4);
- GLint64 defaultBufferComponents = static_cast<GLint64>(mRenderer->getMaxVertexUniformVectors() * 4);
- *params = uniformBufferComponents + defaultBufferComponents;
- }
+ *params = mCaps.maxCombinedFragmentUniformComponents;
break;
case GL_MAX_SERVER_WAIT_TIMEOUT:
- // We do not wait for server fence objects internally, so report a max timeout of zero.
- *params = 0;
+ *params = mCaps.maxServerWaitTimeout;
break;
default:
UNREACHABLE();
@@ -1087,13 +1033,19 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
case GL_COMPRESSED_TEXTURE_FORMATS:
{
*type = GL_INT;
- *numParams = mNumCompressedTextureFormats;
+ *numParams = mCaps.compressedTextureFormats.size();
+ }
+ return true;
+ case GL_PROGRAM_BINARY_FORMATS_OES:
+ {
+ *type = GL_INT;
+ *numParams = mCaps.programBinaryFormats.size();
}
return true;
case GL_SHADER_BINARY_FORMATS:
{
*type = GL_INT;
- *numParams = 0;
+ *numParams = mCaps.shaderBinaryFormats.size();
}
return true;
case GL_MAX_VERTEX_ATTRIBS:
@@ -1162,7 +1114,6 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
case GL_TEXTURE_BINDING_CUBE_MAP:
case GL_RESET_NOTIFICATION_STRATEGY_EXT:
case GL_NUM_PROGRAM_BINARY_FORMATS_OES:
- case GL_PROGRAM_BINARY_FORMATS_OES:
{
*type = GL_INT;
*numParams = 1;
@@ -1360,28 +1311,29 @@ bool Context::getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned
// Applies the render target surface, depth stencil surface, viewport rectangle and
// scissor rectangle to the renderer
-bool Context::applyRenderTarget(GLenum drawMode, bool ignoreViewport)
+Error Context::applyRenderTarget(GLenum drawMode, bool ignoreViewport)
{
Framebuffer *framebufferObject = mState.getDrawFramebuffer();
ASSERT(framebufferObject && framebufferObject->completeness() == GL_FRAMEBUFFER_COMPLETE);
- mRenderer->applyRenderTarget(framebufferObject);
+ gl::Error error = mRenderer->applyRenderTarget(framebufferObject);
+ if (error.isError())
+ {
+ return error;
+ }
float nearZ, farZ;
mState.getDepthRange(&nearZ, &farZ);
- if (!mRenderer->setViewport(mState.getViewport(), nearZ, farZ, drawMode, mState.getRasterizerState().frontFace,
- ignoreViewport))
- {
- return false;
- }
+ mRenderer->setViewport(mState.getViewport(), nearZ, farZ, drawMode, mState.getRasterizerState().frontFace,
+ ignoreViewport);
mRenderer->setScissorRectangle(mState.getScissor(), mState.isScissorTestEnabled());
- return true;
+ return gl::Error(GL_NO_ERROR);
}
// Applies the fixed-function state (culling, depth test, alpha blending, stenciling, etc) to the Direct3D 9 device
-void Context::applyState(GLenum drawMode)
+Error Context::applyState(GLenum drawMode)
{
Framebuffer *framebufferObject = mState.getDrawFramebuffer();
int samples = framebufferObject->getSamples();
@@ -1390,7 +1342,11 @@ void Context::applyState(GLenum drawMode)
rasterizer.pointDrawMode = (drawMode == GL_POINTS);
rasterizer.multiSample = (samples != 0);
- mRenderer->setRasterizerState(rasterizer);
+ Error error = mRenderer->setRasterizerState(rasterizer);
+ if (error.isError())
+ {
+ return error;
+ }
unsigned int mask = 0;
if (mState.isSampleCoverageEnabled())
@@ -1400,7 +1356,6 @@ void Context::applyState(GLenum drawMode)
mState.getSampleCoverageParams(&coverageValue, &coverageInvert);
if (coverageValue != 0)
{
-
float threshold = 0.5f;
for (int i = 0; i < samples; ++i)
@@ -1424,117 +1379,185 @@ void Context::applyState(GLenum drawMode)
{
mask = 0xFFFFFFFF;
}
- mRenderer->setBlendState(framebufferObject, mState.getBlendState(), mState.getBlendColor(), mask);
+ error = mRenderer->setBlendState(framebufferObject, mState.getBlendState(), mState.getBlendColor(), mask);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = mRenderer->setDepthStencilState(mState.getDepthStencilState(), mState.getStencilRef(), mState.getStencilBackRef(),
+ rasterizer.frontFace == GL_CCW);
+ if (error.isError())
+ {
+ return error;
+ }
- mRenderer->setDepthStencilState(mState.getDepthStencilState(), mState.getStencilRef(), mState.getStencilBackRef(),
- rasterizer.frontFace == GL_CCW);
+ return Error(GL_NO_ERROR);
}
// Applies the shaders and shader constants to the Direct3D 9 device
-void Context::applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive)
+Error Context::applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive)
{
const VertexAttribute *vertexAttributes = mState.getVertexArray()->getVertexAttributes();
- VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS];
+ VertexFormat inputLayout[MAX_VERTEX_ATTRIBS];
VertexFormat::GetInputLayout(inputLayout, programBinary, vertexAttributes, mState.getVertexAttribCurrentValues());
const Framebuffer *fbo = mState.getDrawFramebuffer();
- mRenderer->applyShaders(programBinary, inputLayout, fbo, mState.getRasterizerState().rasterizerDiscard, transformFeedbackActive);
+ Error error = mRenderer->applyShaders(programBinary, inputLayout, fbo, mState.getRasterizerState().rasterizerDiscard, transformFeedbackActive);
+ if (error.isError())
+ {
+ return error;
+ }
- programBinary->applyUniforms();
+ return programBinary->applyUniforms();
}
-size_t Context::getCurrentTexturesAndSamplerStates(ProgramBinary *programBinary, SamplerType type, Texture **outTextures,
- TextureType *outTextureTypes, SamplerState *outSamplers)
+Error Context::generateSwizzles(ProgramBinary *programBinary, SamplerType type)
{
size_t samplerRange = programBinary->getUsedSamplerRange(type);
+
for (size_t i = 0; i < samplerRange; i++)
{
- outTextureTypes[i] = programBinary->getSamplerTextureType(type, i);
- GLint textureUnit = programBinary->getSamplerMapping(type, i); // OpenGL texture image unit index
+ GLenum textureType = programBinary->getSamplerTextureType(type, i);
+ GLint textureUnit = programBinary->getSamplerMapping(type, i, getCaps());
if (textureUnit != -1)
{
- outTextures[i] = getSamplerTexture(textureUnit, outTextureTypes[i]);
- outTextures[i]->getSamplerStateWithNativeOffset(&outSamplers[i]);
- Sampler *samplerObject = mState.getSampler(textureUnit);
- if (samplerObject)
+ Texture* texture = getSamplerTexture(textureUnit, textureType);
+ if (texture->getSamplerState().swizzleRequired())
{
- samplerObject->getState(&outSamplers[i]);
+ Error error = mRenderer->generateSwizzle(texture);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
- else
- {
- outTextures[i] = NULL;
- }
}
- return samplerRange;
+ return Error(GL_NO_ERROR);
}
-void Context::generateSwizzles(Texture *textures[], size_t count)
+Error Context::generateSwizzles(ProgramBinary *programBinary)
{
- for (size_t i = 0; i < count; i++)
+ Error error = generateSwizzles(programBinary, SAMPLER_VERTEX);
+ if (error.isError())
{
- if (textures[i] && textures[i]->getSamplerState().swizzleRequired())
- {
- mRenderer->generateSwizzle(textures[i]);
- }
+ return error;
}
+
+ error = generateSwizzles(programBinary, SAMPLER_PIXEL);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ return Error(GL_NO_ERROR);
}
// For each Direct3D sampler of either the pixel or vertex stage,
// looks up the corresponding OpenGL texture image unit and texture type,
// and sets the texture and its addressing/filtering state (or NULL when inactive).
-void Context::applyTextures(SamplerType shaderType, Texture *textures[], TextureType *textureTypes, SamplerState *samplers,
- size_t textureCount, const FramebufferTextureSerialArray& framebufferSerials,
- size_t framebufferSerialCount)
+Error Context::applyTextures(ProgramBinary *programBinary, SamplerType shaderType,
+ const FramebufferTextureSerialArray &framebufferSerials, size_t framebufferSerialCount)
{
- // Range of Direct3D samplers of given sampler type
- size_t samplerCount = (shaderType == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS
- : mRenderer->getMaxVertexTextureImageUnits();
-
- for (size_t samplerIndex = 0; samplerIndex < textureCount; samplerIndex++)
+ size_t samplerRange = programBinary->getUsedSamplerRange(shaderType);
+ for (size_t samplerIndex = 0; samplerIndex < samplerRange; samplerIndex++)
{
- Texture *texture = textures[samplerIndex];
- const SamplerState &sampler = samplers[samplerIndex];
- TextureType textureType = textureTypes[samplerIndex];
-
- if (texture)
+ GLenum textureType = programBinary->getSamplerTextureType(shaderType, samplerIndex);
+ GLint textureUnit = programBinary->getSamplerMapping(shaderType, samplerIndex, getCaps());
+ if (textureUnit != -1)
{
+ SamplerState sampler;
+ Texture* texture = getSamplerTexture(textureUnit, textureType);
+ texture->getSamplerStateWithNativeOffset(&sampler);
+
+ Sampler *samplerObject = mState.getSampler(textureUnit);
+ if (samplerObject)
+ {
+ samplerObject->getState(&sampler);
+ }
+
// TODO: std::binary_search may become unavailable using older versions of GCC
- if (texture->isSamplerComplete(sampler) &&
+ if (texture->isSamplerComplete(sampler, mTextureCaps, mExtensions, mClientVersion) &&
!std::binary_search(framebufferSerials.begin(), framebufferSerials.begin() + framebufferSerialCount, texture->getTextureSerial()))
{
- mRenderer->setSamplerState(shaderType, samplerIndex, sampler);
- mRenderer->setTexture(shaderType, samplerIndex, texture);
- texture->resetDirty();
+ Error error = mRenderer->setSamplerState(shaderType, samplerIndex, sampler);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = mRenderer->setTexture(shaderType, samplerIndex, texture);
+ if (error.isError())
+ {
+ return error;
+ }
}
else
{
+ // Texture is not sampler complete or it is in use by the framebuffer. Bind the incomplete texture.
Texture *incompleteTexture = getIncompleteTexture(textureType);
- mRenderer->setTexture(shaderType, samplerIndex, incompleteTexture);
- incompleteTexture->resetDirty();
+ gl::Error error = mRenderer->setTexture(shaderType, samplerIndex, incompleteTexture);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
else
{
- mRenderer->setTexture(shaderType, samplerIndex, NULL);
+ // No texture bound to this slot even though it is used by the shader, bind a NULL texture
+ Error error = mRenderer->setTexture(shaderType, samplerIndex, NULL);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
- for (size_t samplerIndex = textureCount; samplerIndex < samplerCount; samplerIndex++)
+ // Set all the remaining textures to NULL
+ size_t samplerCount = (shaderType == SAMPLER_PIXEL) ? mCaps.maxTextureImageUnits
+ : mCaps.maxVertexTextureImageUnits;
+ for (size_t samplerIndex = samplerRange; samplerIndex < samplerCount; samplerIndex++)
{
- mRenderer->setTexture(shaderType, samplerIndex, NULL);
+ Error error = mRenderer->setTexture(shaderType, samplerIndex, NULL);
+ if (error.isError())
+ {
+ return error;
+ }
}
+
+ return Error(GL_NO_ERROR);
}
-bool Context::applyUniformBuffers()
+Error Context::applyTextures(ProgramBinary *programBinary)
+{
+ FramebufferTextureSerialArray framebufferSerials;
+ size_t framebufferSerialCount = getBoundFramebufferTextureSerials(&framebufferSerials);
+
+ Error error = applyTextures(programBinary, SAMPLER_VERTEX, framebufferSerials, framebufferSerialCount);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = applyTextures(programBinary, SAMPLER_PIXEL, framebufferSerials, framebufferSerialCount);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ return Error(GL_NO_ERROR);
+}
+
+Error Context::applyUniformBuffers()
{
Program *programObject = getProgram(mState.getCurrentProgramId());
ProgramBinary *programBinary = programObject->getProgramBinary();
- std::vector<gl::Buffer*> boundBuffers;
+ std::vector<Buffer*> boundBuffers;
for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < programBinary->getActiveUniformBlockCount(); uniformBlockIndex++)
{
@@ -1543,7 +1566,7 @@ bool Context::applyUniformBuffers()
if (mState.getIndexedUniformBuffer(blockBinding)->id() == 0)
{
// undefined behaviour
- return false;
+ return gl::Error(GL_INVALID_OPERATION, "It is undefined behaviour to have a used but unbound uniform buffer.");
}
else
{
@@ -1553,7 +1576,7 @@ bool Context::applyUniformBuffers()
}
}
- return programBinary->applyUniformBuffers(boundBuffers);
+ return programBinary->applyUniformBuffers(boundBuffers, getCaps());
}
bool Context::applyTransformFeedbackBuffers()
@@ -1589,28 +1612,25 @@ void Context::markTransformFeedbackUsage()
}
}
-void Context::clear(GLbitfield mask)
+Error Context::clear(GLbitfield mask)
{
if (mState.isRasterizerDiscardEnabled())
{
- return;
+ return Error(GL_NO_ERROR);
}
ClearParameters clearParams = mState.getClearParameters(mask);
- if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
- {
- return;
- }
+ applyRenderTarget(GL_TRIANGLES, true); // Clips the clear to the scissor rectangle but not the viewport
- mRenderer->clear(clearParams, mState.getDrawFramebuffer());
+ return mRenderer->clear(clearParams, mState.getDrawFramebuffer());
}
-void Context::clearBufferfv(GLenum buffer, int drawbuffer, const float *values)
+Error Context::clearBufferfv(GLenum buffer, int drawbuffer, const float *values)
{
if (mState.isRasterizerDiscardEnabled())
{
- return;
+ return Error(GL_NO_ERROR);
}
// glClearBufferfv can be called to clear the color buffer or depth buffer
@@ -1632,19 +1652,16 @@ void Context::clearBufferfv(GLenum buffer, int drawbuffer, const float *values)
clearParams.depthClearValue = values[0];
}
- if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
- {
- return;
- }
+ applyRenderTarget(GL_TRIANGLES, true); // Clips the clear to the scissor rectangle but not the viewport
- mRenderer->clear(clearParams, mState.getDrawFramebuffer());
+ return mRenderer->clear(clearParams, mState.getDrawFramebuffer());
}
-void Context::clearBufferuiv(GLenum buffer, int drawbuffer, const unsigned int *values)
+Error Context::clearBufferuiv(GLenum buffer, int drawbuffer, const unsigned int *values)
{
if (mState.isRasterizerDiscardEnabled())
{
- return;
+ return Error(GL_NO_ERROR);
}
// glClearBufferuv can only be called to clear a color buffer
@@ -1656,19 +1673,16 @@ void Context::clearBufferuiv(GLenum buffer, int drawbuffer, const unsigned int *
clearParams.colorUIClearValue = ColorUI(values[0], values[1], values[2], values[3]);
clearParams.colorClearType = GL_UNSIGNED_INT;
- if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
- {
- return;
- }
+ applyRenderTarget(GL_TRIANGLES, true); // Clips the clear to the scissor rectangle but not the viewport
- mRenderer->clear(clearParams, mState.getDrawFramebuffer());
+ return mRenderer->clear(clearParams, mState.getDrawFramebuffer());
}
-void Context::clearBufferiv(GLenum buffer, int drawbuffer, const int *values)
+Error Context::clearBufferiv(GLenum buffer, int drawbuffer, const int *values)
{
if (mState.isRasterizerDiscardEnabled())
{
- return;
+ return Error(GL_NO_ERROR);
}
// glClearBufferfv can be called to clear the color buffer or stencil buffer
@@ -1690,19 +1704,16 @@ void Context::clearBufferiv(GLenum buffer, int drawbuffer, const int *values)
clearParams.stencilClearValue = values[1];
}
- if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
- {
- return;
- }
+ applyRenderTarget(GL_TRIANGLES, true); // Clips the clear to the scissor rectangle but not the viewport
- mRenderer->clear(clearParams, mState.getDrawFramebuffer());
+ return mRenderer->clear(clearParams, mState.getDrawFramebuffer());
}
-void Context::clearBufferfi(GLenum buffer, int drawbuffer, float depth, int stencil)
+Error Context::clearBufferfi(GLenum buffer, int drawbuffer, float depth, int stencil)
{
if (mState.isRasterizerDiscardEnabled())
{
- return;
+ return Error(GL_NO_ERROR);
}
// glClearBufferfi can only be called to clear a depth stencil buffer
@@ -1712,135 +1723,145 @@ void Context::clearBufferfi(GLenum buffer, int drawbuffer, float depth, int sten
clearParams.clearStencil = true;
clearParams.stencilClearValue = stencil;
- if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
- {
- return;
- }
+ applyRenderTarget(GL_TRIANGLES, true); // Clips the clear to the scissor rectangle but not the viewport
- mRenderer->clear(clearParams, mState.getDrawFramebuffer());
+ return mRenderer->clear(clearParams, mState.getDrawFramebuffer());
}
-void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLsizei *bufSize, void* pixels)
+Error Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLsizei *bufSize, void* pixels)
{
- gl::Framebuffer *framebuffer = mState.getReadFramebuffer();
+ Framebuffer *framebuffer = mState.getReadFramebuffer();
- bool isSized = IsSizedInternalFormat(format);
- GLenum sizedInternalFormat = (isSized ? format : GetSizedInternalFormat(format, type));
- GLuint outputPitch = GetRowPitch(sizedInternalFormat, type, width, mState.getPackAlignment());
+ GLenum sizedInternalFormat = GetSizedInternalFormat(format, type);
+ const InternalFormat &sizedFormatInfo = GetInternalFormatInfo(sizedInternalFormat);
+ GLuint outputPitch = sizedFormatInfo.computeRowPitch(type, width, mState.getPackAlignment());
- mRenderer->readPixels(framebuffer, x, y, width, height, format, type, outputPitch, mState.getPackState(), pixels);
+ return mRenderer->readPixels(framebuffer, x, y, width, height, format, type, outputPitch, mState.getPackState(),
+ reinterpret_cast<uint8_t*>(pixels));
}
-void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances)
+Error Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances)
{
ASSERT(mState.getCurrentProgramId() != 0);
ProgramBinary *programBinary = mState.getCurrentProgramBinary();
programBinary->updateSamplerMapping();
- Texture *vsTextures[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
- TextureType vsTextureTypes[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
- SamplerState vsSamplers[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
- size_t vsTextureCount = getCurrentTexturesAndSamplerStates(programBinary, SAMPLER_VERTEX, vsTextures, vsTextureTypes, vsSamplers);
-
- Texture *psTextures[MAX_TEXTURE_IMAGE_UNITS];
- TextureType psTextureTypes[MAX_TEXTURE_IMAGE_UNITS];
- SamplerState psSamplers[MAX_TEXTURE_IMAGE_UNITS];
- size_t psTextureCount = getCurrentTexturesAndSamplerStates(programBinary, SAMPLER_PIXEL, psTextures, psTextureTypes, psSamplers);
-
- generateSwizzles(vsTextures, vsTextureCount);
- generateSwizzles(psTextures, psTextureCount);
+ Error error = generateSwizzles(programBinary);
+ if (error.isError())
+ {
+ return error;
+ }
if (!mRenderer->applyPrimitiveType(mode, count))
{
- return;
+ return Error(GL_NO_ERROR);
}
- if (!applyRenderTarget(mode, false))
+ error = applyRenderTarget(mode, false);
+ if (error.isError())
{
- return;
+ return error;
}
- applyState(mode);
+ error = applyState(mode);
+ if (error.isError())
+ {
+ return error;
+ }
- GLenum err = mRenderer->applyVertexBuffer(programBinary, mState.getVertexArray()->getVertexAttributes(), mState.getVertexAttribCurrentValues(), first, count, instances);
- if (err != GL_NO_ERROR)
+ error = mRenderer->applyVertexBuffer(programBinary, mState.getVertexArray()->getVertexAttributes(), mState.getVertexAttribCurrentValues(), first, count, instances);
+ if (error.isError())
{
- return gl::error(err);
+ return error;
}
bool transformFeedbackActive = applyTransformFeedbackBuffers();
- applyShaders(programBinary, transformFeedbackActive);
-
- FramebufferTextureSerialArray frameBufferSerials;
- size_t framebufferSerialCount = getBoundFramebufferTextureSerials(&frameBufferSerials);
+ error = applyShaders(programBinary, transformFeedbackActive);
+ if (error.isError())
+ {
+ return error;
+ }
- applyTextures(SAMPLER_VERTEX, vsTextures, vsTextureTypes, vsSamplers, vsTextureCount, frameBufferSerials, framebufferSerialCount);
- applyTextures(SAMPLER_PIXEL, psTextures, psTextureTypes, psSamplers, psTextureCount, frameBufferSerials, framebufferSerialCount);
+ error = applyTextures(programBinary);
+ if (error.isError())
+ {
+ return error;
+ }
- if (!applyUniformBuffers())
+ error = applyUniformBuffers();
+ if (error.isError())
{
- return;
+ return error;
}
if (!skipDraw(mode))
{
- mRenderer->drawArrays(mode, count, instances, transformFeedbackActive);
+ error = mRenderer->drawArrays(mode, count, instances, transformFeedbackActive);
+ if (error.isError())
+ {
+ return error;
+ }
if (transformFeedbackActive)
{
markTransformFeedbackUsage();
}
}
+
+ return gl::Error(GL_NO_ERROR);
}
-void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances)
+Error Context::drawElements(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices, GLsizei instances,
+ const rx::RangeUI &indexRange)
{
ASSERT(mState.getCurrentProgramId() != 0);
ProgramBinary *programBinary = mState.getCurrentProgramBinary();
programBinary->updateSamplerMapping();
- Texture *vsTextures[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
- TextureType vsTextureTypes[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
- SamplerState vsSamplers[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
- size_t vsTextureCount = getCurrentTexturesAndSamplerStates(programBinary, SAMPLER_VERTEX, vsTextures, vsTextureTypes, vsSamplers);
-
- Texture *psTextures[MAX_TEXTURE_IMAGE_UNITS];
- TextureType psTextureTypes[MAX_TEXTURE_IMAGE_UNITS];
- SamplerState psSamplers[MAX_TEXTURE_IMAGE_UNITS];
- size_t psTextureCount = getCurrentTexturesAndSamplerStates(programBinary, SAMPLER_PIXEL, psTextures, psTextureTypes, psSamplers);
-
- generateSwizzles(vsTextures, vsTextureCount);
- generateSwizzles(psTextures, psTextureCount);
+ Error error = generateSwizzles(programBinary);
+ if (error.isError())
+ {
+ return error;
+ }
if (!mRenderer->applyPrimitiveType(mode, count))
{
- return;
+ return Error(GL_NO_ERROR);
}
- if (!applyRenderTarget(mode, false))
+ error = applyRenderTarget(mode, false);
+ if (error.isError())
{
- return;
+ return error;
}
- applyState(mode);
+ error = applyState(mode);
+ if (error.isError())
+ {
+ return error;
+ }
VertexArray *vao = mState.getVertexArray();
rx::TranslatedIndexData indexInfo;
- GLenum err = mRenderer->applyIndexBuffer(indices, vao->getElementArrayBuffer(), count, mode, type, &indexInfo);
- if (err != GL_NO_ERROR)
+ indexInfo.indexRange = indexRange;
+ error = mRenderer->applyIndexBuffer(indices, vao->getElementArrayBuffer(), count, mode, type, &indexInfo);
+ if (error.isError())
{
- return gl::error(err);
+ return error;
}
- GLsizei vertexCount = indexInfo.maxIndex - indexInfo.minIndex + 1;
- err = mRenderer->applyVertexBuffer(programBinary, vao->getVertexAttributes(), mState.getVertexAttribCurrentValues(), indexInfo.minIndex, vertexCount, instances);
- if (err != GL_NO_ERROR)
+ GLsizei vertexCount = indexInfo.indexRange.length() + 1;
+ error = mRenderer->applyVertexBuffer(programBinary, vao->getVertexAttributes(),
+ mState.getVertexAttribCurrentValues(),
+ indexInfo.indexRange.start, vertexCount, instances);
+ if (error.isError())
{
- return gl::error(err);
+ return error;
}
bool transformFeedbackActive = applyTransformFeedbackBuffers();
@@ -1848,23 +1869,34 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
// layer.
ASSERT(!transformFeedbackActive);
- applyShaders(programBinary, transformFeedbackActive);
-
- FramebufferTextureSerialArray frameBufferSerials;
- size_t framebufferSerialCount = getBoundFramebufferTextureSerials(&frameBufferSerials);
+ error = applyShaders(programBinary, transformFeedbackActive);
+ if (error.isError())
+ {
+ return error;
+ }
- applyTextures(SAMPLER_VERTEX, vsTextures, vsTextureTypes, vsSamplers, vsTextureCount, frameBufferSerials, framebufferSerialCount);
- applyTextures(SAMPLER_PIXEL, psTextures, psTextureTypes, psSamplers, psTextureCount, frameBufferSerials, framebufferSerialCount);
+ error = applyTextures(programBinary);
+ if (error.isError())
+ {
+ return error;
+ }
- if (!applyUniformBuffers())
+ error = applyUniformBuffers();
+ if (error.isError())
{
- return;
+ return error;
}
if (!skipDraw(mode))
{
- mRenderer->drawElements(mode, count, type, indices, vao->getElementArrayBuffer(), indexInfo, instances);
+ error = mRenderer->drawElements(mode, count, type, indices, vao->getElementArrayBuffer(), indexInfo, instances);
+ if (error.isError())
+ {
+ return error;
+ }
}
+
+ return Error(GL_NO_ERROR);
}
// Implements glFlush when block is false, glFinish when block is true
@@ -1873,71 +1905,28 @@ void Context::sync(bool block)
mRenderer->sync(block);
}
-void Context::recordInvalidEnum()
-{
- mInvalidEnum = true;
-}
-
-void Context::recordInvalidValue()
-{
- mInvalidValue = true;
-}
-
-void Context::recordInvalidOperation()
-{
- mInvalidOperation = true;
-}
-
-void Context::recordOutOfMemory()
+void Context::recordError(const Error &error)
{
- mOutOfMemory = true;
-}
-
-void Context::recordInvalidFramebufferOperation()
-{
- mInvalidFramebufferOperation = true;
+ if (error.isError())
+ {
+ mErrors.insert(error.getCode());
+ }
}
// Get one of the recorded errors and clear its flag, if any.
// [OpenGL ES 2.0.24] section 2.5 page 13.
GLenum Context::getError()
{
- if (mInvalidEnum)
- {
- mInvalidEnum = false;
-
- return GL_INVALID_ENUM;
- }
-
- if (mInvalidValue)
+ if (mErrors.empty())
{
- mInvalidValue = false;
-
- return GL_INVALID_VALUE;
- }
-
- if (mInvalidOperation)
- {
- mInvalidOperation = false;
-
- return GL_INVALID_OPERATION;
- }
-
- if (mOutOfMemory)
- {
- mOutOfMemory = false;
-
- return GL_OUT_OF_MEMORY;
+ return GL_NO_ERROR;
}
-
- if (mInvalidFramebufferOperation)
+ else
{
- mInvalidFramebufferOperation = false;
-
- return GL_INVALID_FRAMEBUFFER_OPERATION;
+ GLenum error = *mErrors.begin();
+ mErrors.erase(mErrors.begin());
+ return error;
}
-
- return GL_NO_ERROR;
}
GLenum Context::getResetStatus()
@@ -1989,53 +1978,6 @@ const Extensions &Context::getExtensions() const
return mExtensions;
}
-int Context::getMajorShaderModel() const
-{
- return mMajorShaderModel;
-}
-
-unsigned int Context::getMaximumCombinedTextureImageUnits() const
-{
- return mRenderer->getMaxCombinedTextureImageUnits();
-}
-
-unsigned int Context::getMaximumCombinedUniformBufferBindings() const
-{
- return mRenderer->getMaxVertexShaderUniformBuffers() +
- mRenderer->getMaxFragmentShaderUniformBuffers();
-}
-
-int Context::getMaxSupportedSamples() const
-{
- return mRenderer->getMaxSupportedSamples();
-}
-
-GLsizei Context::getMaxSupportedFormatSamples(GLenum internalFormat) const
-{
- return mRenderer->getMaxSupportedFormatSamples(internalFormat);
-}
-
-GLsizei Context::getNumSampleCounts(GLenum internalFormat) const
-{
- return mRenderer->getNumSampleCounts(internalFormat);
-}
-
-void Context::getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const
-{
- mRenderer->getSampleCounts(internalFormat, bufSize, params);
-}
-
-unsigned int Context::getMaxTransformFeedbackBufferBindings() const
-{
- return mRenderer->getMaxTransformFeedbackBuffers();
-}
-
-GLintptr Context::getUniformBufferOffsetAlignment() const
-{
- // setting a large alignment forces uniform buffers to bind with zero offset
- return static_cast<GLintptr>(std::numeric_limits<GLint>::max());
-}
-
void Context::getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, GLenum *type)
{
Framebuffer *framebuffer = mState.getReadFramebuffer();
@@ -2044,9 +1986,12 @@ void Context::getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, G
FramebufferAttachment *attachment = framebuffer->getReadColorbuffer();
ASSERT(attachment);
- *internalFormat = attachment->getActualFormat();
- *format = gl::GetFormat(attachment->getActualFormat());
- *type = gl::GetType(attachment->getActualFormat());
+ GLenum actualFormat = attachment->getActualFormat();
+ const InternalFormat &actualFormatInfo = GetInternalFormatInfo(actualFormat);
+
+ *internalFormat = actualFormat;
+ *format = actualFormatInfo.format;
+ *type = actualFormatInfo.type;
}
void Context::detachTexture(GLuint texture)
@@ -2127,32 +2072,31 @@ void Context::detachSampler(GLuint sampler)
mState.detachSampler(sampler);
}
-Texture *Context::getIncompleteTexture(TextureType type)
+Texture *Context::getIncompleteTexture(GLenum type)
{
- Texture *t = mIncompleteTextures[type].get();
-
- if (t == NULL)
+ if (mIncompleteTextures.find(type) == mIncompleteTextures.end())
{
const GLubyte color[] = { 0, 0, 0, 255 };
const PixelUnpackState incompleteUnpackState(1);
+ Texture* t = NULL;
switch (type)
{
default:
UNREACHABLE();
// default falls through to TEXTURE_2D
- case TEXTURE_2D:
+ case GL_TEXTURE_2D:
{
- Texture2D *incomplete2d = new Texture2D(mRenderer->createTexture2D(), Texture::INCOMPLETE_TEXTURE_ID);
+ Texture2D *incomplete2d = new Texture2D(mRenderer->createTexture(GL_TEXTURE_2D), Texture::INCOMPLETE_TEXTURE_ID);
incomplete2d->setImage(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
t = incomplete2d;
}
break;
- case TEXTURE_CUBE:
+ case GL_TEXTURE_CUBE_MAP:
{
- TextureCubeMap *incompleteCube = new TextureCubeMap(mRenderer->createTextureCube(), Texture::INCOMPLETE_TEXTURE_ID);
+ TextureCubeMap *incompleteCube = new TextureCubeMap(mRenderer->createTexture(GL_TEXTURE_CUBE_MAP), Texture::INCOMPLETE_TEXTURE_ID);
incompleteCube->setImagePosX(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
incompleteCube->setImageNegX(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
@@ -2165,18 +2109,18 @@ Texture *Context::getIncompleteTexture(TextureType type)
}
break;
- case TEXTURE_3D:
+ case GL_TEXTURE_3D:
{
- Texture3D *incomplete3d = new Texture3D(mRenderer->createTexture3D(), Texture::INCOMPLETE_TEXTURE_ID);
+ Texture3D *incomplete3d = new Texture3D(mRenderer->createTexture(GL_TEXTURE_3D), Texture::INCOMPLETE_TEXTURE_ID);
incomplete3d->setImage(0, 1, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
t = incomplete3d;
}
break;
- case TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_2D_ARRAY:
{
- Texture2DArray *incomplete2darray = new Texture2DArray(mRenderer->createTexture2DArray(), Texture::INCOMPLETE_TEXTURE_ID);
+ Texture2DArray *incomplete2darray = new Texture2DArray(mRenderer->createTexture(GL_TEXTURE_2D_ARRAY), Texture::INCOMPLETE_TEXTURE_ID);
incomplete2darray->setImage(0, 1, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
t = incomplete2darray;
@@ -2187,7 +2131,7 @@ Texture *Context::getIncompleteTexture(TextureType type)
mIncompleteTextures[type].set(t);
}
- return t;
+ return mIncompleteTextures[type].get();
}
bool Context::skipDraw(GLenum drawMode)
@@ -2359,14 +2303,16 @@ size_t Context::getBoundFramebufferTextureSerials(FramebufferTextureSerialArray
FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(i);
if (attachment && attachment->isTexture())
{
- (*outSerialArray)[serialCount++] = attachment->getTextureSerial();
+ Texture *texture = attachment->getTexture();
+ (*outSerialArray)[serialCount++] = texture->getTextureSerial();
}
}
FramebufferAttachment *depthStencilAttachment = drawFramebuffer->getDepthOrStencilbuffer();
if (depthStencilAttachment && depthStencilAttachment->isTexture())
{
- (*outSerialArray)[serialCount++] = depthStencilAttachment->getTextureSerial();
+ Texture *depthStencilTexture = depthStencilAttachment->getTexture();
+ (*outSerialArray)[serialCount++] = depthStencilTexture->getTextureSerial();
}
std::sort(outSerialArray->begin(), outSerialArray->begin() + serialCount);
@@ -2396,114 +2342,19 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
blitDepth = true;
}
- gl::Rectangle srcRect(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0);
- gl::Rectangle dstRect(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0);
+ Rectangle srcRect(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0);
+ Rectangle dstRect(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0);
if (blitRenderTarget || blitDepth || blitStencil)
{
- const gl::Rectangle *scissor = mState.isScissorTestEnabled() ? &mState.getScissor() : NULL;
+ const Rectangle *scissor = mState.isScissorTestEnabled() ? &mState.getScissor() : NULL;
mRenderer->blitRect(readFramebuffer, srcRect, drawFramebuffer, dstRect, scissor,
blitRenderTarget, blitDepth, blitStencil, filter);
}
}
-void Context::invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments,
- GLint x, GLint y, GLsizei width, GLsizei height)
-{
- Framebuffer *frameBuffer = NULL;
- switch (target)
- {
- case GL_FRAMEBUFFER:
- case GL_DRAW_FRAMEBUFFER:
- frameBuffer = mState.getDrawFramebuffer();
- break;
- case GL_READ_FRAMEBUFFER:
- frameBuffer = mState.getReadFramebuffer();
- break;
- default:
- UNREACHABLE();
- }
-
- if (frameBuffer && frameBuffer->completeness() == GL_FRAMEBUFFER_COMPLETE)
- {
- for (int i = 0; i < numAttachments; ++i)
- {
- rx::RenderTarget *renderTarget = NULL;
-
- if (attachments[i] >= GL_COLOR_ATTACHMENT0 && attachments[i] <= GL_COLOR_ATTACHMENT15)
- {
- gl::FramebufferAttachment *attachment = frameBuffer->getColorbuffer(attachments[i] - GL_COLOR_ATTACHMENT0);
- if (attachment)
- {
- renderTarget = attachment->getRenderTarget();
- }
- }
- else if (attachments[i] == GL_COLOR)
- {
- gl::FramebufferAttachment *attachment = frameBuffer->getColorbuffer(0);
- if (attachment)
- {
- renderTarget = attachment->getRenderTarget();
- }
- }
- else
- {
- gl::FramebufferAttachment *attachment = NULL;
- switch (attachments[i])
- {
- case GL_DEPTH_ATTACHMENT:
- case GL_DEPTH:
- attachment = frameBuffer->getDepthbuffer();
- break;
- case GL_STENCIL_ATTACHMENT:
- case GL_STENCIL:
- attachment = frameBuffer->getStencilbuffer();
- break;
- case GL_DEPTH_STENCIL_ATTACHMENT:
- attachment = frameBuffer->getDepthOrStencilbuffer();
- break;
- default:
- UNREACHABLE();
- }
-
- if (attachment)
- {
- renderTarget = attachment->getDepthStencil();
- }
- }
-
- if (renderTarget)
- {
- renderTarget->invalidate(x, y, width, height);
- }
- }
- }
-}
-
-bool Context::hasMappedBuffer(GLenum target) const
+void Context::releaseShaderCompiler()
{
- if (target == GL_ARRAY_BUFFER)
- {
- for (unsigned int attribIndex = 0; attribIndex < gl::MAX_VERTEX_ATTRIBS; attribIndex++)
- {
- const gl::VertexAttribute &vertexAttrib = mState.getVertexAttribState(attribIndex);
- gl::Buffer *boundBuffer = vertexAttrib.buffer.get();
- if (vertexAttrib.enabled && boundBuffer && boundBuffer->isMapped())
- {
- return true;
- }
- }
- }
- else if (target == GL_ELEMENT_ARRAY_BUFFER)
- {
- Buffer *elementBuffer = mState.getTargetBuffer(target);
- return (elementBuffer && elementBuffer->isMapped());
- }
- else if (target == GL_TRANSFORM_FEEDBACK_BUFFER)
- {
- UNIMPLEMENTED();
- }
- else UNREACHABLE();
- return false;
+ mRenderer->releaseShaderCompiler();
}
void Context::initCaps(GLuint clientVersion)
@@ -2524,20 +2375,45 @@ void Context::initCaps(GLuint clientVersion)
//mExtensions.sRGB = false;
}
+ // Apply implementation limits
+ mCaps.maxVertexAttributes = std::min<GLuint>(mCaps.maxVertexAttributes, MAX_VERTEX_ATTRIBS);
+ mCaps.maxVertexUniformBlocks = std::min<GLuint>(mCaps.maxVertexUniformBlocks, IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS);
+ mCaps.maxVertexOutputComponents = std::min<GLuint>(mCaps.maxVertexOutputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
+
+ mCaps.maxFragmentInputComponents = std::min<GLuint>(mCaps.maxFragmentInputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
+
+ GLuint maxSamples = 0;
+ mCaps.compressedTextureFormats.clear();
+
const TextureCapsMap &rendererFormats = mRenderer->getRendererTextureCaps();
for (TextureCapsMap::const_iterator i = rendererFormats.begin(); i != rendererFormats.end(); i++)
{
GLenum format = i->first;
TextureCaps formatCaps = i->second;
- if (formatCaps.texturable && IsValidInternalFormat(format, mExtensions, clientVersion))
+ const InternalFormat &formatInfo = GetInternalFormatInfo(format);
+
+ // Update the format caps based on the client version and extensions
+ formatCaps.texturable = formatInfo.textureSupport(clientVersion, mExtensions);
+ formatCaps.renderable = formatInfo.renderSupport(clientVersion, mExtensions);
+ formatCaps.filterable = formatInfo.filterSupport(clientVersion, mExtensions);
+
+ // OpenGL ES does not support multisampling with integer formats
+ if (!formatInfo.renderSupport || formatInfo.componentType == GL_INT || formatInfo.componentType == GL_UNSIGNED_INT)
+ {
+ formatCaps.sampleCounts.clear();
+ }
+ maxSamples = std::max(maxSamples, formatCaps.getMaxSamples());
+
+ if (formatCaps.texturable && formatInfo.compressed)
{
- // Update the format caps based on the client version and extensions
- formatCaps.renderable = IsRenderingSupported(format, mExtensions, clientVersion);
- formatCaps.filterable = IsFilteringSupported(format, mExtensions, clientVersion);
- mTextureCaps.insert(format, formatCaps);
+ mCaps.compressedTextureFormats.push_back(format);
}
+
+ mTextureCaps.insert(format, formatCaps);
}
+
+ mExtensions.maxSamples = maxSamples;
}
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Context.h b/src/3rdparty/angle/src/libGLESv2/Context.h
index 6c93c74e79..1b888aec83 100644
--- a/src/3rdparty/angle/src/libGLESv2/Context.h
+++ b/src/3rdparty/angle/src/libGLESv2/Context.h
@@ -10,23 +10,24 @@
#ifndef LIBGLESV2_CONTEXT_H_
#define LIBGLESV2_CONTEXT_H_
-#include "angle_gl.h"
-
-#include <string>
-#include <set>
-#include <map>
-#include <unordered_map>
-#include <array>
-
#include "common/angleutils.h"
#include "common/RefCountObject.h"
#include "libGLESv2/Caps.h"
+#include "libGLESv2/Error.h"
#include "libGLESv2/HandleAllocator.h"
#include "libGLESv2/angletypes.h"
#include "libGLESv2/Constants.h"
#include "libGLESv2/VertexAttribute.h"
#include "libGLESv2/State.h"
+#include "angle_gl.h"
+
+#include <string>
+#include <set>
+#include <map>
+#include <unordered_map>
+#include <array>
+
namespace rx
{
class Renderer;
@@ -114,10 +115,7 @@ class Context
void bindArrayBuffer(GLuint buffer);
void bindElementArrayBuffer(GLuint buffer);
- void bindTexture2D(GLuint texture);
- void bindTextureCubeMap(GLuint texture);
- void bindTexture3D(GLuint texture);
- void bindTexture2DArray(GLuint texture);
+ void bindTexture(GLenum target, GLuint texture);
void bindReadFramebuffer(GLuint framebuffer);
void bindDrawFramebuffer(GLuint framebuffer);
void bindRenderbuffer(GLuint renderbuffer);
@@ -133,11 +131,11 @@ class Context
void bindPixelUnpackBuffer(GLuint buffer);
void useProgram(GLuint program);
void linkProgram(GLuint program);
- void setProgramBinary(GLuint program, const void *binary, GLint length);
+ void setProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLint length);
void bindTransformFeedback(GLuint transformFeedback);
- void beginQuery(GLenum target, GLuint query);
- void endQuery(GLenum target);
+ Error beginQuery(GLenum target, GLuint query);
+ Error endQuery(GLenum target);
void setFramebufferZero(Framebuffer *framebuffer);
@@ -169,7 +167,7 @@ class Context
Texture3D *getTexture3D() const;
Texture2DArray *getTexture2DArray() const;
- Texture *getSamplerTexture(unsigned int sampler, TextureType type) const;
+ Texture *getSamplerTexture(unsigned int sampler, GLenum type) const;
bool isSampler(GLuint samplerName) const;
@@ -184,22 +182,20 @@ class Context
bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams);
bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams);
- void clear(GLbitfield mask);
- void clearBufferfv(GLenum buffer, int drawbuffer, const float *values);
- void clearBufferuiv(GLenum buffer, int drawbuffer, const unsigned int *values);
- void clearBufferiv(GLenum buffer, int drawbuffer, const int *values);
- void clearBufferfi(GLenum buffer, int drawbuffer, float depth, int stencil);
-
- void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);
- void drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances);
- void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances);
+ Error clear(GLbitfield mask);
+ Error clearBufferfv(GLenum buffer, int drawbuffer, const float *values);
+ Error clearBufferuiv(GLenum buffer, int drawbuffer, const unsigned int *values);
+ Error clearBufferiv(GLenum buffer, int drawbuffer, const int *values);
+ Error clearBufferfi(GLenum buffer, int drawbuffer, float depth, int stencil);
+
+ Error readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);
+ Error drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances);
+ Error drawElements(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices, GLsizei instances,
+ const rx::RangeUI &indexRange);
void sync(bool block); // flush/finish
- void recordInvalidEnum();
- void recordInvalidValue();
- void recordInvalidOperation();
- void recordOutOfMemory();
- void recordInvalidFramebufferOperation();
+ void recordError(const Error &error);
GLenum getError();
GLenum getResetStatus();
@@ -211,15 +207,6 @@ class Context
const TextureCapsMap &getTextureCaps() const;
const Extensions &getExtensions() const;
- int getMajorShaderModel() const;
- unsigned int getMaximumCombinedTextureImageUnits() const;
- unsigned int getMaximumCombinedUniformBufferBindings() const;
- GLsizei getMaxSupportedSamples() const;
- GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const;
- GLsizei getNumSampleCounts(GLenum internalFormat) const;
- void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const;
- unsigned int getMaxTransformFeedbackBufferBindings() const;
- GLintptr getUniformBufferOffsetAlignment() const;
const std::string &getRendererString() const;
const std::string &getExtensionString() const;
@@ -231,29 +218,26 @@ class Context
void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
- void invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments,
- GLint x, GLint y, GLsizei width, GLsizei height);
-
- bool hasMappedBuffer(GLenum target) const;
-
rx::Renderer *getRenderer() { return mRenderer; }
State &getState() { return mState; }
const State &getState() const { return mState; }
+ void releaseShaderCompiler();
+
private:
DISALLOW_COPY_AND_ASSIGN(Context);
// TODO: std::array may become unavailable using older versions of GCC
typedef std::array<unsigned int, IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS> FramebufferTextureSerialArray;
- bool applyRenderTarget(GLenum drawMode, bool ignoreViewport);
- void applyState(GLenum drawMode);
- void applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive);
- void applyTextures(SamplerType shaderType, Texture *textures[], TextureType *textureTypes, SamplerState *samplers,
- size_t textureCount, const FramebufferTextureSerialArray& framebufferSerials,
- size_t framebufferSerialCount);
- bool applyUniformBuffers();
+ Error applyRenderTarget(GLenum drawMode, bool ignoreViewport);
+ Error applyState(GLenum drawMode);
+ Error applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive);
+ Error applyTextures(ProgramBinary *programBinary, SamplerType shaderType, const FramebufferTextureSerialArray &framebufferSerials,
+ size_t framebufferSerialCount);
+ Error applyTextures(ProgramBinary *programBinary);
+ Error applyUniformBuffers();
bool applyTransformFeedbackBuffers();
void markTransformFeedbackUsage();
@@ -265,10 +249,10 @@ class Context
void detachTransformFeedback(GLuint transformFeedback);
void detachSampler(GLuint sampler);
- void generateSwizzles(Texture *textures[], size_t count);
- size_t getCurrentTexturesAndSamplerStates(ProgramBinary *programBinary, SamplerType type, Texture **outTextures,
- TextureType *outTextureTypes, SamplerState *outSamplers);
- Texture *getIncompleteTexture(TextureType type);
+ Error generateSwizzles(ProgramBinary *programBinary, SamplerType type);
+ Error generateSwizzles(ProgramBinary *programBinary);
+
+ Texture *getIncompleteTexture(GLenum type);
bool skipDraw(GLenum drawMode);
@@ -289,10 +273,9 @@ class Context
int mClientVersion;
- BindingPointer<Texture2D> mTexture2DZero;
- BindingPointer<TextureCubeMap> mTextureCubeMapZero;
- BindingPointer<Texture3D> mTexture3DZero;
- BindingPointer<Texture2DArray> mTexture2DArrayZero;
+ typedef std::map< GLenum, BindingPointer<Texture> > TextureMap;
+ TextureMap mZeroTextures;
+ TextureMap mIncompleteTextures;
typedef std::unordered_map<GLuint, Framebuffer*> FramebufferMap;
FramebufferMap mFramebufferMap;
@@ -319,14 +302,9 @@ class Context
std::string mExtensionString;
std::vector<std::string> mExtensionStrings;
- BindingPointer<Texture> mIncompleteTextures[TEXTURE_TYPE_COUNT];
-
// Recorded errors
- bool mInvalidEnum;
- bool mInvalidValue;
- bool mInvalidOperation;
- bool mOutOfMemory;
- bool mInvalidFramebufferOperation;
+ typedef std::set<GLenum> ErrorSet;
+ ErrorSet mErrors;
// Current/lost context flags
bool mHasBeenCurrent;
@@ -335,10 +313,6 @@ class Context
GLenum mResetStrategy;
bool mRobustAccess;
- int mMajorShaderModel;
- bool mSupportsVertexTexture;
- int mNumCompressedTextureFormats;
-
ResourceManager *mResourceManager;
};
}
diff --git a/src/3rdparty/angle/src/libGLESv2/DynamicHLSL.h b/src/3rdparty/angle/src/libGLESv2/DynamicHLSL.h
deleted file mode 100644
index 68abd6e1a4..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/DynamicHLSL.h
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// DynamicHLSL.h: Interface for link and run-time HLSL generation
-//
-
-#ifndef LIBGLESV2_DYNAMIC_HLSL_H_
-#define LIBGLESV2_DYNAMIC_HLSL_H_
-
-#include "common/angleutils.h"
-#include "libGLESv2/constants.h"
-
-namespace rx
-{
-class Renderer;
-}
-
-namespace sh
-{
-struct Attribute;
-struct ShaderVariable;
-}
-
-namespace gl
-{
-
-class InfoLog;
-class FragmentShader;
-class VertexShader;
-struct VariableLocation;
-struct LinkedVarying;
-struct VertexAttribute;
-struct VertexFormat;
-struct PackedVarying;
-
-typedef const PackedVarying *VaryingPacking[IMPLEMENTATION_MAX_VARYING_VECTORS][4];
-
-struct PixelShaderOuputVariable
-{
- GLenum type;
- std::string name;
- std::string source;
- size_t outputIndex;
-};
-
-class DynamicHLSL
-{
- public:
- explicit DynamicHLSL(rx::Renderer *const renderer);
-
- int packVaryings(InfoLog &infoLog, VaryingPacking packing, FragmentShader *fragmentShader,
- VertexShader *vertexShader, const std::vector<std::string>& transformFeedbackVaryings);
- std::string generateVertexShaderForInputLayout(const std::string &sourceShader, const VertexFormat inputLayout[],
- const sh::Attribute shaderAttributes[]) const;
- std::string generatePixelShaderForOutputSignature(const std::string &sourceShader, const std::vector<PixelShaderOuputVariable> &outputVariables,
- bool usesFragDepth, const std::vector<GLenum> &outputLayout) const;
- bool generateShaderLinkHLSL(InfoLog &infoLog, int registers, const VaryingPacking packing,
- std::string& pixelHLSL, std::string& vertexHLSL,
- FragmentShader *fragmentShader, VertexShader *vertexShader,
- const std::vector<std::string>& transformFeedbackVaryings,
- std::vector<LinkedVarying> *linkedVaryings,
- std::map<int, VariableLocation> *programOutputVars,
- std::vector<PixelShaderOuputVariable> *outPixelShaderKey,
- bool *outUsesFragDepth) const;
-
- std::string generateGeometryShaderHLSL(int registers, FragmentShader *fragmentShader, VertexShader *vertexShader) const;
- void getInputLayoutSignature(const VertexFormat inputLayout[], GLenum signature[]) const;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(DynamicHLSL);
-
- rx::Renderer *const mRenderer;
-
- struct SemanticInfo;
-
- std::string getVaryingSemantic(bool pointSize) const;
- SemanticInfo getSemanticInfo(int startRegisters, bool fragCoord, bool pointCoord, bool pointSize,
- bool pixelShader) const;
- std::string generateVaryingLinkHLSL(const SemanticInfo &info, const std::string &varyingHLSL) const;
- std::string generateVaryingHLSL(VertexShader *shader) const;
- void storeUserLinkedVaryings(const VertexShader *vertexShader, std::vector<LinkedVarying> *linkedVaryings) const;
- void storeBuiltinLinkedVaryings(const SemanticInfo &info, std::vector<LinkedVarying> *linkedVaryings) const;
- void defineOutputVariables(FragmentShader *fragmentShader, std::map<int, VariableLocation> *programOutputVars) const;
- std::string generatePointSpriteHLSL(int registers, FragmentShader *fragmentShader, VertexShader *vertexShader) const;
-
- // Prepend an underscore
- static std::string decorateVariable(const std::string &name);
-
- std::string generateAttributeConversionHLSL(const VertexFormat &vertexFormat, const sh::ShaderVariable &shaderAttrib) const;
-};
-
-}
-
-#endif // LIBGLESV2_DYNAMIC_HLSL_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/Error.cpp b/src/3rdparty/angle/src/libGLESv2/Error.cpp
new file mode 100644
index 0000000000..cc7d17eb37
--- /dev/null
+++ b/src/3rdparty/angle/src/libGLESv2/Error.cpp
@@ -0,0 +1,48 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Error.cpp: Implements the gl::Error class which encapsulates an OpenGL error
+// and optional error message.
+
+#include "libGLESv2/Error.h"
+
+#include "common/angleutils.h"
+
+#include <cstdarg>
+
+namespace gl
+{
+
+Error::Error(GLenum errorCode)
+ : mCode(errorCode),
+ mMessage()
+{
+}
+
+Error::Error(GLenum errorCode, const char *msg, ...)
+ : mCode(errorCode),
+ mMessage()
+{
+ va_list vararg;
+ va_start(vararg, msg);
+ mMessage = FormatString(msg, vararg);
+ va_end(vararg);
+}
+
+Error::Error(const Error &other)
+ : mCode(other.mCode),
+ mMessage(other.mMessage)
+{
+}
+
+Error &Error::operator=(const Error &other)
+{
+ mCode = other.mCode;
+ mMessage = other.mMessage;
+ return *this;
+}
+
+}
diff --git a/src/3rdparty/angle/src/libGLESv2/Error.h b/src/3rdparty/angle/src/libGLESv2/Error.h
new file mode 100644
index 0000000000..b70b5a531c
--- /dev/null
+++ b/src/3rdparty/angle/src/libGLESv2/Error.h
@@ -0,0 +1,39 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Error.h: Defines the gl::Error class which encapsulates an OpenGL error
+// and optional error message.
+
+#ifndef LIBGLESV2_ERROR_H_
+#define LIBGLESV2_ERROR_H_
+
+#include "angle_gl.h"
+
+#include <string>
+
+namespace gl
+{
+
+class Error
+{
+ public:
+ explicit Error(GLenum errorCode);
+ Error(GLenum errorCode, const char *msg, ...);
+ Error(const Error &other);
+ Error &operator=(const Error &other);
+
+ GLenum getCode() const { return mCode; }
+ bool isError() const { return (mCode != GL_NO_ERROR); }
+
+ const std::string &getMessage() const { return mMessage; }
+
+ private:
+ GLenum mCode;
+ std::string mMessage;
+};
+
+}
+
+#endif // LIBGLESV2_ERROR_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/Fence.cpp b/src/3rdparty/angle/src/libGLESv2/Fence.cpp
index 31d149d629..ee9a07a5c4 100644
--- a/src/3rdparty/angle/src/libGLESv2/Fence.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Fence.cpp
@@ -1,4 +1,3 @@
-#include "precompiled.h"
//
// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -23,6 +22,8 @@
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/main.h"
+#include "angle_gl.h"
+
namespace gl
{
diff --git a/src/3rdparty/angle/src/libGLESv2/Float16ToFloat32.cpp b/src/3rdparty/angle/src/libGLESv2/Float16ToFloat32.cpp
index b90d2f6023..5bf7b3fce8 100644
--- a/src/3rdparty/angle/src/libGLESv2/Float16ToFloat32.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Float16ToFloat32.cpp
@@ -1,4 +1,3 @@
-#include "precompiled.h"
//
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
diff --git a/src/3rdparty/angle/src/libGLESv2/Framebuffer.cpp b/src/3rdparty/angle/src/libGLESv2/Framebuffer.cpp
index f808175250..5b21433f90 100644
--- a/src/3rdparty/angle/src/libGLESv2/Framebuffer.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Framebuffer.cpp
@@ -1,4 +1,3 @@
-#include "precompiled.h"
//
// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -9,15 +8,60 @@
// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
#include "libGLESv2/Framebuffer.h"
-
#include "libGLESv2/main.h"
-#include "common/utilities.h"
#include "libGLESv2/formatutils.h"
#include "libGLESv2/Texture.h"
#include "libGLESv2/Context.h"
-#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/FramebufferAttachment.h"
+#include "libGLESv2/renderer/Renderer.h"
+#include "libGLESv2/renderer/RenderTarget.h"
+#include "libGLESv2/renderer/d3d/TextureD3D.h"
+
+#include "common/utilities.h"
+
+namespace rx
+{
+RenderTarget *GetAttachmentRenderTarget(gl::FramebufferAttachment *attachment)
+{
+ if (attachment->isTexture())
+ {
+ gl::Texture *texture = attachment->getTexture();
+ ASSERT(texture);
+ TextureD3D *textureD3D = TextureD3D::makeTextureD3D(texture->getImplementation());
+ const gl::ImageIndex *index = attachment->getTextureImageIndex();
+ ASSERT(index);
+ return textureD3D->getRenderTarget(*index);
+ }
+
+ gl::Renderbuffer *renderbuffer = attachment->getRenderbuffer();
+ ASSERT(renderbuffer);
+
+ // TODO: cast to RenderbufferD3D
+ return renderbuffer->getStorage()->getRenderTarget();
+}
+
+// Note: RenderTarget serials should ideally be in the RenderTargets themselves.
+unsigned int GetAttachmentSerial(gl::FramebufferAttachment *attachment)
+{
+ if (attachment->isTexture())
+ {
+ gl::Texture *texture = attachment->getTexture();
+ ASSERT(texture);
+ TextureD3D *textureD3D = TextureD3D::makeTextureD3D(texture->getImplementation());
+ const gl::ImageIndex *index = attachment->getTextureImageIndex();
+ ASSERT(index);
+ return textureD3D->getRenderTargetSerial(*index);
+ }
+
+ gl::Renderbuffer *renderbuffer = attachment->getRenderbuffer();
+ ASSERT(renderbuffer);
+
+ // TODO: cast to RenderbufferD3D
+ return renderbuffer->getStorage()->getSerial();
+}
+
+}
namespace gl
{
@@ -47,7 +91,7 @@ Framebuffer::~Framebuffer()
SafeDelete(mStencilbuffer);
}
-FramebufferAttachment *Framebuffer::createAttachment(GLenum type, GLuint handle, GLint level, GLint layer) const
+FramebufferAttachment *Framebuffer::createAttachment(GLenum binding, GLenum type, GLuint handle, GLint level, GLint layer) const
{
if (handle == 0)
{
@@ -62,15 +106,14 @@ FramebufferAttachment *Framebuffer::createAttachment(GLenum type, GLuint handle,
return NULL;
case GL_RENDERBUFFER:
- return new RenderbufferAttachment(context->getRenderbuffer(handle));
+ return new RenderbufferAttachment(binding, context->getRenderbuffer(handle));
case GL_TEXTURE_2D:
{
Texture *texture = context->getTexture(handle);
if (texture && texture->getTarget() == GL_TEXTURE_2D)
{
- Texture2D *tex2D = static_cast<Texture2D*>(texture);
- return new Texture2DAttachment(tex2D, level);
+ return new TextureAttachment(binding, texture, ImageIndex::Make2D(level));
}
else
{
@@ -88,8 +131,7 @@ FramebufferAttachment *Framebuffer::createAttachment(GLenum type, GLuint handle,
Texture *texture = context->getTexture(handle);
if (texture && texture->getTarget() == GL_TEXTURE_CUBE_MAP)
{
- TextureCubeMap *texCube = static_cast<TextureCubeMap*>(texture);
- return new TextureCubeMapAttachment(texCube, type, level);
+ return new TextureAttachment(binding, texture, ImageIndex::MakeCube(type, level));
}
else
{
@@ -102,8 +144,7 @@ FramebufferAttachment *Framebuffer::createAttachment(GLenum type, GLuint handle,
Texture *texture = context->getTexture(handle);
if (texture && texture->getTarget() == GL_TEXTURE_3D)
{
- Texture3D *tex3D = static_cast<Texture3D*>(texture);
- return new Texture3DAttachment(tex3D, level, layer);
+ return new TextureAttachment(binding, texture, ImageIndex::Make3D(level, layer));
}
else
{
@@ -116,8 +157,7 @@ FramebufferAttachment *Framebuffer::createAttachment(GLenum type, GLuint handle,
Texture *texture = context->getTexture(handle);
if (texture && texture->getTarget() == GL_TEXTURE_2D_ARRAY)
{
- Texture2DArray *tex2DArray = static_cast<Texture2DArray*>(texture);
- return new Texture2DArrayAttachment(tex2DArray, level, layer);
+ return new TextureAttachment(binding, texture, ImageIndex::Make2DArray(level, layer));
}
else
{
@@ -135,24 +175,25 @@ void Framebuffer::setColorbuffer(unsigned int colorAttachment, GLenum type, GLui
{
ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
SafeDelete(mColorbuffers[colorAttachment]);
- mColorbuffers[colorAttachment] = createAttachment(type, colorbuffer, level, layer);
+ GLenum binding = colorAttachment + GL_COLOR_ATTACHMENT0;
+ mColorbuffers[colorAttachment] = createAttachment(binding, type, colorbuffer, level, layer);
}
void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level, GLint layer)
{
SafeDelete(mDepthbuffer);
- mDepthbuffer = createAttachment(type, depthbuffer, level, layer);
+ mDepthbuffer = createAttachment(GL_DEPTH_ATTACHMENT, type, depthbuffer, level, layer);
}
void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint level, GLint layer)
{
SafeDelete(mStencilbuffer);
- mStencilbuffer = createAttachment(type, stencilbuffer, level, layer);
+ mStencilbuffer = createAttachment(GL_STENCIL_ATTACHMENT, type, stencilbuffer, level, layer);
}
void Framebuffer::setDepthStencilBuffer(GLenum type, GLuint depthStencilBuffer, GLint level, GLint layer)
{
- FramebufferAttachment *attachment = createAttachment(type, depthStencilBuffer, level, layer);
+ FramebufferAttachment *attachment = createAttachment(GL_DEPTH_STENCIL_ATTACHMENT, type, depthStencilBuffer, level, layer);
SafeDelete(mDepthbuffer);
SafeDelete(mStencilbuffer);
@@ -164,7 +205,7 @@ void Framebuffer::setDepthStencilBuffer(GLenum type, GLuint depthStencilBuffer,
// Make a new attachment object to ensure we do not double-delete
// See angle issue 686
- mStencilbuffer = createAttachment(type, depthStencilBuffer, level, layer);
+ mStencilbuffer = createAttachment(GL_DEPTH_STENCIL_ATTACHMENT, type, depthStencilBuffer, level, layer);
}
}
@@ -364,6 +405,7 @@ GLenum Framebuffer::completeness() const
GLenum internalformat = colorbuffer->getInternalFormat();
// TODO(geofflang): use context's texture caps
const TextureCaps &formatCaps = mRenderer->getRendererTextureCaps().get(internalformat);
+ const InternalFormat &formatInfo = GetInternalFormatInfo(internalformat);
if (colorbuffer->isTexture())
{
if (!formatCaps.renderable)
@@ -371,14 +413,14 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_UNSUPPORTED;
}
- if (gl::GetDepthBits(internalformat) > 0 || gl::GetStencilBits(internalformat) > 0)
+ if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
else
{
- if (!formatCaps.renderable || gl::GetDepthBits(internalformat) > 0 || gl::GetStencilBits(internalformat) > 0)
+ if (!formatCaps.renderable || formatInfo.depthBits > 0 || formatInfo.stencilBits > 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
@@ -403,7 +445,7 @@ GLenum Framebuffer::completeness() const
// in GLES 3.0, there is no such restriction
if (clientVersion < 3)
{
- if (gl::GetPixelBytes(colorbuffer->getInternalFormat()) != colorbufferSize)
+ if (formatInfo.pixelBytes != colorbufferSize)
{
return GL_FRAMEBUFFER_UNSUPPORTED;
}
@@ -427,7 +469,7 @@ GLenum Framebuffer::completeness() const
width = colorbuffer->getWidth();
height = colorbuffer->getHeight();
samples = colorbuffer->getSamples();
- colorbufferSize = gl::GetPixelBytes(colorbuffer->getInternalFormat());
+ colorbufferSize = formatInfo.pixelBytes;
missingAttachment = false;
}
}
@@ -443,10 +485,9 @@ GLenum Framebuffer::completeness() const
GLenum internalformat = mDepthbuffer->getInternalFormat();
// TODO(geofflang): use context's texture caps
const TextureCaps &formatCaps = mRenderer->getRendererTextureCaps().get(internalformat);
+ const InternalFormat &formatInfo = GetInternalFormatInfo(internalformat);
if (mDepthbuffer->isTexture())
{
- GLenum internalformat = mDepthbuffer->getInternalFormat();
-
// depth texture attachments require OES/ANGLE_depth_texture
// TODO(geofflang): use context's extensions
if (!mRenderer->getRendererExtensions().depthTextures)
@@ -459,14 +500,14 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_UNSUPPORTED;
}
- if (gl::GetDepthBits(internalformat) == 0)
+ if (formatInfo.depthBits == 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
else
{
- if (!formatCaps.renderable || gl::GetDepthBits(internalformat) == 0)
+ if (!formatCaps.renderable || formatInfo.depthBits == 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
@@ -499,10 +540,9 @@ GLenum Framebuffer::completeness() const
GLenum internalformat = mStencilbuffer->getInternalFormat();
// TODO(geofflang): use context's texture caps
const TextureCaps &formatCaps = mRenderer->getRendererTextureCaps().get(internalformat);
+ const InternalFormat &formatInfo = GetInternalFormatInfo(internalformat);
if (mStencilbuffer->isTexture())
{
- GLenum internalformat = mStencilbuffer->getInternalFormat();
-
// texture stencil attachments come along as part
// of OES_packed_depth_stencil + OES/ANGLE_depth_texture
// TODO(geofflang): use context's extensions
@@ -516,14 +556,14 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_UNSUPPORTED;
}
- if (gl::GetStencilBits(internalformat) == 0)
+ if (formatInfo.stencilBits == 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
else
{
- if (!formatCaps.renderable || gl::GetStencilBits(internalformat) == 0)
+ if (!formatCaps.renderable || formatInfo.stencilBits == 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
@@ -562,18 +602,47 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_COMPLETE;
}
+void Framebuffer::invalidate(const Caps &caps, GLsizei numAttachments, const GLenum *attachments)
+{
+ GLuint maxDimension = caps.maxRenderbufferSize;
+ invalidateSub(caps, numAttachments, attachments, 0, 0, maxDimension, maxDimension);
+}
+
+void Framebuffer::invalidateSub(const Caps &caps, GLsizei numAttachments, const GLenum *attachments,
+ GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ ASSERT(completeness() == GL_FRAMEBUFFER_COMPLETE);
+ for (GLsizei attachIndex = 0; attachIndex < numAttachments; ++attachIndex)
+ {
+ GLenum attachmentTarget = attachments[attachIndex];
+
+ gl::FramebufferAttachment *attachment =
+ (attachmentTarget == GL_DEPTH_STENCIL_ATTACHMENT) ? getDepthOrStencilbuffer() :
+ getAttachment(attachmentTarget);
+
+ if (attachment)
+ {
+ rx::RenderTarget *renderTarget = rx::GetAttachmentRenderTarget(attachment);
+ if (renderTarget)
+ {
+ renderTarget->invalidate(x, y, width, height);
+ }
+ }
+ }
+}
+
DefaultFramebuffer::DefaultFramebuffer(rx::Renderer *renderer, Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil)
: Framebuffer(renderer, 0)
{
Renderbuffer *colorRenderbuffer = new Renderbuffer(0, colorbuffer);
- mColorbuffers[0] = new RenderbufferAttachment(colorRenderbuffer);
+ mColorbuffers[0] = new RenderbufferAttachment(GL_BACK, colorRenderbuffer);
Renderbuffer *depthStencilBuffer = new Renderbuffer(0, depthStencil);
// Make a new attachment objects to ensure we do not double-delete
// See angle issue 686
- mDepthbuffer = (depthStencilBuffer->getDepthSize() != 0 ? new RenderbufferAttachment(depthStencilBuffer) : NULL);
- mStencilbuffer = (depthStencilBuffer->getStencilSize() != 0 ? new RenderbufferAttachment(depthStencilBuffer) : NULL);
+ mDepthbuffer = (depthStencilBuffer->getDepthSize() != 0 ? new RenderbufferAttachment(GL_DEPTH_ATTACHMENT, depthStencilBuffer) : NULL);
+ mStencilbuffer = (depthStencilBuffer->getStencilSize() != 0 ? new RenderbufferAttachment(GL_STENCIL_ATTACHMENT, depthStencilBuffer) : NULL);
mDrawBufferStates[0] = GL_BACK;
mReadBufferState = GL_BACK;
@@ -606,6 +675,31 @@ bool Framebuffer::hasValidDepthStencil() const
mDepthbuffer->id() == mStencilbuffer->id());
}
+ColorbufferInfo Framebuffer::getColorbuffersForRender() const
+{
+ ColorbufferInfo colorbuffersForRender;
+
+ for (size_t colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; ++colorAttachment)
+ {
+ GLenum drawBufferState = mDrawBufferStates[colorAttachment];
+ FramebufferAttachment *colorbuffer = mColorbuffers[colorAttachment];
+
+ if (colorbuffer != NULL && drawBufferState != GL_NONE)
+ {
+ ASSERT(drawBufferState == GL_BACK || drawBufferState == (GL_COLOR_ATTACHMENT0_EXT + colorAttachment));
+ colorbuffersForRender.push_back(colorbuffer);
+ }
+#if (ANGLE_MRT_PERF_WORKAROUND == ANGLE_WORKAROUND_DISABLED)
+ else
+ {
+ colorbuffersForRender.push_back(NULL);
+ }
+#endif
+ }
+
+ return colorbuffersForRender;
+}
+
GLenum DefaultFramebuffer::completeness() const
{
// The default framebuffer *must* always be complete, though it may not be
@@ -617,6 +711,7 @@ FramebufferAttachment *DefaultFramebuffer::getAttachment(GLenum attachment) cons
{
switch (attachment)
{
+ case GL_COLOR:
case GL_BACK:
return getColorbuffer(0);
case GL_DEPTH:
diff --git a/src/3rdparty/angle/src/libGLESv2/Framebuffer.h b/src/3rdparty/angle/src/libGLESv2/Framebuffer.h
index 035e16fa45..cc12d22953 100644
--- a/src/3rdparty/angle/src/libGLESv2/Framebuffer.h
+++ b/src/3rdparty/angle/src/libGLESv2/Framebuffer.h
@@ -10,6 +10,8 @@
#ifndef LIBGLESV2_FRAMEBUFFER_H_
#define LIBGLESV2_FRAMEBUFFER_H_
+#include <vector>
+
#include "common/angleutils.h"
#include "common/RefCountObject.h"
#include "constants.h"
@@ -26,6 +28,9 @@ class Colorbuffer;
class Depthbuffer;
class Stencilbuffer;
class DepthStencilbuffer;
+struct Caps;
+
+typedef std::vector<FramebufferAttachment *> ColorbufferInfo;
class Framebuffer
{
@@ -67,6 +72,15 @@ class Framebuffer
virtual GLenum completeness() const;
bool hasValidDepthStencil() const;
+ void invalidate(const Caps &caps, GLsizei numAttachments, const GLenum *attachments);
+ void invalidateSub(const Caps &caps, GLsizei numAttachments, const GLenum *attachments,
+ GLint x, GLint y, GLsizei width, GLsizei height);
+
+ // Use this method to retrieve the color buffer map when doing rendering.
+ // It will apply a workaround for poor shader performance on some systems
+ // by compacting the list to skip NULL values.
+ ColorbufferInfo getColorbuffersForRender() const;
+
protected:
rx::Renderer *mRenderer;
@@ -79,10 +93,10 @@ class Framebuffer
FramebufferAttachment *mDepthbuffer;
FramebufferAttachment *mStencilbuffer;
-private:
+ private:
DISALLOW_COPY_AND_ASSIGN(Framebuffer);
- FramebufferAttachment *createAttachment(GLenum type, GLuint handle, GLint level, GLint layer) const;
+ FramebufferAttachment *createAttachment(GLenum binding, GLenum type, GLuint handle, GLint level, GLint layer) const;
};
class DefaultFramebuffer : public Framebuffer
@@ -99,4 +113,14 @@ class DefaultFramebuffer : public Framebuffer
}
+namespace rx
+{
+class RenderTarget;
+
+// TODO: place this in FramebufferD3D.h
+RenderTarget *GetAttachmentRenderTarget(gl::FramebufferAttachment *attachment);
+unsigned int GetAttachmentSerial(gl::FramebufferAttachment *attachment);
+
+}
+
#endif // LIBGLESV2_FRAMEBUFFER_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.cpp b/src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.cpp
index 5855301c97..540ede1cd2 100644
--- a/src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/FramebufferAttachment.cpp
@@ -1,4 +1,3 @@
-#include "precompiled.h"
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -9,21 +8,22 @@
// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
#include "libGLESv2/FramebufferAttachment.h"
-#include "libGLESv2/renderer/RenderTarget.h"
-
#include "libGLESv2/Texture.h"
+#include "libGLESv2/formatutils.h"
+#include "libGLESv2/Renderbuffer.h"
+#include "libGLESv2/renderer/RenderTarget.h"
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/renderer/d3d/TextureStorage.h"
+
#include "common/utilities.h"
-#include "libGLESv2/formatutils.h"
-#include "libGLESv2/Renderbuffer.h"
namespace gl
{
////// FramebufferAttachment Implementation //////
-FramebufferAttachment::FramebufferAttachment()
+FramebufferAttachment::FramebufferAttachment(GLenum binding)
+ : mBinding(binding)
{
}
@@ -33,42 +33,42 @@ FramebufferAttachment::~FramebufferAttachment()
GLuint FramebufferAttachment::getRedSize() const
{
- return (gl::GetRedBits(getInternalFormat()) > 0) ? gl::GetRedBits(getActualFormat()) : 0;
+ return (GetInternalFormatInfo(getInternalFormat()).redBits > 0) ? GetInternalFormatInfo(getActualFormat()).redBits : 0;
}
GLuint FramebufferAttachment::getGreenSize() const
{
- return (gl::GetGreenBits(getInternalFormat()) > 0) ? gl::GetGreenBits(getActualFormat()) : 0;
+ return (GetInternalFormatInfo(getInternalFormat()).greenBits > 0) ? GetInternalFormatInfo(getActualFormat()).greenBits : 0;
}
GLuint FramebufferAttachment::getBlueSize() const
{
- return (gl::GetBlueBits(getInternalFormat()) > 0) ? gl::GetBlueBits(getActualFormat()) : 0;
+ return (GetInternalFormatInfo(getInternalFormat()).blueBits > 0) ? GetInternalFormatInfo(getActualFormat()).blueBits : 0;
}
GLuint FramebufferAttachment::getAlphaSize() const
{
- return (gl::GetAlphaBits(getInternalFormat()) > 0) ? gl::GetAlphaBits(getActualFormat()) : 0;
+ return (GetInternalFormatInfo(getInternalFormat()).alphaBits > 0) ? GetInternalFormatInfo(getActualFormat()).alphaBits : 0;
}
GLuint FramebufferAttachment::getDepthSize() const
{
- return (gl::GetDepthBits(getInternalFormat()) > 0) ? gl::GetDepthBits(getActualFormat()) : 0;
+ return (GetInternalFormatInfo(getInternalFormat()).depthBits > 0) ? GetInternalFormatInfo(getActualFormat()).depthBits : 0;
}
GLuint FramebufferAttachment::getStencilSize() const
{
- return (gl::GetStencilBits(getInternalFormat()) > 0) ? gl::GetStencilBits(getActualFormat()) : 0;
+ return (GetInternalFormatInfo(getInternalFormat()).stencilBits > 0) ? GetInternalFormatInfo(getActualFormat()).stencilBits : 0;
}
GLenum FramebufferAttachment::getComponentType() const
{
- return gl::GetComponentType(getActualFormat());
+ return GetInternalFormatInfo(getActualFormat()).componentType;
}
GLenum FramebufferAttachment::getColorEncoding() const
{
- return gl::GetColorEncoding(getActualFormat());
+ return GetInternalFormatInfo(getActualFormat()).colorEncoding;
}
bool FramebufferAttachment::isTexture() const
@@ -76,340 +76,85 @@ bool FramebufferAttachment::isTexture() const
return (type() != GL_RENDERBUFFER);
}
-///// Texture2DAttachment Implementation ////////
-
-Texture2DAttachment::Texture2DAttachment(Texture2D *texture, GLint level) : mLevel(level)
-{
- mTexture2D.set(texture);
-}
-
-Texture2DAttachment::~Texture2DAttachment()
-{
- mTexture2D.set(NULL);
-}
-
-rx::RenderTarget *Texture2DAttachment::getRenderTarget()
-{
- return mTexture2D->getRenderTarget(mLevel);
-}
-
-rx::RenderTarget *Texture2DAttachment::getDepthStencil()
-{
- return mTexture2D->getDepthSencil(mLevel);
-}
-
-rx::TextureStorage *Texture2DAttachment::getTextureStorage()
-{
- return mTexture2D->getNativeTexture()->getStorageInstance();
-}
-
-GLsizei Texture2DAttachment::getWidth() const
-{
- return mTexture2D->getWidth(mLevel);
-}
-
-GLsizei Texture2DAttachment::getHeight() const
-{
- return mTexture2D->getHeight(mLevel);
-}
-
-GLenum Texture2DAttachment::getInternalFormat() const
-{
- return mTexture2D->getInternalFormat(mLevel);
-}
-
-GLenum Texture2DAttachment::getActualFormat() const
-{
- return mTexture2D->getActualFormat(mLevel);
-}
-
-GLsizei Texture2DAttachment::getSamples() const
-{
- return 0;
-}
-
-unsigned int Texture2DAttachment::getSerial() const
-{
- return mTexture2D->getRenderTargetSerial(mLevel);
-}
-
-GLuint Texture2DAttachment::id() const
-{
- return mTexture2D->id();
-}
-
-GLenum Texture2DAttachment::type() const
-{
- return GL_TEXTURE_2D;
-}
-
-GLint Texture2DAttachment::mipLevel() const
-{
- return mLevel;
-}
-
-GLint Texture2DAttachment::layer() const
-{
- return 0;
-}
-
-unsigned int Texture2DAttachment::getTextureSerial() const
-{
- return mTexture2D->getTextureSerial();
-}
-
-///// TextureCubeMapAttachment Implementation ////////
-
-TextureCubeMapAttachment::TextureCubeMapAttachment(TextureCubeMap *texture, GLenum faceTarget, GLint level)
- : mFaceTarget(faceTarget), mLevel(level)
-{
- mTextureCubeMap.set(texture);
-}
-
-TextureCubeMapAttachment::~TextureCubeMapAttachment()
-{
- mTextureCubeMap.set(NULL);
-}
-
-rx::RenderTarget *TextureCubeMapAttachment::getRenderTarget()
-{
- return mTextureCubeMap->getRenderTarget(mFaceTarget, mLevel);
-}
-
-rx::RenderTarget *TextureCubeMapAttachment::getDepthStencil()
-{
- return mTextureCubeMap->getDepthStencil(mFaceTarget, mLevel);
-}
-
-rx::TextureStorage *TextureCubeMapAttachment::getTextureStorage()
-{
- return mTextureCubeMap->getNativeTexture()->getStorageInstance();
-}
-
-GLsizei TextureCubeMapAttachment::getWidth() const
-{
- return mTextureCubeMap->getWidth(mFaceTarget, mLevel);
-}
-
-GLsizei TextureCubeMapAttachment::getHeight() const
-{
- return mTextureCubeMap->getHeight(mFaceTarget, mLevel);
-}
-
-GLenum TextureCubeMapAttachment::getInternalFormat() const
-{
- return mTextureCubeMap->getInternalFormat(mFaceTarget, mLevel);
-}
-
-GLenum TextureCubeMapAttachment::getActualFormat() const
-{
- return mTextureCubeMap->getActualFormat(mFaceTarget, mLevel);
-}
-
-GLsizei TextureCubeMapAttachment::getSamples() const
-{
- return 0;
-}
-
-unsigned int TextureCubeMapAttachment::getSerial() const
-{
- return mTextureCubeMap->getRenderTargetSerial(mFaceTarget, mLevel);
-}
-
-GLuint TextureCubeMapAttachment::id() const
-{
- return mTextureCubeMap->id();
-}
-
-GLenum TextureCubeMapAttachment::type() const
-{
- return mFaceTarget;
-}
-
-GLint TextureCubeMapAttachment::mipLevel() const
-{
- return mLevel;
-}
-
-GLint TextureCubeMapAttachment::layer() const
-{
- return 0;
-}
-
-unsigned int TextureCubeMapAttachment::getTextureSerial() const
-{
- return mTextureCubeMap->getTextureSerial();
-}
-
-///// Texture3DAttachment Implementation ////////
-
-Texture3DAttachment::Texture3DAttachment(Texture3D *texture, GLint level, GLint layer)
- : mLevel(level), mLayer(layer)
-{
- mTexture3D.set(texture);
-}
-
-Texture3DAttachment::~Texture3DAttachment()
-{
- mTexture3D.set(NULL);
-}
-
-rx::RenderTarget *Texture3DAttachment::getRenderTarget()
-{
- return mTexture3D->getRenderTarget(mLevel, mLayer