summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/angle/AUTHORS2
-rw-r--r--src/3rdparty/angle/LICENSE.preprocessor45
-rw-r--r--src/3rdparty/angle/include/GLSLANG/ShaderLang.h33
-rw-r--r--src/3rdparty/angle/include/KHR/khrplatform.h8
-rw-r--r--src/3rdparty/angle/src/commit.h2
-rw-r--r--src/3rdparty/angle/src/common/angleutils.h14
-rw-r--r--src/3rdparty/angle/src/common/debug.cpp44
-rw-r--r--src/3rdparty/angle/src/common/debug.h32
-rw-r--r--src/3rdparty/angle/src/common/event_tracer.cpp2
-rw-r--r--src/3rdparty/angle/src/common/event_tracer.h12
-rw-r--r--src/3rdparty/angle/src/common/system.h26
-rw-r--r--src/3rdparty/angle/src/common/version.h18
-rw-r--r--src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp33
-rw-r--r--src/3rdparty/angle/src/compiler/DetectRecursion.cpp125
-rw-r--r--src/3rdparty/angle/src/compiler/DetectRecursion.h60
-rw-r--r--src/3rdparty/angle/src/compiler/InitializeGLPosition.cpp61
-rw-r--r--src/3rdparty/angle/src/compiler/InitializeGLPosition.h33
-rw-r--r--src/3rdparty/angle/src/compiler/IntermTraverse.cpp293
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp84
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h86
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp78
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y18
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp6
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp4
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BaseTypes.h (renamed from src/3rdparty/angle/src/compiler/BaseTypes.h)1
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp (renamed from src/3rdparty/angle/src/compiler/BuiltInFunctionEmulator.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h (renamed from src/3rdparty/angle/src/compiler/BuiltInFunctionEmulator.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/CodeGen.cpp (renamed from src/3rdparty/angle/src/compiler/CodeGenGLSL.cpp)12
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Common.h (renamed from src/3rdparty/angle/src/compiler/Common.h)17
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Compiler.cpp (renamed from src/3rdparty/angle/src/compiler/Compiler.cpp)216
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ConstantUnion.h (renamed from src/3rdparty/angle/src/compiler/ConstantUnion.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DetectCallDepth.cpp (renamed from src/3rdparty/angle/src/compiler/DetectCallDepth.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DetectCallDepth.h (renamed from src/3rdparty/angle/src/compiler/DetectCallDepth.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.cpp (renamed from src/3rdparty/angle/src/compiler/DetectDiscontinuity.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.h (renamed from src/3rdparty/angle/src/compiler/DetectDiscontinuity.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Diagnostics.cpp (renamed from src/3rdparty/angle/src/compiler/Diagnostics.cpp)10
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Diagnostics.h (renamed from src/3rdparty/angle/src/compiler/Diagnostics.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DirectiveHandler.cpp (renamed from src/3rdparty/angle/src/compiler/DirectiveHandler.cpp)26
-rw-r--r--src/3rdparty/angle/src/compiler/translator/DirectiveHandler.h (renamed from src/3rdparty/angle/src/compiler/DirectiveHandler.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.h (renamed from src/3rdparty/angle/src/compiler/ExtensionBehavior.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.cpp (renamed from src/3rdparty/angle/src/compiler/ForLoopUnroll.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.h (renamed from src/3rdparty/angle/src/compiler/ForLoopUnroll.h)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/HashNames.h (renamed from src/3rdparty/angle/src/compiler/HashNames.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InfoSink.cpp (renamed from src/3rdparty/angle/src/compiler/InfoSink.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InfoSink.h (renamed from src/3rdparty/angle/src/compiler/InfoSink.h)3
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Initialize.cpp (renamed from src/3rdparty/angle/src/compiler/Initialize.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Initialize.h (renamed from src/3rdparty/angle/src/compiler/Initialize.h)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeDll.cpp (renamed from src/3rdparty/angle/src/compiler/InitializeDll.cpp)8
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeDll.h (renamed from src/3rdparty/angle/src/compiler/InitializeDll.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeGlobals.h (renamed from src/3rdparty/angle/src/compiler/InitializeGlobals.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeParseContext.cpp (renamed from src/3rdparty/angle/src/compiler/InitializeParseContext.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeParseContext.h (renamed from src/3rdparty/angle/src/compiler/InitializeParseContext.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp116
-rw-r--r--src/3rdparty/angle/src/compiler/translator/InitializeVariables.h50
-rw-r--r--src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp259
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Intermediate.cpp (renamed from src/3rdparty/angle/src/compiler/Intermediate.cpp)76
-rw-r--r--src/3rdparty/angle/src/compiler/translator/MMap.h (renamed from src/3rdparty/angle/src/compiler/MMap.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/MapLongVariableNames.cpp (renamed from src/3rdparty/angle/src/compiler/MapLongVariableNames.cpp)9
-rw-r--r--src/3rdparty/angle/src/compiler/translator/MapLongVariableNames.h (renamed from src/3rdparty/angle/src/compiler/MapLongVariableNames.h)5
-rw-r--r--src/3rdparty/angle/src/compiler/translator/NodeSearch.h80
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputESSL.cpp (renamed from src/3rdparty/angle/src/compiler/OutputESSL.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputESSL.h (renamed from src/3rdparty/angle/src/compiler/OutputESSL.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSL.cpp (renamed from src/3rdparty/angle/src/compiler/OutputGLSL.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSL.h (renamed from src/3rdparty/angle/src/compiler/OutputGLSL.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp (renamed from src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp)12
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h (renamed from src/3rdparty/angle/src/compiler/OutputGLSLBase.h)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp (renamed from src/3rdparty/angle/src/compiler/OutputHLSL.cpp)90
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputHLSL.h (renamed from src/3rdparty/angle/src/compiler/OutputHLSL.h)7
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ParseContext.cpp (renamed from src/3rdparty/angle/src/compiler/ParseHelper.cpp)10
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ParseContext.h (renamed from src/3rdparty/angle/src/compiler/ParseHelper.h)10
-rw-r--r--src/3rdparty/angle/src/compiler/translator/PoolAlloc.cpp (renamed from src/3rdparty/angle/src/compiler/PoolAlloc.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/PoolAlloc.h (renamed from src/3rdparty/angle/src/compiler/PoolAlloc.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Pragma.h (renamed from src/3rdparty/angle/src/compiler/Pragma.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/QualifierAlive.cpp (renamed from src/3rdparty/angle/src/compiler/QualifierAlive.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/QualifierAlive.h (renamed from src/3rdparty/angle/src/compiler/QualifierAlive.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveTree.cpp (renamed from src/3rdparty/angle/src/compiler/RemoveTree.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveTree.h (renamed from src/3rdparty/angle/src/compiler/RemoveTree.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RenameFunction.h (renamed from src/3rdparty/angle/src/compiler/RenameFunction.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp98
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h39
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SearchSymbol.cpp (renamed from src/3rdparty/angle/src/compiler/SearchSymbol.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SearchSymbol.h (renamed from src/3rdparty/angle/src/compiler/SearchSymbol.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ShHandle.h (renamed from src/3rdparty/angle/src/compiler/ShHandle.h)22
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp (renamed from src/3rdparty/angle/src/compiler/ShaderLang.cpp)11
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp (renamed from src/3rdparty/angle/src/compiler/SymbolTable.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/SymbolTable.h (renamed from src/3rdparty/angle/src/compiler/SymbolTable.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorESSL.cpp (renamed from src/3rdparty/angle/src/compiler/TranslatorESSL.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorESSL.h (renamed from src/3rdparty/angle/src/compiler/TranslatorESSL.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.cpp (renamed from src/3rdparty/angle/src/compiler/TranslatorGLSL.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.h (renamed from src/3rdparty/angle/src/compiler/TranslatorGLSL.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp (renamed from src/3rdparty/angle/src/compiler/TranslatorHLSL.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h (renamed from src/3rdparty/angle/src/compiler/TranslatorHLSL.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Types.h (renamed from src/3rdparty/angle/src/compiler/Types.h)26
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.cpp (renamed from src/3rdparty/angle/src/compiler/UnfoldShortCircuit.cpp)20
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.h (renamed from src/3rdparty/angle/src/compiler/UnfoldShortCircuit.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp81
-rw-r--r--src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h51
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Uniform.cpp (renamed from src/3rdparty/angle/src/compiler/Uniform.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Uniform.h (renamed from src/3rdparty/angle/src/compiler/Uniform.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateLimitations.cpp (renamed from src/3rdparty/angle/src/compiler/ValidateLimitations.cpp)10
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h (renamed from src/3rdparty/angle/src/compiler/ValidateLimitations.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariableInfo.cpp (renamed from src/3rdparty/angle/src/compiler/VariableInfo.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariableInfo.h (renamed from src/3rdparty/angle/src/compiler/VariableInfo.h)3
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp (renamed from src/3rdparty/angle/src/compiler/VariablePacker.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VariablePacker.h (renamed from src/3rdparty/angle/src/compiler/VariablePacker.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp (renamed from src/3rdparty/angle/src/compiler/VersionGLSL.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/VersionGLSL.h (renamed from src/3rdparty/angle/src/compiler/VersionGLSL.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/compilerdebug.cpp (renamed from src/3rdparty/angle/src/compiler/debug.cpp)8
-rw-r--r--src/3rdparty/angle/src/compiler/translator/compilerdebug.h (renamed from src/3rdparty/angle/src/compiler/debug.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.cpp (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraph.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.h (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraph.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraphBuilder.cpp)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.h (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraphBuilder.h)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphOutput.cpp (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraphOutput.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphOutput.h (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraphOutput.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphTraverse.cpp (renamed from src/3rdparty/angle/src/compiler/depgraph/DependencyGraphTraverse.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/glslang.h (renamed from src/3rdparty/angle/src/compiler/glslang.h)0
-rw-r--r--src/3rdparty/angle/src/compiler/translator/glslang.l (renamed from src/3rdparty/angle/src/compiler/glslang.l)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/glslang.y (renamed from src/3rdparty/angle/src/compiler/glslang.y)54
-rw-r--r--src/3rdparty/angle/src/compiler/translator/intermOut.cpp (renamed from src/3rdparty/angle/src/compiler/intermOut.cpp)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/intermediate.h (renamed from src/3rdparty/angle/src/compiler/intermediate.h)80
-rw-r--r--src/3rdparty/angle/src/compiler/translator/localintermediate.h (renamed from src/3rdparty/angle/src/compiler/localintermediate.h)6
-rw-r--r--src/3rdparty/angle/src/compiler/translator/osinclude.h (renamed from src/3rdparty/angle/src/compiler/osinclude.h)20
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ossource_posix.cpp (renamed from src/3rdparty/angle/src/compiler/ossource_posix.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ossource_win.cpp (renamed from src/3rdparty/angle/src/compiler/ossource_win.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/ossource_winrt.cpp (renamed from src/3rdparty/angle/src/compiler/ossource_winrt.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/parseConst.cpp (renamed from src/3rdparty/angle/src/compiler/parseConst.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp (renamed from src/3rdparty/angle/src/compiler/timing/RestrictFragmentShaderTiming.cpp)8
-rw-r--r--src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h (renamed from src/3rdparty/angle/src/compiler/timing/RestrictFragmentShaderTiming.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp (renamed from src/3rdparty/angle/src/compiler/timing/RestrictVertexShaderTiming.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h (renamed from src/3rdparty/angle/src/compiler/timing/RestrictVertexShaderTiming.h)4
-rw-r--r--src/3rdparty/angle/src/compiler/translator/util.cpp (renamed from src/3rdparty/angle/src/compiler/util.cpp)2
-rw-r--r--src/3rdparty/angle/src/compiler/translator/util.h (renamed from src/3rdparty/angle/src/compiler/util.h)0
-rw-r--r--src/3rdparty/angle/src/libEGL/Display.cpp11
-rw-r--r--src/3rdparty/angle/src/libEGL/Display.h5
-rw-r--r--src/3rdparty/angle/src/libEGL/Surface.cpp41
-rw-r--r--src/3rdparty/angle/src/libEGL/Surface.h3
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGL.cpp12
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGL.rc11
-rw-r--r--src/3rdparty/angle/src/libEGL/main.cpp135
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Buffer.cpp8
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Buffer.h4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Context.cpp30
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Context.h9
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Framebuffer.h2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp48
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Renderbuffer.cpp15
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Renderbuffer.h5
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Shader.cpp2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Shader.h3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Texture.cpp8
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp10
-rw-r--r--src/3rdparty/angle/src/libGLESv2/libGLESv2.rc11
-rw-r--r--src/3rdparty/angle/src/libGLESv2/main.cpp112
-rw-r--r--src/3rdparty/angle/src/libGLESv2/main.h3
-rw-r--r--src/3rdparty/angle/src/libGLESv2/mathutil.h1
-rw-r--r--src/3rdparty/angle/src/libGLESv2/precompiled.h57
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp361
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h56
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp83
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h34
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h7
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/VertexDataManager.cpp4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp366
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.h92
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Fence11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Fence11.cpp)4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Fence11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Fence11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Image11.cpp)48
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Image11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.cpp)8
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.cpp)14
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Query11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Query11.cpp)4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Query11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Query11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.cpp)60
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.h)22
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.cpp)6
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp)400
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h)20
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.cpp)2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp)215
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.cpp)18
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.cpp)4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.cpp)2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl (renamed from src/3rdparty/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough11.hlsl (renamed from src/3rdparty/angle/src/libGLESv2/renderer/shaders/Passthrough11.hlsl)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Blit.cpp)20
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Blit.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.cpp)4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.h)2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Fence9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Fence9.cpp)6
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Fence9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Fence9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Image9.cpp)12
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Image9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.cpp)4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Query9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Query9.cpp)6
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Query9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Query9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.cpp)6
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Renderer9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.cpp)207
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Renderer9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.h)14
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.cpp)2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/SwapChain9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.cpp)44
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/SwapChain9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.cpp)10
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.cpp)8
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.cpp)4
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp (renamed from src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.cpp)2
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.ps (renamed from src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.ps)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.vs (renamed from src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.vs)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/renderer/d3d9/vertexconversion.h (renamed from src/3rdparty/angle/src/libGLESv2/renderer/vertexconversion.h)0
-rw-r--r--src/3rdparty/angle/src/libGLESv2/utilities.cpp63
-rw-r--r--src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h4
-rw-r--r--src/3rdparty/angle/src/third_party/trace_event/trace_event.h4
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java23
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtNative.java4
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtSurface.java8
-rw-r--r--src/android/java/AndroidManifest.xml14
-rw-r--r--src/android/java/res/layout/splash.xml13
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java4
-rw-r--r--src/android/java/version.xml2
-rw-r--r--src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch28
-rw-r--r--src/angle/patches/0001-Fix-compilation-for-MSVC-2008-and-std-tuple.patch15
-rw-r--r--src/angle/patches/0001-Make-it-possible-to-link-ANGLE-statically-for-single.patch200
-rw-r--r--src/angle/patches/0002-Fix-compilation-of-ANGLE-with-mingw-tdm64-gcc-4.8.1.patch (renamed from src/angle/patches/0001-Fix-compilation-of-ANGLE-with-mingw-tdm64-gcc-4.8.1.patch)10
-rw-r--r--src/angle/patches/0003-Fix-compilation-with-MinGW-gcc-64-bit.patch (renamed from src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch)10
-rw-r--r--src/angle/patches/0004-Fix-black-screen-after-minimizing-OpenGL-window-with.patch45
-rw-r--r--src/angle/patches/0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch68
-rw-r--r--src/angle/patches/0005-Fix-build-when-SSE2-is-not-available.patch33
-rw-r--r--src/angle/patches/0006-Fix-compilation-of-libGLESv2-with-older-MinGW-w64-he.patch (renamed from src/angle/patches/0011-Fix-compilation-of-libGLESv2-with-older-MinGW-w64-he.patch)17
-rw-r--r--src/angle/patches/0006-Make-DX9-DX11-mutually-exclusive.patch149
-rw-r--r--src/angle/patches/0007-ANGLE-Fix-typedefs-for-Win64.patch38
-rw-r--r--src/angle/patches/0007-Make-DX9-DX11-mutually-exclusive.patch141
-rw-r--r--src/angle/patches/0008-ANGLE-DX11-Prevent-assert-when-view-is-minimized-or-.patch58
-rw-r--r--src/angle/patches/0008-ANGLE-Dynamically-load-D3D-compiler-from-a-list-of-k.patch (renamed from src/angle/patches/0015-ANGLE-Dynamically-load-D3D-compiler-from-a-list-of-k.patch)50
-rw-r--r--src/angle/patches/0009-ANGLE-Support-WinRT.patch (renamed from src/angle/patches/0012-ANGLE-Support-WinRT.patch)1039
-rw-r--r--src/angle/patches/0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch426
-rw-r--r--src/angle/patches/0011-ANGLE-Fix-compilation-error-on-MinGW-caused-by-trace.patch37
-rw-r--r--src/angle/patches/0012-ANGLE-fix-semantic-index-lookup.patch48
-rw-r--r--src/angle/patches/0013-ANGLE-Allow-for-universal-program-binaries.patch93
-rw-r--r--src/angle/patches/0013-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch990
-rw-r--r--src/angle/patches/0014-ANGLE-D3D11-Always-execute-QueryInterface.patch51
-rw-r--r--src/angle/patches/0016-ANGLE-D3D11-Fix-build-on-desktop-Windows.patch28
-rw-r--r--src/angle/src/compiler/compiler.pro2
-rw-r--r--src/angle/src/compiler/preprocessor/preprocessor.pro1
-rw-r--r--src/angle/src/compiler/translator.pro163
-rw-r--r--src/angle/src/compiler/translator_common.pro133
-rw-r--r--src/angle/src/compiler/translator_hlsl.pro30
-rw-r--r--src/angle/src/config.pri17
-rw-r--r--src/angle/src/libEGL/libEGL.pro6
-rw-r--r--src/angle/src/libGLESv2/libGLESv2.pro157
-rw-r--r--src/concurrent/qtconcurrentmedian.h6
-rw-r--r--src/corelib/arch/qatomic_armv5.h14
-rw-r--r--src/corelib/arch/qatomic_armv6.h54
-rw-r--r--src/corelib/codecs/qtextcodec.cpp10
-rw-r--r--src/corelib/codecs/qutfcodec.cpp4
-rw-r--r--src/corelib/corelib.pro3
-rw-r--r--src/corelib/doc/snippets/signalmapper/filereader.cpp4
-rw-r--r--src/corelib/global/global.pri9
-rw-r--r--src/corelib/global/qcompilerdetection.h19
-rw-r--r--src/corelib/global/qglobal.cpp9
-rw-r--r--src/corelib/global/qlibraryinfo.cpp4
-rw-r--r--src/corelib/global/qlibraryinfo.h2
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp4
-rw-r--r--src/corelib/io/qloggingcategory.cpp2
-rw-r--r--src/corelib/io/qloggingregistry.cpp4
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp20
-rw-r--r--src/corelib/json/qjsondocument.cpp4
-rw-r--r--src/corelib/json/qjsonvalue.cpp26
-rw-r--r--src/corelib/kernel/qjni_p.h2
-rw-r--r--src/corelib/kernel/qvariant.cpp16
-rw-r--r--src/corelib/tools/qarraydata.h4
-rw-r--r--src/corelib/tools/qarraydataops.h2
-rw-r--r--src/corelib/tools/qbytearray.cpp11
-rw-r--r--src/corelib/tools/qbytearraylist.h5
-rw-r--r--src/corelib/tools/qhash.cpp25
-rw-r--r--src/corelib/tools/qmargins.cpp412
-rw-r--r--src/corelib/tools/qmargins.h265
-rw-r--r--src/corelib/tools/qrect.cpp133
-rw-r--r--src/corelib/tools/qrect.h96
-rw-r--r--src/corelib/tools/qstring.cpp15
-rw-r--r--src/corelib/tools/tools.pri2
-rw-r--r--src/dbus/qdbusmetaobject.cpp5
-rw-r--r--src/gui/doc/snippets/clipboard/clipwindow.cpp4
-rw-r--r--src/gui/doc/snippets/draganddrop/mainwindow.cpp8
-rw-r--r--src/gui/doc/snippets/separations/viewer.cpp4
-rw-r--r--src/gui/kernel/qwindow.cpp8
-rw-r--r--src/gui/kernel/qwindow.h3
-rw-r--r--src/gui/opengl/qopengldebug.cpp14
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp6
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp53
-rw-r--r--src/gui/opengl/qopenglpaintengine_p.h4
-rw-r--r--src/gui/opengl/qopenglproxy_win.cpp3
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp23
-rw-r--r--src/gui/opengl/qopenglshaderprogram.h2
-rw-r--r--src/gui/opengl/qopengltextureglyphcache.cpp78
-rw-r--r--src/gui/opengl/qopengltextureglyphcache_p.h9
-rw-r--r--src/gui/opengl/qopenglversionfunctions.cpp2
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.cpp149
-rw-r--r--src/gui/painting/qoutlinemapper.cpp2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp20
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h2
-rw-r--r--src/gui/painting/qpaintengineex.cpp2
-rw-r--r--src/gui/painting/qpainter.cpp6
-rw-r--r--src/gui/painting/qpainterpath.h2
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp43
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h8
-rw-r--r--src/gui/text/qfontengine.cpp29
-rw-r--r--src/gui/text/qfontengine_ft.cpp10
-rw-r--r--src/gui/text/qfontengine_ft_p.h2
-rw-r--r--src/gui/text/qfontengine_p.h15
-rw-r--r--src/gui/text/qfontengineglyphcache_p.h17
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp104
-rw-r--r--src/gui/text/qtextengine.cpp15
-rw-r--r--src/gui/text/qtextobject.cpp4
-rw-r--r--src/gui/text/qtextobject.h2
-rw-r--r--src/network/access/access.pri2
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp154
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h37
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp130
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel_p.h8
-rw-r--r--src/network/access/qhttpnetworkreply.cpp50
-rw-r--r--src/network/access/qhttpnetworkreply_p.h16
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp16
-rw-r--r--src/network/access/qhttpnetworkrequest_p.h5
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp38
-rw-r--r--src/network/access/qhttpthreaddelegate_p.h4
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp13
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp20
-rw-r--r--src/network/access/qnetworkreplyhttpimpl_p.h7
-rw-r--r--src/network/access/qnetworkrequest.cpp11
-rw-r--r--src/network/access/qnetworkrequest.h2
-rw-r--r--src/network/access/qspdyprotocolhandler.cpp1286
-rw-r--r--src/network/access/qspdyprotocolhandler_p.h228
-rw-r--r--src/network/bearer/qnetworkconfigmanager.cpp2
-rw-r--r--src/network/kernel/qhostinfo_win.cpp12
-rw-r--r--src/network/ssl/qsslcipher.h2
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp47
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h4
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp6
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h2
-rw-r--r--src/platformsupport/eglconvenience/qeglcompositor.cpp7
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcursor.cpp4
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp240
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm6
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm67
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h4
-rw-r--r--src/platformsupport/linuxaccessibility/application.cpp2
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp4
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp7
-rw-r--r--src/plugins/platforms/android/androidjnimain.h2
-rw-r--r--src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp128
-rw-r--r--src/plugins/platforms/android/qandroidassetsfileenginehandler.h3
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp13
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglwindow.cpp2
-rw-r--r--src/plugins/platforms/android/qandroidplatformrasterwindow.cpp5
-rw-r--r--src/plugins/platforms/android/qandroidplatformscreen.cpp59
-rw-r--r--src/plugins/platforms/android/qandroidplatformscreen.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h26
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm199
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm13
-rw-r--r--src/plugins/platforms/cocoa/qmacmime.mm2
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm17
-rw-r--r--src/plugins/platforms/cocoa/qpaintengine_mac.mm6
-rwxr-xr-x[-rw-r--r--]src/plugins/platforms/eglfs/cursor-atlas.pngbin2735 -> 2928 bytes
-rw-r--r--src/plugins/platforms/eglfs/cursor.json42
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp18
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.h1
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp16
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp13
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp16
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.h4
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp35
-rw-r--r--src/plugins/platforms/winrt/qwinrtbackingstore.cpp30
-rw-r--r--src/plugins/platforms/winrt/winrt.pro2
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp22
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp13
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp1
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintersupport.cpp4
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_win.cpp15
-rw-r--r--src/printsupport/dialogs/qprintdialog_win.cpp17
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp107
-rw-r--r--src/printsupport/kernel/qprintengine_win_p.h16
-rw-r--r--src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp11
-rw-r--r--src/testlib/qtestcase.cpp222
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp2
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp10
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp15
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp4
-rw-r--r--src/widgets/doc/src/modelview.qdoc2
-rw-r--r--src/widgets/itemviews/qtreeview.cpp4
-rw-r--r--src/widgets/kernel/qapplication.cpp3
-rw-r--r--src/widgets/kernel/qwidget.cpp3
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp25
-rw-r--r--src/widgets/kernel/qwidgetbackingstore_p.h6
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp3
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp2
-rw-r--r--src/widgets/widgets/qlineedit.cpp12
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp7
-rw-r--r--src/widgets/widgets/qmenu.cpp4
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp4
428 files changed, 9220 insertions, 6121 deletions
diff --git a/src/3rdparty/angle/AUTHORS b/src/3rdparty/angle/AUTHORS
index a2ce91575a..0bdb65ee9a 100644
--- a/src/3rdparty/angle/AUTHORS
+++ b/src/3rdparty/angle/AUTHORS
@@ -13,6 +13,8 @@ TransGaming Inc.
Adobe Systems Inc.
Autodesk, Inc.
+BlackBerry Limited
+Cable Television Laboratories, Inc.
Cloud Party, Inc.
Intel Corporation
Mozilla Corporation
diff --git a/src/3rdparty/angle/LICENSE.preprocessor b/src/3rdparty/angle/LICENSE.preprocessor
deleted file mode 100644
index 0ec2123b61..0000000000
--- a/src/3rdparty/angle/LICENSE.preprocessor
+++ /dev/null
@@ -1,45 +0,0 @@
-Files in src/compiler/preprocessor are provided under the following license:
-
-****************************************************************************
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-****************************************************************************
diff --git a/src/3rdparty/angle/include/GLSLANG/ShaderLang.h b/src/3rdparty/angle/include/GLSLANG/ShaderLang.h
index 28bf516f7f..9912939b95 100644
--- a/src/3rdparty/angle/include/GLSLANG/ShaderLang.h
+++ b/src/3rdparty/angle/include/GLSLANG/ShaderLang.h
@@ -6,20 +6,20 @@
#ifndef _COMPILER_INTERFACE_INCLUDED_
#define _COMPILER_INTERFACE_INCLUDED_
-#if defined(COMPONENT_BUILD)
+#if defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC)
#if defined(_WIN32) || defined(_WIN64)
-#if defined(COMPILER_IMPLEMENTATION)
+#if defined(ANGLE_TRANSLATOR_IMPLEMENTATION)
#define COMPILER_EXPORT __declspec(dllexport)
#else
#define COMPILER_EXPORT __declspec(dllimport)
-#endif // defined(COMPILER_IMPLEMENTATION)
+#endif // defined(ANGLE_TRANSLATOR_IMPLEMENTATION)
-#else // defined(WIN32)
+#else // defined(_WIN32) || defined(_WIN64)
#define COMPILER_EXPORT __attribute__((visibility("default")))
#endif
-#else // defined(COMPONENT_BUILD)
+#else // defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC)
#define COMPILER_EXPORT
#endif
@@ -146,14 +146,14 @@ typedef enum {
// This is needed only as a workaround for certain OpenGL driver bugs.
SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100,
- // This is an experimental flag to enforce restrictions that aim to prevent
+ // This is an experimental flag to enforce restrictions that aim to prevent
// timing attacks.
// It generates compilation errors for shaders that could expose sensitive
// texture information via the timing channel.
// To use this flag, you must compile the shader under the WebGL spec
// (using the SH_WEBGL_SPEC flag).
SH_TIMING_RESTRICTIONS = 0x0200,
-
+
// This flag prints the dependency graph that is used to enforce timing
// restrictions on fragment shaders.
// This flag only has an effect if all of the following are true:
@@ -184,11 +184,24 @@ typedef enum {
// This flag limits the depth of the call stack.
SH_LIMIT_CALL_STACK_DEPTH = 0x4000,
- // This flag initializes gl_Position to vec4(0.0, 0.0, 0.0, 1.0) at
- // the beginning of the vertex shader, and has no effect in the
+ // This flag initializes gl_Position to vec4(0,0,0,0) at the
+ // beginning of the vertex shader's main(), and has no effect in the
// fragment shader. It is intended as a workaround for drivers which
// incorrectly fail to link programs if gl_Position is not written.
SH_INIT_GL_POSITION = 0x8000,
+
+ // This flag replaces
+ // "a && b" with "a ? b : false",
+ // "a || b" with "a ? true : b".
+ // This is to work around a MacOSX driver bug that |b| is executed
+ // independent of |a|'s value.
+ SH_UNFOLD_SHORT_CIRCUIT = 0x10000,
+
+ // This flag initializes varyings without static use in vertex shader
+ // at the beginning of main(), and has no effects in the fragment shader.
+ // It is intended as a workaround for drivers which incorrectly optimize
+ // out such varyings and cause a link failure.
+ SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x20000,
} ShCompileOptions;
// Defines alternate strategies for implementing array index clamping.
@@ -267,7 +280,7 @@ COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources);
//
// ShHandle held by but opaque to the driver. It is allocated,
-// managed, and de-allocated by the compiler. It's contents
+// managed, and de-allocated by the compiler. It's contents
// are defined by and used by the compiler.
//
// If handle creation fails, 0 will be returned.
diff --git a/src/3rdparty/angle/include/KHR/khrplatform.h b/src/3rdparty/angle/include/KHR/khrplatform.h
index 001e925f46..1ac2d3f324 100644
--- a/src/3rdparty/angle/include/KHR/khrplatform.h
+++ b/src/3rdparty/angle/include/KHR/khrplatform.h
@@ -26,7 +26,7 @@
/* Khronos platform-specific types and definitions.
*
- * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+ * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
@@ -221,6 +221,12 @@ typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
+
+/*
+ * Types that differ between LLP64 and LP64 architectures - in LLP64,
+ * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
+ * to be the only LLP64 architecture in current use.
+ */
#ifdef _WIN64
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
diff --git a/src/3rdparty/angle/src/commit.h b/src/3rdparty/angle/src/commit.h
new file mode 100644
index 0000000000..f4a36a3cfe
--- /dev/null
+++ b/src/3rdparty/angle/src/commit.h
@@ -0,0 +1,2 @@
+#define ANGLE_COMMIT_HASH "5bb7ec572d0a"
+#define ANGLE_COMMIT_HASH_SIZE 12
diff --git a/src/3rdparty/angle/src/common/angleutils.h b/src/3rdparty/angle/src/common/angleutils.h
index 9761567fb2..7723f0fb72 100644
--- a/src/3rdparty/angle/src/common/angleutils.h
+++ b/src/3rdparty/angle/src/common/angleutils.h
@@ -42,6 +42,20 @@ void SafeRelease(T& resource)
}
}
+template <typename T>
+void SafeDelete(T*& resource)
+{
+ delete resource;
+ resource = NULL;
+}
+
+template <typename T>
+void SafeDeleteArray(T*& resource)
+{
+ delete[] resource;
+ resource = NULL;
+}
+
#if defined(_MSC_VER)
#define snprintf _snprintf
#endif
diff --git a/src/3rdparty/angle/src/common/debug.cpp b/src/3rdparty/angle/src/common/debug.cpp
index 9b932567b0..05d3dc62ad 100644
--- a/src/3rdparty/angle/src/common/debug.cpp
+++ b/src/3rdparty/angle/src/common/debug.cpp
@@ -7,21 +7,23 @@
// debug.cpp: Debugging utilities.
#include "common/debug.h"
-#include "common/system.h"
-#ifndef ANGLE_ENABLE_D3D11
+#include <stdarg.h>
+
+#if defined(ANGLE_ENABLE_PERF)
#include <d3d9.h>
-#else
-typedef DWORD D3DCOLOR;
#endif
namespace gl
{
-
+#if defined(ANGLE_ENABLE_PERF)
typedef void (WINAPI *PerfOutputFunction)(D3DCOLOR, LPCWSTR);
+#else
+typedef void (*PerfOutputFunction)(unsigned int, const wchar_t*);
+#endif
static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
{
-#if !defined(ANGLE_DISABLE_PERF)
+#if defined(ANGLE_ENABLE_PERF)
if (perfActive())
{
char message[32768];
@@ -41,15 +43,15 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c
perfFunc(0, wideMessage);
}
-#endif
+#endif // ANGLE_ENABLE_PERF
-#if !defined(ANGLE_DISABLE_TRACE)
+#if defined(ANGLE_ENABLE_TRACE)
#if defined(NDEBUG)
if (traceFileDebugOnly)
{
return;
}
-#endif
+#endif // NDEBUG
FILE* file = fopen(TRACE_OUTPUT_FILE, "a");
if (file)
@@ -57,50 +59,50 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c
vfprintf(file, format, vararg);
fclose(file);
}
-#endif
+#endif // ANGLE_ENABLE_TRACE
}
void trace(bool traceFileDebugOnly, const char *format, ...)
{
va_list vararg;
va_start(vararg, format);
-#if defined(ANGLE_DISABLE_PERF)
- output(traceFileDebugOnly, NULL, format, vararg);
-#else
+#if defined(ANGLE_ENABLE_PERF)
output(traceFileDebugOnly, D3DPERF_SetMarker, format, vararg);
+#else
+ output(traceFileDebugOnly, NULL, format, vararg);
#endif
va_end(vararg);
}
bool perfActive()
{
-#if defined(ANGLE_DISABLE_PERF)
- return false;
-#else
+#if defined(ANGLE_ENABLE_PERF)
static bool active = D3DPERF_GetStatus() != 0;
return active;
+#else
+ return false;
#endif
}
ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
{
-#if !defined(ANGLE_DISABLE_PERF)
-#if defined(ANGLE_DISABLE_TRACE)
+#if defined(ANGLE_ENABLE_PERF)
+#if !defined(ANGLE_ENABLE_TRACE)
if (!perfActive())
{
return;
}
-#endif
+#endif // !ANGLE_ENABLE_TRACE
va_list vararg;
va_start(vararg, format);
output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg);
va_end(vararg);
-#endif
+#endif // ANGLE_ENABLE_PERF
}
ScopedPerfEventHelper::~ScopedPerfEventHelper()
{
-#if !defined(ANGLE_DISABLE_PERF)
+#if defined(ANGLE_ENABLE_PERF)
if (perfActive())
{
D3DPERF_EndEvent();
diff --git a/src/3rdparty/angle/src/common/debug.h b/src/3rdparty/angle/src/common/debug.h
index 23ee26d23b..793843895c 100644
--- a/src/3rdparty/angle/src/common/debug.h
+++ b/src/3rdparty/angle/src/common/debug.h
@@ -39,33 +39,35 @@ namespace gl
}
// A macro to output a trace of a function call and its arguments to the debugging log
-#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
-#define TRACE(message, ...) (void(0))
-#else
+#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
#define TRACE(message, ...) gl::trace(true, "trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+#define TRACE(message, ...) (void(0))
#endif
// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
-#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
-#define FIXME(message, ...) (void(0))
-#else
+#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
#define FIXME(message, ...) gl::trace(false, "fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+#define FIXME(message, ...) (void(0))
#endif
// A macro to output a function call and its arguments to the debugging log, in case of error.
-#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
-#define ERR(message, ...) (void(0))
-#else
+#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
#define ERR(message, ...) gl::trace(false, "err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+#define ERR(message, ...) (void(0))
#endif
// A macro to log a performance event around a scope.
-#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
-#define EVENT(message, ...) (void(0))
-#elif defined(_MSC_VER)
+#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
+#if defined(_MSC_VER)
#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper ## __LINE__(__FUNCTION__ message "\n", __VA_ARGS__);
#else
#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper(message "\n", ##__VA_ARGS__);
+#endif // _MSC_VER
+#else
+#define EVENT(message, ...) (void(0))
#endif
// A macro asserting a condition and outputting failures to the debug log
@@ -99,8 +101,10 @@ namespace gl
#define UNREACHABLE() ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__)
#endif
-// A macro that determines whether an object has a given runtime type.
-#if !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI))
+// A macro that determines whether an object has a given runtime type. MSVC uses _CPPRTTI.
+// GCC uses __GXX_RTTI, but the macro was introduced in version 4.3, so we assume that all older
+// versions support RTTI.
+#if !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI)) && (!defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || defined(__GXX_RTTI))
#define HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast<type >(obj) != NULL)
#else
#define HAS_DYNAMIC_TYPE(type, obj) true
diff --git a/src/3rdparty/angle/src/common/event_tracer.cpp b/src/3rdparty/angle/src/common/event_tracer.cpp
index 96cbb01061..142373d13f 100644
--- a/src/3rdparty/angle/src/common/event_tracer.cpp
+++ b/src/3rdparty/angle/src/common/event_tracer.cpp
@@ -14,7 +14,7 @@ AddTraceEventFunc g_addTraceEvent;
extern "C" {
-void __stdcall SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
+void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
AddTraceEventFunc addTraceEvent)
{
gl::g_getCategoryEnabledFlag = getCategoryEnabledFlag;
diff --git a/src/3rdparty/angle/src/common/event_tracer.h b/src/3rdparty/angle/src/common/event_tracer.h
index ae397e7db9..14b7b298fd 100644
--- a/src/3rdparty/angle/src/common/event_tracer.h
+++ b/src/3rdparty/angle/src/common/event_tracer.h
@@ -5,6 +5,14 @@
#ifndef COMMON_EVENT_TRACER_H_
#define COMMON_EVENT_TRACER_H_
+#if !defined(TRACE_ENTRY)
+#if defined(_WIN32)
+#define TRACE_ENTRY __stdcall
+#else
+#define TRACE_ENTRY
+#endif // // _WIN32
+#endif //TRACE_ENTRY
+
extern "C" {
typedef const unsigned char* (*GetCategoryEnabledFlagFunc)(const char* name);
@@ -14,8 +22,8 @@ typedef void (*AddTraceEventFunc)(char phase, const unsigned char* categoryGroup
unsigned char flags);
// extern "C" so that it has a reasonable name for GetProcAddress.
-void __stdcall SetTraceFunctionPointers(GetCategoryEnabledFlagFunc get_category_enabled_flag,
- AddTraceEventFunc add_trace_event_func);
+void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc get_category_enabled_flag,
+ AddTraceEventFunc add_trace_event_func);
}
diff --git a/src/3rdparty/angle/src/common/system.h b/src/3rdparty/angle/src/common/system.h
deleted file mode 100644
index 5eb140bccd..0000000000
--- a/src/3rdparty/angle/src/common/system.h
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// system.h: Includes Windows system headers and undefines macros that conflict.
-
-#ifndef COMMON_SYSTEM_H
-#define COMMON_SYSTEM_H
-
-#if !defined(WIN32_LEAN_AND_MEAN)
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-
-#if defined(min)
-#undef min
-#endif
-
-#if defined(max)
-#undef max
-#endif
-
-#endif // COMMON_SYSTEM_H
diff --git a/src/3rdparty/angle/src/common/version.h b/src/3rdparty/angle/src/common/version.h
index 7a4942ad88..f6ae19f541 100644
--- a/src/3rdparty/angle/src/common/version.h
+++ b/src/3rdparty/angle/src/common/version.h
@@ -1,12 +1,12 @@
-#define MAJOR_VERSION 1
-#define MINOR_VERSION 2
-#define BUILD_VERSION 0
-#define BUILD_REVISION 2446
+#include "commit.h"
-#define STRINGIFY(x) #x
-#define MACRO_STRINGIFY(x) STRINGIFY(x)
+#define ANGLE_MAJOR_VERSION 1
+#define ANGLE_MINOR_VERSION 3
-#define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
-#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(BUILD_VERSION) "." MACRO_STRINGIFY(BUILD_REVISION)
+#define ANGLE_STRINGIFY(x) #x
+#define ANGLE_MACRO_STRINGIFY(x) ANGLE_STRINGIFY(x)
-#define VERSION_DWORD ((MAJOR_VERSION << 24) | (MINOR_VERSION << 16) | BUILD_REVISION)
+#define ANGLE_VERSION_STRING \
+ ANGLE_MACRO_STRINGIFY(ANGLE_MAJOR_VERSION) "." \
+ ANGLE_MACRO_STRINGIFY(ANGLE_MINOR_VERSION) "." \
+ ANGLE_COMMIT_HASH
diff --git a/src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp b/src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp
deleted file mode 100644
index 637ccc5e37..0000000000
--- a/src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/TranslatorHLSL.h"
-
-//
-// This function must be provided to create the actual
-// compile object used by higher level code. It returns
-// a subclass of TCompiler.
-//
-TCompiler* ConstructCompiler(
- ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
-{
- switch (output)
- {
- case SH_HLSL9_OUTPUT:
- case SH_HLSL11_OUTPUT:
- return new TranslatorHLSL(type, spec, output);
- default:
- return NULL;
- }
-}
-
-//
-// Delete the compiler made by ConstructCompiler
-//
-void DeleteCompiler(TCompiler* compiler)
-{
- delete compiler;
-}
diff --git a/src/3rdparty/angle/src/compiler/DetectRecursion.cpp b/src/3rdparty/angle/src/compiler/DetectRecursion.cpp
deleted file mode 100644
index c09780dd92..0000000000
--- a/src/3rdparty/angle/src/compiler/DetectRecursion.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/DetectRecursion.h"
-
-DetectRecursion::FunctionNode::FunctionNode(const TString& fname)
- : name(fname),
- visit(PreVisit)
-{
-}
-
-const TString& DetectRecursion::FunctionNode::getName() const
-{
- return name;
-}
-
-void DetectRecursion::FunctionNode::addCallee(
- DetectRecursion::FunctionNode* callee)
-{
- for (size_t i = 0; i < callees.size(); ++i) {
- if (callees[i] == callee)
- return;
- }
- callees.push_back(callee);
-}
-
-bool DetectRecursion::FunctionNode::detectRecursion()
-{
- ASSERT(visit == PreVisit);
- visit = InVisit;
- for (size_t i = 0; i < callees.size(); ++i) {
- switch (callees[i]->visit) {
- case InVisit:
- // cycle detected, i.e., recursion detected.
- return true;
- case PostVisit:
- break;
- case PreVisit: {
- bool recursion = callees[i]->detectRecursion();
- if (recursion)
- return true;
- break;
- }
- default:
- UNREACHABLE();
- break;
- }
- }
- visit = PostVisit;
- return false;
-}
-
-DetectRecursion::DetectRecursion()
- : currentFunction(NULL)
-{
-}
-
-DetectRecursion::~DetectRecursion()
-{
- for (size_t i = 0; i < functions.size(); ++i)
- delete functions[i];
-}
-
-bool DetectRecursion::visitAggregate(Visit visit, TIntermAggregate* node)
-{
- switch (node->getOp())
- {
- case EOpPrototype:
- // Function declaration.
- // Don't add FunctionNode here because node->getName() is the
- // unmangled function name.
- break;
- case EOpFunction: {
- // Function definition.
- if (visit == PreVisit) {
- currentFunction = findFunctionByName(node->getName());
- if (currentFunction == NULL) {
- currentFunction = new FunctionNode(node->getName());
- functions.push_back(currentFunction);
- }
- }
- break;
- }
- case EOpFunctionCall: {
- // Function call.
- if (visit == PreVisit) {
- ASSERT(currentFunction != NULL);
- FunctionNode* func = findFunctionByName(node->getName());
- if (func == NULL) {
- func = new FunctionNode(node->getName());
- functions.push_back(func);
- }
- currentFunction->addCallee(func);
- }
- break;
- }
- default:
- break;
- }
- return true;
-}
-
-DetectRecursion::ErrorCode DetectRecursion::detectRecursion()
-{
- FunctionNode* main = findFunctionByName("main(");
- if (main == NULL)
- return kErrorMissingMain;
- if (main->detectRecursion())
- return kErrorRecursion;
- return kErrorNone;
-}
-
-DetectRecursion::FunctionNode* DetectRecursion::findFunctionByName(
- const TString& name)
-{
- for (size_t i = 0; i < functions.size(); ++i) {
- if (functions[i]->getName() == name)
- return functions[i];
- }
- return NULL;
-}
-
diff --git a/src/3rdparty/angle/src/compiler/DetectRecursion.h b/src/3rdparty/angle/src/compiler/DetectRecursion.h
deleted file mode 100644
index bbac79dc9c..0000000000
--- a/src/3rdparty/angle/src/compiler/DetectRecursion.h
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_DETECT_RECURSION_H_
-#define COMPILER_DETECT_RECURSION_H_
-
-#include "GLSLANG/ShaderLang.h"
-
-#include "compiler/intermediate.h"
-#include "compiler/VariableInfo.h"
-
-// Traverses intermediate tree to detect function recursion.
-class DetectRecursion : public TIntermTraverser {
-public:
- enum ErrorCode {
- kErrorMissingMain,
- kErrorRecursion,
- kErrorNone
- };
-
- DetectRecursion();
- ~DetectRecursion();
-
- virtual bool visitAggregate(Visit, TIntermAggregate*);
-
- ErrorCode detectRecursion();
-
-private:
- class FunctionNode {
- public:
- FunctionNode(const TString& fname);
-
- const TString& getName() const;
-
- // If a function is already in the callee list, this becomes a no-op.
- void addCallee(FunctionNode* callee);
-
- // Return true if recursive function calls are detected.
- bool detectRecursion();
-
- private:
- // mangled function name is unique.
- TString name;
-
- // functions that are directly called by this function.
- TVector<FunctionNode*> callees;
-
- Visit visit;
- };
-
- FunctionNode* findFunctionByName(const TString& name);
-
- TVector<FunctionNode*> functions;
- FunctionNode* currentFunction;
-};
-
-#endif // COMPILER_DETECT_RECURSION_H_
diff --git a/src/3rdparty/angle/src/compiler/InitializeGLPosition.cpp b/src/3rdparty/angle/src/compiler/InitializeGLPosition.cpp
deleted file mode 100644
index e0193e39d2..0000000000
--- a/src/3rdparty/angle/src/compiler/InitializeGLPosition.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/InitializeGLPosition.h"
-#include "compiler/debug.h"
-
-bool InitializeGLPosition::visitAggregate(Visit visit, TIntermAggregate* node)
-{
- bool visitChildren = !mCodeInserted;
- switch (node->getOp())
- {
- case EOpSequence: break;
- case EOpFunction:
- {
- // Function definition.
- ASSERT(visit == PreVisit);
- if (node->getName() == "main(")
- {
- TIntermSequence &sequence = node->getSequence();
- ASSERT((sequence.size() == 1) || (sequence.size() == 2));
- TIntermAggregate *body = NULL;
- if (sequence.size() == 1)
- {
- body = new TIntermAggregate(EOpSequence);
- sequence.push_back(body);
- }
- else
- {
- body = sequence[1]->getAsAggregate();
- }
- ASSERT(body);
- insertCode(body->getSequence());
- mCodeInserted = true;
- }
- break;
- }
- default: visitChildren = false; break;
- }
- return visitChildren;
-}
-
-void InitializeGLPosition::insertCode(TIntermSequence& sequence)
-{
- TIntermBinary *binary = new TIntermBinary(EOpAssign);
- sequence.insert(sequence.begin(), binary);
-
- TIntermSymbol *left = new TIntermSymbol(
- 0, "gl_Position", TType(EbtFloat, EbpUndefined, EvqPosition, 4));
- binary->setLeft(left);
-
- ConstantUnion *u = new ConstantUnion[4];
- for (int ii = 0; ii < 3; ++ii)
- u[ii].setFConst(0.0f);
- u[3].setFConst(1.0f);
- TIntermConstantUnion *right = new TIntermConstantUnion(
- u, TType(EbtFloat, EbpUndefined, EvqConst, 4));
- binary->setRight(right);
-}
diff --git a/src/3rdparty/angle/src/compiler/InitializeGLPosition.h b/src/3rdparty/angle/src/compiler/InitializeGLPosition.h
deleted file mode 100644
index 1b11075a13..0000000000
--- a/src/3rdparty/angle/src/compiler/InitializeGLPosition.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_INITIALIZE_GL_POSITION_H_
-#define COMPILER_INITIALIZE_GL_POSITION_H_
-
-#include "compiler/intermediate.h"
-
-class InitializeGLPosition : public TIntermTraverser
-{
-public:
- InitializeGLPosition() : mCodeInserted(false) { }
-
-protected:
- virtual bool visitBinary(Visit visit, TIntermBinary* node) { return false; }
- virtual bool visitUnary(Visit visit, TIntermUnary* node) { return false; }
- virtual bool visitSelection(Visit visit, TIntermSelection* node) { return false; }
- virtual bool visitLoop(Visit visit, TIntermLoop* node) { return false; }
- virtual bool visitBranch(Visit visit, TIntermBranch* node) { return false; }
-
- virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
-
-private:
- // Insert AST node in the beginning of main() for "gl_Position = vec4(0.0, 0.0, 0.0, 1.0);".
- void insertCode(TIntermSequence& sequence);
-
- bool mCodeInserted;
-};
-
-#endif // COMPILER_INITIALIZE_GL_POSITION_H_
diff --git a/src/3rdparty/angle/src/compiler/IntermTraverse.cpp b/src/3rdparty/angle/src/compiler/IntermTraverse.cpp
deleted file mode 100644
index a13877f18f..0000000000
--- a/src/3rdparty/angle/src/compiler/IntermTraverse.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/intermediate.h"
-
-//
-// Traverse the intermediate representation tree, and
-// call a node type specific function for each node.
-// Done recursively through the member function Traverse().
-// Node types can be skipped if their function to call is 0,
-// but their subtree will still be traversed.
-// Nodes with children can have their whole subtree skipped
-// if preVisit is turned on and the type specific function
-// returns false.
-//
-// preVisit, postVisit, and rightToLeft control what order
-// nodes are visited in.
-//
-
-//
-// Traversal functions for terminals are straighforward....
-//
-void TIntermSymbol::traverse(TIntermTraverser* it)
-{
- it->visitSymbol(this);
-}
-
-void TIntermConstantUnion::traverse(TIntermTraverser* it)
-{
- it->visitConstantUnion(this);
-}
-
-//
-// Traverse a binary node.
-//
-void TIntermBinary::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- //
- // visit the node before children if pre-visiting.
- //
- if(it->preVisit)
- {
- visit = it->visitBinary(PreVisit, this);
- }
-
- //
- // Visit the children, in the right order.
- //
- if(visit)
- {
- it->incrementDepth();
-
- if(it->rightToLeft)
- {
- if(right)
- {
- right->traverse(it);
- }
-
- if(it->inVisit)
- {
- visit = it->visitBinary(InVisit, this);
- }
-
- if(visit && left)
- {
- left->traverse(it);
- }
- }
- else
- {
- if(left)
- {
- left->traverse(it);
- }
-
- if(it->inVisit)
- {
- visit = it->visitBinary(InVisit, this);
- }
-
- if(visit && right)
- {
- right->traverse(it);
- }
- }
-
- it->decrementDepth();
- }
-
- //
- // Visit the node after the children, if requested and the traversal
- // hasn't been cancelled yet.
- //
- if(visit && it->postVisit)
- {
- it->visitBinary(PostVisit, this);
- }
-}
-
-//
-// Traverse a unary node. Same comments in binary node apply here.
-//
-void TIntermUnary::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit)
- visit = it->visitUnary(PreVisit, this);
-
- if (visit) {
- it->incrementDepth();
- operand->traverse(it);
- it->decrementDepth();
- }
-
- if (visit && it->postVisit)
- it->visitUnary(PostVisit, this);
-}
-
-//
-// Traverse an aggregate node. Same comments in binary node apply here.
-//
-void TIntermAggregate::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if(it->preVisit)
- {
- visit = it->visitAggregate(PreVisit, this);
- }
-
- if(visit)
- {
- it->incrementDepth();
-
- if(it->rightToLeft)
- {
- for(TIntermSequence::reverse_iterator sit = sequence.rbegin(); sit != sequence.rend(); sit++)
- {
- (*sit)->traverse(it);
-
- if(visit && it->inVisit)
- {
- if(*sit != sequence.front())
- {
- visit = it->visitAggregate(InVisit, this);
- }
- }
- }
- }
- else
- {
- for(TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
- {
- (*sit)->traverse(it);
-
- if(visit && it->inVisit)
- {
- if(*sit != sequence.back())
- {
- visit = it->visitAggregate(InVisit, this);
- }
- }
- }
- }
-
- it->decrementDepth();
- }
-
- if(visit && it->postVisit)
- {
- it->visitAggregate(PostVisit, this);
- }
-}
-
-//
-// Traverse a selection node. Same comments in binary node apply here.
-//
-void TIntermSelection::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit)
- visit = it->visitSelection(PreVisit, this);
-
- if (visit) {
- it->incrementDepth();
- if (it->rightToLeft) {
- if (falseBlock)
- falseBlock->traverse(it);
- if (trueBlock)
- trueBlock->traverse(it);
- condition->traverse(it);
- } else {
- condition->traverse(it);
- if (trueBlock)
- trueBlock->traverse(it);
- if (falseBlock)
- falseBlock->traverse(it);
- }
- it->decrementDepth();
- }
-
- if (visit && it->postVisit)
- it->visitSelection(PostVisit, this);
-}
-
-//
-// Traverse a loop node. Same comments in binary node apply here.
-//
-void TIntermLoop::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if(it->preVisit)
- {
- visit = it->visitLoop(PreVisit, this);
- }
-
- if(visit)
- {
- it->incrementDepth();
-
- if(it->rightToLeft)
- {
- if(expr)
- {
- expr->traverse(it);
- }
-
- if(body)
- {
- body->traverse(it);
- }
-
- if(cond)
- {
- cond->traverse(it);
- }
- }
- else
- {
- if(cond)
- {
- cond->traverse(it);
- }
-
- if(body)
- {
- body->traverse(it);
- }
-
- if(expr)
- {
- expr->traverse(it);
- }
- }
-
- it->decrementDepth();
- }
-
- if(visit && it->postVisit)
- {
- it->visitLoop(PostVisit, this);
- }
-}
-
-//
-// Traverse a branch node. Same comments in binary node apply here.
-//
-void TIntermBranch::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit)
- visit = it->visitBranch(PreVisit, this);
-
- if (visit && expression) {
- it->incrementDepth();
- expression->traverse(it);
- it->decrementDepth();
- }
-
- if (visit && it->postVisit)
- it->visitBranch(PostVisit, this);
-}
-
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
index 3e22e1f1c5..a7ce862bcb 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
@@ -25,14 +25,14 @@ void Diagnostics::report(ID id,
Diagnostics::Severity Diagnostics::severity(ID id)
{
- if ((id > ERROR_BEGIN) && (id < ERROR_END))
- return ERROR;
+ if ((id > PP_ERROR_BEGIN) && (id < PP_ERROR_END))
+ return PP_ERROR;
- if ((id > WARNING_BEGIN) && (id < WARNING_END))
- return WARNING;
+ if ((id > PP_WARNING_BEGIN) && (id < PP_WARNING_END))
+ return PP_WARNING;
assert(false);
- return ERROR;
+ return PP_ERROR;
}
std::string Diagnostics::message(ID id)
@@ -40,82 +40,82 @@ std::string Diagnostics::message(ID id)
switch (id)
{
// Errors begin.
- case INTERNAL_ERROR:
+ case PP_INTERNAL_ERROR:
return "internal error";
- case OUT_OF_MEMORY:
+ case PP_OUT_OF_MEMORY:
return "out of memory";
- case INVALID_CHARACTER:
+ case PP_INVALID_CHARACTER:
return "invalid character";
- case INVALID_NUMBER:
+ case PP_INVALID_NUMBER:
return "invalid number";
- case INTEGER_OVERFLOW:
+ case PP_INTEGER_OVERFLOW:
return "integer overflow";
- case FLOAT_OVERFLOW:
+ case PP_FLOAT_OVERFLOW:
return "float overflow";
- case TOKEN_TOO_LONG:
+ case PP_TOKEN_TOO_LONG:
return "token too long";
- case INVALID_EXPRESSION:
+ case PP_INVALID_EXPRESSION:
return "invalid expression";
- case DIVISION_BY_ZERO:
+ case PP_DIVISION_BY_ZERO:
return "division by zero";
- case EOF_IN_COMMENT:
+ case PP_EOF_IN_COMMENT:
return "unexpected end of file found in comment";
- case UNEXPECTED_TOKEN:
+ case PP_UNEXPECTED_TOKEN:
return "unexpected token";
- case DIRECTIVE_INVALID_NAME:
+ case PP_DIRECTIVE_INVALID_NAME:
return "invalid directive name";
- case MACRO_NAME_RESERVED:
+ case PP_MACRO_NAME_RESERVED:
return "macro name is reserved";
- case MACRO_REDEFINED:
+ case PP_MACRO_REDEFINED:
return "macro redefined";
- case MACRO_PREDEFINED_REDEFINED:
+ case PP_MACRO_PREDEFINED_REDEFINED:
return "predefined macro redefined";
- case MACRO_PREDEFINED_UNDEFINED:
+ case PP_MACRO_PREDEFINED_UNDEFINED:
return "predefined macro undefined";
- case MACRO_UNTERMINATED_INVOCATION:
+ case PP_MACRO_UNTERMINATED_INVOCATION:
return "unterminated macro invocation";
- case MACRO_TOO_FEW_ARGS:
+ case PP_MACRO_TOO_FEW_ARGS:
return "Not enough arguments for macro";
- case MACRO_TOO_MANY_ARGS:
+ case PP_MACRO_TOO_MANY_ARGS:
return "Too many arguments for macro";
- case CONDITIONAL_ENDIF_WITHOUT_IF:
+ case PP_CONDITIONAL_ENDIF_WITHOUT_IF:
return "unexpected #endif found without a matching #if";
- case CONDITIONAL_ELSE_WITHOUT_IF:
+ case PP_CONDITIONAL_ELSE_WITHOUT_IF:
return "unexpected #else found without a matching #if";
- case CONDITIONAL_ELSE_AFTER_ELSE:
+ case PP_CONDITIONAL_ELSE_AFTER_ELSE:
return "unexpected #else found after another #else";
- case CONDITIONAL_ELIF_WITHOUT_IF:
+ case PP_CONDITIONAL_ELIF_WITHOUT_IF:
return "unexpected #elif found without a matching #if";
- case CONDITIONAL_ELIF_AFTER_ELSE:
+ case PP_CONDITIONAL_ELIF_AFTER_ELSE:
return "unexpected #elif found after #else";
- case CONDITIONAL_UNTERMINATED:
+ case PP_CONDITIONAL_UNTERMINATED:
return "unexpected end of file found in conditional block";
- case INVALID_EXTENSION_NAME:
+ case PP_INVALID_EXTENSION_NAME:
return "invalid extension name";
- case INVALID_EXTENSION_BEHAVIOR:
+ case PP_INVALID_EXTENSION_BEHAVIOR:
return "invalid extension behavior";
- case INVALID_EXTENSION_DIRECTIVE:
+ case PP_INVALID_EXTENSION_DIRECTIVE:
return "invalid extension directive";
- case INVALID_VERSION_NUMBER:
+ case PP_INVALID_VERSION_NUMBER:
return "invalid version number";
- case INVALID_VERSION_DIRECTIVE:
+ case PP_INVALID_VERSION_DIRECTIVE:
return "invalid version directive";
- case VERSION_NOT_FIRST_STATEMENT:
+ case PP_VERSION_NOT_FIRST_STATEMENT:
return "#version directive must occur before anything else, "
"except for comments and white space";
- case INVALID_LINE_NUMBER:
+ case PP_INVALID_LINE_NUMBER:
return "invalid line number";
- case INVALID_FILE_NUMBER:
+ case PP_INVALID_FILE_NUMBER:
return "invalid file number";
- case INVALID_LINE_DIRECTIVE:
+ case PP_INVALID_LINE_DIRECTIVE:
return "invalid line directive";
// Errors end.
// Warnings begin.
- case EOF_IN_DIRECTIVE:
+ case PP_EOF_IN_DIRECTIVE:
return "unexpected end of file found in directive";
- case CONDITIONAL_UNEXPECTED_TOKEN:
+ case PP_CONDITIONAL_UNEXPECTED_TOKEN:
return "unexpected token after conditional expression";
- case UNRECOGNIZED_PRAGMA:
+ case PP_UNRECOGNIZED_PRAGMA:
return "unrecognized pragma";
// Warnings end.
default:
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
index 07bc411846..2c8c539137 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DiagnosticsBase.h
@@ -21,53 +21,53 @@ class Diagnostics
public:
enum Severity
{
- ERROR,
- WARNING
+ PP_ERROR,
+ PP_WARNING
};
enum ID
{
- ERROR_BEGIN,
- INTERNAL_ERROR,
- OUT_OF_MEMORY,
- INVALID_CHARACTER,
- INVALID_NUMBER,
- INTEGER_OVERFLOW,
- FLOAT_OVERFLOW,
- TOKEN_TOO_LONG,
- INVALID_EXPRESSION,
- DIVISION_BY_ZERO,
- EOF_IN_COMMENT,
- UNEXPECTED_TOKEN,
- DIRECTIVE_INVALID_NAME,
- MACRO_NAME_RESERVED,
- MACRO_REDEFINED,
- MACRO_PREDEFINED_REDEFINED,
- MACRO_PREDEFINED_UNDEFINED,
- MACRO_UNTERMINATED_INVOCATION,
- MACRO_TOO_FEW_ARGS,
- MACRO_TOO_MANY_ARGS,
- CONDITIONAL_ENDIF_WITHOUT_IF,
- CONDITIONAL_ELSE_WITHOUT_IF,
- CONDITIONAL_ELSE_AFTER_ELSE,
- CONDITIONAL_ELIF_WITHOUT_IF,
- CONDITIONAL_ELIF_AFTER_ELSE,
- CONDITIONAL_UNTERMINATED,
- INVALID_EXTENSION_NAME,
- INVALID_EXTENSION_BEHAVIOR,
- INVALID_EXTENSION_DIRECTIVE,
- INVALID_VERSION_NUMBER,
- INVALID_VERSION_DIRECTIVE,
- VERSION_NOT_FIRST_STATEMENT,
- INVALID_LINE_NUMBER,
- INVALID_FILE_NUMBER,
- INVALID_LINE_DIRECTIVE,
- ERROR_END,
+ PP_ERROR_BEGIN,
+ PP_INTERNAL_ERROR,
+ PP_OUT_OF_MEMORY,
+ PP_INVALID_CHARACTER,
+ PP_INVALID_NUMBER,
+ PP_INTEGER_OVERFLOW,
+ PP_FLOAT_OVERFLOW,
+ PP_TOKEN_TOO_LONG,
+ PP_INVALID_EXPRESSION,
+ PP_DIVISION_BY_ZERO,
+ PP_EOF_IN_COMMENT,
+ PP_UNEXPECTED_TOKEN,
+ PP_DIRECTIVE_INVALID_NAME,
+ PP_MACRO_NAME_RESERVED,
+ PP_MACRO_REDEFINED,
+ PP_MACRO_PREDEFINED_REDEFINED,
+ PP_MACRO_PREDEFINED_UNDEFINED,
+ PP_MACRO_UNTERMINATED_INVOCATION,
+ PP_MACRO_TOO_FEW_ARGS,
+ PP_MACRO_TOO_MANY_ARGS,
+ PP_CONDITIONAL_ENDIF_WITHOUT_IF,
+ PP_CONDITIONAL_ELSE_WITHOUT_IF,
+ PP_CONDITIONAL_ELSE_AFTER_ELSE,
+ PP_CONDITIONAL_ELIF_WITHOUT_IF,
+ PP_CONDITIONAL_ELIF_AFTER_ELSE,
+ PP_CONDITIONAL_UNTERMINATED,
+ PP_INVALID_EXTENSION_NAME,
+ PP_INVALID_EXTENSION_BEHAVIOR,
+ PP_INVALID_EXTENSION_DIRECTIVE,
+ PP_INVALID_VERSION_NUMBER,
+ PP_INVALID_VERSION_DIRECTIVE,
+ PP_VERSION_NOT_FIRST_STATEMENT,
+ PP_INVALID_LINE_NUMBER,
+ PP_INVALID_FILE_NUMBER,
+ PP_INVALID_LINE_DIRECTIVE,
+ PP_ERROR_END,
- WARNING_BEGIN,
- EOF_IN_DIRECTIVE,
- CONDITIONAL_UNEXPECTED_TOKEN,
- UNRECOGNIZED_PRAGMA,
- WARNING_END
+ PP_WARNING_BEGIN,
+ PP_EOF_IN_DIRECTIVE,
+ PP_CONDITIONAL_UNEXPECTED_TOKEN,
+ PP_UNRECOGNIZED_PRAGMA,
+ PP_WARNING_END
};
virtual ~Diagnostics();
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
index 94dfdf513d..ebec79804d 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/DirectiveParser.cpp
@@ -172,7 +172,7 @@ class DefinedParser : public Lexer
if (token->type != Token::IDENTIFIER)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mLexer, token);
return;
@@ -185,7 +185,7 @@ class DefinedParser : public Lexer
mLexer->lex(token);
if (token->type != ')')
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mLexer, token);
return;
@@ -233,7 +233,7 @@ void DirectiveParser::lex(Token* token)
if (!mConditionalStack.empty())
{
const ConditionalBlock& block = mConditionalStack.back();
- mDiagnostics->report(Diagnostics::CONDITIONAL_UNTERMINATED,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNTERMINATED,
block.location, block.type);
}
break;
@@ -268,7 +268,7 @@ void DirectiveParser::parseDirective(Token* token)
switch(directive)
{
case DIRECTIVE_NONE:
- mDiagnostics->report(Diagnostics::DIRECTIVE_INVALID_NAME,
+ mDiagnostics->report(Diagnostics::PP_DIRECTIVE_INVALID_NAME,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
break;
@@ -319,7 +319,7 @@ void DirectiveParser::parseDirective(Token* token)
skipUntilEOD(mTokenizer, token);
if (token->type == Token::LAST)
{
- mDiagnostics->report(Diagnostics::EOF_IN_DIRECTIVE,
+ mDiagnostics->report(Diagnostics::PP_EOF_IN_DIRECTIVE,
token->location, token->text);
}
}
@@ -331,19 +331,19 @@ void DirectiveParser::parseDefine(Token* token)
mTokenizer->lex(token);
if (token->type != Token::IDENTIFIER)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
return;
}
if (isMacroPredefined(token->text, *mMacroSet))
{
- mDiagnostics->report(Diagnostics::MACRO_PREDEFINED_REDEFINED,
+ mDiagnostics->report(Diagnostics::PP_MACRO_PREDEFINED_REDEFINED,
token->location, token->text);
return;
}
if (isMacroNameReserved(token->text))
{
- mDiagnostics->report(Diagnostics::MACRO_NAME_RESERVED,
+ mDiagnostics->report(Diagnostics::PP_MACRO_NAME_RESERVED,
token->location, token->text);
return;
}
@@ -368,7 +368,7 @@ void DirectiveParser::parseDefine(Token* token)
if (token->type != ')')
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location,
token->text);
return;
@@ -396,7 +396,7 @@ void DirectiveParser::parseDefine(Token* token)
MacroSet::const_iterator iter = mMacroSet->find(macro.name);
if (iter != mMacroSet->end() && !macro.equals(iter->second))
{
- mDiagnostics->report(Diagnostics::MACRO_REDEFINED,
+ mDiagnostics->report(Diagnostics::PP_MACRO_REDEFINED,
token->location,
macro.name);
return;
@@ -411,7 +411,7 @@ void DirectiveParser::parseUndef(Token* token)
mTokenizer->lex(token);
if (token->type != Token::IDENTIFIER)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
return;
}
@@ -421,7 +421,7 @@ void DirectiveParser::parseUndef(Token* token)
{
if (iter->second.predefined)
{
- mDiagnostics->report(Diagnostics::MACRO_PREDEFINED_UNDEFINED,
+ mDiagnostics->report(Diagnostics::PP_MACRO_PREDEFINED_UNDEFINED,
token->location, token->text);
}
else
@@ -457,7 +457,7 @@ void DirectiveParser::parseElse(Token* token)
if (mConditionalStack.empty())
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_ELSE_WITHOUT_IF,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELSE_WITHOUT_IF,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
@@ -472,7 +472,7 @@ void DirectiveParser::parseElse(Token* token)
}
if (block.foundElseGroup)
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_ELSE_AFTER_ELSE,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELSE_AFTER_ELSE,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
@@ -486,7 +486,7 @@ void DirectiveParser::parseElse(Token* token)
mTokenizer->lex(token);
if (!isEOD(token))
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
}
@@ -498,7 +498,7 @@ void DirectiveParser::parseElif(Token* token)
if (mConditionalStack.empty())
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_ELIF_WITHOUT_IF,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELIF_WITHOUT_IF,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
@@ -513,7 +513,7 @@ void DirectiveParser::parseElif(Token* token)
}
if (block.foundElseGroup)
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_ELIF_AFTER_ELSE,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELIF_AFTER_ELSE,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
@@ -538,7 +538,7 @@ void DirectiveParser::parseEndif(Token* token)
if (mConditionalStack.empty())
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_ENDIF_WITHOUT_IF,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ENDIF_WITHOUT_IF,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
@@ -550,7 +550,7 @@ void DirectiveParser::parseEndif(Token* token)
mTokenizer->lex(token);
if (!isEOD(token))
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
}
@@ -618,7 +618,7 @@ void DirectiveParser::parsePragma(Token* token)
(state == RIGHT_PAREN + 1)); // With value.
if (!valid)
{
- mDiagnostics->report(Diagnostics::UNRECOGNIZED_PRAGMA,
+ mDiagnostics->report(Diagnostics::PP_UNRECOGNIZED_PRAGMA,
token->location, name);
}
else if (state > PRAGMA_NAME) // Do not notify for empty pragma.
@@ -650,7 +650,7 @@ void DirectiveParser::parseExtension(Token* token)
case EXT_NAME:
if (valid && (token->type != Token::IDENTIFIER))
{
- mDiagnostics->report(Diagnostics::INVALID_EXTENSION_NAME,
+ mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_NAME,
token->location, token->text);
valid = false;
}
@@ -659,7 +659,7 @@ void DirectiveParser::parseExtension(Token* token)
case COLON:
if (valid && (token->type != ':'))
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
valid = false;
}
@@ -667,7 +667,7 @@ void DirectiveParser::parseExtension(Token* token)
case EXT_BEHAVIOR:
if (valid && (token->type != Token::IDENTIFIER))
{
- mDiagnostics->report(Diagnostics::INVALID_EXTENSION_BEHAVIOR,
+ mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_BEHAVIOR,
token->location, token->text);
valid = false;
}
@@ -676,7 +676,7 @@ void DirectiveParser::parseExtension(Token* token)
default:
if (valid)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
valid = false;
}
@@ -686,7 +686,7 @@ void DirectiveParser::parseExtension(Token* token)
}
if (valid && (state != EXT_BEHAVIOR + 1))
{
- mDiagnostics->report(Diagnostics::INVALID_EXTENSION_DIRECTIVE,
+ mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_DIRECTIVE,
token->location, token->text);
valid = false;
}
@@ -700,7 +700,7 @@ void DirectiveParser::parseVersion(Token* token)
if (mPastFirstStatement)
{
- mDiagnostics->report(Diagnostics::VERSION_NOT_FIRST_STATEMENT,
+ mDiagnostics->report(Diagnostics::PP_VERSION_NOT_FIRST_STATEMENT,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
@@ -723,13 +723,13 @@ void DirectiveParser::parseVersion(Token* token)
case VERSION_NUMBER:
if (valid && (token->type != Token::CONST_INT))
{
- mDiagnostics->report(Diagnostics::INVALID_VERSION_NUMBER,
+ mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_NUMBER,
token->location, token->text);
valid = false;
}
if (valid && !token->iValue(&version))
{
- mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
+ mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
valid = false;
}
@@ -737,7 +737,7 @@ void DirectiveParser::parseVersion(Token* token)
default:
if (valid)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
valid = false;
}
@@ -747,7 +747,7 @@ void DirectiveParser::parseVersion(Token* token)
}
if (valid && (state != VERSION_NUMBER + 1))
{
- mDiagnostics->report(Diagnostics::INVALID_VERSION_DIRECTIVE,
+ mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE,
token->location, token->text);
valid = false;
}
@@ -778,13 +778,13 @@ void DirectiveParser::parseLine(Token* token)
case LINE_NUMBER:
if (valid && (token->type != Token::CONST_INT))
{
- mDiagnostics->report(Diagnostics::INVALID_LINE_NUMBER,
+ mDiagnostics->report(Diagnostics::PP_INVALID_LINE_NUMBER,
token->location, token->text);
valid = false;
}
if (valid && !token->iValue(&line))
{
- mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
+ mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
valid = false;
}
@@ -792,13 +792,13 @@ void DirectiveParser::parseLine(Token* token)
case FILE_NUMBER:
if (valid && (token->type != Token::CONST_INT))
{
- mDiagnostics->report(Diagnostics::INVALID_FILE_NUMBER,
+ mDiagnostics->report(Diagnostics::PP_INVALID_FILE_NUMBER,
token->location, token->text);
valid = false;
}
if (valid && !token->iValue(&file))
{
- mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
+ mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
valid = false;
}
@@ -806,7 +806,7 @@ void DirectiveParser::parseLine(Token* token)
default:
if (valid)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
valid = false;
}
@@ -817,7 +817,7 @@ void DirectiveParser::parseLine(Token* token)
if (valid && (state != FILE_NUMBER) && (state != FILE_NUMBER + 1))
{
- mDiagnostics->report(Diagnostics::INVALID_LINE_DIRECTIVE,
+ mDiagnostics->report(Diagnostics::PP_INVALID_LINE_DIRECTIVE,
token->location, token->text);
valid = false;
}
@@ -893,7 +893,7 @@ int DirectiveParser::parseExpressionIf(Token* token)
// Warn if there are tokens after #if expression.
if (!isEOD(token))
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
}
@@ -909,7 +909,7 @@ int DirectiveParser::parseExpressionIfdef(Token* token)
mTokenizer->lex(token);
if (token->type != Token::IDENTIFIER)
{
- mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return 0;
@@ -922,7 +922,7 @@ int DirectiveParser::parseExpressionIfdef(Token* token)
mTokenizer->lex(token);
if (!isEOD(token))
{
- mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
}
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
index b6d3143e60..9fa0f0bf80 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
+++ b/src/3rdparty/angle/src/compiler/preprocessor/ExpressionParser.y
@@ -33,6 +33,12 @@ WHICH GENERATES THE GLSL ES preprocessor expression parser.
#include "ExpressionParser.h"
+#if defined(_MSC_VER)
+#include <malloc.h>
+#else
+#include <stdlib.h>
+#endif
+
#include <cassert>
#include <sstream>
@@ -146,7 +152,7 @@ expression
std::ostringstream stream;
stream << $1 << " % " << $3;
std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
+ context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
context->token->location,
text.c_str());
YYABORT;
@@ -159,7 +165,7 @@ expression
std::ostringstream stream;
stream << $1 << " / " << $3;
std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
+ context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
context->token->location,
text.c_str());
YYABORT;
@@ -201,7 +207,7 @@ int yylex(YYSTYPE* lvalp, Context* context)
unsigned int val = 0;
if (!token->uValue(&val))
{
- context->diagnostics->report(pp::Diagnostics::INTEGER_OVERFLOW,
+ context->diagnostics->report(pp::Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
}
*lvalp = static_cast<YYSTYPE>(val);
@@ -242,7 +248,7 @@ int yylex(YYSTYPE* lvalp, Context* context)
void yyerror(Context* context, const char* reason)
{
- context->diagnostics->report(pp::Diagnostics::INVALID_EXPRESSION,
+ context->diagnostics->report(pp::Diagnostics::PP_INVALID_EXPRESSION,
context->token->location,
reason);
}
@@ -270,12 +276,12 @@ bool ExpressionParser::parse(Token* token, int* result)
break;
case 2:
- mDiagnostics->report(Diagnostics::OUT_OF_MEMORY, token->location, "");
+ mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token->location, "");
break;
default:
assert(false);
- mDiagnostics->report(Diagnostics::INTERNAL_ERROR, token->location, "");
+ mDiagnostics->report(Diagnostics::PP_INTERNAL_ERROR, token->location, "");
break;
}
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
index 1116c516ff..b789260af9 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/MacroExpander.cpp
@@ -254,7 +254,7 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
if (token.type == Token::LAST)
{
- mDiagnostics->report(Diagnostics::MACRO_UNTERMINATED_INVOCATION,
+ mDiagnostics->report(Diagnostics::PP_MACRO_UNTERMINATED_INVOCATION,
identifier.location, identifier.text);
// Do not lose EOF token.
ungetToken(token);
@@ -302,8 +302,8 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
if (args->size() != params.size())
{
Diagnostics::ID id = args->size() < macro.parameters.size() ?
- Diagnostics::MACRO_TOO_FEW_ARGS :
- Diagnostics::MACRO_TOO_MANY_ARGS;
+ Diagnostics::PP_MACRO_TOO_FEW_ARGS :
+ Diagnostics::PP_MACRO_TOO_MANY_ARGS;
mDiagnostics->report(id, identifier.location, identifier.text);
return false;
}
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
index b615c85dce..580ffba459 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Preprocessor.cpp
@@ -101,11 +101,11 @@ void Preprocessor::lex(Token* token)
assert(false);
break;
case Token::PP_NUMBER:
- mImpl->diagnostics->report(Diagnostics::INVALID_NUMBER,
+ mImpl->diagnostics->report(Diagnostics::PP_INVALID_NUMBER,
token->location, token->text);
break;
case Token::PP_OTHER:
- mImpl->diagnostics->report(Diagnostics::INVALID_CHARACTER,
+ mImpl->diagnostics->report(Diagnostics::PP_INVALID_CHARACTER,
token->location, token->text);
break;
default:
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
index 01f0177b6c..f1380b26b7 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
+++ b/src/3rdparty/angle/src/compiler/preprocessor/Tokenizer.l
@@ -256,7 +256,7 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
if (YY_START == COMMENT)
{
- yyextra->diagnostics->report(pp::Diagnostics::EOF_IN_COMMENT,
+ yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
pp::SourceLocation(yyfileno, yylineno),
"");
}
@@ -304,7 +304,7 @@ void Tokenizer::lex(Token* token)
token->type = yylex(&token->text, &token->location, mHandle);
if (token->text.size() > mMaxTokenLength)
{
- mContext.diagnostics->report(Diagnostics::TOKEN_TOO_LONG,
+ mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
token->location, token->text);
token->text.erase(mMaxTokenLength);
}
diff --git a/src/3rdparty/angle/src/compiler/BaseTypes.h b/src/3rdparty/angle/src/compiler/translator/BaseTypes.h
index 1631f4f779..7bdaf14983 100644
--- a/src/3rdparty/angle/src/compiler/BaseTypes.h
+++ b/src/3rdparty/angle/src/compiler/translator/BaseTypes.h
@@ -82,6 +82,7 @@ enum TQualifier
{
EvqTemporary, // For temporaries (within a function), read/write
EvqGlobal, // For globals read/write
+ EvqInternal, // For internal use, not visible to the user
EvqConst, // User defined constants and non-output parameters in functions
EvqAttribute, // Readonly
EvqVaryingIn, // readonly, fragment shaders only
diff --git a/src/3rdparty/angle/src/compiler/BuiltInFunctionEmulator.cpp b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp
index 1c4b25f13f..92b71c6bdb 100644
--- a/src/3rdparty/angle/src/compiler/BuiltInFunctionEmulator.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp
@@ -4,9 +4,9 @@
// found in the LICENSE file.
//
-#include "compiler/BuiltInFunctionEmulator.h"
+#include "compiler/translator/BuiltInFunctionEmulator.h"
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/SymbolTable.h"
namespace {
diff --git a/src/3rdparty/angle/src/compiler/BuiltInFunctionEmulator.h b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h
index 0d904f41d0..cfb71a803a 100644
--- a/src/3rdparty/angle/src/compiler/BuiltInFunctionEmulator.h
+++ b/src/3rdparty/angle/src/compiler/translator/BuiltInFunctionEmulator.h
@@ -9,8 +9,8 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/InfoSink.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/intermediate.h"
//
// This class decides which built-in functions need to be replaced with the
diff --git a/src/3rdparty/angle/src/compiler/CodeGenGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/CodeGen.cpp
index 226bf8f0fc..8f5d129104 100644
--- a/src/3rdparty/angle/src/compiler/CodeGenGLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/CodeGen.cpp
@@ -4,8 +4,9 @@
// found in the LICENSE file.
//
-#include "compiler/TranslatorGLSL.h"
-#include "compiler/TranslatorESSL.h"
+#include "compiler/translator/TranslatorESSL.h"
+#include "compiler/translator/TranslatorGLSL.h"
+#include "compiler/translator/TranslatorHLSL.h"
//
// This function must be provided to create the actual
@@ -16,10 +17,13 @@ TCompiler* ConstructCompiler(
ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
{
switch (output) {
- case SH_GLSL_OUTPUT:
- return new TranslatorGLSL(type, spec);
case SH_ESSL_OUTPUT:
return new TranslatorESSL(type, spec);
+ case SH_GLSL_OUTPUT:
+ return new TranslatorGLSL(type, spec);
+ case SH_HLSL9_OUTPUT:
+ case SH_HLSL11_OUTPUT:
+ return new TranslatorHLSL(type, spec, output);
default:
return NULL;
}
diff --git a/src/3rdparty/angle/src/compiler/Common.h b/src/3rdparty/angle/src/compiler/translator/Common.h
index 46f9440fff..1e4503e340 100644
--- a/src/3rdparty/angle/src/compiler/Common.h
+++ b/src/3rdparty/angle/src/compiler/translator/Common.h
@@ -11,8 +11,12 @@
#include <sstream>
#include <string>
#include <vector>
+#include <limits>
+#include <stdio.h>
-#include "compiler/PoolAlloc.h"
+#include "compiler/translator/PoolAlloc.h"
+#include "compiler/translator/compilerdebug.h"
+#include "common/angleutils.h"
struct TSourceLoc {
int first_file;
@@ -74,4 +78,15 @@ public:
TMap(const tAllocator& a) : std::map<K, D, CMP, tAllocator>(std::map<K, D, CMP, tAllocator>::key_compare(), a) {}
};
+// Integer to TString conversion
+template <typename T>
+inline TString str(T i)
+{
+ ASSERT(std::numeric_limits<T>::is_integer);
+ char buffer[((8 * sizeof(T)) / 3) + 3];
+ const char *formatStr = std::numeric_limits<T>::is_signed ? "%d" : "%u";
+ snprintf(buffer, sizeof(buffer), formatStr, i);
+ return buffer;
+}
+
#endif // _COMMON_INCLUDED_
diff --git a/src/3rdparty/angle/src/compiler/Compiler.cpp b/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
index ee64057ac4..eb7465e35c 100644
--- a/src/3rdparty/angle/src/compiler/Compiler.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
@@ -4,22 +4,23 @@
// found in the LICENSE file.
//
-#include "compiler/BuiltInFunctionEmulator.h"
-#include "compiler/DetectCallDepth.h"
-#include "compiler/ForLoopUnroll.h"
-#include "compiler/Initialize.h"
-#include "compiler/InitializeGLPosition.h"
-#include "compiler/InitializeParseContext.h"
-#include "compiler/MapLongVariableNames.h"
-#include "compiler/ParseHelper.h"
-#include "compiler/RenameFunction.h"
-#include "compiler/ShHandle.h"
-#include "compiler/ValidateLimitations.h"
-#include "compiler/VariablePacker.h"
-#include "compiler/depgraph/DependencyGraph.h"
-#include "compiler/depgraph/DependencyGraphOutput.h"
-#include "compiler/timing/RestrictFragmentShaderTiming.h"
-#include "compiler/timing/RestrictVertexShaderTiming.h"
+#include "compiler/translator/BuiltInFunctionEmulator.h"
+#include "compiler/translator/DetectCallDepth.h"
+#include "compiler/translator/ForLoopUnroll.h"
+#include "compiler/translator/Initialize.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/InitializeVariables.h"
+#include "compiler/translator/MapLongVariableNames.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/RenameFunction.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/UnfoldShortCircuitAST.h"
+#include "compiler/translator/ValidateLimitations.h"
+#include "compiler/translator/VariablePacker.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
+#include "compiler/translator/depgraph/DependencyGraphOutput.h"
+#include "compiler/translator/timing/RestrictFragmentShaderTiming.h"
+#include "compiler/translator/timing/RestrictVertexShaderTiming.h"
#include "third_party/compiler/ArrayBoundsClamper.h"
bool isWebGLBasedSpec(ShShaderSpec spec)
@@ -28,43 +29,51 @@ bool isWebGLBasedSpec(ShShaderSpec spec)
}
namespace {
-class TScopedPoolAllocator {
-public:
- TScopedPoolAllocator(TPoolAllocator* allocator) : mAllocator(allocator) {
+class TScopedPoolAllocator
+{
+ public:
+ TScopedPoolAllocator(TPoolAllocator* allocator) : mAllocator(allocator)
+ {
mAllocator->push();
SetGlobalPoolAllocator(mAllocator);
}
- ~TScopedPoolAllocator() {
+ ~TScopedPoolAllocator()
+ {
SetGlobalPoolAllocator(NULL);
mAllocator->pop();
}
-private:
+ private:
TPoolAllocator* mAllocator;
};
-class TScopedSymbolTableLevel {
-public:
- TScopedSymbolTableLevel(TSymbolTable* table) : mTable(table) {
+class TScopedSymbolTableLevel
+{
+ public:
+ TScopedSymbolTableLevel(TSymbolTable* table) : mTable(table)
+ {
ASSERT(mTable->atBuiltInLevel());
mTable->push();
}
- ~TScopedSymbolTableLevel() {
+ ~TScopedSymbolTableLevel()
+ {
while (!mTable->atBuiltInLevel())
mTable->pop();
}
-private:
+ private:
TSymbolTable* mTable;
};
} // namespace
-TShHandleBase::TShHandleBase() {
+TShHandleBase::TShHandleBase()
+{
allocator.push();
SetGlobalPoolAllocator(&allocator);
}
-TShHandleBase::~TShHandleBase() {
+TShHandleBase::~TShHandleBase()
+{
SetGlobalPoolAllocator(NULL);
allocator.popAll();
}
@@ -150,7 +159,8 @@ bool TCompiler::compile(const char* const shaderStrings[],
bool success =
(PaParseStrings(numStrings - firstSource, &shaderStrings[firstSource], NULL, &parseContext) == 0) &&
(parseContext.treeRoot != NULL);
- if (success) {
+ if (success)
+ {
TIntermNode* root = parseContext.treeRoot;
success = intermediate.postProcess(root);
@@ -189,20 +199,31 @@ bool TCompiler::compile(const char* const shaderStrings[],
if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) && hashFunction == NULL)
mapLongVariableNames(root);
- if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION)) {
- InitializeGLPosition initGLPosition;
- root->traverse(&initGLPosition);
+ if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION))
+ initializeGLPosition(root);
+
+ if (success && (compileOptions & SH_UNFOLD_SHORT_CIRCUIT))
+ {
+ UnfoldShortCircuitAST unfoldShortCircuit;
+ root->traverse(&unfoldShortCircuit);
+ unfoldShortCircuit.updateTree();
}
- if (success && (compileOptions & SH_VARIABLES)) {
+ if (success && (compileOptions & SH_VARIABLES))
+ {
collectVariables(root);
- if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS) {
+ if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS)
+ {
success = enforcePackingRestrictions();
- if (!success) {
+ if (!success)
+ {
infoSink.info.prefix(EPrefixError);
infoSink.info << "too many uniforms";
}
}
+ if (success && shaderType == SH_VERTEX_SHADER &&
+ (compileOptions & SH_INIT_VARYINGS_WITHOUT_STATIC_USE))
+ initializeVaryingsWithoutStaticUse(root);
}
if (success && (compileOptions & SH_INTERMEDIATE_TREE))
@@ -251,12 +272,14 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
symbolTable.setDefaultPrecision(integer, EbpHigh);
symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
break;
- default: assert(false && "Language not supported");
+ default:
+ assert(false && "Language not supported");
}
// We set defaults for all the sampler types, even those that are
// only available if an extension exists.
for (int samplerType = EbtGuardSamplerBegin + 1;
- samplerType < EbtGuardSamplerEnd; ++samplerType) {
+ samplerType < EbtGuardSamplerEnd; ++samplerType)
+ {
sampler.type = static_cast<TBasicType>(samplerType);
symbolTable.setDefaultPrecision(sampler, EbpLow);
}
@@ -288,24 +311,25 @@ bool TCompiler::detectCallDepth(TIntermNode* root, TInfoSink& infoSink, bool lim
{
DetectCallDepth detect(infoSink, limitCallStackDepth, maxCallStackDepth);
root->traverse(&detect);
- switch (detect.detectCallDepth()) {
- case DetectCallDepth::kErrorNone:
- return true;
- case DetectCallDepth::kErrorMissingMain:
- infoSink.info.prefix(EPrefixError);
- infoSink.info << "Missing main()";
- return false;
- case DetectCallDepth::kErrorRecursion:
- infoSink.info.prefix(EPrefixError);
- infoSink.info << "Function recursion detected";
- return false;
- case DetectCallDepth::kErrorMaxDepthExceeded:
- infoSink.info.prefix(EPrefixError);
- infoSink.info << "Function call stack too deep";
- return false;
- default:
- UNREACHABLE();
- return false;
+ switch (detect.detectCallDepth())
+ {
+ case DetectCallDepth::kErrorNone:
+ return true;
+ case DetectCallDepth::kErrorMissingMain:
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "Missing main()";
+ return false;
+ case DetectCallDepth::kErrorRecursion:
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "Function recursion detected";
+ return false;
+ case DetectCallDepth::kErrorMaxDepthExceeded:
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "Function call stack too deep";
+ return false;
+ default:
+ UNREACHABLE();
+ return false;
}
}
@@ -315,7 +339,8 @@ void TCompiler::rewriteCSSShader(TIntermNode* root)
root->traverse(&renamer);
}
-bool TCompiler::validateLimitations(TIntermNode* root) {
+bool TCompiler::validateLimitations(TIntermNode* root)
+{
ValidateLimitations validate(shaderType, infoSink.info);
root->traverse(&validate);
return validate.numErrors() == 0;
@@ -323,26 +348,30 @@ bool TCompiler::validateLimitations(TIntermNode* root) {
bool TCompiler::enforceTimingRestrictions(TIntermNode* root, bool outputGraph)
{
- if (shaderSpec != SH_WEBGL_SPEC) {
+ if (shaderSpec != SH_WEBGL_SPEC)
+ {
infoSink.info << "Timing restrictions must be enforced under the WebGL spec.";
return false;
}
- if (shaderType == SH_FRAGMENT_SHADER) {
+ if (shaderType == SH_FRAGMENT_SHADER)
+ {
TDependencyGraph graph(root);
// Output any errors first.
bool success = enforceFragmentShaderTimingRestrictions(graph);
// Then, output the dependency graph.
- if (outputGraph) {
+ if (outputGraph)
+ {
TDependencyGraphOutput output(infoSink.info);
output.outputAllSpanningTrees(graph);
}
return success;
}
- else {
+ else
+ {
return enforceVertexShaderTimingRestrictions(root);
}
}
@@ -362,7 +391,8 @@ bool TCompiler::limitExpressionComplexity(TIntermNode* root)
samplerSymbol->traverse(&graphTraverser);
}
- if (traverser.getMaxDepth() > maxExpressionComplexity) {
+ if (traverser.getMaxDepth() > maxExpressionComplexity)
+ {
infoSink.info << "Expression too complex.";
return false;
}
@@ -395,6 +425,70 @@ bool TCompiler::enforcePackingRestrictions()
return packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
}
+void TCompiler::initializeGLPosition(TIntermNode* root)
+{
+ InitializeVariables::InitVariableInfoList variables;
+ InitializeVariables::InitVariableInfo var(
+ "gl_Position", TType(EbtFloat, EbpUndefined, EvqPosition, 4));
+ variables.push_back(var);
+ InitializeVariables initializer(variables);
+ root->traverse(&initializer);
+}
+
+void TCompiler::initializeVaryingsWithoutStaticUse(TIntermNode* root)
+{
+ InitializeVariables::InitVariableInfoList variables;
+ for (size_t ii = 0; ii < varyings.size(); ++ii)
+ {
+ const TVariableInfo& varying = varyings[ii];
+ if (varying.staticUse)
+ continue;
+ unsigned char size = 0;
+ bool matrix = false;
+ switch (varying.type)
+ {
+ case SH_FLOAT:
+ size = 1;
+ break;
+ case SH_FLOAT_VEC2:
+ size = 2;
+ break;
+ case SH_FLOAT_VEC3:
+ size = 3;
+ break;
+ case SH_FLOAT_VEC4:
+ size = 4;
+ break;
+ case SH_FLOAT_MAT2:
+ size = 2;
+ matrix = true;
+ break;
+ case SH_FLOAT_MAT3:
+ size = 3;
+ matrix = true;
+ break;
+ case SH_FLOAT_MAT4:
+ size = 4;
+ matrix = true;
+ break;
+ default:
+ ASSERT(false);
+ }
+ TType type(EbtFloat, EbpUndefined, EvqVaryingOut, size, matrix, varying.isArray);
+ TString name = varying.name.c_str();
+ if (varying.isArray)
+ {
+ type.setArraySize(varying.size);
+ name = name.substr(0, name.find_first_of('['));
+ }
+
+ InitializeVariables::InitVariableInfo var(name, type);
+ variables.push_back(var);
+ }
+ InitializeVariables initializer(variables);
+ root->traverse(&initializer);
+}
+
void TCompiler::mapLongVariableNames(TIntermNode* root)
{
ASSERT(longNameMap);
diff --git a/src/3rdparty/angle/src/compiler/ConstantUnion.h b/src/3rdparty/angle/src/compiler/translator/ConstantUnion.h
index b1e37885f9..b1e37885f9 100644
--- a/src/3rdparty/angle/src/compiler/ConstantUnion.h
+++ b/src/3rdparty/angle/src/compiler/translator/ConstantUnion.h
diff --git a/src/3rdparty/angle/src/compiler/DetectCallDepth.cpp b/src/3rdparty/angle/src/compiler/translator/DetectCallDepth.cpp
index 60df52c715..bfc1d5852f 100644
--- a/src/3rdparty/angle/src/compiler/DetectCallDepth.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/DetectCallDepth.cpp
@@ -4,8 +4,8 @@
// found in the LICENSE file.
//
-#include "compiler/DetectCallDepth.h"
-#include "compiler/InfoSink.h"
+#include "compiler/translator/DetectCallDepth.h"
+#include "compiler/translator/InfoSink.h"
DetectCallDepth::FunctionNode::FunctionNode(const TString& fname)
: name(fname),
diff --git a/src/3rdparty/angle/src/compiler/DetectCallDepth.h b/src/3rdparty/angle/src/compiler/translator/DetectCallDepth.h
index 89e85f88f6..5e7f23d15f 100644
--- a/src/3rdparty/angle/src/compiler/DetectCallDepth.h
+++ b/src/3rdparty/angle/src/compiler/translator/DetectCallDepth.h
@@ -10,8 +10,8 @@
#include "GLSLANG/ShaderLang.h"
#include <limits.h>
-#include "compiler/intermediate.h"
-#include "compiler/VariableInfo.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/VariableInfo.h"
class TInfoSink;
diff --git a/src/3rdparty/angle/src/compiler/DetectDiscontinuity.cpp b/src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.cpp
index 7c3b68a0b3..334eb0bfa8 100644
--- a/src/3rdparty/angle/src/compiler/DetectDiscontinuity.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.cpp
@@ -8,9 +8,9 @@
// gradients of functions with discontinuities.
//
-#include "compiler/DetectDiscontinuity.h"
+#include "compiler/translator/DetectDiscontinuity.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/ParseContext.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/DetectDiscontinuity.h b/src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.h
index e5520bd5b0..1dd8be9233 100644
--- a/src/3rdparty/angle/src/compiler/DetectDiscontinuity.h
+++ b/src/3rdparty/angle/src/compiler/translator/DetectDiscontinuity.h
@@ -11,7 +11,7 @@
#ifndef COMPILER_DETECTDISCONTINUITY_H_
#define COMPILER_DETECTDISCONTINUITY_H_
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/Diagnostics.cpp b/src/3rdparty/angle/src/compiler/translator/Diagnostics.cpp
index 8a38c41a65..99506c0849 100644
--- a/src/3rdparty/angle/src/compiler/Diagnostics.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Diagnostics.cpp
@@ -4,10 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/Diagnostics.h"
+#include "compiler/translator/Diagnostics.h"
-#include "compiler/debug.h"
-#include "compiler/InfoSink.h"
+#include "compiler/translator/compilerdebug.h"
+#include "compiler/translator/InfoSink.h"
#include "compiler/preprocessor/SourceLocation.h"
TDiagnostics::TDiagnostics(TInfoSink& infoSink) :
@@ -30,11 +30,11 @@ void TDiagnostics::writeInfo(Severity severity,
TPrefixType prefix = EPrefixNone;
switch (severity)
{
- case ERROR:
+ case PP_ERROR:
++mNumErrors;
prefix = EPrefixError;
break;
- case WARNING:
+ case PP_WARNING:
++mNumWarnings;
prefix = EPrefixWarning;
break;
diff --git a/src/3rdparty/angle/src/compiler/Diagnostics.h b/src/3rdparty/angle/src/compiler/translator/Diagnostics.h
index cb71bb1204..cb71bb1204 100644
--- a/src/3rdparty/angle/src/compiler/Diagnostics.h
+++ b/src/3rdparty/angle/src/compiler/translator/Diagnostics.h
diff --git a/src/3rdparty/angle/src/compiler/DirectiveHandler.cpp b/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.cpp
index d1f6ab3af5..662c8ae624 100644
--- a/src/3rdparty/angle/src/compiler/DirectiveHandler.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.cpp
@@ -4,12 +4,12 @@
// found in the LICENSE file.
//
-#include "compiler/DirectiveHandler.h"
+#include "compiler/translator/DirectiveHandler.h"
#include <sstream>
-#include "compiler/debug.h"
-#include "compiler/Diagnostics.h"
+#include "compiler/translator/compilerdebug.h"
+#include "compiler/translator/Diagnostics.h"
static TBehavior getBehavior(const std::string& str)
{
@@ -39,7 +39,7 @@ TDirectiveHandler::~TDirectiveHandler()
void TDirectiveHandler::handleError(const pp::SourceLocation& loc,
const std::string& msg)
{
- mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc, msg, "", "");
+ mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, msg, "", "");
}
void TDirectiveHandler::handlePragma(const pp::SourceLocation& loc,
@@ -73,12 +73,12 @@ void TDirectiveHandler::handlePragma(const pp::SourceLocation& loc,
}
else
{
- mDiagnostics.report(pp::Diagnostics::UNRECOGNIZED_PRAGMA, loc, name);
+ mDiagnostics.report(pp::Diagnostics::PP_UNRECOGNIZED_PRAGMA, loc, name);
return;
}
if (invalidValue)
- mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
+ mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"invalid pragma value", value,
"'on' or 'off' expected");
}
@@ -92,7 +92,7 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
TBehavior behaviorVal = getBehavior(behavior);
if (behaviorVal == EBhUndefined)
{
- mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
+ mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"behavior", name, "invalid");
return;
}
@@ -101,13 +101,13 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
{
if (behaviorVal == EBhRequire)
{
- mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
+ mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"extension", name,
"cannot have 'require' behavior");
}
else if (behaviorVal == EBhEnable)
{
- mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
+ mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"extension", name,
"cannot have 'enable' behavior");
}
@@ -127,15 +127,15 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
return;
}
- pp::Diagnostics::Severity severity = pp::Diagnostics::ERROR;
+ pp::Diagnostics::Severity severity = pp::Diagnostics::PP_ERROR;
switch (behaviorVal) {
case EBhRequire:
- severity = pp::Diagnostics::ERROR;
+ severity = pp::Diagnostics::PP_ERROR;
break;
case EBhEnable:
case EBhWarn:
case EBhDisable:
- severity = pp::Diagnostics::WARNING;
+ severity = pp::Diagnostics::PP_WARNING;
break;
default:
UNREACHABLE();
@@ -155,7 +155,7 @@ void TDirectiveHandler::handleVersion(const pp::SourceLocation& loc,
std::stringstream stream;
stream << version;
std::string str = stream.str();
- mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
+ mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"version number", str, "not supported");
}
}
diff --git a/src/3rdparty/angle/src/compiler/DirectiveHandler.h b/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.h
index 95ca59d6fe..eb5f055494 100644
--- a/src/3rdparty/angle/src/compiler/DirectiveHandler.h
+++ b/src/3rdparty/angle/src/compiler/translator/DirectiveHandler.h
@@ -7,8 +7,8 @@
#ifndef COMPILER_DIRECTIVE_HANDLER_H_
#define COMPILER_DIRECTIVE_HANDLER_H_
-#include "compiler/ExtensionBehavior.h"
-#include "compiler/Pragma.h"
+#include "compiler/translator/ExtensionBehavior.h"
+#include "compiler/translator/Pragma.h"
#include "compiler/preprocessor/DirectiveHandlerBase.h"
class TDiagnostics;
diff --git a/src/3rdparty/angle/src/compiler/ExtensionBehavior.h b/src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.h
index 5c1595fb21..5c1595fb21 100644
--- a/src/3rdparty/angle/src/compiler/ExtensionBehavior.h
+++ b/src/3rdparty/angle/src/compiler/translator/ExtensionBehavior.h
diff --git a/src/3rdparty/angle/src/compiler/ForLoopUnroll.cpp b/src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.cpp
index 27a13eabab..89e6f1a62b 100644
--- a/src/3rdparty/angle/src/compiler/ForLoopUnroll.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/ForLoopUnroll.h"
+#include "compiler/translator/ForLoopUnroll.h"
namespace {
diff --git a/src/3rdparty/angle/src/compiler/ForLoopUnroll.h b/src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.h
index e800e25b1f..afd70d1fd2 100644
--- a/src/3rdparty/angle/src/compiler/ForLoopUnroll.h
+++ b/src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.h
@@ -4,7 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/intermediate.h"
+#ifndef COMPILER_FORLOOPUNROLL_H_
+#define COMPILER_FORLOOPUNROLL_H_
+
+#include "compiler/translator/intermediate.h"
struct TLoopIndexInfo {
int id;
@@ -46,3 +49,4 @@ private:
TVector<TLoopIndexInfo> mLoopIndexStack;
};
+#endif
diff --git a/src/3rdparty/angle/src/compiler/HashNames.h b/src/3rdparty/angle/src/compiler/translator/HashNames.h
index d2141e2d85..751265b759 100644
--- a/src/3rdparty/angle/src/compiler/HashNames.h
+++ b/src/3rdparty/angle/src/compiler/translator/HashNames.h
@@ -9,7 +9,7 @@
#include <map>
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
#include "GLSLANG/ShaderLang.h"
#define HASHED_NAME_PREFIX "webgl_"
diff --git a/src/3rdparty/angle/src/compiler/InfoSink.cpp b/src/3rdparty/angle/src/compiler/translator/InfoSink.cpp
index d20a6c0175..cd59658ff7 100644
--- a/src/3rdparty/angle/src/compiler/InfoSink.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/InfoSink.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/InfoSink.h"
+#include "compiler/translator/InfoSink.h"
void TInfoSinkBase::prefix(TPrefixType p) {
switch(p) {
diff --git a/src/3rdparty/angle/src/compiler/InfoSink.h b/src/3rdparty/angle/src/compiler/translator/InfoSink.h
index 6888838142..698a8b454b 100644
--- a/src/3rdparty/angle/src/compiler/InfoSink.h
+++ b/src/3rdparty/angle/src/compiler/translator/InfoSink.h
@@ -8,7 +8,8 @@
#define _INFOSINK_INCLUDED_
#include <math.h>
-#include "compiler/Common.h"
+#include <stdlib.h>
+#include "compiler/translator/Common.h"
// Returns the fractional part of the given floating-point number.
inline float fractionalPart(float f) {
diff --git a/src/3rdparty/angle/src/compiler/Initialize.cpp b/src/3rdparty/angle/src/compiler/translator/Initialize.cpp
index 236383d874..db728b2129 100644
--- a/src/3rdparty/angle/src/compiler/Initialize.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Initialize.cpp
@@ -10,9 +10,9 @@
// built-in functions and operators.
//
-#include "compiler/Initialize.h"
+#include "compiler/translator/Initialize.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
{
@@ -363,7 +363,7 @@ void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltI
symbolTable.insertBuiltIn(float2, "dFdx", float2);
symbolTable.insertBuiltIn(float3, "dFdx", float3);
symbolTable.insertBuiltIn(float4, "dFdx", float4);
-
+
symbolTable.insertBuiltIn(float1, "dFdy", float1);
symbolTable.insertBuiltIn(float2, "dFdy", float2);
symbolTable.insertBuiltIn(float3, "dFdy", float3);
diff --git a/src/3rdparty/angle/src/compiler/Initialize.h b/src/3rdparty/angle/src/compiler/translator/Initialize.h
index 4aa13466ac..b5642869aa 100644
--- a/src/3rdparty/angle/src/compiler/Initialize.h
+++ b/src/3rdparty/angle/src/compiler/translator/Initialize.h
@@ -7,9 +7,9 @@
#ifndef _INITIALIZE_INCLUDED_
#define _INITIALIZE_INCLUDED_
-#include "compiler/Common.h"
-#include "compiler/ShHandle.h"
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/SymbolTable.h"
void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &table);
diff --git a/src/3rdparty/angle/src/compiler/InitializeDll.cpp b/src/3rdparty/angle/src/compiler/translator/InitializeDll.cpp
index 6c7f27fced..43f81784d0 100644
--- a/src/3rdparty/angle/src/compiler/InitializeDll.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeDll.cpp
@@ -4,11 +4,11 @@
// found in the LICENSE file.
//
-#include "compiler/InitializeDll.h"
+#include "compiler/translator/InitializeDll.h"
-#include "compiler/InitializeGlobals.h"
-#include "compiler/InitializeParseContext.h"
-#include "compiler/osinclude.h"
+#include "compiler/translator/InitializeGlobals.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/osinclude.h"
bool InitProcess()
{
diff --git a/src/3rdparty/angle/src/compiler/InitializeDll.h b/src/3rdparty/angle/src/compiler/translator/InitializeDll.h
index 43070cc3ff..43070cc3ff 100644
--- a/src/3rdparty/angle/src/compiler/InitializeDll.h
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeDll.h
diff --git a/src/3rdparty/angle/src/compiler/InitializeGlobals.h b/src/3rdparty/angle/src/compiler/translator/InitializeGlobals.h
index 0715941424..0715941424 100644
--- a/src/3rdparty/angle/src/compiler/InitializeGlobals.h
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeGlobals.h
diff --git a/src/3rdparty/angle/src/compiler/InitializeParseContext.cpp b/src/3rdparty/angle/src/compiler/translator/InitializeParseContext.cpp
index dfab027330..b4defae569 100644
--- a/src/3rdparty/angle/src/compiler/InitializeParseContext.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeParseContext.cpp
@@ -4,9 +4,9 @@
// found in the LICENSE file.
//
-#include "compiler/InitializeParseContext.h"
+#include "compiler/translator/InitializeParseContext.h"
-#include "compiler/osinclude.h"
+#include "compiler/translator/osinclude.h"
OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
diff --git a/src/3rdparty/angle/src/compiler/InitializeParseContext.h b/src/3rdparty/angle/src/compiler/translator/InitializeParseContext.h
index bffbab87d0..bffbab87d0 100644
--- a/src/3rdparty/angle/src/compiler/InitializeParseContext.h
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeParseContext.h
diff --git a/src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp b/src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp
new file mode 100644
index 0000000000..115c561c77
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp
@@ -0,0 +1,116 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/InitializeVariables.h"
+#include "compiler/translator/compilerdebug.h"
+
+namespace
+{
+
+TIntermConstantUnion* constructFloatConstUnionNode(const TType& type)
+{
+ TType myType = type;
+ unsigned char size = myType.getNominalSize();
+ if (myType.isMatrix())
+ size *= size;
+ ConstantUnion *u = new ConstantUnion[size];
+ for (int ii = 0; ii < size; ++ii)
+ u[ii].setFConst(0.0f);
+
+ myType.clearArrayness();
+ myType.setQualifier(EvqConst);
+ TIntermConstantUnion *node = new TIntermConstantUnion(u, myType);
+ return node;
+}
+
+TIntermConstantUnion* constructIndexNode(int index)
+{
+ ConstantUnion *u = new ConstantUnion[1];
+ u[0].setIConst(index);
+
+ TType type(EbtInt, EbpUndefined, EvqConst, 1);
+ TIntermConstantUnion *node = new TIntermConstantUnion(u, type);
+ return node;
+}
+
+} // namespace anonymous
+
+bool InitializeVariables::visitAggregate(Visit visit, TIntermAggregate* node)
+{
+ bool visitChildren = !mCodeInserted;
+ switch (node->getOp())
+ {
+ case EOpSequence:
+ break;
+ case EOpFunction:
+ {
+ // Function definition.
+ ASSERT(visit == PreVisit);
+ if (node->getName() == "main(")
+ {
+ TIntermSequence &sequence = node->getSequence();
+ ASSERT((sequence.size() == 1) || (sequence.size() == 2));
+ TIntermAggregate *body = NULL;
+ if (sequence.size() == 1)
+ {
+ body = new TIntermAggregate(EOpSequence);
+ sequence.push_back(body);
+ }
+ else
+ {
+ body = sequence[1]->getAsAggregate();
+ }
+ ASSERT(body);
+ insertInitCode(body->getSequence());
+ mCodeInserted = true;
+ }
+ break;
+ }
+ default:
+ visitChildren = false;
+ break;
+ }
+ return visitChildren;
+}
+
+void InitializeVariables::insertInitCode(TIntermSequence& sequence)
+{
+ for (size_t ii = 0; ii < mVariables.size(); ++ii)
+ {
+ const InitVariableInfo& varInfo = mVariables[ii];
+
+ if (varInfo.type.isArray())
+ {
+ for (int index = varInfo.type.getArraySize() - 1; index >= 0; --index)
+ {
+ TIntermBinary *assign = new TIntermBinary(EOpAssign);
+ sequence.insert(sequence.begin(), assign);
+
+ TIntermBinary *indexDirect = new TIntermBinary(EOpIndexDirect);
+ TIntermSymbol *symbol = new TIntermSymbol(0, varInfo.name, varInfo.type);
+ indexDirect->setLeft(symbol);
+ TIntermConstantUnion *indexNode = constructIndexNode(index);
+ indexDirect->setRight(indexNode);
+
+ assign->setLeft(indexDirect);
+
+ TIntermConstantUnion *zeroConst = constructFloatConstUnionNode(varInfo.type);
+ assign->setRight(zeroConst);
+ }
+ }
+ else
+ {
+ TIntermBinary *assign = new TIntermBinary(EOpAssign);
+ sequence.insert(sequence.begin(), assign);
+ TIntermSymbol *symbol = new TIntermSymbol(0, varInfo.name, varInfo.type);
+ assign->setLeft(symbol);
+ TIntermConstantUnion *zeroConst = constructFloatConstUnionNode(varInfo.type);
+ assign->setRight(zeroConst);
+ }
+
+ }
+}
+
diff --git a/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h b/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h
new file mode 100644
index 0000000000..1cd6d7e1b5
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/InitializeVariables.h
@@ -0,0 +1,50 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_INITIALIZE_VARIABLES_H_
+#define COMPILER_INITIALIZE_VARIABLES_H_
+
+#include "compiler/translator/intermediate.h"
+
+class InitializeVariables : public TIntermTraverser
+{
+ public:
+ struct InitVariableInfo
+ {
+ TString name;
+ TType type;
+
+ InitVariableInfo(const TString& _name, const TType& _type)
+ : name(_name),
+ type(_type)
+ {
+ }
+ };
+ typedef TVector<InitVariableInfo> InitVariableInfoList;
+
+ InitializeVariables(const InitVariableInfoList& vars)
+ : mCodeInserted(false),
+ mVariables(vars)
+ {
+ }
+
+ protected:
+ virtual bool visitBinary(Visit visit, TIntermBinary* node) { return false; }
+ virtual bool visitUnary(Visit visit, TIntermUnary* node) { return false; }
+ virtual bool visitSelection(Visit visit, TIntermSelection* node) { return false; }
+ virtual bool visitLoop(Visit visit, TIntermLoop* node) { return false; }
+ virtual bool visitBranch(Visit visit, TIntermBranch* node) { return false; }
+
+ virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
+
+ private:
+ void insertInitCode(TIntermSequence& sequence);
+
+ InitVariableInfoList mVariables;
+ bool mCodeInserted;
+};
+
+#endif // COMPILER_INITIALIZE_VARIABLES_H_
diff --git a/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp b/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp
new file mode 100644
index 0000000000..554b83409a
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp
@@ -0,0 +1,259 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/intermediate.h"
+
+//
+// Traverse the intermediate representation tree, and
+// call a node type specific function for each node.
+// Done recursively through the member function Traverse().
+// Node types can be skipped if their function to call is 0,
+// but their subtree will still be traversed.
+// Nodes with children can have their whole subtree skipped
+// if preVisit is turned on and the type specific function
+// returns false.
+//
+// preVisit, postVisit, and rightToLeft control what order
+// nodes are visited in.
+//
+
+//
+// Traversal functions for terminals are straighforward....
+//
+void TIntermSymbol::traverse(TIntermTraverser *it)
+{
+ it->visitSymbol(this);
+}
+
+void TIntermConstantUnion::traverse(TIntermTraverser *it)
+{
+ it->visitConstantUnion(this);
+}
+
+//
+// Traverse a binary node.
+//
+void TIntermBinary::traverse(TIntermTraverser *it)
+{
+ bool visit = true;
+
+ //
+ // visit the node before children if pre-visiting.
+ //
+ if (it->preVisit)
+ visit = it->visitBinary(PreVisit, this);
+
+ //
+ // Visit the children, in the right order.
+ //
+ if (visit)
+ {
+ it->incrementDepth(this);
+
+ if (it->rightToLeft)
+ {
+ if (right)
+ right->traverse(it);
+
+ if (it->inVisit)
+ visit = it->visitBinary(InVisit, this);
+
+ if (visit && left)
+ left->traverse(it);
+ }
+ else
+ {
+ if (left)
+ left->traverse(it);
+
+ if (it->inVisit)
+ visit = it->visitBinary(InVisit, this);
+
+ if (visit && right)
+ right->traverse(it);
+ }
+
+ it->decrementDepth();
+ }
+
+ //
+ // Visit the node after the children, if requested and the traversal
+ // hasn't been cancelled yet.
+ //
+ if (visit && it->postVisit)
+ it->visitBinary(PostVisit, this);
+}
+
+//
+// Traverse a unary node. Same comments in binary node apply here.
+//
+void TIntermUnary::traverse(TIntermTraverser *it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitUnary(PreVisit, this);
+
+ if (visit) {
+ it->incrementDepth(this);
+ operand->traverse(it);
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitUnary(PostVisit, this);
+}
+
+//
+// Traverse an aggregate node. Same comments in binary node apply here.
+//
+void TIntermAggregate::traverse(TIntermTraverser *it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitAggregate(PreVisit, this);
+
+ if (visit)
+ {
+ it->incrementDepth(this);
+
+ if (it->rightToLeft)
+ {
+ for (TIntermSequence::reverse_iterator sit = sequence.rbegin(); sit != sequence.rend(); sit++)
+ {
+ (*sit)->traverse(it);
+
+ if (visit && it->inVisit)
+ {
+ if (*sit != sequence.front())
+ visit = it->visitAggregate(InVisit, this);
+ }
+ }
+ }
+ else
+ {
+ for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
+ {
+ (*sit)->traverse(it);
+
+ if (visit && it->inVisit)
+ {
+ if (*sit != sequence.back())
+ visit = it->visitAggregate(InVisit, this);
+ }
+ }
+ }
+
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitAggregate(PostVisit, this);
+}
+
+//
+// Traverse a selection node. Same comments in binary node apply here.
+//
+void TIntermSelection::traverse(TIntermTraverser *it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitSelection(PreVisit, this);
+
+ if (visit) {
+ it->incrementDepth(this);
+ if (it->rightToLeft) {
+ if (falseBlock)
+ falseBlock->traverse(it);
+ if (trueBlock)
+ trueBlock->traverse(it);
+ condition->traverse(it);
+ } else {
+ condition->traverse(it);
+ if (trueBlock)
+ trueBlock->traverse(it);
+ if (falseBlock)
+ falseBlock->traverse(it);
+ }
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitSelection(PostVisit, this);
+}
+
+//
+// Traverse a loop node. Same comments in binary node apply here.
+//
+void TIntermLoop::traverse(TIntermTraverser *it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitLoop(PreVisit, this);
+
+ if (visit)
+ {
+ it->incrementDepth(this);
+
+ if (it->rightToLeft)
+ {
+ if (expr)
+ expr->traverse(it);
+
+ if (body)
+ body->traverse(it);
+
+ if (cond)
+ cond->traverse(it);
+
+ if (init)
+ init->traverse(it);
+ }
+ else
+ {
+ if (init)
+ init->traverse(it);
+
+ if (cond)
+ cond->traverse(it);
+
+ if (body)
+ body->traverse(it);
+
+ if (expr)
+ expr->traverse(it);
+ }
+
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitLoop(PostVisit, this);
+}
+
+//
+// Traverse a branch node. Same comments in binary node apply here.
+//
+void TIntermBranch::traverse(TIntermTraverser *it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitBranch(PreVisit, this);
+
+ if (visit && expression) {
+ it->incrementDepth(this);
+ expression->traverse(it);
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitBranch(PostVisit, this);
+}
+
diff --git a/src/3rdparty/angle/src/compiler/Intermediate.cpp b/src/3rdparty/angle/src/compiler/translator/Intermediate.cpp
index 3b6622185d..777cab5458 100644
--- a/src/3rdparty/angle/src/compiler/Intermediate.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Intermediate.cpp
@@ -12,18 +12,20 @@
#include <limits.h>
#include <algorithm>
-#include "compiler/HashNames.h"
-#include "compiler/localintermediate.h"
-#include "compiler/QualifierAlive.h"
-#include "compiler/RemoveTree.h"
+#include "compiler/translator/HashNames.h"
+#include "compiler/translator/localintermediate.h"
+#include "compiler/translator/QualifierAlive.h"
+#include "compiler/translator/RemoveTree.h"
bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray);
-static TPrecision GetHigherPrecision( TPrecision left, TPrecision right ){
+static TPrecision GetHigherPrecision(TPrecision left, TPrecision right)
+{
return left > right ? left : right;
}
-const char* getOperatorString(TOperator op) {
+const char* getOperatorString(TOperator op)
+{
switch (op) {
case EOpInitialize: return "=";
case EOpAssign: return "=";
@@ -742,12 +744,67 @@ void TIntermediate::remove(TIntermNode* root)
//
////////////////////////////////////////////////////////////////
+#define REPLACE_IF_IS(node, type, original, replacement) \
+ if (node == original) { \
+ node = static_cast<type *>(replacement); \
+ return true; \
+ }
+
+bool TIntermLoop::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(init, TIntermNode, original, replacement);
+ REPLACE_IF_IS(cond, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(expr, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(body, TIntermNode, original, replacement);
+ return false;
+}
+
+bool TIntermBranch::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(expression, TIntermTyped, original, replacement);
+ return false;
+}
+
+bool TIntermBinary::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(left, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(right, TIntermTyped, original, replacement);
+ return false;
+}
+
+bool TIntermUnary::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(operand, TIntermTyped, original, replacement);
+ return false;
+}
+
+bool TIntermAggregate::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ for (size_t ii = 0; ii < sequence.size(); ++ii)
+ {
+ REPLACE_IF_IS(sequence[ii], TIntermNode, original, replacement);
+ }
+ return false;
+}
+
+bool TIntermSelection::replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(condition, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(trueBlock, TIntermNode, original, replacement);
+ REPLACE_IF_IS(falseBlock, TIntermNode, original, replacement);
+ return false;
+}
+
//
// Say whether or not an operation node changes the value of a variable.
//
-// Returns true if state is modified.
-//
-bool TIntermOperator::modifiesState() const
+bool TIntermOperator::isAssignment() const
{
switch (op) {
case EOpPostIncrement:
@@ -796,6 +853,7 @@ bool TIntermOperator::isConstructor() const
return false;
}
}
+
//
// Make sure the type of a unary operator is appropriate for its
// combination of operation and operand type.
diff --git a/src/3rdparty/angle/src/compiler/MMap.h b/src/3rdparty/angle/src/compiler/translator/MMap.h
index a308671514..a308671514 100644
--- a/src/3rdparty/angle/src/compiler/MMap.h
+++ b/src/3rdparty/angle/src/compiler/translator/MMap.h
diff --git a/src/3rdparty/angle/src/compiler/MapLongVariableNames.cpp b/src/3rdparty/angle/src/compiler/translator/MapLongVariableNames.cpp
index a41d20f4e8..ef629c26b1 100644
--- a/src/3rdparty/angle/src/compiler/MapLongVariableNames.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/MapLongVariableNames.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/MapLongVariableNames.h"
+#include "compiler/translator/MapLongVariableNames.h"
namespace {
@@ -102,13 +102,6 @@ void MapLongVariableNames::visitSymbol(TIntermSymbol* symbol)
}
}
-bool MapLongVariableNames::visitLoop(Visit, TIntermLoop* node)
-{
- if (node->getInit())
- node->getInit()->traverse(this);
- return true;
-}
-
TString MapLongVariableNames::mapGlobalLongName(const TString& name)
{
ASSERT(mGlobalMap);
diff --git a/src/3rdparty/angle/src/compiler/MapLongVariableNames.h b/src/3rdparty/angle/src/compiler/translator/MapLongVariableNames.h
index d6352acb4b..3b085a3687 100644
--- a/src/3rdparty/angle/src/compiler/MapLongVariableNames.h
+++ b/src/3rdparty/angle/src/compiler/translator/MapLongVariableNames.h
@@ -9,8 +9,8 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
-#include "compiler/VariableInfo.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/VariableInfo.h"
// This size does not include '\0' in the end.
#define MAX_SHORTENED_IDENTIFIER_SIZE 32
@@ -48,7 +48,6 @@ public:
MapLongVariableNames(LongNameMap* globalMap);
virtual void visitSymbol(TIntermSymbol*);
- virtual bool visitLoop(Visit, TIntermLoop*);
private:
TString mapGlobalLongName(const TString& name);
diff --git a/src/3rdparty/angle/src/compiler/translator/NodeSearch.h b/src/3rdparty/angle/src/compiler/translator/NodeSearch.h
new file mode 100644
index 0000000000..b58c7ec689
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/NodeSearch.h
@@ -0,0 +1,80 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// NodeSearch.h: Utilities for searching translator node graphs
+//
+
+#ifndef TRANSLATOR_NODESEARCH_H_
+#define TRANSLATOR_NODESEARCH_H_
+
+#include "compiler/translator/intermediate.h"
+
+namespace sh
+{
+
+template <class Parent>
+class NodeSearchTraverser : public TIntermTraverser
+{
+ public:
+ NodeSearchTraverser()
+ : mFound(false)
+ {}
+
+ bool found() const { return mFound; }
+
+ static bool search(TIntermNode *node)
+ {
+ Parent searchTraverser;
+ node->traverse(&searchTraverser);
+ return searchTraverser.found();
+ }
+
+ protected:
+ bool mFound;
+};
+
+class FindDiscard : public NodeSearchTraverser<FindDiscard>
+{
+ public:
+ virtual bool visitBranch(Visit visit, TIntermBranch *node)
+ {
+ switch (node->getFlowOp())
+ {
+ case EOpKill:
+ mFound = true;
+ break;
+
+ default: break;
+ }
+
+ return !mFound;
+ }
+};
+
+class FindSideEffectRewriting : public NodeSearchTraverser<FindSideEffectRewriting>
+{
+ public:
+ virtual bool visitBinary(Visit visit, TIntermBinary *node)
+ {
+ switch (node->getOp())
+ {
+ case EOpLogicalOr:
+ case EOpLogicalAnd:
+ if (node->getRight()->hasSideEffects())
+ {
+ mFound = true;
+ }
+ break;
+
+ default: break;
+ }
+
+ return !mFound;
+ }
+};
+
+}
+
+#endif // TRANSLATOR_NODESEARCH_H_
diff --git a/src/3rdparty/angle/src/compiler/OutputESSL.cpp b/src/3rdparty/angle/src/compiler/translator/OutputESSL.cpp
index c2048f1cec..8367412462 100644
--- a/src/3rdparty/angle/src/compiler/OutputESSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/OutputESSL.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/OutputESSL.h"
+#include "compiler/translator/OutputESSL.h"
TOutputESSL::TOutputESSL(TInfoSinkBase& objSink,
ShArrayIndexClampingStrategy clampingStrategy,
diff --git a/src/3rdparty/angle/src/compiler/OutputESSL.h b/src/3rdparty/angle/src/compiler/translator/OutputESSL.h
index 05db96e497..2f02979a05 100644
--- a/src/3rdparty/angle/src/compiler/OutputESSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/OutputESSL.h
@@ -7,7 +7,7 @@
#ifndef CROSSCOMPILERGLSL_OUTPUTESSL_H_
#define CROSSCOMPILERGLSL_OUTPUTESSL_H_
-#include "compiler/OutputGLSLBase.h"
+#include "compiler/translator/OutputGLSLBase.h"
class TOutputESSL : public TOutputGLSLBase
{
diff --git a/src/3rdparty/angle/src/compiler/OutputGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/OutputGLSL.cpp
index 10a451c0d7..5589560682 100644
--- a/src/3rdparty/angle/src/compiler/OutputGLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/OutputGLSL.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/OutputGLSL.h"
+#include "compiler/translator/OutputGLSL.h"
TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink,
ShArrayIndexClampingStrategy clampingStrategy,
diff --git a/src/3rdparty/angle/src/compiler/OutputGLSL.h b/src/3rdparty/angle/src/compiler/translator/OutputGLSL.h
index fa68ac8103..e1f114d347 100644
--- a/src/3rdparty/angle/src/compiler/OutputGLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/OutputGLSL.h
@@ -7,7 +7,7 @@
#ifndef CROSSCOMPILERGLSL_OUTPUTGLSL_H_
#define CROSSCOMPILERGLSL_OUTPUTGLSL_H_
-#include "compiler/OutputGLSLBase.h"
+#include "compiler/translator/OutputGLSLBase.h"
class TOutputGLSL : public TOutputGLSLBase
{
diff --git a/src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp
index d677c75633..f2f0a3d6be 100644
--- a/src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.cpp
@@ -4,8 +4,8 @@
// found in the LICENSE file.
//
-#include "compiler/OutputGLSLBase.h"
-#include "compiler/debug.h"
+#include "compiler/translator/OutputGLSLBase.h"
+#include "compiler/translator/compilerdebug.h"
#include <cfloat>
@@ -435,7 +435,7 @@ bool TOutputGLSLBase::visitSelection(Visit visit, TIntermSelection* node)
node->getCondition()->traverse(this);
out << ")\n";
- incrementDepth();
+ incrementDepth(node);
visitCodeBlock(node->getTrueBlock());
if (node->getFalseBlock())
@@ -460,7 +460,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
// Scope the sequences except when at the global scope.
if (depth > 0) out << "{\n";
- incrementDepth();
+ incrementDepth(node);
const TIntermSequence& sequence = node->getSequence();
for (TIntermSequence::const_iterator iter = sequence.begin();
iter != sequence.end(); ++iter)
@@ -498,7 +498,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
writeVariableType(node->getType());
out << " " << hashFunctionName(node->getName());
- incrementDepth();
+ incrementDepth(node);
// Function definition node contains one or two children nodes
// representing function parameters and function body. The latter
// is not present in case of empty function bodies.
@@ -638,7 +638,7 @@ bool TOutputGLSLBase::visitLoop(Visit visit, TIntermLoop* node)
{
TInfoSinkBase& out = objSink();
- incrementDepth();
+ incrementDepth(node);
// Loop header.
TLoopType loopType = node->getType();
if (loopType == ELoopFor) // for loop
diff --git a/src/3rdparty/angle/src/compiler/OutputGLSLBase.h b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h
index df4ad68c2c..76bec4de61 100644
--- a/src/3rdparty/angle/src/compiler/OutputGLSLBase.h
+++ b/src/3rdparty/angle/src/compiler/translator/OutputGLSLBase.h
@@ -9,9 +9,9 @@
#include <set>
-#include "compiler/ForLoopUnroll.h"
-#include "compiler/intermediate.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/ForLoopUnroll.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/ParseContext.h"
class TOutputGLSLBase : public TIntermTraverser
{
diff --git a/src/3rdparty/angle/src/compiler/OutputHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
index 79a373ebab..af996df719 100644
--- a/src/3rdparty/angle/src/compiler/OutputHLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
@@ -4,14 +4,16 @@
// found in the LICENSE file.
//
-#include "compiler/OutputHLSL.h"
+#include "compiler/translator/OutputHLSL.h"
#include "common/angleutils.h"
-#include "compiler/debug.h"
-#include "compiler/DetectDiscontinuity.h"
-#include "compiler/InfoSink.h"
-#include "compiler/SearchSymbol.h"
-#include "compiler/UnfoldShortCircuit.h"
+#include "compiler/translator/compilerdebug.h"
+#include "compiler/translator/DetectDiscontinuity.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/SearchSymbol.h"
+#include "compiler/translator/UnfoldShortCircuit.h"
+#include "compiler/translator/NodeSearch.h"
+#include "compiler/translator/RewriteElseBlocks.h"
#include <algorithm>
#include <cfloat>
@@ -19,13 +21,6 @@
namespace sh
{
-// Integer to TString conversion
-TString str(int i)
-{
- char buffer[20];
- snprintf(buffer, sizeof(buffer), "%d", i);
- return buffer;
-}
OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType)
: TIntermTraverser(true, true, true), mContext(context), mOutputType(outputType)
@@ -72,6 +67,7 @@ OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resourc
mUsesAtan2_2 = false;
mUsesAtan2_3 = false;
mUsesAtan2_4 = false;
+ mUsesDiscardRewriting = false;
mNumRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
@@ -113,6 +109,13 @@ void OutputHLSL::output()
{
mContainsLoopDiscontinuity = mContext.shaderType == SH_FRAGMENT_SHADER && containsLoopDiscontinuity(mContext.treeRoot);
+ // Work around D3D9 bug that would manifest in vertex shaders with selection blocks which
+ // use a vertex attribute as a condition, and some related computation in the else block.
+ if (mOutputType == SH_HLSL9_OUTPUT && mContext.shaderType == SH_VERTEX_SHADER)
+ {
+ RewriteElseBlocks(mContext.treeRoot);
+ }
+
mContext.treeRoot->traverse(this); // Output the body first to determine what has to go in the header
header();
@@ -196,6 +199,11 @@ void OutputHLSL::header()
attributes += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
}
+ if (mUsesDiscardRewriting)
+ {
+ out << "#define ANGLE_USES_DISCARD_REWRITING" << "\n";
+ }
+
if (shaderType == SH_FRAGMENT_SHADER)
{
TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find("GL_EXT_draw_buffers");
@@ -761,12 +769,12 @@ void OutputHLSL::header()
}
else if (mOutputType == SH_HLSL11_OUTPUT)
{
- out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw, float lod)\n"
+ out << "float4 gl_texture2DProjLod(Texture2D t, SamplerState s, float3 uvw, float lod)\n"
"{\n"
" return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), lod);\n"
"}\n"
"\n"
- "float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw)\n"
+ "float4 gl_texture2DProjLod(Texture2D t, SamplerState s, float4 uvw, float lod)\n"
"{\n"
" return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), lod);\n"
"}\n"
@@ -1092,6 +1100,10 @@ void OutputHLSL::visitSymbol(TIntermSymbol *node)
mReferencedVaryings[name] = node;
out << decorate(name);
}
+ else if (qualifier == EvqInternal)
+ {
+ out << name;
+ }
else
{
out << decorate(name);
@@ -1299,15 +1311,31 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
case EOpMatrixTimesVector: outputTriplet(visit, "mul(transpose(", "), ", ")"); break;
case EOpMatrixTimesMatrix: outputTriplet(visit, "transpose(mul(transpose(", "), transpose(", ")))"); break;
case EOpLogicalOr:
- out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
- return false;
+ if (node->getRight()->hasSideEffects())
+ {
+ out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
+ return false;
+ }
+ else
+ {
+ outputTriplet(visit, "(", " || ", ")");
+ return true;
+ }
case EOpLogicalXor:
mUsesXor = true;
outputTriplet(visit, "xor(", ", ", ")");
break;
case EOpLogicalAnd:
- out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
- return false;
+ if (node->getRight()->hasSideEffects())
+ {
+ out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
+ return false;
+ }
+ else
+ {
+ outputTriplet(visit, "(", " && ", ")");
+ return true;
+ }
default: UNREACHABLE();
}
@@ -1491,7 +1519,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
{
symbol->traverse(this);
out << arrayString(symbol->getType());
- out << " = " + initializer(variable->getType());
+ out << " = " + initializer(symbol->getType());
}
else
{
@@ -1944,7 +1972,7 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
{
mUnfoldShortCircuit->traverse(node->getCondition());
- out << "if(";
+ out << "if (";
node->getCondition()->traverse(this);
@@ -1953,9 +1981,14 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
outputLineDirective(node->getLine().first_line);
out << "{\n";
+ bool discard = false;
+
if (node->getTrueBlock())
{
traverseStatements(node->getTrueBlock());
+
+ // Detect true discard
+ discard = (discard || FindDiscard::search(node->getTrueBlock()));
}
outputLineDirective(node->getLine().first_line);
@@ -1973,6 +2006,15 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
outputLineDirective(node->getFalseBlock()->getLine().first_line);
out << ";\n}\n";
+
+ // Detect false discard
+ discard = (discard || FindDiscard::search(node->getFalseBlock()));
+ }
+
+ // ANGLE issue 486: Detect problematic conditional discard
+ if (discard && FindSideEffectRewriting::search(node))
+ {
+ mUsesDiscardRewriting = true;
}
}
@@ -2070,7 +2112,9 @@ bool OutputHLSL::visitBranch(Visit visit, TIntermBranch *node)
switch (node->getFlowOp())
{
- case EOpKill: outputTriplet(visit, "discard;\n", "", ""); break;
+ case EOpKill:
+ outputTriplet(visit, "discard;\n", "", "");
+ break;
case EOpBreak:
if (visit == PreVisit)
{
@@ -2293,7 +2337,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
if (!firstLoopFragment)
{
- out << "if(!Break";
+ out << "if (!Break";
index->traverse(this);
out << ") {\n";
}
diff --git a/src/3rdparty/angle/src/compiler/OutputHLSL.h b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.h
index cde4120718..3afd8e9ada 100644
--- a/src/3rdparty/angle/src/compiler/OutputHLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.h
@@ -14,9 +14,9 @@
#define GL_APICALL
#include <GLES2/gl2.h>
-#include "compiler/intermediate.h"
-#include "compiler/ParseHelper.h"
-#include "compiler/Uniform.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/Uniform.h"
namespace sh
{
@@ -125,6 +125,7 @@ class OutputHLSL : public TIntermTraverser
bool mUsesAtan2_2;
bool mUsesAtan2_3;
bool mUsesAtan2_4;
+ bool mUsesDiscardRewriting;
int mNumRenderTargets;
diff --git a/src/3rdparty/angle/src/compiler/ParseHelper.cpp b/src/3rdparty/angle/src/compiler/translator/ParseContext.cpp
index 1f8538e6a4..1a1e0d140c 100644
--- a/src/3rdparty/angle/src/compiler/ParseHelper.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ParseContext.cpp
@@ -4,12 +4,12 @@
// found in the LICENSE file.
//
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/ParseContext.h"
#include <stdarg.h>
#include <stdio.h>
-#include "compiler/glslang.h"
+#include "compiler/translator/glslang.h"
#include "compiler/preprocessor/SourceLocation.h"
///////////////////////////////////////////////////////////////////////
@@ -182,7 +182,7 @@ void TParseContext::error(const TSourceLoc& loc,
pp::SourceLocation srcLoc;
srcLoc.file = loc.first_file;
srcLoc.line = loc.first_line;
- diagnostics.writeInfo(pp::Diagnostics::ERROR,
+ diagnostics.writeInfo(pp::Diagnostics::PP_ERROR,
srcLoc, reason, token, extraInfo);
}
@@ -193,7 +193,7 @@ void TParseContext::warning(const TSourceLoc& loc,
pp::SourceLocation srcLoc;
srcLoc.file = loc.first_file;
srcLoc.line = loc.first_line;
- diagnostics.writeInfo(pp::Diagnostics::WARNING,
+ diagnostics.writeInfo(pp::Diagnostics::PP_WARNING,
srcLoc, reason, token, extraInfo);
}
@@ -535,7 +535,7 @@ bool TParseContext::constructorErrorCheck(const TSourceLoc& line, TIntermNode* n
return true;
}
- if (op == EOpConstructStruct && !type->isArray() && int(type->getStruct()->fields().size()) != function.getParamCount()) {
+ if (op == EOpConstructStruct && !type->isArray() && type->getStruct()->fields().size() != function.getParamCount()) {
error(line, "Number of constructor parameters does not match the number of structure fields", "constructor");
return true;
}
diff --git a/src/3rdparty/angle/src/compiler/ParseHelper.h b/src/3rdparty/angle/src/compiler/translator/ParseContext.h
index c2b3c3f7ec..b324e575d3 100644
--- a/src/3rdparty/angle/src/compiler/ParseHelper.h
+++ b/src/3rdparty/angle/src/compiler/translator/ParseContext.h
@@ -6,12 +6,12 @@
#ifndef _PARSER_HELPER_INCLUDED_
#define _PARSER_HELPER_INCLUDED_
-#include "compiler/Diagnostics.h"
-#include "compiler/DirectiveHandler.h"
-#include "compiler/localintermediate.h"
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/DirectiveHandler.h"
+#include "compiler/translator/localintermediate.h"
#include "compiler/preprocessor/Preprocessor.h"
-#include "compiler/ShHandle.h"
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/SymbolTable.h"
struct TMatrixFields {
bool wholeRow;
diff --git a/src/3rdparty/angle/src/compiler/PoolAlloc.cpp b/src/3rdparty/angle/src/compiler/translator/PoolAlloc.cpp
index eb993567b3..abe70262f2 100644
--- a/src/3rdparty/angle/src/compiler/PoolAlloc.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/PoolAlloc.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/PoolAlloc.h"
+#include "compiler/translator/PoolAlloc.h"
#ifndef _MSC_VER
#include <stdint.h>
@@ -12,8 +12,8 @@
#include <stdio.h>
#include "common/angleutils.h"
-#include "compiler/InitializeGlobals.h"
-#include "compiler/osinclude.h"
+#include "compiler/translator/InitializeGlobals.h"
+#include "compiler/translator/osinclude.h"
OS_TLSIndex PoolIndex = OS_INVALID_TLS_INDEX;
diff --git a/src/3rdparty/angle/src/compiler/PoolAlloc.h b/src/3rdparty/angle/src/compiler/translator/PoolAlloc.h
index edd249c4d3..edd249c4d3 100644
--- a/src/3rdparty/angle/src/compiler/PoolAlloc.h
+++ b/src/3rdparty/angle/src/compiler/translator/PoolAlloc.h
diff --git a/src/3rdparty/angle/src/compiler/Pragma.h b/src/3rdparty/angle/src/compiler/translator/Pragma.h
index 2f744123b8..2f744123b8 100644
--- a/src/3rdparty/angle/src/compiler/Pragma.h
+++ b/src/3rdparty/angle/src/compiler/translator/Pragma.h
diff --git a/src/3rdparty/angle/src/compiler/QualifierAlive.cpp b/src/3rdparty/angle/src/compiler/translator/QualifierAlive.cpp
index 92a6874eb7..1ba087e176 100644
--- a/src/3rdparty/angle/src/compiler/QualifierAlive.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/QualifierAlive.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
class TAliveTraverser : public TIntermTraverser {
public:
diff --git a/src/3rdparty/angle/src/compiler/QualifierAlive.h b/src/3rdparty/angle/src/compiler/translator/QualifierAlive.h
index 872a06f721..872a06f721 100644
--- a/src/3rdparty/angle/src/compiler/QualifierAlive.h
+++ b/src/3rdparty/angle/src/compiler/translator/QualifierAlive.h
diff --git a/src/3rdparty/angle/src/compiler/RemoveTree.cpp b/src/3rdparty/angle/src/compiler/translator/RemoveTree.cpp
index a4b8c1e63e..92e5dbbfe1 100644
--- a/src/3rdparty/angle/src/compiler/RemoveTree.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/RemoveTree.cpp
@@ -4,8 +4,8 @@
// found in the LICENSE file.
//
-#include "compiler/intermediate.h"
-#include "compiler/RemoveTree.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/RemoveTree.h"
//
// Code to recursively delete the intermediate tree.
diff --git a/src/3rdparty/angle/src/compiler/RemoveTree.h b/src/3rdparty/angle/src/compiler/translator/RemoveTree.h
index 97a821679c..97a821679c 100644
--- a/src/3rdparty/angle/src/compiler/RemoveTree.h
+++ b/src/3rdparty/angle/src/compiler/translator/RemoveTree.h
diff --git a/src/3rdparty/angle/src/compiler/RenameFunction.h b/src/3rdparty/angle/src/compiler/translator/RenameFunction.h
index 3908bfddb8..1f7fb16c45 100644
--- a/src/3rdparty/angle/src/compiler/RenameFunction.h
+++ b/src/3rdparty/angle/src/compiler/translator/RenameFunction.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_RENAME_FUNCTION
#define COMPILER_RENAME_FUNCTION
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
//
// Renames a function, including its declaration and any calls to it.
diff --git a/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp b/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp
new file mode 100644
index 0000000000..48e87cd57a
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp
@@ -0,0 +1,98 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteElseBlocks.cpp: Implementation for tree transform to change
+// all if-else blocks to if-if blocks.
+//
+
+#include "compiler/translator/RewriteElseBlocks.h"
+#include "compiler/translator/NodeSearch.h"
+#include "compiler/translator/SymbolTable.h"
+
+namespace sh
+{
+
+TIntermSymbol *MakeNewTemporary(const TString &name, TBasicType type)
+{
+ TType variableType(type, EbpHigh, EvqInternal);
+ return new TIntermSymbol(-1, name, variableType);
+}
+
+TIntermBinary *MakeNewBinary(TOperator op, TIntermTyped *left, TIntermTyped *right, const TType &resultType)
+{
+ TIntermBinary *binary = new TIntermBinary(op);
+ binary->setLeft(left);
+ binary->setRight(right);
+ binary->setType(resultType);
+ return binary;
+}
+
+TIntermUnary *MakeNewUnary(TOperator op, TIntermTyped *operand)
+{
+ TIntermUnary *unary = new TIntermUnary(op, operand->getType());
+ unary->setOperand(operand);
+ return unary;
+}
+
+bool ElseBlockRewriter::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ switch (node->getOp())
+ {
+ case EOpSequence:
+ {
+ for (size_t statementIndex = 0; statementIndex != node->getSequence().size(); statementIndex++)
+ {
+ TIntermNode *statement = node->getSequence()[statementIndex];
+ TIntermSelection *selection = statement->getAsSelectionNode();
+ if (selection && selection->getFalseBlock() != NULL)
+ {
+ node->getSequence()[statementIndex] = rewriteSelection(selection);
+ delete selection;
+ }
+ }
+ }
+ break;
+
+ default: break;
+ }
+
+ return true;
+}
+
+TIntermNode *ElseBlockRewriter::rewriteSelection(TIntermSelection *selection)
+{
+ ASSERT(selection->getFalseBlock() != NULL);
+
+ TString temporaryName = "cond_" + str(mTemporaryIndex++);
+ TIntermTyped *typedCondition = selection->getCondition()->getAsTyped();
+ TType resultType(EbtBool, EbpUndefined);
+ TIntermSymbol *conditionSymbolA = MakeNewTemporary(temporaryName, EbtBool);
+ TIntermSymbol *conditionSymbolB = MakeNewTemporary(temporaryName, EbtBool);
+ TIntermSymbol *conditionSymbolC = MakeNewTemporary(temporaryName, EbtBool);
+ TIntermBinary *storeCondition = MakeNewBinary(EOpInitialize, conditionSymbolA,
+ typedCondition, resultType);
+ TIntermUnary *negatedCondition = MakeNewUnary(EOpLogicalNot, conditionSymbolB);
+ TIntermSelection *falseBlock = new TIntermSelection(negatedCondition,
+ selection->getFalseBlock(), NULL);
+ TIntermSelection *newIfElse = new TIntermSelection(conditionSymbolC,
+ selection->getTrueBlock(), falseBlock);
+
+ TIntermAggregate *declaration = new TIntermAggregate(EOpDeclaration);
+ declaration->getSequence().push_back(storeCondition);
+
+ TIntermAggregate *block = new TIntermAggregate(EOpSequence);
+ block->getSequence().push_back(declaration);
+ block->getSequence().push_back(newIfElse);
+
+ return block;
+}
+
+void RewriteElseBlocks(TIntermNode *node)
+{
+ ElseBlockRewriter rewriter;
+ node->traverse(&rewriter);
+}
+
+}
diff --git a/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h b/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h
new file mode 100644
index 0000000000..10221335ce
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h
@@ -0,0 +1,39 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteElseBlocks.h: Prototype for tree transform to change
+// all if-else blocks to if-if blocks.
+//
+
+#ifndef COMPILER_REWRITE_ELSE_BLOCKS_H_
+#define COMPILER_REWRITE_ELSE_BLOCKS_H_
+
+#include "compiler/translator/intermediate.h"
+
+namespace sh
+{
+
+class ElseBlockRewriter : public TIntermTraverser
+{
+ public:
+ ElseBlockRewriter()
+ : TIntermTraverser(false, false, true, false)
+ , mTemporaryIndex(0)
+ {}
+
+ protected:
+ bool visitAggregate(Visit visit, TIntermAggregate *aggregate);
+
+ private:
+ int mTemporaryIndex;
+
+ TIntermNode *rewriteSelection(TIntermSelection *selection);
+};
+
+void RewriteElseBlocks(TIntermNode *node);
+
+}
+
+#endif // COMPILER_REWRITE_ELSE_BLOCKS_H_
diff --git a/src/3rdparty/angle/src/compiler/SearchSymbol.cpp b/src/3rdparty/angle/src/compiler/translator/SearchSymbol.cpp
index 9368f1a4fa..f78c84e370 100644
--- a/src/3rdparty/angle/src/compiler/SearchSymbol.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/SearchSymbol.cpp
@@ -6,10 +6,10 @@
// SearchSymbol is an AST traverser to detect the use of a given symbol name
//
-#include "compiler/SearchSymbol.h"
+#include "compiler/translator/SearchSymbol.h"
-#include "compiler/InfoSink.h"
-#include "compiler/OutputHLSL.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/OutputHLSL.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/SearchSymbol.h b/src/3rdparty/angle/src/compiler/translator/SearchSymbol.h
index 6bc0b90feb..8ddd3cb1ac 100644
--- a/src/3rdparty/angle/src/compiler/SearchSymbol.h
+++ b/src/3rdparty/angle/src/compiler/translator/SearchSymbol.h
@@ -9,8 +9,8 @@
#ifndef COMPILER_SEARCHSYMBOL_H_
#define COMPILER_SEARCHSYMBOL_H_
-#include "compiler/intermediate.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/ParseContext.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/ShHandle.h b/src/3rdparty/angle/src/compiler/translator/ShHandle.h
index 873580a99c..54ae27852d 100644
--- a/src/3rdparty/angle/src/compiler/ShHandle.h
+++ b/src/3rdparty/angle/src/compiler/translator/ShHandle.h
@@ -16,12 +16,12 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/BuiltInFunctionEmulator.h"
-#include "compiler/ExtensionBehavior.h"
-#include "compiler/HashNames.h"
-#include "compiler/InfoSink.h"
-#include "compiler/SymbolTable.h"
-#include "compiler/VariableInfo.h"
+#include "compiler/translator/BuiltInFunctionEmulator.h"
+#include "compiler/translator/ExtensionBehavior.h"
+#include "compiler/translator/HashNames.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/VariableInfo.h"
#include "third_party/compiler/ArrayBoundsClamper.h"
class LongNameMap;
@@ -100,6 +100,16 @@ protected:
// Returns true if, after applying the packing rules in the GLSL 1.017 spec
// Appendix A, section 7, the shader does not use too many uniforms.
bool enforcePackingRestrictions();
+ // Insert statements to initialize varyings without static use in the beginning
+ // of main(). It is to work around a Mac driver where such varyings in a vertex
+ // shader may be optimized out incorrectly at compile time, causing a link failure.
+ // This function should only be applied to vertex shaders.
+ void initializeVaryingsWithoutStaticUse(TIntermNode* root);
+ // Insert gl_Position = vec4(0,0,0,0) to the beginning of main().
+ // It is to work around a Linux driver bug where missing this causes compile failure
+ // while spec says it is allowed.
+ // This function should only be applied to vertex shaders.
+ void initializeGLPosition(TIntermNode* root);
// Returns true if the shader passes the restrictions that aim to prevent timing attacks.
bool enforceTimingRestrictions(TIntermNode* root, bool outputGraph);
// Returns true if the shader does not use samplers.
diff --git a/src/3rdparty/angle/src/compiler/ShaderLang.cpp b/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp
index 42cd5cc5c1..608237860c 100644
--- a/src/3rdparty/angle/src/compiler/ShaderLang.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp
@@ -11,11 +11,11 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/InitializeDll.h"
+#include "compiler/translator/InitializeDll.h"
#include "compiler/preprocessor/length_limits.h"
-#include "compiler/ShHandle.h"
-#include "compiler/TranslatorHLSL.h"
-#include "compiler/VariablePacker.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/TranslatorHLSL.h"
+#include "compiler/translator/VariablePacker.h"
//
// This is the platform independent interface between an OGL driver
@@ -91,6 +91,9 @@ void ShInitBuiltInResources(ShBuiltInResources* resources)
resources->HashFunction = NULL;
resources->ArrayIndexClampingStrategy = SH_CLAMP_WITH_CLAMP_INTRINSIC;
+
+ resources->MaxExpressionComplexity = 256;
+ resources->MaxCallStackDepth = 256;
}
//
diff --git a/src/3rdparty/angle/src/compiler/SymbolTable.cpp b/src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp
index a7ce21680f..d04fe5d355 100644
--- a/src/3rdparty/angle/src/compiler/SymbolTable.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/SymbolTable.cpp
@@ -13,7 +13,7 @@
#pragma warning(disable: 4718)
#endif
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/SymbolTable.h"
#include <stdio.h>
#include <algorithm>
diff --git a/src/3rdparty/angle/src/compiler/SymbolTable.h b/src/3rdparty/angle/src/compiler/translator/SymbolTable.h
index bebad4b92e..6c7211f2a9 100644
--- a/src/3rdparty/angle/src/compiler/SymbolTable.h
+++ b/src/3rdparty/angle/src/compiler/translator/SymbolTable.h
@@ -33,8 +33,8 @@
#include <assert.h>
#include "common/angleutils.h"
-#include "compiler/InfoSink.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/intermediate.h"
//
// Symbol base class. (Can build functions or variables out of these...)
diff --git a/src/3rdparty/angle/src/compiler/TranslatorESSL.cpp b/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.cpp
index 2900f8a8ed..9262f7af8c 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorESSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.cpp
@@ -4,9 +4,9 @@
// found in the LICENSE file.
//
-#include "compiler/TranslatorESSL.h"
+#include "compiler/translator/TranslatorESSL.h"
-#include "compiler/OutputESSL.h"
+#include "compiler/translator/OutputESSL.h"
TranslatorESSL::TranslatorESSL(ShShaderType type, ShShaderSpec spec)
: TCompiler(type, spec) {
diff --git a/src/3rdparty/angle/src/compiler/TranslatorESSL.h b/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.h
index a1196bd001..e18f3c25ec 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorESSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorESSL.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_TRANSLATORESSL_H_
#define COMPILER_TRANSLATORESSL_H_
-#include "compiler/ShHandle.h"
+#include "compiler/translator/ShHandle.h"
class TranslatorESSL : public TCompiler {
public:
diff --git a/src/3rdparty/angle/src/compiler/TranslatorGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.cpp
index 7ca4341dcd..6688d7f362 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorGLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.cpp
@@ -4,10 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/TranslatorGLSL.h"
+#include "compiler/translator/TranslatorGLSL.h"
-#include "compiler/OutputGLSL.h"
-#include "compiler/VersionGLSL.h"
+#include "compiler/translator/OutputGLSL.h"
+#include "compiler/translator/VersionGLSL.h"
static void writeVersion(ShShaderType type, TIntermNode* root,
TInfoSinkBase& sink) {
diff --git a/src/3rdparty/angle/src/compiler/TranslatorGLSL.h b/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.h
index c2ce06d192..40bb3145e8 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorGLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorGLSL.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_TRANSLATORGLSL_H_
#define COMPILER_TRANSLATORGLSL_H_
-#include "compiler/ShHandle.h"
+#include "compiler/translator/ShHandle.h"
class TranslatorGLSL : public TCompiler {
public:
diff --git a/src/3rdparty/angle/src/compiler/TranslatorHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp
index 37408a07c4..3c1db011b6 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorHLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.cpp
@@ -4,10 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/TranslatorHLSL.h"
+#include "compiler/translator/TranslatorHLSL.h"
-#include "compiler/InitializeParseContext.h"
-#include "compiler/OutputHLSL.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/OutputHLSL.h"
TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
: TCompiler(type, spec), mOutputType(output)
diff --git a/src/3rdparty/angle/src/compiler/TranslatorHLSL.h b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h
index 9550e15e8e..6204b30cc2 100644
--- a/src/3rdparty/angle/src/compiler/TranslatorHLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/TranslatorHLSL.h
@@ -7,8 +7,8 @@
#ifndef COMPILER_TRANSLATORHLSL_H_
#define COMPILER_TRANSLATORHLSL_H_
-#include "compiler/ShHandle.h"
-#include "compiler/Uniform.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/Uniform.h"
class TranslatorHLSL : public TCompiler {
public:
diff --git a/src/3rdparty/angle/src/compiler/Types.h b/src/3rdparty/angle/src/compiler/translator/Types.h
index 505fa8e3bf..119f4f29e5 100644
--- a/src/3rdparty/angle/src/compiler/Types.h
+++ b/src/3rdparty/angle/src/compiler/translator/Types.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -9,9 +9,9 @@
#include "common/angleutils.h"
-#include "compiler/BaseTypes.h"
-#include "compiler/Common.h"
-#include "compiler/debug.h"
+#include "compiler/translator/BaseTypes.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/compilerdebug.h"
struct TPublicType;
class TType;
@@ -95,7 +95,7 @@ class TType
public:
POOL_ALLOCATOR_NEW_DELETE();
TType() {}
- TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, int s = 1, bool m = false, bool a = false) :
+ TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, unsigned char s = 1, bool m = false, bool a = false) :
type(t), precision(p), qualifier(q), size(s), matrix(m), array(a), arraySize(0), structure(0)
{
}
@@ -116,7 +116,7 @@ public:
// One-dimensional size of single instance type
int getNominalSize() const { return size; }
- void setNominalSize(int s) { size = s; }
+ void setNominalSize(unsigned char s) { size = s; }
// Full size of single instance of type
size_t getObjectSize() const;
@@ -234,12 +234,12 @@ public:
private:
TString buildMangledName() const;
- TBasicType type : 6;
+ TBasicType type;
TPrecision precision;
- TQualifier qualifier : 7;
- int size : 8; // size of vector or matrix, not size of array
- unsigned int matrix : 1;
- unsigned int array : 1;
+ TQualifier qualifier;
+ unsigned char size;
+ bool matrix;
+ bool array;
int arraySize;
TStructure* structure; // 0 unless this is a struct
@@ -261,7 +261,7 @@ struct TPublicType
TBasicType type;
TQualifier qualifier;
TPrecision precision;
- int size; // size of vector or matrix, not size of array
+ unsigned char size; // size of vector or matrix, not size of array
bool matrix;
bool array;
int arraySize;
@@ -281,7 +281,7 @@ struct TPublicType
line = ln;
}
- void setAggregate(int s, bool m = false)
+ void setAggregate(unsigned char s, bool m = false)
{
size = s;
matrix = m;
diff --git a/src/3rdparty/angle/src/compiler/UnfoldShortCircuit.cpp b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.cpp
index 47f0afca6a..b7826119ae 100644
--- a/src/3rdparty/angle/src/compiler/UnfoldShortCircuit.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.cpp
@@ -8,10 +8,10 @@
// the original expression.
//
-#include "compiler/UnfoldShortCircuit.h"
+#include "compiler/translator/UnfoldShortCircuit.h"
-#include "compiler/InfoSink.h"
-#include "compiler/OutputHLSL.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/OutputHLSL.h"
namespace sh
{
@@ -31,6 +31,14 @@ bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node)
{
TInfoSinkBase &out = mOutputHLSL->getBodyStream();
+ // If our right node doesn't have side effects, we know we don't need to unfold this
+ // expression: there will be no short-circuiting side effects to avoid
+ // (note: unfolding doesn't depend on the left node -- it will always be evaluated)
+ if (!node->getRight()->hasSideEffects())
+ {
+ return true;
+ }
+
switch (node->getOp())
{
case EOpLogicalOr:
@@ -49,7 +57,7 @@ bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node)
mTemporaryIndex = i + 1;
node->getLeft()->traverse(mOutputHLSL);
out << ";\n";
- out << "if(!s" << i << ")\n"
+ out << "if (!s" << i << ")\n"
"{\n";
mTemporaryIndex = i + 1;
node->getRight()->traverse(this);
@@ -80,7 +88,7 @@ bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node)
mTemporaryIndex = i + 1;
node->getLeft()->traverse(mOutputHLSL);
out << ";\n";
- out << "if(s" << i << ")\n"
+ out << "if (s" << i << ")\n"
"{\n";
mTemporaryIndex = i + 1;
node->getRight()->traverse(this);
@@ -115,7 +123,7 @@ bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
mTemporaryIndex = i + 1;
node->getCondition()->traverse(this);
- out << "if(";
+ out << "if (";
mTemporaryIndex = i + 1;
node->getCondition()->traverse(mOutputHLSL);
out << ")\n"
diff --git a/src/3rdparty/angle/src/compiler/UnfoldShortCircuit.h b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.h
index cb176a5f1c..1e416bc04c 100644
--- a/src/3rdparty/angle/src/compiler/UnfoldShortCircuit.h
+++ b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuit.h
@@ -9,8 +9,8 @@
#ifndef COMPILER_UNFOLDSHORTCIRCUIT_H_
#define COMPILER_UNFOLDSHORTCIRCUIT_H_
-#include "compiler/intermediate.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/ParseContext.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp
new file mode 100644
index 0000000000..29c4397d56
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp
@@ -0,0 +1,81 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/UnfoldShortCircuitAST.h"
+
+namespace
+{
+
+// "x || y" is equivalent to "x ? true : y".
+TIntermSelection *UnfoldOR(TIntermTyped *x, TIntermTyped *y)
+{
+ const TType boolType(EbtBool, EbpUndefined);
+ ConstantUnion *u = new ConstantUnion;
+ u->setBConst(true);
+ TIntermConstantUnion *trueNode = new TIntermConstantUnion(
+ u, TType(EbtBool, EbpUndefined, EvqConst, 1));
+ return new TIntermSelection(x, trueNode, y, boolType);
+}
+
+// "x && y" is equivalent to "x ? y : false".
+TIntermSelection *UnfoldAND(TIntermTyped *x, TIntermTyped *y)
+{
+ const TType boolType(EbtBool, EbpUndefined);
+ ConstantUnion *u = new ConstantUnion;
+ u->setBConst(false);
+ TIntermConstantUnion *falseNode = new TIntermConstantUnion(
+ u, TType(EbtBool, EbpUndefined, EvqConst, 1));
+ return new TIntermSelection(x, y, falseNode, boolType);
+}
+
+} // namespace anonymous
+
+bool UnfoldShortCircuitAST::visitBinary(Visit visit, TIntermBinary *node)
+{
+ TIntermSelection *replacement = NULL;
+
+ switch (node->getOp())
+ {
+ case EOpLogicalOr:
+ replacement = UnfoldOR(node->getLeft(), node->getRight());
+ break;
+ case EOpLogicalAnd:
+ replacement = UnfoldAND(node->getLeft(), node->getRight());
+ break;
+ default:
+ break;
+ }
+ if (replacement)
+ {
+ replacements.push_back(
+ NodeUpdateEntry(getParentNode(), node, replacement));
+ }
+ return true;
+}
+
+void UnfoldShortCircuitAST::updateTree()
+{
+ for (size_t ii = 0; ii < replacements.size(); ++ii)
+ {
+ const NodeUpdateEntry& entry = replacements[ii];
+ ASSERT(entry.parent);
+ bool replaced = entry.parent->replaceChildNode(
+ entry.original, entry.replacement);
+ ASSERT(replaced);
+
+ // In AST traversing, a parent is visited before its children.
+ // After we replace a node, if an immediate child is to
+ // be replaced, we need to make sure we don't update the replaced
+ // node; instead, we update the replacement node.
+ for (size_t jj = ii + 1; jj < replacements.size(); ++jj)
+ {
+ NodeUpdateEntry& entry2 = replacements[jj];
+ if (entry2.parent == entry.original)
+ entry2.parent = entry.replacement;
+ }
+ }
+}
+
diff --git a/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h
new file mode 100644
index 0000000000..24c14a60e3
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/UnfoldShortCircuitAST.h
@@ -0,0 +1,51 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// UnfoldShortCircuitAST is an AST traverser to replace short-circuiting
+// operations with ternary operations.
+//
+
+#ifndef COMPILER_UNFOLD_SHORT_CIRCUIT_AST_H_
+#define COMPILER_UNFOLD_SHORT_CIRCUIT_AST_H_
+
+#include "common/angleutils.h"
+#include "compiler/translator/intermediate.h"
+
+// This traverser identifies all the short circuit binary nodes that need to
+// be replaced, and creates the corresponding replacement nodes. However,
+// the actual replacements happen after the traverse through updateTree().
+
+class UnfoldShortCircuitAST : public TIntermTraverser
+{
+ public:
+ UnfoldShortCircuitAST() { }
+
+ virtual bool visitBinary(Visit visit, TIntermBinary *);
+
+ void updateTree();
+
+ private:
+ struct NodeUpdateEntry
+ {
+ NodeUpdateEntry(TIntermNode *_parent,
+ TIntermNode *_original,
+ TIntermNode *_replacement)
+ : parent(_parent),
+ original(_original),
+ replacement(_replacement) {}
+
+ TIntermNode *parent;
+ TIntermNode *original;
+ TIntermNode *replacement;
+ };
+
+ // During traversing, save all the replacements that need to happen;
+ // then replace them by calling updateNodes().
+ std::vector<NodeUpdateEntry> replacements;
+
+ DISALLOW_COPY_AND_ASSIGN(UnfoldShortCircuitAST);
+};
+
+#endif // COMPILER_UNFOLD_SHORT_CIRCUIT_AST_H_
diff --git a/src/3rdparty/angle/src/compiler/Uniform.cpp b/src/3rdparty/angle/src/compiler/translator/Uniform.cpp
index f367db2be8..922e13f071 100644
--- a/src/3rdparty/angle/src/compiler/Uniform.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Uniform.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/Uniform.h"
+#include "compiler/translator/Uniform.h"
namespace sh
{
diff --git a/src/3rdparty/angle/src/compiler/Uniform.h b/src/3rdparty/angle/src/compiler/translator/Uniform.h
index 4c53ffa7d2..4c53ffa7d2 100644
--- a/src/3rdparty/angle/src/compiler/Uniform.h
+++ b/src/3rdparty/angle/src/compiler/translator/Uniform.h
diff --git a/src/3rdparty/angle/src/compiler/ValidateLimitations.cpp b/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.cpp
index 736ceeaefc..3c2cc41cda 100644
--- a/src/3rdparty/angle/src/compiler/ValidateLimitations.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.cpp
@@ -4,10 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/ValidateLimitations.h"
-#include "compiler/InfoSink.h"
-#include "compiler/InitializeParseContext.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/ValidateLimitations.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/ParseContext.h"
namespace {
bool IsLoopIndex(const TIntermSymbol* symbol, const TLoopStack& stack) {
@@ -457,7 +457,7 @@ bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
bool ValidateLimitations::validateOperation(TIntermOperator* node,
TIntermNode* operand) {
// Check if loop index is modified in the loop body.
- if (!withinLoopBody() || !node->modifiesState())
+ if (!withinLoopBody() || !node->isAssignment())
return true;
const TIntermSymbol* symbol = operand->getAsSymbolNode();
diff --git a/src/3rdparty/angle/src/compiler/ValidateLimitations.h b/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h
index a835cb3c22..8839dd8b8a 100644
--- a/src/3rdparty/angle/src/compiler/ValidateLimitations.h
+++ b/src/3rdparty/angle/src/compiler/translator/ValidateLimitations.h
@@ -5,7 +5,7 @@
//
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
class TInfoSinkBase;
diff --git a/src/3rdparty/angle/src/compiler/VariableInfo.cpp b/src/3rdparty/angle/src/compiler/translator/VariableInfo.cpp
index f3f7b1ef35..ef888aff11 100644
--- a/src/3rdparty/angle/src/compiler/VariableInfo.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/VariableInfo.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/VariableInfo.h"
+#include "compiler/translator/VariableInfo.h"
namespace {
@@ -116,10 +116,12 @@ void getBuiltInVariableInfo(const TType& type,
varInfo.name = (name + "[0]").c_str();
varInfo.mappedName = (mappedName + "[0]").c_str();
varInfo.size = type.getArraySize();
+ varInfo.isArray = true;
} else {
varInfo.name = name.c_str();
varInfo.mappedName = mappedName.c_str();
varInfo.size = 1;
+ varInfo.isArray = false;
}
varInfo.precision = type.getPrecision();
varInfo.type = getVariableDataType(type);
@@ -167,6 +169,7 @@ TVariableInfo* findVariable(const TType& type,
TVariableInfo::TVariableInfo()
: type(SH_NONE),
size(0),
+ isArray(false),
precision(EbpUndefined),
staticUse(false)
{
@@ -175,6 +178,7 @@ TVariableInfo::TVariableInfo()
TVariableInfo::TVariableInfo(ShDataType type, int size)
: type(type),
size(size),
+ isArray(false),
precision(EbpUndefined),
staticUse(false)
{
diff --git a/src/3rdparty/angle/src/compiler/VariableInfo.h b/src/3rdparty/angle/src/compiler/translator/VariableInfo.h
index 3c7f2a5f84..37216cd142 100644
--- a/src/3rdparty/angle/src/compiler/VariableInfo.h
+++ b/src/3rdparty/angle/src/compiler/translator/VariableInfo.h
@@ -8,7 +8,7 @@
#define COMPILER_VARIABLE_INFO_H_
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
// Provides information about a variable.
// It is currently being used to store info about active attribs and uniforms.
@@ -20,6 +20,7 @@ struct TVariableInfo {
TPersistString mappedName;
ShDataType type;
int size;
+ bool isArray;
TPrecision precision;
bool staticUse;
};
diff --git a/src/3rdparty/angle/src/compiler/VariablePacker.cpp b/src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp
index 8957287763..5634d86337 100644
--- a/src/3rdparty/angle/src/compiler/VariablePacker.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/VariablePacker.cpp
@@ -3,10 +3,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/VariablePacker.h"
+#include "compiler/translator/VariablePacker.h"
#include <algorithm>
-#include "compiler/ShHandle.h"
+#include "compiler/translator/ShHandle.h"
namespace {
int GetSortOrder(ShDataType type)
diff --git a/src/3rdparty/angle/src/compiler/VariablePacker.h b/src/3rdparty/angle/src/compiler/translator/VariablePacker.h
index 8987066cc3..fd6090827c 100644
--- a/src/3rdparty/angle/src/compiler/VariablePacker.h
+++ b/src/3rdparty/angle/src/compiler/translator/VariablePacker.h
@@ -8,7 +8,7 @@
#define _VARIABLEPACKER_INCLUDED_
#include <vector>
-#include "compiler/ShHandle.h"
+#include "compiler/translator/ShHandle.h"
class VariablePacker {
public:
diff --git a/src/3rdparty/angle/src/compiler/VersionGLSL.cpp b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp
index 7a82bb4dc1..dd11f99eb8 100644
--- a/src/3rdparty/angle/src/compiler/VersionGLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/VersionGLSL.h"
+#include "compiler/translator/VersionGLSL.h"
static const int GLSL_VERSION_110 = 110;
static const int GLSL_VERSION_120 = 120;
diff --git a/src/3rdparty/angle/src/compiler/VersionGLSL.h b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.h
index 1c1cb1ab97..d310066171 100644
--- a/src/3rdparty/angle/src/compiler/VersionGLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/VersionGLSL.h
@@ -8,7 +8,7 @@
#define COMPILER_VERSIONGLSL_H_
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
// Traverses the intermediate tree to return the minimum GLSL version
// required to legally access all built-in features used in the shader.
diff --git a/src/3rdparty/angle/src/compiler/debug.cpp b/src/3rdparty/angle/src/compiler/translator/compilerdebug.cpp
index 53778bd3eb..10cbe43b8d 100644
--- a/src/3rdparty/angle/src/compiler/debug.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/compilerdebug.cpp
@@ -6,17 +6,17 @@
// debug.cpp: Debugging utilities.
-#include "compiler/debug.h"
+#include "compiler/translator/compilerdebug.h"
#include <stdarg.h>
#include <stdio.h>
-#include "compiler/InitializeParseContext.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/ParseContext.h"
+#ifdef TRACE_ENABLED
static const int kTraceBufferLen = 1024;
-#ifdef TRACE_ENABLED
extern "C" {
void Trace(const char *format, ...) {
if (!format) return;
diff --git a/src/3rdparty/angle/src/compiler/debug.h b/src/3rdparty/angle/src/compiler/translator/compilerdebug.h
index 7a371516af..7a371516af 100644
--- a/src/3rdparty/angle/src/compiler/debug.h
+++ b/src/3rdparty/angle/src/compiler/translator/compilerdebug.h
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraph.cpp b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.cpp
index ca661d6767..19ddf5c439 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraph.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.cpp
@@ -6,8 +6,8 @@
#pragma warning(disable: 4718)
-#include "compiler/depgraph/DependencyGraph.h"
-#include "compiler/depgraph/DependencyGraphBuilder.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
+#include "compiler/translator/depgraph/DependencyGraphBuilder.h"
TDependencyGraph::TDependencyGraph(TIntermNode* intermNode)
{
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraph.h b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.h
index 5a9c35d00b..5ea1cbb837 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraph.h
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraph.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_H
#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_H
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
#include <set>
#include <stack>
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphBuilder.cpp b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp
index d586cfd03c..d5f2cba5fc 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphBuilder.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/depgraph/DependencyGraphBuilder.h"
+#include "compiler/translator/depgraph/DependencyGraphBuilder.h"
void TDependencyGraphBuilder::build(TIntermNode* node, TDependencyGraph* graph)
{
@@ -94,7 +94,7 @@ void TDependencyGraphBuilder::visitSymbol(TIntermSymbol* intermSymbol)
bool TDependencyGraphBuilder::visitBinary(Visit visit, TIntermBinary* intermBinary)
{
TOperator op = intermBinary->getOp();
- if (op == EOpInitialize || intermBinary->modifiesState())
+ if (op == EOpInitialize || intermBinary->isAssignment())
visitAssignment(intermBinary);
else if (op == EOpLogicalAnd || op == EOpLogicalOr)
visitLogicalOp(intermBinary);
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphBuilder.h b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.h
index c5f232cb21..3e928fb77e 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphBuilder.h
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_BUILDER_H
#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_BUILDER_H
-#include "compiler/depgraph/DependencyGraph.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
//
// Creates a dependency graph of symbols, function calls, conditions etc. by traversing a
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphOutput.cpp b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphOutput.cpp
index 6fc489e7b6..e226333545 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphOutput.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphOutput.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/depgraph/DependencyGraphOutput.h"
+#include "compiler/translator/depgraph/DependencyGraphOutput.h"
void TDependencyGraphOutput::outputIndentation()
{
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphOutput.h b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphOutput.h
index 01447da987..c3a4112278 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphOutput.h
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphOutput.h
@@ -7,8 +7,8 @@
#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_OUTPUT_H
#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_OUTPUT_H
-#include "compiler/depgraph/DependencyGraph.h"
-#include "compiler/InfoSink.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
+#include "compiler/translator/InfoSink.h"
class TDependencyGraphOutput : public TDependencyGraphTraverser {
public:
diff --git a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphTraverse.cpp b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphTraverse.cpp
index b158575cec..197fde97e2 100644
--- a/src/3rdparty/angle/src/compiler/depgraph/DependencyGraphTraverse.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/depgraph/DependencyGraphTraverse.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/depgraph/DependencyGraph.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
// These methods do a breadth-first traversal through the graph and mark visited nodes.
diff --git a/src/3rdparty/angle/src/compiler/glslang.h b/src/3rdparty/angle/src/compiler/translator/glslang.h
index f221199093..f221199093 100644
--- a/src/3rdparty/angle/src/compiler/glslang.h
+++ b/src/3rdparty/angle/src/compiler/translator/glslang.h
diff --git a/src/3rdparty/angle/src/compiler/glslang.l b/src/3rdparty/angle/src/compiler/translator/glslang.l
index 60663f9a6b..ffc1aa18ac 100644
--- a/src/3rdparty/angle/src/compiler/glslang.l
+++ b/src/3rdparty/angle/src/compiler/translator/glslang.l
@@ -36,10 +36,10 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
}
%{
-#include "compiler/glslang.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/glslang.h"
+#include "compiler/translator/ParseContext.h"
#include "compiler/preprocessor/Token.h"
-#include "compiler/util.h"
+#include "compiler/translator/util.h"
#include "glslang_tab.h"
/* windows only pragma */
diff --git a/src/3rdparty/angle/src/compiler/glslang.y b/src/3rdparty/angle/src/compiler/translator/glslang.y
index c64f736f41..7614ff3447 100644
--- a/src/3rdparty/angle/src/compiler/glslang.y
+++ b/src/3rdparty/angle/src/compiler/translator/glslang.y
@@ -34,8 +34,8 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
#pragma warning(disable: 4701)
#endif
-#include "compiler/SymbolTable.h"
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/ParseContext.h"
#include "GLSLANG/ShaderLang.h"
#define YYENABLE_NLS 0
@@ -183,43 +183,55 @@ identifier
variable_identifier
: IDENTIFIER {
// The symbol table search was done in the lexical phase
- const TSymbol* symbol = $1.symbol;
- const TVariable* variable;
- if (symbol == 0) {
+ const TSymbol *symbol = $1.symbol;
+ const TVariable *variable = 0;
+
+ if (!symbol)
+ {
context->error(@1, "undeclared identifier", $1.string->c_str());
context->recover();
- TType type(EbtFloat, EbpUndefined);
- TVariable* fakeVariable = new TVariable($1.string, type);
- context->symbolTable.insert(*fakeVariable);
- variable = fakeVariable;
- } else {
- // This identifier can only be a variable type symbol
- if (! symbol->isVariable()) {
- context->error(@1, "variable expected", $1.string->c_str());
- context->recover();
- }
-
+ }
+ else if (!symbol->isVariable())
+ {
+ context->error(@1, "variable expected", $1.string->c_str());
+ context->recover();
+ }
+ else
+ {
variable = static_cast<const TVariable*>(symbol);
if (context->symbolTable.findBuiltIn(variable->getName()) &&
!variable->getExtension().empty() &&
- context->extensionErrorCheck(@1, variable->getExtension())) {
+ context->extensionErrorCheck(@1, variable->getExtension()))
+ {
context->recover();
}
}
- // don't delete $1.string, it's used by error recovery, and the pool
- // pop will reclaim the memory
+ if (!variable)
+ {
+ TType type(EbtFloat, EbpUndefined);
+ TVariable *fakeVariable = new TVariable($1.string, type);
+ context->symbolTable.insert(*fakeVariable);
+ variable = fakeVariable;
+ }
- if (variable->getType().getQualifier() == EvqConst ) {
+ if (variable->getType().getQualifier() == EvqConst)
+ {
ConstantUnion* constArray = variable->getConstPointer();
TType t(variable->getType());
$$ = context->intermediate.addConstantUnion(constArray, t, @1);
- } else
+ }
+ else
+ {
$$ = context->intermediate.addSymbol(variable->getUniqueId(),
variable->getName(),
variable->getType(),
@1);
+ }
+
+ // don't delete $1.string, it's used by error recovery, and the pool
+ // pop will reclaim the memory
}
;
diff --git a/src/3rdparty/angle/src/compiler/intermOut.cpp b/src/3rdparty/angle/src/compiler/translator/intermOut.cpp
index 13aa96af6d..f2f918d77a 100644
--- a/src/3rdparty/angle/src/compiler/intermOut.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/intermOut.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/localintermediate.h"
+#include "compiler/translator/localintermediate.h"
//
// Two purposes:
@@ -44,9 +44,9 @@ TString TType::getCompleteString() const
if (array)
stream << "array[" << getArraySize() << "] of ";
if (matrix)
- stream << size << "X" << size << " matrix of ";
+ stream << static_cast<int>(size) << "X" << static_cast<int>(size) << " matrix of ";
else if (size > 1)
- stream << size << "-component vector of ";
+ stream << static_cast<int>(size) << "-component vector of ";
stream << getBasicString();
return stream.str();
diff --git a/src/3rdparty/angle/src/compiler/intermediate.h b/src/3rdparty/angle/src/compiler/translator/intermediate.h
index 738621fe70..8f9fe23d3b 100644
--- a/src/3rdparty/angle/src/compiler/intermediate.h
+++ b/src/3rdparty/angle/src/compiler/translator/intermediate.h
@@ -19,9 +19,9 @@
#include "GLSLANG/ShaderLang.h"
#include <algorithm>
-#include "compiler/Common.h"
-#include "compiler/Types.h"
-#include "compiler/ConstantUnion.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/Types.h"
+#include "compiler/translator/ConstantUnion.h"
//
// Operators used by the high-level (parse tree) representation.
@@ -227,6 +227,11 @@ public:
virtual TIntermSymbol* getAsSymbolNode() { return 0; }
virtual TIntermLoop* getAsLoopNode() { return 0; }
+ // Replace a child node. Return true if |original| is a child
+ // node and it is replaced; otherwise, return false.
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement) = 0;
+
protected:
TSourceLoc line;
};
@@ -247,6 +252,8 @@ public:
TIntermTyped(const TType& t) : type(t) { }
virtual TIntermTyped* getAsTyped() { return this; }
+ virtual bool hasSideEffects() const = 0;
+
void setType(const TType& t) { type = t; }
const TType& getType() const { return type; }
TType* getTypePointer() { return &type; }
@@ -295,6 +302,8 @@ public:
virtual TIntermLoop* getAsLoopNode() { return this; }
virtual void traverse(TIntermTraverser*);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
TLoopType getType() const { return type; }
TIntermNode* getInit() { return init; }
@@ -325,6 +334,8 @@ public:
expression(e) { }
virtual void traverse(TIntermTraverser*);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
TOperator getFlowOp() { return flowOp; }
TIntermTyped* getExpression() { return expression; }
@@ -345,6 +356,8 @@ public:
TIntermSymbol(int i, const TString& sym, const TType& t) :
TIntermTyped(t), id(i) { symbol = sym; originalSymbol = sym; }
+ virtual bool hasSideEffects() const { return false; }
+
int getId() const { return id; }
const TString& getSymbol() const { return symbol; }
@@ -355,6 +368,7 @@ public:
virtual void traverse(TIntermTraverser*);
virtual TIntermSymbol* getAsSymbolNode() { return this; }
+ virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
protected:
int id;
@@ -366,14 +380,17 @@ class TIntermConstantUnion : public TIntermTyped {
public:
TIntermConstantUnion(ConstantUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
+ virtual bool hasSideEffects() const { return false; }
+
ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
- int getIConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; }
- float getFConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; }
- bool getBConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; }
+ int getIConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; }
+ float getFConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; }
+ bool getBConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; }
virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
virtual void traverse(TIntermTraverser*);
+ virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
TIntermTyped* fold(TOperator, TIntermTyped*, TInfoSink&);
@@ -389,12 +406,14 @@ public:
TOperator getOp() const { return op; }
void setOp(TOperator o) { op = o; }
- bool modifiesState() const;
+ bool isAssignment() const;
bool isConstructor() const;
+ virtual bool hasSideEffects() const { return isAssignment(); }
+
protected:
TIntermOperator(TOperator o) : TIntermTyped(TType(EbtFloat, EbpUndefined)), op(o) {}
- TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {}
+ TIntermOperator(TOperator o, const TType& t) : TIntermTyped(t), op(o) {}
TOperator op;
};
@@ -407,6 +426,10 @@ public:
virtual TIntermBinary* getAsBinaryNode() { return this; }
virtual void traverse(TIntermTraverser*);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ virtual bool hasSideEffects() const { return (isAssignment() || left->hasSideEffects() || right->hasSideEffects()); }
void setLeft(TIntermTyped* n) { left = n; }
void setRight(TIntermTyped* n) { right = n; }
@@ -430,11 +453,15 @@ protected:
//
class TIntermUnary : public TIntermOperator {
public:
- TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0), useEmulatedFunction(false) {}
+ TIntermUnary(TOperator o, const TType& t) : TIntermOperator(o, t), operand(0), useEmulatedFunction(false) {}
TIntermUnary(TOperator o) : TIntermOperator(o), operand(0), useEmulatedFunction(false) {}
virtual void traverse(TIntermTraverser*);
virtual TIntermUnary* getAsUnaryNode() { return this; }
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ virtual bool hasSideEffects() const { return (isAssignment() || operand->hasSideEffects()); }
void setOperand(TIntermTyped* o) { operand = o; }
TIntermTyped* getOperand() { return operand; }
@@ -465,6 +492,11 @@ public:
virtual TIntermAggregate* getAsAggregate() { return this; }
virtual void traverse(TIntermTraverser*);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ // Conservatively assume function calls and other aggregate operators have side-effects
+ virtual bool hasSideEffects() const { return true; }
TIntermSequence& getSequence() { return sequence; }
@@ -508,6 +540,11 @@ public:
TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
virtual void traverse(TIntermTraverser*);
+ virtual bool replaceChildNode(
+ TIntermNode *original, TIntermNode *replacement);
+
+ // Conservatively assume selections have side-effects
+ virtual bool hasSideEffects() const { return true; }
bool usesTernaryOperator() const { return getBasicType() != EbtVoid; }
TIntermNode* getCondition() const { return condition; }
@@ -547,7 +584,7 @@ public:
rightToLeft(rightToLeft),
depth(0),
maxDepth(0) {}
- virtual ~TIntermTraverser() {};
+ virtual ~TIntermTraverser() {}
virtual void visitSymbol(TIntermSymbol*) {}
virtual void visitConstantUnion(TIntermConstantUnion*) {}
@@ -559,8 +596,24 @@ public:
virtual bool visitBranch(Visit visit, TIntermBranch*) {return true;}
int getMaxDepth() const {return maxDepth;}
- void incrementDepth() {depth++; maxDepth = std::max(maxDepth, depth); }
- void decrementDepth() {depth--;}
+
+ void incrementDepth(TIntermNode *current)
+ {
+ depth++;
+ maxDepth = std::max(maxDepth, depth);
+ path.push_back(current);
+ }
+
+ void decrementDepth()
+ {
+ depth--;
+ path.pop_back();
+ }
+
+ TIntermNode *getParentNode()
+ {
+ return path.size() == 0 ? NULL : path.back();
+ }
// Return the original name if hash function pointer is NULL;
// otherwise return the hashed name.
@@ -574,6 +627,9 @@ public:
protected:
int depth;
int maxDepth;
+
+ // All the nodes from root to the current node's parent during traversing.
+ TVector<TIntermNode *> path;
};
#endif // __INTERMEDIATE_H
diff --git a/src/3rdparty/angle/src/compiler/localintermediate.h b/src/3rdparty/angle/src/compiler/translator/localintermediate.h
index 1214d821eb..b582e02f5d 100644
--- a/src/3rdparty/angle/src/compiler/localintermediate.h
+++ b/src/3rdparty/angle/src/compiler/translator/localintermediate.h
@@ -8,8 +8,8 @@
#define _LOCAL_INTERMEDIATE_INCLUDED_
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/SymbolTable.h"
struct TVectorFields {
int offsets[4];
@@ -39,7 +39,7 @@ public:
TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, const TSourceLoc&);
TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ;
- bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false);
+ bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false);
TIntermNode* addLoop(TLoopType, TIntermNode*, TIntermTyped*, TIntermTyped*, TIntermNode*, const TSourceLoc&);
TIntermBranch* addBranch(TOperator, const TSourceLoc&);
TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&);
diff --git a/src/3rdparty/angle/src/compiler/osinclude.h b/src/3rdparty/angle/src/compiler/translator/osinclude.h
index 60177d5fe5..cccfa6355c 100644
--- a/src/3rdparty/angle/src/compiler/osinclude.h
+++ b/src/3rdparty/angle/src/compiler/translator/osinclude.h
@@ -13,9 +13,6 @@
//
#if defined(_WIN32) || defined(_WIN64)
-#define STRICT
-#define VC_EXTRALEAN 1
-#include <windows.h>
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
#define ANGLE_OS_WINRT
#else
@@ -23,18 +20,27 @@
#endif
#elif defined(__APPLE__) || defined(__linux__) || \
defined(__FreeBSD__) || defined(__OpenBSD__) || \
+ defined(__NetBSD__) || defined(__DragonFly__) || \
defined(__sun) || defined(ANDROID) || \
defined(__GLIBC__) || defined(__GNU__) || \
defined(__QNX__)
#define ANGLE_OS_POSIX
-#include <pthread.h>
-#include <semaphore.h>
-#include <errno.h>
#else
#error Unsupported platform.
#endif
-#include "compiler/debug.h"
+#if defined(ANGLE_OS_WIN) || defined(ANGLE_OS_WINRT)
+#define STRICT
+#define VC_EXTRALEAN 1
+#include <windows.h>
+#elif defined(ANGLE_OS_POSIX)
+#include <pthread.h>
+#include <semaphore.h>
+#include <errno.h>
+#endif // ANGLE_OS_WIN
+
+
+#include "compiler/translator/compilerdebug.h"
//
// Thread Local Storage Operations
diff --git a/src/3rdparty/angle/src/compiler/ossource_posix.cpp b/src/3rdparty/angle/src/compiler/translator/ossource_posix.cpp
index 35510c1af5..d4bba4c70e 100644
--- a/src/3rdparty/angle/src/compiler/ossource_posix.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ossource_posix.cpp
@@ -7,7 +7,7 @@
//
// This file contains the posix specific functions
//
-#include "compiler/osinclude.h"
+#include "compiler/translator/osinclude.h"
#if !defined(ANGLE_OS_POSIX)
#error Trying to build a posix specific file in a non-posix build.
diff --git a/src/3rdparty/angle/src/compiler/ossource_win.cpp b/src/3rdparty/angle/src/compiler/translator/ossource_win.cpp
index 708a1ad311..abd8bc7833 100644
--- a/src/3rdparty/angle/src/compiler/ossource_win.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ossource_win.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/osinclude.h"
+#include "compiler/translator/osinclude.h"
//
// This file contains contains the window's specific functions
//
diff --git a/src/3rdparty/angle/src/compiler/ossource_winrt.cpp b/src/3rdparty/angle/src/compiler/translator/ossource_winrt.cpp
index 84443abc02..bb061ca85d 100644
--- a/src/3rdparty/angle/src/compiler/ossource_winrt.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/ossource_winrt.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/osinclude.h"
+#include "compiler/translator/osinclude.h"
//
// This file contains contains Windows Runtime specific functions
//
diff --git a/src/3rdparty/angle/src/compiler/parseConst.cpp b/src/3rdparty/angle/src/compiler/translator/parseConst.cpp
index 1cc5db8d77..a59f0be9d8 100644
--- a/src/3rdparty/angle/src/compiler/parseConst.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/parseConst.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/ParseHelper.h"
+#include "compiler/translator/ParseContext.h"
//
// Use this class to carry along data from node to node in
diff --git a/src/3rdparty/angle/src/compiler/timing/RestrictFragmentShaderTiming.cpp b/src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp
index 538b731b8e..a9f3f49ef3 100644
--- a/src/3rdparty/angle/src/compiler/timing/RestrictFragmentShaderTiming.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp
@@ -4,10 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/InfoSink.h"
-#include "compiler/ParseHelper.h"
-#include "compiler/depgraph/DependencyGraphOutput.h"
-#include "compiler/timing/RestrictFragmentShaderTiming.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/depgraph/DependencyGraphOutput.h"
+#include "compiler/translator/timing/RestrictFragmentShaderTiming.h"
RestrictFragmentShaderTiming::RestrictFragmentShaderTiming(TInfoSinkBase& sink)
: mSink(sink)
diff --git a/src/3rdparty/angle/src/compiler/timing/RestrictFragmentShaderTiming.h b/src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h
index 899165ca28..323cb62d8a 100644
--- a/src/3rdparty/angle/src/compiler/timing/RestrictFragmentShaderTiming.h
+++ b/src/3rdparty/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h
@@ -9,8 +9,8 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
-#include "compiler/depgraph/DependencyGraph.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
class TInfoSinkBase;
diff --git a/src/3rdparty/angle/src/compiler/timing/RestrictVertexShaderTiming.cpp b/src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp
index 355eb62d65..ee78c35450 100644
--- a/src/3rdparty/angle/src/compiler/timing/RestrictVertexShaderTiming.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/timing/RestrictVertexShaderTiming.h"
+#include "compiler/translator/timing/RestrictVertexShaderTiming.h"
void RestrictVertexShaderTiming::visitSymbol(TIntermSymbol* node)
{
diff --git a/src/3rdparty/angle/src/compiler/timing/RestrictVertexShaderTiming.h b/src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h
index 19a05fa68b..5f0dd3197a 100644
--- a/src/3rdparty/angle/src/compiler/timing/RestrictVertexShaderTiming.h
+++ b/src/3rdparty/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h
@@ -9,8 +9,8 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
-#include "compiler/InfoSink.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/InfoSink.h"
class TInfoSinkBase;
diff --git a/src/3rdparty/angle/src/compiler/util.cpp b/src/3rdparty/angle/src/compiler/translator/util.cpp
index d6e5eeed91..077bdcc48b 100644
--- a/src/3rdparty/angle/src/compiler/util.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/util.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/util.h"
+#include "compiler/translator/util.h"
#include <limits>
diff --git a/src/3rdparty/angle/src/compiler/util.h b/src/3rdparty/angle/src/compiler/translator/util.h
index dc69f39060..dc69f39060 100644
--- a/src/3rdparty/angle/src/compiler/util.h
+++ b/src/3rdparty/angle/src/compiler/translator/util.h
diff --git a/src/3rdparty/angle/src/libEGL/Display.cpp b/src/3rdparty/angle/src/libEGL/Display.cpp
index b18a876a55..e75a4b6440 100644
--- a/src/3rdparty/angle/src/libEGL/Display.cpp
+++ b/src/3rdparty/angle/src/libEGL/Display.cpp
@@ -1,3 +1,4 @@
+#include "../libGLESv2/precompiled.h"
//
// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -40,13 +41,13 @@ egl::Display *Display::getDisplay(EGLNativeDisplayType displayId)
// FIXME: Check if displayId is a valid display device context
- egl::Display *display = new egl::Display(displayId, (HDC)displayId);
+ egl::Display *display = new egl::Display(displayId);
displays[displayId] = display;
return display;
}
-Display::Display(EGLNativeDisplayType displayId, HDC deviceContext) : mDc(deviceContext)
+Display::Display(EGLNativeDisplayType displayId)
{
mDisplayId = displayId;
mRenderer = NULL;
@@ -71,7 +72,7 @@ bool Display::initialize()
return true;
}
- mRenderer = glCreateRenderer(this, mDc, mDisplayId);
+ mRenderer = glCreateRenderer(this, mDisplayId);
if (!mRenderer)
{
@@ -486,7 +487,7 @@ void Display::initExtensionString()
mExtensionString += "EGL_ANGLE_query_surface_pointer ";
-#if !defined(ANGLE_OS_WINRT)
+#if defined(ANGLE_ENABLE_D3D9)
HMODULE swiftShader = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
if (swiftShader)
{
@@ -525,7 +526,7 @@ void Display::initVendorString()
if (mRenderer && mRenderer->getLUID(&adapterLuid))
{
char adapterLuidString[64];
- snprintf(adapterLuidString, sizeof(adapterLuidString), " (adapter LUID: %08l%08l)", adapterLuid.HighPart, adapterLuid.LowPart);
+ snprintf(adapterLuidString, sizeof(adapterLuidString), " (adapter LUID: %08x%08x)", adapterLuid.HighPart, adapterLuid.LowPart);
mVendorString += adapterLuidString;
}
diff --git a/src/3rdparty/angle/src/libEGL/Display.h b/src/3rdparty/angle/src/libEGL/Display.h
index 5d55410440..cd07bb3388 100644
--- a/src/3rdparty/angle/src/libEGL/Display.h
+++ b/src/3rdparty/angle/src/libEGL/Display.h
@@ -11,8 +11,6 @@
#ifndef LIBEGL_DISPLAY_H_
#define LIBEGL_DISPLAY_H_
-#include "common/system.h"
-
#include <set>
#include <vector>
@@ -65,12 +63,11 @@ class Display
private:
DISALLOW_COPY_AND_ASSIGN(Display);
- Display(EGLNativeDisplayType displayId, HDC deviceContext);
+ Display(EGLNativeDisplayType displayId);
bool restoreLostDevice();
EGLNativeDisplayType mDisplayId;
- const HDC mDc;
bool mSoftwareDevice;
diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp
index dbff159d0e..3443355c07 100644
--- a/src/3rdparty/angle/src/libEGL/Surface.cpp
+++ b/src/3rdparty/angle/src/libEGL/Surface.cpp
@@ -1,3 +1,4 @@
+#include "../libGLESv2/precompiled.h"
//
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -10,6 +11,8 @@
#include <tchar.h>
+#include <algorithm>
+
#include "libEGL/Surface.h"
#include "common/debug.h"
@@ -20,8 +23,6 @@
#include "libEGL/main.h"
#include "libEGL/Display.h"
-#include <algorithm>
-
#if defined(ANGLE_OS_WINRT)
#include <windows.foundation.h>
#include <windows.ui.core.h>
@@ -118,12 +119,9 @@ bool Surface::resetSwapChain()
#else
ABI::Windows::Foundation::Rect windowRect;
ABI::Windows::UI::Core::ICoreWindow *window;
- HRESULT result = mWindow->QueryInterface(IID_PPV_ARGS(&window));
- if (FAILED(result))
- {
- ASSERT(false);
+ HRESULT hr = mWindow->QueryInterface(IID_PPV_ARGS(&window));
+ if (FAILED(hr))
return false;
- }
window->get_Bounds(&windowRect);
width = windowRect.Width;
height = windowRect.Height;
@@ -156,16 +154,9 @@ bool Surface::resetSwapChain()
bool Surface::resizeSwapChain(int backbufferWidth, int backbufferHeight)
{
+ ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
ASSERT(mSwapChain);
- // Prevent bad swap chain resize by calling reset if size is invalid
- if (backbufferWidth < 1 || backbufferHeight < 1)
- {
- mWidth = backbufferWidth;
- mHeight = backbufferHeight;
- return mSwapChain->reset(0, 0, mSwapInterval) == EGL_SUCCESS;
- }
-
EGLint status = mSwapChain->resize(backbufferWidth, backbufferHeight);
if (status == EGL_CONTEXT_LOST)
@@ -347,18 +338,26 @@ bool Surface::checkForOutOfDateSwapChain()
#else
ABI::Windows::Foundation::Rect windowRect;
ABI::Windows::UI::Core::ICoreWindow *window;
- HRESULT result = mWindow->QueryInterface(IID_PPV_ARGS(&window));
- if (FAILED(result))
- {
- ASSERT(false);
+ HRESULT hr = mWindow->QueryInterface(IID_PPV_ARGS(&window));
+ if (FAILED(hr))
return false;
- }
window->get_Bounds(&windowRect);
int clientWidth = windowRect.Width;
int clientHeight = windowRect.Height;
#endif
bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
+#if !defined(ANGLE_OS_WINRT)
+ if (IsIconic(getWindowHandle()))
+ {
+ // The window is automatically resized to 150x22 when it's minimized, but the swapchain shouldn't be resized
+ // because that's not a useful size to render to.
+ sizeDirty = false;
+ }
+#endif
+
+ bool wasDirty = (mSwapIntervalDirty || sizeDirty);
+
if (mSwapIntervalDirty)
{
resetSwapChain(clientWidth, clientHeight);
@@ -368,7 +367,7 @@ bool Surface::checkForOutOfDateSwapChain()
resizeSwapChain(clientWidth, clientHeight);
}
- if (mSwapIntervalDirty || sizeDirty)
+ if (wasDirty)
{
if (static_cast<egl::Surface*>(getCurrentDrawSurface()) == this)
{
diff --git a/src/3rdparty/angle/src/libEGL/Surface.h b/src/3rdparty/angle/src/libEGL/Surface.h
index ae9a380858..1d2303c6eb 100644
--- a/src/3rdparty/angle/src/libEGL/Surface.h
+++ b/src/3rdparty/angle/src/libEGL/Surface.h
@@ -15,7 +15,6 @@
#include <EGL/egl.h>
#include "common/angleutils.h"
-#include "windows.h"
namespace gl
{
@@ -80,7 +79,7 @@ private:
bool resetSwapChain(int backbufferWidth, int backbufferHeight);
bool swapRect(EGLint x, EGLint y, EGLint width, EGLint height);
- const EGLNativeWindowType mWindow; // Window that the surface is created for.
+ const EGLNativeWindowType mWindow; // Window that the surface is created for.
bool mWindowSubclassed; // Indicates whether we successfully subclassed mWindow for WM_RESIZE hooking
const egl::Config *mConfig; // EGL config surface was created with
EGLint mHeight; // Height of surface
diff --git a/src/3rdparty/angle/src/libEGL/libEGL.cpp b/src/3rdparty/angle/src/libEGL/libEGL.cpp
index 5bcb5d5959..b2944d5c0d 100644
--- a/src/3rdparty/angle/src/libEGL/libEGL.cpp
+++ b/src/3rdparty/angle/src/libEGL/libEGL.cpp
@@ -184,7 +184,7 @@ const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
case EGL_VENDOR:
return egl::success(display->getVendorString());
case EGL_VERSION:
- return egl::success("1.4 (ANGLE " VERSION_STRING ")");
+ return egl::success("1.4 (ANGLE " ANGLE_VERSION_STRING ")");
}
return egl::error(EGL_BAD_PARAMETER, (const char*)NULL);
@@ -821,13 +821,21 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte
return egl::error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
}
- if (share_context && static_cast<gl::Context*>(share_context)->isResetNotificationEnabled() != reset_notification)
+ gl::Context *sharedContextPtr = (share_context != EGL_NO_CONTEXT ? static_cast<gl::Context*>(share_context) : NULL);
+
+ if (sharedContextPtr != NULL && sharedContextPtr->isResetNotificationEnabled() != reset_notification)
{
return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
}
egl::Display *display = static_cast<egl::Display*>(dpy);
+ // Can not share contexts between displays
+ if (sharedContextPtr != NULL && sharedContextPtr->getRenderer() != display->getRenderer())
+ {
+ return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
+ }
+
if (!validateConfig(display, config))
{
return EGL_NO_CONTEXT;
diff --git a/src/3rdparty/angle/src/libEGL/libEGL.rc b/src/3rdparty/angle/src/libEGL/libEGL.rc
index 5d1f32f1c9..65e0aa50c8 100644
--- a/src/3rdparty/angle/src/libEGL/libEGL.rc
+++ b/src/3rdparty/angle/src/libEGL/libEGL.rc
@@ -54,8 +54,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
+ FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
+ PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -71,13 +71,14 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "ANGLE libEGL Dynamic Link Library"
- VALUE "FileVersion", VERSION_STRING
+ VALUE "FileVersion", ANGLE_VERSION_STRING
VALUE "InternalName", "libEGL"
VALUE "LegalCopyright", "Copyright (C) 2011 Google Inc."
VALUE "OriginalFilename", "libEGL.dll"
- VALUE "PrivateBuild", VERSION_STRING
+ VALUE "PrivateBuild", ANGLE_VERSION_STRING
VALUE "ProductName", "ANGLE libEGL Dynamic Link Library"
- VALUE "ProductVersion", VERSION_STRING
+ VALUE "ProductVersion", ANGLE_VERSION_STRING
+ VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE
END
END
BLOCK "VarFileInfo"
diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp
index 964b4b21fd..e972691a4f 100644
--- a/src/3rdparty/angle/src/libEGL/main.cpp
+++ b/src/3rdparty/angle/src/libEGL/main.cpp
@@ -11,15 +11,63 @@
#include "common/debug.h"
-#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
-
#if !defined(ANGLE_OS_WINRT)
static DWORD currentTLS = TLS_OUT_OF_INDEXES;
#else
static __declspec(thread) void *currentTLS = 0;
#endif
-namespace egl { Current *getCurrent(); }
+namespace egl
+{
+
+Current *AllocateCurrent()
+{
+#if !defined(ANGLE_OS_WINRT)
+ Current *current = (egl::Current*)LocalAlloc(LPTR, sizeof(egl::Current));
+#else
+ currentTLS = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Current));
+ Current *current = (egl::Current*)currentTLS;
+#endif
+
+ if (!current)
+ {
+ ERR("Could not allocate thread local storage.");
+ return NULL;
+ }
+
+#if !defined(ANGLE_OS_WINRT)
+ ASSERT(currentTLS != TLS_OUT_OF_INDEXES);
+ TlsSetValue(currentTLS, current);
+#endif
+
+ current->error = EGL_SUCCESS;
+ current->API = EGL_OPENGL_ES_API;
+ current->display = EGL_NO_DISPLAY;
+ current->drawSurface = EGL_NO_SURFACE;
+ current->readSurface = EGL_NO_SURFACE;
+
+ return current;
+}
+
+void DeallocateCurrent()
+{
+#if !defined(ANGLE_OS_WINRT)
+ void *current = TlsGetValue(currentTLS);
+
+ if (current)
+ {
+ LocalFree((HLOCAL)current);
+ }
+#else
+ if (currentTLS)
+ {
+ HeapFree(GetProcessHeap(), 0, currentTLS);
+ currentTLS = 0;
+ }
+#endif
+}
+
+}
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
@@ -27,7 +75,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
{
case DLL_PROCESS_ATTACH:
{
-#if !defined(ANGLE_DISABLE_TRACE)
+#if defined(ANGLE_ENABLE_TRACE)
FILE *debug = fopen(TRACE_OUTPUT_FILE, "rt");
if (debug)
@@ -41,7 +89,6 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
}
}
#endif
-
#if !defined(ANGLE_OS_WINRT)
currentTLS = TlsAlloc();
@@ -54,51 +101,19 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
// Fall throught to initialize index
case DLL_THREAD_ATTACH:
{
- egl::Current *current = egl::getCurrent();
-
- if (current)
- {
-#if !defined(ANGLE_OS_WINRT)
- TlsSetValue(currentTLS, current);
-#endif
- current->error = EGL_SUCCESS;
- current->API = EGL_OPENGL_ES_API;
- current->display = EGL_NO_DISPLAY;
- current->drawSurface = EGL_NO_SURFACE;
- current->readSurface = EGL_NO_SURFACE;
- }
+ egl::AllocateCurrent();
}
break;
case DLL_THREAD_DETACH:
{
- egl::Current *current = egl::getCurrent();
-
- if (current)
- {
-#if !defined(ANGLE_OS_WINRT)
- LocalFree((HLOCAL)current);
-#else
- HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current);
- currentTLS = 0;
-#endif
- }
+ egl::DeallocateCurrent();
}
break;
case DLL_PROCESS_DETACH:
{
- egl::Current *current = egl::getCurrent();
-
- if (current)
- {
+ egl::DeallocateCurrent();
#if !defined(ANGLE_OS_WINRT)
- LocalFree((HLOCAL)current);
- }
-
TlsFree(currentTLS);
-#else
- HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current);
- currentTLS = 0;
- }
#endif
}
break;
@@ -109,96 +124,94 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
return TRUE;
}
-#endif // !QT_OPENGL_ES_2_ANGLE_STATIC
-
namespace egl
{
-Current *getCurrent()
+
+Current *GetCurrentData()
{
#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
#if !defined(ANGLE_OS_WINRT)
Current *current = (Current*)TlsGetValue(currentTLS);
- if (!current)
- current = (Current*)LocalAlloc(LPTR, sizeof(Current));
- return current;
#else
- if (!currentTLS)
- currentTLS = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY, sizeof(Current));
- return (Current*)currentTLS;
+ Current *current = (Current*)currentTLS;
#endif
#else
// No precautions for thread safety taken as ANGLE is used single-threaded in Qt.
- static Current curr = { EGL_SUCCESS, EGL_OPENGL_ES_API, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE };
- return &curr;
+ static Current s_current = { EGL_SUCCESS, EGL_OPENGL_ES_API, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE };
+ Current *current = &s_current;
#endif
+
+ // ANGLE issue 488: when the dll is loaded after thread initialization,
+ // thread local storage (current) might not exist yet.
+ return (current ? current : AllocateCurrent());
}
void setCurrentError(EGLint error)
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
current->error = error;
}
EGLint getCurrentError()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->error;
}
void setCurrentAPI(EGLenum API)
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
current->API = API;
}
EGLenum getCurrentAPI()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->API;
}
void setCurrentDisplay(EGLDisplay dpy)
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
current->display = dpy;
}
EGLDisplay getCurrentDisplay()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->display;
}
void setCurrentDrawSurface(EGLSurface surface)
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
current->drawSurface = surface;
}
EGLSurface getCurrentDrawSurface()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->drawSurface;
}
void setCurrentReadSurface(EGLSurface surface)
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
current->readSurface = surface;
}
EGLSurface getCurrentReadSurface()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->readSurface;
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Buffer.cpp b/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
index 40baa95760..c007d5d9e9 100644
--- a/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
@@ -37,11 +37,11 @@ Buffer::~Buffer()
delete mStaticIndexBuffer;
}
-void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage, GLenum target)
+void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
{
mBufferStorage->clear();
mIndexRangeCache.clear();
- mBufferStorage->setData(data, size, 0, target);
+ mBufferStorage->setData(data, size, 0);
mUsage = usage;
@@ -54,9 +54,9 @@ void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage, GLenum
}
}
-void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset, GLenum target)
+void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
{
- mBufferStorage->setData(data, size, offset, target);
+ mBufferStorage->setData(data, size, offset);
mIndexRangeCache.invalidateRange(offset, size);
if ((mStaticVertexBuffer && mStaticVertexBuffer->getBufferSize() != 0) || (mStaticIndexBuffer && mStaticIndexBuffer->getBufferSize() != 0))
diff --git a/src/3rdparty/angle/src/libGLESv2/Buffer.h b/src/3rdparty/angle/src/libGLESv2/Buffer.h
index 9b86b9791f..4048f4b906 100644
--- a/src/3rdparty/angle/src/libGLESv2/Buffer.h
+++ b/src/3rdparty/angle/src/libGLESv2/Buffer.h
@@ -33,8 +33,8 @@ class Buffer : public RefCountObject
virtual ~Buffer();
- void bufferData(const void *data, GLsizeiptr size, GLenum usage, GLenum target);
- void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset, GLenum target);
+ void bufferData(const void *data, GLsizeiptr size, GLenum usage);
+ void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
GLenum usage() const;
diff --git a/src/3rdparty/angle/src/libGLESv2/Context.cpp b/src/3rdparty/angle/src/libGLESv2/Context.cpp
index e829d508a6..e651785aed 100644
--- a/src/3rdparty/angle/src/libGLESv2/Context.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Context.cpp
@@ -1779,7 +1779,7 @@ void Context::applyState(GLenum drawMode)
{
mask = 0xFFFFFFFF;
}
- mRenderer->setBlendState(mState.blend, mState.blendColor, mask);
+ mRenderer->setBlendState(framebufferObject, mState.blend, mState.blendColor, mask);
mRenderer->setDepthStencilState(mState.depthStencil, mState.stencilRef, mState.stencilBackRef,
mState.rasterizer.frontFace == GL_CCW);
@@ -1813,6 +1813,8 @@ void Context::applyTextures(SamplerType type)
{
ProgramBinary *programBinary = getCurrentProgramBinary();
+ FramebufferTextureSerialSet boundFramebufferTextures = getBoundFramebufferTextureSerials();
+
// Range of Direct3D samplers of given sampler type
int samplerCount = (type == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS : mRenderer->getMaxVertexTextureImageUnits();
int samplerRange = programBinary->getUsedSamplerRange(type);
@@ -1826,7 +1828,8 @@ void Context::applyTextures(SamplerType type)
TextureType textureType = programBinary->getSamplerTextureType(type, samplerIndex);
Texture *texture = getSamplerTexture(textureUnit, textureType);
- if (texture->isSamplerComplete())
+ if (texture->isSamplerComplete() &&
+ boundFramebufferTextures.find(texture->getTextureSerial()) == boundFramebufferTextures.end())
{
SamplerState samplerState;
texture->getSamplerState(&samplerState);
@@ -2656,6 +2659,29 @@ const char *Context::getRendererString() const
return mRendererString;
}
+Context::FramebufferTextureSerialSet Context::getBoundFramebufferTextureSerials()
+{
+ FramebufferTextureSerialSet set;
+
+ Framebuffer *drawFramebuffer = getDrawFramebuffer();
+ for (unsigned int i = 0; i < IMPLEMENTATION_MAX_DRAW_BUFFERS; i++)
+ {
+ Renderbuffer *renderBuffer = drawFramebuffer->getColorbuffer(i);
+ if (renderBuffer && renderBuffer->getTextureSerial() != 0)
+ {
+ set.insert(renderBuffer->getTextureSerial());
+ }
+ }
+
+ Renderbuffer *depthStencilBuffer = drawFramebuffer->getDepthOrStencilbuffer();
+ if (depthStencilBuffer && depthStencilBuffer->getTextureSerial() != 0)
+ {
+ set.insert(depthStencilBuffer->getTextureSerial());
+ }
+
+ return set;
+}
+
void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask)
diff --git a/src/3rdparty/angle/src/libGLESv2/Context.h b/src/3rdparty/angle/src/libGLESv2/Context.h
index 9c222be24d..3dc95e3b95 100644
--- a/src/3rdparty/angle/src/libGLESv2/Context.h
+++ b/src/3rdparty/angle/src/libGLESv2/Context.h
@@ -18,6 +18,7 @@
#include <string>
#include <map>
+#include <set>
#ifdef _MSC_VER
#include <hash_map>
#else
@@ -37,7 +38,6 @@ class Renderer;
namespace egl
{
-class Display;
class Surface;
}
@@ -73,7 +73,7 @@ enum QueryType
class VertexAttribute
{
public:
- VertexAttribute() : mType(GL_FLOAT), mSize(0), mNormalized(false), mStride(0), mPointer(NULL), mArrayEnabled(false), mDivisor(0)
+ VertexAttribute() : mType(GL_FLOAT), mSize(4), mNormalized(false), mStride(0), mPointer(NULL), mArrayEnabled(false), mDivisor(0)
{
mCurrentValue[0] = 0.0f;
mCurrentValue[1] = 0.0f;
@@ -398,6 +398,8 @@ class Context
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask);
+ rx::Renderer *getRenderer() { return mRenderer; }
+
private:
DISALLOW_COPY_AND_ASSIGN(Context);
@@ -419,6 +421,9 @@ class Context
void initExtensionString();
void initRendererString();
+ typedef std::set<unsigned> FramebufferTextureSerialSet;
+ FramebufferTextureSerialSet getBoundFramebufferTextureSerials();
+
rx::Renderer *const mRenderer;
State mState;
diff --git a/src/3rdparty/angle/src/libGLESv2/Framebuffer.h b/src/3rdparty/angle/src/libGLESv2/Framebuffer.h
index b54e008dd8..50bfd4fd0f 100644
--- a/src/3rdparty/angle/src/libGLESv2/Framebuffer.h
+++ b/src/3rdparty/angle/src/libGLESv2/Framebuffer.h
@@ -12,7 +12,7 @@
#include "common/angleutils.h"
#include "common/RefCountObject.h"
-#include "constants.h"
+#include "Constants.h"
namespace rx
{
diff --git a/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp b/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
index bcd04b7157..13c515a594 100644
--- a/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
@@ -34,6 +34,11 @@ std::string str(int i)
return buffer;
}
+static rx::D3DWorkaroundType DiscardWorkaround(bool usesDiscard)
+{
+ return (usesDiscard ? rx::ANGLE_D3D_WORKAROUND_SM3_OPTIMIZER : rx::ANGLE_D3D_WORKAROUND_NONE);
+}
+
UniformLocation::UniformLocation(const std::string &name, unsigned int element, unsigned int index)
: name(name), element(element), index(index)
{
@@ -1622,9 +1627,20 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
return false;
}
- int version = 0;
- stream.read(&version);
- if (version != VERSION_DWORD)
+ int majorVersion = 0;
+ int minorVersion = 0;
+ stream.read(&majorVersion);
+ stream.read(&minorVersion);
+ if (majorVersion != ANGLE_MAJOR_VERSION || minorVersion != ANGLE_MINOR_VERSION)
+ {
+ infoLog.append("Invalid program binary version.");
+ return false;
+ }
+
+#if !defined(ANGLE_ENABLE_UNIVERSAL_BINARY)
+ unsigned char commitString[ANGLE_COMMIT_HASH_SIZE];
+ stream.read(commitString, ANGLE_COMMIT_HASH_SIZE);
+ if (memcmp(commitString, ANGLE_COMMIT_HASH, sizeof(unsigned char) * ANGLE_COMMIT_HASH_SIZE) != 0)
{
infoLog.append("Invalid program binary version.");
return false;
@@ -1637,6 +1653,7 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
infoLog.append("Mismatched compilation flags.");
return false;
}
+#endif
for (int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
{
@@ -1727,6 +1744,7 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
const char *ptr = (const char*) binary + stream.offset();
+#if !defined(ANGLE_ENABLE_UNIVERSAL_BINARY)
const GUID *binaryIdentifier = (const GUID *) ptr;
ptr += sizeof(GUID);
@@ -1736,6 +1754,7 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
infoLog.append("Invalid program binary.");
return false;
}
+#endif
const char *pixelShaderFunction = ptr;
ptr += pixelShaderSize;
@@ -1791,9 +1810,12 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
BinaryOutputStream stream;
stream.write(GL_PROGRAM_BINARY_ANGLE);
- stream.write(VERSION_DWORD);
+ stream.write(ANGLE_MAJOR_VERSION);
+ stream.write(ANGLE_MINOR_VERSION);
+#if !defined(ANGLE_ENABLE_UNIVERSAL_BINARY)
+ stream.write(ANGLE_COMMIT_HASH, ANGLE_COMMIT_HASH_SIZE);
stream.write(ANGLE_COMPILE_OPTIMIZATION_LEVEL);
-
+#endif
for (unsigned int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
{
stream.write(mLinkedAttribute[i].type);
@@ -1849,7 +1871,9 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
UINT geometryShaderSize = (mGeometryExecutable != NULL) ? mGeometryExecutable->getLength() : 0;
stream.write(geometryShaderSize);
+#if !defined(ANGLE_ENABLE_UNIVERSAL_BINARY)
GUID identifier = mRenderer->getAdapterIdentifier();
+#endif
GLsizei streamLength = stream.length();
const void *streamData = stream.data();
@@ -1872,8 +1896,10 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
memcpy(ptr, streamData, streamLength);
ptr += streamLength;
+#if !defined(ANGLE_ENABLE_UNIVERSAL_BINARY)
memcpy(ptr, &identifier, sizeof(GUID));
ptr += sizeof(GUID);
+#endif
memcpy(ptr, mPixelExecutable->getFunction(), pixelShaderSize);
ptr += pixelShaderSize;
@@ -1962,13 +1988,13 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin
if (success)
{
- mVertexExecutable = mRenderer->compileToExecutable(infoLog, vertexHLSL.c_str(), rx::SHADER_VERTEX);
- mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), rx::SHADER_PIXEL);
+ mVertexExecutable = mRenderer->compileToExecutable(infoLog, vertexHLSL.c_str(), rx::SHADER_VERTEX, DiscardWorkaround(vertexShader->mUsesDiscardRewriting));
+ mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), rx::SHADER_PIXEL, DiscardWorkaround(fragmentShader->mUsesDiscardRewriting));
if (usesGeometryShader())
{
std::string geometryHLSL = generateGeometryShaderHLSL(registers, packing, fragmentShader, vertexShader);
- mGeometryExecutable = mRenderer->compileToExecutable(infoLog, geometryHLSL.c_str(), rx::SHADER_GEOMETRY);
+ mGeometryExecutable = mRenderer->compileToExecutable(infoLog, geometryHLSL.c_str(), rx::SHADER_GEOMETRY, rx::ANGLE_D3D_WORKAROUND_NONE);
}
if (!mVertexExecutable || !mPixelExecutable || (usesGeometryShader() && !mGeometryExecutable))
@@ -2587,7 +2613,9 @@ struct AttributeSorter
bool operator()(int a, int b)
{
- return originalIndices[a] == -1 ? false : originalIndices[a] < originalIndices[b];
+ if (originalIndices[a] == -1) return false;
+ if (originalIndices[b] == -1) return true;
+ return (originalIndices[a] < originalIndices[b]);
}
const int (&originalIndices)[MAX_VERTEX_ATTRIBS];
@@ -2615,7 +2643,7 @@ void ProgramBinary::sortAttributesByLayout(rx::TranslatedAttribute attributes[MA
for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
{
int oldIndex = mAttributesByLayout[i];
- sortedSemanticIndices[i] = mSemanticIndex[oldIndex];
+ sortedSemanticIndices[i] = oldIndex;
attributes[i] = oldTranslatedAttributes[oldIndex];
}
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Renderbuffer.cpp b/src/3rdparty/angle/src/libGLESv2/Renderbuffer.cpp
index 127513741c..98d33ec6c3 100644
--- a/src/3rdparty/angle/src/libGLESv2/Renderbuffer.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Renderbuffer.cpp
@@ -129,6 +129,11 @@ unsigned int RenderbufferTexture2D::getSerial() const
return mTexture2D->getRenderTargetSerial(mTarget);
}
+unsigned int RenderbufferTexture2D::getTextureSerial() const
+{
+ return mTexture2D->getTextureSerial();
+}
+
///// RenderbufferTextureCubeMap Implementation ////////
RenderbufferTextureCubeMap::RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target) : mTarget(target)
@@ -193,6 +198,11 @@ unsigned int RenderbufferTextureCubeMap::getSerial() const
return mTextureCubeMap->getRenderTargetSerial(mTarget);
}
+unsigned int RenderbufferTextureCubeMap::getTextureSerial() const
+{
+ return mTextureCubeMap->getTextureSerial();
+}
+
////// Renderbuffer Implementation //////
Renderbuffer::Renderbuffer(rx::Renderer *renderer, GLuint id, RenderbufferInterface *instance) : RefCountObject(id)
@@ -292,6 +302,11 @@ unsigned int Renderbuffer::getSerial() const
return mInstance->getSerial();
}
+unsigned int Renderbuffer::getTextureSerial() const
+{
+ return mInstance->getTextureSerial();
+}
+
void Renderbuffer::setStorage(RenderbufferStorage *newStorage)
{
ASSERT(newStorage != NULL);
diff --git a/src/3rdparty/angle/src/libGLESv2/Renderbuffer.h b/src/3rdparty/angle/src/libGLESv2/Renderbuffer.h
index eca2f3a780..d46fd44557 100644
--- a/src/3rdparty/angle/src/libGLESv2/Renderbuffer.h
+++ b/src/3rdparty/angle/src/libGLESv2/Renderbuffer.h
@@ -60,6 +60,7 @@ class RenderbufferInterface
GLuint getStencilSize() const;
virtual unsigned int getSerial() const = 0;
+ virtual unsigned int getTextureSerial() const = 0;
private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferInterface);
@@ -85,6 +86,7 @@ class RenderbufferTexture2D : public RenderbufferInterface
virtual GLsizei getSamples() const;
virtual unsigned int getSerial() const;
+ virtual unsigned int getTextureSerial() const;
private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture2D);
@@ -113,6 +115,7 @@ class RenderbufferTextureCubeMap : public RenderbufferInterface
virtual GLsizei getSamples() const;
virtual unsigned int getSerial() const;
+ virtual unsigned int getTextureSerial() const;
private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferTextureCubeMap);
@@ -141,6 +144,7 @@ class RenderbufferStorage : public RenderbufferInterface
virtual GLsizei getSamples() const;
virtual unsigned int getSerial() const;
+ virtual unsigned int getTextureSerial() const { return 0; }
static unsigned int issueSerial();
static unsigned int issueCubeSerials();
@@ -193,6 +197,7 @@ class Renderbuffer : public RefCountObject
GLsizei getSamples() const;
unsigned int getSerial() const;
+ unsigned int getTextureSerial() const;
void setStorage(RenderbufferStorage *newStorage);
diff --git a/src/3rdparty/angle/src/libGLESv2/Shader.cpp b/src/3rdparty/angle/src/libGLESv2/Shader.cpp
index 7dfdd0ba3a..f6a2f03dfc 100644
--- a/src/3rdparty/angle/src/libGLESv2/Shader.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Shader.cpp
@@ -307,6 +307,7 @@ void Shader::parseVaryings()
mUsesPointCoord = strstr(mHlsl, "GL_USES_POINT_COORD") != NULL;
mUsesDepthRange = strstr(mHlsl, "GL_USES_DEPTH_RANGE") != NULL;
mUsesFragDepth = strstr(mHlsl, "GL_USES_FRAG_DEPTH") != NULL;
+ mUsesDiscardRewriting = strstr(mHlsl, "ANGLE_USES_DISCARD_REWRITING") != NULL;
}
}
@@ -340,6 +341,7 @@ void Shader::uncompile()
mUsesPointCoord = false;
mUsesDepthRange = false;
mUsesFragDepth = false;
+ mUsesDiscardRewriting = false;
mActiveUniforms.clear();
}
diff --git a/src/3rdparty/angle/src/libGLESv2/Shader.h b/src/3rdparty/angle/src/libGLESv2/Shader.h
index 2afe2976c3..2015addd11 100644
--- a/src/3rdparty/angle/src/libGLESv2/Shader.h
+++ b/src/3rdparty/angle/src/libGLESv2/Shader.h
@@ -18,7 +18,7 @@
#include <list>
#include <vector>
-#include "compiler/Uniform.h"
+#include "compiler/translator/Uniform.h"
#include "common/angleutils.h"
namespace rx
@@ -107,6 +107,7 @@ class Shader
bool mUsesPointCoord;
bool mUsesDepthRange;
bool mUsesFragDepth;
+ bool mUsesDiscardRewriting;
static void *mFragmentCompiler;
static void *mVertexCompiler;
diff --git a/src/3rdparty/angle/src/libGLESv2/Texture.cpp b/src/3rdparty/angle/src/libGLESv2/Texture.cpp
index 72c0a8ab79..3257d05dd4 100644
--- a/src/3rdparty/angle/src/libGLESv2/Texture.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/Texture.cpp
@@ -14,8 +14,8 @@
#include "libGLESv2/main.h"
#include "libGLESv2/mathutil.h"
#include "libGLESv2/utilities.h"
-#ifndef ANGLE_ENABLE_D3D11
-# include "libGLESv2/renderer/Blit.h"
+#if defined(ANGLE_ENABLE_D3D9)
+# include "libGLESv2/renderer/d3d9/Blit.h"
#else
# define D3DFMT_UNKNOWN DXGI_FORMAT_UNKNOWN
#endif
@@ -1362,10 +1362,10 @@ void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size
for (int level = 0; level < levels; level++)
{
+ GLsizei mipSize = std::max(1, size >> level);
for (int face = 0; face < 6; face++)
{
- mImageArray[face][level]->redefine(mRenderer, internalformat, size, size, true);
- size = std::max(1, size >> 1);
+ mImageArray[face][level]->redefine(mRenderer, internalformat, mipSize, mipSize, true);
}
}
diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp b/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
index 91719f8e6d..814dfbf965 100644
--- a/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
@@ -758,7 +758,7 @@ void __stdcall glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data,
return gl::error(GL_INVALID_OPERATION);
}
- buffer->bufferData(data, size, usage, target);
+ buffer->bufferData(data, size, usage);
}
}
catch(std::bad_alloc&)
@@ -812,7 +812,7 @@ void __stdcall glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size,
return gl::error(GL_INVALID_VALUE);
}
- buffer->bufferSubData(data, size, offset, target);
+ buffer->bufferSubData(data, size, offset);
}
}
catch(std::bad_alloc&)
@@ -3844,9 +3844,9 @@ const GLubyte* __stdcall glGetString(GLenum name)
case GL_RENDERER:
return (GLubyte*)((context != NULL) ? context->getRendererString() : "ANGLE");
case GL_VERSION:
- return (GLubyte*)"OpenGL ES 2.0 (ANGLE " VERSION_STRING ")";
+ return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")";
case GL_SHADING_LANGUAGE_VERSION:
- return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " VERSION_STRING ")";
+ return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")";
case GL_EXTENSIONS:
return (GLubyte*)((context != NULL) ? context->getExtensionString() : "");
default:
@@ -4893,9 +4893,9 @@ void __stdcall glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samp
case GL_RGB565:
case GL_RGB8_OES:
case GL_RGBA8_OES:
- case GL_BGRA8_EXT:
case GL_STENCIL_INDEX8:
case GL_DEPTH24_STENCIL8_OES:
+ case GL_BGRA8_EXT:
context->setRenderbufferStorage(width, height, internalformat, samples);
break;
default:
diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2.rc b/src/3rdparty/angle/src/libGLESv2/libGLESv2.rc
index 0ad21e440e..76cd05566e 100644
--- a/src/3rdparty/angle/src/libGLESv2/libGLESv2.rc
+++ b/src/3rdparty/angle/src/libGLESv2/libGLESv2.rc
@@ -54,8 +54,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
+ FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
+ PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -71,13 +71,14 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "ANGLE libGLESv2 Dynamic Link Library"
- VALUE "FileVersion", VERSION_STRING
+ VALUE "FileVersion", ANGLE_VERSION_STRING
VALUE "InternalName", "libGLESv2"
VALUE "LegalCopyright", "Copyright (C) 2011 Google Inc."
VALUE "OriginalFilename", "libGLESv2.dll"
- VALUE "PrivateBuild", VERSION_STRING
+ VALUE "PrivateBuild", ANGLE_VERSION_STRING
VALUE "ProductName", "ANGLE libGLESv2 Dynamic Link Library"
- VALUE "ProductVersion", VERSION_STRING
+ VALUE "ProductVersion", ANGLE_VERSION_STRING
+ VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE
END
END
BLOCK "VarFileInfo"
diff --git a/src/3rdparty/angle/src/libGLESv2/main.cpp b/src/3rdparty/angle/src/libGLESv2/main.cpp
index defdf35f77..95f4b8de1c 100644
--- a/src/3rdparty/angle/src/libGLESv2/main.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/main.cpp
@@ -11,15 +11,60 @@
#include "libGLESv2/Context.h"
-#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
-
#if !defined(ANGLE_OS_WINRT)
static DWORD currentTLS = TLS_OUT_OF_INDEXES;
#else
static __declspec(thread) void *currentTLS = 0;
#endif
-namespace gl { Current *getCurrent(); }
+namespace gl
+{
+
+Current *AllocateCurrent()
+{
+#if !defined(ANGLE_OS_WINRT)
+ Current *current = (Current*)LocalAlloc(LPTR, sizeof(Current));
+#else
+ currentTLS = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Current));
+ Current *current = (Current*)currentTLS;
+#endif
+
+ if (!current)
+ {
+ ERR("Could not allocate thread local storage.");
+ return NULL;
+ }
+
+#if !defined(ANGLE_OS_WINRT)
+ ASSERT(currentTLS != TLS_OUT_OF_INDEXES);
+ TlsSetValue(currentTLS, current);
+#endif
+
+ current->context = NULL;
+ current->display = NULL;
+
+ return current;
+}
+
+void DeallocateCurrent()
+{
+#if !defined(ANGLE_OS_WINRT)
+ void *current = TlsGetValue(currentTLS);
+
+ if (current)
+ {
+ LocalFree((HLOCAL)current);
+ }
+#else
+ if (currentTLS)
+ {
+ HeapFree(GetProcessHeap(), 0, currentTLS);
+ currentTLS = 0;
+ }
+#endif
+}
+
+}
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
@@ -39,48 +84,19 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
// Fall throught to initialize index
case DLL_THREAD_ATTACH:
{
- gl::Current *current = gl::getCurrent();
-
- if (current)
- {
-#if !defined(ANGLE_OS_WINRT)
- TlsSetValue(currentTLS, current);
-#endif
- current->context = NULL;
- current->display = NULL;
- }
+ gl::AllocateCurrent();
}
break;
case DLL_THREAD_DETACH:
{
- gl::Current *current = gl::getCurrent();
-
- if (current)
- {
-#if !defined(ANGLE_OS_WINRT)
- LocalFree((HLOCAL)current);
-#else
- HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current);
- currentTLS = 0;
-#endif
- }
+ gl::DeallocateCurrent();
}
break;
case DLL_PROCESS_DETACH:
{
- gl::Current *current = gl::getCurrent();
-
- if (current)
- {
+ gl::DeallocateCurrent();
#if !defined(ANGLE_OS_WINRT)
- LocalFree((HLOCAL)current);
- }
-
TlsFree(currentTLS);
-#else
- HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current);
- currentTLS = 0;
- }
#endif
}
break;
@@ -91,33 +107,31 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
return TRUE;
}
-#endif // !QT_OPENGL_ES_2_ANGLE_STATIC
-
namespace gl
{
-Current *getCurrent()
+
+Current *GetCurrentData()
{
#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
#if !defined(ANGLE_OS_WINRT)
Current *current = (Current*)TlsGetValue(currentTLS);
- if (!current)
- current = (Current*)LocalAlloc(LPTR, sizeof(Current));
- return current;
#else
- if (!currentTLS)
- currentTLS = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY, sizeof(Current));
- return (Current*)currentTLS;
+ Current *current = (Current*)currentTLS;
#endif
#else
// No precautions for thread safety taken as ANGLE is used single-threaded in Qt.
- static gl::Current curr = { 0, 0 };
- return &curr;
+ static Current s_current = { 0, 0 };
+ Current *current = &s_current;
#endif
+
+ // ANGLE issue 488: when the dll is loaded after thread initialization,
+ // thread local storage (current) might not exist yet.
+ return (current ? current : AllocateCurrent());
}
void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
current->context = context;
current->display = display;
@@ -130,7 +144,7 @@ void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
Context *getContext()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->context;
}
@@ -156,7 +170,7 @@ Context *getNonLostContext()
egl::Display *getDisplay()
{
- Current *current = getCurrent();
+ Current *current = GetCurrentData();
return current->display;
}
diff --git a/src/3rdparty/angle/src/libGLESv2/main.h b/src/3rdparty/angle/src/libGLESv2/main.h
index 196afaeab6..69465c9bbf 100644
--- a/src/3rdparty/angle/src/libGLESv2/main.h
+++ b/src/3rdparty/angle/src/libGLESv2/main.h
@@ -10,7 +10,6 @@
#define LIBGLESV2_MAIN_H_
#include "common/debug.h"
-#include "common/system.h"
namespace egl
{
@@ -58,7 +57,7 @@ gl::Context *glCreateContext(const gl::Context *shareContext, rx::Renderer *rend
void glDestroyContext(gl::Context *context);
void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
gl::Context *glGetCurrentContext();
-rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayType displayId);
+rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType displayId);
void glDestroyRenderer(rx::Renderer *renderer);
__eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname);
diff --git a/src/3rdparty/angle/src/libGLESv2/mathutil.h b/src/3rdparty/angle/src/libGLESv2/mathutil.h
index 083548669a..6474b66745 100644
--- a/src/3rdparty/angle/src/libGLESv2/mathutil.h
+++ b/src/3rdparty/angle/src/libGLESv2/mathutil.h
@@ -11,7 +11,6 @@
#include <intrin.h>
-#include "common/system.h"
#include "common/debug.h"
namespace gl
diff --git a/src/3rdparty/angle/src/libGLESv2/precompiled.h b/src/3rdparty/angle/src/libGLESv2/precompiled.h
index 823d27bb60..2ff09f531e 100644
--- a/src/3rdparty/angle/src/libGLESv2/precompiled.h
+++ b/src/3rdparty/angle/src/libGLESv2/precompiled.h
@@ -33,26 +33,53 @@
#include <vector>
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
-#define ANGLE_OS_WINRT
-#if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
-#define ANGLE_OS_WINPHONE
+# define ANGLE_OS_WINRT
+# if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
+# define ANGLE_OS_WINPHONE
+# endif
#endif
+
+#if defined(ANGLE_ENABLE_D3D9)
+# include <d3d9.h>
+#endif
+#if defined(ANGLE_ENABLE_D3D11)
+# if !defined(ANGLE_OS_WINRT)
+# include <d3d11.h>
+# else
+# include <d3d11_1.h>
+# define Sleep(x) WaitForSingleObjectEx(GetCurrentThread(), x, FALSE)
+# define GetVersion() WINVER
+# define LoadLibrary(x) LoadPackagedLibrary(x, NULL)
+# endif
+# include <dxgi.h>
+#endif
+#if !defined(ANGLE_OS_WINPHONE)
+# include <d3dcompiler.h>
#endif
-#ifndef ANGLE_ENABLE_D3D11
-#include <d3d9.h>
-#else
-#if !defined(ANGLE_OS_WINRT)
-#include <D3D11.h>
-#else
-#include <d3d11_1.h>
-#define Sleep(x) WaitForSingleObjectEx(GetCurrentThread(), x, FALSE)
-#define GetVersion() WINVER
+#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL0
+#define D3DCOMPILE_OPTIMIZATION_LEVEL0 (1 << 14)
+#endif
+#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL1
+#define D3DCOMPILE_OPTIMIZATION_LEVEL1 0
+#endif
+#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL2
+#define D3DCOMPILE_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15))
+#endif
+#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL3
+#define D3DCOMPILE_OPTIMIZATION_LEVEL3 (1 << 15)
+#endif
+#ifndef D3DCOMPILE_DEBUG
+#define D3DCOMPILE_DEBUG (1 << 0)
+#endif
+#ifndef D3DCOMPILE_SKIP_OPTIMIZATION
+#define D3DCOMPILE_SKIP_OPTIMIZATION (1 << 2)
#endif
-#include <dxgi.h>
+#ifndef D3DCOMPILE_AVOID_FLOW_CONTROL
+#define D3DCOMPILE_AVOID_FLOW_CONTROL (1 << 9)
#endif
-#ifndef ANGLE_OS_WINPHONE
-#include <D3Dcompiler.h>
+#ifndef D3DCOMPILE_PREFER_FLOW_CONTROL
+#define D3DCOMPILE_PREFER_FLOW_CONTROL (1 << 10)
#endif
#ifdef _MSC_VER
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h
index 14a8c2765b..ace1a11bae 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h
@@ -22,7 +22,7 @@ class BufferStorage
// The data returned is only guaranteed valid until next non-const method.
virtual void *getData() = 0;
- virtual void setData(const void* data, unsigned int size, unsigned int offset, unsigned int target) = 0;
+ virtual void setData(const void* data, unsigned int size, unsigned int offset) = 0;
virtual void clear() = 0;
virtual unsigned int getSize() const = 0;
virtual bool supportsDirectBinding() const = 0;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp
deleted file mode 100644
index 2f694db061..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// BufferStorage11.cpp Defines the BufferStorage11 class.
-
-#include "libGLESv2/renderer/BufferStorage11.h"
-#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/Renderer11.h"
-
-namespace rx
-{
-
-BufferStorage11::BufferStorage11(Renderer11 *renderer)
-{
- mRenderer = renderer;
-
- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
-
- mBuffer = NULL;
- mBufferSize = 0;
-
- mSize = 0;
-
- mResolvedData = NULL;
- mResolvedDataSize = 0;
- mResolvedDataValid = false;
-
- mReadUsageCount = 0;
- mWriteUsageCount = 0;
-}
-
-BufferStorage11::~BufferStorage11()
-{
- if (mStagingBuffer)
- {
- mStagingBuffer->Release();
- mStagingBuffer = NULL;
- }
-
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- }
-
- if (mResolvedData)
- {
- free(mResolvedData);
- mResolvedData = NULL;
- }
-}
-
-BufferStorage11 *BufferStorage11::makeBufferStorage11(BufferStorage *bufferStorage)
-{
- ASSERT(HAS_DYNAMIC_TYPE(BufferStorage11*, bufferStorage));
- return static_cast<BufferStorage11*>(bufferStorage);
-}
-
-void *BufferStorage11::getData()
-{
- if (!mResolvedDataValid)
- {
- ID3D11Device *device = mRenderer->getDevice();
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- HRESULT result;
-
- if (!mStagingBuffer || mStagingBufferSize < mBufferSize)
- {
- if (mStagingBuffer)
- {
- mStagingBuffer->Release();
- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
- }
-
- D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = mSize;
- bufferDesc.Usage = D3D11_USAGE_STAGING;
- bufferDesc.BindFlags = 0;
- bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
- bufferDesc.MiscFlags = 0;
- bufferDesc.StructureByteStride = 0;
-
- result = device->CreateBuffer(&bufferDesc, NULL, &mStagingBuffer);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY, (void*)NULL);
- }
-
- mStagingBufferSize = bufferDesc.ByteWidth;
- }
-
- if (!mResolvedData || mResolvedDataSize < mBufferSize)
- {
- free(mResolvedData);
- mResolvedData = malloc(mSize);
- mResolvedDataSize = mSize;
- }
-
- D3D11_BOX srcBox;
- srcBox.left = 0;
- srcBox.right = mSize;
- srcBox.top = 0;
- srcBox.bottom = 1;
- srcBox.front = 0;
- srcBox.back = 1;
-
- context->CopySubresourceRegion(mStagingBuffer, 0, 0, 0, 0, mBuffer, 0, &srcBox);
-
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result = context->Map(mStagingBuffer, 0, D3D11_MAP_READ, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY, (void*)NULL);
- }
-
- memcpy(mResolvedData, mappedResource.pData, mSize);
-
- context->Unmap(mStagingBuffer, 0);
-
- mResolvedDataValid = true;
- }
-
- mReadUsageCount = 0;
-
- return mResolvedData;
-}
-
-void BufferStorage11::setData(const void* data, unsigned int size, unsigned int offset, unsigned int target)
-{
- ID3D11Device *device = mRenderer->getDevice();
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- HRESULT result;
-
- unsigned int requiredBufferSize = size + offset;
- unsigned int requiredStagingSize = size;
- bool directInitialization = offset == 0 && (!mBuffer || mBufferSize < size + offset);
-
- if (!directInitialization)
- {
- if (!mStagingBuffer || mStagingBufferSize < requiredStagingSize)
- {
- if (mStagingBuffer)
- {
- mStagingBuffer->Release();
- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
- }
-
- D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = size;
- bufferDesc.Usage = D3D11_USAGE_STAGING;
- bufferDesc.BindFlags = 0;
- bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
- bufferDesc.MiscFlags = 0;
- bufferDesc.StructureByteStride = 0;
-
- if (data)
- {
- D3D11_SUBRESOURCE_DATA initialData;
- initialData.pSysMem = data;
- initialData.SysMemPitch = size;
- initialData.SysMemSlicePitch = 0;
-
- result = device->CreateBuffer(&bufferDesc, &initialData, &mStagingBuffer);
- }
- else
- {
- result = device->CreateBuffer(&bufferDesc, NULL, &mStagingBuffer);
- }
-
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- mStagingBufferSize = size;
- }
- else if (data)
- {
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result = context->Map(mStagingBuffer, 0, D3D11_MAP_WRITE, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- memcpy(mappedResource.pData, data, size);
-
- context->Unmap(mStagingBuffer, 0);
- }
- }
-
- if (!mBuffer || mBufferSize < size + offset)
- {
- D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = requiredBufferSize;
- bufferDesc.Usage = D3D11_USAGE_DEFAULT;
- if (mRenderer->getFeatureLevel() > D3D_FEATURE_LEVEL_9_3)
- bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER | D3D11_BIND_INDEX_BUFFER;
- else
- bufferDesc.BindFlags = target == GL_ARRAY_BUFFER ? D3D11_BIND_VERTEX_BUFFER : D3D11_BIND_INDEX_BUFFER;
- bufferDesc.CPUAccessFlags = 0;
- bufferDesc.MiscFlags = 0;
- bufferDesc.StructureByteStride = 0;
-
- if (directInitialization)
- {
- // Since the data will fill the entire buffer (being larger than the initial size and having
- // no offset), the buffer can be initialized with the data so no staging buffer is required
-
- // No longer need the old buffer
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- mBufferSize = 0;
- }
-
- if (data)
- {
- D3D11_SUBRESOURCE_DATA initialData;
- initialData.pSysMem = data;
- initialData.SysMemPitch = size;
- initialData.SysMemSlicePitch = 0;
-
- result = device->CreateBuffer(&bufferDesc, &initialData, &mBuffer);
- }
- else
- {
- result = device->CreateBuffer(&bufferDesc, NULL, &mBuffer);
- }
-
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
- }
- else if (mBuffer && offset > 0)
- {
- // If offset is greater than zero and the buffer is non-null, need to preserve the data from
- // the old buffer up to offset
- ID3D11Buffer *newBuffer = NULL;
-
- result = device->CreateBuffer(&bufferDesc, NULL, &newBuffer);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- D3D11_BOX srcBox;
- srcBox.left = 0;
- srcBox.right = std::min(offset, mBufferSize);
- srcBox.top = 0;
- srcBox.bottom = 1;
- srcBox.front = 0;
- srcBox.back = 1;
-
- context->CopySubresourceRegion(newBuffer, 0, 0, 0, 0, mBuffer, 0, &srcBox);
-
- mBuffer->Release();
- mBuffer = newBuffer;
- }
- else
- {
- // Simple case, nothing needs to be copied from the old buffer to the new one, just create
- // a new buffer
-
- // No longer need the old buffer
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- mBufferSize = 0;
- }
-
- // Create a new buffer for data storage
- result = device->CreateBuffer(&bufferDesc, NULL, &mBuffer);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
- }
-
- updateSerial();
- mBufferSize = bufferDesc.ByteWidth;
- }
-
- if (!directInitialization)
- {
- ASSERT(mStagingBuffer && mStagingBufferSize >= requiredStagingSize);
-
- // Data is already put into the staging buffer, copy it over to the data buffer
- D3D11_BOX srcBox;
- srcBox.left = 0;
- srcBox.right = size;
- srcBox.top = 0;
- srcBox.bottom = 1;
- srcBox.front = 0;
- srcBox.back = 1;
-
- context->CopySubresourceRegion(mBuffer, 0, offset, 0, 0, mStagingBuffer, 0, &srcBox);
- }
-
- mSize = std::max(mSize, offset + size);
-
- mWriteUsageCount = 0;
-
- mResolvedDataValid = false;
-}
-
-void BufferStorage11::clear()
-{
- mResolvedDataValid = false;
- mSize = 0;
-}
-
-unsigned int BufferStorage11::getSize() const
-{
- return mSize;
-}
-
-bool BufferStorage11::supportsDirectBinding() const
-{
- return mRenderer->getFeatureLevel() >= D3D_FEATURE_LEVEL_10_0;
-}
-
-void BufferStorage11::markBufferUsage()
-{
- mReadUsageCount++;
- mWriteUsageCount++;
-
- static const unsigned int usageLimit = 5;
-
- if (mReadUsageCount > usageLimit && mResolvedData)
- {
- free(mResolvedData);
- mResolvedData = NULL;
- mResolvedDataSize = 0;
- mResolvedDataValid = false;
- }
-
- if (mReadUsageCount > usageLimit && mWriteUsageCount > usageLimit && mStagingBuffer)
- {
- mStagingBuffer->Release();
- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
- }
-}
-
-ID3D11Buffer *BufferStorage11::getBuffer() const
-{
- return mBuffer;
-}
-
-}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h
deleted file mode 100644
index c9489627c3..0000000000
--- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// BufferStorage11.h Defines the BufferStorage11 class.
-
-#ifndef LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
-#define LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
-
-#include "libGLESv2/renderer/BufferStorage.h"
-
-namespace rx
-{
-class Renderer11;
-
-class BufferStorage11 : public BufferStorage
-{
- public:
- explicit BufferStorage11(Renderer11 *renderer);
- virtual ~BufferStorage11();
-
- static BufferStorage11 *makeBufferStorage11(BufferStorage *bufferStorage);
-
- virtual void *getData();
- virtual void setData(const void* data, unsigned int size, unsigned int offset, unsigned int target);
- virtual void clear();
- virtual unsigned int getSize() const;
- virtual bool supportsDirectBinding() const;
- virtual void markBufferUsage();
-
- ID3D11Buffer *getBuffer() const;
-
- private:
- Renderer11 *mRenderer;
-
- ID3D11Buffer *mStagingBuffer;
- unsigned int mStagingBufferSize;
-
- ID3D11Buffer *mBuffer;
- unsigned int mBufferSize;
-
- unsigned int mSize;
-
- void *mResolvedData;
- unsigned int mResolvedDataSize;
- bool mResolvedDataValid;
-
- unsigned int mReadUsageCount;
- unsigned int mWriteUsageCount;
-};
-
-}
-
-#endif // LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
index 39fd0f41f0..5278113811 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
@@ -11,35 +11,26 @@
#include "libGLESv2/main.h"
#include "libGLESv2/Program.h"
#include "libGLESv2/renderer/Renderer.h"
-#ifndef ANGLE_ENABLE_D3D11
-#include "libGLESv2/renderer/Renderer9.h"
-#else
-#include "libGLESv2/renderer/Renderer11.h"
+#if defined(ANGLE_ENABLE_D3D9)
+# include "libGLESv2/renderer/d3d9/Renderer9.h"
+#endif
+#if defined(ANGLE_ENABLE_D3D11)
+# include "libGLESv2/renderer/d3d11/Renderer11.h"
#endif
#include "libGLESv2/utilities.h"
#include "third_party/trace_event/trace_event.h"
-#if !defined(ANGLE_ENABLE_D3D11)
-// Enables use of the Direct3D 11 API for a default display, when available
-#define ANGLE_ENABLE_D3D11 0
-#endif
-
#ifndef D3DERR_OUTOFVIDEOMEMORY
#define D3DERR_OUTOFVIDEOMEMORY MAKE_HRESULT(1, 0x876, 380)
#endif
-#ifndef D3DCOMPILER_DLL
-#define D3DCOMPILER_DLL L"d3dcompiler_43.dll" // Lowest common denominator
-#endif
+#if defined(__MINGW32__) || defined(ANGLE_OS_WINPHONE)
-#ifndef QT_D3DCOMPILER_DLL
-#define QT_D3DCOMPILER_DLL D3DCOMPILER_DLL
-#endif
+#ifndef D3DCOMPILER_DLL
-#if defined(__MINGW32__) || defined(ANGLE_OS_WINPHONE)
+// Add define + typedefs for older MinGW-w64 headers (pre 5783)
-//Add define + typedefs for older MinGW-w64 headers (pre 5783)
-//Also define these on Windows Phone, which doesn't have a shader compiler
+#define D3DCOMPILER_DLL L"d3dcompiler_43.dll"
HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filename,
const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint,
@@ -48,8 +39,14 @@ typedef HRESULT (WINAPI *pD3DCompile)(const void *data, SIZE_T data_size, const
const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint,
const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages);
+#endif // D3DCOMPILER_DLL
+
#endif // __MINGW32__ || ANGLE_OS_WINPHONE
+#ifndef QT_D3DCOMPILER_DLL
+#define QT_D3DCOMPILER_DLL D3DCOMPILER_DLL
+#endif
+
namespace rx
{
@@ -82,7 +79,8 @@ bool Renderer::initializeCompiler()
break;
}
}
-#else
+#endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
+
// Load the compiler DLL specified by the environment, or default to QT_D3DCOMPILER_DLL
#if !defined(ANGLE_OS_WINRT)
const wchar_t *defaultCompiler = _wgetenv(L"QT_D3DCOMPILER_DLL");
@@ -109,15 +107,11 @@ bool Renderer::initializeCompiler()
// Load the first available known compiler DLL
for (int i = 0; compilerDlls[i]; ++i)
{
-#if !defined(ANGLE_OS_WINRT)
+ // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with.
mD3dCompilerModule = LoadLibrary(compilerDlls[i]);
-#else
- mD3dCompilerModule = LoadPackagedLibrary(compilerDlls[i], NULL);
-#endif
if (mD3dCompilerModule)
break;
}
-#endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
if (!mD3dCompilerModule)
{
@@ -230,18 +224,46 @@ ShaderBlob *Renderer::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, co
extern "C"
{
-rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayType displayId)
+rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType displayId)
{
rx::Renderer *renderer = NULL;
EGLint status = EGL_BAD_ALLOC;
-#if ANGLE_ENABLE_D3D11
- renderer = new rx::Renderer11(display, hDc);
-#else
- bool softwareDevice = (displayId == EGL_SOFTWARE_DISPLAY_ANGLE);
- renderer = new rx::Renderer9(display, hDc, softwareDevice);
+#if defined(ANGLE_OS_WINRT)
+ if (displayId == EGL_DEFAULT_DISPLAY)
+ displayId = EGL_D3D11_ONLY_DISPLAY_ANGLE;
#endif
+#if defined(ANGLE_ENABLE_D3D11)
+ if (displayId == EGL_DEFAULT_DISPLAY ||
+ displayId == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
+ displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
+ {
+ renderer = new rx::Renderer11(display);
+
+ if (renderer)
+ {
+ status = renderer->initialize();
+ }
+
+ if (status == EGL_SUCCESS)
+ {
+ return renderer;
+ }
+ else if (displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
+ {
+ return NULL;
+ }
+
+ // Failed to create a D3D11 renderer, try creating a D3D9 renderer
+ delete renderer;
+ }
+#endif // ANGLE_ENABLE_D3D11
+
+#if defined(ANGLE_ENABLE_D3D9)
+ bool softwareDevice = (displayId == EGL_SOFTWARE_DISPLAY_ANGLE);
+ renderer = new rx::Renderer9(display, displayId, softwareDevice);
+
if (renderer)
{
status = renderer->initialize();
@@ -251,6 +273,7 @@ rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayT
{
return renderer;
}
+#endif // ANGLE_ENABLE_D3D9
return NULL;
}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h
index ac67c27e71..79578b2458 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h
@@ -14,30 +14,6 @@
#include "libGLESv2/Uniform.h"
#include "libGLESv2/angletypes.h"
-#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL0
-#define D3DCOMPILE_OPTIMIZATION_LEVEL0 (1 << 14)
-#endif
-#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL1
-#define D3DCOMPILE_OPTIMIZATION_LEVEL1 0
-#endif
-#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL2
-#define D3DCOMPILE_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15))
-#endif
-#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL3
-#define D3DCOMPILE_OPTIMIZATION_LEVEL3 (1 << 15)
-#endif
-#ifndef D3DCOMPILE_DEBUG
-#define D3DCOMPILE_DEBUG (1 << 0)
-#endif
-#ifndef D3DCOMPILE_SKIP_OPTIMIZATION
-#define D3DCOMPILE_SKIP_OPTIMIZATION (1 << 2)
-#endif
-#ifndef D3DCOMPILE_AVOID_FLOW_CONTROL
-#define D3DCOMPILE_AVOID_FLOW_CONTROL (1 << 9)
-#endif
-#ifndef D3DCOMPILE_PREFER_FLOW_CONTROL
-#define D3DCOMPILE_PREFER_FLOW_CONTROL (1 << 10)
-#endif
#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
#endif
@@ -118,6 +94,12 @@ enum ShaderType
SHADER_GEOMETRY
};
+enum D3DWorkaroundType
+{
+ ANGLE_D3D_WORKAROUND_NONE,
+ ANGLE_D3D_WORKAROUND_SM3_OPTIMIZER
+};
+
class Renderer
{
public:
@@ -138,7 +120,7 @@ class Renderer
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture) = 0;
virtual void setRasterizerState(const gl::RasterizerState &rasterState) = 0;
- virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
+ virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
unsigned int sampleMask) = 0;
virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
int stencilBackRef, bool frontFaceCCW) = 0;
@@ -232,7 +214,7 @@ class Renderer
// Shader operations
virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type) = 0;
- virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type) = 0;
+ virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround) = 0;
// Image operations
virtual Image *createImage() = 0;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h
index a6870ebedc..8231fbcb25 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h
@@ -1,3 +1,4 @@
+#include "../precompiled.h"
//
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -12,6 +13,10 @@
#include "common/angleutils.h"
+#if !defined(ANGLE_FORCE_VSYNC_OFF)
+#define ANGLE_FORCE_VSYNC_OFF 0
+#endif
+
namespace rx
{
@@ -33,7 +38,7 @@ class SwapChain
virtual HANDLE getShareHandle() {return mShareHandle;};
protected:
- const EGLNativeWindowType mWindow; // Window that the surface is created for.
+ const EGLNativeWindowType mWindow; // Window that the surface is created for.
const GLenum mBackBufferFormat;
const GLenum mDepthBufferFormat;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexDataManager.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/VertexDataManager.cpp
index 7ff5171fca..8034aed8c9 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexDataManager.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/VertexDataManager.cpp
@@ -266,6 +266,10 @@ GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[],
return GL_OUT_OF_MEMORY;
}
+ mCurrentValue[i][0] = attribs[i].mCurrentValue[0];
+ mCurrentValue[i][1] = attribs[i].mCurrentValue[1];
+ mCurrentValue[i][2] = attribs[i].mCurrentValue[2];
+ mCurrentValue[i][3] = attribs[i].mCurrentValue[3];
mCurrentValueOffsets[i] = streamOffset;
}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp
new file mode 100644
index 0000000000..31d5b8b886
--- /dev/null
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp
@@ -0,0 +1,366 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// BufferStorage11.cpp Defines the BufferStorage11 class.
+
+#include "libGLESv2/renderer/d3d11/BufferStorage11.h"
+#include "libGLESv2/main.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+
+namespace rx
+{
+
+BufferStorage11::BufferStorage11(Renderer11 *renderer)
+{
+ mRenderer = renderer;
+
+ mStagingBuffer = NULL;
+ mStagingBufferSize = 0;
+
+ mSize = 0;
+
+ mResolvedData = NULL;
+ mResolvedDataSize = 0;
+ mResolvedDataValid = false;
+
+ mReadUsageCount = 0;
+ mWriteUsageCount = 0;
+}
+
+BufferStorage11::~BufferStorage11()
+{
+ SafeRelease(mStagingBuffer);
+
+ if (mResolvedData)
+ {
+ free(mResolvedData);
+ mResolvedData = NULL;
+ }
+
+ for (auto it = mDirectBuffers.begin(); it != mDirectBuffers.end(); it++)
+ {
+ SafeDelete(it->second);
+ }
+}
+
+BufferStorage11 *BufferStorage11::makeBufferStorage11(BufferStorage *bufferStorage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(BufferStorage11*, bufferStorage));
+ return static_cast<BufferStorage11*>(bufferStorage);
+}
+
+void *BufferStorage11::getData()
+{
+ ASSERT(mStagingBuffer);
+
+ if (!mResolvedDataValid)
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ HRESULT result;
+
+ if (!mResolvedData || mResolvedDataSize < mStagingBufferSize)
+ {
+ free(mResolvedData);
+ mResolvedData = malloc(mSize);
+ mResolvedDataSize = mSize;
+ }
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ result = context->Map(mStagingBuffer, 0, D3D11_MAP_READ, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ return gl::error(GL_OUT_OF_MEMORY, (void*)NULL);
+ }
+
+ memcpy(mResolvedData, mappedResource.pData, mSize);
+
+ context->Unmap(mStagingBuffer, 0);
+
+ mResolvedDataValid = true;
+ }
+
+ mReadUsageCount = 0;
+
+ return mResolvedData;
+}
+
+void BufferStorage11::setData(const void* data, unsigned int size, unsigned int offset)
+{
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ HRESULT result;
+
+ const unsigned int requiredStagingBufferSize = size + offset;
+ const bool createStagingBuffer = !mStagingBuffer || mStagingBufferSize < requiredStagingBufferSize;
+
+ if (createStagingBuffer)
+ {
+ D3D11_BUFFER_DESC bufferDesc;
+ bufferDesc.ByteWidth = requiredStagingBufferSize;
+ bufferDesc.Usage = D3D11_USAGE_STAGING;
+ bufferDesc.BindFlags = 0;
+ bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
+ bufferDesc.MiscFlags = 0;
+ bufferDesc.StructureByteStride = 0;
+
+ HRESULT result;
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ ID3D11Buffer *newStagingBuffer;
+
+ if (data && offset == 0)
+ {
+ D3D11_SUBRESOURCE_DATA initialData;
+ initialData.pSysMem = data;
+ initialData.SysMemPitch = requiredStagingBufferSize;
+ initialData.SysMemSlicePitch = 0;
+
+ result = device->CreateBuffer(&bufferDesc, &initialData, &newStagingBuffer);
+ }
+ else
+ {
+ result = device->CreateBuffer(&bufferDesc, NULL, &newStagingBuffer);
+ }
+
+ if (FAILED(result))
+ {
+ mStagingBufferSize = 0;
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ mStagingBufferSize = requiredStagingBufferSize;
+
+ if (mStagingBuffer && offset > 0)
+ {
+ // If offset is greater than zero and the buffer is non-null, need to preserve the data from
+ // the old buffer up to offset
+ D3D11_BOX srcBox;
+ srcBox.left = 0;
+ srcBox.right = std::min(offset, requiredStagingBufferSize);
+ srcBox.top = 0;
+ srcBox.bottom = 1;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ context->CopySubresourceRegion(newStagingBuffer, 0, 0, 0, 0, mStagingBuffer, 0, &srcBox);
+ }
+
+ SafeRelease(mStagingBuffer);
+ mStagingBuffer = newStagingBuffer;
+ }
+
+ if (data && (offset != 0 || !createStagingBuffer))
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ result = context->Map(mStagingBuffer, 0, D3D11_MAP_WRITE, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ unsigned char *offsetBufferPointer = reinterpret_cast<unsigned char *>(mappedResource.pData) + offset;
+ memcpy(offsetBufferPointer, data, size);
+
+ context->Unmap(mStagingBuffer, 0);
+ }
+
+ for (auto it = mDirectBuffers.begin(); it != mDirectBuffers.end(); it++)
+ {
+ it->second->markDirty();
+ }
+
+ mSize = std::max(mSize, requiredStagingBufferSize);
+ mWriteUsageCount = 0;
+
+ mResolvedDataValid = false;
+}
+
+void BufferStorage11::copyData(BufferStorage* sourceStorage, unsigned int size,
+ unsigned int sourceOffset, unsigned int destOffset)
+{
+ BufferStorage11* source = makeBufferStorage11(sourceStorage);
+ if (source)
+ {
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ D3D11_BOX srcBox;
+ srcBox.left = sourceOffset;
+ srcBox.right = sourceOffset + size;
+ srcBox.top = 0;
+ srcBox.bottom = 1;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ ASSERT(mStagingBuffer && source->mStagingBuffer);
+ context->CopySubresourceRegion(mStagingBuffer, 0, destOffset, 0, 0, source->mStagingBuffer, 0, &srcBox);
+ }
+}
+
+void BufferStorage11::clear()
+{
+ mResolvedDataValid = false;
+ mSize = 0;
+}
+
+unsigned int BufferStorage11::getSize() const
+{
+ return mSize;
+}
+
+bool BufferStorage11::supportsDirectBinding() const
+{
+ return true;
+}
+
+void BufferStorage11::markBufferUsage()
+{
+ mReadUsageCount++;
+ mWriteUsageCount++;
+
+ const unsigned int usageLimit = 5;
+
+ if (mReadUsageCount > usageLimit && mResolvedData)
+ {
+ free(mResolvedData);
+ mResolvedData = NULL;
+ mResolvedDataSize = 0;
+ mResolvedDataValid = false;
+ }
+}
+
+ID3D11Buffer *BufferStorage11::getBuffer(BufferUsage usage)
+{
+ markBufferUsage();
+
+ DirectBufferStorage11 *directBuffer = NULL;
+
+ auto directBufferIt = mDirectBuffers.find(usage);
+ if (directBufferIt != mDirectBuffers.end())
+ {
+ directBuffer = directBufferIt->second;
+ }
+
+ if (directBuffer)
+ {
+ if (directBuffer->isDirty())
+ {
+ // if updateFromStagingBuffer returns true, the D3D buffer has been recreated
+ // and we should update our serial
+ if (directBuffer->updateFromStagingBuffer(mStagingBuffer, mSize, 0))
+ {
+ updateSerial();
+ }
+ }
+ }
+ else
+ {
+ // buffer is not allocated, create it
+ directBuffer = new DirectBufferStorage11(mRenderer, usage);
+ directBuffer->updateFromStagingBuffer(mStagingBuffer, mSize, 0);
+
+ mDirectBuffers.insert(std::make_pair(usage, directBuffer));
+ updateSerial();
+ }
+
+ return directBuffer->getD3DBuffer();
+}
+
+DirectBufferStorage11::DirectBufferStorage11(Renderer11 *renderer, BufferUsage usage)
+ : mRenderer(renderer),
+ mUsage(usage),
+ mDirectBuffer(NULL),
+ mBufferSize(0),
+ mDirty(false)
+{
+}
+
+DirectBufferStorage11::~DirectBufferStorage11()
+{
+ SafeRelease(mDirectBuffer);
+}
+
+BufferUsage DirectBufferStorage11::getUsage() const
+{
+ return mUsage;
+}
+
+// Returns true if it recreates the direct buffer
+bool DirectBufferStorage11::updateFromStagingBuffer(ID3D11Buffer *stagingBuffer, size_t size, size_t offset)
+{
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ // unused for now
+ ASSERT(offset == 0);
+
+ unsigned int requiredBufferSize = size + offset;
+ bool createBuffer = !mDirectBuffer || mBufferSize < requiredBufferSize;
+
+ // (Re)initialize D3D buffer if needed
+ if (createBuffer)
+ {
+ D3D11_BUFFER_DESC bufferDesc;
+ fillBufferDesc(&bufferDesc, mRenderer, mUsage, requiredBufferSize);
+
+ ID3D11Buffer *newBuffer;
+ HRESULT result = device->CreateBuffer(&bufferDesc, NULL, &newBuffer);
+
+ if (FAILED(result))
+ {
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
+
+ // No longer need the old buffer
+ SafeRelease(mDirectBuffer);
+ mDirectBuffer = newBuffer;
+
+ mBufferSize = bufferDesc.ByteWidth;
+ }
+
+ // Copy data via staging buffer
+ D3D11_BOX srcBox;
+ srcBox.left = 0;
+ srcBox.right = size;
+ srcBox.top = 0;
+ srcBox.bottom = 1;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ context->CopySubresourceRegion(mDirectBuffer, 0, offset, 0, 0, stagingBuffer, 0, &srcBox);
+
+ mDirty = false;
+
+ return createBuffer;
+}
+
+void DirectBufferStorage11::fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Renderer *renderer, BufferUsage usage, unsigned int bufferSize)
+{
+ bufferDesc->ByteWidth = bufferSize;
+ bufferDesc->MiscFlags = 0;
+ bufferDesc->StructureByteStride = 0;
+
+ switch (usage)
+ {
+ case BUFFER_USAGE_VERTEX:
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc->BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+ case BUFFER_USAGE_INDEX:
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc->BindFlags = D3D11_BIND_INDEX_BUFFER;
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+}
+
+}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.h
new file mode 100644
index 0000000000..a6afafe1b4
--- /dev/null
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.h
@@ -0,0 +1,92 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// BufferStorage11.h Defines the BufferStorage11 class.
+
+#ifndef LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
+#define LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
+
+#include "libGLESv2/renderer/BufferStorage.h"
+
+namespace rx
+{
+class Renderer;
+class Renderer11;
+class DirectBufferStorage11;
+
+enum BufferUsage
+{
+ BUFFER_USAGE_VERTEX,
+ BUFFER_USAGE_INDEX,
+};
+
+class BufferStorage11 : public BufferStorage
+{
+ public:
+ explicit BufferStorage11(Renderer11 *renderer);
+ virtual ~BufferStorage11();
+
+ static BufferStorage11 *makeBufferStorage11(BufferStorage *bufferStorage);
+
+ virtual void *getData();
+ virtual void setData(const void* data, unsigned int size, unsigned int offset);
+ virtual void copyData(BufferStorage* sourceStorage, unsigned int size,
+ unsigned int sourceOffset, unsigned int destOffset);
+ virtual void clear();
+ virtual unsigned int getSize() const;
+ virtual bool supportsDirectBinding() const;
+
+ ID3D11Buffer *getBuffer(BufferUsage usage);
+
+ private:
+ Renderer11 *mRenderer;
+
+ ID3D11Buffer *mStagingBuffer;
+ unsigned int mStagingBufferSize;
+
+ std::map<BufferUsage, DirectBufferStorage11*> mDirectBuffers;
+
+ unsigned int mSize;
+
+ void *mResolvedData;
+ unsigned int mResolvedDataSize;
+ bool mResolvedDataValid;
+
+ unsigned int mReadUsageCount;
+ unsigned int mWriteUsageCount;
+
+ void markBufferUsage();
+};
+
+// Each instance of BufferStorageD3DBuffer11 is specialized for a class of D3D binding points
+// - vertex buffers
+// - index buffers
+class DirectBufferStorage11
+{
+ public:
+ DirectBufferStorage11(Renderer11 *renderer, BufferUsage usage);
+ ~DirectBufferStorage11();
+
+ BufferUsage getUsage() const;
+ bool updateFromStagingBuffer(ID3D11Buffer *stagingBuffer, size_t size, size_t offset);
+
+ ID3D11Buffer *getD3DBuffer() { return mDirectBuffer; }
+ bool isDirty() const { return mDirty; }
+ void markDirty() { mDirty = true; }
+
+ private:
+ Renderer11 *mRenderer;
+ const BufferUsage mUsage;
+ ID3D11Buffer *mDirectBuffer;
+ size_t mBufferSize;
+ bool mDirty;
+
+ static void fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Renderer *renderer, BufferUsage usage, unsigned int bufferSize);
+};
+
+}
+
+#endif // LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Fence11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Fence11.cpp
index 9d11c9a0fc..2a7d4d43ef 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Fence11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Fence11.cpp
@@ -7,9 +7,9 @@
// Fence11.cpp: Defines the rx::Fence11 class which implements rx::FenceImpl.
-#include "libGLESv2/renderer/Fence11.h"
+#include "libGLESv2/renderer/d3d11/Fence11.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
namespace rx
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Fence11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Fence11.h
index a5398bca14..a5398bca14 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Fence11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Fence11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Image11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.cpp
index 81e9e9ecb2..5d039a35e8 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Image11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.cpp
@@ -8,15 +8,15 @@
// Image11.h: Implements the rx::Image11 class, which acts as the interface to
// the actual underlying resources of a Texture
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/renderer/Image11.h"
-#include "libGLESv2/renderer/TextureStorage11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/Image11.h"
+#include "libGLESv2/renderer/d3d11/TextureStorage11.h"
#include "libGLESv2/Framebuffer.h"
#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/main.h"
#include "libGLESv2/utilities.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
#include "libGLESv2/renderer/generatemip.h"
namespace rx
@@ -106,9 +106,15 @@ void Image11::generateMipmap(Image11 *dest, Image11 *src)
dest->markDirty();
}
+static bool FormatRequiresInitialization(DXGI_FORMAT dxgiFormat, GLenum internalFormat)
+{
+ return (dxgiFormat == DXGI_FORMAT_R8G8B8A8_UNORM && gl::GetAlphaSize(internalFormat) == 0) ||
+ (dxgiFormat == DXGI_FORMAT_R32G32B32A32_FLOAT && gl::GetAlphaSize(internalFormat) == 0);
+}
+
bool Image11::isDirty() const
{
- return (mStagingTexture && mDirty);
+ return ((mStagingTexture || FormatRequiresInitialization(mDXGIFormat, mInternalFormat)) && mDirty);
}
bool Image11::updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
@@ -374,6 +380,27 @@ unsigned int Image11::getStagingSubresource()
return mStagingSubresource;
}
+template <typename T, size_t N>
+static void setDefaultData(ID3D11DeviceContext *deviceContext, ID3D11Texture2D *texture, UINT subresource,
+ GLsizei width, GLsizei height, const T (&defaultData)[N])
+{
+ D3D11_MAPPED_SUBRESOURCE map;
+ deviceContext->Map(texture, subresource, D3D11_MAP_WRITE, 0, &map);
+
+ unsigned char* ptr = reinterpret_cast<unsigned char*>(map.pData);
+ size_t pixelSize = sizeof(T) * N;
+
+ for (GLsizei y = 0; y < height; y++)
+ {
+ for (GLsizei x = 0; x < width; x++)
+ {
+ memcpy(ptr + (y * map.RowPitch) + (x * pixelSize), defaultData, pixelSize);
+ }
+ }
+
+ deviceContext->Unmap(texture, subresource);
+}
+
void Image11::createStagingTexture()
{
if (mStagingTexture)
@@ -421,6 +448,17 @@ void Image11::createStagingTexture()
mStagingTexture = newTexture;
mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
mDirty = false;
+
+ if (mDXGIFormat == DXGI_FORMAT_R8G8B8A8_UNORM && gl::GetAlphaSize(mInternalFormat) == 0)
+ {
+ unsigned char defaultPixel[4] = { 0, 0, 0, 255 };
+ setDefaultData(mRenderer->getDeviceContext(), mStagingTexture, mStagingSubresource, mWidth, mHeight, defaultPixel);
+ }
+ else if (mDXGIFormat == DXGI_FORMAT_R32G32B32A32_FLOAT && gl::GetAlphaSize(mInternalFormat) == 0)
+ {
+ float defaultPixel[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
+ setDefaultData(mRenderer->getDeviceContext(), mStagingTexture, mStagingSubresource, mWidth, mHeight, defaultPixel);
+ }
}
HRESULT Image11::map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map)
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Image11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.h
index 11a6492dc8..11a6492dc8 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Image11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp
index 36a62adc1c..44f9976d43 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp
@@ -7,8 +7,8 @@
// IndexBuffer11.cpp: Defines the D3D11 IndexBuffer implementation.
-#include "libGLESv2/renderer/IndexBuffer11.h"
-#include "libGLESv2/renderer/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/IndexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
namespace rx
{
@@ -170,7 +170,7 @@ DXGI_FORMAT IndexBuffer11::getIndexFormat() const
{
case GL_UNSIGNED_BYTE: return DXGI_FORMAT_R16_UINT;
case GL_UNSIGNED_SHORT: return DXGI_FORMAT_R16_UINT;
- case GL_UNSIGNED_INT: return mRenderer->get32BitIndexSupport() ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT;
+ case GL_UNSIGNED_INT: return DXGI_FORMAT_R32_UINT;
default: UNREACHABLE(); return DXGI_FORMAT_UNKNOWN;
}
}
@@ -180,4 +180,4 @@ ID3D11Buffer *IndexBuffer11::getBuffer() const
return mBuffer;
}
-}
+} \ No newline at end of file
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.h
index 39a61946ad..39a61946ad 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp
index 1552f3a326..4940b8c638 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp
@@ -8,10 +8,10 @@
// InputLayoutCache.cpp: Defines InputLayoutCache, a class that builds and caches
// D3D11 input layouts.
-#include "libGLESv2/renderer/InputLayoutCache.h"
-#include "libGLESv2/renderer/VertexBuffer11.h"
-#include "libGLESv2/renderer/BufferStorage11.h"
-#include "libGLESv2/renderer/ShaderExecutable11.h"
+#include "libGLESv2/renderer/d3d11/InputLayoutCache.h"
+#include "libGLESv2/renderer/d3d11/VertexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/BufferStorage11.h"
+#include "libGLESv2/renderer/d3d11/ShaderExecutable11.h"
#include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/Context.h"
#include "libGLESv2/renderer/VertexDataManager.h"
@@ -103,10 +103,10 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
// Record the type of the associated vertex shader vector in our key
// This will prevent mismatched vertex shaders from using the same input layout
GLint attributeSize;
- programBinary->getActiveAttribute(ilKey.elementCount, 0, NULL, &attributeSize, &ilKey.elements[ilKey.elementCount].glslElementType, NULL);
+ programBinary->getActiveAttribute(sortedSemanticIndices[i], 0, NULL, &attributeSize, &ilKey.elements[ilKey.elementCount].glslElementType, NULL);
ilKey.elements[ilKey.elementCount].desc.SemanticName = semanticName;
- ilKey.elements[ilKey.elementCount].desc.SemanticIndex = sortedSemanticIndices[i];
+ ilKey.elements[ilKey.elementCount].desc.SemanticIndex = i;
ilKey.elements[ilKey.elementCount].desc.Format = attributes[i].attribute->mArrayEnabled ? vertexBuffer->getDXGIFormat(*attributes[i].attribute) : DXGI_FORMAT_R32G32B32A32_FLOAT;
ilKey.elements[ilKey.elementCount].desc.InputSlot = i;
ilKey.elements[ilKey.elementCount].desc.AlignedByteOffset = 0;
@@ -114,7 +114,7 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
ilKey.elements[ilKey.elementCount].desc.InstanceDataStepRate = attributes[i].divisor;
ilKey.elementCount++;
- vertexBuffers[i] = bufferStorage ? bufferStorage->getBuffer() : vertexBuffer->getBuffer();
+ vertexBuffers[i] = bufferStorage ? bufferStorage->getBuffer(BUFFER_USAGE_VERTEX) : vertexBuffer->getBuffer();
vertexBufferSerials[i] = bufferStorage ? bufferStorage->getSerial() : vertexBuffer->getSerial();
vertexStrides[i] = attributes[i].stride;
vertexOffsets[i] = attributes[i].offset;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.h
index bb1a8eebcf..bb1a8eebcf 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/InputLayoutCache.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Query11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Query11.cpp
index 13210fc929..24c0330a1e 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Query11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Query11.cpp
@@ -7,8 +7,8 @@
// Query11.cpp: Defines the rx::Query11 class which implements rx::QueryImpl.
-#include "libGLESv2/renderer/Query11.h"
-#include "libGLESv2/renderer/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/Query11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
#include "libGLESv2/main.h"
namespace rx
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Query11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Query11.h
index 0a03de77ca..0a03de77ca 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Query11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Query11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp
index fd388dfe08..a1c324cd80 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp
@@ -8,9 +8,12 @@
// RenderStateCache.cpp: Defines rx::RenderStateCache, a cache of Direct3D render
// state objects.
-#include "libGLESv2/renderer/RenderStateCache.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/RenderStateCache.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/Framebuffer.h"
+#include "libGLESv2/Renderbuffer.h"
+#include "libGLESv2/utilities.h"
#include "common/debug.h"
#include "third_party/murmurhash/MurmurHash3.h"
@@ -71,21 +74,21 @@ void RenderStateCache::clear()
mSamplerStateCache.clear();
}
-std::size_t RenderStateCache::hashBlendState(const gl::BlendState &blendState)
+std::size_t RenderStateCache::hashBlendState(const BlendStateKey &blendState)
{
static const unsigned int seed = 0xABCDEF98;
std::size_t hash = 0;
- MurmurHash3_x86_32(&blendState, sizeof(gl::BlendState), seed, &hash);
+ MurmurHash3_x86_32(&blendState, sizeof(BlendStateKey), seed, &hash);
return hash;
}
-bool RenderStateCache::compareBlendStates(const gl::BlendState &a, const gl::BlendState &b)
+bool RenderStateCache::compareBlendStates(const BlendStateKey &a, const BlendStateKey &b)
{
return memcmp(&a, &b, sizeof(gl::BlendState)) == 0;
}
-ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendState)
+ID3D11BlendState *RenderStateCache::getBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState)
{
if (!mDevice)
{
@@ -93,7 +96,36 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
return NULL;
}
- BlendStateMap::iterator i = mBlendStateCache.find(blendState);
+ bool mrt = false;
+
+ BlendStateKey key = { 0 };
+ key.blendState = blendState;
+ for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
+ {
+ gl::Renderbuffer *renderBuffer = framebuffer->getColorbuffer(i);
+ if (renderBuffer)
+ {
+ if (i > 0)
+ {
+ mrt = true;
+ }
+
+ GLenum internalFormat = renderBuffer->getInternalFormat();
+ key.rtChannels[i][0] = gl::GetRedSize(internalFormat) > 0;
+ key.rtChannels[i][1] = gl::GetGreenSize(internalFormat) > 0;
+ key.rtChannels[i][2] = gl::GetBlueSize(internalFormat) > 0;;
+ key.rtChannels[i][3] = gl::GetAlphaSize(internalFormat) > 0;
+ }
+ else
+ {
+ key.rtChannels[i][0] = false;
+ key.rtChannels[i][1] = false;
+ key.rtChannels[i][2] = false;
+ key.rtChannels[i][3] = false;
+ }
+ }
+
+ BlendStateMap::iterator i = mBlendStateCache.find(key);
if (i != mBlendStateCache.end())
{
BlendStateCounterPair &state = i->second;
@@ -122,7 +154,7 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
// Create a new blend state and insert it into the cache
D3D11_BLEND_DESC blendDesc = { 0 };
blendDesc.AlphaToCoverageEnable = blendState.sampleAlphaToCoverage;
- blendDesc.IndependentBlendEnable = FALSE;
+ blendDesc.IndependentBlendEnable = mrt ? TRUE : FALSE;
for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
@@ -140,10 +172,10 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
rtBlend.BlendOpAlpha = gl_d3d11::ConvertBlendOp(blendState.blendEquationAlpha);
}
- rtBlend.RenderTargetWriteMask = gl_d3d11::ConvertColorMask(blendState.colorMaskRed,
- blendState.colorMaskGreen,
- blendState.colorMaskBlue,
- blendState.colorMaskAlpha);
+ rtBlend.RenderTargetWriteMask = gl_d3d11::ConvertColorMask(key.rtChannels[i][0] && blendState.colorMaskRed,
+ key.rtChannels[i][1] && blendState.colorMaskGreen,
+ key.rtChannels[i][2] && blendState.colorMaskBlue,
+ key.rtChannels[i][3] && blendState.colorMaskAlpha);
}
ID3D11BlendState *dx11BlendState = NULL;
@@ -154,7 +186,7 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
return NULL;
}
- mBlendStateCache.insert(std::make_pair(blendState, std::make_pair(dx11BlendState, mCounter++)));
+ mBlendStateCache.insert(std::make_pair(key, std::make_pair(dx11BlendState, mCounter++)));
return dx11BlendState;
}
@@ -404,4 +436,4 @@ ID3D11SamplerState *RenderStateCache::getSamplerState(const gl::SamplerState &sa
}
}
-} \ No newline at end of file
+}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.h
index f8b5111de4..b4b871a4bd 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.h
@@ -13,6 +13,11 @@
#include "libGLESv2/angletypes.h"
#include "common/angleutils.h"
+namespace gl
+{
+class Framebuffer;
+}
+
namespace rx
{
@@ -26,7 +31,7 @@ class RenderStateCache
void clear();
// Increments refcount on the returned blend state, Release() must be called.
- ID3D11BlendState *getBlendState(const gl::BlendState &blendState);
+ ID3D11BlendState *getBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState);
ID3D11RasterizerState *getRasterizerState(const gl::RasterizerState &rasterState,
bool scissorEnabled, unsigned int depthSize);
ID3D11DepthStencilState *getDepthStencilState(const gl::DepthStencilState &dsState);
@@ -38,14 +43,19 @@ class RenderStateCache
unsigned long long mCounter;
// Blend state cache
- static std::size_t hashBlendState(const gl::BlendState &blendState);
- static bool compareBlendStates(const gl::BlendState &a, const gl::BlendState &b);
+ struct BlendStateKey
+ {
+ gl::BlendState blendState;
+ bool rtChannels[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT][4];
+ };
+ static std::size_t hashBlendState(const BlendStateKey &blendState);
+ static bool compareBlendStates(const BlendStateKey &a, const BlendStateKey &b);
static const unsigned int kMaxBlendStates;
- typedef std::size_t (*BlendStateHashFunction)(const gl::BlendState &);
- typedef bool (*BlendStateEqualityFunction)(const gl::BlendState &, const gl::BlendState &);
+ typedef std::size_t (*BlendStateHashFunction)(const BlendStateKey &);
+ typedef bool (*BlendStateEqualityFunction)(const BlendStateKey &, const BlendStateKey &);
typedef std::pair<ID3D11BlendState*, unsigned long long> BlendStateCounterPair;
- typedef std::unordered_map<gl::BlendState, BlendStateCounterPair, BlendStateHashFunction, BlendStateEqualityFunction> BlendStateMap;
+ typedef std::unordered_map<BlendStateKey, BlendStateCounterPair, BlendStateHashFunction, BlendStateEqualityFunction> BlendStateMap;
BlendStateMap mBlendStateCache;
// Rasterizer state cache
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp
index 2667cc6fa7..3707097aa4 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp
@@ -8,10 +8,10 @@
// RenderTarget11.cpp: Implements a DX11-specific wrapper for ID3D11View pointers
// retained by Renderbuffers.
-#include "libGLESv2/renderer/RenderTarget11.h"
-#include "libGLESv2/renderer/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/RenderTarget11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
#include "libGLESv2/main.h"
namespace rx
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.h
index 97827f2639..97827f2639 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp
index f83e9e91ce..31d976dec4 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp
@@ -12,31 +12,31 @@
#include "libGLESv2/Buffer.h"
#include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/Framebuffer.h"
-#include "libGLESv2/RenderBuffer.h"
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/renderer/RenderTarget11.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
-#include "libGLESv2/renderer/ShaderExecutable11.h"
-#include "libGLESv2/renderer/SwapChain11.h"
-#include "libGLESv2/renderer/Image11.h"
-#include "libGLESv2/renderer/VertexBuffer11.h"
-#include "libGLESv2/renderer/IndexBuffer11.h"
-#include "libGLESv2/renderer/BufferStorage11.h"
+#include "libGLESv2/Renderbuffer.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/RenderTarget11.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/ShaderExecutable11.h"
+#include "libGLESv2/renderer/d3d11/SwapChain11.h"
+#include "libGLESv2/renderer/d3d11/Image11.h"
+#include "libGLESv2/renderer/d3d11/VertexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/IndexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/BufferStorage11.h"
#include "libGLESv2/renderer/VertexDataManager.h"
#include "libGLESv2/renderer/IndexDataManager.h"
-#include "libGLESv2/renderer/TextureStorage11.h"
-#include "libGLESv2/renderer/Query11.h"
-#include "libGLESv2/renderer/Fence11.h"
+#include "libGLESv2/renderer/d3d11/TextureStorage11.h"
+#include "libGLESv2/renderer/d3d11/Query11.h"
+#include "libGLESv2/renderer/d3d11/Fence11.h"
-#include "libGLESv2/renderer/shaders/compiled/passthrough11vs.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughrgba11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughrgb11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughlum11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughlumalpha11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthrough11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/clear11vs.h"
-#include "libGLESv2/renderer/shaders/compiled/clearsingle11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/clearmultiple11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/clear11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/clearsingle11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/clearmultiple11ps.h"
#include "libEGL/Display.h"
@@ -66,7 +66,7 @@ enum
MAX_TEXTURE_IMAGE_UNITS_VTF_SM4 = 16
};
-Renderer11::Renderer11(egl::Display *display, HDC hDc) : Renderer(display), mDc(hDc)
+Renderer11::Renderer11(egl::Display *display) : Renderer(display)
{
mVertexDataManager = NULL;
mIndexDataManager = NULL;
@@ -147,6 +147,7 @@ EGLint Renderer11::initialize()
return EGL_NOT_INITIALIZED;
}
+
// create the D3D11 device
ASSERT(mDevice == NULL);
PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(mD3d11Module, "D3D11CreateDevice");
@@ -160,13 +161,14 @@ EGLint Renderer11::initialize()
D3D_FEATURE_LEVEL featureLevels[] =
{
- D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
+#if !defined(ANGLE_ENABLE_D3D9)
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1,
+#endif
};
HRESULT result = S_OK;
@@ -253,8 +255,6 @@ EGLint Renderer11::initialize()
{
D3D11_MESSAGE_ID hideMessages[] =
{
- D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD,
- D3D11_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD,
D3D11_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET
};
@@ -670,7 +670,7 @@ void Renderer11::setRasterizerState(const gl::RasterizerState &rasterState)
mForceSetRasterState = false;
}
-void Renderer11::setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
+void Renderer11::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
unsigned int sampleMask)
{
if (mForceSetBlendState ||
@@ -678,7 +678,7 @@ void Renderer11::setBlendState(const gl::BlendState &blendState, const gl::Color
memcmp(&blendColor, &mCurBlendColor, sizeof(gl::Color)) != 0 ||
sampleMask != mCurSampleMask)
{
- ID3D11BlendState *dxBlendState = mStateCache.getBlendState(blendState);
+ ID3D11BlendState *dxBlendState = mStateCache.getBlendState(framebuffer, blendState);
if (!dxBlendState)
{
ERR("NULL blend state returned by RenderStateCache::getBlendState, setting the default "
@@ -929,6 +929,25 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer)
renderTargetFormat = colorbuffer->getActualFormat();
missingColorRenderTarget = false;
}
+
+#ifdef _DEBUG
+ // Workaround for Debug SETSHADERRESOURCES_HAZARD D3D11 warnings
+ for (unsigned int vertexSerialIndex = 0; vertexSerialIndex < gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; vertexSerialIndex++)
+ {
+ if (colorbuffer->getTextureSerial() != 0 && mCurVertexTextureSerials[vertexSerialIndex] == colorbuffer->getTextureSerial())
+ {
+ setTexture(gl::SAMPLER_VERTEX, vertexSerialIndex, NULL);
+ }
+ }
+
+ for (unsigned int pixelSerialIndex = 0; pixelSerialIndex < gl::MAX_TEXTURE_IMAGE_UNITS; pixelSerialIndex++)
+ {
+ if (colorbuffer->getTextureSerial() != 0 && mCurPixelTextureSerials[pixelSerialIndex] == colorbuffer->getTextureSerial())
+ {
+ setTexture(gl::SAMPLER_PIXEL, pixelSerialIndex, NULL);
+ }
+ }
+#endif
}
}
@@ -1056,7 +1075,7 @@ GLenum Renderer11::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementAr
BufferStorage11 *storage = BufferStorage11::makeBufferStorage11(indexInfo->storage);
IndexBuffer11* indexBuffer = IndexBuffer11::makeIndexBuffer11(indexInfo->indexBuffer);
- mDeviceContext->IASetIndexBuffer(storage->getBuffer(), indexBuffer->getIndexFormat(), indexInfo->startOffset);
+ mDeviceContext->IASetIndexBuffer(storage->getBuffer(BUFFER_USAGE_INDEX), indexBuffer->getIndexFormat(), indexInfo->startOffset);
mAppliedIBSerial = 0;
mAppliedStorageIBSerial = storage->getSerial();
@@ -1118,43 +1137,6 @@ void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLv
}
}
-template <typename T>
-static void drawLineLoopIndexed(T *data, GLenum type, const GLvoid *indices, GLsizei count)
-{
- switch (type)
- {
- case GL_NONE: // Non-indexed draw
- for (int i = 0; i < count; i++)
- {
- data[i] = i;
- }
- data[count] = 0;
- break;
- case GL_UNSIGNED_BYTE:
- for (int i = 0; i < count; i++)
- {
- data[i] = static_cast<const GLubyte*>(indices)[i];
- }
- data[count] = static_cast<const GLubyte*>(indices)[0];
- break;
- case GL_UNSIGNED_SHORT:
- for (int i = 0; i < count; i++)
- {
- data[i] = static_cast<const GLushort*>(indices)[i];
- }
- data[count] = static_cast<const GLushort*>(indices)[0];
- break;
- case GL_UNSIGNED_INT:
- for (int i = 0; i < count; i++)
- {
- data[i] = static_cast<const GLuint*>(indices)[i];
- }
- data[count] = static_cast<const GLuint*>(indices)[0];
- break;
- default: UNREACHABLE();
- }
-}
-
void Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer)
{
// Get the raw indices for an indexed draw
@@ -1203,71 +1185,59 @@ void Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
return gl::error(GL_OUT_OF_MEMORY);
}
- if (get32BitIndexSupport())
- drawLineLoopIndexed(reinterpret_cast<unsigned int*>(mappedMemory), type, indices, count);
- else
- drawLineLoopIndexed(reinterpret_cast<unsigned short*>(mappedMemory), type, indices, count);
-
+ unsigned int *data = reinterpret_cast<unsigned int*>(mappedMemory);
unsigned int indexBufferOffset = offset;
- if (!mLineLoopIB->unmapBuffer())
- {
- ERR("Could not unmap index buffer for GL_LINE_LOOP.");
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- if (mAppliedIBSerial != mLineLoopIB->getSerial() || mAppliedIBOffset != indexBufferOffset)
- {
- IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mLineLoopIB->getIndexBuffer());
-
- mDeviceContext->IASetIndexBuffer(indexBuffer->getBuffer(), indexBuffer->getIndexFormat(), indexBufferOffset);
- mAppliedIBSerial = mLineLoopIB->getSerial();
- mAppliedStorageIBSerial = 0;
- mAppliedIBOffset = indexBufferOffset;
- }
-
- mDeviceContext->DrawIndexed(count + 1, 0, -minIndex);
-}
-
-template <typename T>
-static void drawTriangleFanIndexed(T *data, GLenum type, const GLvoid *indices, unsigned int numTris)
-{
switch (type)
{
case GL_NONE: // Non-indexed draw
- for (unsigned int i = 0; i < numTris; i++)
+ for (int i = 0; i < count; i++)
{
- data[i*3 + 0] = 0;
- data[i*3 + 1] = i + 1;
- data[i*3 + 2] = i + 2;
+ data[i] = i;
}
+ data[count] = 0;
break;
case GL_UNSIGNED_BYTE:
- for (unsigned int i = 0; i < numTris; i++)
+ for (int i = 0; i < count; i++)
{
- data[i*3 + 0] = static_cast<const GLubyte*>(indices)[0];
- data[i*3 + 1] = static_cast<const GLubyte*>(indices)[i + 1];
- data[i*3 + 2] = static_cast<const GLubyte*>(indices)[i + 2];
+ data[i] = static_cast<const GLubyte*>(indices)[i];
}
+ data[count] = static_cast<const GLubyte*>(indices)[0];
break;
case GL_UNSIGNED_SHORT:
- for (unsigned int i = 0; i < numTris; i++)
+ for (int i = 0; i < count; i++)
{
- data[i*3 + 0] = static_cast<const GLushort*>(indices)[0];
- data[i*3 + 1] = static_cast<const GLushort*>(indices)[i + 1];
- data[i*3 + 2] = static_cast<const GLushort*>(indices)[i + 2];
+ data[i] = static_cast<const GLushort*>(indices)[i];
}
+ data[count] = static_cast<const GLushort*>(indices)[0];
break;
case GL_UNSIGNED_INT:
- for (unsigned int i = 0; i < numTris; i++)
+ for (int i = 0; i < count; i++)
{
- data[i*3 + 0] = static_cast<const GLuint*>(indices)[0];
- data[i*3 + 1] = static_cast<const GLuint*>(indices)[i + 1];
- data[i*3 + 2] = static_cast<const GLuint*>(indices)[i + 2];
+ data[i] = static_cast<const GLuint*>(indices)[i];
}
+ data[count] = static_cast<const GLuint*>(indices)[0];
break;
default: UNREACHABLE();
}
+
+ if (!mLineLoopIB->unmapBuffer())
+ {
+ ERR("Could not unmap index buffer for GL_LINE_LOOP.");
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ if (mAppliedIBSerial != mLineLoopIB->getSerial() || mAppliedIBOffset != indexBufferOffset)
+ {
+ IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mLineLoopIB->getIndexBuffer());
+
+ mDeviceContext->IASetIndexBuffer(indexBuffer->getBuffer(), indexBuffer->getIndexFormat(), indexBufferOffset);
+ mAppliedIBSerial = mLineLoopIB->getSerial();
+ mAppliedStorageIBSerial = 0;
+ mAppliedIBOffset = indexBufferOffset;
+ }
+
+ mDeviceContext->DrawIndexed(count + 1, 0, -minIndex);
}
void Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer, int instances)
@@ -1320,13 +1290,46 @@ void Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indic
return gl::error(GL_OUT_OF_MEMORY);
}
- if (get32BitIndexSupport())
- drawTriangleFanIndexed(reinterpret_cast<unsigned int*>(mappedMemory), type, indices, numTris);
- else
- drawTriangleFanIndexed(reinterpret_cast<unsigned short*>(mappedMemory), type, indices, numTris);
-
+ unsigned int *data = reinterpret_cast<unsigned int*>(mappedMemory);
unsigned int indexBufferOffset = offset;
+ switch (type)
+ {
+ case GL_NONE: // Non-indexed draw
+ for (unsigned int i = 0; i < numTris; i++)
+ {
+ data[i*3 + 0] = 0;
+ data[i*3 + 1] = i + 1;
+ data[i*3 + 2] = i + 2;
+ }
+ break;
+ case GL_UNSIGNED_BYTE:
+ for (unsigned int i = 0; i < numTris; i++)
+ {
+ data[i*3 + 0] = static_cast<const GLubyte*>(indices)[0];
+ data[i*3 + 1] = static_cast<const GLubyte*>(indices)[i + 1];
+ data[i*3 + 2] = static_cast<const GLubyte*>(indices)[i + 2];
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ for (unsigned int i = 0; i < numTris; i++)
+ {
+ data[i*3 + 0] = static_cast<const GLushort*>(indices)[0];
+ data[i*3 + 1] = static_cast<const GLushort*>(indices)[i + 1];
+ data[i*3 + 2] = static_cast<const GLushort*>(indices)[i + 2];
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ for (unsigned int i = 0; i < numTris; i++)
+ {
+ data[i*3 + 0] = static_cast<const GLuint*>(indices)[0];
+ data[i*3 + 1] = static_cast<const GLuint*>(indices)[i + 1];
+ data[i*3 + 2] = static_cast<const GLuint*>(indices)[i + 2];
+ }
+ break;
+ default: UNREACHABLE();
+ }
+
if (!mTriangleFanIB->unmapBuffer())
{
ERR("Could not unmap scratch index buffer for GL_TRIANGLE_FAN.");
@@ -1544,10 +1547,14 @@ void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArra
void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
{
- bool alphaUnmasked = (gl::GetAlphaSize(mRenderTargetDesc.format) == 0) || clearParams.colorMaskAlpha;
+ gl::Renderbuffer *firstRenderbuffer = frameBuffer->getFirstColorbuffer();
+ GLenum internalFormat = firstRenderbuffer ? firstRenderbuffer->getInternalFormat() : GL_NONE;
+
bool needMaskedColorClear = (clearParams.mask & GL_COLOR_BUFFER_BIT) &&
- !(clearParams.colorMaskRed && clearParams.colorMaskGreen &&
- clearParams.colorMaskBlue && alphaUnmasked);
+ ((!clearParams.colorMaskRed && gl::GetRedSize(internalFormat) > 0) ||
+ (!clearParams.colorMaskGreen && gl::GetGreenSize(internalFormat) > 0) ||
+ (!clearParams.colorMaskBlue && gl::GetBlueSize(internalFormat) > 0) ||
+ (!clearParams.colorMaskAlpha && gl::GetAlphaSize(internalFormat) > 0));
unsigned int stencilUnmasked = 0x0;
if (frameBuffer->hasStencil())
@@ -1564,7 +1571,7 @@ void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *
if (needMaskedColorClear || needMaskedStencilClear || needScissoredClear)
{
- maskedClear(clearParams, frameBuffer->usingExtendedDrawBuffers());
+ maskedClear(clearParams, frameBuffer);
}
else
{
@@ -1591,10 +1598,12 @@ void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *
return;
}
- const float clearValues[4] = { clearParams.colorClearValue.red,
- clearParams.colorClearValue.green,
- clearParams.colorClearValue.blue,
- clearParams.colorClearValue.alpha };
+ GLenum format = renderbufferObject->getInternalFormat();
+
+ const float clearValues[4] = { (gl::GetRedSize(format) > 0) ? clearParams.colorClearValue.red : 0.0f,
+ (gl::GetGreenSize(format) > 0) ? clearParams.colorClearValue.green : 0.0f,
+ (gl::GetBlueSize(format) > 0) ? clearParams.colorClearValue.blue : 0.0f,
+ (gl::GetAlphaSize(format) > 0) ? clearParams.colorClearValue.alpha : 1.0f };
mDeviceContext->ClearRenderTargetView(framebufferRTV, clearValues);
}
}
@@ -1638,7 +1647,7 @@ void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *
}
}
-void Renderer11::maskedClear(const gl::ClearParameters &clearParams, bool usingExtendedDrawBuffers)
+void Renderer11::maskedClear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
{
HRESULT result;
@@ -1758,7 +1767,7 @@ void Renderer11::maskedClear(const gl::ClearParameters &clearParams, bool usingE
static const float blendFactors[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
static const UINT sampleMask = 0xFFFFFFFF;
- ID3D11BlendState *blendState = mStateCache.getBlendState(glBlendState);
+ ID3D11BlendState *blendState = mStateCache.getBlendState(frameBuffer, glBlendState);
// Set the vertices
D3D11_MAPPED_SUBRESOURCE mappedResource;
@@ -1785,7 +1794,7 @@ void Renderer11::maskedClear(const gl::ClearParameters &clearParams, bool usingE
mDeviceContext->RSSetState(mScissorEnabled ? mClearScissorRS : mClearNoScissorRS);
// Apply shaders
- ID3D11PixelShader *pixelShader = usingExtendedDrawBuffers ? mClearMultiplePS : mClearSinglePS;
+ ID3D11PixelShader *pixelShader = frameBuffer->usingExtendedDrawBuffers() ? mClearMultiplePS : mClearSinglePS;
mDeviceContext->IASetInputLayout(mClearIL);
mDeviceContext->VSSetShader(mClearVS, NULL, 0);
@@ -1949,13 +1958,14 @@ bool Renderer11::testDeviceResettable()
D3D_FEATURE_LEVEL featureLevels[] =
{
- D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
+#if !defined(ANGLE_ENABLE_D3D9)
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1,
+#endif
};
ID3D11Device* dummyDevice;
@@ -2134,7 +2144,6 @@ float Renderer11::getTextureMaxAnisotropy() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
return D3D11_MAX_MAXANISOTROPY;
case D3D_FEATURE_LEVEL_10_1:
@@ -2159,7 +2168,6 @@ Range Renderer11::getViewportBounds() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
return Range(D3D11_VIEWPORT_BOUNDS_MIN, D3D11_VIEWPORT_BOUNDS_MAX);
case D3D_FEATURE_LEVEL_10_1:
@@ -2180,7 +2188,6 @@ unsigned int Renderer11::getMaxVertexTextureImageUnits() const
META_ASSERT(MAX_TEXTURE_IMAGE_UNITS_VTF_SM4 <= gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS);
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
@@ -2212,41 +2219,15 @@ unsigned int Renderer11::getReservedFragmentUniformVectors() const
unsigned int Renderer11::getMaxVertexUniformVectors() const
{
META_ASSERT(MAX_VERTEX_UNIFORM_VECTORS_D3D11 <= D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT);
- switch (mFeatureLevel)
- {
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return MAX_VERTEX_UNIFORM_VECTORS_D3D11;
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return MAX_VERTEX_UNIFORM_VECTORS_D3D9;
- default:
- UNIMPLEMENTED();
- return 0;
- }
+ ASSERT(mFeatureLevel >= D3D_FEATURE_LEVEL_9_1);
+ return MAX_VERTEX_UNIFORM_VECTORS_D3D11;
}
unsigned int Renderer11::getMaxFragmentUniformVectors() const
{
META_ASSERT(MAX_FRAGMENT_UNIFORM_VECTORS_D3D11 <= D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT);
- switch (mFeatureLevel)
- {
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return MAX_FRAGMENT_UNIFORM_VECTORS_D3D11;
- case D3D_FEATURE_LEVEL_9_3:
- return 221;
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 29;
- default: UNREACHABLE();
- return 0;
- }
+ ASSERT(mFeatureLevel >= D3D_FEATURE_LEVEL_9_1);
+ return MAX_FRAGMENT_UNIFORM_VECTORS_D3D11;
}
unsigned int Renderer11::getMaxVaryingVectors() const
@@ -2254,11 +2235,9 @@ unsigned int Renderer11::getMaxVaryingVectors() const
META_ASSERT(gl::IMPLEMENTATION_MAX_VARYING_VECTORS == D3D11_VS_OUTPUT_REGISTER_COUNT);
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
return D3D11_VS_OUTPUT_REGISTER_COUNT;
case D3D_FEATURE_LEVEL_10_1:
- return D3D10_1_VS_OUTPUT_REGISTER_COUNT;
case D3D_FEATURE_LEVEL_10_0:
return D3D10_VS_OUTPUT_REGISTER_COUNT;
case D3D_FEATURE_LEVEL_9_3:
@@ -2274,7 +2253,6 @@ bool Renderer11::getNonPower2TextureSupport() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
@@ -2292,10 +2270,10 @@ bool Renderer11::getOcclusionQuerySupport() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
+ return true;
case D3D_FEATURE_LEVEL_9_3:
case D3D_FEATURE_LEVEL_9_2:
return true;
@@ -2310,12 +2288,11 @@ bool Renderer11::getInstancingSupport() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
case D3D_FEATURE_LEVEL_9_3:
- return true;
+ return true;
case D3D_FEATURE_LEVEL_9_2:
case D3D_FEATURE_LEVEL_9_1:
return false;
@@ -2336,10 +2313,10 @@ bool Renderer11::getDerivativeInstructionSupport() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
+ return true;
case D3D_FEATURE_LEVEL_9_3:
return true;
case D3D_FEATURE_LEVEL_9_2:
@@ -2360,13 +2337,12 @@ int Renderer11::getMajorShaderModel() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MAJOR_VERSION; // 5
case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MAJOR_VERSION; // 4
case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MAJOR_VERSION; // 4
case D3D_FEATURE_LEVEL_9_3:
case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1: return 4; // SM4 level 9, but treat as 4
+ case D3D_FEATURE_LEVEL_9_1: return D3D10_SHADER_MAJOR_VERSION; // 4 (level 9)
default: UNREACHABLE(); return 0;
}
}
@@ -2375,13 +2351,12 @@ int Renderer11::getMinorShaderModel() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MINOR_VERSION; // 0
case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MINOR_VERSION; // 1
case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MINOR_VERSION; // 0
case D3D_FEATURE_LEVEL_9_3:
case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1: return 0;
+ case D3D_FEATURE_LEVEL_9_1: return D3D10_SHADER_MINOR_VERSION; // 0 (level 9)
default: UNREACHABLE(); return 0;
}
}
@@ -2402,8 +2377,7 @@ int Renderer11::getMaxViewportDimension() const
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_11_0:
return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
@@ -2422,7 +2396,6 @@ int Renderer11::getMaxTextureWidth() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192
@@ -2437,7 +2410,6 @@ int Renderer11::getMaxTextureHeight() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192
@@ -2452,8 +2424,7 @@ bool Renderer11::get32BitIndexSupport() const
{
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_11_0:
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP >= 32; // true
case D3D_FEATURE_LEVEL_9_3:
@@ -2510,17 +2481,17 @@ unsigned int Renderer11::getMaxRenderTargets() const
switch (mFeatureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
return D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; // 8
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
- return D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; // 8
- case D3D_FEATURE_LEVEL_9_3:
- return D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT; // 4
+ case D3D_FEATURE_LEVEL_9_3: // return D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT; // 4
case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT; // 1
+ case D3D_FEATURE_LEVEL_9_1: // return D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT; // 1
+ // Feature level 10.0 and 10.1 cards perform very poorly when the pixel shader
+ // outputs to multiple RTs that are not bound.
+ // TODO: Remove pixel shader outputs for render targets that are not bound.
+ return 1;
default:
UNREACHABLE();
return 1;
@@ -2703,7 +2674,7 @@ bool Renderer11::copyTexture(ID3D11ShaderResourceView *source, const gl::Rectang
samplerDesc.BorderColor[2] = 0.0f;
samplerDesc.BorderColor[3] = 0.0f;
samplerDesc.MinLOD = 0.0f;
- samplerDesc.MaxLOD = 0.0f;
+ samplerDesc.MaxLOD = mDevice->GetFeatureLevel() >= D3D_FEATURE_LEVEL_10_0 ? 0.0f : FLT_MAX;
result = mDevice->CreateSamplerState(&samplerDesc, &mCopySampler);
ASSERT(SUCCEEDED(result));
@@ -2946,7 +2917,7 @@ ShaderExecutable *Renderer11::loadExecutable(const void *function, size_t length
return executable;
}
-ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type)
+ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround)
{
std::string profile;
@@ -3124,7 +3095,7 @@ void Renderer11::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsi
area.width = width;
area.height = height;
- readTextureData(colorBufferTexture, subresourceIndex, area, format, type, outputPitch,
+ readTextureData(colorBufferTexture, subresourceIndex, area, colorbuffer->getActualFormat(), format, type, outputPitch,
packReverseRowOrder, packAlignment, pixels);
colorBufferTexture->Release();
@@ -3160,7 +3131,7 @@ TextureStorage *Renderer11::createTextureStorageCube(int levels, GLenum internal
return new TextureStorage11_Cube(this, levels, internalformat, usage, forceRenderable, size);
}
-static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum destFormat, GLenum destType)
+static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum sourceGLFormat, GLenum destFormat, GLenum destType)
{
if (sourceFormat == DXGI_FORMAT_A8_UNORM &&
destFormat == GL_ALPHA &&
@@ -3168,9 +3139,10 @@ static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum
{
return 1;
}
- else if (sourceFormat == DXGI_FORMAT_R8G8B8A8_UNORM &&
- destFormat == GL_RGBA &&
- destType == GL_UNSIGNED_BYTE)
+ else if (sourceFormat == DXGI_FORMAT_R8G8B8A8_UNORM &&
+ sourceGLFormat == GL_RGBA8_OES &&
+ destFormat == GL_RGBA &&
+ destType == GL_UNSIGNED_BYTE)
{
return 4;
}
@@ -3180,9 +3152,10 @@ static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum
{
return 4;
}
- else if (sourceFormat == DXGI_FORMAT_R16G16B16A16_FLOAT &&
- destFormat == GL_RGBA &&
- destType == GL_HALF_FLOAT_OES)
+ else if (sourceFormat == DXGI_FORMAT_R16G16B16A16_FLOAT &&
+ sourceGLFormat == GL_RGBA16F_EXT &&
+ destFormat == GL_RGBA &&
+ destType == GL_HALF_FLOAT_OES)
{
return 8;
}
@@ -3192,9 +3165,10 @@ static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum
{
return 12;
}
- else if (sourceFormat == DXGI_FORMAT_R32G32B32A32_FLOAT &&
- destFormat == GL_RGBA &&
- destType == GL_FLOAT)
+ else if (sourceFormat == DXGI_FORMAT_R32G32B32A32_FLOAT &&
+ sourceGLFormat == GL_RGBA32F_EXT &&
+ destFormat == GL_RGBA &&
+ destType == GL_FLOAT)
{
return 16;
}
@@ -3204,7 +3178,7 @@ static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum
}
}
-static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format, unsigned int x,
+static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format, GLenum glFormat, unsigned int x,
unsigned int y, int inputPitch, gl::Color *outColor)
{
switch (format)
@@ -3215,7 +3189,15 @@ static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format,
outColor->red = (rgba & 0x000000FF) * (1.0f / 0x000000FF);
outColor->green = (rgba & 0x0000FF00) * (1.0f / 0x0000FF00);
outColor->blue = (rgba & 0x00FF0000) * (1.0f / 0x00FF0000);
- outColor->alpha = (rgba & 0xFF000000) * (1.0f / 0xFF000000);
+
+ if (gl::GetAlphaSize(glFormat) > 0)
+ {
+ outColor->alpha = (rgba & 0xFF000000) * (1.0f / 0xFF000000);
+ }
+ else
+ {
+ outColor->alpha = 1.0f;
+ }
}
break;
@@ -3233,7 +3215,15 @@ static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format,
outColor->red = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 0);
outColor->green = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 1);
outColor->blue = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 2);
- outColor->alpha = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 3);
+
+ if (gl::GetAlphaSize(glFormat) > 0)
+ {
+ outColor->alpha = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 3);
+ }
+ else
+ {
+ outColor->alpha = 1.0f;
+ }
}
break;
@@ -3251,7 +3241,15 @@ static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format,
outColor->red = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 0));
outColor->green = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 1));
outColor->blue = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 2));
- outColor->alpha = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 3));
+
+ if (gl::GetAlphaSize(glFormat) > 0)
+ {
+ outColor->alpha = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 3));
+ }
+ else
+ {
+ outColor->alpha = 1.0f;
+ }
}
break;
@@ -3413,7 +3411,7 @@ static inline void writePixelColor(const gl::Color &color, GLenum format, GLenum
}
void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area,
- GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
+ GLenum sourceFormat, GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
GLint packAlignment, void *pixels)
{
D3D11_TEXTURE2D_DESC textureDesc;
@@ -3502,7 +3500,7 @@ void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResou
inputPitch = static_cast<int>(mapping.RowPitch);
}
- unsigned int fastPixelSize = getFastPixelCopySize(textureDesc.Format, format, type);
+ unsigned int fastPixelSize = getFastPixelCopySize(textureDesc.Format, sourceFormat, format, type);
if (fastPixelSize != 0)
{
unsigned char *dest = static_cast<unsigned char*>(pixels);
@@ -3537,7 +3535,7 @@ void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResou
{
for (int i = 0; i < area.width; i++)
{
- readPixelColor(source, textureDesc.Format, i, j, inputPitch, &pixelColor);
+ readPixelColor(source, textureDesc.Format, sourceFormat, i, j, inputPitch, &pixelColor);
writePixelColor(pixelColor, format, type, i, j, outputPitch, pixels);
}
}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h
index 433945da7a..a8a722c56c 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h
@@ -14,8 +14,8 @@
#include "libGLESv2/mathutil.h"
#include "libGLESv2/renderer/Renderer.h"
-#include "libGLESv2/renderer/RenderStateCache.h"
-#include "libGLESv2/renderer/InputLayoutCache.h"
+#include "libGLESv2/renderer/d3d11/RenderStateCache.h"
+#include "libGLESv2/renderer/d3d11/InputLayoutCache.h"
#include "libGLESv2/renderer/RenderTarget.h"
namespace gl
@@ -32,7 +32,6 @@ class StreamingIndexBufferInterface;
enum
{
- MAX_VERTEX_UNIFORM_VECTORS_D3D9 = 254,
MAX_VERTEX_UNIFORM_VECTORS_D3D11 = 1024,
MAX_FRAGMENT_UNIFORM_VECTORS_D3D11 = 1024
};
@@ -40,7 +39,7 @@ enum
class Renderer11 : public Renderer
{
public:
- Renderer11(egl::Display *display, HDC hDc);
+ Renderer11(egl::Display *display);
virtual ~Renderer11();
static Renderer11 *makeRenderer11(Renderer *renderer);
@@ -59,7 +58,7 @@ class Renderer11 : public Renderer
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture);
virtual void setRasterizerState(const gl::RasterizerState &rasterState);
- virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
+ virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
unsigned int sampleMask);
virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
int stencilBackRef, bool frontFaceCCW);
@@ -156,7 +155,7 @@ class Renderer11 : public Renderer
// Shader operations
virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type);
- virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type);
+ virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround);
// Image operations
virtual Image *createImage();
@@ -178,7 +177,7 @@ class Renderer11 : public Renderer
ID3D11Device *getDevice() { return mDevice; }
ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; };
IDXGIFactory *getDxgiFactory() { return mDxgiFactory; };
- D3D_FEATURE_LEVEL getFeatureLevel() const { return mFeatureLevel; }
+ D3D_FEATURE_LEVEL getFeatureLevel() { return mFeatureLevel; }
bool getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource);
void unapplyRenderTargets();
@@ -193,10 +192,10 @@ class Renderer11 : public Renderer
void drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer, int instances);
void readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area,
- GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
+ GLenum sourceFormat, GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
GLint packAlignment, void *pixels);
- void maskedClear(const gl::ClearParameters &clearParams, bool usingExtendedDrawBuffers);
+ void maskedClear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
rx::Range getViewportBounds() const;
bool blitRenderbufferRect(const gl::Rectangle &readRect, const gl::Rectangle &drawRect, RenderTarget *readRenderTarget,
@@ -205,7 +204,6 @@ class Renderer11 : public Renderer
HMODULE mD3d11Module;
HMODULE mDxgiModule;
- HDC mDc;
bool mDeviceLost;
@@ -237,7 +235,7 @@ class Renderer11 : public Renderer
unsigned int qualityLevels[D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT];
};
- typedef std::unordered_map<DXGI_FORMAT, MultisampleSupportInfo> MultisampleSupportMap;
+ typedef std::unordered_map<DXGI_FORMAT, MultisampleSupportInfo, std::hash<int> > MultisampleSupportMap;
MultisampleSupportMap mMultisampleSupportMap;
unsigned int mMaxSupportedSamples;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp
index e1eb560334..2e455e3af5 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp
@@ -8,7 +8,7 @@
// ShaderExecutable11.cpp: Implements a D3D11-specific class to contain shader
// executable implementation details.
-#include "libGLESv2/renderer/ShaderExecutable11.h"
+#include "libGLESv2/renderer/d3d11/ShaderExecutable11.h"
#include "common/debug.h"
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h
index c6ec1cf7d2..c6ec1cf7d2 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp
index 2fe15ff5b8..bd97d5cff5 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp
@@ -7,12 +7,13 @@
// SwapChain11.cpp: Implements a back-end specific class for the D3D11 swap chain.
-#include "libGLESv2/renderer/SwapChain11.h"
+#include "libGLESv2/renderer/d3d11/SwapChain11.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/renderer/shaders/compiled/passthrough11vs.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughrgba11ps.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthrough11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba11ps.h"
namespace rx
{
@@ -48,83 +49,19 @@ SwapChain11::~SwapChain11()
void SwapChain11::release()
{
- if (mSwapChain)
- {
- mSwapChain->Release();
- mSwapChain = NULL;
- }
-
- if (mBackBufferTexture)
- {
- mBackBufferTexture->Release();
- mBackBufferTexture = NULL;
- }
-
- if (mBackBufferRTView)
- {
- mBackBufferRTView->Release();
- mBackBufferRTView = NULL;
- }
-
- if (mOffscreenTexture)
- {
- mOffscreenTexture->Release();
- mOffscreenTexture = NULL;
- }
-
- if (mOffscreenRTView)
- {
- mOffscreenRTView->Release();
- mOffscreenRTView = NULL;
- }
-
- if (mOffscreenSRView)
- {
- mOffscreenSRView->Release();
- mOffscreenSRView = NULL;
- }
-
- if (mDepthStencilTexture)
- {
- mDepthStencilTexture->Release();
- mDepthStencilTexture = NULL;
- }
-
- if (mDepthStencilDSView)
- {
- mDepthStencilDSView->Release();
- mDepthStencilDSView = NULL;
- }
-
- if (mQuadVB)
- {
- mQuadVB->Release();
- mQuadVB = NULL;
- }
-
- if (mPassThroughSampler)
- {
- mPassThroughSampler->Release();
- mPassThroughSampler = NULL;
- }
-
- if (mPassThroughIL)
- {
- mPassThroughIL->Release();
- mPassThroughIL = NULL;
- }
-
- if (mPassThroughVS)
- {
- mPassThroughVS->Release();
- mPassThroughVS = NULL;
- }
-
- if (mPassThroughPS)
- {
- mPassThroughPS->Release();
- mPassThroughPS = NULL;
- }
+ SafeRelease(mSwapChain);
+ SafeRelease(mBackBufferTexture);
+ SafeRelease(mBackBufferRTView);
+ SafeRelease(mOffscreenTexture);
+ SafeRelease(mOffscreenRTView);
+ SafeRelease(mOffscreenSRView);
+ SafeRelease(mDepthStencilTexture);
+ SafeRelease(mDepthStencilDSView);
+ SafeRelease(mQuadVB);
+ SafeRelease(mPassThroughSampler);
+ SafeRelease(mPassThroughIL);
+ SafeRelease(mPassThroughVS);
+ SafeRelease(mPassThroughPS);
if (!mAppCreatedShareHandle)
{
@@ -134,35 +71,11 @@ void SwapChain11::release()
void SwapChain11::releaseOffscreenTexture()
{
- if (mOffscreenTexture)
- {
- mOffscreenTexture->Release();
- mOffscreenTexture = NULL;
- }
-
- if (mOffscreenRTView)
- {
- mOffscreenRTView->Release();
- mOffscreenRTView = NULL;
- }
-
- if (mOffscreenSRView)
- {
- mOffscreenSRView->Release();
- mOffscreenSRView = NULL;
- }
-
- if (mDepthStencilTexture)
- {
- mDepthStencilTexture->Release();
- mDepthStencilTexture = NULL;
- }
-
- if (mDepthStencilDSView)
- {
- mDepthStencilDSView->Release();
- mDepthStencilDSView = NULL;
- }
+ SafeRelease(mOffscreenTexture);
+ SafeRelease(mOffscreenRTView);
+ SafeRelease(mOffscreenSRView);
+ SafeRelease(mDepthStencilTexture);
+ SafeRelease(mDepthStencilDSView);
}
EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHeight)
@@ -369,23 +282,17 @@ EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight)
return EGL_BAD_ACCESS;
}
- if (!mSwapChain)
- reset(backbufferWidth, backbufferHeight, mSwapInterval);
+ // EGL allows creating a surface with 0x0 dimension, however, DXGI does not like 0x0 swapchains
+ if (backbufferWidth < 1 || backbufferHeight < 1)
+ {
+ return EGL_SUCCESS;
+ }
// Can only call resize if we have already created our swap buffer and resources
ASSERT(mSwapChain && mBackBufferTexture && mBackBufferRTView);
- if (mBackBufferTexture)
- {
- mBackBufferTexture->Release();
- mBackBufferTexture = NULL;
- }
-
- if (mBackBufferRTView)
- {
- mBackBufferRTView->Release();
- mBackBufferRTView = NULL;
- }
+ SafeRelease(mBackBufferTexture);
+ SafeRelease(mBackBufferRTView);
// Resize swap chain
DXGI_FORMAT backbufferDXGIFormat = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
@@ -434,23 +341,9 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
// Release specific resources to free up memory for the new render target, while the
// old render target still exists for the purpose of preserving its contents.
- if (mSwapChain)
- {
- mSwapChain->Release();
- mSwapChain = NULL;
- }
-
- if (mBackBufferTexture)
- {
- mBackBufferTexture->Release();
- mBackBufferTexture = NULL;
- }
-
- if (mBackBufferRTView)
- {
- mBackBufferRTView->Release();
- mBackBufferRTView = NULL;
- }
+ SafeRelease(mSwapChain);
+ SafeRelease(mBackBufferTexture);
+ SafeRelease(mBackBufferRTView);
mSwapInterval = static_cast<unsigned int>(swapInterval);
if (mSwapInterval > 4)
@@ -469,25 +362,13 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
if (mWindow)
{
#if !defined(ANGLE_OS_WINRT)
- // We cannot create a swap chain for an HWND that is owned by a different process
- DWORD currentProcessId = GetCurrentProcessId();
- DWORD wndProcessId;
- GetWindowThreadProcessId(mWindow, &wndProcessId);
-
- if (currentProcessId != wndProcessId)
- {
- ERR("Could not create swap chain, window owned by different process");
- release();
- return EGL_BAD_NATIVE_WINDOW;
- }
-
IDXGIFactory *factory = mRenderer->getDxgiFactory();
DXGI_SWAP_CHAIN_DESC swapChainDesc = {0};
- swapChainDesc.BufferCount = 2;
swapChainDesc.BufferDesc.Format = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
swapChainDesc.BufferDesc.Width = backbufferWidth;
swapChainDesc.BufferDesc.Height = backbufferHeight;
+ swapChainDesc.BufferCount = 2;
swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
swapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
@@ -512,7 +393,6 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
#endif
#endif
-
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.Flags = 0;
swapChainDesc.SampleDesc.Count = 1;
@@ -535,10 +415,28 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
{
return EGL_CONTEXT_LOST;
}
+#if !defined(ANGLE_OS_WINRT)
else
{
- return EGL_BAD_ALLOC;
+ // We cannot create a swap chain for an HWND that is owned by a different process on some versions of
+ // windows
+ DWORD currentProcessId = GetCurrentProcessId();
+ DWORD wndProcessId;
+ GetWindowThreadProcessId(mWindow, &wndProcessId);
+
+ if (currentProcessId != wndProcessId)
+ {
+ ERR("Could not create swap chain, window owned by different process");
+ return EGL_BAD_NATIVE_WINDOW;
+ }
+ else
+ {
+ return EGL_BAD_ALLOC;
+ }
}
+#else
+ return EGL_BAD_ALLOC;
+#endif
}
result = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mBackBufferTexture);
@@ -697,7 +595,12 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
// Draw
deviceContext->Draw(4, 0);
+
+#if ANGLE_FORCE_VSYNC_OFF
+ result = mSwapChain->Present(0, 0);
+#else
result = mSwapChain->Present(mSwapInterval, 0);
+#endif
if (result == DXGI_ERROR_DEVICE_REMOVED)
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h
index 2a030c839d..2a030c839d 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
index 32a407a988..fdfbe526ec 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
@@ -8,12 +8,12 @@
// TextureStorage11.cpp: Implements the abstract rx::TextureStorage11 class and its concrete derived
// classes TextureStorage11_2D and TextureStorage11_Cube, which act as the interface to the D3D11 texture.
-#include "libGLESv2/renderer/TextureStorage11.h"
+#include "libGLESv2/renderer/d3d11/TextureStorage11.h"
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/renderer/RenderTarget11.h"
-#include "libGLESv2/renderer/SwapChain11.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/RenderTarget11.h"
+#include "libGLESv2/renderer/d3d11/SwapChain11.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
#include "libGLESv2/utilities.h"
#include "libGLESv2/main.h"
@@ -229,7 +229,7 @@ TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, int levels, GLenum
mRenderTarget[i] = NULL;
}
- DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat, Renderer11::makeRenderer11(renderer)->getFeatureLevel());
+ DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat, mRenderer->getFeatureLevel());
if (d3d11::IsDepthStencilFormat(convertedFormat))
{
mTextureFormat = d3d11::GetDepthTextureFormat(convertedFormat);
@@ -331,7 +331,7 @@ RenderTarget *TextureStorage11_2D::getRenderTarget(int level)
srvDesc.Format = mShaderResourceFormat;
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
srvDesc.Texture2D.MostDetailedMip = level;
- srvDesc.Texture2D.MipLevels = 1;
+ srvDesc.Texture2D.MipLevels = level ? 1 : -1;
ID3D11ShaderResourceView *srv;
result = device->CreateShaderResourceView(mTexture, &srvDesc, &srv);
@@ -450,7 +450,7 @@ TextureStorage11_Cube::TextureStorage11_Cube(Renderer *renderer, int levels, GLe
}
}
- DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat, Renderer11::makeRenderer11(renderer)->getFeatureLevel());
+ DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat, mRenderer->getFeatureLevel());
if (d3d11::IsDepthStencilFormat(convertedFormat))
{
mTextureFormat = d3d11::GetDepthTextureFormat(convertedFormat);
@@ -549,7 +549,7 @@ RenderTarget *TextureStorage11_Cube::getRenderTarget(GLenum faceTarget, int leve
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
srvDesc.Format = mShaderResourceFormat;
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; // Will be used with Texture2D sampler, not TextureCube
srvDesc.Texture2DArray.MostDetailedMip = level;
srvDesc.Texture2DArray.MipLevels = 1;
srvDesc.Texture2DArray.FirstArraySlice = faceIdx;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.h
index 3c5ded05b8..3c5ded05b8 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp
index 521da80c3d..6f9b4181f1 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp
@@ -7,11 +7,11 @@
// VertexBuffer11.cpp: Defines the D3D11 VertexBuffer implementation.
-#include "libGLESv2/renderer/VertexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/VertexBuffer11.h"
#include "libGLESv2/renderer/BufferStorage.h"
#include "libGLESv2/Buffer.h"
-#include "libGLESv2/renderer/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
#include "libGLESv2/Context.h"
namespace rx
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.h
index eceb426e82..eceb426e82 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer11.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp
index 0624a61160..34b8259a80 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp
@@ -8,7 +8,7 @@
// renderer11_utils.cpp: Conversion functions and other utility routines
// specific to the D3D11 renderer.
-#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
#include "common/debug.h"
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h
index 70ad4fea2b..70ad4fea2b 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl
index cb132dc99c..cb132dc99c 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Passthrough11.hlsl b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough11.hlsl
index 43b7801efc..43b7801efc 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Passthrough11.hlsl
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough11.hlsl
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Blit.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.cpp
index 2a3ce39c63..d73df6418d 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Blit.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.cpp
@@ -7,23 +7,23 @@
// Blit.cpp: Surface copy utility class.
-#include "libGLESv2/renderer/Blit.h"
+#include "libGLESv2/renderer/d3d9/Blit.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/TextureStorage9.h"
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
#include "libGLESv2/Framebuffer.h"
#include "libGLESv2/Renderbuffer.h"
namespace
{
-#include "libGLESv2/renderer/shaders/compiled/standardvs.h"
-#include "libGLESv2/renderer/shaders/compiled/flipyvs.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughps.h"
-#include "libGLESv2/renderer/shaders/compiled/luminanceps.h"
-#include "libGLESv2/renderer/shaders/compiled/componentmaskps.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/standardvs.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/flipyvs.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/passthroughps.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/componentmaskps.h"
const BYTE* const g_shaderCode[] =
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Blit.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.h
index 3718028e66..3718028e66 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Blit.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp
index 57fd29bf80..9fdc1246f1 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp
@@ -7,7 +7,7 @@
// BufferStorage9.cpp Defines the BufferStorage9 class.
-#include "libGLESv2/renderer/BufferStorage9.h"
+#include "libGLESv2/renderer/d3d9/BufferStorage9.h"
#include "common/debug.h"
namespace rx
@@ -36,7 +36,7 @@ void *BufferStorage9::getData()
return mMemory;
}
-void BufferStorage9::setData(const void* data, unsigned int size, unsigned int offset, unsigned int)
+void BufferStorage9::setData(const void* data, unsigned int size, unsigned int offset)
{
if (!mMemory || offset + size > mAllocatedSize)
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.h
index 82ae577e23..3e803969bc 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.h
@@ -23,7 +23,7 @@ class BufferStorage9 : public BufferStorage
static BufferStorage9 *makeBufferStorage9(BufferStorage *bufferStorage);
virtual void *getData();
- virtual void setData(const void* data, unsigned int size, unsigned int offset, unsigned int target = 0);
+ virtual void setData(const void* data, unsigned int size, unsigned int offset);
virtual void clear();
virtual unsigned int getSize() const;
virtual bool supportsDirectBinding() const;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Fence9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Fence9.cpp
index 86064d7e52..639c37b4e4 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Fence9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Fence9.cpp
@@ -7,10 +7,10 @@
// Fence9.cpp: Defines the rx::Fence9 class.
-#include "libGLESv2/renderer/Fence9.h"
+#include "libGLESv2/renderer/d3d9/Fence9.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
namespace rx
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Fence9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Fence9.h
index 9f17641e51..9f17641e51 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Fence9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Fence9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Image9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.cpp
index 53030b7f1e..cd12d8cc9e 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Image9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.cpp
@@ -8,16 +8,16 @@
// Image9.cpp: Implements the rx::Image9 class, which acts as the interface to
// the actual underlying surfaces of a Texture.
-#include "libGLESv2/renderer/Image9.h"
+#include "libGLESv2/renderer/d3d9/Image9.h"
#include "libGLESv2/main.h"
#include "libGLESv2/Framebuffer.h"
#include "libGLESv2/Renderbuffer.h"
-#include "libGLESv2/renderer/Renderer9.h"
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/TextureStorage9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
#include "libGLESv2/renderer/generatemip.h"
namespace rx
@@ -733,4 +733,4 @@ void Image9::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
mDirty = true;
}
-} \ No newline at end of file
+}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Image9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.h
index 2fbbca3124..2fbbca3124 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Image9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp
index c6d83c5dca..7cb5d13a18 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp
@@ -7,8 +7,8 @@
// Indexffer9.cpp: Defines the D3D9 IndexBuffer implementation.
-#include "libGLESv2/renderer/IndexBuffer9.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/IndexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
namespace rx
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.h
index 6801867532..6801867532 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Query9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Query9.cpp
index ef694267dd..72781cbc39 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Query9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Query9.cpp
@@ -8,10 +8,10 @@
// Query9.cpp: Defines the rx::Query9 class which implements rx::QueryImpl.
-#include "libGLESv2/renderer/Query9.h"
+#include "libGLESv2/renderer/d3d9/Query9.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
namespace rx
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Query9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Query9.h
index 47eef89336..47eef89336 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Query9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Query9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp
index a84c709059..090431db99 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp
@@ -8,10 +8,10 @@
// RenderTarget9.cpp: Implements a D3D9-specific wrapper for IDirect3DSurface9
// pointers retained by renderbuffers.
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
#include "libGLESv2/main.h"
namespace rx
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.h
index faf8ad1c6d..faf8ad1c6d 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderTarget9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Renderer9.cpp
index d3f3814ae5..97a10d64bf 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Renderer9.cpp
@@ -14,19 +14,19 @@
#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/renderer/IndexDataManager.h"
-#include "libGLESv2/renderer/Renderer9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/ShaderExecutable9.h"
-#include "libGLESv2/renderer/SwapChain9.h"
-#include "libGLESv2/renderer/TextureStorage9.h"
-#include "libGLESv2/renderer/Image9.h"
-#include "libGLESv2/renderer/Blit.h"
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/VertexBuffer9.h"
-#include "libGLESv2/renderer/IndexBuffer9.h"
-#include "libGLESv2/renderer/BufferStorage9.h"
-#include "libGLESv2/renderer/Query9.h"
-#include "libGLESv2/renderer/Fence9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/ShaderExecutable9.h"
+#include "libGLESv2/renderer/d3d9/SwapChain9.h"
+#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
+#include "libGLESv2/renderer/d3d9/Image9.h"
+#include "libGLESv2/renderer/d3d9/Blit.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/VertexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/IndexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/BufferStorage9.h"
+#include "libGLESv2/renderer/d3d9/Query9.h"
+#include "libGLESv2/renderer/d3d9/Fence9.h"
#include "libEGL/Display.h"
@@ -121,8 +121,6 @@ Renderer9::Renderer9(egl::Display *display, HDC hDc, bool softwareDevice) : Rend
Renderer9::~Renderer9()
{
- releaseDeviceResources();
-
if (mDevice)
{
// If the device is lost, reset it first to prevent leaving the driver in an unstable state
@@ -130,22 +128,19 @@ Renderer9::~Renderer9()
{
resetDevice();
}
-
- mDevice->Release();
- mDevice = NULL;
}
- if (mDeviceEx)
- {
- mDeviceEx->Release();
- mDeviceEx = NULL;
- }
+ deinitialize();
+}
- if (mD3d9)
- {
- mD3d9->Release();
- mD3d9 = NULL;
- }
+void Renderer9::deinitialize()
+{
+ releaseDeviceResources();
+
+ SafeRelease(mDevice);
+ SafeRelease(mDeviceEx);
+ SafeRelease(mD3d9);
+ SafeRelease(mD3d9Ex);
if (mDeviceWindow)
{
@@ -153,12 +148,6 @@ Renderer9::~Renderer9()
mDeviceWindow = NULL;
}
- if (mD3d9Ex)
- {
- mD3d9Ex->Release();
- mD3d9Ex = NULL;
- }
-
if (mD3d9Module)
{
mD3d9Module = NULL;
@@ -863,7 +852,7 @@ void Renderer9::setRasterizerState(const gl::RasterizerState &rasterState)
mForceSetRasterState = false;
}
-void Renderer9::setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor, unsigned int sampleMask)
+void Renderer9::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor, unsigned int sampleMask)
{
bool blendStateChanged = mForceSetBlendState || memcmp(&blendState, &mCurBlendState, sizeof(gl::BlendState)) != 0;
bool blendColorChanged = mForceSetBlendState || memcmp(&blendColor, &mCurBlendColor, sizeof(gl::Color)) != 0;
@@ -1465,7 +1454,7 @@ void Renderer9::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvo
if (mode == GL_POINTS)
{
- drawIndexedPoints(count, type, indices, elementArrayBuffer);
+ drawIndexedPoints(count, type, indices, indexInfo.minIndex, elementArrayBuffer);
}
else if (mode == GL_LINE_LOOP)
{
@@ -1669,16 +1658,16 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
}
template <typename T>
-static void drawPoints(IDirect3DDevice9* device, GLsizei count, const GLvoid *indices)
+static void drawPoints(IDirect3DDevice9* device, GLsizei count, const GLvoid *indices, int minIndex)
{
for (int i = 0; i < count; i++)
{
- unsigned int indexValue = static_cast<unsigned int>(static_cast<const T*>(indices)[i]);
+ unsigned int indexValue = static_cast<unsigned int>(static_cast<const T*>(indices)[i]) - minIndex;
device->DrawPrimitive(D3DPT_POINTLIST, indexValue, 1);
}
}
-void Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer)
+void Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer)
{
// Drawing index point lists is unsupported in d3d9, fall back to a regular DrawPrimitive call
// for each individual point. This call is not expected to happen often.
@@ -1692,9 +1681,9 @@ void Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indi
switch (type)
{
- case GL_UNSIGNED_BYTE: drawPoints<GLubyte>(mDevice, count, indices); break;
- case GL_UNSIGNED_SHORT: drawPoints<GLushort>(mDevice, count, indices); break;
- case GL_UNSIGNED_INT: drawPoints<GLuint>(mDevice, count, indices); break;
+ case GL_UNSIGNED_BYTE: drawPoints<GLubyte>(mDevice, count, indices, minIndex); break;
+ case GL_UNSIGNED_SHORT: drawPoints<GLushort>(mDevice, count, indices, minIndex); break;
+ case GL_UNSIGNED_INT: drawPoints<GLuint>(mDevice, count, indices, minIndex); break;
default: UNREACHABLE();
}
}
@@ -2045,31 +2034,19 @@ void Renderer9::releaseDeviceResources()
mEventQueryPool.pop_back();
}
- if (mMaskedClearSavedState)
- {
- mMaskedClearSavedState->Release();
- mMaskedClearSavedState = NULL;
- }
+ SafeRelease(mMaskedClearSavedState);
mVertexShaderCache.clear();
mPixelShaderCache.clear();
- delete mBlit;
- mBlit = NULL;
-
- delete mVertexDataManager;
- mVertexDataManager = NULL;
-
- delete mIndexDataManager;
- mIndexDataManager = NULL;
-
- delete mLineLoopIB;
- mLineLoopIB = NULL;
+ SafeDelete(mBlit);
+ SafeDelete(mVertexDataManager);
+ SafeDelete(mIndexDataManager);
+ SafeDelete(mLineLoopIB);
for (int i = 0; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++)
{
- delete mNullColorbufferCache[i].buffer;
- mNullColorbufferCache[i].buffer = NULL;
+ SafeDelete(mNullColorbufferCache[i].buffer);
}
}
@@ -2089,22 +2066,8 @@ bool Renderer9::isDeviceLost()
// set notify to true to broadcast a message to all contexts of the device loss
bool Renderer9::testDeviceLost(bool notify)
{
- HRESULT status = S_OK;
-
- if (mDeviceEx)
- {
- status = mDeviceEx->CheckDeviceState(NULL);
- }
- else if (mDevice)
- {
- status = mDevice->TestCooperativeLevel();
- }
- else
- {
- // No device yet, so no reset required
- }
-
- bool isLost = FAILED(status) || d3d9::isDeviceLostError(status);
+ HRESULT status = getDeviceStatusCode();
+ bool isLost = FAILED(status);
if (isLost)
{
@@ -2123,7 +2086,7 @@ bool Renderer9::testDeviceLost(bool notify)
return isLost;
}
-bool Renderer9::testDeviceResettable()
+HRESULT Renderer9::getDeviceStatusCode()
{
HRESULT status = D3D_OK;
@@ -2136,9 +2099,14 @@ bool Renderer9::testDeviceResettable()
status = mDevice->TestCooperativeLevel();
}
+ return status;
+}
+
+bool Renderer9::testDeviceResettable()
+{
// On D3D9Ex, DEVICELOST represents a hung device that needs to be restarted
// DEVICEREMOVED indicates the device has been stopped and must be recreated
- switch (status)
+ switch (getDeviceStatusCode())
{
case D3DERR_DEVICENOTRESET:
case D3DERR_DEVICEHUNG:
@@ -2146,8 +2114,8 @@ bool Renderer9::testDeviceResettable()
case D3DERR_DEVICELOST:
return (mDeviceEx != NULL);
case D3DERR_DEVICEREMOVED:
- UNIMPLEMENTED();
- return false;
+ ASSERT(mDeviceEx != NULL);
+ return isRemovedDeviceResettable();
default:
return false;
}
@@ -2161,14 +2129,26 @@ bool Renderer9::resetDevice()
HRESULT result = D3D_OK;
bool lost = testDeviceLost(false);
- int attempts = 3;
+ bool removedDevice = (getDeviceStatusCode() == D3DERR_DEVICEREMOVED);
- while (lost && attempts > 0)
+ // Device Removed is a feature which is only present with D3D9Ex
+ ASSERT(mDeviceEx != NULL || !removedDevice);
+
+ for (int attempts = 3; lost && attempts > 0; attempts--)
{
- if (mDeviceEx)
+ if (removedDevice)
+ {
+ // Device removed, which may trigger on driver reinstallation,
+ // may cause a longer wait other reset attempts before the
+ // system is ready to handle creating a new device.
+ Sleep(800);
+ lost = !resetRemovedDevice();
+ }
+ else if (mDeviceEx)
{
Sleep(500); // Give the graphics driver some CPU time
result = mDeviceEx->ResetEx(&presentParameters, NULL);
+ lost = testDeviceLost(false);
}
else
{
@@ -2183,10 +2163,8 @@ bool Renderer9::resetDevice()
{
result = mDevice->Reset(&presentParameters);
}
+ lost = testDeviceLost(false);
}
-
- lost = testDeviceLost(false);
- attempts --;
}
if (FAILED(result))
@@ -2195,13 +2173,58 @@ bool Renderer9::resetDevice()
return false;
}
- // reset device defaults
- initializeDevice();
+ if (removedDevice && lost)
+ {
+ ERR("Device lost reset failed multiple times");
+ return false;
+ }
+
+ // If the device was removed, we already finished re-initialization in resetRemovedDevice
+ if (!removedDevice)
+ {
+ // reset device defaults
+ initializeDevice();
+ }
+
mDeviceLost = false;
return true;
}
+bool Renderer9::isRemovedDeviceResettable() const
+{
+ bool success = false;
+
+#ifdef ANGLE_ENABLE_D3D9EX
+ IDirect3D9Ex *d3d9Ex = NULL;
+ typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex**);
+ Direct3DCreate9ExFunc Direct3DCreate9ExPtr = reinterpret_cast<Direct3DCreate9ExFunc>(GetProcAddress(mD3d9Module, "Direct3DCreate9Ex"));
+
+ if (Direct3DCreate9ExPtr && SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &d3d9Ex)))
+ {
+ D3DCAPS9 deviceCaps;
+ HRESULT result = d3d9Ex->GetDeviceCaps(mAdapter, mDeviceType, &deviceCaps);
+ success = SUCCEEDED(result);
+ }
+
+ SafeRelease(d3d9Ex);
+#else
+ ASSERT(UNREACHABLE());
+#endif
+
+ return success;
+}
+
+bool Renderer9::resetRemovedDevice()
+{
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/bb172554(v=vs.85).aspx:
+ // The hardware adapter has been removed. Application must destroy the device, do enumeration of
+ // adapters and create another Direct3D device. If application continues rendering without
+ // calling Reset, the rendering calls will succeed. Applies to Direct3D 9Ex only.
+ deinitialize();
+ return (initialize() == EGL_SUCCESS);
+}
+
DWORD Renderer9::getAdapterVendor() const
{
return mAdapterIdentifier.VendorId;
@@ -3129,7 +3152,7 @@ ShaderExecutable *Renderer9::loadExecutable(const void *function, size_t length,
return executable;
}
-ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type)
+ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround)
{
const char *profile = NULL;
@@ -3146,7 +3169,11 @@ ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const cha
return NULL;
}
- ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, ANGLE_COMPILE_OPTIMIZATION_LEVEL, true);
+ // ANGLE issue 486:
+ // Work-around a D3D9 compiler bug that presents itself when using conditional discard, by disabling optimization
+ UINT optimizationFlags = (workaround == ANGLE_D3D_WORKAROUND_SM3_OPTIMIZER ? D3DCOMPILE_SKIP_OPTIMIZATION : ANGLE_COMPILE_OPTIMIZATION_LEVEL);
+
+ ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, optimizationFlags, true);
if (!binary)
return NULL;
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Renderer9.h
index f8932c4fd4..24fd2bdd84 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Renderer9.h
@@ -12,7 +12,7 @@
#include "common/angleutils.h"
#include "libGLESv2/mathutil.h"
#include "libGLESv2/renderer/ShaderCache.h"
-#include "libGLESv2/renderer/VertexDeclarationCache.h"
+#include "libGLESv2/renderer/d3d9/VertexDeclarationCache.h"
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/renderer/RenderTarget.h"
@@ -72,7 +72,7 @@ class Renderer9 : public Renderer
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture);
virtual void setRasterizerState(const gl::RasterizerState &rasterState);
- virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
+ virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
unsigned int sampleMask);
virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
int stencilBackRef, bool frontFaceCCW);
@@ -170,7 +170,7 @@ class Renderer9 : public Renderer
// Shader operations
virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type);
- virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type);
+ virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround);
// Image operations
virtual Image *createImage();
@@ -198,12 +198,14 @@ class Renderer9 : public Renderer
private:
DISALLOW_COPY_AND_ASSIGN(Renderer9);
+ void deinitialize();
+
void applyUniformnfv(gl::Uniform *targetUniform, const GLfloat *v);
void applyUniformniv(gl::Uniform *targetUniform, const GLint *v);
void applyUniformnbv(gl::Uniform *targetUniform, const GLint *v);
void drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
- void drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer);
+ void drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray);
bool copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged);
@@ -218,6 +220,10 @@ class Renderer9 : public Renderer
D3DPRESENT_PARAMETERS getDefaultPresentParameters();
void releaseDeviceResources();
+ HRESULT getDeviceStatusCode();
+ bool isRemovedDeviceResettable() const;
+ bool resetRemovedDevice();
+
UINT mAdapter;
D3DDEVTYPE mDeviceType;
bool mSoftwareDevice; // FIXME: Deprecate
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp
index 98868a3fbf..5decf9664d 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp
@@ -8,7 +8,7 @@
// ShaderExecutable9.cpp: Implements a D3D9-specific class to contain shader
// executable implementation details.
-#include "libGLESv2/renderer/ShaderExecutable9.h"
+#include "libGLESv2/renderer/d3d9/ShaderExecutable9.h"
#include "common/debug.h"
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.h
index fa1e6c2844..fa1e6c2844 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/ShaderExecutable9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/SwapChain9.cpp
index f57a874688..dd8895d18d 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/SwapChain9.cpp
@@ -7,9 +7,9 @@
// SwapChain9.cpp: Implements a back-end specific class for the D3D9 swap chain.
-#include "libGLESv2/renderer/SwapChain9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/SwapChain9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
namespace rx
{
@@ -71,6 +71,9 @@ void SwapChain9::release()
static DWORD convertInterval(EGLint interval)
{
+#if ANGLE_FORCE_VSYNC_OFF
+ return D3DPRESENT_INTERVAL_IMMEDIATE;
+#else
switch(interval)
{
case 0: return D3DPRESENT_INTERVAL_IMMEDIATE;
@@ -82,6 +85,7 @@ static DWORD convertInterval(EGLint interval)
}
return D3DPRESENT_INTERVAL_DEFAULT;
+#endif
}
EGLint SwapChain9::resize(int backbufferWidth, int backbufferHeight)
@@ -137,21 +141,6 @@ EGLint SwapChain9::reset(int backbufferWidth, int backbufferHeight, EGLint swapI
pShareHandle = &mShareHandle;
}
- // CreateTexture will fail on zero dimensions, so just release old target
- if (!backbufferWidth || !backbufferHeight)
- {
- if (mRenderTarget)
- {
- mRenderTarget->Release();
- mRenderTarget = NULL;
- }
-
- mWidth = backbufferWidth;
- mHeight = backbufferHeight;
-
- return EGL_SUCCESS;
- }
-
result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
gl_d3d9::ConvertRenderbufferFormat(mBackBufferFormat), D3DPOOL_DEFAULT,
&mOffscreenTexture, pShareHandle);
@@ -323,6 +312,11 @@ EGLint SwapChain9::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
device->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
+ for (UINT streamIndex = 0; streamIndex < gl::MAX_VERTEX_ATTRIBS; streamIndex++)
+ {
+ device->SetStreamSourceFreq(streamIndex, 1);
+ }
+
D3DVIEWPORT9 viewport = {0, 0, mWidth, mHeight, 0.0f, 1.0f};
device->SetViewport(&viewport);
@@ -357,17 +351,19 @@ EGLint SwapChain9::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
mRenderer->markAllStateDirty();
- if (d3d9::isDeviceLostError(result))
- {
- return EGL_CONTEXT_LOST;
- }
-
if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR)
{
return EGL_BAD_ALLOC;
}
- ASSERT(SUCCEEDED(result));
+ // http://crbug.com/313210
+ // If our swap failed, trigger a device lost event. Resetting will work around an AMD-specific
+ // device removed bug with lost contexts when reinstalling drivers.
+ if (FAILED(result))
+ {
+ mRenderer->notifyDeviceLost();
+ return EGL_CONTEXT_LOST;
+ }
return EGL_SUCCESS;
}
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/SwapChain9.h
index 16a62bd86f..16a62bd86f 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/SwapChain9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp
index 8aa74a7cba..2486a9a5bf 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp
@@ -10,11 +10,11 @@
// D3D9 texture.
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/Renderer9.h"
-#include "libGLESv2/renderer/TextureStorage9.h"
-#include "libGLESv2/renderer/SwapChain9.h"
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
+#include "libGLESv2/renderer/d3d9/SwapChain9.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
#include "libGLESv2/Texture.h"
namespace rx
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.h
index 86f551a131..86f551a131 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp
index b017b3af33..57f5bcd256 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp
@@ -7,11 +7,11 @@
// VertexBuffer9.cpp: Defines the D3D9 VertexBuffer implementation.
-#include "libGLESv2/renderer/VertexBuffer9.h"
-#include "libGLESv2/renderer/vertexconversion.h"
+#include "libGLESv2/renderer/d3d9/VertexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/vertexconversion.h"
#include "libGLESv2/renderer/BufferStorage.h"
#include "libGLESv2/Context.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
#include "libGLESv2/Buffer.h"
@@ -182,7 +182,7 @@ bool VertexBuffer9::getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei
bool VertexBuffer9::requiresConversion(const gl::VertexAttribute &attrib) const
{
- return formatConverter(attrib).identity;
+ return !formatConverter(attrib).identity;
}
unsigned int VertexBuffer9::getVertexSize(const gl::VertexAttribute &attrib) const
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.h
index 2f88117bda..2f88117bda 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexBuffer9.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp
index 9b83a6476e..e5c8a14232 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp
@@ -9,8 +9,8 @@
#include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/Context.h"
-#include "libGLESv2/renderer/VertexBuffer9.h"
-#include "libGLESv2/renderer/VertexDeclarationCache.h"
+#include "libGLESv2/renderer/d3d9/VertexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/VertexDeclarationCache.h"
namespace rx
{
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.h
index 3fc024a9ba..3fc024a9ba 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/VertexDeclarationCache.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp
index da75d465e3..b7f2ffb1d9 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp
@@ -8,7 +8,7 @@
// renderer9_utils.cpp: Conversion functions and other utility routines
// specific to the D3D9 renderer.
-#include "libGLESv2/renderer/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
#include "libGLESv2/mathutil.h"
#include "libGLESv2/Context.h"
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.h
index bf6cdf1ea6..bf6cdf1ea6 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/renderer9_utils.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.h
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.ps b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.ps
index dcb3bd0e76..dcb3bd0e76 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.ps
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.ps
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.vs b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.vs
index 3a36980b93..3a36980b93 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Blit.vs
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.vs
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/vertexconversion.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/vertexconversion.h
index 590b9d48a3..590b9d48a3 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/vertexconversion.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/vertexconversion.h
diff --git a/src/3rdparty/angle/src/libGLESv2/utilities.cpp b/src/3rdparty/angle/src/libGLESv2/utilities.cpp
index 8fd193b164..30765ffba0 100644
--- a/src/3rdparty/angle/src/libGLESv2/utilities.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/utilities.cpp
@@ -9,13 +9,13 @@
#include "libGLESv2/utilities.h"
#include "libGLESv2/mathutil.h"
-
#if defined(ANGLE_OS_WINRT)
-#include <locale>
-#include <codecvt>
-#include <wrl.h>
-#include <windows.storage.h>
-using namespace ABI::Windows::Storage;
+# include <locale>
+# include <codecvt>
+# include <wrl.h>
+# include <windows.storage.h>
+ using namespace Microsoft::WRL;
+ using namespace ABI::Windows::Storage;
#endif
namespace gl
@@ -745,29 +745,43 @@ bool IsTriangleMode(GLenum drawMode)
std::string getTempPath()
{
-#if defined(ANGLE_OS_WINRT)
+#if !defined(ANGLE_OS_WINRT)
+ char path[MAX_PATH];
+ DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path);
+ if (pathLen == 0)
+ {
+ UNREACHABLE();
+ return std::string();
+ }
+ UINT unique = GetTempFileNameA(path, "sh", 0, path);
+ if (unique == 0)
+ {
+ UNREACHABLE();
+ return std::string();
+ }
+#else
static std::string path;
while (path.empty()) {
- IApplicationDataStatics *applicationDataFactory;
- HRESULT result = RoGetActivationFactory(Microsoft::WRL::Wrappers::HStringReference(RuntimeClass_Windows_Storage_ApplicationData).Get(),
- IID_PPV_ARGS(&applicationDataFactory));
+ ComPtr<IApplicationDataStatics> factory;
+ Wrappers::HStringReference classId(RuntimeClass_Windows_Storage_ApplicationData);
+ HRESULT result = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
if (FAILED(result))
break;
- IApplicationData *applicationData;
- result = applicationDataFactory->get_Current(&applicationData);
+ ComPtr<IApplicationData> applicationData;
+ result = factory->get_Current(&applicationData);
if (FAILED(result))
break;
- IStorageFolder *storageFolder;
+ ComPtr<IStorageFolder> storageFolder;
result = applicationData->get_LocalFolder(&storageFolder);
if (FAILED(result))
break;
- IStorageItem *localFolder;
- result = storageFolder->QueryInterface(IID_PPV_ARGS(&localFolder));
+ ComPtr<IStorageItem> localFolder;
+ result = storageFolder.As(&localFolder);
if (FAILED(result))
break;
@@ -784,25 +798,6 @@ std::string getTempPath()
break;
}
}
-
-#else
-
- char path[MAX_PATH];
-
- DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path);
- if (pathLen == 0)
- {
- UNREACHABLE();
- return std::string();
- }
-
- UINT unique = GetTempFileNameA(path, "sh", 0, path);
- if (unique == 0)
- {
- UNREACHABLE();
- return std::string();
- }
-
#endif
return path;
diff --git a/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h b/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h
index 0d4e1a374c..f725f55b57 100644
--- a/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h
+++ b/src/3rdparty/angle/src/third_party/compiler/ArrayBoundsClamper.h
@@ -28,8 +28,8 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/InfoSink.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/intermediate.h"
class ArrayBoundsClamper {
public:
diff --git a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
index 72d354dd64..96ac910b08 100644
--- a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
+++ b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
@@ -574,8 +574,6 @@
namespace gl {
-extern long **traceSamplingState;
-
namespace TraceEvent {
// Specify these values when the corresponding argument of addTraceEvent is not
@@ -793,6 +791,7 @@ private:
// TraceEventSamplingStateScope records the current sampling state
// and sets a new sampling state. When the scope exists, it restores
// the sampling state having recorded.
+#if 0 // This is not used by ANGLE and causes a compilation error on MinGW
template<size_t BucketNumber>
class SamplingStateScope {
public:
@@ -820,6 +819,7 @@ public:
private:
const char* m_previousState;
};
+#endif
} // namespace TraceEvent
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
index 4b80d68761..aa18dfc2d1 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -48,6 +48,7 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
+import android.graphics.drawable.ColorDrawable;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
@@ -56,6 +57,7 @@ import android.os.ResultReceiver;
import android.text.method.MetaKeyKeyListener;
import android.util.DisplayMetrics;
import android.util.Log;
+import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.KeyCharacterMap;
@@ -653,9 +655,6 @@ public class QtActivityDelegate
m_imm = (InputMethodManager)m_activity.getSystemService(Context.INPUT_METHOD_SERVICE);
m_surfaces = new HashMap<Integer, QtSurface>();
m_nativeViews = new HashMap<Integer, View>();
- m_activity.setContentView(m_layout,
- new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT));
m_activity.registerForContextMenu(m_layout);
int orientation = m_activity.getResources().getConfiguration().orientation;
@@ -988,11 +987,25 @@ public class QtActivityDelegate
m_nativeViews.put(id, view);
}
- public void createSurface(int id, boolean onTop, int x, int y, int w, int h) {
+ public void createSurface(int id, boolean onTop, int x, int y, int w, int h, int imageDepth) {
+ if (m_surfaces.size() == 0) {
+ TypedValue attr = new TypedValue();
+ m_activity.getTheme().resolveAttribute(android.R.attr.windowBackground, attr, true);
+ if (attr.type >= TypedValue.TYPE_FIRST_COLOR_INT && attr.type <= TypedValue.TYPE_LAST_COLOR_INT) {
+ m_activity.getWindow().setBackgroundDrawable(new ColorDrawable(attr.data));
+ } else {
+ m_activity.getWindow().setBackgroundDrawable(m_activity.getResources().getDrawable(attr.resourceId));
+ }
+
+ m_activity.setContentView(m_layout,
+ new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT));
+ }
+
if (m_surfaces.containsKey(id))
m_layout.removeView(m_surfaces.remove(id));
- QtSurface surface = new QtSurface(m_activity, id, onTop);
+ QtSurface surface = new QtSurface(m_activity, id, onTop, imageDepth);
if (w < 0 || h < 0) {
surface.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
index 9b716f74e5..02bb1ae485 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
@@ -511,12 +511,12 @@ public class QtNative
return certificateArray;
}
- private static void createSurface(final int id, final boolean onTop, final int x, final int y, final int w, final int h)
+ private static void createSurface(final int id, final boolean onTop, final int x, final int y, final int w, final int h, final int imageDepth)
{
runAction(new Runnable() {
@Override
public void run() {
- m_activityDelegate.createSurface(id, onTop, x, y, w, h);
+ m_activityDelegate.createSurface(id, onTop, x, y, w, h, imageDepth);
}
});
}
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
index 1454c30638..45a80a3dbb 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
@@ -59,14 +59,18 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback
private GestureDetector m_gestureDetector;
private Object m_accessibilityDelegate = null;
- public QtSurface(Context context, int id, boolean onTop)
+ public QtSurface(Context context, int id, boolean onTop, int imageDepth)
{
super(context);
setFocusable(false);
setFocusableInTouchMode(false);
setZOrderMediaOverlay(onTop);
getHolder().addCallback(this);
- getHolder().setFormat(PixelFormat.RGBA_8888);
+ if (imageDepth == 16)
+ getHolder().setFormat(PixelFormat.RGB_565);
+ else
+ getHolder().setFormat(PixelFormat.RGBA_8888);
+
if (android.os.Build.VERSION.SDK_INT < 11)
getHolder().setType(SurfaceHolder.SURFACE_TYPE_GPU);
diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml
index defbe502ef..3209ab58ac 100644
--- a/src/android/java/AndroidManifest.xml
+++ b/src/android/java/AndroidManifest.xml
@@ -29,15 +29,23 @@
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<!-- Messages maps -->
+
<!-- Splash screen -->
- <meta-data android:name="android.app.splash_screen" android:resource="@layout/splash"/>
+ <!--
+ <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/>
+ -->
<!-- Splash screen -->
</activity>
</application>
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
+
+ <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
+ Remove the comment if you do not require these default permissions. -->
<!-- %%INSERT_PERMISSIONS -->
- <uses-permission android:name="android.permission.INTERNET"/>
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+
+ <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
+ Remove the comment if you do not require these default features. -->
<!-- %%INSERT_FEATURES -->
+
</manifest>
diff --git a/src/android/java/res/layout/splash.xml b/src/android/java/res/layout/splash.xml
deleted file mode 100644
index 6b0d492dd5..0000000000
--- a/src/android/java/res/layout/splash.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_gravity="center"
- >
- <ImageView
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:scaleType="fitXY"
- />
-</LinearLayout>
diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
index b2f92c04e9..3a0eaa77d6 100644
--- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
+++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
@@ -858,8 +858,8 @@ public class QtActivity extends Activity
if (null == getLastNonConfigurationInstance()) {
// if splash screen is defined, then show it
- if (m_activityInfo.metaData.containsKey("android.app.splash_screen") )
- setContentView(m_activityInfo.metaData.getInt("android.app.splash_screen"));
+ if (m_activityInfo.metaData.containsKey("android.app.splash_screen_drawable"))
+ getWindow().setBackgroundDrawableResource(m_activityInfo.metaData.getInt("android.app.splash_screen_drawable"));
startApp(true);
}
}
diff --git a/src/android/java/version.xml b/src/android/java/version.xml
index bdcf915c06..e05bba7588 100644
--- a/src/android/java/version.xml
+++ b/src/android/java/version.xml
@@ -1,4 +1,4 @@
-<version value="5.2">
+<version value="5.3">
<ignore>
<file>AndroidManifest.xml</file>
<file>libs.xml</file>
diff --git a/src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch b/src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch
deleted file mode 100644
index cf32a20d46..0000000000
--- a/src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 4863cf64cd332a5fcefe453634c3c5ef62cb758c Mon Sep 17 00:00:00 2001
-From: Friedemann Kleint <Friedemann.Kleint@digia.com>
-Date: Thu, 24 Oct 2013 12:49:59 +0300
-Subject: [PATCH] ANGLE: Fix compilation with MSVC2013.
-
-Add missing include for std::min(), std::max().
-
-Change-Id: I740e5db94f9f958ac65de8dd7baab7e203482637
----
- src/3rdparty/angle/src/libEGL/Surface.cpp | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp
-index b47a7bc..83fbbf5 100644
---- a/src/3rdparty/angle/src/libEGL/Surface.cpp
-+++ b/src/3rdparty/angle/src/libEGL/Surface.cpp
-@@ -20,6 +20,8 @@
- #include "libEGL/main.h"
- #include "libEGL/Display.h"
-
-+#include <algorithm>
-+
- namespace egl
- {
-
---
-1.8.3.msysgit.0
-
diff --git a/src/angle/patches/0001-Fix-compilation-for-MSVC-2008-and-std-tuple.patch b/src/angle/patches/0001-Fix-compilation-for-MSVC-2008-and-std-tuple.patch
index 2fa23aed8f..06ab16abdb 100644
--- a/src/angle/patches/0001-Fix-compilation-for-MSVC-2008-and-std-tuple.patch
+++ b/src/angle/patches/0001-Fix-compilation-for-MSVC-2008-and-std-tuple.patch
@@ -1,32 +1,31 @@
-From d4776adddb971642164de54141e015abde881740 Mon Sep 17 00:00:00 2001
+From 88297d02fd1aed6cac258b72d9d0a8baabad6203 Mon Sep 17 00:00:00 2001
From: Thomas Hartmann <Thomas.Hartmann@digia.com>
-Date: Tue, 8 Oct 2013 09:46:54 +0200
+Date: Mon, 17 Feb 2014 16:56:51 +0200
Subject: [PATCH] Fix compilation for MSVC 2008 and std::tuple
For MSVC 2008 make_tuple is in the tr1 namespace.
Change-Id: I4a51f6cabdf068993869b404b12ed1484a21a9d4
---
- .../src/libGLESv2/renderer/IndexRangeCache.cpp | 6 +++++-
- 1 files changed, 5 insertions(+), 1 deletions(-)
+ src/3rdparty/angle/src/libGLESv2/renderer/IndexRangeCache.cpp | 4 ++++
+ 1 file changed, 4 insertions(+)
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/IndexRangeCache.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/IndexRangeCache.cpp
-index 610a5ef..95a6961 100644
+index 610a5ef..51d7f0b 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/IndexRangeCache.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/IndexRangeCache.cpp
@@ -81,7 +81,11 @@ IndexRangeCache::IndexRange::IndexRange(GLenum typ, intptr_t off, GLsizei c)
bool IndexRangeCache::IndexRange::operator<(const IndexRange& rhs) const
{
-- return std::make_tuple(type, offset, count) < std::make_tuple(rhs.type, rhs.offset, rhs.count);
+#if defined(_MSC_VER) && _MSC_VER < 1600
+ return std::tr1::make_tuple(type, offset, count) < std::tr1::make_tuple(rhs.type, rhs.offset, rhs.count);
+#else
-+ return std::make_tuple(type, offset, count) < std::make_tuple(rhs.type, rhs.offset, rhs.count);
+ return std::make_tuple(type, offset, count) < std::make_tuple(rhs.type, rhs.offset, rhs.count);
+#endif
}
IndexRangeCache::IndexBounds::IndexBounds()
--
-1.7.6.msysgit.0
+1.8.4.msysgit.0
diff --git a/src/angle/patches/0001-Make-it-possible-to-link-ANGLE-statically-for-single.patch b/src/angle/patches/0001-Make-it-possible-to-link-ANGLE-statically-for-single.patch
deleted file mode 100644
index 9de8c54fb6..0000000000
--- a/src/angle/patches/0001-Make-it-possible-to-link-ANGLE-statically-for-single.patch
+++ /dev/null
@@ -1,200 +0,0 @@
-From f1eeb288ae18f3015f435fc2df25ec1eb0f15e1a Mon Sep 17 00:00:00 2001
-From: Friedemann Kleint <Friedemann.Kleint@digia.com>
-Date: Sat, 14 Sep 2013 11:07:17 +0300
-Subject: [PATCH] Make it possible to link ANGLE statically for
- single-thread use.
-
-Fix exports and provide static instances of thread-local
-data depending on QT_OPENGL_ES_2_ANGLE_STATIC.
-
-Change-Id: Ifab25a820adf5953bb3b09036de53dbf7f1a7fd5
----
- src/3rdparty/angle/include/KHR/khrplatform.h | 2 +-
- src/3rdparty/angle/src/libEGL/main.cpp | 35 ++++++++++++++++++++--------
- src/3rdparty/angle/src/libGLESv2/main.cpp | 21 ++++++++++++++---
- 3 files changed, 44 insertions(+), 14 deletions(-)
-
-diff --git a/src/3rdparty/angle/include/KHR/khrplatform.h b/src/3rdparty/angle/include/KHR/khrplatform.h
-index 8ec0d19..541bfa9 100644
---- a/src/3rdparty/angle/include/KHR/khrplatform.h
-+++ b/src/3rdparty/angle/include/KHR/khrplatform.h
-@@ -97,7 +97,7 @@
- *-------------------------------------------------------------------------
- * This precedes the return type of the function in the function prototype.
- */
--#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
-+#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(QT_OPENGL_ES_2_ANGLE_STATIC)
- # define KHRONOS_APICALL __declspec(dllimport)
- #elif defined (__SYMBIAN32__)
- # define KHRONOS_APICALL IMPORT_C
-diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp
-index 424ec3f..7dea5fc 100644
---- a/src/3rdparty/angle/src/libEGL/main.cpp
-+++ b/src/3rdparty/angle/src/libEGL/main.cpp
-@@ -10,6 +10,8 @@
-
- #include "common/debug.h"
-
-+#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
-+
- static DWORD currentTLS = TLS_OUT_OF_INDEXES;
-
- extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
-@@ -86,74 +88,87 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
- return TRUE;
- }
-
-+#endif // !QT_OPENGL_ES_2_ANGLE_STATIC
-+
- namespace egl
- {
-+Current *getCurrent()
-+{
-+#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
-+ return (Current*)TlsGetValue(currentTLS);
-+#else
-+ // No precautions for thread safety taken as ANGLE is used single-threaded in Qt.
-+ static Current curr = { EGL_SUCCESS, EGL_OPENGL_ES_API, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE };
-+ return &curr;
-+#endif
-+}
-+
- void setCurrentError(EGLint error)
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- current->error = error;
- }
-
- EGLint getCurrentError()
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- return current->error;
- }
-
- void setCurrentAPI(EGLenum API)
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- current->API = API;
- }
-
- EGLenum getCurrentAPI()
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- return current->API;
- }
-
- void setCurrentDisplay(EGLDisplay dpy)
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- current->display = dpy;
- }
-
- EGLDisplay getCurrentDisplay()
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- return current->display;
- }
-
- void setCurrentDrawSurface(EGLSurface surface)
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- current->drawSurface = surface;
- }
-
- EGLSurface getCurrentDrawSurface()
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- return current->drawSurface;
- }
-
- void setCurrentReadSurface(EGLSurface surface)
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- current->readSurface = surface;
- }
-
- EGLSurface getCurrentReadSurface()
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- return current->readSurface;
- }
-diff --git a/src/3rdparty/angle/src/libGLESv2/main.cpp b/src/3rdparty/angle/src/libGLESv2/main.cpp
-index 6d7a241..730a6ac 100644
---- a/src/3rdparty/angle/src/libGLESv2/main.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/main.cpp
-@@ -11,6 +11,8 @@
-
- #include "libGLESv2/Context.h"
-
-+#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
-+
- static DWORD currentTLS = TLS_OUT_OF_INDEXES;
-
- extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
-@@ -69,11 +71,24 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
- return TRUE;
- }
-
-+#endif // !QT_OPENGL_ES_2_ANGLE_STATIC
-+
- namespace gl
- {
-+Current *getCurrent()
-+{
-+#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
-+ return (Current*)TlsGetValue(currentTLS);
-+#else
-+ // No precautions for thread safety taken as ANGLE is used single-threaded in Qt.
-+ static gl::Current curr = { 0, 0 };
-+ return &curr;
-+#endif
-+}
-+
- void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- current->context = context;
- current->display = display;
-@@ -86,7 +101,7 @@ void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
-
- Context *getContext()
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- return current->context;
- }
-@@ -112,7 +127,7 @@ Context *getNonLostContext()
-
- egl::Display *getDisplay()
- {
-- Current *current = (Current*)TlsGetValue(currentTLS);
-+ Current *current = getCurrent();
-
- return current->display;
- }
---
-1.8.1.msysgit.1
-
diff --git a/src/angle/patches/0001-Fix-compilation-of-ANGLE-with-mingw-tdm64-gcc-4.8.1.patch b/src/angle/patches/0002-Fix-compilation-of-ANGLE-with-mingw-tdm64-gcc-4.8.1.patch
index 498cce1b7c..8b91d4b8ea 100644
--- a/src/angle/patches/0001-Fix-compilation-of-ANGLE-with-mingw-tdm64-gcc-4.8.1.patch
+++ b/src/angle/patches/0002-Fix-compilation-of-ANGLE-with-mingw-tdm64-gcc-4.8.1.patch
@@ -1,6 +1,6 @@
-From 58a797397378aff3aa039a8b2a2d7011fe788737 Mon Sep 17 00:00:00 2001
+From 95e3ca47772ef0552662b1d04b7ee08d9d1d2338 Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@digia.com>
-Date: Tue, 21 Jan 2014 10:23:38 +0100
+Date: Mon, 17 Feb 2014 16:59:19 +0200
Subject: [PATCH] Fix compilation of ANGLE with mingw-tdm64 gcc 4.8.1
Do not rely on sprintf_s being declared/defined. This also fixes
@@ -16,7 +16,7 @@ Change-Id: I520e2f61aeab34963e7a57baafd413c7db93f110
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/3rdparty/angle/src/libEGL/Display.cpp b/src/3rdparty/angle/src/libEGL/Display.cpp
-index a382c3b..82b48ce 100644
+index a382c3b..13ef701 100644
--- a/src/3rdparty/angle/src/libEGL/Display.cpp
+++ b/src/3rdparty/angle/src/libEGL/Display.cpp
@@ -523,7 +523,7 @@ void Display::initVendorString()
@@ -24,10 +24,10 @@ index a382c3b..82b48ce 100644
{
char adapterLuidString[64];
- sprintf_s(adapterLuidString, sizeof(adapterLuidString), " (adapter LUID: %08x%08x)", adapterLuid.HighPart, adapterLuid.LowPart);
-+ snprintf(adapterLuidString, sizeof(adapterLuidString), " (adapter LUID: %08l%08l)", adapterLuid.HighPart, adapterLuid.LowPart);
++ snprintf(adapterLuidString, sizeof(adapterLuidString), " (adapter LUID: %08x%08x)", adapterLuid.HighPart, adapterLuid.LowPart);
mVendorString += adapterLuidString;
}
--
-1.8.5.2.msysgit.0
+1.8.4.msysgit.0
diff --git a/src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch b/src/angle/patches/0003-Fix-compilation-with-MinGW-gcc-64-bit.patch
index 0420694c91..7d70057a9a 100644
--- a/src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch
+++ b/src/angle/patches/0003-Fix-compilation-with-MinGW-gcc-64-bit.patch
@@ -1,6 +1,6 @@
-From 821c28d387b332bf16b6ea35ec22a77d3ba41632 Mon Sep 17 00:00:00 2001
+From a03d8f647816767525489a2b26663d897f0264a0 Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@digia.com>
-Date: Mon, 28 Oct 2013 10:27:53 +0100
+Date: Tue, 18 Feb 2014 09:34:39 +0200
Subject: [PATCH] Fix compilation with MinGW gcc 64 bit
Fix compilation of ANGLE with gcc 4.8.0 64 bit: The
@@ -18,10 +18,10 @@ Change-Id: Ibde75dd4b5536f3827bdf0ab02a15e93a1a8a4f0
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
-index 113b126..72d354d 100644
+index 1880056..637cf9a 100644
--- a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
+++ b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
-@@ -589,7 +589,7 @@ const unsigned long long noEventId = 0;
+@@ -587,7 +587,7 @@ const unsigned long long noEventId = 0;
class TraceID {
public:
explicit TraceID(const void* id, unsigned char* flags) :
@@ -31,5 +31,5 @@ index 113b126..72d354d 100644
*flags |= TRACE_EVENT_FLAG_MANGLE_ID;
}
--
-1.8.3.msysgit.0
+1.8.4.msysgit.0
diff --git a/src/angle/patches/0004-Fix-black-screen-after-minimizing-OpenGL-window-with.patch b/src/angle/patches/0004-Fix-black-screen-after-minimizing-OpenGL-window-with.patch
deleted file mode 100644
index 6eb84fd02e..0000000000
--- a/src/angle/patches/0004-Fix-black-screen-after-minimizing-OpenGL-window-with.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 991dfbdfc018cb30bc1ac4df429411680b47d674 Mon Sep 17 00:00:00 2001
-From: Miikka Heikkinen <miikka.heikkinen@digia.com>
-Date: Sat, 14 Sep 2013 11:07:45 +0300
-Subject: [PATCH] Fix black screen after minimizing OpenGL window with
- ANGLE
-
-CreateTexture will fail on zero dimensions, so just release old target
-and reset dimensions when resetSwapChain is called with zero size area.
-
-Task-number: QTBUG-27994
-Change-Id: I1e500c4fd4b92f7d9ea2a49a44f3fb930b575cd1
-Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
----
- src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.cpp | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
-
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.cpp
-index 0324d01..f57a874 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain9.cpp
-@@ -137,6 +137,21 @@ EGLint SwapChain9::reset(int backbufferWidth, int backbufferHeight, EGLint swapI
- pShareHandle = &mShareHandle;
- }
-
-+ // CreateTexture will fail on zero dimensions, so just release old target
-+ if (!backbufferWidth || !backbufferHeight)
-+ {
-+ if (mRenderTarget)
-+ {
-+ mRenderTarget->Release();
-+ mRenderTarget = NULL;
-+ }
-+
-+ mWidth = backbufferWidth;
-+ mHeight = backbufferHeight;
-+
-+ return EGL_SUCCESS;
-+ }
-+
- result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
- gl_d3d9::ConvertRenderbufferFormat(mBackBufferFormat), D3DPOOL_DEFAULT,
- &mOffscreenTexture, pShareHandle);
---
-1.8.1.msysgit.1
-
diff --git a/src/angle/patches/0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch b/src/angle/patches/0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch
new file mode 100644
index 0000000000..2c95c5bcfa
--- /dev/null
+++ b/src/angle/patches/0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch
@@ -0,0 +1,68 @@
+From 9b24b25eeb5ca97d7978c6840fdb1e903bf63a55 Mon Sep 17 00:00:00 2001
+From: Friedemann Kleint <Friedemann.Kleint@digia.com>
+Date: Tue, 18 Feb 2014 09:52:52 +0200
+Subject: [PATCH] Make it possible to link ANGLE statically for
+ single-thread use.
+
+Fix exports and provide static instances of thread-local
+data depending on QT_OPENGL_ES_2_ANGLE_STATIC.
+
+Change-Id: Ifab25a820adf5953bb3b09036de53dbf7f1a7fd5
+---
+ src/3rdparty/angle/include/KHR/khrplatform.h | 2 +-
+ src/3rdparty/angle/src/libEGL/main.cpp | 6 ++++++
+ src/3rdparty/angle/src/libGLESv2/main.cpp | 6 ++++++
+ 3 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/angle/include/KHR/khrplatform.h b/src/3rdparty/angle/include/KHR/khrplatform.h
+index c9e6f17..1ac2d3f 100644
+--- a/src/3rdparty/angle/include/KHR/khrplatform.h
++++ b/src/3rdparty/angle/include/KHR/khrplatform.h
+@@ -97,7 +97,7 @@
+ *-------------------------------------------------------------------------
+ * This precedes the return type of the function in the function prototype.
+ */
+-#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
++#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(QT_OPENGL_ES_2_ANGLE_STATIC)
+ # define KHRONOS_APICALL __declspec(dllimport)
+ #elif defined (__SYMBIAN32__)
+ # define KHRONOS_APICALL IMPORT_C
+diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp
+index 80dcc34..772b8eb 100644
+--- a/src/3rdparty/angle/src/libEGL/main.cpp
++++ b/src/3rdparty/angle/src/libEGL/main.cpp
+@@ -106,7 +106,13 @@ namespace egl
+
+ Current *GetCurrentData()
+ {
++#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
+ Current *current = (Current*)TlsGetValue(currentTLS);
++#else
++ // No precautions for thread safety taken as ANGLE is used single-threaded in Qt.
++ static Current s_current = { EGL_SUCCESS, EGL_OPENGL_ES_API, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE };
++ Current *current = &s_current;
++#endif
+
+ // ANGLE issue 488: when the dll is loaded after thread initialization,
+ // thread local storage (current) might not exist yet.
+diff --git a/src/3rdparty/angle/src/libGLESv2/main.cpp b/src/3rdparty/angle/src/libGLESv2/main.cpp
+index 50e2593..6b459d3 100644
+--- a/src/3rdparty/angle/src/libGLESv2/main.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/main.cpp
+@@ -89,7 +89,13 @@ namespace gl
+
+ Current *GetCurrentData()
+ {
++#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
+ Current *current = (Current*)TlsGetValue(currentTLS);
++#else
++ // No precautions for thread safety taken as ANGLE is used single-threaded in Qt.
++ static Current s_current = { 0, 0 };
++ Current *current = &s_current;
++#endif
+
+ // ANGLE issue 488: when the dll is loaded after thread initialization,
+ // thread local storage (current) might not exist yet.
+--
+1.8.4.msysgit.0
+
diff --git a/src/angle/patches/0005-Fix-build-when-SSE2-is-not-available.patch b/src/angle/patches/0005-Fix-build-when-SSE2-is-not-available.patch
index 840f6dc36e..475ec55b0e 100644
--- a/src/angle/patches/0005-Fix-build-when-SSE2-is-not-available.patch
+++ b/src/angle/patches/0005-Fix-build-when-SSE2-is-not-available.patch
@@ -1,6 +1,6 @@
-From af7cb8e35774f5cba15256cb463da8c1c4d533f3 Mon Sep 17 00:00:00 2001
+From cebc37237a74a130dffaefad0a10da17abc42981 Mon Sep 17 00:00:00 2001
From: Andy Shaw <andy.shaw@digia.com>
-Date: Sat, 14 Sep 2013 11:25:53 +0300
+Date: Tue, 18 Feb 2014 09:59:17 +0200
Subject: [PATCH] Fix build when SSE2 is not available.
Although SSE2 support is detected at runtime it still may not be
@@ -9,15 +9,15 @@ when it is available at build time too.
Change-Id: I86c45a6466ab4cec79aa0f62b0d5230a78ad825a
---
- src/3rdparty/angle/src/libGLESv2/mathutil.h | 2 ++
- src/3rdparty/angle/src/libGLESv2/renderer/Image9.cpp | 4 ++++
- 2 files changed, 6 insertions(+)
+ src/3rdparty/angle/src/libGLESv2/mathutil.h | 2 ++
+ src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.cpp | 6 +++++-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/3rdparty/angle/src/libGLESv2/mathutil.h b/src/3rdparty/angle/src/libGLESv2/mathutil.h
-index bb48b94..0835486 100644
+index f902131..6474b66 100644
--- a/src/3rdparty/angle/src/libGLESv2/mathutil.h
+++ b/src/3rdparty/angle/src/libGLESv2/mathutil.h
-@@ -93,6 +93,7 @@ inline bool supportsSSE2()
+@@ -92,6 +92,7 @@ inline bool supportsSSE2()
return supports;
}
@@ -25,7 +25,7 @@ index bb48b94..0835486 100644
int info[4];
__cpuid(info, 0);
-@@ -102,6 +103,7 @@ inline bool supportsSSE2()
+@@ -101,6 +102,7 @@ inline bool supportsSSE2()
supports = (info[3] >> 26) & 1;
}
@@ -33,10 +33,10 @@ index bb48b94..0835486 100644
checked = true;
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Image9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Image9.cpp
-index b3dcc59..53030b7 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/Image9.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Image9.cpp
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.cpp
+index 8511946..cd12d8c 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Image9.cpp
@@ -373,11 +373,13 @@ void Image9::loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heigh
switch (mInternalFormat)
{
@@ -65,6 +65,13 @@ index b3dcc59..53030b7 100644
{
loadRGBAUByteDataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
}
+@@ -729,4 +733,4 @@ void Image9::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
+ mDirty = true;
+ }
+
+-}
+\ No newline at end of file
++}
--
-1.8.1.msysgit.1
+1.8.4.msysgit.0
diff --git a/src/angle/patches/0011-Fix-compilation-of-libGLESv2-with-older-MinGW-w64-he.patch b/src/angle/patches/0006-Fix-compilation-of-libGLESv2-with-older-MinGW-w64-he.patch
index 9189501b59..cf31245b95 100644
--- a/src/angle/patches/0011-Fix-compilation-of-libGLESv2-with-older-MinGW-w64-he.patch
+++ b/src/angle/patches/0006-Fix-compilation-of-libGLESv2-with-older-MinGW-w64-he.patch
@@ -1,7 +1,8 @@
-From 6d8be1da6a5a5177289200247f98e0200e0e3df3 Mon Sep 17 00:00:00 2001
+From 68ba96d224a84389567f506661a78c32b307e84d Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@digia.com>
-Date: Sat, 14 Sep 2013 11:38:47 +0300
-Subject: [PATCH] Fix compilation of libGLESv2 with older MinGW-w64 headers
+Date: Tue, 18 Feb 2014 10:29:14 +0200
+Subject: [PATCH] Fix compilation of libGLESv2 with older MinGW-w64
+ headers
Fix compilation of libGLESv2 for mingw-headers predating MinGW-w64
svn commit 5567 (like MinGW-builds gcc 4.7.2-rev8, the toolchain
@@ -18,18 +19,18 @@ Change-Id: I31272a1a991c4fc0f1611f8fb7510be51d6bb925
1 file changed, 19 insertions(+)
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
-index 70b9326..d1d234b 100644
+index 3407353..e74120d 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
-@@ -21,6 +21,25 @@
- #define ANGLE_ENABLE_D3D11 0
+@@ -24,6 +24,25 @@
+ #define D3DERR_OUTOFVIDEOMEMORY MAKE_HRESULT(1, 0x876, 380)
#endif
+#ifdef __MINGW32__
+
+#ifndef D3DCOMPILER_DLL
+
-+//Add define + typedefs for older MinGW-w64 headers (pre 5783)
++// Add define + typedefs for older MinGW-w64 headers (pre 5783)
+
+#define D3DCOMPILER_DLL L"d3dcompiler_43.dll"
+
@@ -48,5 +49,5 @@ index 70b9326..d1d234b 100644
{
--
-1.8.1.msysgit.1
+1.8.4.msysgit.0
diff --git a/src/angle/patches/0006-Make-DX9-DX11-mutually-exclusive.patch b/src/angle/patches/0006-Make-DX9-DX11-mutually-exclusive.patch
deleted file mode 100644
index 1e618d43c7..0000000000
--- a/src/angle/patches/0006-Make-DX9-DX11-mutually-exclusive.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From c2eb5746cdf65091932558ac48ae1e6175d45a3c Mon Sep 17 00:00:00 2001
-From: Andrew Knight <andrew.knight@digia.com>
-Date: Sat, 14 Sep 2013 12:01:19 +0300
-Subject: [PATCH] Make DX9/DX11 mutually exclusive
-
-ANGLE supports selecting the renderer on creation, choosing between
-D3D11 and D3D9 backends. This patch removes that feature, and makes the
-D3D version a compile-time decision. This makes the binary size smaller
-(no extra render is built) and ensures compatibility with Windows Runtime,
-which supports only Direct3D 11.
-
-Change-Id: Id9473e0e631721083fe4026d475e37603a144c37
----
- src/3rdparty/angle/src/common/RefCountObject.cpp | 1 -
- src/3rdparty/angle/src/common/debug.cpp | 4 +++
- src/3rdparty/angle/src/libGLESv2/Texture.cpp | 6 +++-
- src/3rdparty/angle/src/libGLESv2/precompiled.h | 3 ++
- .../angle/src/libGLESv2/renderer/Renderer.cpp | 37 +++++++---------------
- 5 files changed, 24 insertions(+), 27 deletions(-)
-
-diff --git a/src/3rdparty/angle/src/common/RefCountObject.cpp b/src/3rdparty/angle/src/common/RefCountObject.cpp
-index 0364adf..c1ef90c 100644
---- a/src/3rdparty/angle/src/common/RefCountObject.cpp
-+++ b/src/3rdparty/angle/src/common/RefCountObject.cpp
-@@ -1,4 +1,3 @@
--#include "precompiled.h"
- //
- // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
- // Use of this source code is governed by a BSD-style license that can be
-diff --git a/src/3rdparty/angle/src/common/debug.cpp b/src/3rdparty/angle/src/common/debug.cpp
-index 2333740..9b93256 100644
---- a/src/3rdparty/angle/src/common/debug.cpp
-+++ b/src/3rdparty/angle/src/common/debug.cpp
-@@ -8,7 +8,11 @@
-
- #include "common/debug.h"
- #include "common/system.h"
-+#ifndef ANGLE_ENABLE_D3D11
- #include <d3d9.h>
-+#else
-+typedef DWORD D3DCOLOR;
-+#endif
-
- namespace gl
- {
-diff --git a/src/3rdparty/angle/src/libGLESv2/Texture.cpp b/src/3rdparty/angle/src/libGLESv2/Texture.cpp
-index ae83037..72c0a8a 100644
---- a/src/3rdparty/angle/src/libGLESv2/Texture.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/Texture.cpp
-@@ -14,7 +14,11 @@
- #include "libGLESv2/main.h"
- #include "libGLESv2/mathutil.h"
- #include "libGLESv2/utilities.h"
--#include "libGLESv2/renderer/Blit.h"
-+#ifndef ANGLE_ENABLE_D3D11
-+# include "libGLESv2/renderer/Blit.h"
-+#else
-+# define D3DFMT_UNKNOWN DXGI_FORMAT_UNKNOWN
-+#endif
- #include "libGLESv2/Renderbuffer.h"
- #include "libGLESv2/renderer/Image.h"
- #include "libGLESv2/renderer/Renderer.h"
-diff --git a/src/3rdparty/angle/src/libGLESv2/precompiled.h b/src/3rdparty/angle/src/libGLESv2/precompiled.h
-index a850d57..50dec6b 100644
---- a/src/3rdparty/angle/src/libGLESv2/precompiled.h
-+++ b/src/3rdparty/angle/src/libGLESv2/precompiled.h
-@@ -32,9 +32,12 @@
- #include <unordered_map>
- #include <vector>
-
-+#ifndef ANGLE_ENABLE_D3D11
- #include <d3d9.h>
-+#else
- #include <D3D11.h>
- #include <dxgi.h>
-+#endif
- #include <D3Dcompiler.h>
-
- #ifdef _MSC_VER
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
-index d1d234b..21ad223 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
-@@ -11,8 +11,11 @@
- #include "libGLESv2/main.h"
- #include "libGLESv2/Program.h"
- #include "libGLESv2/renderer/Renderer.h"
-+#ifndef ANGLE_ENABLE_D3D11
- #include "libGLESv2/renderer/Renderer9.h"
-+#else
- #include "libGLESv2/renderer/Renderer11.h"
-+#endif
- #include "libGLESv2/utilities.h"
- #include "third_party/trace_event/trace_event.h"
-
-@@ -21,6 +24,10 @@
- #define ANGLE_ENABLE_D3D11 0
- #endif
-
-+#ifndef D3DERR_OUTOFVIDEOMEMORY
-+#define D3DERR_OUTOFVIDEOMEMORY MAKE_HRESULT(1, 0x876, 380)
-+#endif
-+
- #ifdef __MINGW32__
-
- #ifndef D3DCOMPILER_DLL
-@@ -192,34 +199,14 @@ rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayT
- {
- rx::Renderer *renderer = NULL;
- EGLint status = EGL_BAD_ALLOC;
--
-- if (ANGLE_ENABLE_D3D11 ||
-- displayId == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
-- displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
-- {
-- renderer = new rx::Renderer11(display, hDc);
--
-- if (renderer)
-- {
-- status = renderer->initialize();
-- }
--
-- if (status == EGL_SUCCESS)
-- {
-- return renderer;
-- }
-- else if (displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
-- {
-- return NULL;
-- }
--
-- // Failed to create a D3D11 renderer, try creating a D3D9 renderer
-- delete renderer;
-- }
-
-+#if ANGLE_ENABLE_D3D11
-+ renderer = new rx::Renderer11(display, hDc);
-+#else
- bool softwareDevice = (displayId == EGL_SOFTWARE_DISPLAY_ANGLE);
- renderer = new rx::Renderer9(display, hDc, softwareDevice);
--
-+#endif
-+
- if (renderer)
- {
- status = renderer->initialize();
---
-1.8.1.msysgit.1
-
diff --git a/src/angle/patches/0007-ANGLE-Fix-typedefs-for-Win64.patch b/src/angle/patches/0007-ANGLE-Fix-typedefs-for-Win64.patch
deleted file mode 100644
index 5779d68e70..0000000000
--- a/src/angle/patches/0007-ANGLE-Fix-typedefs-for-Win64.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 2c7319083bc7bac6faafdf29b3a1d5440abf1313 Mon Sep 17 00:00:00 2001
-From: Jonathan Liu <net147@gmail.com>
-Date: Sat, 14 Sep 2013 11:32:01 +0300
-Subject: [PATCH] ANGLE: Fix typedefs for Win64
-
-The long int type is incorrect for Windows 64-bit as LLP64 is used
-there.
-
-Change-Id: Ibbe6f94bffd511ab1285020c89874021a762c2af
----
- src/3rdparty/angle/include/KHR/khrplatform.h | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/src/3rdparty/angle/include/KHR/khrplatform.h b/src/3rdparty/angle/include/KHR/khrplatform.h
-index 541bfa9..001e925 100644
---- a/src/3rdparty/angle/include/KHR/khrplatform.h
-+++ b/src/3rdparty/angle/include/KHR/khrplatform.h
-@@ -221,10 +221,17 @@ typedef signed char khronos_int8_t;
- typedef unsigned char khronos_uint8_t;
- typedef signed short int khronos_int16_t;
- typedef unsigned short int khronos_uint16_t;
-+#ifdef _WIN64
-+typedef signed long long int khronos_intptr_t;
-+typedef unsigned long long int khronos_uintptr_t;
-+typedef signed long long int khronos_ssize_t;
-+typedef unsigned long long int khronos_usize_t;
-+#else
- typedef signed long int khronos_intptr_t;
- typedef unsigned long int khronos_uintptr_t;
- typedef signed long int khronos_ssize_t;
- typedef unsigned long int khronos_usize_t;
-+#endif
-
- #if KHRONOS_SUPPORT_FLOAT
- /*
---
-1.8.1.msysgit.1
-
diff --git a/src/angle/patches/0007-Make-DX9-DX11-mutually-exclusive.patch b/src/angle/patches/0007-Make-DX9-DX11-mutually-exclusive.patch
new file mode 100644
index 0000000000..25a2f12847
--- /dev/null
+++ b/src/angle/patches/0007-Make-DX9-DX11-mutually-exclusive.patch
@@ -0,0 +1,141 @@
+From e1b26c6669cafb5c1298d6e5476c24686fccf1bd Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@digia.com>
+Date: Thu, 20 Feb 2014 16:46:15 +0200
+Subject: [PATCH] Make DX9/DX11 support configurable
+
+ANGLE supports selecting the renderer on creation, choosing between
+D3D11 and D3D9 backends. This patch improves upon this by enabling the
+D3D backend(s) at compile time. This can make the binary size smaller
+(no extra render is built) and ensures compatibility with Windows Runtime
+when building only the D3D11 renderer.
+
+Change-Id: Id9473e0e631721083fe4026d475e37603a144c37
+---
+ src/3rdparty/angle/src/libEGL/Display.cpp | 4 +++-
+ src/3rdparty/angle/src/libGLESv2/Texture.cpp | 6 +++++-
+ src/3rdparty/angle/src/libGLESv2/precompiled.h | 10 +++++++---
+ .../angle/src/libGLESv2/renderer/Renderer.cpp | 19 +++++++++++++------
+ 4 files changed, 28 insertions(+), 11 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/libEGL/Display.cpp b/src/3rdparty/angle/src/libEGL/Display.cpp
+index 13ef701..a7f5f5a 100644
+--- a/src/3rdparty/angle/src/libEGL/Display.cpp
++++ b/src/3rdparty/angle/src/libEGL/Display.cpp
+@@ -471,7 +471,6 @@ bool Display::hasExistingWindowSurface(HWND window)
+
+ void Display::initExtensionString()
+ {
+- HMODULE swiftShader = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
+ bool shareHandleSupported = mRenderer->getShareHandleSupport();
+
+ mExtensionString = "";
+@@ -487,10 +486,13 @@ void Display::initExtensionString()
+
+ mExtensionString += "EGL_ANGLE_query_surface_pointer ";
+
++#if defined(ANGLE_ENABLE_D3D9)
++ HMODULE swiftShader = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
+ if (swiftShader)
+ {
+ mExtensionString += "EGL_ANGLE_software_display ";
+ }
++#endif
+
+ if (shareHandleSupported)
+ {
+diff --git a/src/3rdparty/angle/src/libGLESv2/Texture.cpp b/src/3rdparty/angle/src/libGLESv2/Texture.cpp
+index 3deecaf..3257d05 100644
+--- a/src/3rdparty/angle/src/libGLESv2/Texture.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/Texture.cpp
+@@ -14,7 +14,11 @@
+ #include "libGLESv2/main.h"
+ #include "libGLESv2/mathutil.h"
+ #include "libGLESv2/utilities.h"
+-#include "libGLESv2/renderer/d3d9/Blit.h"
++#if defined(ANGLE_ENABLE_D3D9)
++# include "libGLESv2/renderer/d3d9/Blit.h"
++#else
++# define D3DFMT_UNKNOWN DXGI_FORMAT_UNKNOWN
++#endif
+ #include "libGLESv2/Renderbuffer.h"
+ #include "libGLESv2/renderer/Image.h"
+ #include "libGLESv2/renderer/Renderer.h"
+diff --git a/src/3rdparty/angle/src/libGLESv2/precompiled.h b/src/3rdparty/angle/src/libGLESv2/precompiled.h
+index 58ad181..79490b1 100644
+--- a/src/3rdparty/angle/src/libGLESv2/precompiled.h
++++ b/src/3rdparty/angle/src/libGLESv2/precompiled.h
+@@ -32,9 +32,13 @@
+ #include <unordered_map>
+ #include <vector>
+
+-#include <d3d9.h>
+-#include <d3d11.h>
+-#include <dxgi.h>
++#if defined(ANGLE_ENABLE_D3D9)
++# include <d3d9.h>
++#endif
++#if defined(ANGLE_ENABLE_D3D11)
++# include <d3d11.h>
++# include <dxgi.h>
++#endif
+ #include <d3dcompiler.h>
+
+ #ifdef _MSC_VER
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
+index 86be93f..3407353 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
+@@ -11,14 +11,17 @@
+ #include "libGLESv2/main.h"
+ #include "libGLESv2/Program.h"
+ #include "libGLESv2/renderer/Renderer.h"
+-#include "libGLESv2/renderer/d3d9/Renderer9.h"
+-#include "libGLESv2/renderer/d3d11/Renderer11.h"
++#if defined(ANGLE_ENABLE_D3D9)
++# include "libGLESv2/renderer/d3d9/Renderer9.h"
++#endif
++#if defined(ANGLE_ENABLE_D3D11)
++# include "libGLESv2/renderer/d3d11/Renderer11.h"
++#endif
+ #include "libGLESv2/utilities.h"
+ #include "third_party/trace_event/trace_event.h"
+
+-#if !defined(ANGLE_ENABLE_D3D11)
+-// Enables use of the Direct3D 11 API for a default display, when available
+-#define ANGLE_ENABLE_D3D11 0
++#ifndef D3DERR_OUTOFVIDEOMEMORY
++#define D3DERR_OUTOFVIDEOMEMORY MAKE_HRESULT(1, 0x876, 380)
+ #endif
+
+ namespace rx
+@@ -177,7 +180,8 @@ rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayT
+ rx::Renderer *renderer = NULL;
+ EGLint status = EGL_BAD_ALLOC;
+
+- if (ANGLE_ENABLE_D3D11 ||
++#if defined(ANGLE_ENABLE_D3D11)
++ if (displayId == EGL_DEFAULT_DISPLAY ||
+ displayId == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
+ displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
+ {
+@@ -200,7 +204,9 @@ rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayT
+ // Failed to create a D3D11 renderer, try creating a D3D9 renderer
+ delete renderer;
+ }
++#endif // ANGLE_ENABLE_D3D11
+
++#if defined(ANGLE_ENABLE_D3D9)
+ bool softwareDevice = (displayId == EGL_SOFTWARE_DISPLAY_ANGLE);
+ renderer = new rx::Renderer9(display, hDc, softwareDevice);
+
+@@ -213,6 +219,7 @@ rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayT
+ {
+ return renderer;
+ }
++#endif // ANGLE_ENABLE_D3D9
+
+ return NULL;
+ }
+--
+1.8.4.msysgit.0
+
diff --git a/src/angle/patches/0008-ANGLE-DX11-Prevent-assert-when-view-is-minimized-or-.patch b/src/angle/patches/0008-ANGLE-DX11-Prevent-assert-when-view-is-minimized-or-.patch
deleted file mode 100644
index 10b36c2096..0000000000
--- a/src/angle/patches/0008-ANGLE-DX11-Prevent-assert-when-view-is-minimized-or-.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From 6f4600a842bbc7438c8d330305de82b960598ad3 Mon Sep 17 00:00:00 2001
-From: Andrew Knight <andrew.knight@digia.com>
-Date: Sun, 15 Sep 2013 00:18:44 +0300
-Subject: [PATCH] ANGLE DX11: Prevent assert when view is minimized or size
- goes to 0x0
-
-This allows the Direct3D 11 version of ANGLE to gracefully allow
-surfaces with dimensions of 0. This is important because Qt may resize
-the surface to 0x0 because of window minimization or other user
-action (window resize). As EGL specifies that empty (0x0) surfaces are
-valid, this makes sure an assert doesn't occur in the case that a valid
-surface is resized to an empty one.
-
-Change-Id: Ia60c4c694090d03c1da7f43c56e90b925c8eab6d
----
- src/3rdparty/angle/src/libEGL/Surface.cpp | 9 ++++++++-
- src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp | 3 +++
- 2 files changed, 11 insertions(+), 1 deletion(-)
-
-diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp
-index 311790c..b47a7bc 100644
---- a/src/3rdparty/angle/src/libEGL/Surface.cpp
-+++ b/src/3rdparty/angle/src/libEGL/Surface.cpp
-@@ -135,9 +135,16 @@ bool Surface::resetSwapChain()
-
- bool Surface::resizeSwapChain(int backbufferWidth, int backbufferHeight)
- {
-- ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
- ASSERT(mSwapChain);
-
-+ // Prevent bad swap chain resize by calling reset if size is invalid
-+ if (backbufferWidth < 1 || backbufferHeight < 1)
-+ {
-+ mWidth = backbufferWidth;
-+ mHeight = backbufferHeight;
-+ return mSwapChain->reset(0, 0, mSwapInterval) == EGL_SUCCESS;
-+ }
-+
- EGLint status = mSwapChain->resize(backbufferWidth, backbufferHeight);
-
- if (status == EGL_CONTEXT_LOST)
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
-index a50db3b..0da58cb 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
-@@ -369,6 +369,9 @@ EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight)
- return EGL_BAD_ACCESS;
- }
-
-+ if (!mSwapChain)
-+ reset(backbufferWidth, backbufferHeight, mSwapInterval);
-+
- // Can only call resize if we have already created our swap buffer and resources
- ASSERT(mSwapChain && mBackBufferTexture && mBackBufferRTView);
-
---
-1.8.1.msysgit.1
-
diff --git a/src/angle/patches/0015-ANGLE-Dynamically-load-D3D-compiler-from-a-list-of-k.patch b/src/angle/patches/0008-ANGLE-Dynamically-load-D3D-compiler-from-a-list-of-k.patch
index 1955e12bf3..c7cfafc246 100644
--- a/src/angle/patches/0015-ANGLE-Dynamically-load-D3D-compiler-from-a-list-of-k.patch
+++ b/src/angle/patches/0008-ANGLE-Dynamically-load-D3D-compiler-from-a-list-of-k.patch
@@ -1,6 +1,6 @@
-From 806fbe22a3515792b6716b5072a2131e2ce3437a Mon Sep 17 00:00:00 2001
+From 0fede57f6fc052942b910995fdfa4cd76a32f586 Mon Sep 17 00:00:00 2001
From: Andrew Knight <andrew.knight@digia.com>
-Date: Sat, 7 Dec 2013 23:57:39 +0200
+Date: Tue, 18 Feb 2014 12:11:45 +0200
Subject: [PATCH] ANGLE: Dynamically load D3D compiler from a list or the
environment
@@ -11,36 +11,29 @@ QT_D3DCOMPILER_DLL.
Change-Id: I0d7a8a8a36cc571836f8fa59ea14513b9b19c19b
---
- .../angle/src/libGLESv2/renderer/Renderer.cpp | 44 ++++++++++++++++++----
- 1 file changed, 36 insertions(+), 8 deletions(-)
+ .../angle/src/libGLESv2/renderer/Renderer.cpp | 34 ++++++++++++++++++++--
+ 1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
-index 7ba183d..39fd0f4 100644
+index e74120d..94cbc0e 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
-@@ -29,12 +29,12 @@
- #endif
+@@ -43,6 +43,10 @@ typedef HRESULT (WINAPI *pD3DCompile)(const void *data, SIZE_T data_size, const
+
+ #endif // __MINGW32__
- #ifndef D3DCOMPILER_DLL
--#ifndef ANGLE_OS_WINPHONE
- #define D3DCOMPILER_DLL L"d3dcompiler_43.dll" // Lowest common denominator
--#else
--#define D3DCOMPILER_DLL L"qtd3dcompiler.dll" // Placeholder DLL for phone
--#endif // ANGLE_OS_WINPHONE
--#endif // D3DCOMPILER_DLL
-+#endif
-+
+#ifndef QT_D3DCOMPILER_DLL
+#define QT_D3DCOMPILER_DLL D3DCOMPILER_DLL
+#endif
++
+ namespace rx
+ {
- #if defined(__MINGW32__) || defined(ANGLE_OS_WINPHONE)
-
-@@ -83,12 +83,40 @@ bool Renderer::initializeCompiler()
- }
+@@ -77,10 +81,36 @@ bool Renderer::initializeCompiler()
}
- #else
-- // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with.
+ #endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
+
+- if (!mD3dCompilerModule)
+ // Load the compiler DLL specified by the environment, or default to QT_D3DCOMPILER_DLL
+#if !defined(ANGLE_OS_WINRT)
+ const wchar_t *defaultCompiler = _wgetenv(L"QT_D3DCOMPILER_DLL");
@@ -66,18 +59,13 @@ index 7ba183d..39fd0f4 100644
+
+ // Load the first available known compiler DLL
+ for (int i = 0; compilerDlls[i]; ++i)
-+ {
- #if !defined(ANGLE_OS_WINRT)
-- mD3dCompilerModule = LoadLibrary(D3DCOMPILER_DLL);
+ {
+ // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with.
+- mD3dCompilerModule = LoadLibrary(D3DCOMPILER_DLL);
+ mD3dCompilerModule = LoadLibrary(compilerDlls[i]);
- #else
-- mD3dCompilerModule = LoadPackagedLibrary(D3DCOMPILER_DLL, NULL);
-+ mD3dCompilerModule = LoadPackagedLibrary(compilerDlls[i], NULL);
- #endif
+ if (mD3dCompilerModule)
+ break;
-+ }
- #endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
+ }
if (!mD3dCompilerModule)
--
diff --git a/src/angle/patches/0012-ANGLE-Support-WinRT.patch b/src/angle/patches/0009-ANGLE-Support-WinRT.patch
index 8a5b96c7c0..92909d37d8 100644
--- a/src/angle/patches/0012-ANGLE-Support-WinRT.patch
+++ b/src/angle/patches/0009-ANGLE-Support-WinRT.patch
@@ -1,10 +1,10 @@
-From 67c318c7b9c6d95d3170d11956dbec56494511ca Mon Sep 17 00:00:00 2001
+From 46b8b123ada1787c68525cd07dcdbfdbc003bcc5 Mon Sep 17 00:00:00 2001
From: Andrew Knight <andrew.knight@digia.com>
-Date: Tue, 1 Oct 2013 09:43:29 +0300
+Date: Thu, 20 Feb 2014 16:49:13 +0200
Subject: [PATCH] ANGLE: Support WinRT
This enables EGL for WinRT's native types, and adjusts some codepaths
-to accommodate differences in between desktop Windows and WinRT.
+to accommodate differences between desktop Windows and WinRT.
- WinRT native handles added to eglplatform.h
- References to native handles in libEGL/libGLESv2 follow eglplatform.h
@@ -16,31 +16,32 @@ Change-Id: Ia90377e700d335a1c569c2145008dd4b0dfd84d3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
---
src/3rdparty/angle/include/EGL/eglplatform.h | 10 ++-
- src/3rdparty/angle/src/compiler/osinclude.h | 35 ++++------
- src/3rdparty/angle/src/compiler/ossource_posix.cpp | 8 +++
- src/3rdparty/angle/src/compiler/ossource_win.cpp | 8 +++
- src/3rdparty/angle/src/compiler/ossource_winrt.cpp | 75 ++++++++++++++++++++++
- src/3rdparty/angle/src/libEGL/Display.cpp | 8 ++-
- src/3rdparty/angle/src/libEGL/Display.h | 4 +-
- src/3rdparty/angle/src/libEGL/Surface.cpp | 35 +++++++++-
- src/3rdparty/angle/src/libEGL/Surface.h | 7 +-
+ .../angle/src/compiler/translator/osinclude.h | 20 +++---
+ .../src/compiler/translator/ossource_posix.cpp | 8 +++
+ .../angle/src/compiler/translator/ossource_win.cpp | 8 +++
+ .../src/compiler/translator/ossource_winrt.cpp | 75 ++++++++++++++++++++++
+ src/3rdparty/angle/src/libEGL/Display.cpp | 11 ++--
+ src/3rdparty/angle/src/libEGL/Display.h | 7 +-
+ src/3rdparty/angle/src/libEGL/Surface.cpp | 42 +++++++++++-
+ src/3rdparty/angle/src/libEGL/Surface.h | 6 +-
src/3rdparty/angle/src/libEGL/libEGL.cpp | 4 +-
- src/3rdparty/angle/src/libEGL/main.cpp | 40 ++++++++++--
- src/3rdparty/angle/src/libGLESv2/main.cpp | 39 +++++++++--
- src/3rdparty/angle/src/libGLESv2/precompiled.h | 15 +++++
- .../angle/src/libGLESv2/renderer/Renderer.cpp | 23 ++++---
- .../angle/src/libGLESv2/renderer/Renderer.h | 27 +++++++-
- .../angle/src/libGLESv2/renderer/Renderer11.cpp | 10 ++-
- .../angle/src/libGLESv2/renderer/Renderer11.h | 2 +-
- .../angle/src/libGLESv2/renderer/SwapChain.h | 4 +-
- .../angle/src/libGLESv2/renderer/SwapChain11.cpp | 29 +++++++--
- .../angle/src/libGLESv2/renderer/SwapChain11.h | 2 +-
- src/3rdparty/angle/src/libGLESv2/utilities.cpp | 53 +++++++++++++++
- src/angle/src/common/common.pri | 2 +-
- src/angle/src/compiler/translator_common.pro | 7 +-
- src/angle/src/config.pri | 5 +-
- 24 files changed, 386 insertions(+), 66 deletions(-)
- create mode 100644 src/3rdparty/angle/src/compiler/ossource_winrt.cpp
+ src/3rdparty/angle/src/libEGL/main.cpp | 29 ++++++++-
+ src/3rdparty/angle/src/libGLESv2/Context.cpp | 1 +
+ src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp | 1 +
+ src/3rdparty/angle/src/libGLESv2/main.cpp | 27 ++++++++
+ src/3rdparty/angle/src/libGLESv2/main.h | 2 +-
+ src/3rdparty/angle/src/libGLESv2/precompiled.h | 45 ++++++++++++-
+ .../angle/src/libGLESv2/renderer/Renderer.cpp | 15 +++--
+ .../angle/src/libGLESv2/renderer/Renderer.h | 3 +-
+ .../angle/src/libGLESv2/renderer/SwapChain.h | 5 +-
+ .../src/libGLESv2/renderer/d3d11/Renderer11.cpp | 13 +++-
+ .../src/libGLESv2/renderer/d3d11/Renderer11.h | 5 +-
+ .../src/libGLESv2/renderer/d3d11/SwapChain11.cpp | 37 +++++++++--
+ .../src/libGLESv2/renderer/d3d11/SwapChain11.h | 2 +-
+ .../libGLESv2/renderer/d3d11/shaders/Clear11.hlsl | 4 ++
+ src/3rdparty/angle/src/libGLESv2/utilities.cpp | 48 ++++++++++++++
+ 25 files changed, 378 insertions(+), 50 deletions(-)
+ create mode 100644 src/3rdparty/angle/src/compiler/translator/ossource_winrt.cpp
diff --git a/src/3rdparty/angle/include/EGL/eglplatform.h b/src/3rdparty/angle/include/EGL/eglplatform.h
index 34283f2..eb15ae5 100644
@@ -63,17 +64,14 @@ index 34283f2..eb15ae5 100644
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
-diff --git a/src/3rdparty/angle/src/compiler/osinclude.h b/src/3rdparty/angle/src/compiler/osinclude.h
-index d8bb1a7..60177d5 100644
---- a/src/3rdparty/angle/src/compiler/osinclude.h
-+++ b/src/3rdparty/angle/src/compiler/osinclude.h
-@@ -13,27 +13,26 @@
+diff --git a/src/3rdparty/angle/src/compiler/translator/osinclude.h b/src/3rdparty/angle/src/compiler/translator/osinclude.h
+index c3063d6..cccfa63 100644
+--- a/src/3rdparty/angle/src/compiler/translator/osinclude.h
++++ b/src/3rdparty/angle/src/compiler/translator/osinclude.h
+@@ -13,7 +13,11 @@
//
#if defined(_WIN32) || defined(_WIN64)
-+#define STRICT
-+#define VC_EXTRALEAN 1
-+#include <windows.h>
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
+#define ANGLE_OS_WINRT
+#else
@@ -81,31 +79,17 @@ index d8bb1a7..60177d5 100644
+#endif
#elif defined(__APPLE__) || defined(__linux__) || \
defined(__FreeBSD__) || defined(__OpenBSD__) || \
- defined(__sun) || defined(ANDROID) || \
- defined(__GLIBC__) || defined(__GNU__) || \
- defined(__QNX__)
- #define ANGLE_OS_POSIX
--#else
--#error Unsupported platform.
--#endif
--
--#if defined(ANGLE_OS_WIN)
--#define STRICT
--#define VC_EXTRALEAN 1
--#include <windows.h>
--#elif defined(ANGLE_OS_POSIX)
- #include <pthread.h>
- #include <semaphore.h>
- #include <errno.h>
--#endif // ANGLE_OS_WIN
--
-+#else
-+#error Unsupported platform.
-+#endif
-
- #include "compiler/debug.h"
+ defined(__NetBSD__) || defined(__DragonFly__) || \
+@@ -25,7 +29,7 @@
+ #error Unsupported platform.
+ #endif
-@@ -43,23 +42,17 @@
+-#if defined(ANGLE_OS_WIN)
++#if defined(ANGLE_OS_WIN) || defined(ANGLE_OS_WINRT)
+ #define STRICT
+ #define VC_EXTRALEAN 1
+ #include <windows.h>
+@@ -44,23 +48,17 @@
#if defined(ANGLE_OS_WIN)
typedef DWORD OS_TLSIndex;
#define OS_INVALID_TLS_INDEX (TLS_OUT_OF_INDEXES)
@@ -133,10 +117,10 @@ index d8bb1a7..60177d5 100644
-}
-
#endif // __OSINCLUDE_H
-diff --git a/src/3rdparty/angle/src/compiler/ossource_posix.cpp b/src/3rdparty/angle/src/compiler/ossource_posix.cpp
-index 1e1e699..35510c1 100644
---- a/src/3rdparty/angle/src/compiler/ossource_posix.cpp
-+++ b/src/3rdparty/angle/src/compiler/ossource_posix.cpp
+diff --git a/src/3rdparty/angle/src/compiler/translator/ossource_posix.cpp b/src/3rdparty/angle/src/compiler/translator/ossource_posix.cpp
+index 90a3757..d4bba4c 100644
+--- a/src/3rdparty/angle/src/compiler/translator/ossource_posix.cpp
++++ b/src/3rdparty/angle/src/compiler/translator/ossource_posix.cpp
@@ -33,6 +33,14 @@ OS_TLSIndex OS_AllocTLSIndex()
}
@@ -152,10 +136,10 @@ index 1e1e699..35510c1 100644
bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
{
if (nIndex == OS_INVALID_TLS_INDEX) {
-diff --git a/src/3rdparty/angle/src/compiler/ossource_win.cpp b/src/3rdparty/angle/src/compiler/ossource_win.cpp
-index 89922fe..708a1ad 100644
---- a/src/3rdparty/angle/src/compiler/ossource_win.cpp
-+++ b/src/3rdparty/angle/src/compiler/ossource_win.cpp
+diff --git a/src/3rdparty/angle/src/compiler/translator/ossource_win.cpp b/src/3rdparty/angle/src/compiler/translator/ossource_win.cpp
+index 2cc5871..abd8bc7 100644
+--- a/src/3rdparty/angle/src/compiler/translator/ossource_win.cpp
++++ b/src/3rdparty/angle/src/compiler/translator/ossource_win.cpp
@@ -29,6 +29,14 @@ OS_TLSIndex OS_AllocTLSIndex()
}
@@ -171,11 +155,11 @@ index 89922fe..708a1ad 100644
bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
{
if (nIndex == OS_INVALID_TLS_INDEX) {
-diff --git a/src/3rdparty/angle/src/compiler/ossource_winrt.cpp b/src/3rdparty/angle/src/compiler/ossource_winrt.cpp
+diff --git a/src/3rdparty/angle/src/compiler/translator/ossource_winrt.cpp b/src/3rdparty/angle/src/compiler/translator/ossource_winrt.cpp
new file mode 100644
-index 0000000..84443ab
+index 0000000..bb061ca
--- /dev/null
-+++ b/src/3rdparty/angle/src/compiler/ossource_winrt.cpp
++++ b/src/3rdparty/angle/src/compiler/translator/ossource_winrt.cpp
@@ -0,0 +1,75 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
@@ -183,7 +167,7 @@ index 0000000..84443ab
+// found in the LICENSE file.
+//
+
-+#include "compiler/osinclude.h"
++#include "compiler/translator/osinclude.h"
+//
+// This file contains contains Windows Runtime specific functions
+//
@@ -253,10 +237,40 @@ index 0000000..84443ab
+ return true;
+}
diff --git a/src/3rdparty/angle/src/libEGL/Display.cpp b/src/3rdparty/angle/src/libEGL/Display.cpp
-index a382c3b..14973af 100644
+index a7f5f5a..e75a4b6 100644
--- a/src/3rdparty/angle/src/libEGL/Display.cpp
+++ b/src/3rdparty/angle/src/libEGL/Display.cpp
-@@ -186,7 +186,7 @@ bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
+@@ -1,3 +1,4 @@
++#include "../libGLESv2/precompiled.h"
+ //
+ // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+ // Use of this source code is governed by a BSD-style license that can be
+@@ -40,13 +41,13 @@ egl::Display *Display::getDisplay(EGLNativeDisplayType displayId)
+
+ // FIXME: Check if displayId is a valid display device context
+
+- egl::Display *display = new egl::Display(displayId, (HDC)displayId);
++ egl::Display *display = new egl::Display(displayId);
+
+ displays[displayId] = display;
+ return display;
+ }
+
+-Display::Display(EGLNativeDisplayType displayId, HDC deviceContext) : mDc(deviceContext)
++Display::Display(EGLNativeDisplayType displayId)
+ {
+ mDisplayId = displayId;
+ mRenderer = NULL;
+@@ -71,7 +72,7 @@ bool Display::initialize()
+ return true;
+ }
+
+- mRenderer = glCreateRenderer(this, mDc, mDisplayId);
++ mRenderer = glCreateRenderer(this, mDisplayId);
+
+ if (!mRenderer)
+ {
+@@ -186,7 +187,7 @@ bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
@@ -265,7 +279,7 @@ index a382c3b..14973af 100644
{
const Config *configuration = mConfigSet.get(config);
EGLint postSubBufferSupported = EGL_FALSE;
-@@ -456,7 +456,7 @@ bool Display::isValidSurface(egl::Surface *surface)
+@@ -456,7 +457,7 @@ bool Display::isValidSurface(egl::Surface *surface)
return mSurfaceSet.find(surface) != mSurfaceSet.end();
}
@@ -274,33 +288,11 @@ index a382c3b..14973af 100644
{
for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
{
-@@ -471,7 +471,6 @@ bool Display::hasExistingWindowSurface(HWND window)
-
- void Display::initExtensionString()
- {
-- HMODULE swiftShader = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
- bool shareHandleSupported = mRenderer->getShareHandleSupport();
-
- mExtensionString = "";
-@@ -487,10 +486,13 @@ void Display::initExtensionString()
-
- mExtensionString += "EGL_ANGLE_query_surface_pointer ";
-
-+#if !defined(ANGLE_OS_WINRT)
-+ HMODULE swiftShader = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
- if (swiftShader)
- {
- mExtensionString += "EGL_ANGLE_software_display ";
- }
-+#endif
-
- if (shareHandleSupported)
- {
diff --git a/src/3rdparty/angle/src/libEGL/Display.h b/src/3rdparty/angle/src/libEGL/Display.h
-index 58c3940..5d55410 100644
+index c816e4e..cd07bb3 100644
--- a/src/3rdparty/angle/src/libEGL/Display.h
+++ b/src/3rdparty/angle/src/libEGL/Display.h
-@@ -40,7 +40,7 @@ class Display
+@@ -38,7 +38,7 @@ class Display
bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value);
@@ -309,7 +301,7 @@ index 58c3940..5d55410 100644
EGLSurface createOffscreenSurface(EGLConfig config, HANDLE shareHandle, const EGLint *attribList);
EGLContext createContext(EGLConfig configHandle, const gl::Context *shareContext, bool notifyResets, bool robustAccess);
-@@ -51,7 +51,7 @@ class Display
+@@ -49,7 +49,7 @@ class Display
bool isValidConfig(EGLConfig config);
bool isValidContext(gl::Context *context);
bool isValidSurface(egl::Surface *surface);
@@ -318,11 +310,30 @@ index 58c3940..5d55410 100644
rx::Renderer *getRenderer() { return mRenderer; };
+@@ -63,12 +63,11 @@ class Display
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Display);
+
+- Display(EGLNativeDisplayType displayId, HDC deviceContext);
++ Display(EGLNativeDisplayType displayId);
+
+ bool restoreLostDevice();
+
+ EGLNativeDisplayType mDisplayId;
+- const HDC mDc;
+
+ bool mSoftwareDevice;
+
diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp
-index b47a7bc..abc6d7d 100644
+index 12f8dfd..3443355 100644
--- a/src/3rdparty/angle/src/libEGL/Surface.cpp
+++ b/src/3rdparty/angle/src/libEGL/Surface.cpp
-@@ -20,10 +20,15 @@
+@@ -1,3 +1,4 @@
++#include "../libGLESv2/precompiled.h"
+ //
+ // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+ // Use of this source code is governed by a BSD-style license that can be
+@@ -22,10 +23,15 @@
#include "libEGL/main.h"
#include "libEGL/Display.h"
@@ -334,12 +345,12 @@ index b47a7bc..abc6d7d 100644
namespace egl
{
--Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported)
+-Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported)
+Surface::Surface(Display *display, const Config *config, EGLNativeWindowType window, EGLint postSubBufferSupported)
: mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported)
{
mRenderer = mDisplay->getRenderer();
-@@ -96,6 +101,7 @@ bool Surface::resetSwapChain()
+@@ -98,6 +104,7 @@ bool Surface::resetSwapChain()
if (mWindow)
{
@@ -347,14 +358,16 @@ index b47a7bc..abc6d7d 100644
RECT windowRect;
if (!GetClientRect(getWindowHandle(), &windowRect))
{
-@@ -107,6 +113,14 @@ bool Surface::resetSwapChain()
+@@ -109,6 +116,16 @@ bool Surface::resetSwapChain()
width = windowRect.right - windowRect.left;
height = windowRect.bottom - windowRect.top;
+#else
+ ABI::Windows::Foundation::Rect windowRect;
+ ABI::Windows::UI::Core::ICoreWindow *window;
-+ ASSERT(SUCCEEDED(mWindow->QueryInterface(IID_PPV_ARGS(&window))));
++ HRESULT hr = mWindow->QueryInterface(IID_PPV_ARGS(&window));
++ if (FAILED(hr))
++ return false;
+ window->get_Bounds(&windowRect);
+ width = windowRect.Width;
+ height = windowRect.Height;
@@ -362,7 +375,7 @@ index b47a7bc..abc6d7d 100644
}
else
{
-@@ -226,7 +240,7 @@ bool Surface::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
+@@ -221,7 +238,7 @@ bool Surface::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
return true;
}
@@ -371,7 +384,7 @@ index b47a7bc..abc6d7d 100644
{
return mWindow;
}
-@@ -235,6 +249,7 @@ HWND Surface::getWindowHandle()
+@@ -230,6 +247,7 @@ HWND Surface::getWindowHandle()
#define kSurfaceProperty _TEXT("Egl::SurfaceOwner")
#define kParentWndProc _TEXT("Egl::SurfaceParentWndProc")
@@ -379,7 +392,7 @@ index b47a7bc..abc6d7d 100644
static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
if (message == WM_SIZE)
-@@ -248,9 +263,13 @@ static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam
+@@ -243,9 +261,13 @@ static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam
WNDPROC prevWndFunc = reinterpret_cast<WNDPROC >(GetProp(hwnd, kParentWndProc));
return CallWindowProc(prevWndFunc, hwnd, message, wparam, lparam);
}
@@ -393,7 +406,7 @@ index b47a7bc..abc6d7d 100644
if (!mWindow)
{
return;
-@@ -274,10 +293,12 @@ void Surface::subclassWindow()
+@@ -269,10 +291,12 @@ void Surface::subclassWindow()
SetProp(mWindow, kSurfaceProperty, reinterpret_cast<HANDLE>(this));
SetProp(mWindow, kParentWndProc, reinterpret_cast<HANDLE>(oldWndProc));
mWindowSubclassed = true;
@@ -406,7 +419,7 @@ index b47a7bc..abc6d7d 100644
if(!mWindowSubclassed)
{
return;
-@@ -300,10 +321,12 @@ void Surface::unsubclassWindow()
+@@ -295,10 +319,12 @@ void Surface::unsubclassWindow()
RemoveProp(mWindow, kSurfaceProperty);
RemoveProp(mWindow, kParentWndProc);
mWindowSubclassed = false;
@@ -419,34 +432,38 @@ index b47a7bc..abc6d7d 100644
RECT client;
if (!GetClientRect(getWindowHandle(), &client))
{
-@@ -314,6 +337,14 @@ bool Surface::checkForOutOfDateSwapChain()
+@@ -309,14 +335,26 @@ bool Surface::checkForOutOfDateSwapChain()
// Grow the buffer now, if the window has grown. We need to grow now to avoid losing information.
int clientWidth = client.right - client.left;
int clientHeight = client.bottom - client.top;
+#else
+ ABI::Windows::Foundation::Rect windowRect;
+ ABI::Windows::UI::Core::ICoreWindow *window;
-+ ASSERT(SUCCEEDED(mWindow->QueryInterface(IID_PPV_ARGS(&window))));
++ HRESULT hr = mWindow->QueryInterface(IID_PPV_ARGS(&window));
++ if (FAILED(hr))
++ return false;
+ window->get_Bounds(&windowRect);
+ int clientWidth = windowRect.Width;
+ int clientHeight = windowRect.Height;
+#endif
bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
- if (mSwapIntervalDirty)
++#if !defined(ANGLE_OS_WINRT)
+ if (IsIconic(getWindowHandle()))
+ {
+ // The window is automatically resized to 150x22 when it's minimized, but the swapchain shouldn't be resized
+ // because that's not a useful size to render to.
+ sizeDirty = false;
+ }
++#endif
+
+ bool wasDirty = (mSwapIntervalDirty || sizeDirty);
+
diff --git a/src/3rdparty/angle/src/libEGL/Surface.h b/src/3rdparty/angle/src/libEGL/Surface.h
-index 938b800..ae9a380 100644
+index 938b800..1d2303c 100644
--- a/src/3rdparty/angle/src/libEGL/Surface.h
+++ b/src/3rdparty/angle/src/libEGL/Surface.h
-@@ -15,6 +15,7 @@
- #include <EGL/egl.h>
-
- #include "common/angleutils.h"
-+#include "windows.h"
-
- namespace gl
- {
-@@ -34,7 +35,7 @@ class Config;
+@@ -34,7 +34,7 @@ class Config;
class Surface
{
public:
@@ -455,7 +472,7 @@ index 938b800..ae9a380 100644
Surface(Display *display, const egl::Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget);
~Surface();
-@@ -43,7 +44,7 @@ class Surface
+@@ -43,7 +43,7 @@ class Surface
void release();
bool resetSwapChain();
@@ -464,17 +481,17 @@ index 938b800..ae9a380 100644
bool swap();
bool postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height);
-@@ -79,7 +80,7 @@ private:
+@@ -79,7 +79,7 @@ private:
bool resetSwapChain(int backbufferWidth, int backbufferHeight);
bool swapRect(EGLint x, EGLint y, EGLint width, EGLint height);
- const HWND mWindow; // Window that the surface is created for.
-+ const EGLNativeWindowType mWindow; // Window that the surface is created for.
++ const EGLNativeWindowType mWindow; // Window that the surface is created for.
bool mWindowSubclassed; // Indicates whether we successfully subclassed mWindow for WM_RESIZE hooking
const egl::Config *mConfig; // EGL config surface was created with
EGLint mHeight; // Height of surface
diff --git a/src/3rdparty/angle/src/libEGL/libEGL.cpp b/src/3rdparty/angle/src/libEGL/libEGL.cpp
-index 6e10c39..5bcb5d5 100644
+index 0ea46d4..b2944d5 100644
--- a/src/3rdparty/angle/src/libEGL/libEGL.cpp
+++ b/src/3rdparty/angle/src/libEGL/libEGL.cpp
@@ -308,14 +308,16 @@ EGLSurface __stdcall eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EG
@@ -496,7 +513,7 @@ index 6e10c39..5bcb5d5 100644
catch(std::bad_alloc&)
{
diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp
-index 7dea5fc..964b4b2 100644
+index 772b8eb..e972691 100644
--- a/src/3rdparty/angle/src/libEGL/main.cpp
+++ b/src/3rdparty/angle/src/libEGL/main.cpp
@@ -1,3 +1,4 @@
@@ -504,24 +521,67 @@ index 7dea5fc..964b4b2 100644
//
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
-@@ -12,7 +13,13 @@
+@@ -10,14 +11,23 @@
- #ifndef QT_OPENGL_ES_2_ANGLE_STATIC
+ #include "common/debug.h"
+#if !defined(ANGLE_OS_WINRT)
static DWORD currentTLS = TLS_OUT_OF_INDEXES;
+#else
+static __declspec(thread) void *currentTLS = 0;
+#endif
-+
-+namespace egl { Current *getCurrent(); }
- extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
+ namespace egl
{
-@@ -35,22 +42,25 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
+
+ Current *AllocateCurrent()
+ {
++#if !defined(ANGLE_OS_WINRT)
+ Current *current = (egl::Current*)LocalAlloc(LPTR, sizeof(egl::Current));
++#else
++ currentTLS = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Current));
++ Current *current = (egl::Current*)currentTLS;
++#endif
+
+ if (!current)
+ {
+@@ -25,8 +35,10 @@ Current *AllocateCurrent()
+ return NULL;
+ }
+
++#if !defined(ANGLE_OS_WINRT)
+ ASSERT(currentTLS != TLS_OUT_OF_INDEXES);
+ TlsSetValue(currentTLS, current);
++#endif
+
+ current->error = EGL_SUCCESS;
+ current->API = EGL_OPENGL_ES_API;
+@@ -39,12 +51,20 @@ Current *AllocateCurrent()
+
+ void DeallocateCurrent()
+ {
++#if !defined(ANGLE_OS_WINRT)
+ void *current = TlsGetValue(currentTLS);
+
+ if (current)
+ {
+ LocalFree((HLOCAL)current);
+ }
++#else
++ if (currentTLS)
++ {
++ HeapFree(GetProcessHeap(), 0, currentTLS);
++ currentTLS = 0;
++ }
++#endif
+ }
+
+ }
+@@ -69,13 +89,14 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
+ }
}
#endif
-
+-
+#if !defined(ANGLE_OS_WINRT)
currentTLS = TlsAlloc();
@@ -533,94 +593,114 @@ index 7dea5fc..964b4b2 100644
}
// Fall throught to initialize index
case DLL_THREAD_ATTACH:
- {
-- egl::Current *current = (egl::Current*)LocalAlloc(LPTR, sizeof(egl::Current));
-+ egl::Current *current = egl::getCurrent();
-
- if (current)
- {
-+#if !defined(ANGLE_OS_WINRT)
- TlsSetValue(currentTLS, current);
--
-+#endif
- current->error = EGL_SUCCESS;
- current->API = EGL_OPENGL_ES_API;
- current->display = EGL_NO_DISPLAY;
-@@ -61,24 +71,35 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
- break;
- case DLL_THREAD_DETACH:
- {
-- void *current = TlsGetValue(currentTLS);
-+ egl::Current *current = egl::getCurrent();
-
- if (current)
- {
-+#if !defined(ANGLE_OS_WINRT)
- LocalFree((HLOCAL)current);
-+#else
-+ HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current);
-+ currentTLS = 0;
-+#endif
- }
- }
- break;
+@@ -91,7 +112,9 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
case DLL_PROCESS_DETACH:
{
-- void *current = TlsGetValue(currentTLS);
-+ egl::Current *current = egl::getCurrent();
-
- if (current)
- {
+ egl::DeallocateCurrent();
+#if !defined(ANGLE_OS_WINRT)
- LocalFree((HLOCAL)current);
- }
-
TlsFree(currentTLS);
-+#else
-+ HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current);
-+ currentTLS = 0;
-+ }
+#endif
}
break;
default:
-@@ -95,7 +116,16 @@ namespace egl
- Current *getCurrent()
+@@ -107,8 +130,12 @@ namespace egl
+ Current *GetCurrentData()
{
#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
-- return (Current*)TlsGetValue(currentTLS);
+#if !defined(ANGLE_OS_WINRT)
-+ Current *current = (Current*)TlsGetValue(currentTLS);
-+ if (!current)
-+ current = (Current*)LocalAlloc(LPTR, sizeof(Current));
-+ return current;
-+#else
-+ if (!currentTLS)
-+ currentTLS = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY, sizeof(Current));
-+ return (Current*)currentTLS;
-+#endif
+ Current *current = (Current*)TlsGetValue(currentTLS);
#else
++ Current *current = (Current*)currentTLS;
++#endif
++#else
// No precautions for thread safety taken as ANGLE is used single-threaded in Qt.
- static Current curr = { EGL_SUCCESS, EGL_OPENGL_ES_API, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE };
+ static Current s_current = { EGL_SUCCESS, EGL_OPENGL_ES_API, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE };
+ Current *current = &s_current;
+diff --git a/src/3rdparty/angle/src/libGLESv2/Context.cpp b/src/3rdparty/angle/src/libGLESv2/Context.cpp
+index 1a058b6..e651785 100644
+--- a/src/3rdparty/angle/src/libGLESv2/Context.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/Context.cpp
+@@ -1076,6 +1076,7 @@ void Context::setRenderbufferStorage(GLsizei width, GLsizei height, GLenum inter
+ case GL_RGB565:
+ case GL_RGB8_OES:
+ case GL_RGBA8_OES:
++ case GL_BGRA8_EXT:
+ renderbuffer = new gl::Colorbuffer(mRenderer,width, height, internalformat, samples);
+ break;
+ case GL_STENCIL_INDEX8:
+diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp b/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
+index a33481e..814dfbf 100644
+--- a/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
+@@ -4895,6 +4895,7 @@ void __stdcall glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samp
+ case GL_RGBA8_OES:
+ case GL_STENCIL_INDEX8:
+ case GL_DEPTH24_STENCIL8_OES:
++ case GL_BGRA8_EXT:
+ context->setRenderbufferStorage(width, height, internalformat, samples);
+ break;
+ default:
diff --git a/src/3rdparty/angle/src/libGLESv2/main.cpp b/src/3rdparty/angle/src/libGLESv2/main.cpp
-index 730a6ac..defdf35 100644
+index 6b459d3..95f4b8d 100644
--- a/src/3rdparty/angle/src/libGLESv2/main.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/main.cpp
-@@ -13,7 +13,13 @@
+@@ -11,14 +11,23 @@
- #ifndef QT_OPENGL_ES_2_ANGLE_STATIC
+ #include "libGLESv2/Context.h"
+#if !defined(ANGLE_OS_WINRT)
static DWORD currentTLS = TLS_OUT_OF_INDEXES;
+#else
+static __declspec(thread) void *currentTLS = 0;
+#endif
-+
-+namespace gl { Current *getCurrent(); }
- extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
+ namespace gl
{
-@@ -21,22 +27,25 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
+
+ Current *AllocateCurrent()
+ {
++#if !defined(ANGLE_OS_WINRT)
+ Current *current = (Current*)LocalAlloc(LPTR, sizeof(Current));
++#else
++ currentTLS = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Current));
++ Current *current = (Current*)currentTLS;
++#endif
+
+ if (!current)
+ {
+@@ -26,8 +35,10 @@ Current *AllocateCurrent()
+ return NULL;
+ }
+
++#if !defined(ANGLE_OS_WINRT)
+ ASSERT(currentTLS != TLS_OUT_OF_INDEXES);
+ TlsSetValue(currentTLS, current);
++#endif
+
+ current->context = NULL;
+ current->display = NULL;
+@@ -37,12 +48,20 @@ Current *AllocateCurrent()
+
+ void DeallocateCurrent()
+ {
++#if !defined(ANGLE_OS_WINRT)
+ void *current = TlsGetValue(currentTLS);
+
+ if (current)
+ {
+ LocalFree((HLOCAL)current);
+ }
++#else
++ if (currentTLS)
++ {
++ HeapFree(GetProcessHeap(), 0, currentTLS);
++ currentTLS = 0;
++ }
++#endif
+ }
+
+ }
+@@ -53,12 +72,14 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
{
case DLL_PROCESS_ATTACH:
{
@@ -635,167 +715,162 @@ index 730a6ac..defdf35 100644
}
// Fall throught to initialize index
case DLL_THREAD_ATTACH:
- {
-- gl::Current *current = (gl::Current*)LocalAlloc(LPTR, sizeof(gl::Current));
-+ gl::Current *current = gl::getCurrent();
-
- if (current)
- {
-+#if !defined(ANGLE_OS_WINRT)
- TlsSetValue(currentTLS, current);
--
-+#endif
- current->context = NULL;
- current->display = NULL;
- }
-@@ -44,24 +53,35 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
- break;
- case DLL_THREAD_DETACH:
- {
-- void *current = TlsGetValue(currentTLS);
-+ gl::Current *current = gl::getCurrent();
-
- if (current)
- {
-+#if !defined(ANGLE_OS_WINRT)
- LocalFree((HLOCAL)current);
-+#else
-+ HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current);
-+ currentTLS = 0;
-+#endif
- }
- }
- break;
+@@ -74,7 +95,9 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
case DLL_PROCESS_DETACH:
{
-- void *current = TlsGetValue(currentTLS);
-+ gl::Current *current = gl::getCurrent();
-
- if (current)
- {
+ gl::DeallocateCurrent();
+#if !defined(ANGLE_OS_WINRT)
- LocalFree((HLOCAL)current);
- }
-
TlsFree(currentTLS);
-+#else
-+ HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current);
-+ currentTLS = 0;
-+ }
+#endif
}
break;
default:
-@@ -78,7 +98,16 @@ namespace gl
- Current *getCurrent()
+@@ -90,8 +113,12 @@ namespace gl
+ Current *GetCurrentData()
{
#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
-- return (Current*)TlsGetValue(currentTLS);
+#if !defined(ANGLE_OS_WINRT)
-+ Current *current = (Current*)TlsGetValue(currentTLS);
-+ if (!current)
-+ current = (Current*)LocalAlloc(LPTR, sizeof(Current));
-+ return current;
-+#else
-+ if (!currentTLS)
-+ currentTLS = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY, sizeof(Current));
-+ return (Current*)currentTLS;
-+#endif
+ Current *current = (Current*)TlsGetValue(currentTLS);
#else
++ Current *current = (Current*)currentTLS;
++#endif
++#else
// No precautions for thread safety taken as ANGLE is used single-threaded in Qt.
- static gl::Current curr = { 0, 0 };
+ static Current s_current = { 0, 0 };
+ Current *current = &s_current;
+diff --git a/src/3rdparty/angle/src/libGLESv2/main.h b/src/3rdparty/angle/src/libGLESv2/main.h
+index b413f23..69465c9 100644
+--- a/src/3rdparty/angle/src/libGLESv2/main.h
++++ b/src/3rdparty/angle/src/libGLESv2/main.h
+@@ -57,7 +57,7 @@ gl::Context *glCreateContext(const gl::Context *shareContext, rx::Renderer *rend
+ void glDestroyContext(gl::Context *context);
+ void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
+ gl::Context *glGetCurrentContext();
+-rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayType displayId);
++rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType displayId);
+ void glDestroyRenderer(rx::Renderer *renderer);
+
+ __eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname);
diff --git a/src/3rdparty/angle/src/libGLESv2/precompiled.h b/src/3rdparty/angle/src/libGLESv2/precompiled.h
-index 50dec6b..823d27b 100644
+index 79490b1..2ff09f5 100644
--- a/src/3rdparty/angle/src/libGLESv2/precompiled.h
+++ b/src/3rdparty/angle/src/libGLESv2/precompiled.h
-@@ -32,13 +32,28 @@
+@@ -32,14 +32,55 @@
#include <unordered_map>
#include <vector>
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
-+#define ANGLE_OS_WINRT
-+#if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
-+#define ANGLE_OS_WINPHONE
++# define ANGLE_OS_WINRT
++# if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
++# define ANGLE_OS_WINPHONE
++# endif
+#endif
++
+ #if defined(ANGLE_ENABLE_D3D9)
+ # include <d3d9.h>
+ #endif
+ #if defined(ANGLE_ENABLE_D3D11)
+-# include <d3d11.h>
++# if !defined(ANGLE_OS_WINRT)
++# include <d3d11.h>
++# else
++# include <d3d11_1.h>
++# define Sleep(x) WaitForSingleObjectEx(GetCurrentThread(), x, FALSE)
++# define GetVersion() WINVER
++# define LoadLibrary(x) LoadPackagedLibrary(x, NULL)
++# endif
+ # include <dxgi.h>
+ #endif
+-#include <d3dcompiler.h>
++#if !defined(ANGLE_OS_WINPHONE)
++# include <d3dcompiler.h>
+#endif
+
- #ifndef ANGLE_ENABLE_D3D11
- #include <d3d9.h>
- #else
-+#if !defined(ANGLE_OS_WINRT)
- #include <D3D11.h>
-+#else
-+#include <d3d11_1.h>
-+#define Sleep(x) WaitForSingleObjectEx(GetCurrentThread(), x, FALSE)
-+#define GetVersion() WINVER
++#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL0
++#define D3DCOMPILE_OPTIMIZATION_LEVEL0 (1 << 14)
+#endif
- #include <dxgi.h>
- #endif
-+#ifndef ANGLE_OS_WINPHONE
- #include <D3Dcompiler.h>
++#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL1
++#define D3DCOMPILE_OPTIMIZATION_LEVEL1 0
++#endif
++#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL2
++#define D3DCOMPILE_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15))
++#endif
++#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL3
++#define D3DCOMPILE_OPTIMIZATION_LEVEL3 (1 << 15)
++#endif
++#ifndef D3DCOMPILE_DEBUG
++#define D3DCOMPILE_DEBUG (1 << 0)
++#endif
++#ifndef D3DCOMPILE_SKIP_OPTIMIZATION
++#define D3DCOMPILE_SKIP_OPTIMIZATION (1 << 2)
++#endif
++#ifndef D3DCOMPILE_AVOID_FLOW_CONTROL
++#define D3DCOMPILE_AVOID_FLOW_CONTROL (1 << 9)
++#endif
++#ifndef D3DCOMPILE_PREFER_FLOW_CONTROL
++#define D3DCOMPILE_PREFER_FLOW_CONTROL (1 << 10)
+#endif
#ifdef _MSC_VER
#include <hash_map>
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
-index 21ad223..7ba183d 100644
+index 94cbc0e..5278113 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp
-@@ -28,13 +28,18 @@
+@@ -24,7 +24,7 @@
#define D3DERR_OUTOFVIDEOMEMORY MAKE_HRESULT(1, 0x876, 380)
#endif
-#ifdef __MINGW32__
--
- #ifndef D3DCOMPILER_DLL
-+#ifndef ANGLE_OS_WINPHONE
-+#define D3DCOMPILER_DLL L"d3dcompiler_43.dll" // Lowest common denominator
-+#else
-+#define D3DCOMPILER_DLL L"qtd3dcompiler.dll" // Placeholder DLL for phone
-+#endif // ANGLE_OS_WINPHONE
-+#endif // D3DCOMPILER_DLL
-
--//Add define + typedefs for older MinGW-w64 headers (pre 5783)
+#if defined(__MINGW32__) || defined(ANGLE_OS_WINPHONE)
--#define D3DCOMPILER_DLL L"d3dcompiler_43.dll"
-+//Add define + typedefs for older MinGW-w64 headers (pre 5783)
-+//Also define these on Windows Phone, which doesn't have a shader compiler
+ #ifndef D3DCOMPILER_DLL
- HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filename,
- const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint,
-@@ -43,9 +48,7 @@ typedef HRESULT (WINAPI *pD3DCompile)(const void *data, SIZE_T data_size, const
- const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint,
- const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages);
+@@ -41,7 +41,7 @@ typedef HRESULT (WINAPI *pD3DCompile)(const void *data, SIZE_T data_size, const
+
+ #endif // D3DCOMPILER_DLL
--#endif // D3DCOMPILER_DLL
--
-#endif // __MINGW32__
+#endif // __MINGW32__ || ANGLE_OS_WINPHONE
- namespace rx
+ #ifndef QT_D3DCOMPILER_DLL
+ #define QT_D3DCOMPILER_DLL D3DCOMPILER_DLL
+@@ -224,17 +224,22 @@ ShaderBlob *Renderer::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, co
+ extern "C"
{
-@@ -81,7 +84,11 @@ bool Renderer::initializeCompiler()
- }
- #else
- // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with.
-+#if !defined(ANGLE_OS_WINRT)
- mD3dCompilerModule = LoadLibrary(D3DCOMPILER_DLL);
-+#else
-+ mD3dCompilerModule = LoadPackagedLibrary(D3DCOMPILER_DLL, NULL);
+
+-rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayType displayId)
++rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType displayId)
+ {
+ rx::Renderer *renderer = NULL;
+ EGLint status = EGL_BAD_ALLOC;
+
++#if defined(ANGLE_OS_WINRT)
++ if (displayId == EGL_DEFAULT_DISPLAY)
++ displayId = EGL_D3D11_ONLY_DISPLAY_ANGLE;
+#endif
- #endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
++
+ #if defined(ANGLE_ENABLE_D3D11)
+ if (displayId == EGL_DEFAULT_DISPLAY ||
+ displayId == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
+ displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
+ {
+- renderer = new rx::Renderer11(display, hDc);
++ renderer = new rx::Renderer11(display);
- if (!mD3dCompilerModule)
-@@ -225,4 +232,4 @@ void glDestroyRenderer(rx::Renderer *renderer)
- delete renderer;
- }
+ if (renderer)
+ {
+@@ -257,7 +262,7 @@ rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayT
--}
-\ No newline at end of file
-+}
+ #if defined(ANGLE_ENABLE_D3D9)
+ bool softwareDevice = (displayId == EGL_SOFTWARE_DISPLAY_ANGLE);
+- renderer = new rx::Renderer9(display, hDc, softwareDevice);
++ renderer = new rx::Renderer9(display, displayId, softwareDevice);
+
+ if (renderer)
+ {
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h
-index 04e877b..ac67c27 100644
+index 7244a0a..79578b2 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.h
@@ -1,3 +1,4 @@
@@ -803,38 +878,7 @@ index 04e877b..ac67c27 100644
//
// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
-@@ -13,6 +14,30 @@
- #include "libGLESv2/Uniform.h"
- #include "libGLESv2/angletypes.h"
-
-+#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL0
-+#define D3DCOMPILE_OPTIMIZATION_LEVEL0 (1 << 14)
-+#endif
-+#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL1
-+#define D3DCOMPILE_OPTIMIZATION_LEVEL1 0
-+#endif
-+#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL2
-+#define D3DCOMPILE_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15))
-+#endif
-+#ifndef D3DCOMPILE_OPTIMIZATION_LEVEL3
-+#define D3DCOMPILE_OPTIMIZATION_LEVEL3 (1 << 15)
-+#endif
-+#ifndef D3DCOMPILE_DEBUG
-+#define D3DCOMPILE_DEBUG (1 << 0)
-+#endif
-+#ifndef D3DCOMPILE_SKIP_OPTIMIZATION
-+#define D3DCOMPILE_SKIP_OPTIMIZATION (1 << 2)
-+#endif
-+#ifndef D3DCOMPILE_AVOID_FLOW_CONTROL
-+#define D3DCOMPILE_AVOID_FLOW_CONTROL (1 << 9)
-+#endif
-+#ifndef D3DCOMPILE_PREFER_FLOW_CONTROL
-+#define D3DCOMPILE_PREFER_FLOW_CONTROL (1 << 10)
-+#endif
- #if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
- #define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
- #endif
-@@ -107,7 +132,7 @@ class Renderer
+@@ -113,7 +114,7 @@ class Renderer
virtual void sync(bool block) = 0;
@@ -843,10 +887,46 @@ index 04e877b..ac67c27 100644
virtual void setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &sampler) = 0;
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture) = 0;
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp
-index a431018..d04467b 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h
+index f09f19b..8231fbc 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h
+@@ -1,3 +1,4 @@
++#include "../precompiled.h"
+ //
+ // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+ // Use of this source code is governed by a BSD-style license that can be
+@@ -22,7 +23,7 @@ namespace rx
+ class SwapChain
+ {
+ public:
+- SwapChain(HWND window, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat)
++ SwapChain(EGLNativeWindowType window, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat)
+ : mWindow(window), mShareHandle(shareHandle), mBackBufferFormat(backBufferFormat), mDepthBufferFormat(depthBufferFormat)
+ {
+ }
+@@ -37,7 +38,7 @@ class SwapChain
+ virtual HANDLE getShareHandle() {return mShareHandle;};
+
+ protected:
+- const HWND mWindow; // Window that the surface is created for.
++ const EGLNativeWindowType mWindow; // Window that the surface is created for.
+ const GLenum mBackBufferFormat;
+ const GLenum mDepthBufferFormat;
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp
+index d9fcb7a..7f166fd 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp
+@@ -66,7 +66,7 @@ enum
+ MAX_TEXTURE_IMAGE_UNITS_VTF_SM4 = 16
+ };
+
+-Renderer11::Renderer11(egl::Display *display, HDC hDc) : Renderer(display), mDc(hDc)
++Renderer11::Renderer11(egl::Display *display) : Renderer(display)
+ {
+ mVertexDataManager = NULL;
+ mIndexDataManager = NULL;
@@ -137,6 +137,7 @@ EGLint Renderer11::initialize()
return EGL_NOT_INITIALIZED;
}
@@ -855,7 +935,15 @@ index a431018..d04467b 100644
mDxgiModule = LoadLibrary(TEXT("dxgi.dll"));
mD3d11Module = LoadLibrary(TEXT("d3d11.dll"));
-@@ -155,6 +156,7 @@ EGLint Renderer11::initialize()
+@@ -146,6 +147,7 @@ EGLint Renderer11::initialize()
+ return EGL_NOT_INITIALIZED;
+ }
+
++
+ // create the D3D11 device
+ ASSERT(mDevice == NULL);
+ PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(mD3d11Module, "D3D11CreateDevice");
+@@ -155,6 +157,7 @@ EGLint Renderer11::initialize()
ERR("Could not retrieve D3D11CreateDevice address - aborting!\n");
return EGL_NOT_INITIALIZED;
}
@@ -863,7 +951,7 @@ index a431018..d04467b 100644
D3D_FEATURE_LEVEL featureLevels[] =
{
-@@ -203,8 +205,12 @@ EGLint Renderer11::initialize()
+@@ -203,8 +206,12 @@ EGLint Renderer11::initialize()
}
}
@@ -877,7 +965,7 @@ index a431018..d04467b 100644
if (FAILED(result))
{
-@@ -524,7 +530,7 @@ void Renderer11::sync(bool block)
+@@ -522,7 +529,7 @@ void Renderer11::sync(bool block)
}
}
@@ -886,10 +974,19 @@ index a431018..d04467b 100644
{
return new rx::SwapChain11(this, window, shareHandle, backBufferFormat, depthBufferFormat);
}
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h
-index f024855..a7f5a39 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h
+index 1b6760b..ba3f0c6 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h
+@@ -39,7 +39,7 @@ enum
+ class Renderer11 : public Renderer
+ {
+ public:
+- Renderer11(egl::Display *display, HDC hDc);
++ Renderer11(egl::Display *display);
+ virtual ~Renderer11();
+
+ static Renderer11 *makeRenderer11(Renderer *renderer);
@@ -52,7 +52,7 @@ class Renderer11 : public Renderer
virtual void sync(bool block);
@@ -899,33 +996,19 @@ index f024855..a7f5a39 100644
virtual void setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &sampler);
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture);
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h
-index 14c0515..a6870eb 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain.h
-@@ -18,7 +18,7 @@ namespace rx
- class SwapChain
- {
- public:
-- SwapChain(HWND window, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat)
-+ SwapChain(EGLNativeWindowType window, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat)
- : mWindow(window), mShareHandle(shareHandle), mBackBufferFormat(backBufferFormat), mDepthBufferFormat(depthBufferFormat)
- {
- }
-@@ -33,7 +33,7 @@ class SwapChain
- virtual HANDLE getShareHandle() {return mShareHandle;};
+@@ -203,7 +203,6 @@ class Renderer11 : public Renderer
- protected:
-- const HWND mWindow; // Window that the surface is created for.
-+ const EGLNativeWindowType mWindow; // Window that the surface is created for.
- const GLenum mBackBufferFormat;
- const GLenum mDepthBufferFormat;
+ HMODULE mD3d11Module;
+ HMODULE mDxgiModule;
+- HDC mDc;
+
+ bool mDeviceLost;
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
-index 0da58cb..0797fd7 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
-@@ -17,7 +17,7 @@
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp
+index d2b53a7..bd97d5c 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp
+@@ -18,7 +18,7 @@
namespace rx
{
@@ -934,15 +1017,20 @@ index 0da58cb..0797fd7 100644
GLenum backBufferFormat, GLenum depthBufferFormat)
: mRenderer(renderer), SwapChain(window, shareHandle, backBufferFormat, depthBufferFormat)
{
-@@ -468,6 +468,7 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
+@@ -361,25 +361,50 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
if (mWindow)
{
+#if !defined(ANGLE_OS_WINRT)
- // We cannot create a swap chain for an HWND that is owned by a different process
- DWORD currentProcessId = GetCurrentProcessId();
- DWORD wndProcessId;
-@@ -491,14 +492,34 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
+ IDXGIFactory *factory = mRenderer->getDxgiFactory();
+
+ DXGI_SWAP_CHAIN_DESC swapChainDesc = {0};
+- swapChainDesc.BufferCount = 2;
+ swapChainDesc.BufferDesc.Format = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
+ swapChainDesc.BufferDesc.Width = backbufferWidth;
+ swapChainDesc.BufferDesc.Height = backbufferHeight;
++ swapChainDesc.BufferCount = 2;
+ swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
swapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
@@ -954,14 +1042,18 @@ index 0da58cb..0797fd7 100644
+ ASSERT(SUCCEEDED(result));
+
+ DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};
-+ swapChainDesc.BufferCount = 2;
+ swapChainDesc.Format = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
+ swapChainDesc.Width = backbufferWidth;
+ swapChainDesc.Height = backbufferHeight;
+ swapChainDesc.Stereo = FALSE;
++#if !defined(ANGLE_OS_WINPHONE)
++ swapChainDesc.BufferCount = 2;
+ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
++#else
++ swapChainDesc.BufferCount = 1;
++ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
++#endif
+#endif
-+
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.Flags = 0;
- swapChainDesc.OutputWindow = mWindow;
@@ -969,9 +1061,8 @@ index 0da58cb..0797fd7 100644
swapChainDesc.SampleDesc.Quality = 0;
- swapChainDesc.Windowed = TRUE;
-- HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, &mSwapChain);
+#if !defined(ANGLE_OS_WINRT)
-+ result = factory->CreateSwapChain(device, &swapChainDesc, &mSwapChain);
+ HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, &mSwapChain);
+#else
+ IDXGISwapChain1 *swapChain;
+ result = factory->CreateSwapChainForCoreWindow(device, mWindow, &swapChainDesc, NULL, &swapChain);
@@ -980,10 +1071,28 @@ index 0da58cb..0797fd7 100644
if (FAILED(result))
{
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.h b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.h
+@@ -390,6 +415,7 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
+ {
+ return EGL_CONTEXT_LOST;
+ }
++#if !defined(ANGLE_OS_WINRT)
+ else
+ {
+ // We cannot create a swap chain for an HWND that is owned by a different process on some versions of
+@@ -408,6 +434,9 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
+ return EGL_BAD_ALLOC;
+ }
+ }
++#else
++ return EGL_BAD_ALLOC;
++#endif
+ }
+
+ result = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mBackBufferTexture);
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h
index 8001046..2a030c8 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.h
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.h
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h
@@ -19,7 +19,7 @@ class Renderer11;
class SwapChain11 : public SwapChain
{
@@ -993,52 +1102,89 @@ index 8001046..2a030c8 100644
GLenum backBufferFormat, GLenum depthBufferFormat);
virtual ~SwapChain11();
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl
+index 042ac69..cb132dc 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl
+@@ -12,10 +12,12 @@ struct PS_OutputMultiple
+ float4 color1 : SV_TARGET1;
+ float4 color2 : SV_TARGET2;
+ float4 color3 : SV_TARGET3;
++#ifdef SM4
+ float4 color4 : SV_TARGET4;
+ float4 color5 : SV_TARGET5;
+ float4 color6 : SV_TARGET6;
+ float4 color7 : SV_TARGET7;
++#endif
+ };
+
+ PS_OutputMultiple PS_ClearMultiple(in float4 inPosition : SV_POSITION, in float4 inColor : COLOR)
+@@ -25,10 +27,12 @@ PS_OutputMultiple PS_ClearMultiple(in float4 inPosition : SV_POSITION, in float4
+ outColor.color1 = inColor;
+ outColor.color2 = inColor;
+ outColor.color3 = inColor;
++#ifdef SM4
+ outColor.color4 = inColor;
+ outColor.color5 = inColor;
+ outColor.color6 = inColor;
+ outColor.color7 = inColor;
++#endif
+ return outColor;
+ }
+
diff --git a/src/3rdparty/angle/src/libGLESv2/utilities.cpp b/src/3rdparty/angle/src/libGLESv2/utilities.cpp
-index 32df49e..8fd193b 100644
+index 32df49e..30765ff 100644
--- a/src/3rdparty/angle/src/libGLESv2/utilities.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/utilities.cpp
-@@ -10,6 +10,14 @@
+@@ -9,6 +9,14 @@
+
#include "libGLESv2/utilities.h"
#include "libGLESv2/mathutil.h"
-
+#if defined(ANGLE_OS_WINRT)
-+#include <locale>
-+#include <codecvt>
-+#include <wrl.h>
-+#include <windows.storage.h>
-+using namespace ABI::Windows::Storage;
++# include <locale>
++# include <codecvt>
++# include <wrl.h>
++# include <windows.storage.h>
++ using namespace Microsoft::WRL;
++ using namespace ABI::Windows::Storage;
+#endif
-+
+
namespace gl
{
-
-@@ -737,7 +745,50 @@ bool IsTriangleMode(GLenum drawMode)
+@@ -737,6 +745,7 @@ bool IsTriangleMode(GLenum drawMode)
std::string getTempPath()
{
-+#if defined(ANGLE_OS_WINRT)
-+
++#if !defined(ANGLE_OS_WINRT)
+ char path[MAX_PATH];
+ DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path);
+ if (pathLen == 0)
+@@ -751,6 +760,45 @@ std::string getTempPath()
+ UNREACHABLE();
+ return std::string();
+ }
++#else
+ static std::string path;
+
+ while (path.empty()) {
-+ IApplicationDataStatics *applicationDataFactory;
-+ HRESULT result = RoGetActivationFactory(Microsoft::WRL::Wrappers::HStringReference(RuntimeClass_Windows_Storage_ApplicationData).Get(),
-+ IID_PPV_ARGS(&applicationDataFactory));
++ ComPtr<IApplicationDataStatics> factory;
++ Wrappers::HStringReference classId(RuntimeClass_Windows_Storage_ApplicationData);
++ HRESULT result = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(result))
+ break;
+
-+ IApplicationData *applicationData;
-+ result = applicationDataFactory->get_Current(&applicationData);
++ ComPtr<IApplicationData> applicationData;
++ result = factory->get_Current(&applicationData);
+ if (FAILED(result))
+ break;
+
-+ IStorageFolder *storageFolder;
++ ComPtr<IStorageFolder> storageFolder;
+ result = applicationData->get_LocalFolder(&storageFolder);
+ if (FAILED(result))
+ break;
+
-+ IStorageItem *localFolder;
-+ result = storageFolder->QueryInterface(IID_PPV_ARGS(&localFolder));
++ ComPtr<IStorageItem> localFolder;
++ result = storageFolder.As(&localFolder);
+ if (FAILED(result))
+ break;
+
@@ -1055,77 +1201,10 @@ index 32df49e..8fd193b 100644
+ break;
+ }
+ }
-+
-+#else
-+
- char path[MAX_PATH];
-+
- DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path);
- if (pathLen == 0)
- {
-@@ -751,6 +802,8 @@ std::string getTempPath()
- UNREACHABLE();
- return std::string();
- }
-+
+#endif
return path;
}
-diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri
-index a94b9a6..12e26a9 100644
---- a/src/angle/src/common/common.pri
-+++ b/src/angle/src/common/common.pri
-@@ -7,7 +7,7 @@ INCLUDEPATH += \
- LIBS = $$QMAKE_LIBS_CORE $$QMAKE_LIBS_GUI
-
- # DirectX is included in the Windows 8 Kit, but everything else requires the DX SDK.
--win32-msvc2012 {
-+win32-msvc2012|winrt {
- FXC = fxc.exe
- } else {
- DX_DIR = $$(DXSDK_DIR)
-diff --git a/src/angle/src/compiler/translator_common.pro b/src/angle/src/compiler/translator_common.pro
-index b281215..5581c9d 100644
---- a/src/angle/src/compiler/translator_common.pro
-+++ b/src/angle/src/compiler/translator_common.pro
-@@ -78,7 +78,6 @@ SOURCES += \
- $$ANGLE_DIR/src/compiler/intermOut.cpp \
- $$ANGLE_DIR/src/compiler/IntermTraverse.cpp \
- $$ANGLE_DIR/src/compiler/MapLongVariableNames.cpp \
-- $$ANGLE_DIR/src/compiler/ossource_win.cpp \
- $$ANGLE_DIR/src/compiler/parseConst.cpp \
- $$ANGLE_DIR/src/compiler/ParseHelper.cpp \
- $$ANGLE_DIR/src/compiler/PoolAlloc.cpp \
-@@ -98,6 +97,12 @@ SOURCES += \
- $$ANGLE_DIR/src/compiler/timing/RestrictVertexShaderTiming.cpp \
- $$ANGLE_DIR/src/third_party/compiler/ArrayBoundsClamper.cpp
-
-+winrt {
-+ SOURCES += $$ANGLE_DIR/src/compiler/ossource_winrt.cpp
-+} else {
-+ SOURCES += $$ANGLE_DIR/src/compiler/ossource_win.cpp
-+}
-+
- # NOTE: 'win_flex' and 'bison' can be found in qt5/gnuwin32/bin
- flex.commands = $$addGnuPath(win_flex) --noline --nounistd --outfile=${QMAKE_FILE_BASE}_lex.cpp ${QMAKE_FILE_NAME}
- flex.output = ${QMAKE_FILE_BASE}_lex.cpp
-diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri
-index 1c6d8b0..ed25581 100644
---- a/src/angle/src/config.pri
-+++ b/src/angle/src/config.pri
-@@ -37,8 +37,9 @@ DEFINES += _WINDOWS \
- NOMINMAX \
- WIN32_LEAN_AND_MEAN=1
-
--# Defines specifying the API version (0x0600 = Vista)
--DEFINES += _WIN32_WINNT=0x0600 WINVER=0x0600
-+# Defines specifying the API version (0x0600 = Vista, 0x0602 = Win8))
-+winrt: DEFINES += _WIN32_WINNT=0x0602 WINVER=0x0602
-+else: DEFINES += _WIN32_WINNT=0x0600 WINVER=0x0600
-
- # ANGLE specific defines
- DEFINES += ANGLE_DISABLE_TRACE \
--
1.8.4.msysgit.0
diff --git a/src/angle/patches/0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch b/src/angle/patches/0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch
new file mode 100644
index 0000000000..34c881ba21
--- /dev/null
+++ b/src/angle/patches/0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch
@@ -0,0 +1,426 @@
+From e84f947df4ae095eae600550749b3a4e8de5ee8b Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@digia.com>
+Date: Thu, 20 Feb 2014 16:51:36 +0200
+Subject: [PATCH] ANGLE: Enable D3D11 for feature level 9 cards
+
+Enable use of ANGLE on lower-end hardware, such as Surface RT and
+Windows Phone 8.
+
+Based on https://codereview.appspot.com/12917046/
+
+Change-Id: Ice536802e4eedc1d264abd0dd65960638fce59e4
+---
+ .../angle/src/libGLESv2/renderer/d3d11/Image11.cpp | 7 +-
+ .../libGLESv2/renderer/d3d11/RenderStateCache.cpp | 5 +-
+ .../src/libGLESv2/renderer/d3d11/Renderer11.cpp | 90 ++++++++++++++++++++--
+ .../src/libGLESv2/renderer/d3d11/Renderer11.h | 1 +
+ .../libGLESv2/renderer/d3d11/TextureStorage11.cpp | 10 +--
+ .../libGLESv2/renderer/d3d11/renderer11_utils.cpp | 4 +-
+ .../libGLESv2/renderer/d3d11/renderer11_utils.h | 2 +-
+ 7 files changed, 100 insertions(+), 19 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.cpp
+index 2b07b9d..5d039a3 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Image11.cpp
+@@ -142,7 +142,7 @@ bool Image11::redefine(Renderer *renderer, GLint internalformat, GLsizei width,
+ mHeight = height;
+ mInternalFormat = internalformat;
+ // compute the d3d format that will be used
+- mDXGIFormat = gl_d3d11::ConvertTextureFormat(internalformat);
++ mDXGIFormat = gl_d3d11::ConvertTextureFormat(internalformat, mRenderer->getFeatureLevel());
+ mActualFormat = d3d11_gl::ConvertTextureInternalFormat(mDXGIFormat);
+
+ if (mStagingTexture)
+@@ -191,7 +191,10 @@ void Image11::loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heig
+ switch (mInternalFormat)
+ {
+ case GL_ALPHA8_EXT:
+- loadAlphaDataToNative(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
++ if (mRenderer->getFeatureLevel() >= D3D_FEATURE_LEVEL_10_0)
++ loadAlphaDataToNative(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
++ else
++ loadAlphaDataToBGRA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
+ break;
+ case GL_LUMINANCE8_EXT:
+ loadLuminanceDataToNativeOrBGRA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData, false);
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp
+index 0047e04..a1c324c 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp
+@@ -419,7 +419,8 @@ ID3D11SamplerState *RenderStateCache::getSamplerState(const gl::SamplerState &sa
+ samplerDesc.BorderColor[2] = 0.0f;
+ samplerDesc.BorderColor[3] = 0.0f;
+ samplerDesc.MinLOD = gl_d3d11::ConvertMinLOD(samplerState.minFilter, samplerState.lodOffset);
+- samplerDesc.MaxLOD = gl_d3d11::ConvertMaxLOD(samplerState.minFilter, samplerState.lodOffset);
++ samplerDesc.MaxLOD = mDevice->GetFeatureLevel() >= D3D_FEATURE_LEVEL_10_0
++ ? gl_d3d11::ConvertMaxLOD(samplerState.minFilter, samplerState.lodOffset) : FLT_MAX;
+
+ ID3D11SamplerState *dx11SamplerState = NULL;
+ HRESULT result = mDevice->CreateSamplerState(&samplerDesc, &dx11SamplerState);
+@@ -435,4 +436,4 @@ ID3D11SamplerState *RenderStateCache::getSamplerState(const gl::SamplerState &sa
+ }
+ }
+
+-}
+\ No newline at end of file
++}
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp
+index 7f166fd..31d976d 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp
+@@ -164,6 +164,11 @@ EGLint Renderer11::initialize()
+ D3D_FEATURE_LEVEL_11_0,
+ D3D_FEATURE_LEVEL_10_1,
+ D3D_FEATURE_LEVEL_10_0,
++#if !defined(ANGLE_ENABLE_D3D9)
++ D3D_FEATURE_LEVEL_9_3,
++ D3D_FEATURE_LEVEL_9_2,
++ D3D_FEATURE_LEVEL_9_1,
++#endif
+ };
+
+ HRESULT result = S_OK;
+@@ -1533,7 +1538,7 @@ void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArra
+ }
+
+ // needed for the point sprite geometry shader
+- if (mCurrentGeometryConstantBuffer != mDriverConstantBufferPS)
++ if (mFeatureLevel >= D3D_FEATURE_LEVEL_10_0 && mCurrentGeometryConstantBuffer != mDriverConstantBufferPS)
+ {
+ mDeviceContext->GSSetConstantBuffers(0, 1, &mDriverConstantBufferPS);
+ mCurrentGeometryConstantBuffer = mDriverConstantBufferPS;
+@@ -1956,6 +1961,11 @@ bool Renderer11::testDeviceResettable()
+ D3D_FEATURE_LEVEL_11_0,
+ D3D_FEATURE_LEVEL_10_1,
+ D3D_FEATURE_LEVEL_10_0,
++#if !defined(ANGLE_ENABLE_D3D9)
++ D3D_FEATURE_LEVEL_9_3,
++ D3D_FEATURE_LEVEL_9_2,
++ D3D_FEATURE_LEVEL_9_1,
++#endif
+ };
+
+ ID3D11Device* dummyDevice;
+@@ -2139,6 +2149,11 @@ float Renderer11::getTextureMaxAnisotropy() const
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_MAX_MAXANISOTROPY;
++ case D3D_FEATURE_LEVEL_9_3:
++ case D3D_FEATURE_LEVEL_9_2:
++ return 16;
++ case D3D_FEATURE_LEVEL_9_1:
++ return D3D_FL9_1_DEFAULT_MAX_ANISOTROPY;
+ default: UNREACHABLE();
+ return 0;
+ }
+@@ -2158,6 +2173,11 @@ Range Renderer11::getViewportBounds() const
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return Range(D3D10_VIEWPORT_BOUNDS_MIN, D3D10_VIEWPORT_BOUNDS_MAX);
++ case D3D_FEATURE_LEVEL_9_3:
++ return Range(D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION * -2, D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION * 2);
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1:
++ return Range(D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION * -2, D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION * 2);
+ default: UNREACHABLE();
+ return Range(0, 0);
+ }
+@@ -2172,6 +2192,10 @@ unsigned int Renderer11::getMaxVertexTextureImageUnits() const
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return MAX_TEXTURE_IMAGE_UNITS_VTF_SM4;
++ case D3D_FEATURE_LEVEL_9_3:
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1:
++ return 0;
+ default: UNREACHABLE();
+ return 0;
+ }
+@@ -2195,14 +2219,14 @@ unsigned int Renderer11::getReservedFragmentUniformVectors() const
+ unsigned int Renderer11::getMaxVertexUniformVectors() const
+ {
+ META_ASSERT(MAX_VERTEX_UNIFORM_VECTORS_D3D11 <= D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT);
+- ASSERT(mFeatureLevel >= D3D_FEATURE_LEVEL_10_0);
++ ASSERT(mFeatureLevel >= D3D_FEATURE_LEVEL_9_1);
+ return MAX_VERTEX_UNIFORM_VECTORS_D3D11;
+ }
+
+ unsigned int Renderer11::getMaxFragmentUniformVectors() const
+ {
+ META_ASSERT(MAX_FRAGMENT_UNIFORM_VECTORS_D3D11 <= D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT);
+- ASSERT(mFeatureLevel >= D3D_FEATURE_LEVEL_10_0);
++ ASSERT(mFeatureLevel >= D3D_FEATURE_LEVEL_9_1);
+ return MAX_FRAGMENT_UNIFORM_VECTORS_D3D11;
+ }
+
+@@ -2216,6 +2240,10 @@ unsigned int Renderer11::getMaxVaryingVectors() const
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_VS_OUTPUT_REGISTER_COUNT;
++ case D3D_FEATURE_LEVEL_9_3:
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1:
++ return 8;
+ default: UNREACHABLE();
+ return 0;
+ }
+@@ -2229,6 +2257,10 @@ bool Renderer11::getNonPower2TextureSupport() const
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return true;
++ case D3D_FEATURE_LEVEL_9_3:
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1:
++ return false;
+ default: UNREACHABLE();
+ return false;
+ }
+@@ -2242,6 +2274,11 @@ bool Renderer11::getOcclusionQuerySupport() const
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return true;
++ case D3D_FEATURE_LEVEL_9_3:
++ case D3D_FEATURE_LEVEL_9_2:
++ return true;
++ case D3D_FEATURE_LEVEL_9_1:
++ return false;
+ default: UNREACHABLE();
+ return false;
+ }
+@@ -2254,7 +2291,11 @@ bool Renderer11::getInstancingSupport() const
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+- return true;
++ case D3D_FEATURE_LEVEL_9_3:
++ return true;
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1:
++ return false;
+ default: UNREACHABLE();
+ return false;
+ }
+@@ -2276,6 +2317,11 @@ bool Renderer11::getDerivativeInstructionSupport() const
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return true;
++ case D3D_FEATURE_LEVEL_9_3:
++ return true;
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1:
++ return false;
+ default: UNREACHABLE();
+ return false;
+ }
+@@ -2294,6 +2340,9 @@ int Renderer11::getMajorShaderModel() const
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MAJOR_VERSION; // 5
+ case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MAJOR_VERSION; // 4
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MAJOR_VERSION; // 4
++ case D3D_FEATURE_LEVEL_9_3:
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1: return D3D10_SHADER_MAJOR_VERSION; // 4 (level 9)
+ default: UNREACHABLE(); return 0;
+ }
+ }
+@@ -2305,6 +2354,9 @@ int Renderer11::getMinorShaderModel() const
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MINOR_VERSION; // 0
+ case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MINOR_VERSION; // 1
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MINOR_VERSION; // 0
++ case D3D_FEATURE_LEVEL_9_3:
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1: return D3D10_SHADER_MINOR_VERSION; // 0 (level 9)
+ default: UNREACHABLE(); return 0;
+ }
+ }
+@@ -2330,6 +2382,11 @@ int Renderer11::getMaxViewportDimension() const
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192
++ case D3D_FEATURE_LEVEL_9_3:
++ return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 4096
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1:
++ return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 2048
+ default: UNREACHABLE();
+ return 0;
+ }
+@@ -2342,6 +2399,9 @@ int Renderer11::getMaxTextureWidth() const
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192
++ case D3D_FEATURE_LEVEL_9_3: return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 4096
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1: return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 2048
+ default: UNREACHABLE(); return 0;
+ }
+ }
+@@ -2353,6 +2413,9 @@ int Renderer11::getMaxTextureHeight() const
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192
++ case D3D_FEATURE_LEVEL_9_3: return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 4096
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1: return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 2048
+ default: UNREACHABLE(); return 0;
+ }
+ }
+@@ -2364,6 +2427,9 @@ bool Renderer11::get32BitIndexSupport() const
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP >= 32; // true
++ case D3D_FEATURE_LEVEL_9_3:
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1: return false;
+ default: UNREACHABLE(); return false;
+ }
+ }
+@@ -2410,6 +2476,8 @@ unsigned int Renderer11::getMaxRenderTargets() const
+ {
+ META_ASSERT(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT <= gl::IMPLEMENTATION_MAX_DRAW_BUFFERS);
+ META_ASSERT(D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT <= gl::IMPLEMENTATION_MAX_DRAW_BUFFERS);
++ META_ASSERT(D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT <= gl::IMPLEMENTATION_MAX_DRAW_BUFFERS);
++ META_ASSERT(D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT <= gl::IMPLEMENTATION_MAX_DRAW_BUFFERS);
+
+ switch (mFeatureLevel)
+ {
+@@ -2417,6 +2485,9 @@ unsigned int Renderer11::getMaxRenderTargets() const
+ return D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; // 8
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
++ case D3D_FEATURE_LEVEL_9_3: // return D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT; // 4
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1: // return D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT; // 1
+ // Feature level 10.0 and 10.1 cards perform very poorly when the pixel shader
+ // outputs to multiple RTs that are not bound.
+ // TODO: Remove pixel shader outputs for render targets that are not bound.
+@@ -2603,7 +2674,7 @@ bool Renderer11::copyTexture(ID3D11ShaderResourceView *source, const gl::Rectang
+ samplerDesc.BorderColor[2] = 0.0f;
+ samplerDesc.BorderColor[3] = 0.0f;
+ samplerDesc.MinLOD = 0.0f;
+- samplerDesc.MaxLOD = 0.0f;
++ samplerDesc.MaxLOD = mDevice->GetFeatureLevel() >= D3D_FEATURE_LEVEL_10_0 ? 0.0f : FLT_MAX;
+
+ result = mDevice->CreateSamplerState(&samplerDesc, &mCopySampler);
+ ASSERT(SUCCEEDED(result));
+@@ -2848,7 +2919,7 @@ ShaderExecutable *Renderer11::loadExecutable(const void *function, size_t length
+
+ ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround)
+ {
+- const char *profile = NULL;
++ std::string profile;
+
+ switch (type)
+ {
+@@ -2866,7 +2937,12 @@ ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const ch
+ return NULL;
+ }
+
+- ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, D3DCOMPILE_OPTIMIZATION_LEVEL0, false);
++ if (mFeatureLevel == D3D_FEATURE_LEVEL_9_3)
++ profile += "_level_9_3";
++ else if (mFeatureLevel == D3D_FEATURE_LEVEL_9_2 || mFeatureLevel == D3D_FEATURE_LEVEL_9_1)
++ profile += "_level_9_1";
++
++ ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile.c_str(), D3DCOMPILE_OPTIMIZATION_LEVEL0, false);
+ if (!binary)
+ return NULL;
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h
+index ba3f0c6..a8a722c 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/Renderer11.h
+@@ -177,6 +177,7 @@ class Renderer11 : public Renderer
+ ID3D11Device *getDevice() { return mDevice; }
+ ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; };
+ IDXGIFactory *getDxgiFactory() { return mDxgiFactory; };
++ D3D_FEATURE_LEVEL getFeatureLevel() { return mFeatureLevel; }
+
+ bool getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource);
+ void unapplyRenderTargets();
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
+index 5f6ea21..fdfbe52 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
+@@ -222,14 +222,14 @@ TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, SwapChain11 *swapch
+ }
+
+ TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
+- : TextureStorage11(renderer, GetTextureBindFlags(gl_d3d11::ConvertTextureFormat(internalformat), usage, forceRenderable))
++ : TextureStorage11(renderer, GetTextureBindFlags(gl_d3d11::ConvertTextureFormat(internalformat, Renderer11::makeRenderer11(renderer)->getFeatureLevel()), usage, forceRenderable))
+ {
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mRenderTarget[i] = NULL;
+ }
+
+- DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat);
++ DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat, mRenderer->getFeatureLevel());
+ if (d3d11::IsDepthStencilFormat(convertedFormat))
+ {
+ mTextureFormat = d3d11::GetDepthTextureFormat(convertedFormat);
+@@ -331,7 +331,7 @@ RenderTarget *TextureStorage11_2D::getRenderTarget(int level)
+ srvDesc.Format = mShaderResourceFormat;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ srvDesc.Texture2D.MostDetailedMip = level;
+- srvDesc.Texture2D.MipLevels = 1;
++ srvDesc.Texture2D.MipLevels = level ? 1 : -1;
+
+ ID3D11ShaderResourceView *srv;
+ result = device->CreateShaderResourceView(mTexture, &srvDesc, &srv);
+@@ -440,7 +440,7 @@ void TextureStorage11_2D::generateMipmap(int level)
+ }
+
+ TextureStorage11_Cube::TextureStorage11_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
+- : TextureStorage11(renderer, GetTextureBindFlags(gl_d3d11::ConvertTextureFormat(internalformat), usage, forceRenderable))
++ : TextureStorage11(renderer, GetTextureBindFlags(gl_d3d11::ConvertTextureFormat(internalformat, Renderer11::makeRenderer11(renderer)->getFeatureLevel()), usage, forceRenderable))
+ {
+ for (unsigned int i = 0; i < 6; i++)
+ {
+@@ -450,7 +450,7 @@ TextureStorage11_Cube::TextureStorage11_Cube(Renderer *renderer, int levels, GLe
+ }
+ }
+
+- DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat);
++ DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat, mRenderer->getFeatureLevel());
+ if (d3d11::IsDepthStencilFormat(convertedFormat))
+ {
+ mTextureFormat = d3d11::GetDepthTextureFormat(convertedFormat);
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp
+index 6f06024..34b8259 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp
+@@ -329,7 +329,7 @@ DXGI_FORMAT ConvertRenderbufferFormat(GLenum format)
+ return DXGI_FORMAT_R8G8B8A8_UNORM;
+ }
+
+-DXGI_FORMAT ConvertTextureFormat(GLenum internalformat)
++DXGI_FORMAT ConvertTextureFormat(GLenum internalformat, D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (internalformat)
+ {
+@@ -342,7 +342,7 @@ DXGI_FORMAT ConvertTextureFormat(GLenum internalformat)
+ case GL_LUMINANCE8_ALPHA8_EXT:
+ return DXGI_FORMAT_R8G8B8A8_UNORM;
+ case GL_ALPHA8_EXT:
+- return DXGI_FORMAT_A8_UNORM;
++ return featureLevel >= D3D_FEATURE_LEVEL_10_0 ? DXGI_FORMAT_A8_UNORM : DXGI_FORMAT_B8G8R8A8_UNORM;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ return DXGI_FORMAT_BC1_UNORM;
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h
+index 1bc48c1..70ad4fe 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h
+@@ -32,7 +32,7 @@ FLOAT ConvertMinLOD(GLenum minFilter, unsigned int lodOffset);
+ FLOAT ConvertMaxLOD(GLenum minFilter, unsigned int lodOffset);
+
+ DXGI_FORMAT ConvertRenderbufferFormat(GLenum format);
+-DXGI_FORMAT ConvertTextureFormat(GLenum format);
++DXGI_FORMAT ConvertTextureFormat(GLenum format, D3D_FEATURE_LEVEL featureLevel);
+ }
+
+ namespace d3d11_gl
+--
+1.8.4.msysgit.0
+
diff --git a/src/angle/patches/0011-ANGLE-Fix-compilation-error-on-MinGW-caused-by-trace.patch b/src/angle/patches/0011-ANGLE-Fix-compilation-error-on-MinGW-caused-by-trace.patch
new file mode 100644
index 0000000000..fdee11d324
--- /dev/null
+++ b/src/angle/patches/0011-ANGLE-Fix-compilation-error-on-MinGW-caused-by-trace.patch
@@ -0,0 +1,37 @@
+From 8ea24fcce69900f42299fd01772714a566f9111e Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@digia.com>
+Date: Mon, 24 Feb 2014 11:08:23 +0200
+Subject: [PATCH] ANGLE: Fix compilation error on MinGW caused by trace_event.h
+
+The event trace header in ANGLE's third_party directory has an unused
+template which causes a compilation error on MinGW. Disable this part
+of the code.
+
+Change-Id: I167eac56507fafba34e3eb5ce6071d8f136a4e41
+---
+ src/3rdparty/angle/src/third_party/trace_event/trace_event.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
+index 637cf9a..96ac910 100644
+--- a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
++++ b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
+@@ -791,6 +791,7 @@ private:
+ // TraceEventSamplingStateScope records the current sampling state
+ // and sets a new sampling state. When the scope exists, it restores
+ // the sampling state having recorded.
++#if 0 // This is not used by ANGLE and causes a compilation error on MinGW
+ template<size_t BucketNumber>
+ class SamplingStateScope {
+ public:
+@@ -818,6 +819,7 @@ public:
+ private:
+ const char* m_previousState;
+ };
++#endif
+
+ } // namespace TraceEvent
+
+--
+1.8.4.msysgit.0
+
diff --git a/src/angle/patches/0012-ANGLE-fix-semantic-index-lookup.patch b/src/angle/patches/0012-ANGLE-fix-semantic-index-lookup.patch
new file mode 100644
index 0000000000..fe16d1d7b2
--- /dev/null
+++ b/src/angle/patches/0012-ANGLE-fix-semantic-index-lookup.patch
@@ -0,0 +1,48 @@
+From 15b694fa33cf76f93de62b8106972083f5fb3114 Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@digia.com>
+Date: Fri, 21 Feb 2014 13:34:21 +0200
+Subject: [PATCH] ANGLE: fix semantic index lookup
+
+The sorted semantic index table was returning a direct mapping to the
+new indices, instead of the old indices. This caused a mismatch in the
+GL type lookup for the translated attribute.
+
+Change-Id: I75d05ed707f56c45210e3dcbc277f894e3dc5a48
+---
+ src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp | 2 +-
+ src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp b/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
+index 41a83b6..13c515a 100644
+--- a/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
+@@ -2643,7 +2643,7 @@ void ProgramBinary::sortAttributesByLayout(rx::TranslatedAttribute attributes[MA
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ int oldIndex = mAttributesByLayout[i];
+- sortedSemanticIndices[i] = mSemanticIndex[oldIndex];
++ sortedSemanticIndices[i] = oldIndex;
+ attributes[i] = oldTranslatedAttributes[oldIndex];
+ }
+ }
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp
+index 3418e89..4940b8c 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp
+@@ -103,10 +103,10 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
+ // Record the type of the associated vertex shader vector in our key
+ // This will prevent mismatched vertex shaders from using the same input layout
+ GLint attributeSize;
+- programBinary->getActiveAttribute(ilKey.elementCount, 0, NULL, &attributeSize, &ilKey.elements[ilKey.elementCount].glslElementType, NULL);
++ programBinary->getActiveAttribute(sortedSemanticIndices[i], 0, NULL, &attributeSize, &ilKey.elements[ilKey.elementCount].glslElementType, NULL);
+
+ ilKey.elements[ilKey.elementCount].desc.SemanticName = semanticName;
+- ilKey.elements[ilKey.elementCount].desc.SemanticIndex = sortedSemanticIndices[i];
++ ilKey.elements[ilKey.elementCount].desc.SemanticIndex = i;
+ ilKey.elements[ilKey.elementCount].desc.Format = attributes[i].attribute->mArrayEnabled ? vertexBuffer->getDXGIFormat(*attributes[i].attribute) : DXGI_FORMAT_R32G32B32A32_FLOAT;
+ ilKey.elements[ilKey.elementCount].desc.InputSlot = i;
+ ilKey.elements[ilKey.elementCount].desc.AlignedByteOffset = 0;
+--
+1.8.4.msysgit.0
+
diff --git a/src/angle/patches/0013-ANGLE-Allow-for-universal-program-binaries.patch b/src/angle/patches/0013-ANGLE-Allow-for-universal-program-binaries.patch
new file mode 100644
index 0000000000..11c32880df
--- /dev/null
+++ b/src/angle/patches/0013-ANGLE-Allow-for-universal-program-binaries.patch
@@ -0,0 +1,93 @@
+From 5eeb4a06f182b4fc0e3dcb82f47fcf4286890f94 Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@digia.com>
+Date: Fri, 21 Feb 2014 08:35:01 +0200
+Subject: [PATCH] ANGLE: Allow for universal program binaries
+
+As a safety precaution, ANGLE writes the commit hash, optimization level,
+and adapter ID to its binary format. However, this hurts portability
+between systems by making shader pre-compilation/caching artificially
+system-specific.
+
+The shader compiler doesn't take the target adapter into account, and the
+optimization level information discarded by ANGLE anyway. So, allow ANGLE
+to bypass these checks on systems where precompilation is required (i.e.
+WinRT). The default mechanism still applies unless
+ANGLE_ENABLE_UNIVERSAL_BINARY is passed as a define.
+
+Change-Id: Iec6d833fd7010ed163978557238f00e7ac6ae416
+---
+ src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp b/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
+index 8896665..41a83b6 100644
+--- a/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
+@@ -1637,6 +1637,7 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
+ return false;
+ }
+
++#if !defined(ANGLE_ENABLE_UNIVERSAL_BINARY)
+ unsigned char commitString[ANGLE_COMMIT_HASH_SIZE];
+ stream.read(commitString, ANGLE_COMMIT_HASH_SIZE);
+ if (memcmp(commitString, ANGLE_COMMIT_HASH, sizeof(unsigned char) * ANGLE_COMMIT_HASH_SIZE) != 0)
+@@ -1652,6 +1653,7 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
+ infoLog.append("Mismatched compilation flags.");
+ return false;
+ }
++#endif
+
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
+ {
+@@ -1742,6 +1744,7 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
+
+ const char *ptr = (const char*) binary + stream.offset();
+
++#if !defined(ANGLE_ENABLE_UNIVERSAL_BINARY)
+ const GUID *binaryIdentifier = (const GUID *) ptr;
+ ptr += sizeof(GUID);
+
+@@ -1751,6 +1754,7 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
+ infoLog.append("Invalid program binary.");
+ return false;
+ }
++#endif
+
+ const char *pixelShaderFunction = ptr;
+ ptr += pixelShaderSize;
+@@ -1808,9 +1812,10 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
+ stream.write(GL_PROGRAM_BINARY_ANGLE);
+ stream.write(ANGLE_MAJOR_VERSION);
+ stream.write(ANGLE_MINOR_VERSION);
++#if !defined(ANGLE_ENABLE_UNIVERSAL_BINARY)
+ stream.write(ANGLE_COMMIT_HASH, ANGLE_COMMIT_HASH_SIZE);
+ stream.write(ANGLE_COMPILE_OPTIMIZATION_LEVEL);
+-
++#endif
+ for (unsigned int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
+ {
+ stream.write(mLinkedAttribute[i].type);
+@@ -1866,7 +1871,9 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
+ UINT geometryShaderSize = (mGeometryExecutable != NULL) ? mGeometryExecutable->getLength() : 0;
+ stream.write(geometryShaderSize);
+
++#if !defined(ANGLE_ENABLE_UNIVERSAL_BINARY)
+ GUID identifier = mRenderer->getAdapterIdentifier();
++#endif
+
+ GLsizei streamLength = stream.length();
+ const void *streamData = stream.data();
+@@ -1889,8 +1896,10 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
+ memcpy(ptr, streamData, streamLength);
+ ptr += streamLength;
+
++#if !defined(ANGLE_ENABLE_UNIVERSAL_BINARY)
+ memcpy(ptr, &identifier, sizeof(GUID));
+ ptr += sizeof(GUID);
++#endif
+
+ memcpy(ptr, mPixelExecutable->getFunction(), pixelShaderSize);
+ ptr += pixelShaderSize;
+--
+1.8.4.msysgit.0
+
diff --git a/src/angle/patches/0013-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch b/src/angle/patches/0013-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch
deleted file mode 100644
index 0a8e403e8d..0000000000
--- a/src/angle/patches/0013-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch
+++ /dev/null
@@ -1,990 +0,0 @@
-From a71ccc033fe2cf1c3c58633d3bd220c52b744478 Mon Sep 17 00:00:00 2001
-From: Andrew Knight <andrew.knight@digia.com>
-Date: Fri, 8 Nov 2013 09:04:59 +0200
-Subject: [PATCH] ANGLE: Enable D3D11 for feature level 9 cards
-
-Enable use of ANGLE on lower-end hardware, such as Surface RT and
-Windows Phone 8.
-
-Based on https://codereview.appspot.com/12917046/
-
-Change-Id: Ice536802e4eedc1d264abd0dd65960638fce59e4
----
- src/3rdparty/angle/src/libGLESv2/Buffer.cpp | 8 +-
- src/3rdparty/angle/src/libGLESv2/Buffer.h | 4 +-
- src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp | 4 +-
- .../angle/src/libGLESv2/renderer/BufferStorage.h | 2 +-
- .../src/libGLESv2/renderer/BufferStorage11.cpp | 9 +-
- .../angle/src/libGLESv2/renderer/BufferStorage11.h | 2 +-
- .../src/libGLESv2/renderer/BufferStorage9.cpp | 2 +-
- .../angle/src/libGLESv2/renderer/BufferStorage9.h | 2 +-
- .../angle/src/libGLESv2/renderer/Image11.cpp | 7 +-
- .../angle/src/libGLESv2/renderer/IndexBuffer11.cpp | 4 +-
- .../src/libGLESv2/renderer/RenderStateCache.cpp | 3 +-
- .../angle/src/libGLESv2/renderer/Renderer11.cpp | 288 +++++++++++++++------
- .../angle/src/libGLESv2/renderer/Renderer11.h | 2 +
- .../angle/src/libGLESv2/renderer/SwapChain11.cpp | 7 +-
- .../src/libGLESv2/renderer/TextureStorage11.cpp | 8 +-
- .../src/libGLESv2/renderer/renderer11_utils.cpp | 4 +-
- .../src/libGLESv2/renderer/renderer11_utils.h | 2 +-
- .../src/libGLESv2/renderer/shaders/Clear11.hlsl | 4 +
- src/angle/src/libGLESv2/libGLESv2.pro | 8 +-
- 19 files changed, 260 insertions(+), 110 deletions(-)
-
-diff --git a/src/3rdparty/angle/src/libGLESv2/Buffer.cpp b/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
-index c007d5d..40baa95 100644
---- a/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/Buffer.cpp
-@@ -37,11 +37,11 @@ Buffer::~Buffer()
- delete mStaticIndexBuffer;
- }
-
--void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
-+void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage, GLenum target)
- {
- mBufferStorage->clear();
- mIndexRangeCache.clear();
-- mBufferStorage->setData(data, size, 0);
-+ mBufferStorage->setData(data, size, 0, target);
-
- mUsage = usage;
-
-@@ -54,9 +54,9 @@ void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
- }
- }
-
--void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
-+void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset, GLenum target)
- {
-- mBufferStorage->setData(data, size, offset);
-+ mBufferStorage->setData(data, size, offset, target);
- mIndexRangeCache.invalidateRange(offset, size);
-
- if ((mStaticVertexBuffer && mStaticVertexBuffer->getBufferSize() != 0) || (mStaticIndexBuffer && mStaticIndexBuffer->getBufferSize() != 0))
-diff --git a/src/3rdparty/angle/src/libGLESv2/Buffer.h b/src/3rdparty/angle/src/libGLESv2/Buffer.h
-index 4048f4b..9b86b97 100644
---- a/src/3rdparty/angle/src/libGLESv2/Buffer.h
-+++ b/src/3rdparty/angle/src/libGLESv2/Buffer.h
-@@ -33,8 +33,8 @@ class Buffer : public RefCountObject
-
- virtual ~Buffer();
-
-- void bufferData(const void *data, GLsizeiptr size, GLenum usage);
-- void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
-+ void bufferData(const void *data, GLsizeiptr size, GLenum usage, GLenum target);
-+ void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset, GLenum target);
-
- GLenum usage() const;
-
-diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp b/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
-index 320bbcc..91719f8 100644
---- a/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
-@@ -758,7 +758,7 @@ void __stdcall glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data,
- return gl::error(GL_INVALID_OPERATION);
- }
-
-- buffer->bufferData(data, size, usage);
-+ buffer->bufferData(data, size, usage, target);
- }
- }
- catch(std::bad_alloc&)
-@@ -812,7 +812,7 @@ void __stdcall glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size,
- return gl::error(GL_INVALID_VALUE);
- }
-
-- buffer->bufferSubData(data, size, offset);
-+ buffer->bufferSubData(data, size, offset, target);
- }
- }
- catch(std::bad_alloc&)
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h
-index ace1a11..14a8c27 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage.h
-@@ -22,7 +22,7 @@ class BufferStorage
-
- // The data returned is only guaranteed valid until next non-const method.
- virtual void *getData() = 0;
-- virtual void setData(const void* data, unsigned int size, unsigned int offset) = 0;
-+ virtual void setData(const void* data, unsigned int size, unsigned int offset, unsigned int target) = 0;
- virtual void clear() = 0;
- virtual unsigned int getSize() const = 0;
- virtual bool supportsDirectBinding() const = 0;
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp
-index 3647d8a..2f694db 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.cpp
-@@ -131,7 +131,7 @@ void *BufferStorage11::getData()
- return mResolvedData;
- }
-
--void BufferStorage11::setData(const void* data, unsigned int size, unsigned int offset)
-+void BufferStorage11::setData(const void* data, unsigned int size, unsigned int offset, unsigned int target)
- {
- ID3D11Device *device = mRenderer->getDevice();
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
-@@ -201,7 +201,10 @@ void BufferStorage11::setData(const void* data, unsigned int size, unsigned int
- D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = requiredBufferSize;
- bufferDesc.Usage = D3D11_USAGE_DEFAULT;
-- bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER | D3D11_BIND_INDEX_BUFFER;
-+ if (mRenderer->getFeatureLevel() > D3D_FEATURE_LEVEL_9_3)
-+ bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER | D3D11_BIND_INDEX_BUFFER;
-+ else
-+ bufferDesc.BindFlags = target == GL_ARRAY_BUFFER ? D3D11_BIND_VERTEX_BUFFER : D3D11_BIND_INDEX_BUFFER;
- bufferDesc.CPUAccessFlags = 0;
- bufferDesc.MiscFlags = 0;
- bufferDesc.StructureByteStride = 0;
-@@ -324,7 +327,7 @@ unsigned int BufferStorage11::getSize() const
-
- bool BufferStorage11::supportsDirectBinding() const
- {
-- return true;
-+ return mRenderer->getFeatureLevel() >= D3D_FEATURE_LEVEL_10_0;
- }
-
- void BufferStorage11::markBufferUsage()
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h
-index b62348b..c948962 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage11.h
-@@ -24,7 +24,7 @@ class BufferStorage11 : public BufferStorage
- static BufferStorage11 *makeBufferStorage11(BufferStorage *bufferStorage);
-
- virtual void *getData();
-- virtual void setData(const void* data, unsigned int size, unsigned int offset);
-+ virtual void setData(const void* data, unsigned int size, unsigned int offset, unsigned int target);
- virtual void clear();
- virtual unsigned int getSize() const;
- virtual bool supportsDirectBinding() const;
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.cpp
-index e69e7a8..57fd29b 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.cpp
-@@ -36,7 +36,7 @@ void *BufferStorage9::getData()
- return mMemory;
- }
-
--void BufferStorage9::setData(const void* data, unsigned int size, unsigned int offset)
-+void BufferStorage9::setData(const void* data, unsigned int size, unsigned int offset, unsigned int)
- {
- if (!mMemory || offset + size > mAllocatedSize)
- {
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.h b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.h
-index 3e80396..82ae577 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.h
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/BufferStorage9.h
-@@ -23,7 +23,7 @@ class BufferStorage9 : public BufferStorage
- static BufferStorage9 *makeBufferStorage9(BufferStorage *bufferStorage);
-
- virtual void *getData();
-- virtual void setData(const void* data, unsigned int size, unsigned int offset);
-+ virtual void setData(const void* data, unsigned int size, unsigned int offset, unsigned int target = 0);
- virtual void clear();
- virtual unsigned int getSize() const;
- virtual bool supportsDirectBinding() const;
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Image11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Image11.cpp
-index 09c8922..81e9e9e 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/Image11.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Image11.cpp
-@@ -136,7 +136,7 @@ bool Image11::redefine(Renderer *renderer, GLint internalformat, GLsizei width,
- mHeight = height;
- mInternalFormat = internalformat;
- // compute the d3d format that will be used
-- mDXGIFormat = gl_d3d11::ConvertTextureFormat(internalformat);
-+ mDXGIFormat = gl_d3d11::ConvertTextureFormat(internalformat, mRenderer->getFeatureLevel());
- mActualFormat = d3d11_gl::ConvertTextureInternalFormat(mDXGIFormat);
-
- if (mStagingTexture)
-@@ -185,7 +185,10 @@ void Image11::loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heig
- switch (mInternalFormat)
- {
- case GL_ALPHA8_EXT:
-- loadAlphaDataToNative(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
-+ if (mRenderer->getFeatureLevel() >= D3D_FEATURE_LEVEL_10_0)
-+ loadAlphaDataToNative(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
-+ else
-+ loadAlphaDataToBGRA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_LUMINANCE8_EXT:
- loadLuminanceDataToNativeOrBGRA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData, false);
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.cpp
-index 66604c4..36a62ad 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/IndexBuffer11.cpp
-@@ -170,7 +170,7 @@ DXGI_FORMAT IndexBuffer11::getIndexFormat() const
- {
- case GL_UNSIGNED_BYTE: return DXGI_FORMAT_R16_UINT;
- case GL_UNSIGNED_SHORT: return DXGI_FORMAT_R16_UINT;
-- case GL_UNSIGNED_INT: return DXGI_FORMAT_R32_UINT;
-+ case GL_UNSIGNED_INT: return mRenderer->get32BitIndexSupport() ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT;
- default: UNREACHABLE(); return DXGI_FORMAT_UNKNOWN;
- }
- }
-@@ -180,4 +180,4 @@ ID3D11Buffer *IndexBuffer11::getBuffer() const
- return mBuffer;
- }
-
--}
-\ No newline at end of file
-+}
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.cpp
-index b3111af..fd388df 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/RenderStateCache.cpp
-@@ -387,7 +387,8 @@ ID3D11SamplerState *RenderStateCache::getSamplerState(const gl::SamplerState &sa
- samplerDesc.BorderColor[2] = 0.0f;
- samplerDesc.BorderColor[3] = 0.0f;
- samplerDesc.MinLOD = gl_d3d11::ConvertMinLOD(samplerState.minFilter, samplerState.lodOffset);
-- samplerDesc.MaxLOD = gl_d3d11::ConvertMaxLOD(samplerState.minFilter, samplerState.lodOffset);
-+ samplerDesc.MaxLOD = mDevice->GetFeatureLevel() >= D3D_FEATURE_LEVEL_10_0
-+ ? gl_d3d11::ConvertMaxLOD(samplerState.minFilter, samplerState.lodOffset) : FLT_MAX;
-
- ID3D11SamplerState *dx11SamplerState = NULL;
- HRESULT result = mDevice->CreateSamplerState(&samplerDesc, &dx11SamplerState);
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp
-index d04467b..f83e9e9 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.cpp
-@@ -160,9 +160,13 @@ EGLint Renderer11::initialize()
-
- D3D_FEATURE_LEVEL featureLevels[] =
- {
-+ D3D_FEATURE_LEVEL_11_1,
- D3D_FEATURE_LEVEL_11_0,
- D3D_FEATURE_LEVEL_10_1,
- D3D_FEATURE_LEVEL_10_0,
-+ D3D_FEATURE_LEVEL_9_3,
-+ D3D_FEATURE_LEVEL_9_2,
-+ D3D_FEATURE_LEVEL_9_1,
- };
-
- HRESULT result = S_OK;
-@@ -1114,6 +1118,43 @@ void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLv
- }
- }
-
-+template <typename T>
-+static void drawLineLoopIndexed(T *data, GLenum type, const GLvoid *indices, GLsizei count)
-+{
-+ switch (type)
-+ {
-+ case GL_NONE: // Non-indexed draw
-+ for (int i = 0; i < count; i++)
-+ {
-+ data[i] = i;
-+ }
-+ data[count] = 0;
-+ break;
-+ case GL_UNSIGNED_BYTE:
-+ for (int i = 0; i < count; i++)
-+ {
-+ data[i] = static_cast<const GLubyte*>(indices)[i];
-+ }
-+ data[count] = static_cast<const GLubyte*>(indices)[0];
-+ break;
-+ case GL_UNSIGNED_SHORT:
-+ for (int i = 0; i < count; i++)
-+ {
-+ data[i] = static_cast<const GLushort*>(indices)[i];
-+ }
-+ data[count] = static_cast<const GLushort*>(indices)[0];
-+ break;
-+ case GL_UNSIGNED_INT:
-+ for (int i = 0; i < count; i++)
-+ {
-+ data[i] = static_cast<const GLuint*>(indices)[i];
-+ }
-+ data[count] = static_cast<const GLuint*>(indices)[0];
-+ break;
-+ default: UNREACHABLE();
-+ }
-+}
-+
- void Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer)
- {
- // Get the raw indices for an indexed draw
-@@ -1162,59 +1203,71 @@ void Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
-- unsigned int *data = reinterpret_cast<unsigned int*>(mappedMemory);
-+ if (get32BitIndexSupport())
-+ drawLineLoopIndexed(reinterpret_cast<unsigned int*>(mappedMemory), type, indices, count);
-+ else
-+ drawLineLoopIndexed(reinterpret_cast<unsigned short*>(mappedMemory), type, indices, count);
-+
- unsigned int indexBufferOffset = offset;
-
-+ if (!mLineLoopIB->unmapBuffer())
-+ {
-+ ERR("Could not unmap index buffer for GL_LINE_LOOP.");
-+ return gl::error(GL_OUT_OF_MEMORY);
-+ }
-+
-+ if (mAppliedIBSerial != mLineLoopIB->getSerial() || mAppliedIBOffset != indexBufferOffset)
-+ {
-+ IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mLineLoopIB->getIndexBuffer());
-+
-+ mDeviceContext->IASetIndexBuffer(indexBuffer->getBuffer(), indexBuffer->getIndexFormat(), indexBufferOffset);
-+ mAppliedIBSerial = mLineLoopIB->getSerial();
-+ mAppliedStorageIBSerial = 0;
-+ mAppliedIBOffset = indexBufferOffset;
-+ }
-+
-+ mDeviceContext->DrawIndexed(count + 1, 0, -minIndex);
-+}
-+
-+template <typename T>
-+static void drawTriangleFanIndexed(T *data, GLenum type, const GLvoid *indices, unsigned int numTris)
-+{
- switch (type)
- {
- case GL_NONE: // Non-indexed draw
-- for (int i = 0; i < count; i++)
-+ for (unsigned int i = 0; i < numTris; i++)
- {
-- data[i] = i;
-+ data[i*3 + 0] = 0;
-+ data[i*3 + 1] = i + 1;
-+ data[i*3 + 2] = i + 2;
- }
-- data[count] = 0;
- break;
- case GL_UNSIGNED_BYTE:
-- for (int i = 0; i < count; i++)
-+ for (unsigned int i = 0; i < numTris; i++)
- {
-- data[i] = static_cast<const GLubyte*>(indices)[i];
-+ data[i*3 + 0] = static_cast<const GLubyte*>(indices)[0];
-+ data[i*3 + 1] = static_cast<const GLubyte*>(indices)[i + 1];
-+ data[i*3 + 2] = static_cast<const GLubyte*>(indices)[i + 2];
- }
-- data[count] = static_cast<const GLubyte*>(indices)[0];
- break;
- case GL_UNSIGNED_SHORT:
-- for (int i = 0; i < count; i++)
-+ for (unsigned int i = 0; i < numTris; i++)
- {
-- data[i] = static_cast<const GLushort*>(indices)[i];
-+ data[i*3 + 0] = static_cast<const GLushort*>(indices)[0];
-+ data[i*3 + 1] = static_cast<const GLushort*>(indices)[i + 1];
-+ data[i*3 + 2] = static_cast<const GLushort*>(indices)[i + 2];
- }
-- data[count] = static_cast<const GLushort*>(indices)[0];
- break;
- case GL_UNSIGNED_INT:
-- for (int i = 0; i < count; i++)
-+ for (unsigned int i = 0; i < numTris; i++)
- {
-- data[i] = static_cast<const GLuint*>(indices)[i];
-+ data[i*3 + 0] = static_cast<const GLuint*>(indices)[0];
-+ data[i*3 + 1] = static_cast<const GLuint*>(indices)[i + 1];
-+ data[i*3 + 2] = static_cast<const GLuint*>(indices)[i + 2];
- }
-- data[count] = static_cast<const GLuint*>(indices)[0];
- break;
- default: UNREACHABLE();
- }
--
-- if (!mLineLoopIB->unmapBuffer())
-- {
-- ERR("Could not unmap index buffer for GL_LINE_LOOP.");
-- return gl::error(GL_OUT_OF_MEMORY);
-- }
--
-- if (mAppliedIBSerial != mLineLoopIB->getSerial() || mAppliedIBOffset != indexBufferOffset)
-- {
-- IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mLineLoopIB->getIndexBuffer());
--
-- mDeviceContext->IASetIndexBuffer(indexBuffer->getBuffer(), indexBuffer->getIndexFormat(), indexBufferOffset);
-- mAppliedIBSerial = mLineLoopIB->getSerial();
-- mAppliedStorageIBSerial = 0;
-- mAppliedIBOffset = indexBufferOffset;
-- }
--
-- mDeviceContext->DrawIndexed(count + 1, 0, -minIndex);
- }
-
- void Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer, int instances)
-@@ -1267,45 +1320,12 @@ void Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indic
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
-- unsigned int *data = reinterpret_cast<unsigned int*>(mappedMemory);
-- unsigned int indexBufferOffset = offset;
-+ if (get32BitIndexSupport())
-+ drawTriangleFanIndexed(reinterpret_cast<unsigned int*>(mappedMemory), type, indices, numTris);
-+ else
-+ drawTriangleFanIndexed(reinterpret_cast<unsigned short*>(mappedMemory), type, indices, numTris);
-
-- switch (type)
-- {
-- case GL_NONE: // Non-indexed draw
-- for (unsigned int i = 0; i < numTris; i++)
-- {
-- data[i*3 + 0] = 0;
-- data[i*3 + 1] = i + 1;
-- data[i*3 + 2] = i + 2;
-- }
-- break;
-- case GL_UNSIGNED_BYTE:
-- for (unsigned int i = 0; i < numTris; i++)
-- {
-- data[i*3 + 0] = static_cast<const GLubyte*>(indices)[0];
-- data[i*3 + 1] = static_cast<const GLubyte*>(indices)[i + 1];
-- data[i*3 + 2] = static_cast<const GLubyte*>(indices)[i + 2];
-- }
-- break;
-- case GL_UNSIGNED_SHORT:
-- for (unsigned int i = 0; i < numTris; i++)
-- {
-- data[i*3 + 0] = static_cast<const GLushort*>(indices)[0];
-- data[i*3 + 1] = static_cast<const GLushort*>(indices)[i + 1];
-- data[i*3 + 2] = static_cast<const GLushort*>(indices)[i + 2];
-- }
-- break;
-- case GL_UNSIGNED_INT:
-- for (unsigned int i = 0; i < numTris; i++)
-- {
-- data[i*3 + 0] = static_cast<const GLuint*>(indices)[0];
-- data[i*3 + 1] = static_cast<const GLuint*>(indices)[i + 1];
-- data[i*3 + 2] = static_cast<const GLuint*>(indices)[i + 2];
-- }
-- break;
-- default: UNREACHABLE();
-- }
-+ unsigned int indexBufferOffset = offset;
-
- if (!mTriangleFanIB->unmapBuffer())
- {
-@@ -1515,7 +1535,7 @@ void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArra
- }
-
- // needed for the point sprite geometry shader
-- if (mCurrentGeometryConstantBuffer != mDriverConstantBufferPS)
-+ if (mFeatureLevel >= D3D_FEATURE_LEVEL_10_0 && mCurrentGeometryConstantBuffer != mDriverConstantBufferPS)
- {
- mDeviceContext->GSSetConstantBuffers(0, 1, &mDriverConstantBufferPS);
- mCurrentGeometryConstantBuffer = mDriverConstantBufferPS;
-@@ -1929,9 +1949,13 @@ bool Renderer11::testDeviceResettable()
-
- D3D_FEATURE_LEVEL featureLevels[] =
- {
-+ D3D_FEATURE_LEVEL_11_1,
- D3D_FEATURE_LEVEL_11_0,
- D3D_FEATURE_LEVEL_10_1,
- D3D_FEATURE_LEVEL_10_0,
-+ D3D_FEATURE_LEVEL_9_3,
-+ D3D_FEATURE_LEVEL_9_2,
-+ D3D_FEATURE_LEVEL_9_1,
- };
-
- ID3D11Device* dummyDevice;
-@@ -2110,11 +2134,17 @@ float Renderer11::getTextureMaxAnisotropy() const
- {
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_MAX_MAXANISOTROPY;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_MAX_MAXANISOTROPY;
-+ case D3D_FEATURE_LEVEL_9_3:
-+ case D3D_FEATURE_LEVEL_9_2:
-+ return 16;
-+ case D3D_FEATURE_LEVEL_9_1:
-+ return D3D_FL9_1_DEFAULT_MAX_ANISOTROPY;
- default: UNREACHABLE();
- return 0;
- }
-@@ -2129,11 +2159,17 @@ Range Renderer11::getViewportBounds() const
- {
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return Range(D3D11_VIEWPORT_BOUNDS_MIN, D3D11_VIEWPORT_BOUNDS_MAX);
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return Range(D3D10_VIEWPORT_BOUNDS_MIN, D3D10_VIEWPORT_BOUNDS_MAX);
-+ case D3D_FEATURE_LEVEL_9_3:
-+ return Range(D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION * -2, D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION * 2);
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1:
-+ return Range(D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION * -2, D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION * 2);
- default: UNREACHABLE();
- return Range(0, 0);
- }
-@@ -2144,10 +2180,15 @@ unsigned int Renderer11::getMaxVertexTextureImageUnits() const
- META_ASSERT(MAX_TEXTURE_IMAGE_UNITS_VTF_SM4 <= gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS);
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return MAX_TEXTURE_IMAGE_UNITS_VTF_SM4;
-+ case D3D_FEATURE_LEVEL_9_3:
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1:
-+ return 0;
- default: UNREACHABLE();
- return 0;
- }
-@@ -2171,15 +2212,41 @@ unsigned int Renderer11::getReservedFragmentUniformVectors() const
- unsigned int Renderer11::getMaxVertexUniformVectors() const
- {
- META_ASSERT(MAX_VERTEX_UNIFORM_VECTORS_D3D11 <= D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT);
-- ASSERT(mFeatureLevel >= D3D_FEATURE_LEVEL_10_0);
-- return MAX_VERTEX_UNIFORM_VECTORS_D3D11;
-+ switch (mFeatureLevel)
-+ {
-+ case D3D_FEATURE_LEVEL_11_1:
-+ case D3D_FEATURE_LEVEL_11_0:
-+ case D3D_FEATURE_LEVEL_10_1:
-+ case D3D_FEATURE_LEVEL_10_0:
-+ return MAX_VERTEX_UNIFORM_VECTORS_D3D11;
-+ case D3D_FEATURE_LEVEL_9_3:
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1:
-+ return MAX_VERTEX_UNIFORM_VECTORS_D3D9;
-+ default:
-+ UNIMPLEMENTED();
-+ return 0;
-+ }
- }
-
- unsigned int Renderer11::getMaxFragmentUniformVectors() const
- {
- META_ASSERT(MAX_FRAGMENT_UNIFORM_VECTORS_D3D11 <= D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT);
-- ASSERT(mFeatureLevel >= D3D_FEATURE_LEVEL_10_0);
-- return MAX_FRAGMENT_UNIFORM_VECTORS_D3D11;
-+ switch (mFeatureLevel)
-+ {
-+ case D3D_FEATURE_LEVEL_11_1:
-+ case D3D_FEATURE_LEVEL_11_0:
-+ case D3D_FEATURE_LEVEL_10_1:
-+ case D3D_FEATURE_LEVEL_10_0:
-+ return MAX_FRAGMENT_UNIFORM_VECTORS_D3D11;
-+ case D3D_FEATURE_LEVEL_9_3:
-+ return 221;
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1:
-+ return 29;
-+ default: UNREACHABLE();
-+ return 0;
-+ }
- }
-
- unsigned int Renderer11::getMaxVaryingVectors() const
-@@ -2187,11 +2254,17 @@ unsigned int Renderer11::getMaxVaryingVectors() const
- META_ASSERT(gl::IMPLEMENTATION_MAX_VARYING_VECTORS == D3D11_VS_OUTPUT_REGISTER_COUNT);
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_VS_OUTPUT_REGISTER_COUNT;
- case D3D_FEATURE_LEVEL_10_1:
-+ return D3D10_1_VS_OUTPUT_REGISTER_COUNT;
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_VS_OUTPUT_REGISTER_COUNT;
-+ case D3D_FEATURE_LEVEL_9_3:
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1:
-+ return 8;
- default: UNREACHABLE();
- return 0;
- }
-@@ -2201,10 +2274,15 @@ bool Renderer11::getNonPower2TextureSupport() const
- {
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return true;
-+ case D3D_FEATURE_LEVEL_9_3:
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1:
-+ return false;
- default: UNREACHABLE();
- return false;
- }
-@@ -2214,10 +2292,15 @@ bool Renderer11::getOcclusionQuerySupport() const
- {
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
-+ case D3D_FEATURE_LEVEL_9_3:
-+ case D3D_FEATURE_LEVEL_9_2:
- return true;
-+ case D3D_FEATURE_LEVEL_9_1:
-+ return false;
- default: UNREACHABLE();
- return false;
- }
-@@ -2227,10 +2310,15 @@ bool Renderer11::getInstancingSupport() const
- {
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
-+ case D3D_FEATURE_LEVEL_9_3:
- return true;
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1:
-+ return false;
- default: UNREACHABLE();
- return false;
- }
-@@ -2248,10 +2336,15 @@ bool Renderer11::getDerivativeInstructionSupport() const
- {
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
-+ case D3D_FEATURE_LEVEL_9_3:
- return true;
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1:
-+ return false;
- default: UNREACHABLE();
- return false;
- }
-@@ -2267,9 +2360,13 @@ int Renderer11::getMajorShaderModel() const
- {
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MAJOR_VERSION; // 5
- case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MAJOR_VERSION; // 4
- case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MAJOR_VERSION; // 4
-+ case D3D_FEATURE_LEVEL_9_3:
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1: return 4; // SM4 level 9, but treat as 4
- default: UNREACHABLE(); return 0;
- }
- }
-@@ -2278,9 +2375,13 @@ int Renderer11::getMinorShaderModel() const
- {
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MINOR_VERSION; // 0
- case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MINOR_VERSION; // 1
- case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MINOR_VERSION; // 0
-+ case D3D_FEATURE_LEVEL_9_3:
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1: return 0;
- default: UNREACHABLE(); return 0;
- }
- }
-@@ -2301,11 +2402,17 @@ int Renderer11::getMaxViewportDimension() const
-
- switch (mFeatureLevel)
- {
-- case D3D_FEATURE_LEVEL_11_0:
-+ case D3D_FEATURE_LEVEL_11_1:
-+ case D3D_FEATURE_LEVEL_11_0:
- return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192
-+ case D3D_FEATURE_LEVEL_9_3:
-+ return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 4096
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1:
-+ return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 2048
- default: UNREACHABLE();
- return 0;
- }
-@@ -2315,9 +2422,13 @@ int Renderer11::getMaxTextureWidth() const
- {
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192
-+ case D3D_FEATURE_LEVEL_9_3: return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 4096
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1: return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 2048
- default: UNREACHABLE(); return 0;
- }
- }
-@@ -2326,9 +2437,13 @@ int Renderer11::getMaxTextureHeight() const
- {
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192
-+ case D3D_FEATURE_LEVEL_9_3: return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 4096
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1: return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 2048
- default: UNREACHABLE(); return 0;
- }
- }
-@@ -2337,9 +2452,13 @@ bool Renderer11::get32BitIndexSupport() const
- {
- switch (mFeatureLevel)
- {
-- case D3D_FEATURE_LEVEL_11_0:
-+ case D3D_FEATURE_LEVEL_11_1:
-+ case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP >= 32; // true
-+ case D3D_FEATURE_LEVEL_9_3:
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1: return false;
- default: UNREACHABLE(); return false;
- }
- }
-@@ -2386,14 +2505,22 @@ unsigned int Renderer11::getMaxRenderTargets() const
- {
- META_ASSERT(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT <= gl::IMPLEMENTATION_MAX_DRAW_BUFFERS);
- META_ASSERT(D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT <= gl::IMPLEMENTATION_MAX_DRAW_BUFFERS);
-+ META_ASSERT(D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT <= gl::IMPLEMENTATION_MAX_DRAW_BUFFERS);
-+ META_ASSERT(D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT <= gl::IMPLEMENTATION_MAX_DRAW_BUFFERS);
-
- switch (mFeatureLevel)
- {
-+ case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; // 8
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; // 8
-+ case D3D_FEATURE_LEVEL_9_3:
-+ return D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT; // 4
-+ case D3D_FEATURE_LEVEL_9_2:
-+ case D3D_FEATURE_LEVEL_9_1:
-+ return D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT; // 1
- default:
- UNREACHABLE();
- return 1;
-@@ -2821,7 +2948,7 @@ ShaderExecutable *Renderer11::loadExecutable(const void *function, size_t length
-
- ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type)
- {
-- const char *profile = NULL;
-+ std::string profile;
-
- switch (type)
- {
-@@ -2839,7 +2966,12 @@ ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const ch
- return NULL;
- }
-
-- ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, D3DCOMPILE_OPTIMIZATION_LEVEL0, false);
-+ if (mFeatureLevel == D3D_FEATURE_LEVEL_9_3)
-+ profile += "_level_9_3";
-+ else if (mFeatureLevel == D3D_FEATURE_LEVEL_9_2 || mFeatureLevel == D3D_FEATURE_LEVEL_9_1)
-+ profile += "_level_9_1";
-+
-+ ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile.c_str(), D3DCOMPILE_OPTIMIZATION_LEVEL0, false);
- if (!binary)
- return NULL;
-
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h
-index a7f5a39..433945d 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer11.h
-@@ -32,6 +32,7 @@ class StreamingIndexBufferInterface;
-
- enum
- {
-+ MAX_VERTEX_UNIFORM_VECTORS_D3D9 = 254,
- MAX_VERTEX_UNIFORM_VECTORS_D3D11 = 1024,
- MAX_FRAGMENT_UNIFORM_VECTORS_D3D11 = 1024
- };
-@@ -177,6 +178,7 @@ class Renderer11 : public Renderer
- ID3D11Device *getDevice() { return mDevice; }
- ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; };
- IDXGIFactory *getDxgiFactory() { return mDxgiFactory; };
-+ D3D_FEATURE_LEVEL getFeatureLevel() const { return mFeatureLevel; }
-
- bool getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource);
- void unapplyRenderTargets();
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
-index 0797fd7..9770772 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
-@@ -500,12 +500,17 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
- ASSERT(SUCCEEDED(result));
-
- DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};
-- swapChainDesc.BufferCount = 2;
- swapChainDesc.Format = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
- swapChainDesc.Width = backbufferWidth;
- swapChainDesc.Height = backbufferHeight;
- swapChainDesc.Stereo = FALSE;
-+#if !defined(ANGLE_OS_WINPHONE)
-+ swapChainDesc.BufferCount = 2;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
-+#else
-+ swapChainDesc.BufferCount = 1;
-+ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
-+#endif
- #endif
-
- swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.cpp
-index 408b48e..32a407a 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/TextureStorage11.cpp
-@@ -222,14 +222,14 @@ TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, SwapChain11 *swapch
- }
-
- TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
-- : TextureStorage11(renderer, GetTextureBindFlags(gl_d3d11::ConvertTextureFormat(internalformat), usage, forceRenderable))
-+ : TextureStorage11(renderer, GetTextureBindFlags(gl_d3d11::ConvertTextureFormat(internalformat, Renderer11::makeRenderer11(renderer)->getFeatureLevel()), usage, forceRenderable))
- {
- for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
- {
- mRenderTarget[i] = NULL;
- }
-
-- DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat);
-+ DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat, Renderer11::makeRenderer11(renderer)->getFeatureLevel());
- if (d3d11::IsDepthStencilFormat(convertedFormat))
- {
- mTextureFormat = d3d11::GetDepthTextureFormat(convertedFormat);
-@@ -440,7 +440,7 @@ void TextureStorage11_2D::generateMipmap(int level)
- }
-
- TextureStorage11_Cube::TextureStorage11_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
-- : TextureStorage11(renderer, GetTextureBindFlags(gl_d3d11::ConvertTextureFormat(internalformat), usage, forceRenderable))
-+ : TextureStorage11(renderer, GetTextureBindFlags(gl_d3d11::ConvertTextureFormat(internalformat, Renderer11::makeRenderer11(renderer)->getFeatureLevel()), usage, forceRenderable))
- {
- for (unsigned int i = 0; i < 6; i++)
- {
-@@ -450,7 +450,7 @@ TextureStorage11_Cube::TextureStorage11_Cube(Renderer *renderer, int levels, GLe
- }
- }
-
-- DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat);
-+ DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat, Renderer11::makeRenderer11(renderer)->getFeatureLevel());
- if (d3d11::IsDepthStencilFormat(convertedFormat))
- {
- mTextureFormat = d3d11::GetDepthTextureFormat(convertedFormat);
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.cpp
-index 13800da..0624a61 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.cpp
-@@ -329,7 +329,7 @@ DXGI_FORMAT ConvertRenderbufferFormat(GLenum format)
- return DXGI_FORMAT_R8G8B8A8_UNORM;
- }
-
--DXGI_FORMAT ConvertTextureFormat(GLenum internalformat)
-+DXGI_FORMAT ConvertTextureFormat(GLenum internalformat, D3D_FEATURE_LEVEL featureLevel)
- {
- switch (internalformat)
- {
-@@ -342,7 +342,7 @@ DXGI_FORMAT ConvertTextureFormat(GLenum internalformat)
- case GL_LUMINANCE8_ALPHA8_EXT:
- return DXGI_FORMAT_R8G8B8A8_UNORM;
- case GL_ALPHA8_EXT:
-- return DXGI_FORMAT_A8_UNORM;
-+ return featureLevel >= D3D_FEATURE_LEVEL_10_0 ? DXGI_FORMAT_A8_UNORM : DXGI_FORMAT_B8G8R8A8_UNORM;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return DXGI_FORMAT_BC1_UNORM;
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.h b/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.h
-index 1bc48c1..70ad4fe 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.h
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/renderer11_utils.h
-@@ -32,7 +32,7 @@ FLOAT ConvertMinLOD(GLenum minFilter, unsigned int lodOffset);
- FLOAT ConvertMaxLOD(GLenum minFilter, unsigned int lodOffset);
-
- DXGI_FORMAT ConvertRenderbufferFormat(GLenum format);
--DXGI_FORMAT ConvertTextureFormat(GLenum format);
-+DXGI_FORMAT ConvertTextureFormat(GLenum format, D3D_FEATURE_LEVEL featureLevel);
- }
-
- namespace d3d11_gl
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl b/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl
-index 042ac69..cb132dc 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl
-@@ -12,10 +12,12 @@ struct PS_OutputMultiple
- float4 color1 : SV_TARGET1;
- float4 color2 : SV_TARGET2;
- float4 color3 : SV_TARGET3;
-+#ifdef SM4
- float4 color4 : SV_TARGET4;
- float4 color5 : SV_TARGET5;
- float4 color6 : SV_TARGET6;
- float4 color7 : SV_TARGET7;
-+#endif
- };
-
- PS_OutputMultiple PS_ClearMultiple(in float4 inPosition : SV_POSITION, in float4 inColor : COLOR)
-@@ -25,10 +27,12 @@ PS_OutputMultiple PS_ClearMultiple(in float4 inPosition : SV_POSITION, in float4
- outColor.color1 = inColor;
- outColor.color2 = inColor;
- outColor.color3 = inColor;
-+#ifdef SM4
- outColor.color4 = inColor;
- outColor.color5 = inColor;
- outColor.color6 = inColor;
- outColor.color7 = inColor;
-+#endif
- return outColor;
- }
-
-diff --git a/src/angle/src/libGLESv2/libGLESv2.pro b/src/angle/src/libGLESv2/libGLESv2.pro
-index ff2f888..b39ce78 100644
---- a/src/angle/src/libGLESv2/libGLESv2.pro
-+++ b/src/angle/src/libGLESv2/libGLESv2.pro
-@@ -190,7 +190,7 @@ for (ps, PIXEL_SHADERS_BLIT) {
- QMAKE_EXTRA_COMPILERS += fxc_ps_$${ps}
- }
- for (ps, PIXEL_SHADERS_PASSTHROUGH) {
-- fxc_ps_$${ps}.commands = $$FXC /nologo /E PS_$$ps /T ps_4_0 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
-+ fxc_ps_$${ps}.commands = $$FXC /nologo /E PS_$$ps /T ps_4_0_level_9_1 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
- fxc_ps_$${ps}.output = $$SHADER_DIR/$${ps}11ps.h
- fxc_ps_$${ps}.input = PASSTHROUGH_INPUT
- fxc_ps_$${ps}.dependency_type = TYPE_C
-@@ -199,7 +199,7 @@ for (ps, PIXEL_SHADERS_PASSTHROUGH) {
- QMAKE_EXTRA_COMPILERS += fxc_ps_$${ps}
- }
- for (ps, PIXEL_SHADERS_CLEAR) {
-- fxc_ps_$${ps}.commands = $$FXC /nologo /E PS_$$ps /T ps_4_0 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
-+ fxc_ps_$${ps}.commands = $$FXC /nologo /E PS_$$ps /T ps_4_0_level_9_1 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
- fxc_ps_$${ps}.output = $$SHADER_DIR/$${ps}11ps.h
- fxc_ps_$${ps}.input = CLEAR_INPUT
- fxc_ps_$${ps}.dependency_type = TYPE_C
-@@ -217,7 +217,7 @@ for (vs, VERTEX_SHADERS_BLIT) {
- QMAKE_EXTRA_COMPILERS += fxc_vs_$${vs}
- }
- for (vs, VERTEX_SHADERS_PASSTHROUGH) {
-- fxc_vs_$${vs}.commands = $$FXC /nologo /E VS_$$vs /T vs_4_0 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
-+ fxc_vs_$${vs}.commands = $$FXC /nologo /E VS_$$vs /T vs_4_0_level_9_1 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
- fxc_vs_$${vs}.output = $$SHADER_DIR/$${vs}11vs.h
- fxc_vs_$${vs}.input = PASSTHROUGH_INPUT
- fxc_vs_$${vs}.dependency_type = TYPE_C
-@@ -226,7 +226,7 @@ for (vs, VERTEX_SHADERS_PASSTHROUGH) {
- QMAKE_EXTRA_COMPILERS += fxc_vs_$${vs}
- }
- for (vs, VERTEX_SHADERS_CLEAR) {
-- fxc_vs_$${vs}.commands = $$FXC /nologo /E VS_$$vs /T vs_4_0 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
-+ fxc_vs_$${vs}.commands = $$FXC /nologo /E VS_$$vs /T vs_4_0_level_9_1 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
- fxc_vs_$${vs}.output = $$SHADER_DIR/$${vs}11vs.h
- fxc_vs_$${vs}.input = CLEAR_INPUT
- fxc_vs_$${vs}.dependency_type = TYPE_C
---
-1.8.4.msysgit.0
-
diff --git a/src/angle/patches/0014-ANGLE-D3D11-Always-execute-QueryInterface.patch b/src/angle/patches/0014-ANGLE-D3D11-Always-execute-QueryInterface.patch
deleted file mode 100644
index dbe618102e..0000000000
--- a/src/angle/patches/0014-ANGLE-D3D11-Always-execute-QueryInterface.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 4d1906f0b81f2b61adf9640ae6cef9d503c33209 Mon Sep 17 00:00:00 2001
-From: Maurice Kalinowski <maurice.kalinowski@digia.com>
-Date: Tue, 3 Dec 2013 14:52:18 +0100
-Subject: [PATCH] ANGLE D3D11: Always execute QueryInterface
-
-ASSERT removes the condition when building for release mode. However,
-QueryInterface must be called in any case. Adopt to using ASSERT(false)
-like in other occurrences in angle.
-
-This is a follow-up patch to 331bc16afd23414493b842819e0b747e8f364243
-
-Change-Id: I4413bab06b5a529fcbd09bbc20828fcdcf4e4fc6
----
- src/3rdparty/angle/src/libEGL/Surface.cpp | 14 ++++++++++++--
- 1 file changed, 12 insertions(+), 2 deletions(-)
-
-diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp
-index ee8d480..99d0c1d 100644
---- a/src/3rdparty/angle/src/libEGL/Surface.cpp
-+++ b/src/3rdparty/angle/src/libEGL/Surface.cpp
-@@ -118,7 +118,12 @@ bool Surface::resetSwapChain()
- #else
- ABI::Windows::Foundation::Rect windowRect;
- ABI::Windows::UI::Core::ICoreWindow *window;
-- ASSERT(SUCCEEDED(mWindow->QueryInterface(IID_PPV_ARGS(&window))));
-+ HRESULT result = mWindow->QueryInterface(IID_PPV_ARGS(&window));
-+ if (FAILED(result))
-+ {
-+ ASSERT(false);
-+ return false;
-+ }
- window->get_Bounds(&windowRect);
- width = windowRect.Width;
- height = windowRect.Height;
-@@ -342,7 +347,12 @@ bool Surface::checkForOutOfDateSwapChain()
- #else
- ABI::Windows::Foundation::Rect windowRect;
- ABI::Windows::UI::Core::ICoreWindow *window;
-- ASSERT(SUCCEEDED(mWindow->QueryInterface(IID_PPV_ARGS(&window))));
-+ HRESULT result = mWindow->QueryInterface(IID_PPV_ARGS(&window));
-+ if (FAILED(result))
-+ {
-+ ASSERT(false);
-+ return false;
-+ }
- window->get_Bounds(&windowRect);
- int clientWidth = windowRect.Width;
- int clientHeight = windowRect.Height;
---
-1.7.11.msysgit.0
-
diff --git a/src/angle/patches/0016-ANGLE-D3D11-Fix-build-on-desktop-Windows.patch b/src/angle/patches/0016-ANGLE-D3D11-Fix-build-on-desktop-Windows.patch
deleted file mode 100644
index 99f458bc28..0000000000
--- a/src/angle/patches/0016-ANGLE-D3D11-Fix-build-on-desktop-Windows.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 8229b84ddf0134ac11412262d23515dfb7ddb177 Mon Sep 17 00:00:00 2001
-From: Andrew Knight <andrew.knight@digia.com>
-Date: Sun, 8 Dec 2013 22:50:38 +0200
-Subject: [PATCH] ANGLE D3D11: Fix build on desktop Windows
-
-This fixes a missing declaration caused by 11a2226c
-
-Change-Id: I4b8092c6b9592e886353af9193686238105a1512
----
- src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
-index 9770772..2fe15ff 100644
---- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
-+++ b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp
-@@ -519,7 +519,7 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
- swapChainDesc.SampleDesc.Quality = 0;
-
- #if !defined(ANGLE_OS_WINRT)
-- result = factory->CreateSwapChain(device, &swapChainDesc, &mSwapChain);
-+ HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, &mSwapChain);
- #else
- IDXGISwapChain1 *swapChain;
- result = factory->CreateSwapChainForCoreWindow(device, mWindow, &swapChainDesc, NULL, &swapChain);
---
-1.8.4.msysgit.0
-
diff --git a/src/angle/src/compiler/compiler.pro b/src/angle/src/compiler/compiler.pro
index 26b03bfc86..7f3f3e301e 100644
--- a/src/angle/src/compiler/compiler.pro
+++ b/src/angle/src/compiler/compiler.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
CONFIG += ordered
-SUBDIRS = preprocessor translator_common.pro translator_hlsl.pro
+SUBDIRS = preprocessor translator.pro
diff --git a/src/angle/src/compiler/preprocessor/preprocessor.pro b/src/angle/src/compiler/preprocessor/preprocessor.pro
index 432c8dcf32..74cd97c5a4 100644
--- a/src/angle/src/compiler/preprocessor/preprocessor.pro
+++ b/src/angle/src/compiler/preprocessor/preprocessor.pro
@@ -21,6 +21,7 @@ HEADERS += \
$$ANGLE_DIR/src/compiler/preprocessor/DirectiveParser.h \
$$ANGLE_DIR/src/compiler/preprocessor/ExpressionParser.h \
$$ANGLE_DIR/src/compiler/preprocessor/Input.h \
+ $$ANGLE_DIR/src/compiler/preprocessor/length_limits.h \
$$ANGLE_DIR/src/compiler/preprocessor/Lexer.h \
$$ANGLE_DIR/src/compiler/preprocessor/Macro.h \
$$ANGLE_DIR/src/compiler/preprocessor/MacroExpander.h \
diff --git a/src/angle/src/compiler/translator.pro b/src/angle/src/compiler/translator.pro
new file mode 100644
index 0000000000..0051486f82
--- /dev/null
+++ b/src/angle/src/compiler/translator.pro
@@ -0,0 +1,163 @@
+TEMPLATE = lib
+CONFIG += static
+TARGET = $$qtLibraryTarget(translator)
+
+include(../config.pri)
+
+# Mingw 4.7 chokes on implicit move semantics, so disable C++11 here
+mingw: CONFIG -= c++11
+
+INCLUDEPATH += \
+ $$ANGLE_DIR/src \
+ $$ANGLE_DIR/include
+
+DEFINES += _SECURE_SCL=0 _LIB COMPILER_IMPLEMENTATION
+
+FLEX_SOURCES = $$ANGLE_DIR/src/compiler/translator/glslang.l
+BISON_SOURCES = $$ANGLE_DIR/src/compiler/translator/glslang.y
+
+HEADERS += \
+ $$ANGLE_DIR/include/GLSLANG/ResourceLimits.h \
+ $$ANGLE_DIR/include/GLSLANG/ShaderLang.h \
+ $$ANGLE_DIR/src/compiler/translator/BaseTypes.h \
+ $$ANGLE_DIR/src/compiler/translator/BuiltInFunctionEmulator.h \
+ $$ANGLE_DIR/src/compiler/translator/Common.h \
+ $$ANGLE_DIR/src/compiler/translator/compilerdebug.h \
+ $$ANGLE_DIR/src/compiler/translator/ConstantUnion.h \
+ $$ANGLE_DIR/src/compiler/translator/depgraph/DependencyGraph.h \
+ $$ANGLE_DIR/src/compiler/translator/depgraph/DependencyGraphBuilder.h \
+ $$ANGLE_DIR/src/compiler/translator/depgraph/DependencyGraphOutput.h \
+ $$ANGLE_DIR/src/compiler/translator/DetectCallDepth.h \
+ $$ANGLE_DIR/src/compiler/translator/DetectDiscontinuity.h \
+ $$ANGLE_DIR/src/compiler/translator/Diagnostics.h \
+ $$ANGLE_DIR/src/compiler/translator/DirectiveHandler.h \
+ $$ANGLE_DIR/src/compiler/translator/ExtensionBehavior.h \
+ $$ANGLE_DIR/src/compiler/translator/ForLoopUnroll.h \
+ $$ANGLE_DIR/src/compiler/translator/HashNames.h \
+ $$ANGLE_DIR/src/compiler/translator/InfoSink.h \
+ $$ANGLE_DIR/src/compiler/translator/Initialize.h \
+ $$ANGLE_DIR/src/compiler/translator/InitializeDll.h \
+ $$ANGLE_DIR/src/compiler/translator/InitializeParseContext.h \
+ $$ANGLE_DIR/src/compiler/translator/InitializeVariables.h \
+ $$ANGLE_DIR/src/compiler/translator/intermediate.h \
+ $$ANGLE_DIR/src/compiler/translator/localintermediate.h \
+ $$ANGLE_DIR/src/compiler/translator/MapLongVariableNames.h \
+ $$ANGLE_DIR/src/compiler/translator/MMap.h \
+ $$ANGLE_DIR/src/compiler/translator/NodeSearch.h \
+ $$ANGLE_DIR/src/compiler/translator/osinclude.h \
+ $$ANGLE_DIR/src/compiler/translator/OutputESSL.h \
+ $$ANGLE_DIR/src/compiler/translator/OutputGLSL.h \
+ $$ANGLE_DIR/src/compiler/translator/OutputGLSLBase.h \
+ $$ANGLE_DIR/src/compiler/translator/OutputHLSL.h \
+ $$ANGLE_DIR/src/compiler/translator/ParseContext.h \
+ $$ANGLE_DIR/src/compiler/translator/PoolAlloc.h \
+ $$ANGLE_DIR/src/compiler/translator/Pragma.h \
+ $$ANGLE_DIR/src/compiler/translator/QualifierAlive.h \
+ $$ANGLE_DIR/src/compiler/translator/RemoveTree.h \
+ $$ANGLE_DIR/src/compiler/translator/RenameFunction.h \
+ $$ANGLE_DIR/src/compiler/translator/RewriteElseBlocks.h \
+ $$ANGLE_DIR/src/compiler/translator/SearchSymbol.h \
+ $$ANGLE_DIR/src/compiler/translator/ShHandle.h \
+ $$ANGLE_DIR/src/compiler/translator/SymbolTable.h \
+ $$ANGLE_DIR/src/compiler/translator/timing/RestrictFragmentShaderTiming.h \
+ $$ANGLE_DIR/src/compiler/translator/timing/RestrictVertexShaderTiming.h \
+ $$ANGLE_DIR/src/compiler/translator/TranslatorESSL.h \
+ $$ANGLE_DIR/src/compiler/translator/TranslatorGLSL.h \
+ $$ANGLE_DIR/src/compiler/translator/TranslatorHLSL.h \
+ $$ANGLE_DIR/src/compiler/translator/Types.h \
+ $$ANGLE_DIR/src/compiler/translator/UnfoldShortCircuit.h \
+ $$ANGLE_DIR/src/compiler/translator/UnfoldShortCircuitAST.h \
+ $$ANGLE_DIR/src/compiler/translator/Uniform.h \
+ $$ANGLE_DIR/src/compiler/translator/util.h \
+ $$ANGLE_DIR/src/compiler/translator/ValidateLimitations.h \
+ $$ANGLE_DIR/src/compiler/translator/VariableInfo.h \
+ $$ANGLE_DIR/src/compiler/translator/VariablePacker.h \
+ $$ANGLE_DIR/src/compiler/translator/VersionGLSL.h \
+ $$ANGLE_DIR/src/third_party/compiler/ArrayBoundsClamper.h
+
+
+SOURCES += \
+ $$ANGLE_DIR/src/compiler/translator/BuiltInFunctionEmulator.cpp \
+ $$ANGLE_DIR/src/compiler/translator/CodeGen.cpp \
+ $$ANGLE_DIR/src/compiler/translator/Compiler.cpp \
+ $$ANGLE_DIR/src/compiler/translator/compilerdebug.cpp \
+ $$ANGLE_DIR/src/compiler/translator/depgraph/DependencyGraph.cpp \
+ $$ANGLE_DIR/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp \
+ $$ANGLE_DIR/src/compiler/translator/depgraph/DependencyGraphOutput.cpp \
+ $$ANGLE_DIR/src/compiler/translator/depgraph/DependencyGraphTraverse.cpp \
+ $$ANGLE_DIR/src/compiler/translator/DetectCallDepth.cpp \
+ $$ANGLE_DIR/src/compiler/translator/DetectDiscontinuity.cpp \
+ $$ANGLE_DIR/src/compiler/translator/Diagnostics.cpp \
+ $$ANGLE_DIR/src/compiler/translator/DirectiveHandler.cpp \
+ $$ANGLE_DIR/src/compiler/translator/ForLoopUnroll.cpp \
+ $$ANGLE_DIR/src/compiler/translator/InfoSink.cpp \
+ $$ANGLE_DIR/src/compiler/translator/Initialize.cpp \
+ $$ANGLE_DIR/src/compiler/translator/InitializeDll.cpp \
+ $$ANGLE_DIR/src/compiler/translator/InitializeParseContext.cpp \
+ $$ANGLE_DIR/src/compiler/translator/InitializeVariables.cpp \
+ $$ANGLE_DIR/src/compiler/translator/Intermediate.cpp \
+ $$ANGLE_DIR/src/compiler/translator/intermOut.cpp \
+ $$ANGLE_DIR/src/compiler/translator/IntermTraverse.cpp \
+ $$ANGLE_DIR/src/compiler/translator/MapLongVariableNames.cpp \
+ $$ANGLE_DIR/src/compiler/translator/OutputESSL.cpp \
+ $$ANGLE_DIR/src/compiler/translator/OutputGLSL.cpp \
+ $$ANGLE_DIR/src/compiler/translator/OutputGLSLBase.cpp \
+ $$ANGLE_DIR/src/compiler/translator/OutputHLSL.cpp \
+ $$ANGLE_DIR/src/compiler/translator/parseConst.cpp \
+ $$ANGLE_DIR/src/compiler/translator/ParseContext.cpp \
+ $$ANGLE_DIR/src/compiler/translator/PoolAlloc.cpp \
+ $$ANGLE_DIR/src/compiler/translator/QualifierAlive.cpp \
+ $$ANGLE_DIR/src/compiler/translator/RemoveTree.cpp \
+ $$ANGLE_DIR/src/compiler/translator/RewriteElseBlocks.cpp \
+ $$ANGLE_DIR/src/compiler/translator/SearchSymbol.cpp \
+ $$ANGLE_DIR/src/compiler/translator/ShaderLang.cpp \
+ $$ANGLE_DIR/src/compiler/translator/SymbolTable.cpp \
+ $$ANGLE_DIR/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp \
+ $$ANGLE_DIR/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp \
+ $$ANGLE_DIR/src/compiler/translator/TranslatorESSL.cpp \
+ $$ANGLE_DIR/src/compiler/translator/TranslatorGLSL.cpp \
+ $$ANGLE_DIR/src/compiler/translator/TranslatorHLSL.cpp \
+ $$ANGLE_DIR/src/compiler/translator/UnfoldShortCircuit.cpp \
+ $$ANGLE_DIR/src/compiler/translator/UnfoldShortCircuitAST.cpp \
+ $$ANGLE_DIR/src/compiler/translator/Uniform.cpp \
+ $$ANGLE_DIR/src/compiler/translator/util.cpp \
+ $$ANGLE_DIR/src/compiler/translator/ValidateLimitations.cpp \
+ $$ANGLE_DIR/src/compiler/translator/VariableInfo.cpp \
+ $$ANGLE_DIR/src/compiler/translator/VariablePacker.cpp \
+ $$ANGLE_DIR/src/compiler/translator/VersionGLSL.cpp \
+ $$ANGLE_DIR/src/third_party/compiler/ArrayBoundsClamper.cpp
+
+
+winrt {
+ SOURCES += $$ANGLE_DIR/src/compiler/translator/ossource_winrt.cpp
+} else {
+ SOURCES += $$ANGLE_DIR/src/compiler/translator/ossource_win.cpp
+}
+
+# NOTE: 'win_flex' and 'bison' can be found in qt5/gnuwin32/bin
+flex.commands = $$addGnuPath(win_flex) --noline --nounistd --outfile=${QMAKE_FILE_BASE}_lex.cpp ${QMAKE_FILE_NAME}
+flex.output = ${QMAKE_FILE_BASE}_lex.cpp
+flex.input = FLEX_SOURCES
+flex.dependency_type = TYPE_C
+flex.variable_out = GENERATED_SOURCES
+QMAKE_EXTRA_COMPILERS += flex
+
+bison.commands = $$addGnuPath(bison) --no-lines --skeleton=yacc.c --defines=${QMAKE_FILE_BASE}_tab.h \
+ --output=${QMAKE_FILE_BASE}_tab.cpp ${QMAKE_FILE_NAME}
+bison.output = ${QMAKE_FILE_BASE}_tab.h
+bison.input = BISON_SOURCES
+bison.dependency_type = TYPE_C
+bison.variable_out = GENERATED_SOURCES
+QMAKE_EXTRA_COMPILERS += bison
+
+# This is a dummy compiler to work around the fact that an extra compiler can only
+# have one output file even if the command generates two.
+MAKEFILE_NOOP_COMMAND = @echo -n
+msvc: MAKEFILE_NOOP_COMMAND = @echo >NUL
+bison_impl.output = ${QMAKE_FILE_BASE}_tab.cpp
+bison_impl.input = BISON_SOURCES
+bison_impl.commands = $$MAKEFILE_NOOP_COMMAND
+bison_impl.depends = ${QMAKE_FILE_BASE}_tab.h
+bison_impl.output = ${QMAKE_FILE_BASE}_tab.cpp
+bison_impl.variable_out = GENERATED_SOURCES
+QMAKE_EXTRA_COMPILERS += bison_impl
diff --git a/src/angle/src/compiler/translator_common.pro b/src/angle/src/compiler/translator_common.pro
deleted file mode 100644
index c8f86d6b10..0000000000
--- a/src/angle/src/compiler/translator_common.pro
+++ /dev/null
@@ -1,133 +0,0 @@
-TEMPLATE = lib
-CONFIG += static
-TARGET = $$qtLibraryTarget(translator_common)
-
-include(../config.pri)
-
-# Mingw 4.7 chokes on implicit move semantics, so disable C++11 here
-mingw: CONFIG -= c++11
-
-INCLUDEPATH += \
- $$ANGLE_DIR/src \
- $$ANGLE_DIR/include
-
-DEFINES += _SECURE_SCL=0 _LIB COMPILER_IMPLEMENTATION
-
-FLEX_SOURCES = $$ANGLE_DIR/src/compiler/glslang.l
-BISON_SOURCES = $$ANGLE_DIR/src/compiler/glslang.y
-
-HEADERS += \
- $$ANGLE_DIR/src/compiler/BaseTypes.h \
- $$ANGLE_DIR/src/compiler/BuiltInFunctionEmulator.h \
- $$ANGLE_DIR/src/compiler/Common.h \
- $$ANGLE_DIR/src/compiler/ConstantUnion.h \
- $$ANGLE_DIR/src/compiler/debug.h \
- $$ANGLE_DIR/src/compiler/DetectRecursion.h \
- $$ANGLE_DIR/src/compiler/DetectCallDepth.h \
- $$ANGLE_DIR/src/compiler/Diagnostics.h \
- $$ANGLE_DIR/src/compiler/DirectiveHandler.h \
- $$ANGLE_DIR/src/compiler/ForLoopUnroll.h \
- $$ANGLE_DIR/src/compiler/InfoSink.h \
- $$ANGLE_DIR/src/compiler/Initialize.h \
- $$ANGLE_DIR/src/compiler/InitializeDll.h \
- $$ANGLE_DIR/src/compiler/InitializeGlobals.h \
- $$ANGLE_DIR/src/compiler/InitializeGLPosition.h \
- $$ANGLE_DIR/src/compiler/InitializeParseContext.h \
- $$ANGLE_DIR/src/compiler/intermediate.h \
- $$ANGLE_DIR/src/compiler/localintermediate.h \
- $$ANGLE_DIR/src/compiler/MapLongVariableNames.h \
- $$ANGLE_DIR/src/compiler/MMap.h \
- $$ANGLE_DIR/src/compiler/osinclude.h \
- $$ANGLE_DIR/src/compiler/ParseHelper.h \
- $$ANGLE_DIR/src/compiler/PoolAlloc.h \
- $$ANGLE_DIR/src/compiler/QualifierAlive.h \
- $$ANGLE_DIR/src/compiler/RemoveTree.h \
- $$ANGLE_DIR/src/compiler/RenameFunction.h \
- $$ANGLE_DIR/include/GLSLANG/ResourceLimits.h \
- $$ANGLE_DIR/include/GLSLANG/ShaderLang.h \
- $$ANGLE_DIR/src/compiler/ShHandle.h \
- $$ANGLE_DIR/src/compiler/SymbolTable.h \
- $$ANGLE_DIR/src/compiler/Types.h \
- $$ANGLE_DIR/src/compiler/UnfoldShortCircuit.h \
- $$ANGLE_DIR/src/compiler/util.h \
- $$ANGLE_DIR/src/compiler/ValidateLimitations.h \
- $$ANGLE_DIR/src/compiler/VariableInfo.h \
- $$ANGLE_DIR/src/compiler/VariablePacker.h \
- $$ANGLE_DIR/src/compiler/timing/RestrictFragmentShaderTiming.h \
- $$ANGLE_DIR/src/compiler/timing/RestrictVertexShaderTiming.h \
- $$ANGLE_DIR/src/compiler/depgraph/DependencyGraph.h \
- $$ANGLE_DIR/src/compiler/depgraph/DependencyGraphBuilder.h \
- $$ANGLE_DIR/src/compiler/depgraph/DependencyGraphOutput.h \
- $$ANGLE_DIR/src/third_party/compiler/ArrayBoundsClamper.h
-
-SOURCES += \
- $$ANGLE_DIR/src/compiler/BuiltInFunctionEmulator.cpp \
- $$ANGLE_DIR/src/compiler/Compiler.cpp \
- $$ANGLE_DIR/src/compiler/debug.cpp \
- $$ANGLE_DIR/src/compiler/DetectCallDepth.cpp \
- $$ANGLE_DIR/src/compiler/DetectRecursion.cpp \
- $$ANGLE_DIR/src/compiler/Diagnostics.cpp \
- $$ANGLE_DIR/src/compiler/DirectiveHandler.cpp \
- $$ANGLE_DIR/src/compiler/ForLoopUnroll.cpp \
- $$ANGLE_DIR/src/compiler/InfoSink.cpp \
- $$ANGLE_DIR/src/compiler/Initialize.cpp \
- $$ANGLE_DIR/src/compiler/InitializeDll.cpp \
- $$ANGLE_DIR/src/compiler/InitializeGLPosition.cpp \
- $$ANGLE_DIR/src/compiler/InitializeParseContext.cpp \
- $$ANGLE_DIR/src/compiler/Intermediate.cpp \
- $$ANGLE_DIR/src/compiler/intermOut.cpp \
- $$ANGLE_DIR/src/compiler/IntermTraverse.cpp \
- $$ANGLE_DIR/src/compiler/MapLongVariableNames.cpp \
- $$ANGLE_DIR/src/compiler/parseConst.cpp \
- $$ANGLE_DIR/src/compiler/ParseHelper.cpp \
- $$ANGLE_DIR/src/compiler/PoolAlloc.cpp \
- $$ANGLE_DIR/src/compiler/QualifierAlive.cpp \
- $$ANGLE_DIR/src/compiler/RemoveTree.cpp \
- $$ANGLE_DIR/src/compiler/ShaderLang.cpp \
- $$ANGLE_DIR/src/compiler/SymbolTable.cpp \
- $$ANGLE_DIR/src/compiler/util.cpp \
- $$ANGLE_DIR/src/compiler/ValidateLimitations.cpp \
- $$ANGLE_DIR/src/compiler/VariableInfo.cpp \
- $$ANGLE_DIR/src/compiler/VariablePacker.cpp \
- $$ANGLE_DIR/src/compiler/depgraph/DependencyGraph.cpp \
- $$ANGLE_DIR/src/compiler/depgraph/DependencyGraphBuilder.cpp \
- $$ANGLE_DIR/src/compiler/depgraph/DependencyGraphOutput.cpp \
- $$ANGLE_DIR/src/compiler/depgraph/DependencyGraphTraverse.cpp \
- $$ANGLE_DIR/src/compiler/timing/RestrictFragmentShaderTiming.cpp \
- $$ANGLE_DIR/src/compiler/timing/RestrictVertexShaderTiming.cpp \
- $$ANGLE_DIR/src/third_party/compiler/ArrayBoundsClamper.cpp
-
-winrt {
- SOURCES += $$ANGLE_DIR/src/compiler/ossource_winrt.cpp
-} else {
- SOURCES += $$ANGLE_DIR/src/compiler/ossource_win.cpp
-}
-
-# NOTE: 'win_flex' and 'bison' can be found in qt5/gnuwin32/bin
-flex.commands = $$addGnuPath(win_flex) --noline --nounistd --outfile=${QMAKE_FILE_BASE}_lex.cpp ${QMAKE_FILE_NAME}
-flex.output = ${QMAKE_FILE_BASE}_lex.cpp
-flex.input = FLEX_SOURCES
-flex.dependency_type = TYPE_C
-flex.variable_out = GENERATED_SOURCES
-QMAKE_EXTRA_COMPILERS += flex
-
-bison.commands = $$addGnuPath(bison) --no-lines --skeleton=yacc.c --defines=${QMAKE_FILE_BASE}_tab.h \
- --output=${QMAKE_FILE_BASE}_tab.cpp ${QMAKE_FILE_NAME}
-bison.output = ${QMAKE_FILE_BASE}_tab.h
-bison.input = BISON_SOURCES
-bison.dependency_type = TYPE_C
-bison.variable_out = GENERATED_SOURCES
-QMAKE_EXTRA_COMPILERS += bison
-
-# This is a dummy compiler to work around the fact that an extra compiler can only
-# have one output file even if the command generates two.
-MAKEFILE_NOOP_COMMAND = @echo -n
-msvc: MAKEFILE_NOOP_COMMAND = @echo >NUL
-bison_impl.output = ${QMAKE_FILE_BASE}_tab.cpp
-bison_impl.input = BISON_SOURCES
-bison_impl.commands = $$MAKEFILE_NOOP_COMMAND
-bison_impl.depends = ${QMAKE_FILE_BASE}_tab.h
-bison_impl.output = ${QMAKE_FILE_BASE}_tab.cpp
-bison_impl.variable_out = GENERATED_SOURCES
-QMAKE_EXTRA_COMPILERS += bison_impl
-
diff --git a/src/angle/src/compiler/translator_hlsl.pro b/src/angle/src/compiler/translator_hlsl.pro
deleted file mode 100644
index f19d33a530..0000000000
--- a/src/angle/src/compiler/translator_hlsl.pro
+++ /dev/null
@@ -1,30 +0,0 @@
-TEMPLATE = lib
-CONFIG += static
-TARGET = $$qtLibraryTarget(translator_hlsl)
-
-include(../config.pri)
-
-# Mingw 4.7 chokes on implicit move semantics, so disable C++11 here
-mingw: CONFIG -= c++11
-
-INCLUDEPATH += $$ANGLE_DIR/src \
- $$ANGLE_DIR/include
-
-DEFINES += COMPILER_IMPLEMENTATION
-
-HEADERS += \
- $$ANGLE_DIR/src/compiler/DetectDiscontinuity.h \
- $$ANGLE_DIR/src/compiler/OutputHLSL.h \
- $$ANGLE_DIR/src/compiler/SearchSymbol.h \
- $$ANGLE_DIR/src/compiler/TranslatorHLSL.h \
- $$ANGLE_DIR/src/compiler/UnfoldShortCircuit.h \
- $$ANGLE_DIR/src/compiler/Uniform.h
-
-SOURCES += \
- $$ANGLE_DIR/src/compiler/CodeGenHLSL.cpp \
- $$ANGLE_DIR/src/compiler/DetectDiscontinuity.cpp \
- $$ANGLE_DIR/src/compiler/OutputHLSL.cpp \
- $$ANGLE_DIR/src/compiler/SearchSymbol.cpp \
- $$ANGLE_DIR/src/compiler/TranslatorHLSL.cpp \
- $$ANGLE_DIR/src/compiler/UnfoldShortCircuit.cpp \
- $$ANGLE_DIR/src/compiler/Uniform.cpp
diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri
index ed2558117e..8e0f6b7f42 100644
--- a/src/angle/src/config.pri
+++ b/src/angle/src/config.pri
@@ -38,14 +38,13 @@ DEFINES += _WINDOWS \
WIN32_LEAN_AND_MEAN=1
# Defines specifying the API version (0x0600 = Vista, 0x0602 = Win8))
-winrt: DEFINES += _WIN32_WINNT=0x0602 WINVER=0x0602
-else: DEFINES += _WIN32_WINNT=0x0600 WINVER=0x0600
-
-# ANGLE specific defines
-DEFINES += ANGLE_DISABLE_TRACE \
- ANGLE_DISABLE_PERF \
- ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0 \
- ANGLE_USE_NEW_PREPROCESSOR=1
+winrt {
+ DEFINES += _WIN32_WINNT=0x0602 WINVER=0x0602
+ DEFINES += ANGLE_ENABLE_UNIVERSAL_BINARY
+} else {
+ DEFINES += _WIN32_WINNT=0x0600 WINVER=0x0600
+ DEFINES += ANGLE_ENABLE_D3D9
+}
angle_d3d11 {
DEFINES += ANGLE_ENABLE_D3D11
@@ -55,7 +54,7 @@ angle_d3d11 {
CONFIG(debug, debug|release) {
DEFINES += _DEBUG
} else {
- CONFIG += rtti_off
+ !static: CONFIG += rtti_off
DEFINES += NDEBUG
}
diff --git a/src/angle/src/libEGL/libEGL.pro b/src/angle/src/libEGL/libEGL.pro
index f51bc8ee83..4f10583fc0 100644
--- a/src/angle/src/libEGL/libEGL.pro
+++ b/src/angle/src/libEGL/libEGL.pro
@@ -3,11 +3,11 @@ TARGET = $$qtLibraryTarget(libEGL)
include(../common/common.pri)
-angle_d3d11 {
+angle_d3d11: \
LIBS_PRIVATE += -ld3d11
-} else {
+!winrt: \
LIBS_PRIVATE += -ld3d9
-}
+
LIBS_PRIVATE += -ldxguid -L$$QT_BUILD_TREE/lib -l$$qtLibraryTarget(libGLESv2)
HEADERS += \
diff --git a/src/angle/src/libGLESv2/libGLESv2.pro b/src/angle/src/libGLESv2/libGLESv2.pro
index 75853e219e..6176016f13 100644
--- a/src/angle/src/libGLESv2/libGLESv2.pro
+++ b/src/angle/src/libGLESv2/libGLESv2.pro
@@ -7,13 +7,13 @@ include(../common/common.pri)
INCLUDEPATH += $$OUT_PWD/.. $$ANGLE_DIR/src/libGLESv2
# Remember to adapt tools/configure/configureapp.cpp if the Direct X version changes.
-angle_d3d11 {
+angle_d3d11: \
LIBS_PRIVATE += -ldxgi -ld3d11
-} else {
+!winrt: \
LIBS_PRIVATE += -ld3d9
-}
+
LIBS_PRIVATE += -ldxguid
-STATICLIBS = translator_common translator_hlsl preprocessor
+STATICLIBS = translator preprocessor
for(libname, STATICLIBS) {
# Appends 'd' to the library for debug builds and builds up the fully
@@ -93,67 +93,69 @@ SSE2_SOURCES += $$ANGLE_DIR/src/libGLESv2/renderer/ImageSSE2.cpp
angle_d3d11 {
HEADERS += \
- $$ANGLE_DIR/src/libGLESv2/renderer/BufferStorage11.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/Fence11.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/Image11.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/IndexBuffer11.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/InputLayoutCache.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/Query11.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/Renderer11.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/renderer11_utils.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/RenderTarget11.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/RenderStateCache.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/ShaderExecutable11.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/SwapChain11.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/TextureStorage11.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/VertexBuffer11.h
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/BufferStorage11.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/Fence11.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/Image11.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/IndexBuffer11.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/InputLayoutCache.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/Query11.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/Renderer11.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/renderer11_utils.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/RenderTarget11.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/RenderStateCache.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/SwapChain11.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/TextureStorage11.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/VertexBuffer11.h
SOURCES += \
- $$ANGLE_DIR/src/libGLESv2/renderer/BufferStorage11.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/Fence11.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/Image11.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/IndexBuffer11.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/InputLayoutCache.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/Query11.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/Renderer11.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/renderer11_utils.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/RenderTarget11.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/RenderStateCache.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/ShaderExecutable11.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/SwapChain11.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/TextureStorage11.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/VertexBuffer11.cpp
-} else {
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/Fence11.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/Image11.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/Query11.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/Renderer11.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/SwapChain11.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp
+}
+
+!winrt {
HEADERS += \
- $$ANGLE_DIR/src/libGLESv2/renderer/Blit.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/BufferStorage9.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/Fence9.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/Image9.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/IndexBuffer9.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/Query9.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/Renderer9.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/renderer9_utils.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/RenderTarget9.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/ShaderExecutable9.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/SwapChain9.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/TextureStorage9.h \
- $$ANGLE_DIR/src/libGLESv2/renderer/VertexBuffer9.h
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/Blit.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/BufferStorage9.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/Fence9.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/Image9.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/IndexBuffer9.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/Query9.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/Renderer9.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/renderer9_utils.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/RenderTarget9.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/ShaderExecutable9.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/SwapChain9.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/TextureStorage9.h \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/VertexBuffer9.h
SOURCES += \
- $$ANGLE_DIR/src/libGLESv2/renderer/Blit.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/BufferStorage9.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/Fence9.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/Image9.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/IndexBuffer9.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/Query9.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/Renderer9.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/renderer9_utils.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/RenderTarget9.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/ShaderExecutable9.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/SwapChain9.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/TextureStorage9.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/VertexBuffer9.cpp \
- $$ANGLE_DIR/src/libGLESv2/renderer/VertexDeclarationCache.cpp
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/Blit.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/Fence9.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/Image9.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/Query9.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/Renderer9.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/SwapChain9.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp \
+ $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp
}
!static {
@@ -167,10 +169,10 @@ float_converter.commands = python $$ANGLE_DIR/src/libGLESv2/Float16ToFloat32.py
QMAKE_EXTRA_TARGETS += float_converter
# Generate the shader header files.
-PS_BLIT_INPUT = $$ANGLE_DIR/src/libGLESv2/renderer/shaders/Blit.ps
-VS_BLIT_INPUT = $$ANGLE_DIR/src/libGLESv2/renderer/shaders/Blit.vs
-PASSTHROUGH_INPUT = $$ANGLE_DIR/src/libGLESv2/renderer/shaders/Passthrough11.hlsl
-CLEAR_INPUT = $$ANGLE_DIR/src/libGLESv2/renderer/shaders/Clear11.hlsl
+PS_BLIT_INPUT = $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/shaders/Blit.ps
+VS_BLIT_INPUT = $$ANGLE_DIR/src/libGLESv2/renderer/d3d9/shaders/Blit.vs
+PASSTHROUGH_INPUT = $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/shaders/Passthrough11.hlsl
+CLEAR_INPUT = $$ANGLE_DIR/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl
PIXEL_SHADERS_BLIT = passthroughps luminanceps componentmaskps
PIXEL_SHADERS_PASSTHROUGH = PassthroughRGBA PassthroughRGB \
PassthroughLum PassthroughLumAlpha
@@ -178,61 +180,62 @@ PIXEL_SHADERS_CLEAR = ClearSingle ClearMultiple
VERTEX_SHADERS_BLIT = standardvs flipyvs
VERTEX_SHADERS_PASSTHROUGH = Passthrough
VERTEX_SHADERS_CLEAR = Clear
-SHADER_DIR = $$OUT_PWD/renderer/shaders/compiled
+SHADER_DIR_9 = $$OUT_PWD/renderer/d3d9/shaders/compiled
+SHADER_DIR_11 = $$OUT_PWD/renderer/d3d11/shaders/compiled
for (ps, PIXEL_SHADERS_BLIT) {
fxc_ps_$${ps}.commands = $$FXC /nologo /E $$ps /T ps_2_0 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
- fxc_ps_$${ps}.output = $$SHADER_DIR/$${ps}.h
+ fxc_ps_$${ps}.output = $$SHADER_DIR_9/$${ps}.h
fxc_ps_$${ps}.input = PS_BLIT_INPUT
fxc_ps_$${ps}.dependency_type = TYPE_C
fxc_ps_$${ps}.variable_out = HEADERS
fxc_ps_$${ps}.CONFIG += target_predeps
- QMAKE_EXTRA_COMPILERS += fxc_ps_$${ps}
+ !winrt: QMAKE_EXTRA_COMPILERS += fxc_ps_$${ps}
}
for (ps, PIXEL_SHADERS_PASSTHROUGH) {
fxc_ps_$${ps}.commands = $$FXC /nologo /E PS_$$ps /T ps_4_0_level_9_1 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
- fxc_ps_$${ps}.output = $$SHADER_DIR/$${ps}11ps.h
+ fxc_ps_$${ps}.output = $$SHADER_DIR_11/$${ps}11ps.h
fxc_ps_$${ps}.input = PASSTHROUGH_INPUT
fxc_ps_$${ps}.dependency_type = TYPE_C
fxc_ps_$${ps}.variable_out = HEADERS
fxc_ps_$${ps}.CONFIG += target_predeps
- QMAKE_EXTRA_COMPILERS += fxc_ps_$${ps}
+ angle_d3d11: QMAKE_EXTRA_COMPILERS += fxc_ps_$${ps}
}
for (ps, PIXEL_SHADERS_CLEAR) {
fxc_ps_$${ps}.commands = $$FXC /nologo /E PS_$$ps /T ps_4_0_level_9_1 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
- fxc_ps_$${ps}.output = $$SHADER_DIR/$${ps}11ps.h
+ fxc_ps_$${ps}.output = $$SHADER_DIR_11/$${ps}11ps.h
fxc_ps_$${ps}.input = CLEAR_INPUT
fxc_ps_$${ps}.dependency_type = TYPE_C
fxc_ps_$${ps}.variable_out = HEADERS
fxc_ps_$${ps}.CONFIG += target_predeps
- QMAKE_EXTRA_COMPILERS += fxc_ps_$${ps}
+ angle_d3d11: QMAKE_EXTRA_COMPILERS += fxc_ps_$${ps}
}
for (vs, VERTEX_SHADERS_BLIT) {
fxc_vs_$${vs}.commands = $$FXC /nologo /E $$vs /T vs_2_0 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
- fxc_vs_$${vs}.output = $$SHADER_DIR/$${vs}.h
+ fxc_vs_$${vs}.output = $$SHADER_DIR_9/$${vs}.h
fxc_vs_$${vs}.input = VS_BLIT_INPUT
fxc_vs_$${vs}.dependency_type = TYPE_C
fxc_vs_$${vs}.variable_out = HEADERS
fxc_vs_$${vs}.CONFIG += target_predeps
- QMAKE_EXTRA_COMPILERS += fxc_vs_$${vs}
+ !winrt: QMAKE_EXTRA_COMPILERS += fxc_vs_$${vs}
}
for (vs, VERTEX_SHADERS_PASSTHROUGH) {
fxc_vs_$${vs}.commands = $$FXC /nologo /E VS_$$vs /T vs_4_0_level_9_1 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
- fxc_vs_$${vs}.output = $$SHADER_DIR/$${vs}11vs.h
+ fxc_vs_$${vs}.output = $$SHADER_DIR_11/$${vs}11vs.h
fxc_vs_$${vs}.input = PASSTHROUGH_INPUT
fxc_vs_$${vs}.dependency_type = TYPE_C
fxc_vs_$${vs}.variable_out = HEADERS
fxc_vs_$${vs}.CONFIG += target_predeps
- QMAKE_EXTRA_COMPILERS += fxc_vs_$${vs}
+ angle_d3d11: QMAKE_EXTRA_COMPILERS += fxc_vs_$${vs}
}
for (vs, VERTEX_SHADERS_CLEAR) {
fxc_vs_$${vs}.commands = $$FXC /nologo /E VS_$$vs /T vs_4_0_level_9_1 /Fh ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
- fxc_vs_$${vs}.output = $$SHADER_DIR/$${vs}11vs.h
+ fxc_vs_$${vs}.output = $$SHADER_DIR_11/$${vs}11vs.h
fxc_vs_$${vs}.input = CLEAR_INPUT
fxc_vs_$${vs}.dependency_type = TYPE_C
fxc_vs_$${vs}.variable_out = HEADERS
fxc_vs_$${vs}.CONFIG += target_predeps
- QMAKE_EXTRA_COMPILERS += fxc_vs_$${vs}
+ angle_d3d11: QMAKE_EXTRA_COMPILERS += fxc_vs_$${vs}
}
load(qt_installs)
diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h
index ce2afb9c28..5dd43a015e 100644
--- a/src/concurrent/qtconcurrentmedian.h
+++ b/src/concurrent/qtconcurrentmedian.h
@@ -104,8 +104,10 @@ public:
dirty = false;
// This is a workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58800
-// Avoid using std::nth_element for stdlibc++ <= 4.7.3 || (>= 4.8.0 && <= 4.8.2)
-#if defined(__GLIBCXX__) && (__GLIBCXX__ <= 20130411 || (__GLIBCXX__ >= 20130322 && __GLIBCXX__ <= 20131016))
+// Avoid using std::nth_element for the affected stdlibc++ releases 4.7.3 and 4.8.2.
+// Note that the official __GLIBCXX__ value of the releases is not used since that
+// one might be patched on some GNU/Linux distributions.
+#if defined(__GLIBCXX__) && __GLIBCXX__ <= 20140107
QVector<T> sorted = values;
std::sort(sorted.begin(), sorted.end());
currentMedian = sorted.at(bufferSize / 2);
diff --git a/src/corelib/arch/qatomic_armv5.h b/src/corelib/arch/qatomic_armv5.h
index 6939650c54..253b9263de 100644
--- a/src/corelib/arch/qatomic_armv5.h
+++ b/src/corelib/arch/qatomic_armv5.h
@@ -54,6 +54,7 @@ QT_END_NAMESPACE
#pragma qt_sync_stop_processing
#endif
+#define Q_ATOMIC_INT32_IS_SUPPORTED
#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE
#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE
#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE
@@ -98,6 +99,7 @@ template <int size> struct QBasicAtomicOps: QGenericAtomicOps<QBasicAtomicOps<si
static Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return false; }
static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return false; }
template <typename T> static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW;
+ template <typename T> static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW;
template <typename T> static T fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW;
template <typename T> static
T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW;
@@ -133,6 +135,18 @@ bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW
}
template<> template <typename T> inline
+bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
+{
+ T originalValue;
+ do {
+ originalValue = _q_value;
+ if (originalValue != expectedValue)
+ return false;
+ } while (_q_cmpxchg(expectedValue, newValue, &_q_value) != 0);
+ return true;
+}
+
+template<> template <typename T> inline
bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
{
T originalValue;
diff --git a/src/corelib/arch/qatomic_armv6.h b/src/corelib/arch/qatomic_armv6.h
index 4f1c758ded..31a06541ed 100644
--- a/src/corelib/arch/qatomic_armv6.h
+++ b/src/corelib/arch/qatomic_armv6.h
@@ -90,6 +90,10 @@ template <int size> struct QBasicAtomicOps: QGenericAtomicOps<QBasicAtomicOps<si
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return true; }
template <typename T> static
T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW;
+
+private:
+ template <typename T> static inline T shrinkFrom32Bit(T value);
+ template <typename T> static inline T extendTo32Bit(T value);
};
template <typename T> struct QAtomicOps : QBasicAtomicOps<sizeof(T)>
@@ -257,6 +261,36 @@ template<> struct QAtomicOpsSupport<8> { enum { IsSupported = 1 }; };
#define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_ALWAYS_NATIVE
+// note: if T is signed, parameters are passed sign-extended in the
+// registers. However, our 8- and 16-bit operations don't do sign
+// extension. So we need to clear out the input on entry and sign-extend again
+// on exit.
+template<int Size> template <typename T>
+T QBasicAtomicOps<Size>::shrinkFrom32Bit(T value)
+{
+ Q_STATIC_ASSERT(Size == 1 || Size == 2);
+ if (T(-1) > T(0))
+ return value; // unsigned, ABI will zero extend
+ if (Size == 1)
+ asm volatile("and %0, %0, %1" : "+r" (value) : "I" (0xff));
+ else
+ asm volatile("and %0, %0, %1" : "+r" (value) : "r" (0xffff));
+ return value;
+}
+
+template<int Size> template <typename T>
+T QBasicAtomicOps<Size>::extendTo32Bit(T value)
+{
+ Q_STATIC_ASSERT(Size == 1 || Size == 2);
+ if (T(-1) > T(0))
+ return value; // unsigned, ABI will zero extend
+ if (Size == 1)
+ asm volatile("sxtb %0, %0" : "+r" (value));
+ else
+ asm volatile("sxth %0, %0" : "+r" (value));
+ return value;
+}
+
template<> template<typename T> inline
bool QBasicAtomicOps<1>::ref(T &_q_value) Q_DECL_NOTHROW
{
@@ -308,7 +342,7 @@ bool QBasicAtomicOps<1>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa
"beq 0b\n"
: [result] "=&r" (result),
"+m" (_q_value)
- : [expectedValue] "r" (expectedValue),
+ : [expectedValue] "r" (shrinkFrom32Bit(expectedValue)),
[newValue] "r" (newValue),
[_q_value] "r" (&_q_value)
: "cc");
@@ -330,11 +364,11 @@ bool QBasicAtomicOps<1>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
"+m" (_q_value)
- : [expectedValue] "r" (expectedValue),
+ : [expectedValue] "r" (shrinkFrom32Bit(expectedValue)),
[newValue] "r" (newValue),
[_q_value] "r" (&_q_value)
: "cc");
- *currentValue = tempValue;
+ *currentValue = extendTo32Bit(tempValue);
return result == 0;
}
@@ -354,7 +388,7 @@ T QBasicAtomicOps<1>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR
: [newValue] "r" (newValue),
[_q_value] "r" (&_q_value)
: "cc");
- return originalValue;
+ return extendTo32Bit(originalValue);
}
template<> template <typename T> inline
@@ -376,7 +410,7 @@ T QBasicAtomicOps<1>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveTy
: [valueToAdd] "r" (valueToAdd * QAtomicAdditiveType<T>::AddScale),
[_q_value] "r" (&_q_value)
: "cc");
- return originalValue;
+ return extendTo32Bit(originalValue);
}
template<> template<typename T> inline
@@ -430,7 +464,7 @@ bool QBasicAtomicOps<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa
"beq 0b\n"
: [result] "=&r" (result),
"+m" (_q_value)
- : [expectedValue] "r" (expectedValue),
+ : [expectedValue] "r" (shrinkFrom32Bit(expectedValue)),
[newValue] "r" (newValue),
[_q_value] "r" (&_q_value)
: "cc");
@@ -452,11 +486,11 @@ bool QBasicAtomicOps<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
"+m" (_q_value)
- : [expectedValue] "r" (expectedValue),
+ : [expectedValue] "r" (shrinkFrom32Bit(expectedValue)),
[newValue] "r" (newValue),
[_q_value] "r" (&_q_value)
: "cc");
- *currentValue = tempValue;
+ *currentValue = extendTo32Bit(tempValue);
return result == 0;
}
@@ -476,7 +510,7 @@ T QBasicAtomicOps<2>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR
: [newValue] "r" (newValue),
[_q_value] "r" (&_q_value)
: "cc");
- return originalValue;
+ return extendTo32Bit(originalValue);
}
template<> template <typename T> inline
@@ -498,7 +532,7 @@ T QBasicAtomicOps<2>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveTy
: [valueToAdd] "r" (valueToAdd * QAtomicAdditiveType<T>::AddScale),
[_q_value] "r" (&_q_value)
: "cc");
- return originalValue;
+ return extendTo32Bit(originalValue);
}
// Explanation from GCC's source code (config/arm/arm.c) on the modifiers below:
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 2552ddebe9..7e3e629c47 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -993,6 +993,8 @@ QString QTextDecoder::toUnicode(const char *chars, int len)
return c->toUnicode(chars, len, &state);
}
+// in qstring.cpp:
+void qt_from_latin1(ushort *dst, const char *str, size_t size);
/*! \overload
@@ -1005,12 +1007,10 @@ void QTextDecoder::toUnicode(QString *target, const char *chars, int len)
case 106: // utf8
static_cast<const QUtf8Codec*>(c)->convertToUnicode(target, chars, len, &state);
break;
- case 4: { // latin1
+ case 4: // latin1
target->resize(len);
- ushort *data = (ushort*)target->data();
- for (int i = len; i >=0; --i)
- data[i] = (uchar) chars[i];
- } break;
+ qt_from_latin1((ushort*)target->data(), chars, len);
+ break;
default:
*target = c->toUnicode(chars, len, &state);
}
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index a5d16b0b54..54312601e4 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -85,7 +85,7 @@ static inline bool simdEncodeAscii(uchar *&dst, const ushort *&nextAscii, const
// we don't want to load 32 bytes again in this loop if we know there are non-ASCII
// characters still coming
n = _bit_scan_reverse(n);
- nextAscii = src + n;
+ nextAscii = src + n + 1;
return false;
}
@@ -115,7 +115,7 @@ static inline bool simdDecodeAscii(ushort *&dst, const uchar *&nextAscii, const
// we don't want to load 16 bytes again in this loop if we know there are non-ASCII
// characters still coming
n = _bit_scan_reverse(n);
- nextAscii = src + n;
+ nextAscii = src + n + 1;
return false;
}
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 373b3f148d..79c90e0664 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -24,6 +24,9 @@ ANDROID_LIB_DEPENDENCIES = \
ANDROID_BUNDLED_JAR_DEPENDENCIES = \
jar/QtAndroid-bundled.jar \
jar/QtAndroidAccessibility-bundled.jar
+ANDROID_PERMISSIONS = \
+ android.permission.INTERNET \
+ android.permission.WRITE_EXTERNAL_STORAGE
load(qt_module)
diff --git a/src/corelib/doc/snippets/signalmapper/filereader.cpp b/src/corelib/doc/snippets/signalmapper/filereader.cpp
index cb83ea9362..6770510f5e 100644
--- a/src/corelib/doc/snippets/signalmapper/filereader.cpp
+++ b/src/corelib/doc/snippets/signalmapper/filereader.cpp
@@ -74,8 +74,8 @@ FileReader::FileReader(QWidget *parent)
//! [2]
//slower due to signature normalization at runtime
- connect(signalMapper, SIGNAL(mapped(const QString &)),
- this, SLOT(readFile(const QString &)));
+ connect(signalMapper, SIGNAL(mapped(QString)),
+ this, SLOT(readFile(QString)));
//! [2]
*/
QHBoxLayout *buttonLayout = new QHBoxLayout;
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index 789f500cab..efa585ff3e 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -29,15 +29,6 @@ SOURCES += \
# qlibraryinfo.cpp includes qconfig.cpp
INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global
-# configure creates these, not syncqt, so we need to manually inject them
-qconfig_h_files = \
- $$OUT_PWD/global/qfeatures.h \
- $$OUT_PWD/global/qconfig.h \
- $$QT_BUILD_TREE/include/QtCore/QtConfig
-targ_headers.files += $$qconfig_h_files
-contains(QMAKE_BUNDLE_DATA, FRAMEWORK_HEADERS): \
- FRAMEWORK_HEADERS.files += $$qconfig_h_files
-
# Only used on platforms with CONFIG += precompile_header
PRECOMPILED_HEADER = global/qt_pch.h
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 70f45345c6..1eb442aa5f 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -489,6 +489,7 @@
#ifdef Q_CC_INTEL
# define Q_COMPILER_RESTRICTED_VLA
+# define Q_COMPILER_VARIADIC_MACROS // C++11 feature supported as an extension in other modes, too
# if __INTEL_COMPILER < 1200
# define Q_NO_TEMPLATE_FRIENDS
# endif
@@ -498,7 +499,6 @@
# define Q_COMPILER_BINARY_LITERALS
# endif
# if __cplusplus >= 201103L
-# define Q_COMPILER_VARIADIC_MACROS
# if __INTEL_COMPILER >= 1200
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_CLASS_ENUM
@@ -560,6 +560,15 @@
# define Q_COMPILER_BINARY_LITERALS
# endif
+// Variadic macros are supported for gnu++98, c++11, c99 ... since 2.9
+# if ((__clang_major__ * 100) + __clang_minor__) >= 209
+# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \
+ || (defined(__cplusplus) && (__cplusplus >= 201103L)) \
+ || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
+# define Q_COMPILER_VARIADIC_MACROS
+# endif
+# endif
+
/* C++11 features, see http://clang.llvm.org/cxx_status.html */
# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
/* Detect C++ features using __has_feature(), see http://clang.llvm.org/docs/LanguageExtensions.html#cxx11 */
@@ -656,7 +665,6 @@
/* Features that have no __has_feature() check */
# if ((__clang_major__ * 100) + __clang_minor__) >= 209 /* since clang 2.9 */
# define Q_COMPILER_EXTERN_TEMPLATES
-# define Q_COMPILER_VARIADIC_MACROS
# endif
# endif
@@ -693,13 +701,18 @@
// GCC supports binary literals in C, C++98 and C++11 modes
# define Q_COMPILER_BINARY_LITERALS
# endif
+# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \
+ || (defined(__cplusplus) && (__cplusplus >= 201103L)) \
+ || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
+ // Variadic macros are supported for gnu++98, c++11, C99 ... since forever (gcc 2.97)
+# define Q_COMPILER_VARIADIC_MACROS
+# endif
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
/* C++11 features supported in GCC 4.3: */
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
-# define Q_COMPILER_VARIADIC_MACROS
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
/* C++11 features supported in GCC 4.4: */
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index fe10c493a7..710f7e8ba1 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -743,7 +743,7 @@ Q_STATIC_ASSERT_X(UCHAR_MAX == 255, "Qt assumes that char is 8 bits");
\relates <QtGlobal>
This enum describes the messages that can be sent to a message
- handler (QtMsgHandler). You can use the enum to identify and
+ handler (QtMessageHandler). You can use the enum to identify and
associate the various message types with the appropriate
actions.
@@ -2810,12 +2810,17 @@ int qrand()
The char pointer will be invalid after the statement in which
qPrintable() is used. This is because the array returned by
- toLocal8Bit() will fall out of scope.
+ QString::toLocal8Bit() will fall out of scope.
Example:
\snippet code/src_corelib_global_qglobal.cpp 37
+ \note qDebug(), qWarning(), qCritical(), qFatal() expect %s
+ arguments to be UTF-8 encoded, while qPrintable() converts to
+ local 8-bit encoding. Therefore using qPrintable for logging
+ strings is only safe if the argument contains only ASCII
+ characters.
\sa qDebug(), qWarning(), qCritical(), qFatal()
*/
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index ed1715ddb5..689de48e26 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -287,9 +287,9 @@ QLibraryInfo::buildDate()
\since 5.3
*/
-const char *QLibraryInfo::build()
+const char *QLibraryInfo::build() Q_DECL_NOTHROW
{
- static const char data[] = "Qt " QT_VERSION_STR " (" __DATE__ "), "
+ static const char data[] = "Qt " QT_VERSION_STR " (" __DATE__ ", "
COMPILER_STRING ", "
#if QT_POINTER_SIZE == 4
"32"
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 2a8a3b84b9..0b573c2e6a 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -59,7 +59,7 @@ public:
static QDate buildDate();
#endif //QT_NO_DATESTRING
- static const char * build();
+ static const char * build() Q_DECL_NOTHROW;
static bool isDebugBuild();
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 2327c11c69..ea3a3ca13d 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -720,8 +720,8 @@ QString QFileSystemEngine::tempPath()
temp = QFile::decodeName(qgetenv("TMPDIR"));
if (temp.isEmpty()) {
- qWarning("Neither the TEMP nor the TMPDIR environment variable is set, falling back to /tmp.");
- temp = QLatin1String("/tmp");
+ qWarning("Neither the TEMP nor the TMPDIR environment variable is set, falling back to /var/tmp.");
+ temp = QLatin1String("/var/tmp");
}
return QDir::cleanPath(temp);
#else
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index f37b9575aa..eb8aeaca50 100644
--- a/src/corelib/io/qloggingcategory.cpp
+++ b/src/corelib/io/qloggingcategory.cpp
@@ -109,7 +109,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
apply to a category/type, the rule that comes later is applied.
Rules can be set via \l setFilterRules(). Since Qt 5.3 logging rules
- are also automatically loaded from the \c [rules] section of a logging
+ are also automatically loaded from the \c [Rules] section of a logging
configuration file. Such configuration files are looked up in the QtProject
configuration directory, or explicitly set in a \c QT_LOGGING_CONF
environment variable.
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index b8fef16c0e..2619743ff4 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -203,7 +203,7 @@ void QLoggingSettingsParser::setContent(QTextStream &stream)
continue;
}
- if (_section == QLatin1String("rules")) {
+ if (_section == QLatin1String("Rules")) {
int equalPos = line.indexOf(QLatin1Char('='));
if ((equalPos != -1)
&& (line.lastIndexOf(QLatin1Char('=')) == equalPos)) {
@@ -298,7 +298,7 @@ void QLoggingRegistry::unregisterCategory(QLoggingCategory *cat)
void QLoggingRegistry::setApiRules(const QString &content)
{
QLoggingSettingsParser parser;
- parser.setSection(QStringLiteral("rules"));
+ parser.setSection(QStringLiteral("Rules"));
parser.setContent(content);
QMutexLocker locker(&registryMutex);
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index ebc97ca2d9..1e377abf3e 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -2606,16 +2606,16 @@ void QSortFilterProxyModel::invalidateFilter()
the following QVariant types:
\list
- \li QVariant::Int
- \li QVariant::UInt
- \li QVariant::LongLong
- \li QVariant::ULongLong
- \li QVariant::Double
- \li QVariant::Char
- \li QVariant::Date
- \li QVariant::Time
- \li QVariant::DateTime
- \li QVariant::String
+ \li QMetaType::Int
+ \li QMetaType::UInt
+ \li QMetaType::LongLong
+ \li QMetaType::ULongLong
+ \li QMetaType::Double
+ \li QMetaType::QChar
+ \li QMetaType::QDate
+ \li QMetaType::QTime
+ \li QMetaType::QDateTime
+ \li QMetaType::QString
\endlist
Any other type will be converted to a QString using
diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp
index 6e257df39d..90ce8c63a5 100644
--- a/src/corelib/json/qjsondocument.cpp
+++ b/src/corelib/json/qjsondocument.cpp
@@ -260,8 +260,8 @@ QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidati
/*!
Creates a QJsonDocument from the QVariant \a variant.
- If the \a variant contains any other type than a QVariant::Map,
- QVariant::List or QVariant::StringList, the returned document
+ If the \a variant contains any other type than a QVariantMap,
+ QVariantList or QStringList, the returned document
document is invalid.
\sa toVariant()
diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp
index c16824ebd2..487a431b8f 100644
--- a/src/corelib/json/qjsonvalue.cpp
+++ b/src/corelib/json/qjsonvalue.cpp
@@ -344,16 +344,16 @@ QJsonValue &QJsonValue::operator =(const QJsonValue &other)
The conversion will convert QVariant types as follows:
\list
- \li QVariant::Bool to Bool
- \li QVariant::Int
- \li QVariant::Double
- \li QVariant::LongLong
- \li QVariant::ULongLong
- \li QVariant::UInt to Double
- \li QVariant::String to String
- \li QVariant::StringList
- \li QVariant::VariantList to Array
- \li QVariant::VariantMap to Object
+ \li QMetaType::Bool to Bool
+ \li QMetaType::Int
+ \li QMetaType::Double
+ \li QMetaType::LongLong
+ \li QMetaType::ULongLong
+ \li QMetaType::UInt to Double
+ \li QMetaType::QString to String
+ \li QMetaType::QStringList
+ \li QMetaType::QVariantList to Array
+ \li QMetaType::QVariantMap to Object
\endlist
For all other QVariant types a conversion to a QString will be attempted. If the returned string
@@ -395,9 +395,9 @@ QJsonValue QJsonValue::fromVariant(const QVariant &variant)
The QJsonValue types will be converted as follows:
\value Null QVariant()
- \value Bool QVariant::Bool
- \value Double QVariant::Double
- \value String QVariant::String
+ \value Bool QMetaType::Bool
+ \value Double QMetaType::Double
+ \value String QString
\value Array QVariantList
\value Object QVariantMap
\value Undefined QVariant()
diff --git a/src/corelib/kernel/qjni_p.h b/src/corelib/kernel/qjni_p.h
index b1f0011b94..83dd3a00af 100644
--- a/src/corelib/kernel/qjni_p.h
+++ b/src/corelib/kernel/qjni_p.h
@@ -177,7 +177,7 @@ public:
{
jobject jobj = static_cast<jobject>(o);
if (!isSameObject(jobj)) {
- d = QSharedPointer<QJNIObjectData>(new QJNIObjectData());
+ d = QSharedPointer<QJNIObjectData>::create();
if (jobj) {
QJNIEnvironmentPrivate env;
d->m_jobject = env->NewGlobalRef(jobj);
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index dd9a7693ca..5e8f330a92 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1165,7 +1165,7 @@ Q_CORE_EXPORT void QVariantPrivate::registerHandler(const int /* Modules::Names
instead to construct variants from the pointer types represented by
\c QMetaType::VoidStar, and \c QMetaType::QObjectStar.
- \sa QVariant::fromValue(), Type
+ \sa QVariant::fromValue(), QMetaType::Type
*/
/*!
@@ -1765,7 +1765,7 @@ const char *QVariant::typeName() const
}
/*!
- Convert this variant to type Invalid and free up any resources
+ Convert this variant to type QMetaType::UnknownType and free up any resources
used.
*/
void QVariant::clear()
@@ -1781,7 +1781,7 @@ void QVariant::clear()
Converts the int representation of the storage type, \a typeId, to
its string representation.
- Returns a null pointer if the type is QVariant::Invalid or doesn't exist.
+ Returns a null pointer if the type is QMetaType::UnknownType or doesn't exist.
*/
const char *QVariant::typeToName(int typeId)
{
@@ -2019,7 +2019,7 @@ QDataStream& operator<<(QDataStream &s, const QVariant::Type p)
\fn bool QVariant::isValid() const
Returns \c true if the storage type of this variant is not
- QVariant::Invalid; otherwise returns \c false.
+ QMetaType::UnknownType; otherwise returns \c false.
*/
template <typename T>
@@ -3488,7 +3488,7 @@ QDebug operator<<(QDebug dbg, const QVariant::Type p)
/*!
\class QSequentialIterable
-
+ \since 5.2
\inmodule QtCore
\brief The QSequentialIterable class is an iterable interface for a container in a QVariant.
@@ -3591,7 +3591,7 @@ bool QSequentialIterable::canReverseIterate() const
/*!
\class QSequentialIterable::const_iterator
-
+ \since 5.2
\inmodule QtCore
\brief The QSequentialIterable::const_iterator allows iteration over a container in a QVariant.
@@ -3794,7 +3794,7 @@ QSequentialIterable::const_iterator QSequentialIterable::const_iterator::operato
/*!
\class QAssociativeIterable
-
+ \since 5.2
\inmodule QtCore
\brief The QAssociativeIterable class is an iterable interface for an associative container in a QVariant.
@@ -3899,7 +3899,7 @@ int QAssociativeIterable::size() const
/*!
\class QAssociativeIterable::const_iterator
-
+ \since 5.2
\inmodule QtCore
\brief The QAssociativeIterable::const_iterator allows iteration over a container in a QVariant.
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index 90b5649f09..534f310d36 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -135,7 +135,7 @@ struct QTypedArrayData
public:
T *i;
typedef std::random_access_iterator_tag iterator_category;
- typedef qptrdiff difference_type;
+ typedef int difference_type;
typedef T value_type;
typedef T *pointer;
typedef T &reference;
@@ -169,7 +169,7 @@ struct QTypedArrayData
public:
const T *i;
typedef std::random_access_iterator_tag iterator_category;
- typedef qptrdiff difference_type;
+ typedef int difference_type;
typedef T value_type;
typedef const T *pointer;
typedef const T &reference;
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h
index c8a0825480..b94c6b50ea 100644
--- a/src/corelib/tools/qarraydataops.h
+++ b/src/corelib/tools/qarraydataops.h
@@ -122,7 +122,7 @@ struct QPodArrayOps
Q_ASSERT(b >= this->begin() && b < this->end());
Q_ASSERT(e > this->begin() && e < this->end());
- ::memmove(b, e, (this->end() - e) * sizeof(T));
+ ::memmove(b, e, (static_cast<T *>(this->end()) - e) * sizeof(T));
this->size -= (e - b);
}
};
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 3030657a62..52207dcd4e 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -3665,12 +3665,6 @@ QByteArray QByteArray::toBase64(Base64Options options) const
\sa toUShort()
*/
-/*!
- \overload
-
- \sa toLongLong()
-*/
-
static char *qulltoa2(char *p, qulonglong n, int base)
{
#if defined(QT_CHECK_RANGE)
@@ -3689,6 +3683,11 @@ static char *qulltoa2(char *p, qulonglong n, int base)
return p;
}
+/*!
+ \overload
+
+ \sa toLongLong()
+*/
QByteArray &QByteArray::setNum(qlonglong n, int base)
{
const int buffsize = 66; // big enough for MAX_ULLONG in base 2
diff --git a/src/corelib/tools/qbytearraylist.h b/src/corelib/tools/qbytearraylist.h
index 5ce6509c28..882bc68f09 100644
--- a/src/corelib/tools/qbytearraylist.h
+++ b/src/corelib/tools/qbytearraylist.h
@@ -97,9 +97,8 @@ inline QByteArray QByteArrayList::join(char sep) const
inline QByteArrayList operator+(const QByteArrayList &lhs, const QByteArrayList &rhs)
{
- QByteArrayList res;
- res.append( lhs );
- res.append( rhs );
+ QByteArrayList res = lhs;
+ res += rhs;
return res;
}
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 5320ea1fbf..a5d14a3535 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -337,20 +337,29 @@ uint qt_hash(const QStringRef &key) Q_DECL_NOTHROW
}
/*
- The prime_deltas array is a table of selected prime values, even
- though it doesn't look like one. The primes we are using are 1,
- 2, 5, 11, 17, 37, 67, 131, 257, ..., i.e. primes in the immediate
- surrounding of a power of two.
+ The prime_deltas array contains the difference between a power
+ of two and the next prime number:
- The primeForNumBits() function returns the prime associated to a
- power of two. For example, primeForNumBits(8) returns 257.
+ prime_deltas[i] = nextprime(2^i) - 2^i
+
+ Basically, it's sequence A092131 from OEIS, assuming:
+ - nextprime(1) = 1
+ - nextprime(2) = 2
+ and
+ - left-extending it for the offset 0 (A092131 starts at i=1)
+ - stopping the sequence at i = 28 (the table is big enough...)
*/
static const uchar prime_deltas[] = {
- 0, 0, 1, 3, 1, 5, 3, 3, 1, 9, 7, 5, 3, 9, 25, 3,
- 1, 21, 3, 21, 7, 15, 9, 5, 3, 29, 15, 0, 0, 0, 0, 0
+ 0, 0, 1, 3, 1, 5, 3, 3, 1, 9, 7, 5, 3, 17, 27, 3,
+ 1, 29, 3, 21, 7, 17, 15, 9, 43, 35, 15, 0, 0, 0, 0, 0
};
+/*
+ The primeForNumBits() function returns the prime associated to a
+ power of two. For example, primeForNumBits(8) returns 257.
+*/
+
static inline int primeForNumBits(int numBits)
{
return (1 << numBits) + prime_deltas[numBits];
diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp
index c5bd8468bc..088f0dc083 100644
--- a/src/corelib/tools/qmargins.cpp
+++ b/src/corelib/tools/qmargins.cpp
@@ -158,86 +158,63 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QRect operator+(const QRect &rectangle, const QMargins &margins)
- \relates QRect
-
- Returns the \a rectangle grown by the \a margins.
-
- \since 5.1
-*/
-
-/*!
- \fn QRect operator+(const QMargins &margins, const QRect &rectangle)
- \relates QRect
- \overload
-
- Returns the \a rectangle grown by the \a margins.
-
- \since 5.1
-*/
-
-/*!
- \fn QRect QRect::marginsAdded(const QMargins &margins) const
-
- Returns a rectangle grown by the \a margins.
-
- \sa operator+=(), marginsRemoved(), operator-=()
-
- \since 5.1
-*/
-
-/*!
- \fn QRect QRect::operator+=(const QMargins &margins) const
+ \fn const QMargins operator+(const QMargins &m1, const QMargins &m2)
+ \relates QMargins
- Adds the \a margins to the rectangle, growing it.
+ Returns a QMargins object that is the sum of the given margins, \a m1
+ and \a m2; each component is added separately.
- \sa marginsAdded(), marginsRemoved(), operator-=()
+ \sa QMargins::operator+=(), QMargins::operator-=()
\since 5.1
*/
/*!
- \fn QRect QRect::marginsRemoved(const QMargins &margins) const
+ \fn const QMargins operator-(const QMargins &m1, const QMargins &m2)
+ \relates QMargins
- Removes the \a margins from the rectangle, shrinking it.
+ Returns a QMargins object that is formed by subtracting \a m2 from
+ \a m1; each component is subtracted separately.
- \sa marginsAdded(), operator+=(), operator-=()
+ \sa QMargins::operator+=(), QMargins::operator-=()
\since 5.1
*/
/*!
- \fn QRect QRect::operator -=(const QMargins &margins) const
+ \fn const QMargins operator+(const QMargins &lhs, int rhs)
+ \relates QMargins
- Returns a rectangle shrunk by the \a margins.
+ Returns a QMargins object that is formed by adding \a rhs to
+ \a lhs.
- \sa marginsRemoved(), operator+=(), marginsAdded()
+ \sa QMargins::operator+=(), QMargins::operator-=()
- \since 5.1
+ \since 5.3
*/
/*!
- \fn const QMargins operator+(const QMargins &m1, const QMargins &m2)
+ \fn const QMargins operator+(int lhs, const QMargins &rhs)
\relates QMargins
- Returns a QMargins object that is the sum of the given margins, \a m1
- and \a m2; each component is added separately.
+ Returns a QMargins object that is formed by adding \a lhs to
+ \a rhs.
\sa QMargins::operator+=(), QMargins::operator-=()
- \since 5.1
+ \since 5.3
*/
/*!
- \fn const QMargins operator-(const QMargins &m1, const QMargins &m2)
+ \fn const QMargins operator-(const QMargins &lhs, int rhs)
\relates QMargins
- Returns a QMargins object that is formed by subtracting \a m2 from
- \a m1; each component is subtracted separately.
+ Returns a QMargins object that is formed by subtracting \a rhs from
+ \a lhs.
\sa QMargins::operator+=(), QMargins::operator-=()
- \since 5.1
+ \since 5.3
*/
/*!
@@ -317,6 +294,15 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \fn QMargins operator+(const QMargins &margins)
+ \relates QMargins
+
+ Returns a QMargin object that is formed from all components of \a margins.
+
+ \since 5.3
+*/
+
+/*!
\fn QMargins operator-(const QMargins &margins)
\relates QMargins
@@ -440,4 +426,336 @@ QDebug operator<<(QDebug dbg, const QMargins &m) {
}
#endif
+/*!
+ \class QMarginsF
+ \inmodule QtCore
+ \ingroup painting
+ \since 5.3
+
+ \brief The QMarginsF class defines the four margins of a rectangle.
+
+ QMarginsF defines a set of four margins; left, top, right and bottom,
+ that describe the size of the borders surrounding a rectangle.
+
+ The isNull() function returns \c true only if all margins are set to zero.
+
+ QMarginsF objects can be streamed as well as compared.
+*/
+
+
+/*****************************************************************************
+ QMarginsF member functions
+ *****************************************************************************/
+
+/*!
+ \fn QMarginsF::QMarginsF()
+
+ Constructs a margins object with all margins set to 0.
+
+ \sa isNull()
+*/
+
+/*!
+ \fn QMarginsF::QMarginsF(qreal left, qreal top, qreal right, qreal bottom)
+
+ Constructs margins with the given \a left, \a top, \a right, \a bottom
+
+ \sa setLeft(), setRight(), setTop(), setBottom()
+*/
+
+/*!
+ \fn QMarginsF::QMarginsF(const QMargins &margins)
+
+ Constructs margins copied from the given \a margins
+*/
+
+/*!
+ \fn bool QMarginsF::isNull() const
+
+ Returns \c true if all margins are is 0; otherwise returns
+ false.
+*/
+
+
+/*!
+ \fn qreal QMarginsF::left() const
+
+ Returns the left margin.
+
+ \sa setLeft()
+*/
+
+/*!
+ \fn qreal QMarginsF::top() const
+
+ Returns the top margin.
+
+ \sa setTop()
+*/
+
+/*!
+ \fn qreal QMarginsF::right() const
+
+ Returns the right margin.
+*/
+
+/*!
+ \fn qreal QMarginsF::bottom() const
+
+ Returns the bottom margin.
+*/
+
+
+/*!
+ \fn void QMarginsF::setLeft(qreal left)
+
+ Sets the left margin to \a left.
+*/
+
+/*!
+ \fn void QMarginsF::setTop(qreal Top)
+
+ Sets the Top margin to \a Top.
+*/
+
+/*!
+ \fn void QMarginsF::setRight(qreal right)
+
+ Sets the right margin to \a right.
+*/
+
+/*!
+ \fn void QMarginsF::setBottom(qreal bottom)
+
+ Sets the bottom margin to \a bottom.
+*/
+
+/*!
+ \fn bool operator==(const QMarginsF &lhs, const QMarginsF &rhs)
+ \relates QMarginsF
+
+ Returns \c true if \a lhs and \a rhs are equal; otherwise returns \c false.
+*/
+
+/*!
+ \fn bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs)
+ \relates QMarginsF
+
+ Returns \c true if \a lhs and \a rhs are different; otherwise returns \c false.
+*/
+
+/*!
+ \fn const QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs)
+ \relates QMarginsF
+
+ Returns a QMarginsF object that is the sum of the given margins, \a lhs
+ and \a rhs; each component is added separately.
+
+ \sa QMarginsF::operator+=(), QMarginsF::operator-=()
+*/
+
+/*!
+ \fn const QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs)
+ \relates QMarginsF
+
+ Returns a QMarginsF object that is formed by subtracting \a rhs from
+ \a lhs; each component is subtracted separately.
+
+ \sa QMarginsF::operator+=(), QMarginsF::operator-=()
+*/
+
+/*!
+ \fn const QMarginsF operator+(const QMarginsF &lhs, qreal rhs)
+ \relates QMarginsF
+
+ Returns a QMarginsF object that is formed by adding \a rhs to
+ \a lhs.
+
+ \sa QMarginsF::operator+=(), QMarginsF::operator-=()
+*/
+
+/*!
+ \fn const QMarginsF operator+(qreal lhs, const QMarginsF &rhs)
+ \relates QMarginsF
+
+ Returns a QMarginsF object that is formed by adding \a lhs to
+ \a rhs.
+
+ \sa QMarginsF::operator+=(), QMarginsF::operator-=()
+*/
+
+/*!
+ \fn const QMarginsF operator-(const QMarginsF &lhs, qreal rhs)
+ \relates QMarginsF
+
+ Returns a QMarginsF object that is formed by subtracting \a rhs from
+ \a lhs.
+
+ \sa QMarginsF::operator+=(), QMarginsF::operator-=()
+*/
+
+/*!
+ \fn const QMarginsF operator*(const QMarginsF &lhs, qreal rhs)
+ \relates QMarginsF
+ \overload
+
+ Returns a QMarginsF object that is formed by multiplying each component
+ of the given \a lhs margins by \a rhs factor.
+
+ \sa QMarginsF::operator*=(), QMarginsF::operator/=()
+*/
+
+/*!
+ \fn const QMarginsF operator*(qreal lhs, const QMarginsF &rhs)
+ \relates QMarginsF
+ \overload
+
+ Returns a QMarginsF object that is formed by multiplying each component
+ of the given \a lhs margins by \a rhs factor.
+
+ \sa QMarginsF::operator*=(), QMarginsF::operator/=()
+*/
+
+/*!
+ \fn const QMarginsF operator/(const QMarginsF &lhs, qreal rhs)
+ \relates QMarginsF
+ \overload
+
+ Returns a QMarginsF object that is formed by dividing the components of
+ the given \a lhs margins by the given \a rhs divisor.
+
+ \sa QMarginsF::operator*=(), QMarginsF::operator/=()
+*/
+
+/*!
+ \fn QMarginsF operator+(const QMarginsF &margins)
+ \relates QMarginsF
+
+ Returns a QMargin object that is formed from all components of \a margins.
+*/
+
+/*!
+ \fn QMarginsF operator-(const QMarginsF &margins)
+ \relates QMarginsF
+
+ Returns a QMargin object that is formed by negating all components of \a margins.
+*/
+
+/*!
+ \fn QMarginsF &QMarginsF::operator+=(const QMarginsF &margins)
+
+ Add each component of \a margins to the respective component of this object
+ and returns a reference to it.
+
+ \sa operator-=()
+*/
+
+/*!
+ \fn QMarginsF &QMarginsF::operator-=(const QMarginsF &margins)
+
+ Subtract each component of \a margins from the respective component of this object
+ and returns a reference to it.
+
+ \sa operator+=()
+*/
+
+/*!
+ \fn QMarginsF &QMarginsF::operator+=(qreal addend)
+ \overload
+
+ Adds the \a addend to each component of this object
+ and returns a reference to it.
+
+ \sa operator-=()
+*/
+
+/*!
+ \fn QMarginsF &QMarginsF::operator-=(qreal subtrahend)
+ \overload
+
+ Subtracts the \a subtrahend from each component of this object
+ and returns a reference to it.
+
+ \sa operator+=()
+*/
+
+/*!
+ \fn QMarginsF &QMarginsF::operator*=(qreal factor)
+
+ Multiplies each component of this object by \a factor
+ and returns a reference to it.
+
+ \sa operator/=()
+*/
+
+/*!
+ \fn QMarginsF &QMarginsF::operator/=(qreal divisor)
+
+ Divides each component of this object by \a divisor
+ and returns a reference to it.
+
+ \sa operator*=()
+*/
+
+/*!
+ \fn QMargins QMarginsF::toMargins() const
+
+ Returns an integer based copy of this margins object.
+
+ Note that the components in the returned margins will be rounded to
+ the nearest integer.
+
+ \sa QMarginsF()
+*/
+
+/*****************************************************************************
+ QMarginsF stream functions
+ *****************************************************************************/
+#ifndef QT_NO_DATASTREAM
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QMarginsF &m)
+ \relates QMarginsF
+
+ Writes margin \a m to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Serializing Qt Data Types}
+*/
+
+QDataStream &operator<<(QDataStream &s, const QMarginsF &m)
+{
+ s << double(m.left()) << double(m.top()) << double(m.right()) << double(m.bottom());
+ return s;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QMarginsF &m)
+ \relates QMarginsF
+
+ Reads a margin from the given \a stream into margin \a m
+ and returns a reference to the stream.
+
+ \sa {Serializing Qt Data Types}
+*/
+
+QDataStream &operator>>(QDataStream &s, QMarginsF &m)
+{
+ double left, top, right, bottom;
+ s >> left;
+ s >> top;
+ s >> right;
+ s >> bottom;
+ m = QMarginsF(qreal(left), qreal(top), qreal(right), qreal(bottom));
+ return s;
+}
+#endif // QT_NO_DATASTREAM
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QMarginsF &m) {
+ dbg.nospace() << "QMarginsF(" << m.left() << ", "
+ << m.top() << ", " << m.right() << ", " << m.bottom() << ')';
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h
index ad5e94cefe..d96ccaccae 100644
--- a/src/corelib/tools/qmargins.h
+++ b/src/corelib/tools/qmargins.h
@@ -42,10 +42,13 @@
#ifndef QMARGINS_H
#define QMARGINS_H
-#include <QtCore/qrect.h>
+#include <QtCore/qnamespace.h>
QT_BEGIN_NAMESPACE
+/*****************************************************************************
+ QMargins class
+ *****************************************************************************/
class QMargins
{
@@ -149,51 +152,34 @@ Q_DECL_CONSTEXPR inline bool operator!=(const QMargins &m1, const QMargins &m2)
m1.m_bottom != m2.m_bottom;
}
-Q_DECL_CONSTEXPR inline QRect operator+(const QRect &rectangle, const QMargins &margins)
-{
- return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()),
- QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()));
-}
-
-Q_DECL_CONSTEXPR inline QRect operator+(const QMargins &margins, const QRect &rectangle)
-{
- return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()),
- QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()));
-}
-
-inline QRect QRect::marginsAdded(const QMargins &margins) const
-{
- return *this + margins;
-}
-
-inline QRect QRect::marginsRemoved(const QMargins &margins) const
+Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &m1, const QMargins &m2)
{
- return QRect(QPoint(x1 + margins.left(), y1 + margins.top()),
- QPoint(x2 - margins.right(), y2 - margins.bottom()));
+ return QMargins(m1.left() + m2.left(), m1.top() + m2.top(),
+ m1.right() + m2.right(), m1.bottom() + m2.bottom());
}
-inline QRect &QRect::operator+=(const QMargins &margins)
+Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &m1, const QMargins &m2)
{
- *this = marginsAdded(margins);
- return *this;
+ return QMargins(m1.left() - m2.left(), m1.top() - m2.top(),
+ m1.right() - m2.right(), m1.bottom() - m2.bottom());
}
-inline QRect &QRect::operator-=(const QMargins &margins)
+Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &lhs, int rhs)
{
- *this = marginsRemoved(margins);
- return *this;
+ return QMargins(lhs.left() + rhs, lhs.top() + rhs,
+ lhs.right() + rhs, lhs.bottom() + rhs);
}
-Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &m1, const QMargins &m2)
+Q_DECL_CONSTEXPR inline QMargins operator+(int lhs, const QMargins &rhs)
{
- return QMargins(m1.left() + m2.left(), m1.top() + m2.top(),
- m1.right() + m2.right(), m1.bottom() + m2.bottom());
+ return QMargins(rhs.left() + lhs, rhs.top() + lhs,
+ rhs.right() + lhs, rhs.bottom() + lhs);
}
-Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &m1, const QMargins &m2)
+Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &lhs, int rhs)
{
- return QMargins(m1.left() - m2.left(), m1.top() - m2.top(),
- m1.right() - m2.right(), m1.bottom() - m2.bottom());
+ return QMargins(lhs.left() - rhs, lhs.top() - rhs,
+ lhs.right() - rhs, lhs.bottom() - rhs);
}
Q_DECL_CONSTEXPR inline QMargins operator*(const QMargins &margins, int factor)
@@ -280,6 +266,11 @@ inline QMargins &QMargins::operator/=(qreal divisor)
return *this = *this / divisor;
}
+Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &margins)
+{
+ return margins;
+}
+
Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &margins)
{
return QMargins(-margins.left(), -margins.top(), -margins.right(), -margins.bottom());
@@ -289,6 +280,214 @@ Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &margins)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QMargins &);
#endif
+/*****************************************************************************
+ QMarginsF class
+ *****************************************************************************/
+
+class QMarginsF
+{
+public:
+ Q_DECL_CONSTEXPR QMarginsF();
+ Q_DECL_CONSTEXPR QMarginsF(qreal left, qreal top, qreal right, qreal bottom);
+ Q_DECL_CONSTEXPR QMarginsF(const QMargins &margins);
+
+ Q_DECL_CONSTEXPR bool isNull() const;
+
+ Q_DECL_CONSTEXPR qreal left() const;
+ Q_DECL_CONSTEXPR qreal top() const;
+ Q_DECL_CONSTEXPR qreal right() const;
+ Q_DECL_CONSTEXPR qreal bottom() const;
+
+ void setLeft(qreal left);
+ void setTop(qreal top);
+ void setRight(qreal right);
+ void setBottom(qreal bottom);
+
+ QMarginsF &operator+=(const QMarginsF &margins);
+ QMarginsF &operator-=(const QMarginsF &margins);
+ QMarginsF &operator+=(qreal addend);
+ QMarginsF &operator-=(qreal subtrahend);
+ QMarginsF &operator*=(qreal factor);
+ QMarginsF &operator/=(qreal divisor);
+
+ Q_DECL_CONSTEXPR inline QMargins toMargins() const;
+
+private:
+ qreal m_left;
+ qreal m_top;
+ qreal m_right;
+ qreal m_bottom;
+};
+
+Q_DECLARE_TYPEINFO(QMarginsF, Q_MOVABLE_TYPE);
+
+/*****************************************************************************
+ QMarginsF stream functions
+ *****************************************************************************/
+
+#ifndef QT_NO_DATASTREAM
+Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QMarginsF &);
+Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QMarginsF &);
+#endif
+
+/*****************************************************************************
+ QMarginsF inline functions
+ *****************************************************************************/
+
+Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF() : m_left(0), m_top(0), m_right(0), m_bottom(0) {}
+
+Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF(qreal aleft, qreal atop, qreal aright, qreal abottom)
+ : m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {}
+
+Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF(const QMargins &margins)
+ : m_left(margins.left()), m_top(margins.top()), m_right(margins.right()), m_bottom(margins.bottom()) {}
+
+Q_DECL_CONSTEXPR inline bool QMarginsF::isNull() const
+{ return qFuzzyIsNull(m_left) && qFuzzyIsNull(m_top) && qFuzzyIsNull(m_right) && qFuzzyIsNull(m_bottom); }
+
+Q_DECL_CONSTEXPR inline qreal QMarginsF::left() const
+{ return m_left; }
+
+Q_DECL_CONSTEXPR inline qreal QMarginsF::top() const
+{ return m_top; }
+
+Q_DECL_CONSTEXPR inline qreal QMarginsF::right() const
+{ return m_right; }
+
+Q_DECL_CONSTEXPR inline qreal QMarginsF::bottom() const
+{ return m_bottom; }
+
+
+inline void QMarginsF::setLeft(qreal aleft)
+{ m_left = aleft; }
+
+inline void QMarginsF::setTop(qreal atop)
+{ m_top = atop; }
+
+inline void QMarginsF::setRight(qreal aright)
+{ m_right = aright; }
+
+inline void QMarginsF::setBottom(qreal abottom)
+{ m_bottom = abottom; }
+
+Q_DECL_CONSTEXPR inline bool operator==(const QMarginsF &lhs, const QMarginsF &rhs)
+{
+ return qFuzzyCompare(lhs.left(), rhs.left())
+ && qFuzzyCompare(lhs.top(), rhs.top())
+ && qFuzzyCompare(lhs.right(), rhs.right())
+ && qFuzzyCompare(lhs.bottom(), rhs.bottom());
+}
+
+Q_DECL_CONSTEXPR inline bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs)
+{
+ return !operator==(lhs, rhs);
+}
+
+Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs)
+{
+ return QMarginsF(lhs.left() + rhs.left(), lhs.top() + rhs.top(),
+ lhs.right() + rhs.right(), lhs.bottom() + rhs.bottom());
+}
+
+Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs)
+{
+ return QMarginsF(lhs.left() - rhs.left(), lhs.top() - rhs.top(),
+ lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom());
+}
+
+Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &lhs, qreal rhs)
+{
+ return QMarginsF(lhs.left() + rhs, lhs.top() + rhs,
+ lhs.right() + rhs, lhs.bottom() + rhs);
+}
+
+Q_DECL_CONSTEXPR inline QMarginsF operator+(qreal lhs, const QMarginsF &rhs)
+{
+ return QMarginsF(rhs.left() + lhs, rhs.top() + lhs,
+ rhs.right() + lhs, rhs.bottom() + lhs);
+}
+
+Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &lhs, qreal rhs)
+{
+ return QMarginsF(lhs.left() - rhs, lhs.top() - rhs,
+ lhs.right() - rhs, lhs.bottom() - rhs);
+}
+
+Q_DECL_CONSTEXPR inline QMarginsF operator*(const QMarginsF &lhs, qreal rhs)
+{
+ return QMarginsF(lhs.left() * rhs, lhs.top() * rhs,
+ lhs.right() * rhs, lhs.bottom() * rhs);
+}
+
+Q_DECL_CONSTEXPR inline QMarginsF operator*(qreal lhs, const QMarginsF &rhs)
+{
+ return QMarginsF(rhs.left() * lhs, rhs.top() * lhs,
+ rhs.right() * lhs, rhs.bottom() * lhs);
+}
+
+Q_DECL_CONSTEXPR inline QMarginsF operator/(const QMarginsF &lhs, qreal divisor)
+{
+ return QMarginsF(lhs.left() / divisor, lhs.top() / divisor,
+ lhs.right() / divisor, lhs.bottom() / divisor);
+}
+
+inline QMarginsF &QMarginsF::operator+=(const QMarginsF &margins)
+{
+ return *this = *this + margins;
+}
+
+inline QMarginsF &QMarginsF::operator-=(const QMarginsF &margins)
+{
+ return *this = *this - margins;
+}
+
+inline QMarginsF &QMarginsF::operator+=(qreal addend)
+{
+ m_left += addend;
+ m_top += addend;
+ m_right += addend;
+ m_bottom += addend;
+ return *this;
+}
+
+inline QMarginsF &QMarginsF::operator-=(qreal subtrahend)
+{
+ m_left -= subtrahend;
+ m_top -= subtrahend;
+ m_right -= subtrahend;
+ m_bottom -= subtrahend;
+ return *this;
+}
+
+inline QMarginsF &QMarginsF::operator*=(qreal factor)
+{
+ return *this = *this * factor;
+}
+
+inline QMarginsF &QMarginsF::operator/=(qreal divisor)
+{
+ return *this = *this / divisor;
+}
+
+Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &margins)
+{
+ return margins;
+}
+
+Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &margins)
+{
+ return QMarginsF(-margins.left(), -margins.top(), -margins.right(), -margins.bottom());
+}
+
+Q_DECL_CONSTEXPR inline QMargins QMarginsF::toMargins() const
+{
+ return QMargins(qRound(m_left), qRound(m_top), qRound(m_right), qRound(m_bottom));
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_CORE_EXPORT QDebug operator<<(QDebug, const QMarginsF &);
+#endif
+
QT_END_NAMESPACE
#endif // QMARGINS_H
diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp
index fcff8931e8..33e8dd23fc 100644
--- a/src/corelib/tools/qrect.cpp
+++ b/src/corelib/tools/qrect.cpp
@@ -1162,6 +1162,74 @@ bool QRect::intersects(const QRect &r) const
returns \c false.
*/
+/*!
+ \fn QRect operator+(const QRect &rectangle, const QMargins &margins)
+ \relates QRect
+
+ Returns the \a rectangle grown by the \a margins.
+
+ \since 5.1
+*/
+
+/*!
+ \fn QRect operator+(const QMargins &margins, const QRect &rectangle)
+ \relates QRect
+ \overload
+
+ Returns the \a rectangle grown by the \a margins.
+
+ \since 5.1
+*/
+
+/*!
+ \fn QRect operator-(const QRect &lhs, const QMargins &rhs)
+ \relates QRect
+
+ Returns the \a lhs rectangle shrunken by the \a rhs margins.
+
+ \since 5.3
+*/
+
+/*!
+ \fn QRect QRect::marginsAdded(const QMargins &margins) const
+
+ Returns a rectangle grown by the \a margins.
+
+ \sa operator+=(), marginsRemoved(), operator-=()
+
+ \since 5.1
+*/
+
+/*!
+ \fn QRect QRect::operator+=(const QMargins &margins) const
+
+ Adds the \a margins to the rectangle, growing it.
+
+ \sa marginsAdded(), marginsRemoved(), operator-=()
+
+ \since 5.1
+*/
+
+/*!
+ \fn QRect QRect::marginsRemoved(const QMargins &margins) const
+
+ Removes the \a margins from the rectangle, shrinking it.
+
+ \sa marginsAdded(), operator+=(), operator-=()
+
+ \since 5.1
+*/
+
+/*!
+ \fn QRect QRect::operator -=(const QMargins &margins) const
+
+ Returns a rectangle shrunk by the \a margins.
+
+ \sa marginsRemoved(), operator+=(), marginsAdded()
+
+ \since 5.1
+*/
+
/*****************************************************************************
QRect stream functions
@@ -2311,6 +2379,71 @@ QRect QRectF::toAlignedRect() const
returns \c false.
*/
+/*!
+ \fn QRectF operator+(const QRectF &lhs, const QMarginsF &rhs)
+ \relates QRectF
+ \since 5.3
+
+ Returns the \a lhs rectangle grown by the \a rhs margins.
+*/
+
+/*!
+ \fn QRectF operator-(const QRectF &lhs, const QMarginsF &rhs)
+ \relates QRectF
+ \since 5.3
+
+ Returns the \a lhs rectangle grown by the \a rhs margins.
+*/
+
+/*!
+ \fn QRectF operator+(const QMarginsF &lhs, const QRectF &rhs)
+ \relates QRectF
+ \overload
+ \since 5.3
+
+ Returns the \a lhs rectangle grown by the \a rhs margins.
+*/
+
+/*!
+ \fn QRectF QRectF::marginsAdded(const QMarginsF &margins) const
+ \relates QRectF
+ \since 5.3
+
+ Returns a rectangle grown by the \a margins.
+
+ \sa operator+=(), marginsRemoved(), operator-=()
+*/
+
+/*!
+ \fn QRectF QRectF::marginsRemoved(const QMarginsF &margins) const
+ \relates QRectF
+ \since 5.3
+
+ Removes the \a margins from the rectangle, shrinking it.
+
+ \sa marginsAdded(), operator+=(), operator-=()
+*/
+
+/*!
+ \fn QRectF QRectF::operator+=(const QMarginsF &margins)
+ \relates QRectF
+ \since 5.3
+
+ Adds the \a margins to the rectangle, growing it.
+
+ \sa marginsAdded(), marginsRemoved(), operator-=()
+*/
+
+/*!
+ \fn QRectF QRectF::operator-=(const QMarginsF &margins)
+ \relates QRectF
+ \since 5.3
+
+ Returns a rectangle shrunk by the \a margins.
+
+ \sa marginsRemoved(), operator+=(), marginsAdded()
+*/
+
/*****************************************************************************
QRectF stream functions
*****************************************************************************/
diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h
index 22696f9edf..2bb74e8221 100644
--- a/src/corelib/tools/qrect.h
+++ b/src/corelib/tools/qrect.h
@@ -42,6 +42,7 @@
#ifndef QRECT_H
#define QRECT_H
+#include <QtCore/qmargins.h>
#include <QtCore/qsize.h>
#include <QtCore/qpoint.h>
@@ -51,8 +52,6 @@
QT_BEGIN_NAMESPACE
-class QMargins;
-
class Q_CORE_EXPORT QRect
{
public:
@@ -138,8 +137,8 @@ public:
inline QRect intersected(const QRect &other) const;
bool intersects(const QRect &r) const;
- inline QRect marginsAdded(const QMargins &margins) const;
- inline QRect marginsRemoved(const QMargins &margins) const;
+ Q_DECL_CONSTEXPR inline QRect marginsAdded(const QMargins &margins) const;
+ Q_DECL_CONSTEXPR inline QRect marginsRemoved(const QMargins &margins) const;
inline QRect &operator+=(const QMargins &margins);
inline QRect &operator-=(const QMargins &margins);
@@ -452,6 +451,48 @@ Q_DECL_CONSTEXPR inline bool operator!=(const QRect &r1, const QRect &r2)
return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2;
}
+Q_DECL_CONSTEXPR inline QRect operator+(const QRect &rectangle, const QMargins &margins)
+{
+ return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()),
+ QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()));
+}
+
+Q_DECL_CONSTEXPR inline QRect operator+(const QMargins &margins, const QRect &rectangle)
+{
+ return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()),
+ QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()));
+}
+
+Q_DECL_CONSTEXPR inline QRect operator-(const QRect &lhs, const QMargins &rhs)
+{
+ return QRect(QPoint(lhs.left() + rhs.left(), lhs.top() + rhs.top()),
+ QPoint(lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom()));
+}
+
+Q_DECL_CONSTEXPR inline QRect QRect::marginsAdded(const QMargins &margins) const
+{
+ return QRect(QPoint(x1 - margins.left(), y1 - margins.top()),
+ QPoint(x2 + margins.right(), y2 + margins.bottom()));
+}
+
+Q_DECL_CONSTEXPR inline QRect QRect::marginsRemoved(const QMargins &margins) const
+{
+ return QRect(QPoint(x1 + margins.left(), y1 + margins.top()),
+ QPoint(x2 - margins.right(), y2 - margins.bottom()));
+}
+
+inline QRect &QRect::operator+=(const QMargins &margins)
+{
+ *this = marginsAdded(margins);
+ return *this;
+}
+
+inline QRect &QRect::operator-=(const QMargins &margins)
+{
+ *this = marginsRemoved(margins);
+ return *this;
+}
+
#ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDebug operator<<(QDebug, const QRect &);
#endif
@@ -543,6 +584,11 @@ public:
inline QRectF intersected(const QRectF &other) const;
bool intersects(const QRectF &r) const;
+ Q_DECL_CONSTEXPR inline QRectF marginsAdded(const QMarginsF &margins) const;
+ Q_DECL_CONSTEXPR inline QRectF marginsRemoved(const QMarginsF &margins) const;
+ inline QRectF &operator+=(const QMarginsF &margins);
+ inline QRectF &operator-=(const QMarginsF &margins);
+
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED QRectF unite(const QRectF &r) const { return united(r); }
QT_DEPRECATED QRectF intersect(const QRectF &r) const { return intersected(r); }
@@ -784,6 +830,48 @@ Q_DECL_CONSTEXPR inline QRect QRectF::toRect() const
return QRect(qRound(xp), qRound(yp), qRound(w), qRound(h));
}
+Q_DECL_CONSTEXPR inline QRectF operator+(const QRectF &lhs, const QMarginsF &rhs)
+{
+ return QRectF(QPointF(lhs.left() - rhs.left(), lhs.top() - rhs.top()),
+ QSizeF(lhs.width() + rhs.left() + rhs.right(), lhs.height() + rhs.top() + rhs.bottom()));
+}
+
+Q_DECL_CONSTEXPR inline QRectF operator+(const QMarginsF &lhs, const QRectF &rhs)
+{
+ return QRectF(QPointF(rhs.left() - lhs.left(), rhs.top() - lhs.top()),
+ QSizeF(rhs.width() + lhs.left() + lhs.right(), rhs.height() + lhs.top() + lhs.bottom()));
+}
+
+Q_DECL_CONSTEXPR inline QRectF operator-(const QRectF &lhs, const QMarginsF &rhs)
+{
+ return QRectF(QPointF(lhs.left() + rhs.left(), lhs.top() + rhs.top()),
+ QSizeF(lhs.width() - rhs.left() - rhs.right(), lhs.height() - rhs.top() - rhs.bottom()));
+}
+
+Q_DECL_CONSTEXPR inline QRectF QRectF::marginsAdded(const QMarginsF &margins) const
+{
+ return QRectF(QPointF(xp - margins.left(), yp - margins.top()),
+ QSizeF(w + margins.left() + margins.right(), h + margins.top() + margins.bottom()));
+}
+
+Q_DECL_CONSTEXPR inline QRectF QRectF::marginsRemoved(const QMarginsF &margins) const
+{
+ return QRectF(QPointF(xp + margins.left(), yp + margins.top()),
+ QSizeF(w - margins.left() - margins.right(), h - margins.top() - margins.bottom()));
+}
+
+inline QRectF &QRectF::operator+=(const QMarginsF &margins)
+{
+ *this = marginsAdded(margins);
+ return *this;
+}
+
+inline QRectF &QRectF::operator-=(const QMarginsF &margins)
+{
+ *this = marginsRemoved(margins);
+ return *this;
+}
+
#ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDebug operator<<(QDebug, const QRectF &);
#endif
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 50f616a010..116da9e383 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -210,7 +210,7 @@ inline RetType UnrollTailLoop<0>::exec(int, RetType returnIfExited, Functor1, Fu
#endif
// conversion between Latin 1 and UTF-16
-static void qt_from_latin1(ushort *dst, const char *str, size_t size)
+void qt_from_latin1(ushort *dst, const char *str, size_t size)
{
/* SIMD:
* Unpacking with SSE has been shown to improve performance on recent CPUs
@@ -1494,6 +1494,10 @@ QString::QString(QChar ch)
\internal
*/
+/*! \fn QString::QString(QStringDataPtr)
+ \internal
+*/
+
/*! \fn QString &QString::operator=(const Null &)
\internal
*/
@@ -6424,8 +6428,8 @@ QString &QString::setNum(qulonglong n, int base)
to the given \a format and \a precision, and returns a reference
to the string.
- The \a format can be 'f', 'F', 'e', 'E', 'g' or 'G' (see the
- arg() function documentation for an explanation of the formats).
+ The \a format can be 'e', 'E', 'f', 'g' or 'G' (see
+ \l{Argument Formats} for an explanation of the formats).
The formatting always uses QLocale::C, i.e., English/UnitedStates.
To get a localized string representation of a number, use
@@ -8465,6 +8469,11 @@ bool operator<(const QStringRef &s1,const QStringRef &s2)
*/
/*!
+ \typedef QString::Data
+ \internal
+*/
+
+/*!
\typedef QString::DataPtr
\internal
*/
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 7ef7e6f46a..1e4a503778 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -1,5 +1,7 @@
# Qt tools module
+intel_icc: QMAKE_CXXFLAGS += -fp-model strict
+
HEADERS += \
tools/qalgorithms.h \
tools/qarraydata.h \
diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp
index 392eac6081..8337a84614 100644
--- a/src/dbus/qdbusmetaobject.cpp
+++ b/src/dbus/qdbusmetaobject.cpp
@@ -220,8 +220,11 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature,
} else if (signature == "a{sv}") {
result.name = "QVariantMap";
type = QVariant::Map;
+ } else if (signature == "a{ss}") {
+ result.name = "QMap<QString,QString>";
+ type = qMetaTypeId<QMap<QString, QString> >();
} else {
- result.name = "QDBusRawType::" + signature;
+ result.name = "{D-Bus type \"" + signature + "\"}";
type = registerComplexDBusType(result.name);
}
} else {
diff --git a/src/gui/doc/snippets/clipboard/clipwindow.cpp b/src/gui/doc/snippets/clipboard/clipwindow.cpp
index 657ea4e652..19a685b9d4 100644
--- a/src/gui/doc/snippets/clipboard/clipwindow.cpp
+++ b/src/gui/doc/snippets/clipboard/clipwindow.cpp
@@ -59,8 +59,8 @@ ClipWindow::ClipWindow(QWidget *parent)
//! [0]
connect(clipboard, SIGNAL(dataChanged()), this, SLOT(updateClipboard()));
//! [0]
- connect(mimeTypeCombo, SIGNAL(activated(const QString &)),
- this, SLOT(updateData(const QString &)));
+ connect(mimeTypeCombo, SIGNAL(activated(QString)),
+ this, SLOT(updateData(QString)));
QVBoxLayout *currentLayout = new QVBoxLayout(currentItem);
currentLayout->addWidget(mimeTypeLabel);
diff --git a/src/gui/doc/snippets/draganddrop/mainwindow.cpp b/src/gui/doc/snippets/draganddrop/mainwindow.cpp
index dc1b39422d..c8d0bf4e09 100644
--- a/src/gui/doc/snippets/draganddrop/mainwindow.cpp
+++ b/src/gui/doc/snippets/draganddrop/mainwindow.cpp
@@ -54,10 +54,10 @@ MainWindow::MainWindow(QWidget *parent)
QLabel *dataLabel = new QLabel(tr("Amount of data (bytes):"), centralWidget);
dragWidget = new DragWidget(centralWidget);
- connect(dragWidget, SIGNAL(mimeTypes(const QStringList &)),
- this, SLOT(setMimeTypes(const QStringList &)));
- connect(dragWidget, SIGNAL(dragResult(const QString &)),
- this, SLOT(setDragResult(const QString &)));
+ connect(dragWidget, SIGNAL(mimeTypes(QStringList)),
+ this, SLOT(setMimeTypes(QStringList)));
+ connect(dragWidget, SIGNAL(dragResult(QString)),
+ this, SLOT(setDragResult(QString)));
QVBoxLayout *mainLayout = new QVBoxLayout(centralWidget);
mainLayout->addWidget(mimeTypeLabel);
diff --git a/src/gui/doc/snippets/separations/viewer.cpp b/src/gui/doc/snippets/separations/viewer.cpp
index 84ef7b7567..6a0f49ee2f 100644
--- a/src/gui/doc/snippets/separations/viewer.cpp
+++ b/src/gui/doc/snippets/separations/viewer.cpp
@@ -119,8 +119,8 @@ void Viewer::createMenus()
connect(openAction, SIGNAL(triggered()), this, SLOT(chooseFile()));
connect(saveAction, SIGNAL(triggered()), this, SLOT(saveImage()));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
- connect(brightnessMenu, SIGNAL(triggered(QAction *)), this,
- SLOT(setBrightness(QAction *)));
+ connect(brightnessMenu, SIGNAL(triggered(QAction*)), this,
+ SLOT(setBrightness(QAction*)));
}
/*
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 51548aa371..04a2615c81 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -727,9 +727,15 @@ Qt::WindowType QWindow::type() const
void QWindow::setTitle(const QString &title)
{
Q_D(QWindow);
- d->windowTitle = title;
+ bool changed = false;
+ if (d->windowTitle != title) {
+ d->windowTitle = title;
+ changed = true;
+ }
if (d->platformWindow)
d->platformWindow->setWindowTitle(title);
+ if (changed)
+ emit windowTitleChanged(title);
}
QString QWindow::title() const
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index ca261ff7ce..3278b7233c 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -103,7 +103,7 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
// C++ properties in qwindow.cpp AND as QML properties in qquickwindow.cpp.
// http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-definetypes.html#type-revisions-and-versions
- Q_PROPERTY(QString title READ title WRITE setTitle)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY windowTitleChanged)
Q_PROPERTY(Qt::WindowModality modality READ modality WRITE setModality NOTIFY modalityChanged)
Q_PROPERTY(Qt::WindowFlags flags READ flags WRITE setFlags)
Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
@@ -297,6 +297,7 @@ Q_SIGNALS:
void screenChanged(QScreen *screen);
void modalityChanged(Qt::WindowModality modality);
void windowStateChanged(Qt::WindowState windowState);
+ void windowTitleChanged(const QString &title);
void xChanged(int arg);
void yChanged(int arg);
diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp
index 90d062f4dd..2355d0a8a7 100644
--- a/src/gui/opengl/qopengldebug.cpp
+++ b/src/gui/opengl/qopengldebug.cpp
@@ -43,6 +43,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qvarlengtharray.h>
#include <QtGui/qopengl.h>
+#include <QtGui/qopenglfunctions.h>
#include "qopengldebug.h"
@@ -1364,7 +1365,20 @@ bool QOpenGLDebugLogger::initialize()
GET_DEBUG_PROC_ADDRESS(glGetDebugMessageLog);
GET_DEBUG_PROC_ADDRESS(glPushDebugGroup);
GET_DEBUG_PROC_ADDRESS(glPopDebugGroup);
+
+ // Windows' Desktop GL doesn't allow resolution of "basic GL entry points"
+ // through wglGetProcAddress
+#if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2)
+ {
+ HMODULE handle = static_cast<HMODULE>(QOpenGLFunctions::platformGLHandle());
+ if (!handle)
+ handle = GetModuleHandleA("opengl32.dll");
+ d->glGetPointerv = reinterpret_cast<qt_glGetPointerv_t>(GetProcAddress(handle, QByteArrayLiteral("glGetPointerv")));
+ }
+#else
GET_DEBUG_PROC_ADDRESS(glGetPointerv)
+#endif
+
#undef GET_DEBUG_PROC_ADDRESS
glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &d->maxMessageLength);
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 150e7dcb32..60743b3a27 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -314,7 +314,8 @@ static int qt_gl_resolve_features()
if (extensions.match("GL_ARB_multisample"))
features |= QOpenGLFunctions::Multisample;
if (extensions.match("GL_ARB_texture_non_power_of_two"))
- features |= QOpenGLFunctions::NPOTTextures;
+ features |= QOpenGLFunctions::NPOTTextures |
+ QOpenGLFunctions::NPOTTextureRepeat;
// assume version 2.0 or higher
features |= QOpenGLFunctions::BlendColor |
@@ -327,7 +328,8 @@ static int qt_gl_resolve_features()
QOpenGLFunctions::Shaders |
QOpenGLFunctions::StencilSeparate |
QOpenGLFunctions::BlendEquationSeparate |
- QOpenGLFunctions::NPOTTextures;
+ QOpenGLFunctions::NPOTTextures |
+ QOpenGLFunctions::NPOTTextureRepeat;
if (format.majorVersion() >= 3)
features |= QOpenGLFunctions::Framebuffers;
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index e91ada7b3a..63127668a5 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -1434,19 +1434,18 @@ void QOpenGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem)
QFontEngine *fontEngine = textItem->fontEngine();
if (shouldDrawCachedGlyphs(fontEngine, s->matrix)) {
- QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0
- ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat)
- : d->glyphCacheType;
- if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
+ QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None
+ ? fontEngine->glyphFormat : d->glyphCacheFormat;
+ if (glyphFormat == QFontEngine::Format_A32) {
if (d->device->context()->format().alphaBufferSize() > 0 || s->matrix.type() > QTransform::TxTranslate
|| (s->composition_mode != QPainter::CompositionMode_Source
&& s->composition_mode != QPainter::CompositionMode_SourceOver))
{
- glyphType = QFontEngineGlyphCache::Raster_A8;
+ glyphFormat = QFontEngine::Format_A8;
}
}
- d->drawCachedGlyphs(glyphType, textItem);
+ d->drawCachedGlyphs(glyphFormat, textItem);
} else {
QPaintEngineEx::drawStaticTextItem(textItem);
}
@@ -1483,17 +1482,15 @@ void QOpenGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &text
QTransform::TransformationType txtype = s->matrix.type();
- QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0
- ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat)
- : d->glyphCacheType;
+ QFontEngine::GlyphFormat glyphFormat = ti.fontEngine->glyphFormat != QFontEngine::Format_None
+ ? ti.fontEngine->glyphFormat : d->glyphCacheFormat;
-
- if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
+ if (glyphFormat == QFontEngine::Format_A32) {
if (d->device->context()->format().alphaBufferSize() > 0 || txtype > QTransform::TxTranslate
|| (state()->composition_mode != QPainter::CompositionMode_Source
&& state()->composition_mode != QPainter::CompositionMode_SourceOver))
{
- glyphType = QFontEngineGlyphCache::Raster_A8;
+ glyphFormat = QFontEngine::Format_A8;
}
}
@@ -1512,7 +1509,7 @@ void QOpenGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &text
staticTextItem.numGlyphs = glyphs.size();
staticTextItem.glyphPositions = positions.data();
- d->drawCachedGlyphs(glyphType, &staticTextItem);
+ d->drawCachedGlyphs(glyphFormat, &staticTextItem);
}
return;
}
@@ -1537,7 +1534,7 @@ namespace {
QSize cacheSize;
QOpenGL2PEXVertexArray vertexCoordinateArray;
QOpenGL2PEXVertexArray textureCoordinateArray;
- QFontEngineGlyphCache::Type glyphType;
+ QFontEngine::GlyphFormat glyphFormat;
int cacheSerialNumber;
};
@@ -1572,7 +1569,7 @@ bool QOpenGL2PaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, cons
return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, t);
}
-void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType,
+void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat glyphFormat,
QStaticTextItem *staticTextItem)
{
Q_Q(QOpenGL2PaintEngineEx);
@@ -1596,9 +1593,9 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
}
QOpenGLTextureGlyphCache *cache =
- (QOpenGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphType, glyphCacheTransform);
- if (!cache || cache->cacheType() != glyphType || cache->contextGroup() == 0) {
- cache = new QOpenGLTextureGlyphCache(glyphType, glyphCacheTransform);
+ (QOpenGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphFormat, glyphCacheTransform);
+ if (!cache || cache->glyphFormat() != glyphFormat || cache->contextGroup() == 0) {
+ cache = new QOpenGLTextureGlyphCache(glyphFormat, glyphCacheTransform);
fe->setGlyphCache(cacheKey, cache);
recreateVertexArrays = true;
}
@@ -1611,7 +1608,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
recreateVertexArrays = true;
} else {
QOpenGLStaticTextUserData *userData = static_cast<QOpenGLStaticTextUserData *>(staticTextItem->userData());
- if (userData->glyphType != glyphType) {
+ if (userData->glyphFormat != glyphFormat) {
recreateVertexArrays = true;
} else if (userData->cacheSerialNumber != cache->serialNumber()) {
recreateVertexArrays = true;
@@ -1636,12 +1633,12 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
if (cache->width() == 0 || cache->height() == 0)
return;
- if (glyphType == QFontEngineGlyphCache::Raster_ARGB)
+ if (glyphFormat == QFontEngine::Format_ARGB)
transferMode(ImageArrayDrawingMode);
else
transferMode(TextDrawingMode);
- int margin = fe->glyphMargin(glyphType);
+ int margin = fe->glyphMargin(glyphFormat);
GLfloat dx = 1.0 / cache->width();
GLfloat dy = 1.0 / cache->height();
@@ -1663,7 +1660,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData());
}
- userData->glyphType = glyphType;
+ userData->glyphFormat = glyphFormat;
userData->cacheSerialNumber = cache->serialNumber();
// Use cache if backend optimizations is turned on
@@ -1735,7 +1732,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
#endif
}
- if (glyphType != QFontEngineGlyphCache::Raster_ARGB || recreateVertexArrays) {
+ if (glyphFormat != QFontEngine::Format_ARGB || recreateVertexArrays) {
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinates->data());
setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinates->data());
}
@@ -1748,7 +1745,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
QBrush pensBrush = q->state()->pen.brush();
setBrush(pensBrush);
- if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
+ if (glyphFormat == QFontEngine::Format_A32) {
// Subpixel antialiasing without gamma correction
@@ -1821,7 +1818,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
glBlendFunc(GL_ONE, GL_ONE);
}
compositionModeDirty = true;
- } else if (glyphType == QFontEngineGlyphCache::Raster_ARGB) {
+ } else if (glyphFormat == QFontEngine::Format_ARGB) {
currentBrush = noBrush;
shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc);
if (prepareForCachedGlyphDraw(*cache))
@@ -1836,7 +1833,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
QOpenGLTextureGlyphCache::FilterMode filterMode = (s->matrix.type() > QTransform::TxTranslate)?QOpenGLTextureGlyphCache::Linear:QOpenGLTextureGlyphCache::Nearest;
if (lastMaskTextureUsed != cache->texture() || cache->filterMode() != filterMode) {
- if (glyphType == QFontEngineGlyphCache::Raster_ARGB)
+ if (glyphFormat == QFontEngine::Format_ARGB)
funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
else
funcs.glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT);
@@ -2012,12 +2009,12 @@ bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev)
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
- d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
+ d->glyphCacheFormat = QFontEngine::Format_A8;
#ifndef QT_OPENGL_ES_2
if (!QOpenGLFunctions::isES()) {
glDisable(GL_MULTISAMPLE);
- d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask;
+ d->glyphCacheFormat = QFontEngine::Format_A32;
d->multisamplingAlwaysEnabled = false;
} else
#endif // QT_OPENGL_ES_2
diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h
index d51f0e5256..4f0e2e52a4 100644
--- a/src/gui/opengl/qopenglpaintengine_p.h
+++ b/src/gui/opengl/qopenglpaintengine_p.h
@@ -212,7 +212,7 @@ public:
void drawTexture(const QOpenGLRect& dest, const QOpenGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false);
void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
QPainter::PixmapFragmentHints hints);
- void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem);
+ void drawCachedGlyphs(QFontEngine::GlyphFormat glyphFormat, QStaticTextItem *staticTextItem);
// Calls glVertexAttributePointer if the pointer has changed
inline void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer);
@@ -267,7 +267,7 @@ public:
int width, height;
QOpenGLContext *ctx;
EngineMode mode;
- QFontEngineGlyphCache::Type glyphCacheType;
+ QFontEngine::GlyphFormat glyphCacheFormat;
bool vertexAttributeArraysEnabledState[QT_GL_VERTEX_ARRAY_TRACKED_COUNT];
diff --git a/src/gui/opengl/qopenglproxy_win.cpp b/src/gui/opengl/qopenglproxy_win.cpp
index 83c3073f63..88f3a1d11d 100644
--- a/src/gui/opengl/qopenglproxy_win.cpp
+++ b/src/gui/opengl/qopenglproxy_win.cpp
@@ -680,9 +680,6 @@ static HMODULE qgl_loadLib(const char *name, bool warnOnFail = true)
QWindowsOpenGL::QWindowsOpenGL()
: m_eglLib(0)
{
- if (qEnvironmentVariableIsSet("QT_OPENGLPROXY_DEBUG"))
- QLoggingCategory::setFilterRules(QStringLiteral("qt.gui.openglproxy=true"));
-
enum RequestedLib {
Unknown,
Desktop,
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 06f40eafd0..164e5e6925 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -123,7 +123,8 @@ QT_BEGIN_NAMESPACE
on the return value from programId(). Then the application should
call link(), which will notice that the program has already been
specified and linked, allowing other operations to be performed
- on the shader program.
+ on the shader program. The shader program's id can be explicitly
+ created using the create() function.
\sa QOpenGLShader
*/
@@ -639,6 +640,26 @@ QOpenGLShaderProgram::~QOpenGLShaderProgram()
{
}
+/*!
+ Requests the shader program's id to be created immediately. Returns \c true
+ if successful; \c false otherwise.
+
+ This function is primarily useful when combining QOpenGLShaderProgram
+ with other OpenGL functions that operate directly on the shader
+ program id, like \c {GL_OES_get_program_binary}.
+
+ When the shader program is used normally, the shader program's id will
+ be created on demand.
+
+ \sa programId()
+
+ \since 5.3
+ */
+bool QOpenGLShaderProgram::create()
+{
+ return init();
+}
+
bool QOpenGLShaderProgram::init()
{
Q_D(QOpenGLShaderProgram);
diff --git a/src/gui/opengl/qopenglshaderprogram.h b/src/gui/opengl/qopenglshaderprogram.h
index b894ae3af8..91754842e6 100644
--- a/src/gui/opengl/qopenglshaderprogram.h
+++ b/src/gui/opengl/qopenglshaderprogram.h
@@ -130,6 +130,8 @@ public:
bool bind();
void release();
+ bool create();
+
GLuint programId() const;
int maxGeometryOutputVertices() const;
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index 0d9a2359bd..3524c1cb1a 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -51,13 +51,14 @@ QT_BEGIN_NAMESPACE
QBasicAtomicInt qopengltextureglyphcache_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1);
-QOpenGLTextureGlyphCache::QOpenGLTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix)
- : QImageTextureGlyphCache(type, matrix)
+QOpenGLTextureGlyphCache::QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix)
+ : QImageTextureGlyphCache(format, matrix)
, m_textureResource(0)
, pex(0)
, m_blitProgram(0)
, m_filterMode(Nearest)
, m_serialNumber(qopengltextureglyphcache_serial_number.fetchAndAddRelaxed(1))
+ , m_buffer(QOpenGLBuffer::VertexBuffer)
{
#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG
qDebug(" -> QOpenGLTextureGlyphCache() %p for context %p.", this, QOpenGLContext::currentContext());
@@ -88,6 +89,11 @@ QOpenGLTextureGlyphCache::~QOpenGLTextureGlyphCache()
#endif
}
+static inline bool isCoreProfile()
+{
+ return QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile;
+}
+
void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
{
QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
@@ -122,7 +128,7 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
m_textureResource->m_width = width;
m_textureResource->m_height = height;
- if (m_type == QFontEngineGlyphCache::Raster_RGBMask || m_type == QFontEngineGlyphCache::Raster_ARGB) {
+ if (m_format == QFontEngine::Format_A32 || m_format == QFontEngine::Format_ARGB) {
QVarLengthArray<uchar> data(width * height * 4);
for (int i = 0; i < data.size(); ++i)
data[i] = 0;
@@ -131,7 +137,14 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
QVarLengthArray<uchar> data(width * height);
for (int i = 0; i < data.size(); ++i)
data[i] = 0;
- glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]);
+#if !defined(QT_OPENGL_ES_2)
+ const GLint internalFormat = isCoreProfile() ? GL_R8 : GL_ALPHA;
+ const GLenum format = isCoreProfile() ? GL_RED : GL_ALPHA;
+#else
+ const GLint internalFormat = GL_ALPHA;
+ const GLenum format = GL_ALPHA;
+#endif
+ glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, GL_UNSIGNED_BYTE, &data[0]);
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -139,6 +152,31 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
m_filterMode = Nearest;
+
+ if (!m_buffer.isCreated()) {
+ m_buffer.create();
+ m_buffer.bind();
+ static GLfloat buf[sizeof(m_vertexCoordinateArray) + sizeof(m_textureCoordinateArray)];
+ memcpy(buf, m_vertexCoordinateArray, sizeof(m_vertexCoordinateArray));
+ memcpy(buf + (sizeof(m_vertexCoordinateArray) / sizeof(GLfloat)),
+ m_textureCoordinateArray,
+ sizeof(m_textureCoordinateArray));
+ m_buffer.allocate(buf, sizeof(buf));
+ m_buffer.release();
+ }
+
+ if (!m_vao.isCreated())
+ m_vao.create();
+}
+
+void QOpenGLTextureGlyphCache::setupVertexAttribs()
+{
+ m_buffer.bind();
+ m_blitProgram->setAttributeBuffer(int(QT_VERTEX_COORDS_ATTR), GL_FLOAT, 0, 2);
+ m_blitProgram->setAttributeBuffer(int(QT_TEXTURE_COORDS_ATTR), GL_FLOAT, sizeof(m_vertexCoordinateArray), 2);
+ m_blitProgram->enableAttributeArray(int(QT_VERTEX_COORDS_ATTR));
+ m_blitProgram->enableAttributeArray(int(QT_TEXTURE_COORDS_ATTR));
+ m_buffer.release();
}
void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
@@ -237,16 +275,19 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
m_blitProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
m_blitProgram->link();
+
+ if (m_vao.isCreated()) {
+ m_vao.bind();
+ setupVertexAttribs();
+ }
}
- funcs.glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, m_vertexCoordinateArray);
- funcs.glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, m_textureCoordinateArray);
+ if (m_vao.isCreated())
+ m_vao.bind();
+ else
+ setupVertexAttribs();
m_blitProgram->bind();
- m_blitProgram->enableAttributeArray(int(QT_VERTEX_COORDS_ATTR));
- m_blitProgram->enableAttributeArray(int(QT_TEXTURE_COORDS_ATTR));
- m_blitProgram->disableAttributeArray(int(QT_OPACITY_ATTR));
-
blitProgram = m_blitProgram;
} else {
@@ -276,8 +317,12 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
glViewport(0, 0, pex->width, pex->height);
pex->updateClipScissorTest();
} else {
- m_blitProgram->disableAttributeArray(int(QT_VERTEX_COORDS_ATTR));
- m_blitProgram->disableAttributeArray(int(QT_TEXTURE_COORDS_ATTR));
+ if (m_vao.isCreated()) {
+ m_vao.release();
+ } else {
+ m_blitProgram->disableAttributeArray(int(QT_VERTEX_COORDS_ATTR));
+ m_blitProgram->disableAttributeArray(int(QT_TEXTURE_COORDS_ATTR));
+ }
}
}
@@ -395,7 +440,14 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i));
} else {
#endif
- glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits());
+
+#if !defined(QT_OPENGL_ES_2)
+ const GLenum format = isCoreProfile() ? GL_RED : GL_ALPHA;
+#else
+ const GLenum format = GL_ALPHA;
+#endif
+ glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, format, GL_UNSIGNED_BYTE, mask.bits());
+
#if 0
}
#endif
diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h
index d9456db6ed..1e2c031018 100644
--- a/src/gui/opengl/qopengltextureglyphcache_p.h
+++ b/src/gui/opengl/qopengltextureglyphcache_p.h
@@ -57,6 +57,8 @@
#include <private/qopenglcontext_p.h>
#include <qopenglshaderprogram.h>
#include <qopenglfunctions.h>
+#include <qopenglbuffer.h>
+#include <qopenglvertexarrayobject.h>
// #define QT_GL_TEXTURE_GLYPH_CACHE_DEBUG
@@ -109,7 +111,7 @@ public:
class Q_GUI_EXPORT QOpenGLTextureGlyphCache : public QImageTextureGlyphCache
{
public:
- QOpenGLTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix);
+ QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat glyphFormat, const QTransform &matrix);
~QOpenGLTextureGlyphCache();
virtual void createTextureData(int width, int height);
@@ -152,6 +154,8 @@ public:
void clear();
private:
+ void setupVertexAttribs();
+
QOpenGLGlyphTexture *m_textureResource;
QOpenGL2PaintEngineExPrivate *pex;
@@ -162,6 +166,9 @@ private:
GLfloat m_textureCoordinateArray[8];
int m_serialNumber;
+
+ QOpenGLBuffer m_buffer;
+ QOpenGLVertexArrayObject m_vao;
};
QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp
index 428f6e8a8b..5df7463e8a 100644
--- a/src/gui/opengl/qopenglversionfunctions.cpp
+++ b/src/gui/opengl/qopenglversionfunctions.cpp
@@ -191,6 +191,8 @@ QAbstractOpenGLFunctions::~QAbstractOpenGLFunctions()
delete d_ptr;
}
+/*! \internal
+ */
bool QAbstractOpenGLFunctions::initializeOpenGLFunctions()
{
Q_D(QAbstractOpenGLFunctions);
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp
index e26c6ec25a..52fd482b53 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.cpp
+++ b/src/gui/opengl/qopenglvertexarrayobject.cpp
@@ -45,34 +45,35 @@
#include <QtGui/qopenglcontext.h>
#include <QtGui/qopenglfunctions.h>
-#if !defined(QT_OPENGL_ES_2)
#include <QtGui/qopenglfunctions_3_0.h>
#include <QtGui/qopenglfunctions_3_2_core.h>
-#endif
QT_BEGIN_NAMESPACE
+class QOpenGLFunctions_3_0;
+class QOpenGLFunctions_3_2_Core;
+
class QVertexArrayObjectHelper
{
public:
QVertexArrayObjectHelper(QOpenGLContext *context)
{
Q_ASSERT(context);
-#if !defined(QT_OPENGL_ES_2)
- if (context->hasExtension(QByteArrayLiteral("GL_APPLE_vertex_array_object"))) {
- GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysAPPLE")));
- DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysAPPLE")));
- BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayAPPLE")));
+ if (QOpenGLFunctions::isES()) {
+ GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES")));
+ DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES")));
+ BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayOES")));
} else {
- GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenVertexArrays")));
- DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArrays")));
- BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindVertexArray")));
+ if (context->hasExtension(QByteArrayLiteral("GL_APPLE_vertex_array_object"))) {
+ GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysAPPLE")));
+ DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysAPPLE")));
+ BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayAPPLE")));
+ } else {
+ GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenVertexArrays")));
+ DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArrays")));
+ BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindVertexArray")));
+ }
}
-#else
- GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES")));
- DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES")));
- BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayOES")));
-#endif
}
inline void glGenVertexArrays(GLsizei n, GLuint *arrays)
@@ -102,23 +103,15 @@ class QOpenGLVertexArrayObjectPrivate : public QObjectPrivate
public:
QOpenGLVertexArrayObjectPrivate()
: vao(0)
-#if defined(QT_OPENGL_ES_2)
- , vaoFuncs(0)
-#else
, vaoFuncsType(NotSupported)
-#endif
, context(0)
{
}
~QOpenGLVertexArrayObjectPrivate()
{
-#if defined(QT_OPENGL_ES_2)
- delete vaoFuncs;
-#else
- if ((vaoFuncsType == ARB) || (vaoFuncsType == APPLE))
+ if (vaoFuncsType == ARB || vaoFuncsType == APPLE || vaoFuncsType == OES)
delete vaoFuncs.helper;
-#endif
}
bool create();
@@ -131,9 +124,6 @@ public:
GLuint vao;
-#if defined(QT_OPENGL_ES_2)
- QVertexArrayObjectHelper *vaoFuncs;
-#else
union {
QOpenGLFunctions_3_0 *core_3_0;
QOpenGLFunctions_3_2_Core *core_3_2;
@@ -144,9 +134,10 @@ public:
Core_3_0,
Core_3_2,
ARB,
- APPLE
+ APPLE,
+ OES
} vaoFuncsType;
-#endif
+
QOpenGLContext *context;
};
@@ -157,13 +148,6 @@ bool QOpenGLVertexArrayObjectPrivate::create()
return false;
}
-#if !defined(QT_OPENGL_ES_2)
- if (QOpenGLFunctions::isES()) {
- qWarning("QOpenGLVertexArrayObject: Not supported on dynamic GL ES");
- return false;
- }
-#endif
-
Q_Q(QOpenGLVertexArrayObject);
if (context)
QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
@@ -176,35 +160,40 @@ bool QOpenGLVertexArrayObjectPrivate::create()
context = ctx;
QObject::connect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
-#if defined(QT_OPENGL_ES_2)
- if (ctx->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) {
- vaoFuncs = new QVertexArrayObjectHelper(ctx);
- vaoFuncs->glGenVertexArrays(1, &vao);
- }
-#else
- vaoFuncs.core_3_0 = 0;
- vaoFuncsType = NotSupported;
- QSurfaceFormat format = ctx->format();
- if (format.version() >= qMakePair<int, int>(3,2)) {
- vaoFuncs.core_3_2 = ctx->versionFunctions<QOpenGLFunctions_3_2_Core>();
- vaoFuncsType = Core_3_2;
- vaoFuncs.core_3_2->initializeOpenGLFunctions();
- vaoFuncs.core_3_2->glGenVertexArrays(1, &vao);
- } else if (format.majorVersion() >= 3) {
- vaoFuncs.core_3_0 = ctx->versionFunctions<QOpenGLFunctions_3_0>();
- vaoFuncsType = Core_3_0;
- vaoFuncs.core_3_0->initializeOpenGLFunctions();
- vaoFuncs.core_3_0->glGenVertexArrays(1, &vao);
- } else if (ctx->hasExtension(QByteArrayLiteral("GL_ARB_vertex_array_object"))) {
- vaoFuncs.helper = new QVertexArrayObjectHelper(ctx);
- vaoFuncsType = ARB;
- vaoFuncs.helper->glGenVertexArrays(1, &vao);
- } else if (ctx->hasExtension(QByteArrayLiteral("GL_APPLE_vertex_array_object"))) {
- vaoFuncs.helper = new QVertexArrayObjectHelper(ctx);
- vaoFuncsType = APPLE;
- vaoFuncs.helper->glGenVertexArrays(1, &vao);
- }
+ if (QOpenGLFunctions::isES()) {
+ if (ctx->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) {
+ vaoFuncs.helper = new QVertexArrayObjectHelper(ctx);
+ vaoFuncsType = OES;
+ vaoFuncs.helper->glGenVertexArrays(1, &vao);
+ }
+ } else {
+ vaoFuncs.core_3_0 = 0;
+ vaoFuncsType = NotSupported;
+ QSurfaceFormat format = ctx->format();
+#ifndef QT_OPENGL_ES_2
+ if (format.version() >= qMakePair<int, int>(3,2)) {
+ vaoFuncs.core_3_2 = ctx->versionFunctions<QOpenGLFunctions_3_2_Core>();
+ vaoFuncsType = Core_3_2;
+ vaoFuncs.core_3_2->initializeOpenGLFunctions();
+ vaoFuncs.core_3_2->glGenVertexArrays(1, &vao);
+ } else if (format.majorVersion() >= 3) {
+ vaoFuncs.core_3_0 = ctx->versionFunctions<QOpenGLFunctions_3_0>();
+ vaoFuncsType = Core_3_0;
+ vaoFuncs.core_3_0->initializeOpenGLFunctions();
+ vaoFuncs.core_3_0->glGenVertexArrays(1, &vao);
+ } else
#endif
+ if (ctx->hasExtension(QByteArrayLiteral("GL_ARB_vertex_array_object"))) {
+ vaoFuncs.helper = new QVertexArrayObjectHelper(ctx);
+ vaoFuncsType = ARB;
+ vaoFuncs.helper->glGenVertexArrays(1, &vao);
+ } else if (ctx->hasExtension(QByteArrayLiteral("GL_APPLE_vertex_array_object"))) {
+ vaoFuncs.helper = new QVertexArrayObjectHelper(ctx);
+ vaoFuncsType = APPLE;
+ vaoFuncs.helper->glGenVertexArrays(1, &vao);
+ }
+ }
+
return (vao != 0);
}
@@ -212,25 +201,25 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
{
if (!vao)
return;
-#if defined(QT_OPENGL_ES_2)
- if (vaoFuncs)
- vaoFuncs->glDeleteVertexArrays(1, &vao);
-#else
+
switch (vaoFuncsType) {
+#ifndef QT_OPENGL_ES_2
case Core_3_2:
vaoFuncs.core_3_2->glDeleteVertexArrays(1, &vao);
break;
case Core_3_0:
vaoFuncs.core_3_0->glDeleteVertexArrays(1, &vao);
break;
+#endif
case ARB:
case APPLE:
+ case OES:
vaoFuncs.helper->glDeleteVertexArrays(1, &vao);
break;
- case NotSupported:
+ default:
break;
}
-#endif
+
vao = 0;
}
@@ -244,48 +233,44 @@ void QOpenGLVertexArrayObjectPrivate::_q_contextAboutToBeDestroyed()
void QOpenGLVertexArrayObjectPrivate::bind()
{
-#if defined(QT_OPENGL_ES_2)
- if (vaoFuncs)
- vaoFuncs->glBindVertexArray(vao);
-#else
switch (vaoFuncsType) {
+#ifndef QT_OPENGL_ES_2
case Core_3_2:
vaoFuncs.core_3_2->glBindVertexArray(vao);
break;
case Core_3_0:
vaoFuncs.core_3_0->glBindVertexArray(vao);
break;
+#endif
case ARB:
case APPLE:
+ case OES:
vaoFuncs.helper->glBindVertexArray(vao);
break;
- case NotSupported:
+ default:
break;
}
-#endif
}
void QOpenGLVertexArrayObjectPrivate::release()
{
-#if defined(QT_OPENGL_ES_2)
- if (vaoFuncs)
- vaoFuncs->glBindVertexArray(0);
-#else
switch (vaoFuncsType) {
+#ifndef QT_OPENGL_ES_2
case Core_3_2:
vaoFuncs.core_3_2->glBindVertexArray(0);
break;
case Core_3_0:
vaoFuncs.core_3_0->glBindVertexArray(0);
break;
+#endif
case ARB:
case APPLE:
+ case OES:
vaoFuncs.helper->glBindVertexArray(0);
break;
- case NotSupported:
+ default:
break;
}
-#endif
}
diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp
index 8b47dae5ff..6a38ed6c70 100644
--- a/src/gui/painting/qoutlinemapper.cpp
+++ b/src/gui/painting/qoutlinemapper.cpp
@@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE
-#define qreal_to_fixed_26_6(f) (int(f * 64))
+#define qreal_to_fixed_26_6(f) (qRound(f * 64))
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 9a2e49618c..67896f786d 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -523,7 +523,7 @@ bool QRasterPaintEngine::begin(QPaintDevice *device)
#endif
if (d->mono_surface)
- d->glyphCacheType = QFontEngineGlyphCache::Raster_Mono;
+ d->glyphCacheFormat = QFontEngine::Format_Mono;
#if defined(Q_OS_WIN)
else if (clearTypeFontsEnabled())
#else
@@ -532,11 +532,11 @@ bool QRasterPaintEngine::begin(QPaintDevice *device)
{
QImage::Format format = static_cast<QImage *>(d->device)->format();
if (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32)
- d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask;
+ d->glyphCacheFormat = QFontEngine::Format_A32;
else
- d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
+ d->glyphCacheFormat = QFontEngine::Format_A8;
} else
- d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
+ d->glyphCacheFormat = QFontEngine::Format_A8;
setActive(true);
return true;
@@ -2819,12 +2819,12 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
}
} else {
- QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(fontEngine->glyphFormat) : d->glyphCacheType;
+ QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None ? fontEngine->glyphFormat : d->glyphCacheFormat;
QImageTextureGlyphCache *cache =
- static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphType, s->matrix));
+ static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphFormat, s->matrix));
if (!cache) {
- cache = new QImageTextureGlyphCache(glyphType, s->matrix);
+ cache = new QImageTextureGlyphCache(glyphFormat, s->matrix);
fontEngine->setGlyphCache(0, cache);
}
@@ -2842,7 +2842,7 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
else if (depth == 1)
rightShift = 3; // divide by 8
- int margin = fontEngine->glyphMargin(glyphType);
+ int margin = fontEngine->glyphMargin(glyphFormat);
const uchar *bits = image.bits();
for (int i=0; i<numGlyphs; ++i) {
@@ -2865,7 +2865,7 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
const uchar *glyphBits = bits + ((c.x << leftShift) >> rightShift) + c.y * bpl;
- if (glyphType == QFontEngineGlyphCache::Raster_ARGB) {
+ if (glyphFormat == QFontEngine::Format_ARGB) {
// The current state transform has already been applied to the positions,
// so we prevent drawImage() from re-applying the transform by clearing
// the state for the duration of the call.
@@ -3064,7 +3064,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
Q_D(QRasterPaintEngine);
fprintf(stderr," - QRasterPaintEngine::drawTextItem(), (%.2f,%.2f), string=%s ct=%d\n",
p.x(), p.y(), QString::fromRawData(ti.chars, ti.num_chars).toLatin1().data(),
- d->glyphCacheType);
+ d->glyphCacheFormat);
#endif
if (ti.glyphs.numGlyphs == 0)
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index 00a9ae750c..4bfdbd91e0 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -336,7 +336,7 @@ public:
QSpanData solid_color_filler;
- QFontEngineGlyphCache::Type glyphCacheType;
+ QFontEngine::GlyphFormat glyphCacheFormat;
QScopedPointer<QClipData> baseClip;
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 6e72b5db7f..e75a59cc91 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -1088,7 +1088,7 @@ bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const Q
bool QPaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const
{
- if (fontEngine->glyphFormat == QFontEngineGlyphCache::Raster_ARGB)
+ if (fontEngine->glyphFormat == QFontEngine::Format_ARGB)
return true;
qreal pixelSize = fontEngine->fontDef.pixelSize;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 1fc044aa44..e35cdd370e 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -171,9 +171,6 @@ static bool qt_painter_thread_test(int devType, const char *what)
void QPainterPrivate::checkEmulation()
{
Q_ASSERT(extended);
- if (extended->flags() & QPaintEngineEx::DoNotEmulate)
- return;
-
bool doEmulation = false;
if (state->bgMode == Qt::OpaqueMode)
doEmulation = true;
@@ -186,6 +183,9 @@ void QPainterPrivate::checkEmulation()
if (pg && pg->coordinateMode() > QGradient::LogicalMode)
doEmulation = true;
+ if (doEmulation && extended->flags() & QPaintEngineEx::DoNotEmulate)
+ return;
+
if (doEmulation) {
if (extended != emulationEngine) {
if (!emulationEngine)
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index c922867eb9..db65e14af9 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -244,7 +244,7 @@ class Q_GUI_EXPORT QPainterPathStroker
Q_DECLARE_PRIVATE(QPainterPathStroker)
public:
QPainterPathStroker();
- QPainterPathStroker(const QPen &pen);
+ explicit QPainterPathStroker(const QPen &pen);
~QPainterPathStroker();
void setWidth(qreal width);
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index e340c1e613..83edeb41a6 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -130,14 +130,6 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
QHash<GlyphAndSubPixelPosition, Coord> listItemCoordinates;
int rowHeight = 0;
- QFontEngine::GlyphFormat format;
- switch (m_type) {
- case Raster_A8: format = QFontEngine::Format_A8; break;
- case Raster_RGBMask: format = QFontEngine::Format_A32; break;
- case Raster_ARGB: format = QFontEngine::Format_ARGB; break;
- default: format = QFontEngine::Format_Mono; break;
- }
-
// check each glyph for its metrics and get the required rowHeight.
for (int i=0; i < numGlyphs; ++i) {
const glyph_t glyph = glyphs[i];
@@ -159,12 +151,12 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
// we ask for the alphaMapBoundingBox(), the glyph will be loaded, rasterized and its
// proper metrics will be cached and used later.
if (fontEngine->hasInternalCaching()) {
- QImage *locked = fontEngine->lockedAlphaMapForGlyph(glyph, subPixelPosition, format);
+ QImage *locked = fontEngine->lockedAlphaMapForGlyph(glyph, subPixelPosition, m_format);
if (locked && !locked->isNull())
fontEngine->unlockAlphaMapForGlyph();
}
- glyph_metrics_t metrics = fontEngine->alphaMapBoundingBox(glyph, subPixelPosition, m_transform, format);
+ glyph_metrics_t metrics = fontEngine->alphaMapBoundingBox(glyph, subPixelPosition, m_transform, m_format);
#ifdef CACHE_DEBUG
printf("(%4x): w=%.2f, h=%.2f, xoff=%.2f, yoff=%.2f, x=%.2f, y=%.2f\n",
@@ -186,7 +178,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
continue;
}
// align to 8-bit boundary
- if (m_type == QFontEngineGlyphCache::Raster_Mono)
+ if (m_format == QFontEngine::Format_Mono)
glyph_width = (glyph_width+7)&~7;
Coord c = { 0, 0, // will be filled in later
@@ -289,11 +281,14 @@ void QTextureGlyphCache::fillInPendingGlyphs()
QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g, QFixed subPixelPosition) const
{
- if (m_type == QFontEngineGlyphCache::Raster_RGBMask)
+ switch (m_format) {
+ case QFontEngine::Format_A32:
return m_current_fontengine->alphaRGBMapForGlyph(g, subPixelPosition, m_transform);
- else if (m_type == QFontEngineGlyphCache::Raster_ARGB)
+ case QFontEngine::Format_ARGB:
return m_current_fontengine->bitmapForGlyph(g, subPixelPosition, m_transform);
- return m_current_fontengine->alphaMapForGlyph(g, subPixelPosition, m_transform);
+ default:
+ return m_current_fontengine->alphaMapForGlyph(g, subPixelPosition, m_transform);
+ }
}
/************************************************************************
@@ -307,11 +302,11 @@ void QImageTextureGlyphCache::resizeTextureData(int width, int height)
void QImageTextureGlyphCache::createTextureData(int width, int height)
{
- switch (m_type) {
- case QFontEngineGlyphCache::Raster_Mono:
+ switch (m_format) {
+ case QFontEngine::Format_Mono:
m_image = QImage(width, height, QImage::Format_Mono);
break;
- case QFontEngineGlyphCache::Raster_A8: {
+ case QFontEngine::Format_A8: {
m_image = QImage(width, height, QImage::Format_Indexed8);
m_image.fill(0);
QVector<QRgb> colors(256);
@@ -320,12 +315,14 @@ void QImageTextureGlyphCache::createTextureData(int width, int height)
*it = 0xff000000 | i | (i<<8) | (i<<16);
m_image.setColorTable(colors);
break; }
- case QFontEngineGlyphCache::Raster_RGBMask:
+ case QFontEngine::Format_A32:
m_image = QImage(width, height, QImage::Format_RGB32);
break;
- case QFontEngineGlyphCache::Raster_ARGB:
+ case QFontEngine::Format_ARGB:
m_image = QImage(width, height, QImage::Format_ARGB32_Premultiplied);
break;
+ default:
+ Q_UNREACHABLE();
}
}
@@ -341,8 +338,8 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
}
#endif
- if (m_type == QFontEngineGlyphCache::Raster_RGBMask
- || m_type == QFontEngineGlyphCache::Raster_ARGB) {
+ if (m_format == QFontEngine::Format_A32
+ || m_format == QFontEngine::Format_ARGB) {
QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()),
qMax(mask.width(), c.w), qMax(mask.height(), c.h), m_image.bytesPerLine(),
m_image.format());
@@ -351,7 +348,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
p.fillRect(0, 0, c.w, c.h, QColor(0,0,0,0)); // TODO optimize this
p.drawImage(0, 0, mask);
p.end();
- } else if (m_type == QFontEngineGlyphCache::Raster_Mono) {
+ } else if (m_format == QFontEngine::Format_Mono) {
if (mask.depth() > 1) {
// TODO optimize this
mask = mask.alphaChannel();
@@ -414,7 +411,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
#ifdef CACHE_DEBUG
// QPainter p(&m_image);
// p.drawLine(
- int margin = m_current_fontengine ? m_current_fontengine->glyphMargin(m_type) : 0;
+ int margin = m_current_fontengine ? m_current_fontengine->glyphMargin(m_format) : 0;
QPoint base(c.x + margin, c.y + margin + c.baseLineY-1);
if (m_image.rect().contains(base))
m_image.setPixel(base, 255);
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index d93f57ad80..84f62717f6 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -75,8 +75,8 @@ class QTextItemInt;
class Q_GUI_EXPORT QTextureGlyphCache : public QFontEngineGlyphCache
{
public:
- QTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix)
- : QFontEngineGlyphCache(matrix, type), m_current_fontengine(0),
+ QTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix)
+ : QFontEngineGlyphCache(format, matrix), m_current_fontengine(0),
m_w(0), m_h(0), m_cx(0), m_cy(0), m_currentRowHeight(0)
{ }
@@ -163,8 +163,8 @@ inline uint qHash(const QTextureGlyphCache::GlyphAndSubPixelPosition &g)
class Q_GUI_EXPORT QImageTextureGlyphCache : public QTextureGlyphCache
{
public:
- QImageTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix)
- : QTextureGlyphCache(type, matrix) { }
+ QImageTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix)
+ : QTextureGlyphCache(format, matrix) { }
virtual void createTextureData(int width, int height);
virtual void resizeTextureData(int width, int height);
virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition);
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 14ce5d2396..83e64a51a6 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -41,6 +41,7 @@
#include <qdebug.h>
#include <private/qfontengine_p.h>
+#include <private/qfontengineglyphcache_p.h>
#include "qbitmap.h"
#include "qpainter.h"
@@ -253,7 +254,7 @@ QFontEngine::QFontEngine()
fsType = 0;
symbol = false;
- glyphFormat = -1;
+ glyphFormat = Format_None;
m_subPixelPositionCount = 0;
#ifdef QT_BUILD_INTERNAL
@@ -979,12 +980,12 @@ void QFontEngine::setGlyphCache(const void *key, QFontEngineGlyphCache *data)
}
-QFontEngineGlyphCache *QFontEngine::glyphCache(const void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const
+QFontEngineGlyphCache *QFontEngine::glyphCache(const void *key, GlyphFormat format, const QTransform &transform) const
{
for (QLinkedList<GlyphCacheEntry>::const_iterator it = m_glyphCaches.constBegin(), end = m_glyphCaches.constEnd(); it != end; ++it) {
QFontEngineGlyphCache *c = it->cache.data();
if (key == it->context
- && type == c->cacheType()
+ && format == c->glyphFormat()
&& qtransform_equals_no_translate(c->m_transform, transform)) {
return c;
}
@@ -1354,6 +1355,28 @@ QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round)
return 0;
}
+
+QFontEngine::GlyphCacheEntry::GlyphCacheEntry()
+ : context(0)
+{
+}
+
+QFontEngine::GlyphCacheEntry::GlyphCacheEntry(const GlyphCacheEntry &o)
+ : context(o.context), cache(o.cache)
+{
+}
+
+QFontEngine::GlyphCacheEntry::~GlyphCacheEntry()
+{
+}
+
+QFontEngine::GlyphCacheEntry &QFontEngine::GlyphCacheEntry::operator=(const GlyphCacheEntry &o)
+{
+ context = o.context;
+ cache = o.cache;
+ return *this;
+}
+
// ------------------------------------------------------------------
// The box font engine
// ------------------------------------------------------------------
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 665932e4a5..c13f60ff69 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -690,11 +690,9 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
this->antialias = antialias;
if (!antialias)
- glyphFormat = QFontEngineGlyphCache::Raster_Mono;
- else if (format == Format_A8)
- glyphFormat = QFontEngineGlyphCache::Raster_A8;
- else if (format == Format_A32)
- glyphFormat = QFontEngineGlyphCache::Raster_RGBMask;
+ glyphFormat = QFontEngine::Format_Mono;
+ else
+ glyphFormat = defaultFormat;
face_id = faceId;
@@ -1619,7 +1617,7 @@ void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlag
face = lockFace();
g = loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyphs->glyphs[i], 0, Format_None, true);
glyphs->advances[i] = design ? QFixed::fromFixed(face->glyph->linearHoriAdvance >> 10)
- : QFixed::fromFixed(face->glyph->metrics.horiAdvance);
+ : QFixed::fromFixed(face->glyph->metrics.horiAdvance).round();
if (!cacheEnabled)
delete g;
}
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index 7df66b9678..ad1598ba6d 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -264,7 +264,7 @@ private:
virtual void unlockAlphaMapForGlyph();
virtual void removeGlyphFromCache(glyph_t glyph);
- virtual int glyphMargin(QFontEngineGlyphCache::Type /* type */) { return 0; }
+ virtual int glyphMargin(QFontEngine::GlyphFormat /* format */) { return 0; }
virtual int glyphCount() const;
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 532ebaf8ff..0bfb9e70e2 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -60,11 +60,10 @@
#include "private/qtextengine_p.h"
#include "private/qfont_p.h"
-#include <private/qfontengineglyphcache_p.h>
-
QT_BEGIN_NAMESPACE
class QPainterPath;
+class QFontEngineGlyphCache;
struct QGlyphLayout;
@@ -246,7 +245,7 @@ public:
virtual Type type() const = 0;
virtual int glyphCount() const;
- virtual int glyphMargin(QFontEngineGlyphCache::Type type) { return type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0; }
+ virtual int glyphMargin(GlyphFormat format) { return format == Format_A32 ? 2 : 0; }
virtual QFontEngine *cloneWithSize(qreal /*pixelSize*/) const { return 0; }
@@ -258,7 +257,7 @@ public:
void clearGlyphCache(const void *key);
void setGlyphCache(const void *key, QFontEngineGlyphCache *data);
- QFontEngineGlyphCache *glyphCache(const void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const;
+ QFontEngineGlyphCache *glyphCache(const void *key, GlyphFormat format, const QTransform &transform) const;
static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize);
static quint32 getTrueTypeGlyphIndex(const uchar *cmap, uint unicode);
@@ -300,7 +299,7 @@ public:
QVector<KernPair> kerning_pairs;
void loadKerningPairs(QFixed scalingFactor);
- int glyphFormat;
+ GlyphFormat glyphFormat;
QImage currentlyLockedAlphaMap;
int m_subPixelPositionCount; // Number of positions within a single pixel for this cache
@@ -313,6 +312,12 @@ protected:
private:
struct GlyphCacheEntry {
+ GlyphCacheEntry();
+ GlyphCacheEntry(const GlyphCacheEntry &);
+ ~GlyphCacheEntry();
+
+ GlyphCacheEntry &operator=(const GlyphCacheEntry &);
+
const void *context;
QExplicitlySharedDataPointer<QFontEngineGlyphCache> cache;
bool operator==(const GlyphCacheEntry &other) const { return context == other.context && cache == other.cache; }
diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h
index ac01c78399..65be14b90f 100644
--- a/src/gui/text/qfontengineglyphcache_p.h
+++ b/src/gui/text/qfontengineglyphcache_p.h
@@ -58,6 +58,7 @@
#include "QtCore/qatomic.h"
#include <QtCore/qvarlengtharray.h>
#include "private/qfont_p.h"
+#include "private/qfontengine_p.h"
@@ -66,22 +67,18 @@ QT_BEGIN_NAMESPACE
class QFontEngineGlyphCache: public QSharedData
{
public:
- enum Type {
- Raster_RGBMask,
- Raster_A8,
- Raster_Mono,
- Raster_ARGB
- };
-
- QFontEngineGlyphCache(const QTransform &matrix, Type type) : m_transform(matrix), m_type(type) { }
+ QFontEngineGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix) : m_format(format), m_transform(matrix)
+ {
+ Q_ASSERT(m_format != QFontEngine::Format_None);
+ }
virtual ~QFontEngineGlyphCache() { }
- Type cacheType() const { return m_type; }
+ QFontEngine::GlyphFormat glyphFormat() const { return m_format; }
const QTransform &transform() const { return m_transform; }
+ QFontEngine::GlyphFormat m_format;
QTransform m_transform;
- QFontEngineGlyphCache::Type m_type;
};
typedef QHash<void *, QList<QFontEngineGlyphCache *> > GlyphPointerHash;
typedef QHash<int, QList<QFontEngineGlyphCache *> > GlyphIntHash;
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 7936831e13..3049e0ab5e 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -500,58 +500,60 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q
}
}
}
- if (codePageRange[0] & ((1 << Latin1CsbBit) | (1 << CentralEuropeCsbBit) | (1 << TurkishCsbBit) | (1 << BalticCsbBit))) {
- writingSystems.setSupported(QFontDatabase::Latin);
- hasScript = true;
- //qDebug("font %s supports Latin", familyName.latin1());
- }
- if (codePageRange[0] & (1 << CyrillicCsbBit)) {
- writingSystems.setSupported(QFontDatabase::Cyrillic);
- hasScript = true;
- //qDebug("font %s supports Cyrillic", familyName.latin1());
- }
- if (codePageRange[0] & (1 << GreekCsbBit)) {
- writingSystems.setSupported(QFontDatabase::Greek);
- hasScript = true;
- //qDebug("font %s supports Greek", familyName.latin1());
- }
- if (codePageRange[0] & (1 << HebrewCsbBit)) {
- writingSystems.setSupported(QFontDatabase::Hebrew);
- hasScript = true;
- //qDebug("font %s supports Hebrew", familyName.latin1());
- }
- if (codePageRange[0] & (1 << ArabicCsbBit)) {
- writingSystems.setSupported(QFontDatabase::Arabic);
- hasScript = true;
- //qDebug("font %s supports Arabic", familyName.latin1());
- }
- if (codePageRange[0] & (1 << VietnameseCsbBit)) {
- writingSystems.setSupported(QFontDatabase::Vietnamese);
- hasScript = true;
- //qDebug("font %s supports Vietnamese", familyName.latin1());
- }
- if (codePageRange[0] & (1 << SimplifiedChineseCsbBit)) {
- writingSystems.setSupported(QFontDatabase::SimplifiedChinese);
- hasScript = true;
- //qDebug("font %s supports Simplified Chinese", familyName.latin1());
- }
- if (codePageRange[0] & (1 << TraditionalChineseCsbBit)) {
- writingSystems.setSupported(QFontDatabase::TraditionalChinese);
- hasScript = true;
- //qDebug("font %s supports Traditional Chinese", familyName.latin1());
- }
- if (codePageRange[0] & (1 << JapaneseCsbBit)) {
- writingSystems.setSupported(QFontDatabase::Japanese);
- hasScript = true;
- //qDebug("font %s supports Japanese", familyName.latin1());
- }
- if (codePageRange[0] & ((1 << KoreanCsbBit) | (1 << KoreanJohabCsbBit))) {
- writingSystems.setSupported(QFontDatabase::Korean);
- hasScript = true;
- //qDebug("font %s supports Korean", familyName.latin1());
+ if (!hasScript) {
+ if (codePageRange[0] & ((1 << Latin1CsbBit) | (1 << CentralEuropeCsbBit) | (1 << TurkishCsbBit) | (1 << BalticCsbBit))) {
+ writingSystems.setSupported(QFontDatabase::Latin);
+ hasScript = true;
+ //qDebug("font %s supports Latin", familyName.latin1());
+ }
+ if (codePageRange[0] & (1 << CyrillicCsbBit)) {
+ writingSystems.setSupported(QFontDatabase::Cyrillic);
+ hasScript = true;
+ //qDebug("font %s supports Cyrillic", familyName.latin1());
+ }
+ if (codePageRange[0] & (1 << GreekCsbBit)) {
+ writingSystems.setSupported(QFontDatabase::Greek);
+ hasScript = true;
+ //qDebug("font %s supports Greek", familyName.latin1());
+ }
+ if (codePageRange[0] & (1 << HebrewCsbBit)) {
+ writingSystems.setSupported(QFontDatabase::Hebrew);
+ hasScript = true;
+ //qDebug("font %s supports Hebrew", familyName.latin1());
+ }
+ if (codePageRange[0] & (1 << ArabicCsbBit)) {
+ writingSystems.setSupported(QFontDatabase::Arabic);
+ hasScript = true;
+ //qDebug("font %s supports Arabic", familyName.latin1());
+ }
+ if (codePageRange[0] & (1 << VietnameseCsbBit)) {
+ writingSystems.setSupported(QFontDatabase::Vietnamese);
+ hasScript = true;
+ //qDebug("font %s supports Vietnamese", familyName.latin1());
+ }
+ if (codePageRange[0] & (1 << SimplifiedChineseCsbBit)) {
+ writingSystems.setSupported(QFontDatabase::SimplifiedChinese);
+ hasScript = true;
+ //qDebug("font %s supports Simplified Chinese", familyName.latin1());
+ }
+ if (codePageRange[0] & (1 << TraditionalChineseCsbBit)) {
+ writingSystems.setSupported(QFontDatabase::TraditionalChinese);
+ hasScript = true;
+ //qDebug("font %s supports Traditional Chinese", familyName.latin1());
+ }
+ if (codePageRange[0] & (1 << JapaneseCsbBit)) {
+ writingSystems.setSupported(QFontDatabase::Japanese);
+ hasScript = true;
+ //qDebug("font %s supports Japanese", familyName.latin1());
+ }
+ if (codePageRange[0] & ((1 << KoreanCsbBit) | (1 << KoreanJohabCsbBit))) {
+ writingSystems.setSupported(QFontDatabase::Korean);
+ hasScript = true;
+ //qDebug("font %s supports Korean", familyName.latin1());
+ }
+ if (!hasScript)
+ writingSystems.setSupported(QFontDatabase::Symbol);
}
- if (!hasScript)
- writingSystems.setSupported(QFontDatabase::Symbol);
return writingSystems;
}
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index eb31c520ed..63e2af8d15 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1133,6 +1133,21 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
uint cluster = infos[i].cluster;
if (last_cluster != cluster) {
+ if (Q_UNLIKELY(g.glyphs[i] == 0)) {
+ // hide characters that should normally be invisible
+ switch (string[item_pos + str_pos]) {
+ case QChar::LineFeed:
+ case 0x000c: // FormFeed
+ case QChar::CarriageReturn:
+ case QChar::LineSeparator:
+ case QChar::ParagraphSeparator:
+ g.attributes[i].dontPrint = true;
+ break;
+ default:
+ break;
+ }
+ }
+
// fix up clusters so that the cluster indices will be monotonic
// and thus we never return out-of-order indices
while (last_cluster++ < cluster && str_pos < item_length)
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index bd1e970583..c0342c0d4e 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -1242,9 +1242,9 @@ QString QTextBlock::text() const
\sa charFormat(), blockFormat()
*/
-QList<QTextLayout::FormatRange> QTextBlock::textFormats() const
+QVector<QTextLayout::FormatRange> QTextBlock::textFormats() const
{
- QList<QTextLayout::FormatRange> formats;
+ QVector<QTextLayout::FormatRange> formats;
if (!p || !n)
return formats;
diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h
index 6a127f0315..8138854348 100644
--- a/src/gui/text/qtextobject.h
+++ b/src/gui/text/qtextobject.h
@@ -223,7 +223,7 @@ public:
QString text() const;
- QList<QTextLayout::FormatRange> textFormats() const;
+ QVector<QTextLayout::FormatRange> textFormats() const;
const QTextDocument *document() const;
diff --git a/src/network/access/access.pri b/src/network/access/access.pri
index 3017417da8..e829d52cbe 100644
--- a/src/network/access/access.pri
+++ b/src/network/access/access.pri
@@ -9,6 +9,7 @@ HEADERS += \
access/qhttpnetworkconnectionchannel_p.h \
access/qabstractprotocolhandler_p.h \
access/qhttpprotocolhandler_p.h \
+ access/qspdyprotocolhandler_p.h \
access/qnetworkaccessauthenticationmanager_p.h \
access/qnetworkaccessmanager.h \
access/qnetworkaccessmanager_p.h \
@@ -47,6 +48,7 @@ SOURCES += \
access/qhttpnetworkconnectionchannel.cpp \
access/qabstractprotocolhandler.cpp \
access/qhttpprotocolhandler.cpp \
+ access/qspdyprotocolhandler.cpp \
access/qnetworkaccessauthenticationmanager.cpp \
access/qnetworkaccessmanager.cpp \
access/qnetworkaccesscache.cpp \
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 866a9399a9..2421de3f0c 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -68,7 +68,7 @@
QT_BEGIN_NAMESPACE
-const int QHttpNetworkConnectionPrivate::defaultChannelCount = 6;
+const int QHttpNetworkConnectionPrivate::defaultHttpChannelCount = 6;
// The pipeline length. So there will be 4 requests in flight.
const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3;
@@ -77,20 +77,29 @@ const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3;
const int QHttpNetworkConnectionPrivate::defaultRePipelineLength = 2;
-QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt)
+QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &hostName,
+ quint16 port, bool encrypt,
+ QHttpNetworkConnection::ConnectionType type)
: state(RunningState),
networkLayerState(Unknown),
- hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true),
- channelCount(defaultChannelCount)
+ hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true)
+#ifndef QT_NO_SSL
+, channelCount((type == QHttpNetworkConnection::ConnectionTypeSPDY) ? 1 : defaultHttpChannelCount)
+#else
+, channelCount(defaultHttpChannelCount)
+#endif // QT_NO_SSL
#ifndef QT_NO_NETWORKPROXY
, networkProxy(QNetworkProxy::NoProxy)
#endif
, preConnectRequests(0)
+ , connectionType(type)
{
channels = new QHttpNetworkConnectionChannel[channelCount];
}
-QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, quint16 port, bool encrypt)
+QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName,
+ quint16 port, bool encrypt,
+ QHttpNetworkConnection::ConnectionType type)
: state(RunningState), networkLayerState(Unknown),
hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true),
channelCount(channelCount)
@@ -98,6 +107,7 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(quint16 channelCoun
, networkProxy(QNetworkProxy::NoProxy)
#endif
, preConnectRequests(0)
+ , connectionType(type)
{
channels = new QHttpNetworkConnectionChannel[channelCount];
}
@@ -546,15 +556,24 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor
if (request.isPreConnect())
preConnectRequests++;
- switch (request.priority()) {
- case QHttpNetworkRequest::HighPriority:
- highPriorityQueue.prepend(pair);
- break;
- case QHttpNetworkRequest::NormalPriority:
- case QHttpNetworkRequest::LowPriority:
- lowPriorityQueue.prepend(pair);
- break;
+ if (connectionType == QHttpNetworkConnection::ConnectionTypeHTTP) {
+ switch (request.priority()) {
+ case QHttpNetworkRequest::HighPriority:
+ highPriorityQueue.prepend(pair);
+ break;
+ case QHttpNetworkRequest::NormalPriority:
+ case QHttpNetworkRequest::LowPriority:
+ lowPriorityQueue.prepend(pair);
+ break;
+ }
}
+#ifndef QT_NO_SSL
+ else { // SPDY
+ if (!pair.second->d_func()->requestIsPrepared)
+ prepareRequest(pair);
+ channels[0].spdyRequestsToSend.insertMulti(request.priority(), pair);
+ }
+#endif // QT_NO_SSL
// For Happy Eyeballs the networkLayerState is set to Unknown
// untill we have started the first connection attempt. So no
@@ -900,17 +919,39 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
// dequeue new ones
- // return fast if there is nothing to do
- if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
- return;
- // try to get a free AND connected socket
- for (int i = 0; i < channelCount; ++i) {
- if (channels[i].socket) {
- if (!channels[i].reply && !channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) {
- if (dequeueRequest(channels[i].socket))
- channels[i].sendRequest();
+ switch (connectionType) {
+ case QHttpNetworkConnection::ConnectionTypeHTTP: {
+ // return fast if there is nothing to do
+ if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
+ return;
+
+ // try to get a free AND connected socket
+ for (int i = 0; i < channelCount; ++i) {
+ if (channels[i].socket) {
+ if (!channels[i].reply && !channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) {
+ if (dequeueRequest(channels[i].socket))
+ channels[i].sendRequest();
+ }
}
}
+ break;
+ }
+ case QHttpNetworkConnection::ConnectionTypeSPDY: {
+#ifndef QT_NO_SSL
+ if (channels[0].spdyRequestsToSend.isEmpty())
+ return;
+
+ if (networkLayerState == IPv4)
+ channels[0].networkLayerPreference = QAbstractSocket::IPv4Protocol;
+ else if (networkLayerState == IPv6)
+ channels[0].networkLayerPreference = QAbstractSocket::IPv6Protocol;
+ channels[0].ensureConnection();
+ if (channels[0].socket && channels[0].socket->state() == QAbstractSocket::ConnectedState
+ && !channels[0].pendingEncrypt)
+ channels[0].sendRequest();
+#endif // QT_NO_SSL
+ break;
+ }
}
// try to push more into all sockets
@@ -1059,7 +1100,19 @@ void QHttpNetworkConnectionPrivate::_q_hostLookupFinished(QHostInfo info)
if (dequeueRequest(channels[0].socket)) {
emitReplyError(channels[0].socket, channels[0].reply, QNetworkReply::HostNotFoundError);
networkLayerState = QHttpNetworkConnectionPrivate::Unknown;
- } else {
+ }
+#ifndef QT_NO_SSL
+ else if (connectionType == QHttpNetworkConnection::ConnectionTypeSPDY) {
+ QList<HttpMessagePair> spdyPairs = channels[0].spdyRequestsToSend.values();
+ for (int a = 0; a < spdyPairs.count(); ++a) {
+ // emit error for all replies
+ QHttpNetworkReply *currentReply = spdyPairs.at(a).second;
+ Q_ASSERT(currentReply);
+ emitReplyError(channels[0].socket, currentReply, QNetworkReply::HostNotFoundError);
+ }
+ }
+#endif // QT_NO_SSL
+ else {
// Should not happen
qWarning() << "QHttpNetworkConnectionPrivate::_q_hostLookupFinished could not dequeu request";
networkLayerState = QHttpNetworkConnectionPrivate::Unknown;
@@ -1127,31 +1180,41 @@ void QHttpNetworkConnectionPrivate::_q_connectDelayedChannel()
}
#ifndef QT_NO_BEARERMANAGEMENT
-QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt, QObject *parent, QSharedPointer<QNetworkSession> networkSession)
- : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt)), parent)
+QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt,
+ QHttpNetworkConnection::ConnectionType connectionType,
+ QObject *parent, QSharedPointer<QNetworkSession> networkSession)
+ : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt, connectionType)), parent)
{
Q_D(QHttpNetworkConnection);
d->networkSession = qMove(networkSession);
d->init();
}
-QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QString &hostName, quint16 port, bool encrypt, QObject *parent, QSharedPointer<QNetworkSession> networkSession)
- : QObject(*(new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt)), parent)
+QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QString &hostName,
+ quint16 port, bool encrypt, QObject *parent,
+ QSharedPointer<QNetworkSession> networkSession,
+ QHttpNetworkConnection::ConnectionType connectionType)
+ : QObject(*(new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt,
+ connectionType)), parent)
{
Q_D(QHttpNetworkConnection);
d->networkSession = qMove(networkSession);
d->init();
}
#else
-QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt, QObject *parent)
- : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt)), parent)
+QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt, QObject *parent,
+ QHttpNetworkConnection::ConnectionType connectionType)
+ : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt , connectionType)), parent)
{
Q_D(QHttpNetworkConnection);
d->init();
}
-QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QString &hostName, quint16 port, bool encrypt, QObject *parent)
- : QObject(*(new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt)), parent)
+QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QString &hostName,
+ quint16 port, bool encrypt, QObject *parent,
+ QHttpNetworkConnection::ConnectionType connectionType)
+ : QObject(*(new QHttpNetworkConnectionPrivate(connectionCount, hostName, port, encrypt,
+ connectionType)), parent)
{
Q_D(QHttpNetworkConnection);
d->init();
@@ -1225,6 +1288,17 @@ QNetworkProxy QHttpNetworkConnection::transparentProxy() const
}
#endif
+QHttpNetworkConnection::ConnectionType QHttpNetworkConnection::connectionType()
+{
+ Q_D(QHttpNetworkConnection);
+ return d->connectionType;
+}
+
+void QHttpNetworkConnection::setConnectionType(ConnectionType type)
+{
+ Q_D(QHttpNetworkConnection);
+ d->connectionType = type;
+}
// SSL support below
#ifndef QT_NO_SSL
@@ -1299,7 +1373,23 @@ void QHttpNetworkConnectionPrivate::emitProxyAuthenticationRequired(const QHttpN
// Also pause the connection because socket notifiers may fire while an user
// dialog is displaying
pauseConnection();
- emit chan->reply->proxyAuthenticationRequired(proxy, auth);
+ QHttpNetworkReply *reply;
+#ifndef QT_NO_SSL
+ if (connectionType == QHttpNetworkConnection::ConnectionTypeSPDY) {
+ // we choose the reply to emit the proxyAuth signal from somewhat arbitrarily,
+ // but that does not matter because the signal will ultimately be emitted
+ // by the QNetworkAccessManager.
+ Q_ASSERT(chan->spdyRequestsToSend.count() > 0);
+ reply = chan->spdyRequestsToSend.values().first().second;
+ } else { // HTTP
+#endif // QT_NO_SSL
+ reply = chan->reply;
+#ifndef QT_NO_SSL
+ }
+#endif // QT_NO_SSL
+
+ Q_ASSERT(reply);
+ emit reply->proxyAuthenticationRequired(proxy, auth);
resumeConnection();
int i = indexOf(chan->socket);
copyCredentials(i, auth, true);
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index 526326c3fd..9d4257e217 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -94,12 +94,27 @@ class Q_AUTOTEST_EXPORT QHttpNetworkConnection : public QObject
Q_OBJECT
public:
+ enum ConnectionType {
+ ConnectionTypeHTTP,
+ ConnectionTypeSPDY
+ };
+
#ifndef QT_NO_BEARERMANAGEMENT
- explicit QHttpNetworkConnection(const QString &hostName, quint16 port = 80, bool encrypt = false, QObject *parent = 0, QSharedPointer<QNetworkSession> networkSession = QSharedPointer<QNetworkSession>());
- QHttpNetworkConnection(quint16 channelCount, const QString &hostName, quint16 port = 80, bool encrypt = false, QObject *parent = 0, QSharedPointer<QNetworkSession> networkSession = QSharedPointer<QNetworkSession>());
+ explicit QHttpNetworkConnection(const QString &hostName, quint16 port = 80, bool encrypt = false,
+ ConnectionType connectionType = ConnectionTypeHTTP,
+ QObject *parent = 0, QSharedPointer<QNetworkSession> networkSession
+ = QSharedPointer<QNetworkSession>());
+ QHttpNetworkConnection(quint16 channelCount, const QString &hostName, quint16 port = 80,
+ bool encrypt = false, QObject *parent = 0,
+ QSharedPointer<QNetworkSession> networkSession = QSharedPointer<QNetworkSession>(),
+ ConnectionType connectionType = ConnectionTypeHTTP);
#else
- explicit QHttpNetworkConnection(const QString &hostName, quint16 port = 80, bool encrypt = false, QObject *parent = 0);
- QHttpNetworkConnection(quint16 channelCount, const QString &hostName, quint16 port = 80, bool encrypt = false, QObject *parent = 0);
+ explicit QHttpNetworkConnection(const QString &hostName, quint16 port = 80, bool encrypt = false,
+ QObject *parent = 0,
+ ConnectionType connectionType = ConnectionTypeHTTP);
+ QHttpNetworkConnection(quint16 channelCount, const QString &hostName, quint16 port = 80,
+ bool encrypt = false, QObject *parent = 0,
+ ConnectionType connectionType = ConnectionTypeHTTP);
#endif
~QHttpNetworkConnection();
@@ -123,6 +138,9 @@ public:
QHttpNetworkConnectionChannel *channels() const;
+ ConnectionType connectionType();
+ void setConnectionType(ConnectionType type);
+
#ifndef QT_NO_SSL
void setSslConfiguration(const QSslConfiguration &config);
void ignoreSslErrors(int channel = -1);
@@ -140,6 +158,7 @@ private:
friend class QHttpNetworkReplyPrivate;
friend class QHttpNetworkConnectionChannel;
friend class QHttpProtocolHandler;
+ friend class QSpdyProtocolHandler;
Q_PRIVATE_SLOT(d_func(), void _q_startNextRequest())
Q_PRIVATE_SLOT(d_func(), void _q_hostLookupFinished(QHostInfo))
@@ -155,7 +174,7 @@ class QHttpNetworkConnectionPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QHttpNetworkConnection)
public:
- static const int defaultChannelCount;
+ static const int defaultHttpChannelCount;
static const int defaultPipelineLength;
static const int defaultRePipelineLength;
@@ -172,8 +191,10 @@ public:
IPv4or6
};
- QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt);
- QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, quint16 port, bool encrypt);
+ QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt,
+ QHttpNetworkConnection::ConnectionType type);
+ QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, quint16 port, bool encrypt,
+ QHttpNetworkConnection::ConnectionType type);
~QHttpNetworkConnectionPrivate();
void init();
@@ -245,6 +266,8 @@ public:
int preConnectRequests;
+ QHttpNetworkConnection::ConnectionType connectionType;
+
#ifndef QT_NO_SSL
QSharedPointer<QSslContext> sslContext;
#endif
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 6f06c18732..fb40958178 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -50,6 +50,7 @@
#ifndef QT_NO_HTTP
#include <private/qhttpprotocolhandler_p.h>
+#include <private/qspdyprotocolhandler_p.h>
#ifndef QT_NO_SSL
# include <QtNetwork/qsslkey.h>
@@ -166,9 +167,12 @@ void QHttpNetworkConnectionChannel::init()
if (!sslConfiguration.isNull())
sslSocket->setSslConfiguration(sslConfiguration);
+ } else {
+#endif // QT_NO_SSL
+ protocolHandler.reset(new QHttpProtocolHandler(this));
+#ifndef QT_NO_SSL
}
#endif
- protocolHandler.reset(new QHttpProtocolHandler(this));
#ifndef QT_NO_NETWORKPROXY
if (proxy.type() != QNetworkProxy::NoProxy)
@@ -879,6 +883,18 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
if (protocolHandler)
protocolHandler->setReply(0);
}
+#ifndef QT_NO_SSL
+ else if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) {
+ QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
+ for (int a = 0; a < spdyPairs.count(); ++a) {
+ // emit error for all replies
+ QHttpNetworkReply *currentReply = spdyPairs.at(a).second;
+ Q_ASSERT(currentReply);
+ emit currentReply->finishedWithError(errorCode, errorString);
+ }
+ }
+#endif // QT_NO_SSL
+
// send the next request
QMetaObject::invokeMethod(that, "_q_startNextRequest", Qt::QueuedConnection);
@@ -889,11 +905,19 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
#ifndef QT_NO_NETWORKPROXY
void QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator* auth)
{
- // Need to dequeue the request before we can emit the error.
- if (!reply)
- connection->d_func()->dequeueRequest(socket);
- if (reply)
+#ifndef QT_NO_SSL
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) {
connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth);
+ } else { // HTTP
+#endif // QT_NO_SSL
+ // Need to dequeue the request before we can emit the error.
+ if (!reply)
+ connection->d_func()->dequeueRequest(socket);
+ if (reply)
+ connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth);
+#ifndef QT_NO_SSL
+ }
+#endif // QT_NO_SSL
}
#endif
@@ -905,16 +929,85 @@ void QHttpNetworkConnectionChannel::_q_uploadDataReadyRead()
#ifndef QT_NO_SSL
void QHttpNetworkConnectionChannel::_q_encrypted()
{
+ QSslSocket *sslSocket = qobject_cast<QSslSocket *>(socket);
+ Q_ASSERT(sslSocket);
+
+ if (!protocolHandler) {
+ switch (sslSocket->sslConfiguration().nextProtocolNegotiationStatus()) {
+ case QSslConfiguration::NextProtocolNegotiationNegotiated: {
+ QByteArray nextProtocol = sslSocket->sslConfiguration().nextNegotiatedProtocol();
+ if (nextProtocol == QSslConfiguration::NextProtocolHttp1_1) {
+ // fall through to create a QHttpProtocolHandler
+ } else if (nextProtocol == QSslConfiguration::NextProtocolSpdy3_0) {
+ protocolHandler.reset(new QSpdyProtocolHandler(this));
+ connection->setConnectionType(QHttpNetworkConnection::ConnectionTypeSPDY);
+ // no need to re-queue requests, if SPDY was enabled on the request it
+ // has gone to the SPDY queue already
+ break;
+ } else {
+ emitFinishedWithError(QNetworkReply::SslHandshakeFailedError,
+ "detected unknown Next Protocol Negotiation protocol");
+ break;
+ }
+ }
+ case QSslConfiguration::NextProtocolNegotiationNone:
+ protocolHandler.reset(new QHttpProtocolHandler(this));
+ connection->setConnectionType(QHttpNetworkConnection::ConnectionTypeHTTP);
+ // re-queue requests from SPDY queue to HTTP queue, if any
+ requeueSpdyRequests();
+ break;
+ case QSslConfiguration::NextProtocolNegotiationUnsupported:
+ emitFinishedWithError(QNetworkReply::SslHandshakeFailedError,
+ "chosen Next Protocol Negotiation value unsupported");
+ break;
+ default:
+ emitFinishedWithError(QNetworkReply::SslHandshakeFailedError,
+ "detected unknown Next Protocol Negotiation protocol");
+ }
+ }
+
if (!socket)
return; // ### error
state = QHttpNetworkConnectionChannel::IdleState;
pendingEncrypt = false;
- if (!reply)
- connection->d_func()->dequeueRequest(socket);
- if (reply)
- emit reply->encrypted();
+
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) {
+ // we call setSpdyWasUsed(true) on the replies in the SPDY handler when the request is sent
+ if (spdyRequestsToSend.count() > 0)
+ // wait for data from the server first (e.g. initial window, max concurrent requests)
+ QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
+ } else { // HTTP
+ if (!reply)
+ connection->d_func()->dequeueRequest(socket);
+ if (reply) {
+ reply->setSpdyWasUsed(false);
+ emit reply->encrypted();
+ }
+ if (reply)
+ sendRequest();
+ }
+}
+
+void QHttpNetworkConnectionChannel::requeueSpdyRequests()
+{
+ QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
+ for (int a = 0; a < spdyPairs.count(); ++a) {
+ connection->d_func()->requeueRequest(spdyPairs.at(a));
+ }
+ spdyRequestsToSend.clear();
+}
+
+void QHttpNetworkConnectionChannel::emitFinishedWithError(QNetworkReply::NetworkError error,
+ const char *message)
+{
if (reply)
- sendRequest();
+ emit reply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message));
+ QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
+ for (int a = 0; a < spdyPairs.count(); ++a) {
+ QHttpNetworkReply *currentReply = spdyPairs.at(a).second;
+ Q_ASSERT(currentReply);
+ emit currentReply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message));
+ }
}
void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors)
@@ -927,8 +1020,21 @@ void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors)
connection->d_func()->pauseConnection();
if (pendingEncrypt && !reply)
connection->d_func()->dequeueRequest(socket);
- if (reply)
- emit reply->sslErrors(errors);
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP) {
+ if (reply)
+ emit reply->sslErrors(errors);
+ }
+#ifndef QT_NO_SSL
+ else { // SPDY
+ QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
+ for (int a = 0; a < spdyPairs.count(); ++a) {
+ // emit SSL errors for all replies
+ QHttpNetworkReply *currentReply = spdyPairs.at(a).second;
+ Q_ASSERT(currentReply);
+ emit currentReply->sslErrors(errors);
+ }
+ }
+#endif // QT_NO_SSL
connection->d_func()->resumeConnection();
}
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
index 7230eb2543..450b6fc419 100644
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
@@ -104,8 +104,8 @@ public:
bool ssl;
bool isInitialized;
ChannelState state;
- QHttpNetworkRequest request; // current request
- QHttpNetworkReply *reply; // current reply for this request
+ QHttpNetworkRequest request; // current request, only used for HTTP
+ QHttpNetworkReply *reply; // current reply for this request, only used for HTTP
qint64 written;
qint64 bytesTotal;
bool resendCurrent;
@@ -123,9 +123,13 @@ public:
bool ignoreAllSslErrors;
QList<QSslError> ignoreSslErrorsList;
QSslConfiguration sslConfiguration;
+ QMultiMap<int, HttpMessagePair> spdyRequestsToSend; // sorted by priority
void ignoreSslErrors();
void ignoreSslErrors(const QList<QSslError> &errors);
void setSslConfiguration(const QSslConfiguration &config);
+ void requeueSpdyRequests(); // when we wanted SPDY but got HTTP
+ // to emit the signal for all in-flight replies:
+ void emitFinishedWithError(QNetworkReply::NetworkError error, const char *message);
#endif
#ifndef QT_NO_BEARERMANAGEMENT
QSharedPointer<QNetworkSession> networkSession;
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 1b9e1f5a53..2a7e6ed638 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -265,6 +265,16 @@ bool QHttpNetworkReply::isPipeliningUsed() const
return d_func()->pipeliningUsed;
}
+bool QHttpNetworkReply::isSpdyUsed() const
+{
+ return d_func()->spdyUsed;
+}
+
+void QHttpNetworkReply::setSpdyWasUsed(bool spdy)
+{
+ d_func()->spdyUsed = spdy;
+}
+
QHttpNetworkConnection* QHttpNetworkReply::connection()
{
return d_func()->connection;
@@ -281,9 +291,15 @@ QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl)
connectionCloseEnabled(true),
forceConnectionCloseEnabled(false),
lastChunkRead(false),
- currentChunkSize(0), currentChunkRead(0), readBufferMaxSize(0), connection(0),
+ currentChunkSize(0), currentChunkRead(0), readBufferMaxSize(0),
+ windowSizeDownload(65536), // 64K initial window size according to SPDY standard
+ windowSizeUpload(65536), // 64K initial window size according to SPDY standard
+ currentlyReceivedDataInWindow(0),
+ currentlyUploadedDataInWindow(0),
+ totallyUploadedData(0),
+ connection(0),
autoDecompress(false), responseData(), requestIsPrepared(false)
- ,pipeliningUsed(false), downstreamLimited(false)
+ ,pipeliningUsed(false), spdyUsed(false), downstreamLimited(false)
,userProvidedDownloadBuffer(0)
#ifndef QT_NO_COMPRESS
,inflateStrm(0)
@@ -550,15 +566,7 @@ qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket)
// allocate inflate state
if (!inflateStrm)
inflateStrm = new z_stream;
- inflateStrm->zalloc = Z_NULL;
- inflateStrm->zfree = Z_NULL;
- inflateStrm->opaque = Z_NULL;
- inflateStrm->avail_in = 0;
- inflateStrm->next_in = Z_NULL;
- // "windowBits can also be greater than 15 for optional gzip decoding.
- // Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection"
- // http://www.zlib.net/manual.html
- int ret = inflateInit2(inflateStrm, MAX_WBITS+32);
+ int ret = initializeInflateStream();
if (ret != Z_OK)
return -1;
}
@@ -703,8 +711,28 @@ qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QByteDataBuff
}
#ifndef QT_NO_COMPRESS
+int QHttpNetworkReplyPrivate::initializeInflateStream()
+{
+ inflateStrm->zalloc = Z_NULL;
+ inflateStrm->zfree = Z_NULL;
+ inflateStrm->opaque = Z_NULL;
+ inflateStrm->avail_in = 0;
+ inflateStrm->next_in = Z_NULL;
+ // "windowBits can also be greater than 15 for optional gzip decoding.
+ // Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection"
+ // http://www.zlib.net/manual.html
+ int ret = inflateInit2(inflateStrm, MAX_WBITS+32);
+ Q_ASSERT(ret == Z_OK);
+ return ret;
+}
+
qint64 QHttpNetworkReplyPrivate::uncompressBodyData(QByteDataBuffer *in, QByteDataBuffer *out)
{
+ if (!inflateStrm) { // happens when called from the SPDY protocol handler
+ inflateStrm = new z_stream;
+ initializeInflateStream();
+ }
+
if (!inflateStrm)
return -1;
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index 583c3e426f..e15ace0072 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -132,6 +132,8 @@ public:
bool isFinished() const;
bool isPipeliningUsed() const;
+ bool isSpdyUsed() const;
+ void setSpdyWasUsed(bool spdy);
QHttpNetworkConnection* connection();
@@ -165,6 +167,7 @@ private:
friend class QHttpNetworkConnectionPrivate;
friend class QHttpNetworkConnectionChannel;
friend class QHttpProtocolHandler;
+ friend class QSpdyProtocolHandler;
};
@@ -205,7 +208,11 @@ public:
ReadingStatusState,
ReadingHeaderState,
ReadingDataState,
- AllDoneState
+ AllDoneState,
+ SPDYSYNSent,
+ SPDYUploading,
+ SPDYHalfClosed,
+ SPDYClosed
} state;
QHttpNetworkRequest request;
@@ -226,6 +233,11 @@ public:
qint64 currentChunkSize;
qint64 currentChunkRead;
qint64 readBufferMaxSize;
+ qint32 windowSizeDownload; // only for SPDY
+ qint32 windowSizeUpload; // only for SPDY
+ qint32 currentlyReceivedDataInWindow; // only for SPDY
+ qint32 currentlyUploadedDataInWindow; // only for SPDY
+ qint64 totallyUploadedData; // only for SPDY
QPointer<QHttpNetworkConnection> connection;
QPointer<QHttpNetworkConnectionChannel> connectionChannel;
@@ -236,12 +248,14 @@ public:
bool requestIsPrepared;
bool pipeliningUsed;
+ bool spdyUsed;
bool downstreamLimited;
char* userProvidedDownloadBuffer;
#ifndef QT_NO_COMPRESS
z_stream_s *inflateStrm;
+ int initializeInflateStream();
qint64 uncompressBodyData(QByteDataBuffer *in, QByteDataBuffer *out);
#endif
};
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index 3786f9b992..6e9f1216c3 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -49,8 +49,8 @@ QT_BEGIN_NAMESPACE
QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,
QHttpNetworkRequest::Priority pri, const QUrl &newUrl)
: QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0),
- autoDecompress(false), pipeliningAllowed(false), withCredentials(true),
- preConnect(false)
+ autoDecompress(false), pipeliningAllowed(false), spdyAllowed(false),
+ withCredentials(true), preConnect(false)
{
}
@@ -62,6 +62,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest
uploadByteDevice = other.uploadByteDevice;
autoDecompress = other.autoDecompress;
pipeliningAllowed = other.pipeliningAllowed;
+ spdyAllowed = other.spdyAllowed;
customVerb = other.customVerb;
withCredentials = other.withCredentials;
ssl = other.ssl;
@@ -80,6 +81,7 @@ bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &ot
&& (uploadByteDevice == other.uploadByteDevice)
&& (autoDecompress == other.autoDecompress)
&& (pipeliningAllowed == other.pipeliningAllowed)
+ && (spdyAllowed == other.spdyAllowed)
// we do not clear the customVerb in setOperation
&& (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb))
&& (withCredentials == other.withCredentials)
@@ -299,6 +301,16 @@ void QHttpNetworkRequest::setPipeliningAllowed(bool b)
d->pipeliningAllowed = b;
}
+bool QHttpNetworkRequest::isSPDYAllowed() const
+{
+ return d->spdyAllowed;
+}
+
+void QHttpNetworkRequest::setSPDYAllowed(bool b)
+{
+ d->spdyAllowed = b;
+}
+
bool QHttpNetworkRequest::withCredentials() const
{
return d->withCredentials;
diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h
index f224f7329d..09847d715c 100644
--- a/src/network/access/qhttpnetworkrequest_p.h
+++ b/src/network/access/qhttpnetworkrequest_p.h
@@ -114,6 +114,9 @@ public:
bool isPipeliningAllowed() const;
void setPipeliningAllowed(bool b);
+ bool isSPDYAllowed() const;
+ void setSPDYAllowed(bool b);
+
bool withCredentials() const;
void setWithCredentials(bool b);
@@ -135,6 +138,7 @@ private:
friend class QHttpNetworkConnectionPrivate;
friend class QHttpNetworkConnectionChannel;
friend class QHttpProtocolHandler;
+ friend class QSpdyProtocolHandler;
};
class QHttpNetworkRequestPrivate : public QHttpNetworkHeaderPrivate
@@ -154,6 +158,7 @@ public:
mutable QNonContiguousByteDevice* uploadByteDevice;
bool autoDecompress;
bool pipeliningAllowed;
+ bool spdyAllowed;
bool withCredentials;
bool ssl;
bool preConnect;
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index 5602c8028a..7b5ad1e2f1 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -180,11 +180,15 @@ class QNetworkAccessCachedHttpConnection: public QHttpNetworkConnection,
// Q_OBJECT
public:
#ifdef QT_NO_BEARERMANAGEMENT
- QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt)
- : QHttpNetworkConnection(hostName, port, encrypt)
+ QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt,
+ QHttpNetworkConnection::ConnectionType connectionType)
+ : QHttpNetworkConnection(hostName, port, encrypt, connectionType)
#else
- QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt, QSharedPointer<QNetworkSession> networkSession)
- : QHttpNetworkConnection(hostName, port, encrypt, /*parent=*/0, qMove(networkSession))
+ QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt,
+ QHttpNetworkConnection::ConnectionType connectionType,
+ QSharedPointer<QNetworkSession> networkSession)
+ : QHttpNetworkConnection(hostName, port, encrypt, connectionType, /*parent=*/0,
+ qMove(networkSession))
#endif
{
setExpires(true);
@@ -230,6 +234,7 @@ QHttpThreadDelegate::QHttpThreadDelegate(QObject *parent) :
, synchronous(false)
, incomingStatusCode(0)
, isPipeliningUsed(false)
+ , isSpdyUsed(false)
, incomingContentLength(-1)
, incomingErrorCode(QNetworkReply::NoError)
, downloadBuffer(0)
@@ -281,6 +286,19 @@ void QHttpThreadDelegate::startRequest()
QUrl urlCopy = httpRequest.url();
urlCopy.setPort(urlCopy.port(ssl ? 443 : 80));
+ QHttpNetworkConnection::ConnectionType connectionType
+ = QHttpNetworkConnection::ConnectionTypeHTTP;
+#ifndef QT_NO_SSL
+ if (httpRequest.isSPDYAllowed() && ssl) {
+ connectionType = QHttpNetworkConnection::ConnectionTypeSPDY;
+ urlCopy.setScheme(QStringLiteral("spdy")); // to differentiate SPDY requests from HTTPS requests
+ QList<QByteArray> nextProtocols;
+ nextProtocols << QSslConfiguration::NextProtocolSpdy3_0
+ << QSslConfiguration::NextProtocolHttp1_1;
+ incomingSslConfiguration.setAllowedNextProtocols(nextProtocols);
+ }
+#endif // QT_NO_SSL
+
#ifndef QT_NO_NETWORKPROXY
if (transparentProxy.type() != QNetworkProxy::NoProxy)
cacheKey = makeCacheKey(urlCopy, &transparentProxy);
@@ -297,9 +315,12 @@ void QHttpThreadDelegate::startRequest()
// no entry in cache; create an object
// the http object is actually a QHttpNetworkConnection
#ifdef QT_NO_BEARERMANAGEMENT
- httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl);
+ httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl,
+ connectionType);
#else
- httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl, networkSession);
+ httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl,
+ connectionType,
+ networkSession);
#endif
#ifndef QT_NO_SSL
// Set the QSslConfiguration from this QNetworkRequest.
@@ -575,13 +596,15 @@ void QHttpThreadDelegate::headerChangedSlot()
incomingReasonPhrase = httpReply->reasonPhrase();
isPipeliningUsed = httpReply->isPipeliningUsed();
incomingContentLength = httpReply->contentLength();
+ isSpdyUsed = httpReply->isSpdyUsed();
emit downloadMetaData(incomingHeaders,
incomingStatusCode,
incomingReasonPhrase,
isPipeliningUsed,
downloadBuffer,
- incomingContentLength);
+ incomingContentLength,
+ isSpdyUsed);
}
void QHttpThreadDelegate::synchronousHeaderChangedSlot()
@@ -597,6 +620,7 @@ void QHttpThreadDelegate::synchronousHeaderChangedSlot()
incomingStatusCode = httpReply->statusCode();
incomingReasonPhrase = httpReply->reasonPhrase();
isPipeliningUsed = httpReply->isPipeliningUsed();
+ isSpdyUsed = httpReply->isSpdyUsed();
incomingContentLength = httpReply->contentLength();
}
diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h
index d9ef1a0a55..6e6d3b5797 100644
--- a/src/network/access/qhttpthreaddelegate_p.h
+++ b/src/network/access/qhttpthreaddelegate_p.h
@@ -111,6 +111,7 @@ public:
int incomingStatusCode;
QString incomingReasonPhrase;
bool isPipeliningUsed;
+ bool isSpdyUsed;
qint64 incomingContentLength;
QNetworkReply::NetworkError incomingErrorCode;
QString incomingErrorDetail;
@@ -139,7 +140,8 @@ signals:
void sslErrors(const QList<QSslError> &, bool *, QList<QSslError> *);
void sslConfigurationChanged(const QSslConfiguration);
#endif
- void downloadMetaData(QList<QPair<QByteArray,QByteArray> >,int,QString,bool,QSharedPointer<char>,qint64);
+ void downloadMetaData(QList<QPair<QByteArray,QByteArray> >, int, QString, bool,
+ QSharedPointer<char>, qint64, bool);
void downloadProgress(qint64, qint64);
void downloadData(QByteArray);
void error(QNetworkReply::NetworkError, const QString);
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index c89419091f..473acc5f22 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -977,6 +977,12 @@ QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccess
\a sslConfiguration. This function is useful to complete the TCP and SSL handshake
to a host before the HTTPS request is made, resulting in a lower network latency.
+ \note Preconnecting a SPDY connection can be done by calling setAllowedNextProtocols()
+ on \a sslConfiguration with QSslConfiguration::NextProtocolSpdy3_0 contained in
+ the list of allowed protocols. When using SPDY, one single connection per host is
+ enough, i.e. calling this method multiple times per host will not result in faster
+ network transactions.
+
\note This function has no possibility to report errors.
\sa connectToHost(), get(), post(), put(), deleteResource()
@@ -991,6 +997,13 @@ void QNetworkAccessManager::connectToHostEncrypted(const QString &hostName, quin
QNetworkRequest request(url);
if (sslConfiguration != QSslConfiguration::defaultConfiguration())
request.setSslConfiguration(sslConfiguration);
+
+ // There is no way to enable SPDY via a request, so we need to check
+ // the ssl configuration whether SPDY is allowed here.
+ if (sslConfiguration.allowedNextProtocols().contains(
+ QSslConfiguration::NextProtocolSpdy3_0))
+ request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
+
get(request);
}
#endif
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 29d23bfd8f..de4c8d0964 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -752,6 +752,9 @@ void QNetworkReplyHttpImplPrivate::postRequest()
if (request.attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool() == true)
httpRequest.setPipeliningAllowed(true);
+ if (request.attribute(QNetworkRequest::SpdyAllowedAttribute).toBool() == true)
+ httpRequest.setSPDYAllowed(true);
+
if (static_cast<QNetworkRequest::LoadControl>
(request.attribute(QNetworkRequest::AuthenticationReuseAttribute,
QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual)
@@ -811,8 +814,12 @@ void QNetworkReplyHttpImplPrivate::postRequest()
QObject::connect(delegate, SIGNAL(downloadFinished()),
q, SLOT(replyFinished()),
Qt::QueuedConnection);
- QObject::connect(delegate, SIGNAL(downloadMetaData(QList<QPair<QByteArray,QByteArray> >,int,QString,bool,QSharedPointer<char>,qint64)),
- q, SLOT(replyDownloadMetaData(QList<QPair<QByteArray,QByteArray> >,int,QString,bool,QSharedPointer<char>,qint64)),
+ QObject::connect(delegate, SIGNAL(downloadMetaData(QList<QPair<QByteArray,QByteArray> >,
+ int, QString, bool,
+ QSharedPointer<char>, qint64, bool)),
+ q, SLOT(replyDownloadMetaData(QList<QPair<QByteArray,QByteArray> >,
+ int, QString, bool,
+ QSharedPointer<char>, qint64, bool)),
Qt::QueuedConnection);
QObject::connect(delegate, SIGNAL(downloadProgress(qint64,qint64)),
q, SLOT(replyDownloadProgressSlot(qint64,qint64)),
@@ -907,7 +914,8 @@ void QNetworkReplyHttpImplPrivate::postRequest()
delegate->incomingReasonPhrase,
delegate->isPipeliningUsed,
QSharedPointer<char>(),
- delegate->incomingContentLength);
+ delegate->incomingContentLength,
+ delegate->isSpdyUsed);
replyDownloadData(delegate->synchronousDownloadData);
httpError(delegate->incomingErrorCode, delegate->incomingErrorDetail);
} else {
@@ -917,7 +925,8 @@ void QNetworkReplyHttpImplPrivate::postRequest()
delegate->incomingReasonPhrase,
delegate->isPipeliningUsed,
QSharedPointer<char>(),
- delegate->incomingContentLength);
+ delegate->incomingContentLength,
+ delegate->isSpdyUsed);
replyDownloadData(delegate->synchronousDownloadData);
}
@@ -1074,7 +1083,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData
(QList<QPair<QByteArray,QByteArray> > hm,
int sc,QString rp,bool pu,
QSharedPointer<char> db,
- qint64 contentLength)
+ qint64 contentLength, bool spdyWasUsed)
{
Q_Q(QNetworkReplyHttpImpl);
Q_UNUSED(contentLength);
@@ -1091,6 +1100,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData
}
q->setAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute, pu);
+ q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, spdyWasUsed);
// reconstruct the HTTP header
QList<QPair<QByteArray, QByteArray> > headerMap = hm;
diff --git a/src/network/access/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h
index 15cc0ec476..aa2d6f0ec9 100644
--- a/src/network/access/qnetworkreplyhttpimpl_p.h
+++ b/src/network/access/qnetworkreplyhttpimpl_p.h
@@ -111,7 +111,9 @@ public:
// From reply
Q_PRIVATE_SLOT(d_func(), void replyDownloadData(QByteArray))
Q_PRIVATE_SLOT(d_func(), void replyFinished())
- Q_PRIVATE_SLOT(d_func(), void replyDownloadMetaData(QList<QPair<QByteArray,QByteArray> >,int,QString,bool,QSharedPointer<char>,qint64))
+ Q_PRIVATE_SLOT(d_func(), void replyDownloadMetaData(QList<QPair<QByteArray,QByteArray> >,
+ int, QString, bool, QSharedPointer<char>,
+ qint64, bool))
Q_PRIVATE_SLOT(d_func(), void replyDownloadProgressSlot(qint64,qint64))
Q_PRIVATE_SLOT(d_func(), void httpAuthenticationRequired(const QHttpNetworkRequest &, QAuthenticator *))
Q_PRIVATE_SLOT(d_func(), void httpError(QNetworkReply::NetworkError, const QString &))
@@ -276,7 +278,8 @@ public:
// From HTTP thread:
void replyDownloadData(QByteArray);
void replyFinished();
- void replyDownloadMetaData(QList<QPair<QByteArray,QByteArray> >,int,QString,bool,QSharedPointer<char>,qint64);
+ void replyDownloadMetaData(QList<QPair<QByteArray,QByteArray> >, int, QString, bool,
+ QSharedPointer<char>, qint64, bool);
void replyDownloadProgressSlot(qint64,qint64);
void httpAuthenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *auth);
void httpError(QNetworkReply::NetworkError error, const QString &errorString);
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 65fd693771..aa1102f9bf 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -246,6 +246,17 @@ QT_BEGIN_NAMESPACE
The QNetworkSession ConnectInBackground property will be set according to
this attribute.
+ \value SpdyAllowedAttribute
+ Requests only, type: QMetaType::Bool (default: false)
+ Indicates whether the QNetworkAccessManager code is
+ allowed to use SPDY with this request. This applies only
+ to SSL requests, and depends on the server supporting SPDY.
+
+ \value SpdyWasUsedAttribute
+ Replies only, type: QMetaType::Bool
+ Indicates whether SPDY was used for receiving
+ this reply.
+
\value User
Special type. Additional information can be passed in
QVariants with types ranging from User to UserMax. The default
diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h
index 1512c6dadd..27b02a89ef 100644
--- a/src/network/access/qnetworkrequest.h
+++ b/src/network/access/qnetworkrequest.h
@@ -86,6 +86,8 @@ public:
DownloadBufferAttribute, // internal
SynchronousRequestAttribute, // internal
BackgroundRequestAttribute,
+ SpdyAllowedAttribute,
+ SpdyWasUsedAttribute,
User = 1000,
UserMax = 32767
diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp
new file mode 100644
index 0000000000..098b3e9ab0
--- /dev/null
+++ b/src/network/access/qspdyprotocolhandler.cpp
@@ -0,0 +1,1286 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <private/qspdyprotocolhandler_p.h>
+#include <private/qnoncontiguousbytedevice_p.h>
+#include <private/qhttpnetworkconnectionchannel_p.h>
+#include <QtCore/QtEndian>
+
+#if !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+
+QT_BEGIN_NAMESPACE
+
+static const char spdyDictionary[] = {
+ 0x00, 0x00, 0x00, 0x07, 0x6f, 0x70, 0x74, 0x69, // ....opti
+ 0x6f, 0x6e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x68, // ons....h
+ 0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x04, 0x70, // ead....p
+ 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x03, 0x70, // ost....p
+ 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x64, 0x65, // ut....de
+ 0x6c, 0x65, 0x74, 0x65, 0x00, 0x00, 0x00, 0x05, // lete....
+ 0x74, 0x72, 0x61, 0x63, 0x65, 0x00, 0x00, 0x00, // trace...
+ 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x00, // .accept.
+ 0x00, 0x00, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x70, // ...accep
+ 0x74, 0x2d, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, // t-charse
+ 0x74, 0x00, 0x00, 0x00, 0x0f, 0x61, 0x63, 0x63, // t....acc
+ 0x65, 0x70, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, // ept-enco
+ 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x0f, // ding....
+ 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x6c, // accept-l
+ 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x00, // anguage.
+ 0x00, 0x00, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x70, // ...accep
+ 0x74, 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, // t-ranges
+ 0x00, 0x00, 0x00, 0x03, 0x61, 0x67, 0x65, 0x00, // ....age.
+ 0x00, 0x00, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, // ...allow
+ 0x00, 0x00, 0x00, 0x0d, 0x61, 0x75, 0x74, 0x68, // ....auth
+ 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, // orizatio
+ 0x6e, 0x00, 0x00, 0x00, 0x0d, 0x63, 0x61, 0x63, // n....cac
+ 0x68, 0x65, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, // he-contr
+ 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f, // ol....co
+ 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, // nnection
+ 0x00, 0x00, 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, // ....cont
+ 0x65, 0x6e, 0x74, 0x2d, 0x62, 0x61, 0x73, 0x65, // ent-base
+ 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, 0x6e, 0x74, // ....cont
+ 0x65, 0x6e, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, // ent-enco
+ 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, // ding....
+ 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, // content-
+ 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, // language
+ 0x00, 0x00, 0x00, 0x0e, 0x63, 0x6f, 0x6e, 0x74, // ....cont
+ 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x65, 0x6e, 0x67, // ent-leng
+ 0x74, 0x68, 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, // th....co
+ 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x6f, // ntent-lo
+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // cation..
+ 0x00, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, // ..conten
+ 0x74, 0x2d, 0x6d, 0x64, 0x35, 0x00, 0x00, 0x00, // t-md5...
+ 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, // .content
+ 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, // -range..
+ 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, // ..conten
+ 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, // t-type..
+ 0x00, 0x04, 0x64, 0x61, 0x74, 0x65, 0x00, 0x00, // ..date..
+ 0x00, 0x04, 0x65, 0x74, 0x61, 0x67, 0x00, 0x00, // ..etag..
+ 0x00, 0x06, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, // ..expect
+ 0x00, 0x00, 0x00, 0x07, 0x65, 0x78, 0x70, 0x69, // ....expi
+ 0x72, 0x65, 0x73, 0x00, 0x00, 0x00, 0x04, 0x66, // res....f
+ 0x72, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x04, 0x68, // rom....h
+ 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x08, 0x69, // ost....i
+ 0x66, 0x2d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, // f-match.
+ 0x00, 0x00, 0x11, 0x69, 0x66, 0x2d, 0x6d, 0x6f, // ...if-mo
+ 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2d, 0x73, // dified-s
+ 0x69, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0x0d, // ince....
+ 0x69, 0x66, 0x2d, 0x6e, 0x6f, 0x6e, 0x65, 0x2d, // if-none-
+ 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, 0x00, 0x00, // match...
+ 0x08, 0x69, 0x66, 0x2d, 0x72, 0x61, 0x6e, 0x67, // .if-rang
+ 0x65, 0x00, 0x00, 0x00, 0x13, 0x69, 0x66, 0x2d, // e....if-
+ 0x75, 0x6e, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, // unmodifi
+ 0x65, 0x64, 0x2d, 0x73, 0x69, 0x6e, 0x63, 0x65, // ed-since
+ 0x00, 0x00, 0x00, 0x0d, 0x6c, 0x61, 0x73, 0x74, // ....last
+ 0x2d, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, // -modifie
+ 0x64, 0x00, 0x00, 0x00, 0x08, 0x6c, 0x6f, 0x63, // d....loc
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, // ation...
+ 0x0c, 0x6d, 0x61, 0x78, 0x2d, 0x66, 0x6f, 0x72, // .max-for
+ 0x77, 0x61, 0x72, 0x64, 0x73, 0x00, 0x00, 0x00, // wards...
+ 0x06, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x00, // .pragma.
+ 0x00, 0x00, 0x12, 0x70, 0x72, 0x6f, 0x78, 0x79, // ...proxy
+ 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, // -authent
+ 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, // icate...
+ 0x13, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2d, 0x61, // .proxy-a
+ 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, // uthoriza
+ 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, // tion....
+ 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, 0x00, // range...
+ 0x07, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, // .referer
+ 0x00, 0x00, 0x00, 0x0b, 0x72, 0x65, 0x74, 0x72, // ....retr
+ 0x79, 0x2d, 0x61, 0x66, 0x74, 0x65, 0x72, 0x00, // y-after.
+ 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, // ...serve
+ 0x72, 0x00, 0x00, 0x00, 0x02, 0x74, 0x65, 0x00, // r....te.
+ 0x00, 0x00, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6c, // ...trail
+ 0x65, 0x72, 0x00, 0x00, 0x00, 0x11, 0x74, 0x72, // er....tr
+ 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x2d, 0x65, // ansfer-e
+ 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x00, // ncoding.
+ 0x00, 0x00, 0x07, 0x75, 0x70, 0x67, 0x72, 0x61, // ...upgra
+ 0x64, 0x65, 0x00, 0x00, 0x00, 0x0a, 0x75, 0x73, // de....us
+ 0x65, 0x72, 0x2d, 0x61, 0x67, 0x65, 0x6e, 0x74, // er-agent
+ 0x00, 0x00, 0x00, 0x04, 0x76, 0x61, 0x72, 0x79, // ....vary
+ 0x00, 0x00, 0x00, 0x03, 0x76, 0x69, 0x61, 0x00, // ....via.
+ 0x00, 0x00, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, // ...warni
+ 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, 0x77, 0x77, // ng....ww
+ 0x77, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, // w-authen
+ 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, // ticate..
+ 0x00, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, // ..method
+ 0x00, 0x00, 0x00, 0x03, 0x67, 0x65, 0x74, 0x00, // ....get.
+ 0x00, 0x00, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, // ...statu
+ 0x73, 0x00, 0x00, 0x00, 0x06, 0x32, 0x30, 0x30, // s....200
+ 0x20, 0x4f, 0x4b, 0x00, 0x00, 0x00, 0x07, 0x76, // .OK....v
+ 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ersion..
+ 0x00, 0x08, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, // ..HTTP.1
+ 0x2e, 0x31, 0x00, 0x00, 0x00, 0x03, 0x75, 0x72, // .1....ur
+ 0x6c, 0x00, 0x00, 0x00, 0x06, 0x70, 0x75, 0x62, // l....pub
+ 0x6c, 0x69, 0x63, 0x00, 0x00, 0x00, 0x0a, 0x73, // lic....s
+ 0x65, 0x74, 0x2d, 0x63, 0x6f, 0x6f, 0x6b, 0x69, // et-cooki
+ 0x65, 0x00, 0x00, 0x00, 0x0a, 0x6b, 0x65, 0x65, // e....kee
+ 0x70, 0x2d, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x00, // p-alive.
+ 0x00, 0x00, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, // ...origi
+ 0x6e, 0x31, 0x30, 0x30, 0x31, 0x30, 0x31, 0x32, // n1001012
+ 0x30, 0x31, 0x32, 0x30, 0x32, 0x32, 0x30, 0x35, // 01202205
+ 0x32, 0x30, 0x36, 0x33, 0x30, 0x30, 0x33, 0x30, // 20630030
+ 0x32, 0x33, 0x30, 0x33, 0x33, 0x30, 0x34, 0x33, // 23033043
+ 0x30, 0x35, 0x33, 0x30, 0x36, 0x33, 0x30, 0x37, // 05306307
+ 0x34, 0x30, 0x32, 0x34, 0x30, 0x35, 0x34, 0x30, // 40240540
+ 0x36, 0x34, 0x30, 0x37, 0x34, 0x30, 0x38, 0x34, // 64074084
+ 0x30, 0x39, 0x34, 0x31, 0x30, 0x34, 0x31, 0x31, // 09410411
+ 0x34, 0x31, 0x32, 0x34, 0x31, 0x33, 0x34, 0x31, // 41241341
+ 0x34, 0x34, 0x31, 0x35, 0x34, 0x31, 0x36, 0x34, // 44154164
+ 0x31, 0x37, 0x35, 0x30, 0x32, 0x35, 0x30, 0x34, // 17502504
+ 0x35, 0x30, 0x35, 0x32, 0x30, 0x33, 0x20, 0x4e, // 505203.N
+ 0x6f, 0x6e, 0x2d, 0x41, 0x75, 0x74, 0x68, 0x6f, // on-Autho
+ 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, // ritative
+ 0x20, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, // .Informa
+ 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x30, 0x34, 0x20, // tion204.
+ 0x4e, 0x6f, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x65, // No.Conte
+ 0x6e, 0x74, 0x33, 0x30, 0x31, 0x20, 0x4d, 0x6f, // nt301.Mo
+ 0x76, 0x65, 0x64, 0x20, 0x50, 0x65, 0x72, 0x6d, // ved.Perm
+ 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x34, // anently4
+ 0x30, 0x30, 0x20, 0x42, 0x61, 0x64, 0x20, 0x52, // 00.Bad.R
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x34, 0x30, // equest40
+ 0x31, 0x20, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, // 1.Unauth
+ 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x34, 0x30, // orized40
+ 0x33, 0x20, 0x46, 0x6f, 0x72, 0x62, 0x69, 0x64, // 3.Forbid
+ 0x64, 0x65, 0x6e, 0x34, 0x30, 0x34, 0x20, 0x4e, // den404.N
+ 0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, // ot.Found
+ 0x35, 0x30, 0x30, 0x20, 0x49, 0x6e, 0x74, 0x65, // 500.Inte
+ 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x72, // rnal.Ser
+ 0x76, 0x65, 0x72, 0x20, 0x45, 0x72, 0x72, 0x6f, // ver.Erro
+ 0x72, 0x35, 0x30, 0x31, 0x20, 0x4e, 0x6f, 0x74, // r501.Not
+ 0x20, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, // .Impleme
+ 0x6e, 0x74, 0x65, 0x64, 0x35, 0x30, 0x33, 0x20, // nted503.
+ 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, // Service.
+ 0x55, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, // Unavaila
+ 0x62, 0x6c, 0x65, 0x4a, 0x61, 0x6e, 0x20, 0x46, // bleJan.F
+ 0x65, 0x62, 0x20, 0x4d, 0x61, 0x72, 0x20, 0x41, // eb.Mar.A
+ 0x70, 0x72, 0x20, 0x4d, 0x61, 0x79, 0x20, 0x4a, // pr.May.J
+ 0x75, 0x6e, 0x20, 0x4a, 0x75, 0x6c, 0x20, 0x41, // un.Jul.A
+ 0x75, 0x67, 0x20, 0x53, 0x65, 0x70, 0x74, 0x20, // ug.Sept.
+ 0x4f, 0x63, 0x74, 0x20, 0x4e, 0x6f, 0x76, 0x20, // Oct.Nov.
+ 0x44, 0x65, 0x63, 0x20, 0x30, 0x30, 0x3a, 0x30, // Dec.00.0
+ 0x30, 0x3a, 0x30, 0x30, 0x20, 0x4d, 0x6f, 0x6e, // 0.00.Mon
+ 0x2c, 0x20, 0x54, 0x75, 0x65, 0x2c, 0x20, 0x57, // ..Tue..W
+ 0x65, 0x64, 0x2c, 0x20, 0x54, 0x68, 0x75, 0x2c, // ed..Thu.
+ 0x20, 0x46, 0x72, 0x69, 0x2c, 0x20, 0x53, 0x61, // .Fri..Sa
+ 0x74, 0x2c, 0x20, 0x53, 0x75, 0x6e, 0x2c, 0x20, // t..Sun..
+ 0x47, 0x4d, 0x54, 0x63, 0x68, 0x75, 0x6e, 0x6b, // GMTchunk
+ 0x65, 0x64, 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, // ed.text.
+ 0x68, 0x74, 0x6d, 0x6c, 0x2c, 0x69, 0x6d, 0x61, // html.ima
+ 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0x2c, 0x69, // ge.png.i
+ 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x67, // mage.jpg
+ 0x2c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, // .image.g
+ 0x69, 0x66, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, // if.appli
+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, // cation.x
+ 0x6d, 0x6c, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, // ml.appli
+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, // cation.x
+ 0x68, 0x74, 0x6d, 0x6c, 0x2b, 0x78, 0x6d, 0x6c, // html.xml
+ 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, // .text.pl
+ 0x61, 0x69, 0x6e, 0x2c, 0x74, 0x65, 0x78, 0x74, // ain.text
+ 0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, // .javascr
+ 0x69, 0x70, 0x74, 0x2c, 0x70, 0x75, 0x62, 0x6c, // ipt.publ
+ 0x69, 0x63, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, // icprivat
+ 0x65, 0x6d, 0x61, 0x78, 0x2d, 0x61, 0x67, 0x65, // emax-age
+ 0x3d, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x64, 0x65, // .gzip.de
+ 0x66, 0x6c, 0x61, 0x74, 0x65, 0x2c, 0x73, 0x64, // flate.sd
+ 0x63, 0x68, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, // chcharse
+ 0x74, 0x3d, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x63, // t.utf-8c
+ 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x3d, 0x69, // harset.i
+ 0x73, 0x6f, 0x2d, 0x38, 0x38, 0x35, 0x39, 0x2d, // so-8859-
+ 0x31, 0x2c, 0x75, 0x74, 0x66, 0x2d, 0x2c, 0x2a, // 1.utf-..
+ 0x2c, 0x65, 0x6e, 0x71, 0x3d, 0x30, 0x2e // .enq.0.
+};
+
+// uncomment to debug
+//static void printHex(const QByteArray &ba)
+//{
+// QByteArray hex;
+// QByteArray clearText;
+// for (int a = 0; a < ba.count(); ++a) {
+// QByteArray currentHexChar = QByteArray(1, ba.at(a)).toHex().rightJustified(2, ' ');
+// QByteArray currentChar;
+// if (ba.at(a) >= 32 && ba.at(a) < 126) { // if ASCII, print the letter
+// currentChar = QByteArray(1, ba.at(a));
+// } else {
+// currentChar = " ";
+// }
+// clearText.append(currentChar.rightJustified(2, ' '));
+// hex.append(currentHexChar);
+// hex.append(' ');
+// clearText.append(' ');
+// }
+// int chunkSize = 102; // 12 == 4 bytes per line
+// for (int a = 0; a < hex.count(); a += chunkSize) {
+// qDebug() << hex.mid(a, chunkSize);
+// qDebug() << clearText.mid(a, chunkSize);
+// }
+//}
+
+QSpdyProtocolHandler::QSpdyProtocolHandler(QHttpNetworkConnectionChannel *channel)
+ : QObject(0), QAbstractProtocolHandler(channel),
+ m_nextStreamID(-1),
+ m_maxConcurrentStreams(100), // 100 is recommended in the SPDY RFC
+ m_initialWindowSize(0),
+ m_waitingForCompleteStream(false)
+{
+ m_inflateStream.zalloc = Z_NULL;
+ m_inflateStream.zfree = Z_NULL;
+ m_inflateStream.opaque = Z_NULL;
+ int zlibRet = inflateInit(&m_inflateStream);
+ Q_ASSERT(zlibRet == Z_OK);
+
+ m_deflateStream.zalloc = Z_NULL;
+ m_deflateStream.zfree = Z_NULL;
+ m_deflateStream.opaque = Z_NULL;
+
+ // Do actually not compress (i.e. compression level = 0)
+ // when sending the headers because of the CRIME attack
+ zlibRet = deflateInit(&m_deflateStream, /* compression level = */ 0);
+ Q_ASSERT(zlibRet == Z_OK);
+}
+
+QSpdyProtocolHandler::~QSpdyProtocolHandler()
+{
+ deflateEnd(&m_deflateStream);
+ deflateEnd(&m_inflateStream);
+}
+
+bool QSpdyProtocolHandler::sendRequest()
+{
+ Q_ASSERT(!m_reply);
+
+ int maxPossibleRequests = m_maxConcurrentStreams - m_inFlightStreams.count();
+ Q_ASSERT(maxPossibleRequests >= 0);
+ if (maxPossibleRequests == 0)
+ return true; // return early if max concurrent requests are exceeded
+
+ m_channel->state = QHttpNetworkConnectionChannel::WritingState;
+
+ // requests will be ordered by priority (see QMultiMap doc)
+ QList<HttpMessagePair> requests = m_channel->spdyRequestsToSend.values();
+ QList<int> priorities = m_channel->spdyRequestsToSend.keys();
+
+ int requestsToSend = qMin(requests.count(), maxPossibleRequests);
+
+ for (int a = 0; a < requestsToSend; ++a) {
+ HttpMessagePair currentPair = requests.at(a);
+ QHttpNetworkRequest currentRequest = requests.at(a).first;
+ QHttpNetworkReply *currentReply = requests.at(a).second;
+
+ currentReply->setSpdyWasUsed(true);
+ qint32 streamID = generateNextStreamID();
+
+ currentReply->setRequest(currentRequest);
+ currentReply->d_func()->connection = m_connection;
+ currentReply->d_func()->connectionChannel = m_channel;
+ m_inFlightStreams.insert(streamID, currentPair);
+
+ sendSYN_STREAM(currentPair, streamID, /* associatedToStreamID = */ 0);
+ int requestsRemoved = m_channel->spdyRequestsToSend.remove(
+ priorities.at(a), currentPair);
+ Q_ASSERT(requestsRemoved == 1);
+ Q_UNUSED(requestsRemoved); // silence -Wunused-variable
+ }
+ m_channel->state = QHttpNetworkConnectionChannel::IdleState;
+ return true;
+}
+
+void QSpdyProtocolHandler::_q_receiveReply()
+{
+ Q_ASSERT(m_socket);
+
+ // only run when the QHttpNetworkConnection is not currently being destructed, e.g.
+ // this function is called from _q_disconnected which is called because
+ // of ~QHttpNetworkConnectionPrivate
+ if (!qobject_cast<QHttpNetworkConnection*>(m_connection)) {
+ return;
+ }
+
+ if (bytesAvailable() < 8)
+ return; // cannot read frame headers, wait for more data
+
+ char frameHeadersRaw[8];
+ if (!readNextChunk(8, frameHeadersRaw))
+ return; // this should not happen, we just checked
+
+ const QByteArray frameHeaders(frameHeadersRaw, 8); // ### try without memcpy
+ if (frameHeadersRaw[0] & 0x80) {
+ handleControlFrame(frameHeaders);
+ } else {
+ handleDataFrame(frameHeaders);
+ }
+
+ // after handling the current frame, check whether there is more data waiting
+ if (m_socket->bytesAvailable() > 0)
+ QMetaObject::invokeMethod(m_channel, "_q_receiveReply", Qt::QueuedConnection);
+}
+
+void QSpdyProtocolHandler::_q_readyRead()
+{
+ _q_receiveReply();
+}
+
+static qint16 twoBytesToInt(const char *bytes)
+{
+ return qFromBigEndian<qint16>(reinterpret_cast<const uchar *>(bytes));
+}
+
+static qint32 threeBytesToInt(const char *bytes)
+{
+ return qFromBigEndian<qint32>(reinterpret_cast<const uchar *>(bytes)) >> 8;
+}
+
+static qint32 fourBytesToInt(const char *bytes)
+{
+ return qFromBigEndian<qint32>(reinterpret_cast<const uchar *>(bytes));
+}
+
+static void appendIntToThreeBytes(char *output, qint32 number)
+{
+ qToBigEndian<qint16>(number, reinterpret_cast<uchar *>(output + 1));
+ qToBigEndian<qint8>(number >> 16, reinterpret_cast<uchar *>(output));
+}
+
+static void appendIntToFourBytes(char *output, qint32 number)
+{
+ qToBigEndian<qint32>(number, reinterpret_cast<uchar *>(output));
+}
+
+static QByteArray intToFourBytes(qint32 number) // ### try to use appendIntToFourBytes where possible
+{
+ uchar data[4];
+ qToBigEndian<qint32>(number, data);
+ QByteArray ret(reinterpret_cast<char *>(data), 4);
+ return ret;
+}
+
+static QByteArray intToThreeBytes(qint32 number)
+{
+ uchar data[4];
+ qToBigEndian<qint32>(number << 8, data);
+ QByteArray ret(reinterpret_cast<char *>(data), 3);
+ return ret;
+}
+
+static qint32 getStreamID(const char *bytes)
+{
+ // eliminate most significant bit; it might be 0 or 1 depending on whether
+ // we are dealing with a control or data frame
+ return fourBytesToInt(bytes) & 0x3fffffff;
+}
+
+static QByteArray headerField(const QByteArray &name, const QByteArray &value)
+{
+ QByteArray ret;
+ ret.reserve(name.count() + value.count() + 8); // 4 byte for length each
+ ret.append(intToFourBytes(name.count()));
+ ret.append(name);
+ ret.append(intToFourBytes(value.count()));
+ ret.append(value);
+ return ret;
+}
+
+bool QSpdyProtocolHandler::uncompressHeader(const QByteArray &input, QByteArray *output)
+{
+ const size_t chunkSize = 1024;
+ char outputRaw[chunkSize];
+ // input bytes will not be changed by zlib, so it is safe to const_cast here
+ m_inflateStream.next_in = const_cast<Bytef *>(reinterpret_cast<const Bytef *>(input.constData()));
+ m_inflateStream.avail_in = input.count();
+ m_inflateStream.total_in = input.count();
+ int zlibRet;
+
+ do {
+ m_inflateStream.next_out = reinterpret_cast<Bytef *>(outputRaw);
+ m_inflateStream.avail_out = chunkSize;
+ zlibRet = inflate(&m_inflateStream, Z_SYNC_FLUSH);
+ if (zlibRet == Z_NEED_DICT) {
+ zlibRet = inflateSetDictionary(&m_inflateStream,
+ reinterpret_cast<const Bytef*>(spdyDictionary),
+ /* dictionaryLength = */ 1423);
+ Q_ASSERT(zlibRet == Z_OK);
+ continue;
+ }
+ switch (zlibRet) {
+ case Z_BUF_ERROR: {
+ if (m_inflateStream.avail_in == 0) {
+ int outputSize = chunkSize - m_inflateStream.avail_out;
+ output->append(outputRaw, outputSize);
+ m_inflateStream.avail_out = chunkSize;
+ }
+ break;
+ }
+ case Z_OK: {
+ int outputSize = chunkSize - m_inflateStream.avail_out;
+ output->append(outputRaw, outputSize);
+ break;
+ }
+ default: {
+ qWarning() << Q_FUNC_INFO << "got unexpected zlib return value:" << zlibRet;
+ return false;
+ }
+ }
+ } while (m_inflateStream.avail_in > 0 && zlibRet != Z_STREAM_END);
+
+ Q_ASSERT(m_inflateStream.avail_in == 0);
+ return true;
+}
+
+QByteArray QSpdyProtocolHandler::composeHeader(const QHttpNetworkRequest &request)
+{
+ QByteArray uncompressedHeader;
+ uncompressedHeader.reserve(300); // rough estimate
+
+ // calculate additional headers first, because we need to know the size
+ // ### do not partially copy the list, but restrict the set header fields
+ // in QHttpNetworkConnection
+ QList<QPair<QByteArray, QByteArray> > additionalHeaders;
+ for (int a = 0; a < request.header().count(); ++a) {
+ QByteArray key = request.header().at(a).first;
+ if (key == "Connection" || key == "Host" || key == "Keep-Alive"
+ || key == "Proxy-Connection" || key == "Transfer-Encoding")
+ continue; // those headers are not valid (section 3.2.1)
+ additionalHeaders.append(request.header().at(a));
+ }
+
+ qint32 numberOfHeaderPairs = 5 + additionalHeaders.count(); // 5 mandatory below + the additional ones
+ uncompressedHeader.append(intToFourBytes(numberOfHeaderPairs));
+
+ // mandatory header fields:
+
+ uncompressedHeader.append(headerField(":method", request.methodName()));
+#ifndef QT_NO_NETWORKPROXY
+ bool useProxy = m_connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy;
+ uncompressedHeader.append(headerField(":path", request.uri(useProxy)));
+#else
+ uncompressedHeader.append(headerField(":path", request.uri(false)));
+#endif
+ uncompressedHeader.append(headerField(":version", "HTTP/1.1"));
+
+ QHostAddress add; // ### unify with the host parsing from QHttpNetworkConnection
+ QByteArray host;
+ QString hostName = m_connection->hostName();
+ if (add.setAddress(hostName)) {
+ if (add.protocol() == QAbstractSocket::IPv6Protocol)
+ host = "[" + hostName.toLatin1() + "]"; //format the ipv6 in the standard way
+ else
+ host = hostName.toLatin1();
+
+ } else {
+ host = QUrl::toAce(hostName);
+ }
+
+ int port = request.url().port();
+ if (port != -1) {
+ host += ':';
+ host += QByteArray::number(port);
+ }
+ uncompressedHeader.append(headerField(":host", host));
+
+ uncompressedHeader.append(headerField(":scheme", request.url().scheme().toLatin1()));
+
+ // end of mandatory header fields
+
+ // now add the additional headers
+ for (int a = 0; a < additionalHeaders.count(); ++a) {
+ uncompressedHeader.append(headerField(additionalHeaders.at(a).first.toLower(),
+ additionalHeaders.at(a).second));
+ }
+
+ m_deflateStream.total_in = uncompressedHeader.count();
+ m_deflateStream.avail_in = uncompressedHeader.count();
+ m_deflateStream.next_in = reinterpret_cast<unsigned char *>(uncompressedHeader.data());
+ int outputBytes = uncompressedHeader.count() + 30; // 30 bytes of compression header overhead
+ m_deflateStream.avail_out = outputBytes;
+ unsigned char *out = new unsigned char[outputBytes];
+ m_deflateStream.next_out = out;
+ int availOutBefore = m_deflateStream.avail_out;
+ int zlibRet = deflate(&m_deflateStream, Z_SYNC_FLUSH); // do everything in one go since we use no compression
+ int compressedHeaderSize = availOutBefore - m_deflateStream.avail_out;
+ Q_ASSERT(zlibRet == Z_OK); // otherwise, we need to allocate more outputBytes
+ Q_UNUSED(zlibRet); // silence -Wunused-variable
+ Q_ASSERT(m_deflateStream.avail_in == 0);
+ QByteArray compressedHeader(reinterpret_cast<char *>(out), compressedHeaderSize);
+ delete[] out;
+
+ return compressedHeader;
+}
+
+quint64 QSpdyProtocolHandler::bytesAvailable() const
+{
+ Q_ASSERT(m_socket);
+ return m_spdyBuffer.byteAmount() + m_socket->bytesAvailable();
+}
+
+bool QSpdyProtocolHandler::readNextChunk(qint64 length, char *sink)
+{
+ qint64 expectedReadBytes = length;
+ qint64 requiredBytesFromBuffer = 0;
+
+ if (m_waitingForCompleteStream) {
+ requiredBytesFromBuffer = qMin(length, m_spdyBuffer.byteAmount());
+ // ### if next chunk from buffer bigger than what we want to read,
+ // we have to call read() (which memcpy's). Otherwise, we can just
+ // read the next chunk without memcpy'ing.
+ qint64 bytesReadFromBuffer = m_spdyBuffer.read(sink, requiredBytesFromBuffer);
+ Q_ASSERT(bytesReadFromBuffer == requiredBytesFromBuffer);
+ if (length <= bytesReadFromBuffer) {
+ return true; // buffer > required size -> no need to read from socket
+ }
+ expectedReadBytes -= requiredBytesFromBuffer;
+ }
+ qint64 readBytes = m_socket->read(sink + requiredBytesFromBuffer, expectedReadBytes);
+
+ if (readBytes < expectedReadBytes) {
+ m_waitingForCompleteStream = true;
+ // ### this is inefficient, we should not put back so much data into the buffer
+ QByteArray temp(sink, requiredBytesFromBuffer + readBytes);
+ m_spdyBuffer.append(temp);
+ return false;
+ } else {
+ return true; // buffer must be cleared by calling function
+ }
+}
+
+void QSpdyProtocolHandler::sendControlFrame(FrameType type,
+ ControlFrameFlags flags,
+ const char *data,
+ quint32 length)
+{
+ // frame type and stream ID
+ char header[8];
+ header[0] = 0x80; // leftmost bit == 1 -> is a control frame
+ header[1] = 0x03; // 3 bit == version 3
+ header[2] = 0;
+ switch (type) {
+ case FrameType_CREDENTIAL: {
+ qWarning("sending SPDY CREDENTIAL frame is not yet implemented"); // QTBUG-36188
+ return;
+ }
+ default:
+ header[3] = type;
+ }
+
+ // flags
+ header[4] = 0;
+ if (flags & ControlFrame_FLAG_FIN || length == 0) {
+ Q_ASSERT(type == FrameType_SYN_STREAM || type == FrameType_SYN_REPLY
+ || type == FrameType_HEADERS || length == 0);
+ header[4] |= ControlFrame_FLAG_FIN;
+ }
+ if (flags & ControlFrame_FLAG_UNIDIRECTIONAL) {
+ Q_ASSERT(type == FrameType_SYN_STREAM);
+ header[4] |= ControlFrame_FLAG_UNIDIRECTIONAL;
+ }
+
+ // length
+ appendIntToThreeBytes(header + 5, length);
+
+ qint64 written = m_socket->write(header, 8);
+ Q_ASSERT(written == 8);
+ written = m_socket->write(data, length);
+ Q_ASSERT(written == length);
+}
+
+void QSpdyProtocolHandler::sendSYN_STREAM(HttpMessagePair messagePair,
+ qint32 streamID, qint32 associatedToStreamID)
+{
+ QHttpNetworkRequest request = messagePair.first;
+ QHttpNetworkReply *reply = messagePair.second;
+
+ ControlFrameFlags flags = 0;
+
+ if (!request.uploadByteDevice()) {
+ // no upload -> this is the last frame, send the FIN flag
+ flags |= ControlFrame_FLAG_FIN;
+ reply->d_func()->state = QHttpNetworkReplyPrivate::SPDYHalfClosed;
+ } else {
+ reply->d_func()->state = QHttpNetworkReplyPrivate::SPDYUploading;
+
+ // hack: set the stream ID on the device directly, so when we get
+ // the signal for uploading we know which stream we are sending on
+ request.uploadByteDevice()->setProperty("SPDYStreamID", streamID);
+
+ QObject::connect(request.uploadByteDevice(), SIGNAL(readyRead()), this,
+ SLOT(_q_uploadDataReadyRead()), Qt::QueuedConnection);
+ }
+
+ QByteArray namesAndValues = composeHeader(request);
+ quint32 length = namesAndValues.count() + 10; // 10 == 4 for Stream-ID + 4 for Associated-To-Stream-ID
+ // + 2 for Priority, Unused and Slot
+
+ QByteArray wireData;
+ wireData.reserve(length);
+ wireData.append(intToFourBytes(streamID));
+ wireData.append(intToFourBytes(associatedToStreamID));
+
+ // priority (3 bits) / unused (5 bits) / slot (8 bits)
+ char prioAndSlot[2];
+ switch (request.priority()) {
+ case QHttpNetworkRequest::HighPriority:
+ prioAndSlot[0] = 0x00; // == prio 0 (highest)
+ break;
+ case QHttpNetworkRequest::NormalPriority:
+ prioAndSlot[0] = 0x80; // == prio 4
+ break;
+ case QHttpNetworkRequest::LowPriority:
+ prioAndSlot[0] = 0xe0; // == prio 7 (lowest)
+ break;
+ }
+ prioAndSlot[1] = 0x00; // slot in client certificates (not supported currently)
+ wireData.append(prioAndSlot, 2);
+
+ wireData.append(namesAndValues);
+
+ sendControlFrame(FrameType_SYN_STREAM, flags, wireData.constData(), length);
+
+ if (reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYUploading)
+ uploadData(streamID);
+}
+
+void QSpdyProtocolHandler::sendRST_STREAM(qint32 streamID, RST_STREAM_STATUS_CODE statusCode)
+{
+ char wireData[8];
+ appendIntToFourBytes(wireData, streamID);
+ appendIntToFourBytes(wireData + 4, statusCode);
+ sendControlFrame(FrameType_RST_STREAM, /* flags = */ 0, wireData, /* length = */ 8);
+}
+
+void QSpdyProtocolHandler::sendPING(quint32 pingID)
+{
+ char rawData[4];
+ appendIntToFourBytes(rawData, pingID);
+ sendControlFrame(FrameType_PING, /* flags = */ 0, rawData, /* length = */ 4);
+}
+
+bool QSpdyProtocolHandler::uploadData(qint32 streamID)
+{
+ // we only rely on SPDY flow control here and don't care about TCP buffers
+
+ HttpMessagePair messagePair = m_inFlightStreams.value(streamID);
+ QHttpNetworkRequest request = messagePair.first;
+ QHttpNetworkReply *reply = messagePair.second;
+ Q_ASSERT(reply);
+ QHttpNetworkReplyPrivate *replyPrivate = reply->d_func();
+ Q_ASSERT(replyPrivate);
+
+ qint32 dataLeftInWindow = replyPrivate->windowSizeUpload
+ - replyPrivate->currentlyUploadedDataInWindow;
+
+ while (dataLeftInWindow > 0 && !request.uploadByteDevice()->atEnd()) {
+
+ // get pointer to upload data
+ qint64 currentReadSize = 0;
+ const char *readPointer = request.uploadByteDevice()->readPointer(dataLeftInWindow,
+ currentReadSize);
+
+ if (currentReadSize == -1) {
+ // premature eof happened
+ m_connection->d_func()->emitReplyError(m_socket, reply,
+ QNetworkReply::UnknownNetworkError);
+ return false;
+ } else if (readPointer == 0 || currentReadSize == 0) {
+ // nothing to read currently, break the loop
+ break;
+ } else {
+ DataFrameFlags flags = 0;
+ // we will send the FIN flag later if appropriate
+ qint64 currentWriteSize = sendDataFrame(streamID, flags, currentReadSize, readPointer);
+ if (currentWriteSize == -1 || currentWriteSize != currentReadSize) {
+ // socket broke down
+ m_connection->d_func()->emitReplyError(m_socket, reply,
+ QNetworkReply::UnknownNetworkError);
+ return false;
+ } else {
+ replyPrivate->currentlyUploadedDataInWindow += currentWriteSize;
+ replyPrivate->totallyUploadedData += currentWriteSize;
+ dataLeftInWindow = replyPrivate->windowSizeUpload
+ - replyPrivate->currentlyUploadedDataInWindow;
+ request.uploadByteDevice()->advanceReadPointer(currentWriteSize);
+
+ emit reply->dataSendProgress(replyPrivate->totallyUploadedData,
+ request.contentLength());
+ }
+ }
+ }
+ if (replyPrivate->totallyUploadedData == request.contentLength()) {
+ DataFrameFlags finFlag = DataFrame_FLAG_FIN;
+ qint64 writeSize = sendDataFrame(streamID, finFlag, 0, 0);
+ Q_ASSERT(writeSize == 0);
+ Q_UNUSED(writeSize); // silence -Wunused-variable
+ replyPrivate->state = QHttpNetworkReplyPrivate::SPDYHalfClosed;
+ // ### this will not work if the content length is not known, but
+ // then again many servers will fail in this case anyhow according
+ // to the SPDY RFC
+ }
+ return true;
+}
+
+void QSpdyProtocolHandler::_q_uploadDataReadyRead()
+{
+ QNonContiguousByteDevice *device = qobject_cast<QNonContiguousByteDevice *>(sender());
+ Q_ASSERT(device);
+ qint32 streamID = device->property("SPDYStreamID").toInt();
+ Q_ASSERT(streamID > 0);
+ uploadData(streamID);
+}
+
+void QSpdyProtocolHandler::sendWINDOW_UPDATE(qint32 streamID, quint32 deltaWindowSize)
+{
+ char windowUpdateData[8];
+ appendIntToFourBytes(windowUpdateData, streamID);
+ appendIntToFourBytes(windowUpdateData + 4, deltaWindowSize);
+
+ sendControlFrame(FrameType_WINDOW_UPDATE, /* flags = */ 0, windowUpdateData, /* length = */ 8);
+}
+
+qint64 QSpdyProtocolHandler::sendDataFrame(qint32 streamID, DataFrameFlags flags,
+ quint32 length, const char *data)
+{
+ QByteArray wireData;
+ wireData.reserve(8);
+
+ wireData.append(intToFourBytes(streamID));
+ wireData.append(flags);
+ wireData.append(intToThreeBytes(length));
+
+ Q_ASSERT(m_socket);
+ m_socket->write(wireData);
+
+ if (data) {
+ qint64 ret = m_socket->write(data, length);
+ return ret;
+ } else {
+ return 0; // nothing to write, e.g. FIN flag
+ }
+}
+
+void QSpdyProtocolHandler::handleControlFrame(const QByteArray &frameHeaders) // ### make it char *
+{
+ Q_ASSERT(frameHeaders.count() >= 8);
+ qint16 version = twoBytesToInt(frameHeaders.constData());
+ version &= 0x3fff; // eliminate most significant bit to determine version
+ Q_ASSERT(version == 3);
+
+ qint16 type = twoBytesToInt(frameHeaders.constData() + 2);
+
+ char flags = frameHeaders.at(4);
+ qint32 length = threeBytesToInt(frameHeaders.constData() + 5);
+ Q_ASSERT(length > 0);
+
+ QByteArray frameData;
+ frameData.resize(length);
+ if (!readNextChunk(length, frameData.data())) {
+ // put back the frame headers to the buffer
+ m_spdyBuffer.prepend(frameHeaders);
+ return; // we couldn't read the whole frame and need to wait
+ } else {
+ m_spdyBuffer.clear();
+ m_waitingForCompleteStream = false;
+ }
+
+ switch (type) {
+ case FrameType_SYN_STREAM: {
+ handleSYN_STREAM(flags, length, frameData);
+ break;
+ }
+ case FrameType_SYN_REPLY: {
+ handleSYN_REPLY(flags, length, frameData);
+ break;
+ }
+ case FrameType_RST_STREAM: {
+ handleRST_STREAM(flags, length, frameData);
+ break;
+ }
+ case FrameType_SETTINGS: {
+ handleSETTINGS(flags, length, frameData);
+ break;
+ }
+ case FrameType_PING: {
+ handlePING(flags, length, frameData);
+ break;
+ }
+ case FrameType_GOAWAY: {
+ handleGOAWAY(flags, length, frameData);
+ break;
+ }
+ case FrameType_HEADERS: {
+ handleHEADERS(flags, length, frameData);
+ break;
+ }
+ case FrameType_WINDOW_UPDATE: {
+ handleWINDOW_UPDATE(flags, length, frameData);
+ break;
+ }
+ default:
+ qWarning() << Q_FUNC_INFO << "cannot handle frame of type" << type;
+ }
+}
+
+void QSpdyProtocolHandler::handleSYN_STREAM(char /*flags*/, quint32 /*length*/,
+ const QByteArray &frameData)
+{
+ // not implemented; will be implemented when servers start using it
+ // we just tell the server that we do not accept that
+
+ qint32 streamID = getStreamID(frameData.constData());
+
+ sendRST_STREAM(streamID, RST_STREAM_REFUSED_STREAM);
+}
+
+void QSpdyProtocolHandler::handleSYN_REPLY(char flags, quint32 /*length*/, const QByteArray &frameData)
+{
+ parseHttpHeaders(flags, frameData);
+}
+
+void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameData)
+{
+ qint32 streamID = getStreamID(frameData.constData());
+
+ flags &= 0x3f;
+ bool flag_fin = flags & 0x01;
+
+ QByteArray headerValuePairs = frameData.mid(4);
+
+ HttpMessagePair pair = m_inFlightStreams.value(streamID);
+ QHttpNetworkReply *httpReply = pair.second;
+ Q_ASSERT(httpReply != 0);
+
+ QByteArray uncompressedHeader;
+ if (!uncompressHeader(headerValuePairs, &uncompressedHeader)) {
+ qWarning() << Q_FUNC_INFO << "error reading header from SYN_REPLY message";
+ return;
+ }
+
+ qint32 headerCount = fourBytesToInt(uncompressedHeader.constData());
+ qint32 readPointer = 4;
+ for (qint32 a = 0; a < headerCount; ++a) {
+ qint32 count = fourBytesToInt(uncompressedHeader.constData() + readPointer);
+ readPointer += 4;
+ QByteArray name = uncompressedHeader.mid(readPointer, count);
+ readPointer += count;
+ count = fourBytesToInt(uncompressedHeader.constData() + readPointer);
+ readPointer += 4;
+ QByteArray value = uncompressedHeader.mid(readPointer, count);
+ readPointer += count;
+ if (name == ":status") {
+ httpReply->setStatusCode(value.left(3).toInt());
+ httpReply->d_func()->reasonPhrase = QString::fromLatin1(value.mid(4));
+ } else if (name == ":version") {
+ int majorVersion = value.at(5) - 48;
+ int minorVersion = value.at(7) - 48;
+ httpReply->d_func()->majorVersion = majorVersion;
+ httpReply->d_func()->minorVersion = minorVersion;
+ } else if (name == "content-length") {
+ httpReply->setContentLength(value.toLongLong());
+ } else {
+ if (value.contains('\0')) {
+ QList<QByteArray> values = value.split('\0');
+ QByteArray binder(", ");
+ if (name == "set-cookie")
+ binder = "\n";
+ value.clear();
+ Q_FOREACH (const QByteArray& ivalue, values) {
+ if (value.isEmpty())
+ value = ivalue;
+ else
+ value += binder + ivalue;
+ }
+ }
+ httpReply->setHeaderField(name, value);
+ }
+ }
+ emit httpReply->headerChanged();
+
+ if (flag_fin) {
+ switch (httpReply->d_func()->state) {
+ case QHttpNetworkReplyPrivate::SPDYSYNSent:
+ httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYHalfClosed;
+ break;
+ case QHttpNetworkReplyPrivate::SPDYHalfClosed:
+ replyFinished(httpReply, streamID);
+ break;
+ case QHttpNetworkReplyPrivate::SPDYClosed: {
+ sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR);
+ replyFinishedWithError(httpReply, streamID, QNetworkReply::ProtocolFailure,
+ "server sent SYN_REPLY on an already closed stream");
+ break;
+ }
+ default:
+ qWarning() << Q_FUNC_INFO << "got data frame in unknown state";
+ }
+ }
+}
+
+void QSpdyProtocolHandler::handleRST_STREAM(char /*flags*/, quint32 length,
+ const QByteArray &frameData)
+{
+ // flags are ignored
+
+ Q_ASSERT(length == 8);
+ Q_UNUSED(length); // silence -Wunused-parameter
+ qint32 streamID = getStreamID(frameData.constData());
+ QHttpNetworkReply *httpReply = m_inFlightStreams.value(streamID).second;
+
+ qint32 statusCodeInt = fourBytesToInt(frameData.constData() + 4);
+ RST_STREAM_STATUS_CODE statusCode = static_cast<RST_STREAM_STATUS_CODE>(statusCodeInt);
+ QNetworkReply::NetworkError errorCode;
+ QByteArray errorMessage;
+
+ switch (statusCode) {
+ case RST_STREAM_PROTOCOL_ERROR:
+ errorCode = QNetworkReply::ProtocolFailure;
+ errorMessage = "SPDY protocol error";
+ break;
+ case RST_STREAM_INVALID_STREAM:
+ errorCode = QNetworkReply::ProtocolFailure;
+ errorMessage = "SPDY stream is not active";
+ break;
+ case RST_STREAM_REFUSED_STREAM:
+ errorCode = QNetworkReply::ProtocolFailure;
+ errorMessage = "SPDY stream was refused";
+ break;
+ case RST_STREAM_UNSUPPORTED_VERSION:
+ errorCode = QNetworkReply::ProtocolUnknownError;
+ errorMessage = "SPDY version is unknown to the server";
+ break;
+ case RST_STREAM_CANCEL:
+ errorCode = QNetworkReply::ProtocolFailure;
+ errorMessage = "SPDY stream is no longer needed";
+ break;
+ case RST_STREAM_INTERNAL_ERROR:
+ errorCode = QNetworkReply::InternalServerError;
+ errorMessage = "Internal server error";
+ break;
+ case RST_STREAM_FLOW_CONTROL_ERROR:
+ errorCode = QNetworkReply::ProtocolFailure;
+ errorMessage = "peer violated the flow control protocol";
+ break;
+ case RST_STREAM_STREAM_IN_USE:
+ errorCode = QNetworkReply::ProtocolFailure;
+ errorMessage = "server received a SYN_REPLY for an already open stream";
+ break;
+ case RST_STREAM_STREAM_ALREADY_CLOSED:
+ errorCode = QNetworkReply::ProtocolFailure;
+ errorMessage = "server received data or a SYN_REPLY for an already half-closed stream";
+ break;
+ case RST_STREAM_INVALID_CREDENTIALS:
+ errorCode = QNetworkReply::ContentAccessDenied;
+ errorMessage = "server received invalid credentials";
+ break;
+ case RST_STREAM_FRAME_TOO_LARGE:
+ errorCode = QNetworkReply::ProtocolFailure;
+ errorMessage = "server cannot process the frame because it is too large";
+ break;
+ default:
+ qWarning() << Q_FUNC_INFO << "could not understand servers RST_STREAM status code";
+ errorCode = QNetworkReply::ProtocolFailure;
+ errorMessage = "got SPDY RST_STREAM message with unknown error code";
+ }
+ if (httpReply)
+ replyFinishedWithError(httpReply, streamID, errorCode, errorMessage.constData());
+}
+
+void QSpdyProtocolHandler::handleSETTINGS(char flags, quint32 /*length*/, const QByteArray &frameData)
+{
+ Q_ASSERT(frameData.count() > 0);
+
+ SETTINGS_Flags settingsFlags = static_cast<SETTINGS_Flags>(flags);
+ if (settingsFlags & FLAG_SETTINGS_CLEAR_SETTINGS) {
+ // ### clear all persistent settings; since we do not persist settings
+ // as of now, we don't need to clear anything either
+ }
+
+ qint32 numberOfEntries = fourBytesToInt(frameData.constData());
+ Q_ASSERT(numberOfEntries > 0);
+ for (int a = 0, frameDataIndex = 4; a < numberOfEntries; ++a, frameDataIndex += 8) {
+ SETTINGS_ID_Flag idFlag = static_cast<SETTINGS_ID_Flag>(frameData[frameDataIndex]);
+ if (idFlag & FLAG_SETTINGS_PERSIST_VALUE) {
+ // ### we SHOULD persist the settings here according to the RFC, but we don't have to,
+ // so implement that later
+ } // the other value is only sent by us, but not received
+
+ quint32 uniqueID = static_cast<SETTINGS_ID>(
+ threeBytesToInt(frameData.constData() + frameDataIndex + 1));
+ quint32 value = fourBytesToInt(frameData.constData() + frameDataIndex + 4);
+ switch (uniqueID) {
+ case SETTINGS_UPLOAD_BANDWIDTH: {
+ // ignored for now, just an estimated informative value
+ break;
+ }
+ case SETTINGS_DOWNLOAD_BANDWIDTH: {
+ // ignored for now, just an estimated informative value
+ break;
+ }
+ case SETTINGS_ROUND_TRIP_TIME: {
+ // ignored for now, just an estimated informative value
+ break;
+ }
+ case SETTINGS_MAX_CONCURRENT_STREAMS: {
+ m_maxConcurrentStreams = value;
+ break;
+ }
+ case SETTINGS_CURRENT_CWND: {
+ // ignored for now, just an informative value
+ break;
+ }
+ case SETTINGS_DOWNLOAD_RETRANS_RATE: {
+ // ignored for now, just an estimated informative value
+ break;
+ }
+ case SETTINGS_INITIAL_WINDOW_SIZE: {
+ m_initialWindowSize = value;
+ break;
+ }
+ case SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE: {
+ // client certificates are not supported
+ break;
+ }
+ default:
+ qWarning() << Q_FUNC_INFO << "found unknown settings value" << value;
+ }
+ }
+}
+
+void QSpdyProtocolHandler::handlePING(char /*flags*/, quint32 length, const QByteArray &frameData)
+{
+ // flags are ignored
+
+ Q_ASSERT(length == 4);
+ Q_UNUSED(length); // silence -Wunused-parameter
+ quint32 pingID = fourBytesToInt(frameData.constData());
+
+ // odd numbered IDs must be ignored
+ if ((pingID & 1) == 0) // is even?
+ sendPING(pingID);
+}
+
+void QSpdyProtocolHandler::handleGOAWAY(char /*flags*/, quint32 /*length*/,
+ const QByteArray &frameData)
+{
+ // flags are ignored
+
+ qint32 statusCode = static_cast<GOAWAY_STATUS>(fourBytesToInt(frameData.constData() + 4));
+ QNetworkReply::NetworkError errorCode;
+ switch (statusCode) {
+ case GOAWAY_OK: {
+ errorCode = QNetworkReply::NoError;
+ break;
+ }
+ case GOAWAY_PROTOCOL_ERROR: {
+ errorCode = QNetworkReply::ProtocolFailure;
+ break;
+ }
+ case GOAWAY_INTERNAL_ERROR: {
+ errorCode = QNetworkReply::InternalServerError;
+ break;
+ }
+ default:
+ qWarning() << Q_FUNC_INFO << "unexpected status code" << statusCode;
+ errorCode = QNetworkReply::ProtocolUnknownError;
+ }
+
+ qint32 lastGoodStreamID = getStreamID(frameData.constData());
+
+ // emit errors for all replies after the last good stream ID
+ Q_ASSERT(m_connection);
+ for (qint32 currentStreamID = lastGoodStreamID + 2; currentStreamID <= m_nextStreamID;
+ ++currentStreamID) {
+ QHttpNetworkReply *reply = m_inFlightStreams.value(currentStreamID).second;
+ Q_ASSERT(reply);
+ m_connection->d_func()->emitReplyError(m_socket, reply, errorCode);
+ }
+ // ### we could make sure a new session is initiated anyhow
+}
+
+void QSpdyProtocolHandler::handleHEADERS(char flags, quint32 /*length*/,
+ const QByteArray &frameData)
+{
+ parseHttpHeaders(flags, frameData);
+}
+
+void QSpdyProtocolHandler::handleWINDOW_UPDATE(char /*flags*/, quint32 /*length*/,
+ const QByteArray &frameData)
+{
+ qint32 streamID = getStreamID(frameData.constData());
+ qint32 deltaWindowSize = fourBytesToInt(frameData.constData() + 4);
+
+ QHttpNetworkReply *reply = m_inFlightStreams.value(streamID).second;
+ Q_ASSERT(reply);
+ QHttpNetworkReplyPrivate *replyPrivate = reply->d_func();
+ Q_ASSERT(replyPrivate);
+
+ replyPrivate->currentlyUploadedDataInWindow = replyPrivate->windowSizeUpload - deltaWindowSize;
+ uploadData(streamID); // we hopefully can continue to upload
+}
+
+
+void QSpdyProtocolHandler::handleDataFrame(const QByteArray &frameHeaders)
+{
+ Q_ASSERT(frameHeaders.count() >= 8);
+
+ qint32 streamID = getStreamID(frameHeaders.constData());
+ unsigned char flags = static_cast<unsigned char>(frameHeaders.at(4));
+ flags &= 0x3f;
+ bool flag_fin = flags & 0x01;
+ bool flag_compress = flags & 0x02;
+ qint32 length = threeBytesToInt(frameHeaders.constData() + 5);
+
+ QByteArray data;
+ data.resize(length);
+ if (!readNextChunk(length, data.data())) {
+ // put back the frame headers to the buffer
+ m_spdyBuffer.prepend(frameHeaders);
+ return; // we couldn't read the whole frame and need to wait
+ } else {
+ m_spdyBuffer.clear();
+ m_waitingForCompleteStream = false;
+ }
+
+ HttpMessagePair pair = m_inFlightStreams.value(streamID);
+ QHttpNetworkRequest httpRequest = pair.first;
+ QHttpNetworkReply *httpReply = pair.second;
+ Q_ASSERT(httpReply != 0);
+
+ QHttpNetworkReplyPrivate *replyPrivate = httpReply->d_func();
+
+ // check whether we need to send WINDOW_UPDATE (i.e. tell the sender it can send more)
+ replyPrivate->currentlyReceivedDataInWindow += length;
+ qint32 dataLeftInWindow = replyPrivate->windowSizeDownload - replyPrivate->currentlyReceivedDataInWindow;
+
+ if (replyPrivate->currentlyReceivedDataInWindow > 0
+ && dataLeftInWindow < replyPrivate->windowSizeDownload / 2) {
+
+ // socket read buffer size is 64K actually, hard coded in the channel
+ // We can read way more than 64K per socket, because the window size
+ // here is per stream.
+ if (replyPrivate->windowSizeDownload >= m_socket->readBufferSize()) {
+ replyPrivate->windowSizeDownload = m_socket->readBufferSize();
+ } else {
+ replyPrivate->windowSizeDownload *= 1.5;
+ }
+ QMetaObject::invokeMethod(this, "sendWINDOW_UPDATE", Qt::QueuedConnection,
+ Q_ARG(qint32, streamID),
+ Q_ARG(quint32, replyPrivate->windowSizeDownload));
+ // setting the current data count to 0 is a race condition,
+ // because we call sendWINDOW_UPDATE through the event loop.
+ // But then again, the whole situation is a race condition because
+ // we don't know when the packet will arrive at the server; so
+ // this is most likely good enough here.
+ replyPrivate->currentlyReceivedDataInWindow = 0;
+ }
+
+ httpReply->d_func()->compressedData.append(data);
+
+
+ replyPrivate->totalProgress += length;
+
+ if (httpRequest.d->autoDecompress && httpReply->d_func()->isCompressed()) {
+ QByteDataBuffer inDataBuffer; // ### should we introduce one in the http reply?
+ inDataBuffer.append(data);
+ qint64 compressedCount = httpReply->d_func()->uncompressBodyData(&inDataBuffer,
+ &replyPrivate->responseData);
+ Q_ASSERT(compressedCount >= 0);
+ Q_UNUSED(compressedCount); // silence -Wunused-variable
+ } else {
+ replyPrivate->responseData.append(data);
+ }
+
+ if (replyPrivate->shouldEmitSignals()) {
+ emit httpReply->readyRead();
+ emit httpReply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength);
+ }
+
+ if (flag_compress) {
+ qWarning() << Q_FUNC_INFO << "SPDY level compression is not supported";
+ }
+
+ if (flag_fin) {
+ switch (httpReply->d_func()->state) {
+ case QHttpNetworkReplyPrivate::SPDYSYNSent:
+ httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYHalfClosed;
+ // ### send FIN ourselves?
+ break;
+ case QHttpNetworkReplyPrivate::SPDYHalfClosed:
+ replyFinished(httpReply, streamID);
+ break;
+ case QHttpNetworkReplyPrivate::SPDYClosed: {
+ sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR);
+ replyFinishedWithError(httpReply, streamID, QNetworkReply::ProtocolFailure,
+ "server sent data on an already closed stream");
+ break;
+ }
+ default:
+ qWarning() << Q_FUNC_INFO << "got data frame in unknown state";
+ }
+ }
+}
+
+void QSpdyProtocolHandler::replyFinished(QHttpNetworkReply *httpReply, qint32 streamID)
+{
+ httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYClosed;
+ int streamsRemoved = m_inFlightStreams.remove(streamID);
+ Q_ASSERT(streamsRemoved == 1);
+ Q_UNUSED(streamsRemoved); // silence -Wunused-variable
+ emit httpReply->finished();
+}
+
+void QSpdyProtocolHandler::replyFinishedWithError(QHttpNetworkReply *httpReply, qint32 streamID,
+ QNetworkReply::NetworkError errorCode, const char *errorMessage)
+{
+ Q_ASSERT(httpReply);
+ httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYClosed;
+ int streamsRemoved = m_inFlightStreams.remove(streamID);
+ Q_ASSERT(streamsRemoved == 1);
+ Q_UNUSED(streamsRemoved); // silence -Wunused-variable
+ emit httpReply->finishedWithError(errorCode, QSpdyProtocolHandler::tr(errorMessage));
+}
+
+qint32 QSpdyProtocolHandler::generateNextStreamID()
+{
+ // stream IDs initiated by the client must be odd
+ m_nextStreamID += 2;
+ return m_nextStreamID;
+}
+
+QT_END_NAMESPACE
+
+#endif // !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
diff --git a/src/network/access/qspdyprotocolhandler_p.h b/src/network/access/qspdyprotocolhandler_p.h
new file mode 100644
index 0000000000..8cbfbdda86
--- /dev/null
+++ b/src/network/access/qspdyprotocolhandler_p.h
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSPDYPROTOCOLHANDLER_H
+#define QSPDYPROTOCOLHANDLER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the Network Access API. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qabstractprotocolhandler_p.h>
+#include <QtNetwork/qnetworkreply.h>
+#include <private/qbytedata_p.h>
+
+#include <zlib.h>
+
+#if !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+
+QT_BEGIN_NAMESPACE
+
+class QHttpNetworkRequest;
+
+#ifndef HttpMessagePair
+typedef QPair<QHttpNetworkRequest, QHttpNetworkReply*> HttpMessagePair;
+#endif
+
+class QSpdyProtocolHandler : public QObject, public QAbstractProtocolHandler {
+ Q_OBJECT
+public:
+ QSpdyProtocolHandler(QHttpNetworkConnectionChannel *channel);
+ ~QSpdyProtocolHandler();
+
+ enum DataFrameFlag {
+ DataFrame_FLAG_FIN = 0x01,
+ DataFrame_FLAG_COMPRESS = 0x02
+ };
+
+ Q_DECLARE_FLAGS(DataFrameFlags, DataFrameFlag)
+
+ enum ControlFrameFlag {
+ ControlFrame_FLAG_FIN = 0x01,
+ ControlFrame_FLAG_UNIDIRECTIONAL = 0x02
+ };
+
+ Q_DECLARE_FLAGS(ControlFrameFlags, ControlFrameFlag)
+
+ enum SETTINGS_Flag {
+ FLAG_SETTINGS_CLEAR_SETTINGS = 0x01
+ };
+
+ Q_DECLARE_FLAGS(SETTINGS_Flags, SETTINGS_Flag)
+
+ enum SETTINGS_ID_Flag {
+ FLAG_SETTINGS_PERSIST_VALUE = 0x01,
+ FLAG_SETTINGS_PERSISTED = 0x02
+ };
+
+ Q_DECLARE_FLAGS(SETTINGS_ID_Flags, SETTINGS_ID_Flag)
+
+ virtual void _q_receiveReply() Q_DECL_OVERRIDE;
+ virtual void _q_readyRead() Q_DECL_OVERRIDE;
+ virtual bool sendRequest() Q_DECL_OVERRIDE;
+
+private slots:
+ void _q_uploadDataReadyRead();
+
+private:
+
+ enum FrameType {
+ FrameType_SYN_STREAM = 1,
+ FrameType_SYN_REPLY = 2,
+ FrameType_RST_STREAM = 3,
+ FrameType_SETTINGS = 4,
+ FrameType_PING = 6,
+ FrameType_GOAWAY = 7,
+ FrameType_HEADERS = 8,
+ FrameType_WINDOW_UPDATE = 9,
+ FrameType_CREDENTIAL // has a special type
+ };
+
+ enum StatusCode {
+ StatusCode_PROTOCOL_ERROR = 1,
+ StatusCode_INVALID_STREAM = 2,
+ StatusCode_REFUSED_STREAM = 3,
+ StatusCode_UNSUPPORTED_VERSION = 4,
+ StatusCode_CANCEL = 5,
+ StatusCode_INTERNAL_ERROR = 6,
+ StatusCode_FLOW_CONTROL_ERROR = 7,
+ StatusCode_STREAM_IN_USE = 8,
+ StatusCode_STREAM_ALREADY_CLOSED = 9,
+ StatusCode_INVALID_CREDENTIALS = 10,
+ StatusCode_FRAME_TOO_LARGE = 11
+ };
+
+ enum SETTINGS_ID {
+ SETTINGS_UPLOAD_BANDWIDTH = 1,
+ SETTINGS_DOWNLOAD_BANDWIDTH = 2,
+ SETTINGS_ROUND_TRIP_TIME = 3,
+ SETTINGS_MAX_CONCURRENT_STREAMS = 4,
+ SETTINGS_CURRENT_CWND = 5,
+ SETTINGS_DOWNLOAD_RETRANS_RATE = 6,
+ SETTINGS_INITIAL_WINDOW_SIZE = 7,
+ SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE = 8
+ };
+
+ enum GOAWAY_STATUS {
+ GOAWAY_OK = 0,
+ GOAWAY_PROTOCOL_ERROR = 1,
+ GOAWAY_INTERNAL_ERROR = 11
+ };
+
+ enum RST_STREAM_STATUS_CODE {
+ RST_STREAM_PROTOCOL_ERROR = 1,
+ RST_STREAM_INVALID_STREAM = 2,
+ RST_STREAM_REFUSED_STREAM = 3,
+ RST_STREAM_UNSUPPORTED_VERSION = 4,
+ RST_STREAM_CANCEL = 5,
+ RST_STREAM_INTERNAL_ERROR = 6,
+ RST_STREAM_FLOW_CONTROL_ERROR = 7,
+ RST_STREAM_STREAM_IN_USE = 8,
+ RST_STREAM_STREAM_ALREADY_CLOSED = 9,
+ RST_STREAM_INVALID_CREDENTIALS = 10,
+ RST_STREAM_FRAME_TOO_LARGE = 11
+ };
+
+ quint64 bytesAvailable() const;
+ bool readNextChunk(qint64 length, char *sink);
+
+ void sendControlFrame(FrameType type, ControlFrameFlags flags, const char *data, quint32 length);
+
+ void sendSYN_STREAM(HttpMessagePair pair, qint32 streamID,
+ qint32 associatedToStreamID);
+ void sendRST_STREAM(qint32 streamID, RST_STREAM_STATUS_CODE statusCode);
+ void sendPING(quint32 pingID);
+
+ bool uploadData(qint32 streamID);
+ Q_INVOKABLE void sendWINDOW_UPDATE(qint32 streamID, quint32 deltaWindowSize);
+
+ qint64 sendDataFrame(qint32 streamID, DataFrameFlags flags, quint32 length,
+ const char *data);
+
+ QByteArray composeHeader(const QHttpNetworkRequest &request);
+ bool uncompressHeader(const QByteArray &input, QByteArray *output);
+
+ void handleControlFrame(const QByteArray &frameHeaders);
+ void handleDataFrame(const QByteArray &frameHeaders);
+
+ void handleSYN_STREAM(char, quint32, const QByteArray &frameData);
+ void handleSYN_REPLY(char flags, quint32, const QByteArray &frameData);
+ void handleRST_STREAM(char flags, quint32 length, const QByteArray &frameData);
+ void handleSETTINGS(char flags, quint32 length, const QByteArray &frameData);
+ void handlePING(char, quint32 length, const QByteArray &frameData);
+ void handleGOAWAY(char flags, quint32, const QByteArray &frameData);
+ void handleHEADERS(char flags, quint32, const QByteArray &frameData);
+ void handleWINDOW_UPDATE(char, quint32, const QByteArray &frameData);
+
+ qint32 generateNextStreamID();
+ void parseHttpHeaders(char flags, const QByteArray &frameData);
+
+ void replyFinished(QHttpNetworkReply *httpReply, qint32 streamID);
+ void replyFinishedWithError(QHttpNetworkReply *httpReply, qint32 streamID,
+ QNetworkReply::NetworkError errorCode, const char *errorMessage);
+
+ qint32 m_nextStreamID;
+ QHash<quint32, HttpMessagePair> m_inFlightStreams;
+ qint32 m_maxConcurrentStreams;
+ quint32 m_initialWindowSize;
+ QByteDataBuffer m_spdyBuffer;
+ bool m_waitingForCompleteStream;
+ z_stream m_deflateStream;
+ z_stream m_inflateStream;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QSpdyProtocolHandler::DataFrameFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QSpdyProtocolHandler::ControlFrameFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QSpdyProtocolHandler::SETTINGS_Flags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QSpdyProtocolHandler::SETTINGS_ID_Flags)
+
+QT_END_NAMESPACE
+
+#endif // !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+
+#endif // QSPDYPROTOCOLHANDLER_H
diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp
index dc36443718..855ab4e485 100644
--- a/src/network/bearer/qnetworkconfigmanager.cpp
+++ b/src/network/bearer/qnetworkconfigmanager.cpp
@@ -132,7 +132,7 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate()
Some configuration updates may require some time to perform updates. A WLAN scan is
such an example. Unless the platform performs internal updates it may be required to
manually trigger configuration updates via QNetworkConfigurationManager::updateConfigurations().
- The completion of the update process is indicted by emitting the updateCompleted()
+ The completion of the update process is indicated by emitting the updateCompleted()
signal. The update process ensures that every existing QNetworkConfiguration instance
is updated. There is no need to ask for a renewed configuration list via allConfigurations().
diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp
index 570d1a82ea..cbaa9bec6a 100644
--- a/src/network/kernel/qhostinfo_win.cpp
+++ b/src/network/kernel/qhostinfo_win.cpp
@@ -134,8 +134,8 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
QHostInfo results;
#if defined(QHOSTINFO_DEBUG)
- qDebug("QHostInfoAgent::fromName(%p): looking up \"%s\" (IPv6 support is %s)",
- this, hostName.toLatin1().constData(),
+ qDebug("QHostInfoAgent::fromName(): looking up \"%s\" (IPv6 support is %s)",
+ hostName.toLatin1().constData(),
(local_getaddrinfo && local_freeaddrinfo) ? "enabled" : "disabled");
#endif
@@ -248,8 +248,8 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
#if defined(QHOSTINFO_DEBUG)
if (results.error() != QHostInfo::NoError) {
- qDebug("QHostInfoAgent::run(%p): error (%s)",
- this, results.errorString().toLatin1().constData());
+ qDebug("QHostInfoAgent::run(): error (%s)",
+ results.errorString().toLatin1().constData());
} else {
QString tmp;
QList<QHostAddress> addresses = results.addresses();
@@ -257,8 +257,8 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
if (i != 0) tmp += ", ";
tmp += addresses.at(i).toString();
}
- qDebug("QHostInfoAgent::run(%p): found %i entries: {%s}",
- this, addresses.count(), tmp.toLatin1().constData());
+ qDebug("QHostInfoAgent::run(): found %i entries: {%s}",
+ addresses.count(), tmp.toLatin1().constData());
}
#endif
return results;
diff --git a/src/network/ssl/qsslcipher.h b/src/network/ssl/qsslcipher.h
index 4cebffa7ae..f6ca033ede 100644
--- a/src/network/ssl/qsslcipher.h
+++ b/src/network/ssl/qsslcipher.h
@@ -57,7 +57,7 @@ class Q_NETWORK_EXPORT QSslCipher
{
public:
QSslCipher();
- QSslCipher(const QString &name);
+ explicit QSslCipher(const QString &name);
QSslCipher(const QString &name, QSsl::SslProtocol protocol);
QSslCipher(const QSslCipher &other);
~QSslCipher();
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 32dd7be7ba..b8c039d0e2 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1482,20 +1482,21 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem)
// don't try to cache huge fonts or vastly transformed fonts
QFontEngine *fontEngine = textItem->fontEngine();
if (shouldDrawCachedGlyphs(fontEngine, s->matrix)) {
- QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0
- ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat)
- : d->glyphCacheType;
- if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
+
+ QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None
+ ? fontEngine->glyphFormat : d->glyphCacheFormat;
+
+ if (glyphFormat == QFontEngine::Format_A32) {
if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()
|| d->device->alphaRequested() || s->matrix.type() > QTransform::TxTranslate
|| (s->composition_mode != QPainter::CompositionMode_Source
&& s->composition_mode != QPainter::CompositionMode_SourceOver))
{
- glyphType = QFontEngineGlyphCache::Raster_A8;
+ glyphFormat = QFontEngine::Format_A8;
}
}
- d->drawCachedGlyphs(glyphType, textItem);
+ d->drawCachedGlyphs(glyphFormat, textItem);
} else {
QPaintEngineEx::drawStaticTextItem(textItem);
}
@@ -1532,18 +1533,16 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
QTransform::TransformationType txtype = s->matrix.type();
- QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0
- ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat)
- : d->glyphCacheType;
-
+ QFontEngine::GlyphFormat glyphFormat = ti.fontEngine->glyphFormat != QFontEngine::Format_None
+ ? ti.fontEngine->glyphFormat : d->glyphCacheFormat;
- if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
+ if (glyphFormat == QFontEngine::Format_A32) {
if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()
|| d->device->alphaRequested() || txtype > QTransform::TxTranslate
|| (state()->composition_mode != QPainter::CompositionMode_Source
&& state()->composition_mode != QPainter::CompositionMode_SourceOver))
{
- glyphType = QFontEngineGlyphCache::Raster_A8;
+ glyphFormat = QFontEngine::Format_A8;
}
}
@@ -1562,7 +1561,7 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
staticTextItem.numGlyphs = glyphs.size();
staticTextItem.glyphPositions = positions.data();
- d->drawCachedGlyphs(glyphType, &staticTextItem);
+ d->drawCachedGlyphs(glyphFormat, &staticTextItem);
}
return;
}
@@ -1587,7 +1586,7 @@ namespace {
QSize cacheSize;
QGL2PEXVertexArray vertexCoordinateArray;
QGL2PEXVertexArray textureCoordinateArray;
- QFontEngineGlyphCache::Type glyphType;
+ QFontEngine::GlyphFormat glyphFormat;
int cacheSerialNumber;
};
@@ -1596,7 +1595,7 @@ namespace {
// #define QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO
-void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType,
+void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat glyphFormat,
QStaticTextItem *staticTextItem)
{
Q_Q(QGL2PaintEngineEx);
@@ -1620,9 +1619,9 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
}
QGLTextureGlyphCache *cache =
- (QGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphType, glyphCacheTransform);
- if (!cache || cache->cacheType() != glyphType || cache->contextGroup() == 0) {
- cache = new QGLTextureGlyphCache(glyphType, glyphCacheTransform);
+ (QGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphFormat, glyphCacheTransform);
+ if (!cache || cache->glyphFormat() != glyphFormat || cache->contextGroup() == 0) {
+ cache = new QGLTextureGlyphCache(glyphFormat, glyphCacheTransform);
fe->setGlyphCache(cacheKey, cache);
recreateVertexArrays = true;
}
@@ -1635,7 +1634,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
recreateVertexArrays = true;
} else {
QOpenGLStaticTextUserData *userData = static_cast<QOpenGLStaticTextUserData *>(staticTextItem->userData());
- if (userData->glyphType != glyphType) {
+ if (userData->glyphFormat != glyphFormat) {
recreateVertexArrays = true;
} else if (userData->cacheSerialNumber != cache->serialNumber()) {
recreateVertexArrays = true;
@@ -1662,7 +1661,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
transferMode(TextDrawingMode);
- int margin = fe->glyphMargin(glyphType);
+ int margin = fe->glyphMargin(glyphFormat);
GLfloat dx = 1.0 / cache->width();
GLfloat dy = 1.0 / cache->height();
@@ -1684,7 +1683,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData());
}
- userData->glyphType = glyphType;
+ userData->glyphFormat = glyphFormat;
userData->cacheSerialNumber = cache->serialNumber();
// Use cache if backend optimizations is turned on
@@ -1767,7 +1766,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
QBrush pensBrush = q->state()->pen.brush();
setBrush(pensBrush);
- if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
+ if (glyphFormat == QFontEngine::Format_A32) {
// Subpixel antialiasing without gamma correction
@@ -2037,11 +2036,11 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
glDisable(GL_MULTISAMPLE);
#endif
- d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
+ d->glyphCacheFormat = QFontEngine::Format_A8;
#if !defined(QT_OPENGL_ES_2)
if (!QOpenGLFunctions::isES()) {
- d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask;
+ d->glyphCacheFormat = QFontEngine::Format_A32;
d->multisamplingAlwaysEnabled = false;
} else {
d->multisamplingAlwaysEnabled = d->device->format().sampleBuffers();
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 76ef3aa55a..33a8869ecf 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -203,7 +203,7 @@ public:
void drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false);
void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
QPainter::PixmapFragmentHints hints);
- void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem);
+ void drawCachedGlyphs(QFontEngine::GlyphFormat glyphFormat, QStaticTextItem *staticTextItem);
// Calls glVertexAttributePointer if the pointer has changed
inline void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer);
@@ -255,7 +255,7 @@ public:
int width, height;
QGLContext *ctx;
EngineMode mode;
- QFontEngineGlyphCache::Type glyphCacheType;
+ QFontEngine::GlyphFormat glyphCacheFormat;
QOpenGLExtensions funcs;
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
index d506b7e4b9..f9f2670375 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
@@ -49,8 +49,8 @@ QT_BEGIN_NAMESPACE
QBasicAtomicInt qgltextureglyphcache_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1);
-QGLTextureGlyphCache::QGLTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix)
- : QImageTextureGlyphCache(type, matrix)
+QGLTextureGlyphCache::QGLTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix)
+ : QImageTextureGlyphCache(format, matrix)
, m_textureResource(0)
, pex(0)
, m_blitProgram(0)
@@ -123,7 +123,7 @@ void QGLTextureGlyphCache::createTextureData(int width, int height)
m_textureResource->m_width = width;
m_textureResource->m_height = height;
- if (m_type == QFontEngineGlyphCache::Raster_RGBMask) {
+ if (m_format == QFontEngine::Format_A32) {
QVarLengthArray<uchar> data(width * height * 4);
for (int i = 0; i < data.size(); ++i)
data[i] = 0;
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
index 8f43a906c0..5ffbea8708 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
@@ -112,7 +112,7 @@ struct QGLGlyphTexture : public QOpenGLSharedResource
class Q_OPENGL_EXPORT QGLTextureGlyphCache : public QImageTextureGlyphCache
{
public:
- QGLTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix);
+ QGLTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix);
~QGLTextureGlyphCache();
virtual void createTextureData(int width, int height);
diff --git a/src/platformsupport/eglconvenience/qeglcompositor.cpp b/src/platformsupport/eglconvenience/qeglcompositor.cpp
index a38f00d4f6..0e0a2d9375 100644
--- a/src/platformsupport/eglconvenience/qeglcompositor.cpp
+++ b/src/platformsupport/eglconvenience/qeglcompositor.cpp
@@ -119,16 +119,21 @@ void QEGLCompositor::render(QEGLPlatformWindow *window)
glBindTexture(GL_TEXTURE_2D, textureId);
QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i),
targetWindowRect);
- m_blitter->setSwizzleRB(window->isRaster());
if (textures->count() > 1 && i == textures->count() - 1) {
+ // Backingstore for a widget with QOpenGLWidget subwidgets
+ m_blitter->setSwizzleRB(true);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
m_blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
glDisable(GL_BLEND);
} else if (textures->count() == 1) {
+ // A regular QWidget window
+ m_blitter->setSwizzleRB(true);
m_blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
} else {
+ // Texture from an FBO belonging to a QOpenGLWidget
+ m_blitter->setSwizzleRB(false);
m_blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginBottomLeft);
}
}
diff --git a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp
index 1c87e1d27d..70e7c4e4db 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp
@@ -210,7 +210,7 @@ void QEGLPlatformCursor::initCursorAtlas()
m_cursorAtlas.cursorsPerRow = cursorsPerRow;
const QJsonArray hotSpots = object.value(QLatin1String("hotSpots")).toArray();
- Q_ASSERT(hotSpots.count() == Qt::LastCursor);
+ Q_ASSERT(hotSpots.count() == Qt::LastCursor + 1);
for (int i = 0; i < hotSpots.count(); i++) {
QPoint hotSpot(hotSpots[i].toArray()[0].toDouble(), hotSpots[i].toArray()[1].toDouble());
m_cursorAtlas.hotSpots << hotSpot;
@@ -218,7 +218,7 @@ void QEGLPlatformCursor::initCursorAtlas()
QImage image = QImage(atlas).convertToFormat(QImage::Format_ARGB32_Premultiplied);
m_cursorAtlas.cursorWidth = image.width() / m_cursorAtlas.cursorsPerRow;
- m_cursorAtlas.cursorHeight = image.height() / ((Qt::LastCursor + cursorsPerRow - 1) / cursorsPerRow);
+ m_cursorAtlas.cursorHeight = image.height() / ((Qt::LastCursor + cursorsPerRow) / cursorsPerRow);
m_cursorAtlas.width = image.width();
m_cursorAtlas.height = image.height();
m_cursorAtlas.image = image;
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 8b16e7520a..a9a85f1316 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -331,8 +331,10 @@ static const char *getFcFamilyForStyleHint(const QFont::StyleHint style)
return stylehint;
}
-static void populateFromPattern(FcPattern *pattern)
+void QFontconfigDatabase::populateFontDatabase()
{
+ FcFontSet *fonts;
+
QString familyName;
FcChar8 *value = 0;
int weight_value;
@@ -346,110 +348,6 @@ static void populateFromPattern(FcPattern *pattern)
FcBool scalable;
FcBool antialias;
- if (FcPatternGetString(pattern, FC_FAMILY, 0, &value) != FcResultMatch)
- return;
-
- familyName = QString::fromUtf8((const char *)value);
-
- slant_value = FC_SLANT_ROMAN;
- weight_value = FC_WEIGHT_REGULAR;
- spacing_value = FC_PROPORTIONAL;
- file_value = 0;
- indexValue = 0;
- scalable = FcTrue;
-
-
- if (FcPatternGetInteger(pattern, FC_SLANT, 0, &slant_value) != FcResultMatch)
- slant_value = FC_SLANT_ROMAN;
- if (FcPatternGetInteger(pattern, FC_WEIGHT, 0, &weight_value) != FcResultMatch)
- weight_value = FC_WEIGHT_REGULAR;
- if (FcPatternGetInteger(pattern, FC_WIDTH, 0, &width_value) != FcResultMatch)
- width_value = FC_WIDTH_NORMAL;
- if (FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing_value) != FcResultMatch)
- spacing_value = FC_PROPORTIONAL;
- if (FcPatternGetString(pattern, FC_FILE, 0, &file_value) != FcResultMatch)
- file_value = 0;
- if (FcPatternGetInteger(pattern, FC_INDEX, 0, &indexValue) != FcResultMatch)
- indexValue = 0;
- if (FcPatternGetBool(pattern, FC_SCALABLE, 0, &scalable) != FcResultMatch)
- scalable = FcTrue;
- if (FcPatternGetString(pattern, FC_FOUNDRY, 0, &foundry_value) != FcResultMatch)
- foundry_value = 0;
- if (FcPatternGetString(pattern, FC_STYLE, 0, &style_value) != FcResultMatch)
- style_value = 0;
- if (FcPatternGetBool(pattern,FC_ANTIALIAS,0,&antialias) != FcResultMatch)
- antialias = true;
-
- QSupportedWritingSystems writingSystems;
- FcLangSet *langset = 0;
- FcResult res = FcPatternGetLangSet(pattern, FC_LANG, 0, &langset);
- if (res == FcResultMatch) {
- bool hasLang = false;
- for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
- const FcChar8 *lang = (const FcChar8*) languageForWritingSystem[j];
- if (lang) {
- FcLangResult langRes = FcLangSetHasLang(langset, lang);
- if (langRes != FcLangDifferentLang) {
- writingSystems.setSupported(QFontDatabase::WritingSystem(j));
- hasLang = true;
- }
- }
- }
- if (!hasLang)
- // none of our known languages, add it to the other set
- writingSystems.setSupported(QFontDatabase::Other);
- } else {
- // we set Other to supported for symbol fonts. It makes no
- // sense to merge these with other ones, as they are
- // special in a way.
- writingSystems.setSupported(QFontDatabase::Other);
- }
-
-#if FC_VERSION >= 20297
- for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
- if (writingSystems.supported(QFontDatabase::WritingSystem(j))
- && requiresOpenType(j) && openType[j]) {
- FcChar8 *cap;
- res = FcPatternGetString (pattern, FC_CAPABILITY, 0, &cap);
- if (res != FcResultMatch || !strstr((const char *)cap, openType[j]))
- writingSystems.setSupported(QFontDatabase::WritingSystem(j),false);
- }
- }
-#endif
-
- FontFile *fontFile = new FontFile;
- fontFile->fileName = QLatin1String((const char *)file_value);
- fontFile->indexValue = indexValue;
-
- QFont::Style style = (slant_value == FC_SLANT_ITALIC)
- ? QFont::StyleItalic
- : ((slant_value == FC_SLANT_OBLIQUE)
- ? QFont::StyleOblique
- : QFont::StyleNormal);
- // Note: weight should really be an int but registerFont incorrectly uses an enum
- QFont::Weight weight = QFont::Weight(weightFromFcWeight(weight_value));
-
- double pixel_size = 0;
- if (!scalable)
- FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &pixel_size);
-
- bool fixedPitch = spacing_value >= FC_MONO;
- // Note: stretch should really be an int but registerFont incorrectly uses an enum
- QFont::Stretch stretch = QFont::Stretch(stretchFromFcWidth(width_value));
- QString styleName = style_value ? QString::fromUtf8((const char *) style_value) : QString();
- QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile);
-// qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size;
-
- for (int k = 1; FcPatternGetString(pattern, FC_FAMILY, k, &value) == FcResultMatch; ++k)
- QPlatformFontDatabase::registerAliasToFontFamily(familyName, QString::fromUtf8((const char *)value));
-
-}
-
-void QFontconfigDatabase::populateFontDatabase()
-{
- FcInitReinitialize();
- FcFontSet *fonts;
-
{
FcObjectSet *os = FcObjectSetCreate();
FcPattern *pattern = FcPatternCreate();
@@ -473,8 +371,103 @@ void QFontconfigDatabase::populateFontDatabase()
FcPatternDestroy(pattern);
}
- for (int i = 0; i < fonts->nfont; i++)
- populateFromPattern(fonts->fonts[i]);
+ for (int i = 0; i < fonts->nfont; i++) {
+ if (FcPatternGetString(fonts->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch)
+ continue;
+ // capitalize(value);
+ familyName = QString::fromUtf8((const char *)value);
+ slant_value = FC_SLANT_ROMAN;
+ weight_value = FC_WEIGHT_REGULAR;
+ spacing_value = FC_PROPORTIONAL;
+ file_value = 0;
+ indexValue = 0;
+ scalable = FcTrue;
+
+
+ if (FcPatternGetInteger (fonts->fonts[i], FC_SLANT, 0, &slant_value) != FcResultMatch)
+ slant_value = FC_SLANT_ROMAN;
+ if (FcPatternGetInteger (fonts->fonts[i], FC_WEIGHT, 0, &weight_value) != FcResultMatch)
+ weight_value = FC_WEIGHT_REGULAR;
+ if (FcPatternGetInteger (fonts->fonts[i], FC_WIDTH, 0, &width_value) != FcResultMatch)
+ width_value = FC_WIDTH_NORMAL;
+ if (FcPatternGetInteger (fonts->fonts[i], FC_SPACING, 0, &spacing_value) != FcResultMatch)
+ spacing_value = FC_PROPORTIONAL;
+ if (FcPatternGetString (fonts->fonts[i], FC_FILE, 0, &file_value) != FcResultMatch)
+ file_value = 0;
+ if (FcPatternGetInteger (fonts->fonts[i], FC_INDEX, 0, &indexValue) != FcResultMatch)
+ indexValue = 0;
+ if (FcPatternGetBool(fonts->fonts[i], FC_SCALABLE, 0, &scalable) != FcResultMatch)
+ scalable = FcTrue;
+ if (FcPatternGetString(fonts->fonts[i], FC_FOUNDRY, 0, &foundry_value) != FcResultMatch)
+ foundry_value = 0;
+ if (FcPatternGetString(fonts->fonts[i], FC_STYLE, 0, &style_value) != FcResultMatch)
+ style_value = 0;
+ if(FcPatternGetBool(fonts->fonts[i],FC_ANTIALIAS,0,&antialias) != FcResultMatch)
+ antialias = true;
+
+ QSupportedWritingSystems writingSystems;
+ FcLangSet *langset = 0;
+ FcResult res = FcPatternGetLangSet(fonts->fonts[i], FC_LANG, 0, &langset);
+ if (res == FcResultMatch) {
+ bool hasLang = false;
+ for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
+ const FcChar8 *lang = (const FcChar8*) languageForWritingSystem[j];
+ if (lang) {
+ FcLangResult langRes = FcLangSetHasLang(langset, lang);
+ if (langRes != FcLangDifferentLang) {
+ writingSystems.setSupported(QFontDatabase::WritingSystem(j));
+ hasLang = true;
+ }
+ }
+ }
+ if (!hasLang)
+ // none of our known languages, add it to the other set
+ writingSystems.setSupported(QFontDatabase::Other);
+ } else {
+ // we set Other to supported for symbol fonts. It makes no
+ // sense to merge these with other ones, as they are
+ // special in a way.
+ writingSystems.setSupported(QFontDatabase::Other);
+ }
+
+#if FC_VERSION >= 20297
+ for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
+ if (writingSystems.supported(QFontDatabase::WritingSystem(j))
+ && requiresOpenType(j) && openType[j]) {
+ FcChar8 *cap;
+ res = FcPatternGetString (fonts->fonts[i], FC_CAPABILITY, 0, &cap);
+ if (res != FcResultMatch || !strstr((const char *)cap, openType[j]))
+ writingSystems.setSupported(QFontDatabase::WritingSystem(j),false);
+ }
+ }
+#endif
+
+ FontFile *fontFile = new FontFile;
+ fontFile->fileName = QLatin1String((const char *)file_value);
+ fontFile->indexValue = indexValue;
+
+ QFont::Style style = (slant_value == FC_SLANT_ITALIC)
+ ? QFont::StyleItalic
+ : ((slant_value == FC_SLANT_OBLIQUE)
+ ? QFont::StyleOblique
+ : QFont::StyleNormal);
+ // Note: weight should really be an int but registerFont incorrectly uses an enum
+ QFont::Weight weight = QFont::Weight(weightFromFcWeight(weight_value));
+
+ double pixel_size = 0;
+ if (!scalable)
+ FcPatternGetDouble (fonts->fonts[i], FC_PIXEL_SIZE, 0, &pixel_size);
+
+ bool fixedPitch = spacing_value >= FC_MONO;
+ // Note: stretch should really be an int but registerFont incorrectly uses an enum
+ QFont::Stretch stretch = QFont::Stretch(stretchFromFcWidth(width_value));
+ QString styleName = style_value ? QString::fromUtf8((const char *) style_value) : QString();
+ QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile);
+// qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size;
+
+ for (int k = 1; FcPatternGetString(fonts->fonts[i], FC_FAMILY, k, &value) == FcResultMatch; ++k)
+ QPlatformFontDatabase::registerAliasToFontFamily(familyName, QString::fromUtf8((const char *)value));
+ }
FcFontSetDestroy (fonts);
@@ -522,12 +515,14 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
return 0;
QFontDef fontDef = f;
+ QFontEngineFT *engine;
FontFile *fontfile = static_cast<FontFile *> (usrPtr);
QFontEngine::FaceId fid;
fid.filename = QFile::encodeName(fontfile->fileName);
fid.index = fontfile->indexValue;
bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias);
+ engine = new QFontEngineFT(fontDef);
QFontEngineFT::GlyphFormat format;
// try and get the pattern
@@ -552,19 +547,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
FcDefaultSubstitute(pattern);
FcPattern *match = FcFontMatch(0, pattern, &result);
-
- QFontEngineFT *engine = new QFontEngineFT(fontDef);
-
if (match) {
- //Respect the file and index of the font config match
- FcChar8 *file_value;
- int indexValue;
-
- if (FcPatternGetString(match, FC_FILE, 0, &file_value) == FcResultMatch)
- fid.filename = (const char *)file_value;
- if (FcPatternGetInteger(match, FC_INDEX, 0, &indexValue) == FcResultMatch)
- fid.index = indexValue;
-
QFontEngineFT::HintStyle default_hint_style;
if (f.hintingPreference != QFont::PreferDefaultHinting) {
switch (f.hintingPreference) {
@@ -641,14 +624,12 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
format = subpixelType == QFontEngineFT::Subpixel_None
? QFontEngineFT::Format_A8 : QFontEngineFT::Format_A32;
engine->subpixelType = subpixelType;
- } else {
+ } else
format = QFontEngineFT::Format_Mono;
- }
FcPatternDestroy(match);
- } else {
+ } else
format = antialias ? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono;
- }
FcPatternDestroy(pattern);
@@ -762,7 +743,6 @@ static FcPattern *queryFont(const FcChar8 *file, const QByteArray &data, int id,
QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
{
QStringList families;
-
FcFontSet *set = FcConfigGetFonts(0, FcSetApplication);
if (!set) {
FcConfigAppFontAddFile(0, (const FcChar8 *)":/non-existent");
@@ -775,24 +755,28 @@ QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData,
FcBlanks *blanks = FcConfigGetBlanks(0);
int count = 0;
- FcPattern *pattern;
+ FcPattern *pattern = 0;
do {
pattern = queryFont((const FcChar8 *)QFile::encodeName(fileName).constData(),
fontData, id, blanks, &count);
if (!pattern)
return families;
+ FcPatternDel(pattern, FC_FILE);
+ QByteArray cs = fileName.toUtf8();
+ FcPatternAddString(pattern, FC_FILE, (const FcChar8 *) cs.constData());
+
FcChar8 *fam = 0;
if (FcPatternGetString(pattern, FC_FAMILY, 0, &fam) == FcResultMatch) {
QString family = QString::fromUtf8(reinterpret_cast<const char *>(fam));
families << family;
}
- populateFromPattern(pattern);
- FcFontSetAdd(set, pattern);
+ if (!FcFontSetAdd(set, pattern))
+ return families;
++id;
- } while (id < count);
+ } while (pattern && id < count);
return families;
}
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index ab2e9c1f1a..76506d12e9 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -163,10 +163,10 @@ QCoreTextFontDatabase::QCoreTextFontDatabase()
[fontImage release];
}
QCoreTextFontEngine::defaultGlyphFormat = (font_smoothing > 0
- ? QFontEngineGlyphCache::Raster_RGBMask
- : QFontEngineGlyphCache::Raster_A8);
+ ? QFontEngine::Format_A32
+ : QFontEngine::Format_A8);
#else
- QCoreTextFontEngine::defaultGlyphFormat = QFontEngineGlyphCache::Raster_A8;
+ QCoreTextFontEngine::defaultGlyphFormat = QFontEngine::Format_A8;
#endif
}
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 31a015ae9f..4fe78cb568 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -74,7 +74,7 @@ static void loadAdvancesForGlyphs(CTFontRef ctfont,
int QCoreTextFontEngine::antialiasingThreshold = 0;
-QFontEngineGlyphCache::Type QCoreTextFontEngine::defaultGlyphFormat = QFontEngineGlyphCache::Raster_RGBMask;
+QFontEngine::GlyphFormat QCoreTextFontEngine::defaultGlyphFormat = QFontEngine::Format_A32;
CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef)
{
@@ -155,7 +155,7 @@ void QCoreTextFontEngine::init()
#if defined(Q_OS_IOS) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (supportsColorGlyphs() && (traits & kCTFontColorGlyphsTrait))
- glyphFormat = QFontEngineGlyphCache::Raster_ARGB;
+ glyphFormat = QFontEngine::Format_ARGB;
else
#endif
glyphFormat = defaultGlyphFormat;
@@ -424,7 +424,7 @@ static void convertCGPathToQPainterPath(void *info, const CGPathElement *element
void QCoreTextFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nGlyphs,
QPainterPath *path, QTextItem::RenderFlags)
{
- if (glyphFormat == QFontEngineGlyphCache::Raster_ARGB)
+ if (glyphFormat == QFontEngine::Format_ARGB)
return; // We can't convert color-glyphs to path
CGAffineTransform cgMatrix = CGAffineTransformIdentity;
@@ -452,30 +452,67 @@ static void qcoretextfontengine_scaleMetrics(glyph_metrics_t &br, const QTransfo
}
}
-glyph_metrics_t QCoreTextFontEngine::alphaMapBoundingBox(glyph_t glyph, QFixed pos, const QTransform &matrix, GlyphFormat format)
+glyph_metrics_t QCoreTextFontEngine::alphaMapBoundingBox(glyph_t glyph, QFixed subPixelPosition, const QTransform &matrix, GlyphFormat format)
{
if (matrix.type() > QTransform::TxScale)
- return QFontEngine::alphaMapBoundingBox(glyph, pos, matrix, format);
+ return QFontEngine::alphaMapBoundingBox(glyph, subPixelPosition, matrix, format);
glyph_metrics_t br = boundingBox(glyph);
qcoretextfontengine_scaleMetrics(br, matrix);
- br.width = qAbs(qRound(br.width)) + 2;
- br.height = qAbs(qRound(br.height)) + 2;
+ // Normalize width and height
+ if (br.width < 0)
+ br.width = -br.width;
+ if (br.height < 0)
+ br.height = -br.height;
+
+ if (format == QFontEngine::Format_A8 || format == QFontEngine::Format_A32) {
+ // Drawing a glyph at x-position 0 with anti-aliasing enabled
+ // will potentially fill the pixel to the left of 0, as the
+ // coordinates are not aligned to the center of pixels. To
+ // prevent clipping of this pixel we need to shift the glyph
+ // in the bitmap one pixel to the right. The shift needs to
+ // be reflected in the glyph metrics as well, so that the final
+ // position of the glyph is correct, which is why doing the
+ // shift in imageForGlyph() is not enough.
+ br.x -= 1;
+
+ // As we've shifted the glyph one pixel to the right, we need
+ // to expand the width of the alpha map bounding box as well.
+ br.width += 1;
+
+ // But we have the same anti-aliasing problem on the right
+ // hand side of the glyph, eg. if the width of the glyph
+ // results in the bounding rect landing between two pixels.
+ // We pad the bounding rect again to account for the possible
+ // anti-aliased drawing.
+ br.width += 1;
+
+ // We also shift the glyph to right right based on the subpixel
+ // position, so we pad the bounding box to take account for the
+ // subpixel positions that may result in the glyph being drawn
+ // one pixel to the right of the 0-subpixel position.
+ br.width += 1;
+
+ // The same same logic as for the x-position needs to be applied
+ // to the y-position, except we don't need to compensate for
+ // the subpixel positioning.
+ br.y -= 1;
+ br.height += 2;
+ }
return br;
}
-QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition, bool aa, const QTransform &m)
+QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition, bool aa, const QTransform &matrix)
{
- glyph_metrics_t br = boundingBox(glyph);
- qcoretextfontengine_scaleMetrics(br, m);
+ glyph_metrics_t br = alphaMapBoundingBox(glyph, subPixelPosition, matrix, glyphFormat);
- bool isColorGlyph = glyphFormat == QFontEngineGlyphCache::Raster_ARGB;
- QImage::Format format = isColorGlyph ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
- QImage im(qAbs(qRound(br.width)) + 2, qAbs(qRound(br.height)) + 2, format);
+ bool isColorGlyph = glyphFormat == QFontEngine::Format_ARGB;
+ QImage::Format imageFormat = isColorGlyph ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
+ QImage im(br.width.ceil().toInt(), br.height.ceil().toInt(), imageFormat);
im.fill(0);
#ifndef Q_OS_IOS
@@ -503,8 +540,8 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
if (!isColorGlyph) // CTFontDrawGlyphs incorporates the font's matrix already
cgMatrix = CGAffineTransformConcat(cgMatrix, transform);
- if (m.isScaling())
- cgMatrix = CGAffineTransformConcat(cgMatrix, CGAffineTransformMakeScale(m.m11(), m.m22()));
+ if (matrix.isScaling())
+ cgMatrix = CGAffineTransformConcat(cgMatrix, CGAffineTransformMakeScale(matrix.m11(), matrix.m22()));
CGGlyph cgGlyph = glyph;
qreal pos_x = -br.x.truncate() + subPixelPosition.toReal();
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
index 7ef9f0dfbb..1cdac820b6 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
@@ -104,7 +104,7 @@ public:
bool supportsTransformation(const QTransform &transform) const;
virtual QFontEngine *cloneWithSize(qreal pixelSize) const;
- virtual int glyphMargin(QFontEngineGlyphCache::Type type) { Q_UNUSED(type); return 0; }
+ virtual int glyphMargin(QFontEngine::GlyphFormat format) { Q_UNUSED(format); return 0; }
static bool supportsColorGlyphs()
{
@@ -122,7 +122,7 @@ public:
}
static int antialiasingThreshold;
- static QFontEngineGlyphCache::Type defaultGlyphFormat;
+ static QFontEngine::GlyphFormat defaultGlyphFormat;
private:
friend class QRawFontPrivate;
diff --git a/src/platformsupport/linuxaccessibility/application.cpp b/src/platformsupport/linuxaccessibility/application.cpp
index 5c8f2e5fe2..ae52ab3b57 100644
--- a/src/platformsupport/linuxaccessibility/application.cpp
+++ b/src/platformsupport/linuxaccessibility/application.cpp
@@ -171,7 +171,7 @@ bool QSpiApplicationAdaptor::eventFilter(QObject *target, QEvent *event)
// FIXME: this is critical, the timeout should probably be pretty low to allow normal processing
int timeout = 100;
bool sent = dbusConnection.callWithCallback(m, this, SLOT(notifyKeyboardListenerCallback(QDBusMessage)),
- SLOT(notifyKeyboardListenerError(QDBusError, QDBusMessage)), timeout);
+ SLOT(notifyKeyboardListenerError(QDBusError,QDBusMessage)), timeout);
if (sent) {
//queue the event and send it after callback
keyEvents.enqueue(QPair<QPointer<QObject>, QKeyEvent*> (QPointer<QObject>(target), copyKeyEvent(keyEvent)));
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index aee56eb034..797c30c7c6 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -98,8 +98,8 @@ void QConnmanEngine::initialize()
ofonoContextManager = new QOfonoDataConnectionManagerInterface(ofonoManager->currentModem(),this);
connect(ofonoContextManager,SIGNAL(roamingAllowedChanged(bool)),this,SLOT(reEvaluateCellular()));
- connect(connmanManager,SIGNAL(servicesChanged(ConnmanMapList, QList<QDBusObjectPath>)),
- this, SLOT(updateServices(ConnmanMapList, QList<QDBusObjectPath>)));
+ connect(connmanManager,SIGNAL(servicesChanged(ConnmanMapList,QList<QDBusObjectPath>)),
+ this, SLOT(updateServices(ConnmanMapList,QList<QDBusObjectPath>)));
connect(connmanManager,SIGNAL(servicesReady(QStringList)),this,SLOT(servicesReady(QStringList)));
connect(connmanManager,SIGNAL(scanFinished()),this,SLOT(finishedScan()));
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 28a5da4b5d..784cc2e38b 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -334,7 +334,7 @@ namespace QtAndroid
return manufacturer + QStringLiteral(" ") + model;
}
- int createSurface(AndroidSurfaceClient *client, const QRect &geometry, bool onTop)
+ int createSurface(AndroidSurfaceClient *client, const QRect &geometry, bool onTop, int imageDepth)
{
QJNIEnvironmentPrivate env;
if (!env)
@@ -356,7 +356,8 @@ namespace QtAndroid
m_createSurfaceMethodID,
surfaceId,
jboolean(onTop),
- x, y, w, h);
+ x, y, w, h,
+ imageDepth);
return surfaceId;
}
@@ -689,7 +690,7 @@ static int registerNatives(JNIEnv *env)
return JNI_FALSE;
}
- GET_AND_CHECK_STATIC_METHOD(m_createSurfaceMethodID, m_applicationClass, "createSurface", "(IZIIII)V");
+ GET_AND_CHECK_STATIC_METHOD(m_createSurfaceMethodID, m_applicationClass, "createSurface", "(IZIIIII)V");
GET_AND_CHECK_STATIC_METHOD(m_insertNativeViewMethodID, m_applicationClass, "insertNativeView", "(ILandroid/view/View;IIII)V");
GET_AND_CHECK_STATIC_METHOD(m_setSurfaceGeometryMethodID, m_applicationClass, "setSurfaceGeometry", "(IIIII)V");
GET_AND_CHECK_STATIC_METHOD(m_destroySurfaceMethodID, m_applicationClass, "destroySurface", "(I)V");
diff --git a/src/plugins/platforms/android/androidjnimain.h b/src/plugins/platforms/android/androidjnimain.h
index eb604c8da8..c00b23fff3 100644
--- a/src/plugins/platforms/android/androidjnimain.h
+++ b/src/plugins/platforms/android/androidjnimain.h
@@ -66,7 +66,7 @@ namespace QtAndroid
void setQtThread(QThread *thread);
- int createSurface(AndroidSurfaceClient * client, const QRect &geometry, bool onTop);
+ int createSurface(AndroidSurfaceClient * client, const QRect &geometry, bool onTop, int imageDepth);
int insertNativeView(jobject view, const QRect &geometry);
void setSurfaceGeometry(int surfaceId, const QRect &geometry);
void destroySurface(int surfaceId);
diff --git a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
index 5f77d1645a..b112e265a5 100644
--- a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
+++ b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
@@ -51,10 +51,12 @@ struct AndroidAssetDir
{
AndroidAssetDir(AAssetDir* ad)
{
- const char *fileName;
- while ((fileName = AAssetDir_getNextFileName(ad)))
- m_items.push_back(QString::fromUtf8(fileName));
- AAssetDir_close(ad);
+ if (ad) {
+ const char *fileName;
+ while ((fileName = AAssetDir_getNextFileName(ad)))
+ m_items.push_back(QString::fromUtf8(fileName));
+ AAssetDir_close(ad);
+ }
}
FilesList m_items;
};
@@ -82,7 +84,10 @@ public:
{
if (m_index < 0 || m_index >= m_items.size())
return QString();
- return m_items[m_index];
+ QString fileName = m_items[m_index];
+ if (fileName.endsWith(QLatin1Char('/')))
+ fileName.chop(1);
+ return fileName;
}
virtual QString currentFilePath() const
@@ -254,33 +259,106 @@ private:
};
-AndroidAssetsFileEngineHandler::AndroidAssetsFileEngineHandler():m_assetsCache(std::max(5, qgetenv("QT_ANDROID_MAX_ASSETS_CACHE_SIZE").toInt()))
+AndroidAssetsFileEngineHandler::AndroidAssetsFileEngineHandler()
+ : m_assetsCache(std::max(5, qgetenv("QT_ANDROID_MAX_ASSETS_CACHE_SIZE").toInt()))
+ , m_hasPrepopulatedCache(false)
{
m_assetManager = QtAndroid::assetManager();
+ prepopulateCache();
}
AndroidAssetsFileEngineHandler::~AndroidAssetsFileEngineHandler()
{
}
+void AndroidAssetsFileEngineHandler::prepopulateCache()
+{
+ QMutexLocker locker(&m_assetsCacheMutext);
+ Q_ASSERT(m_assetsCache.isEmpty());
+
+ // Failsafe: Don't read cache files that are larger than 1MB
+ static qint64 maxPrepopulatedCacheSize = qMax(1024LL * 1024LL,
+ qgetenv("QT_ANDROID_MAX_PREPOPULATED_ASSETS_CACHE_SIZE").toLongLong());
+
+ const char *fileName = "--Added-by-androiddeployqt--/qt_cache_pregenerated_file_list";
+ AAsset *asset = AAssetManager_open(m_assetManager, fileName, AASSET_MODE_BUFFER);
+ if (asset) {
+ m_hasPrepopulatedCache = true;
+ AndroidAbstractFileEngine fileEngine(asset, QString::fromLatin1(fileName));
+ if (fileEngine.open(QIODevice::ReadOnly)) {
+ qint64 size = fileEngine.size();
+
+ if (size <= maxPrepopulatedCacheSize) {
+ QByteArray bytes(size, Qt::Uninitialized);
+ qint64 read = fileEngine.read(bytes.data(), size);
+ if (read != size) {
+ qWarning("Failed to read prepopulated cache");
+ return;
+ }
+
+ QDataStream stream(&bytes, QIODevice::ReadOnly);
+ stream.setVersion(QDataStream::Qt_5_3);
+ if (stream.status() != QDataStream::Ok) {
+ qWarning("Failed to read prepopulated cache");
+ return;
+ }
+
+ while (!stream.atEnd()) {
+ QString directoryName;
+ stream >> directoryName;
+
+ int fileCount;
+ stream >> fileCount;
+
+ QVector<QString> fileList;
+ fileList.reserve(fileCount);
+ while (fileCount--) {
+ QString fileName;
+ stream >> fileName;
+ fileList.append(fileName);
+ }
+
+ QSharedPointer<AndroidAssetDir> *aad = new QSharedPointer<AndroidAssetDir>(new AndroidAssetDir(0));
+ (*aad)->m_items = fileList;
+
+ // Cost = 0, because we should always cache everything if there's a prepopulated cache
+ QByteArray key = directoryName != QLatin1String("/")
+ ? QByteArray("assets:/") + directoryName.toUtf8()
+ : QByteArray("assets:");
+
+ bool ok = m_assetsCache.insert(key, aad, 0);
+ if (!ok)
+ qWarning("Failed to insert in cache: %s", qPrintable(directoryName));
+ }
+ } else {
+ qWarning("Prepopulated cache is too large to read.\n"
+ "Use environment variable QT_ANDROID_MAX_PREPOPULATED_ASSETS_CACHE_SIZE to adjust size.");
+ }
+ }
+ }
+}
+
QAbstractFileEngine * AndroidAssetsFileEngineHandler::create(const QString &fileName) const
{
if (fileName.isEmpty())
return 0;
- if (!fileName.startsWith(QLatin1String("assets:/")))
+ static QLatin1String assetsPrefix("assets:");
+ if (!fileName.startsWith(assetsPrefix))
return 0;
- int prefixSize=8;
+ static int prefixSize = assetsPrefix.size() + 1;
QByteArray path;
if (!fileName.endsWith(QLatin1Char('/'))) {
path = fileName.toUtf8();
- AAsset *asset = AAssetManager_open(m_assetManager,
- path.constData() + prefixSize,
- AASSET_MODE_BUFFER);
- if (asset)
- return new AndroidAbstractFileEngine(asset, fileName);
+ if (path.size() > prefixSize) {
+ AAsset *asset = AAssetManager_open(m_assetManager,
+ path.constData() + prefixSize,
+ AASSET_MODE_BUFFER);
+ if (asset)
+ return new AndroidAbstractFileEngine(asset, fileName);
+ }
}
if (!path.size())
@@ -290,17 +368,19 @@ QAbstractFileEngine * AndroidAssetsFileEngineHandler::create(const QString &file
QSharedPointer<AndroidAssetDir> *aad = m_assetsCache.object(path);
m_assetsCacheMutext.unlock();
if (!aad) {
- AAssetDir *assetDir = AAssetManager_openDir(m_assetManager, path.constData() + prefixSize);
- if (assetDir) {
- if (AAssetDir_getNextFileName(assetDir)) {
- AAssetDir_rewind(assetDir);
- aad = new QSharedPointer<AndroidAssetDir>(new AndroidAssetDir(assetDir));
- m_assetsCacheMutext.lock();
- m_assetsCache.insert(path, aad);
- m_assetsCacheMutext.unlock();
- return new AndroidAbstractFileEngine(*aad, fileName);
- } else {
- AAssetDir_close(assetDir);
+ if (!m_hasPrepopulatedCache && path.size() > prefixSize) {
+ AAssetDir *assetDir = AAssetManager_openDir(m_assetManager, path.constData() + prefixSize);
+ if (assetDir) {
+ if (AAssetDir_getNextFileName(assetDir)) {
+ AAssetDir_rewind(assetDir);
+ aad = new QSharedPointer<AndroidAssetDir>(new AndroidAssetDir(assetDir));
+ m_assetsCacheMutext.lock();
+ m_assetsCache.insert(path, aad);
+ m_assetsCacheMutext.unlock();
+ return new AndroidAbstractFileEngine(*aad, fileName);
+ } else {
+ AAssetDir_close(assetDir);
+ }
}
}
} else {
diff --git a/src/plugins/platforms/android/qandroidassetsfileenginehandler.h b/src/plugins/platforms/android/qandroidassetsfileenginehandler.h
index 7bd560886c..d56367d4d8 100644
--- a/src/plugins/platforms/android/qandroidassetsfileenginehandler.h
+++ b/src/plugins/platforms/android/qandroidassetsfileenginehandler.h
@@ -58,9 +58,12 @@ public:
QAbstractFileEngine *create(const QString &fileName) const;
private:
+ void prepopulateCache();
+
AAssetManager *m_assetManager;
mutable QCache<QByteArray, QSharedPointer<AndroidAssetDir>> m_assetsCache;
mutable QMutex m_assetsCacheMutext;
+ bool m_hasPrepopulatedCache;
};
#endif // QANDROIDASSETSFILEENGINEHANDLER_H
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp
index 5848e94aca..2cca974b41 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp
@@ -50,21 +50,20 @@
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformwindow.h>
-#warning sort the headers
#include "androidjnimain.h"
#include "qabstracteventdispatcher.h"
-#include "qandroidplatformrasterwindow.h"
-#include "qandroidplatformopenglwindow.h"
#include "qandroidplatformbackingstore.h"
-#include "qandroidplatformservices.h"
-#include "qandroidplatformfontdatabase.h"
-#include "qandroidplatformclipboard.h"
#include "qandroidplatformaccessibility.h"
+#include "qandroidplatformclipboard.h"
+#include "qandroidplatformforeignwindow.h"
+#include "qandroidplatformfontdatabase.h"
#include "qandroidplatformopenglcontext.h"
+#include "qandroidplatformopenglwindow.h"
+#include "qandroidplatformrasterwindow.h"
#include "qandroidplatformscreen.h"
+#include "qandroidplatformservices.h"
#include "qandroidplatformtheme.h"
#include "qandroidsystemlocale.h"
-#include "qandroidplatformforeignwindow.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
index 9df6610a99..34db729289 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
@@ -57,7 +57,7 @@ QAndroidPlatformOpenGLWindow::QAndroidPlatformOpenGLWindow(QWindow *window, EGLD
:QAndroidPlatformWindow(window), m_eglDisplay(display)
{
lockSurface();
- m_nativeSurfaceId = QtAndroid::createSurface(this, geometry(), bool(window->flags() & Qt::WindowStaysOnTopHint));
+ m_nativeSurfaceId = QtAndroid::createSurface(this, geometry(), bool(window->flags() & Qt::WindowStaysOnTopHint), 32);
m_surfaceWaitCondition.wait(&m_surfaceMutex);
unlockSurface();
}
diff --git a/src/plugins/platforms/android/qandroidplatformrasterwindow.cpp b/src/plugins/platforms/android/qandroidplatformrasterwindow.cpp
index 68545c6562..334b9cdd23 100644
--- a/src/plugins/platforms/android/qandroidplatformrasterwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformrasterwindow.cpp
@@ -54,6 +54,9 @@ QAndroidPlatformRasterWindow::QAndroidPlatformRasterWindow(QWindow *window)
void QAndroidPlatformRasterWindow::repaint(const QRegion &region)
{
+ if (QAndroidPlatformWindow::parent())
+ return;
+
QRect currentGeometry = geometry().translated(mapToGlobal(QPoint(0,0)));
QRect dirtyClient = region.boundingRect();
@@ -71,7 +74,7 @@ void QAndroidPlatformRasterWindow::repaint(const QRegion &region)
void QAndroidPlatformRasterWindow::setGeometry(const QRect &rect)
{
- m_oldGeometry = geometry();
+ m_oldGeometry = geometry().translated(mapToGlobal(QPoint(0,0)));;
QAndroidPlatformWindow::setGeometry(rect);
}
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp
index dd86a80d23..dbf317696f 100644
--- a/src/plugins/platforms/android/qandroidplatformscreen.cpp
+++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp
@@ -64,6 +64,7 @@ public:
ScopedProfiler(const QString &msg)
{
m_msg = msg;
+ m_timer.start();
}
~ScopedProfiler()
{
@@ -197,7 +198,7 @@ void QAndroidPlatformScreen::scheduleUpdate()
void QAndroidPlatformScreen::setDirty(const QRect &rect)
{
QRect intersection = rect.intersected(m_geometry);
- m_repaintRegion += intersection;
+ m_dirtyRect |= intersection;
scheduleUpdate();
}
@@ -241,14 +242,12 @@ void QAndroidPlatformScreen::doRedraw()
{
PROFILE_SCOPE;
- if (m_repaintRegion.isEmpty())
+ if (m_dirtyRect.isEmpty())
return;
- QVector<QRect> rects = m_repaintRegion.rects();
-
QMutexLocker lock(&m_surfaceMutex);
if (m_id == -1) {
- m_id = QtAndroid::createSurface(this, m_geometry, true);
+ m_id = QtAndroid::createSurface(this, m_geometry, true, m_depth);
m_surfaceWaitCondition.wait(&m_surfaceMutex);
}
@@ -257,11 +256,10 @@ void QAndroidPlatformScreen::doRedraw()
ANativeWindow_Buffer nativeWindowBuffer;
ARect nativeWindowRect;
- QRect br = m_repaintRegion.boundingRect();
- nativeWindowRect.top = br.top();
- nativeWindowRect.left = br.left();
- nativeWindowRect.bottom = br.bottom() + 1; // for some reason that I don't understand the QRect bottom needs to +1 to be the same with ARect bottom
- nativeWindowRect.right = br.right() + 1; // same for the right
+ nativeWindowRect.top = m_dirtyRect.top();
+ nativeWindowRect.left = m_dirtyRect.left();
+ nativeWindowRect.bottom = m_dirtyRect.bottom() + 1; // for some reason that I don't understand the QRect bottom needs to +1 to be the same with ARect bottom
+ nativeWindowRect.right = m_dirtyRect.right() + 1; // same for the right
int ret;
if ((ret = ANativeWindow_lock(m_nativeSurface, &nativeWindowBuffer, &nativeWindowRect)) < 0) {
@@ -283,36 +281,35 @@ void QAndroidPlatformScreen::doRedraw()
QPainter compositePainter(&screenImage);
compositePainter.setCompositionMode(QPainter::CompositionMode_Source);
- for (int rectIndex = 0; rectIndex < rects.size(); rectIndex++) {
- QRegion visibleRegion = rects[rectIndex];
- foreach (QAndroidPlatformWindow *window, m_windowStack) {
- if (!window->window()->isVisible()
- || !window->isRaster())
- continue;
+ QRegion visibleRegion(m_dirtyRect);
+ foreach (QAndroidPlatformWindow *window, m_windowStack) {
+ if (!window->window()->isVisible()
+ || !window->isRaster())
+ continue;
- foreach (const QRect &rect, visibleRegion.rects()) {
- QRect targetRect = window->geometry();
- targetRect &= rect;
+ QVector<QRect> visibleRects = visibleRegion.rects();
+ foreach (const QRect &rect, visibleRects) {
+ QRect targetRect = window->geometry();
+ targetRect &= rect;
- if (targetRect.isNull())
- continue;
+ if (targetRect.isNull())
+ continue;
- visibleRegion -= targetRect;
- QRect windowRect = targetRect.translated(-window->geometry().topLeft());
- QAndroidPlatformBackingStore *backingStore = static_cast<QAndroidPlatformRasterWindow *>(window)->backingStore();
- if (backingStore)
- compositePainter.drawImage(targetRect.topLeft(), backingStore->image(), windowRect);
- }
+ visibleRegion -= targetRect;
+ QRect windowRect = targetRect.translated(-window->geometry().topLeft());
+ QAndroidPlatformBackingStore *backingStore = static_cast<QAndroidPlatformRasterWindow *>(window)->backingStore();
+ if (backingStore)
+ compositePainter.drawImage(targetRect.topLeft(), backingStore->image(), windowRect);
}
+ }
- foreach (const QRect &rect, visibleRegion.rects()) {
- compositePainter.fillRect(rect, QColor(Qt::transparent));
- }
+ foreach (const QRect &rect, visibleRegion.rects()) {
+ compositePainter.fillRect(rect, QColor(Qt::transparent));
}
ret = ANativeWindow_unlockAndPost(m_nativeSurface);
if (ret >= 0)
- m_repaintRegion = QRegion();
+ m_dirtyRect = QRect();
}
QDpi QAndroidPlatformScreen::logicalDpi() const
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.h b/src/plugins/platforms/android/qandroidplatformscreen.h
index d3de937548..625e77840e 100644
--- a/src/plugins/platforms/android/qandroidplatformscreen.h
+++ b/src/plugins/platforms/android/qandroidplatformscreen.h
@@ -91,7 +91,7 @@ public slots:
protected:
typedef QList<QAndroidPlatformWindow *> WindowStackType;
WindowStackType m_windowStack;
- QRegion m_repaintRegion;
+ QRect m_dirtyRect;
QTimer m_redrawTimer;
QRect m_geometry;
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 30c15d823a..3ca611b537 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -122,7 +122,7 @@ bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy)
CGImageRef QCocoaBackingStore::getBackingStoreCGImage()
{
if (!m_cgImage)
- m_cgImage = qt_mac_toCGImage(m_qImage, false, 0);
+ m_cgImage = qt_mac_toCGImage(m_qImage);
// Warning: do not retain/release/cache the returned image from
// outside the backingstore since it shares data with a QImage and
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index f401459cc3..8728ab8764 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -318,7 +318,7 @@ static QString strippedText(QString s)
}
}
- QString qtFileName = QCFString::toQString(filename);
+ QString qtFileName = QFileInfo(QCFString::toQString(filename)).fileName();
// No filter means accept everything
bool nameMatches = mSelectedNameFilter->isEmpty();
// Check if the current file name filter accepts the file:
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index 6f76892d93..9b4d8fd96f 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -162,6 +162,9 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo
QCocoaGLContext::~QCocoaGLContext()
{
+ if (m_currentWindow && m_currentWindow.data()->handle())
+ static_cast<QCocoaWindow *>(m_currentWindow.data()->handle())->setCurrentContext(0);
+
[m_context release];
}
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index 419bf631aa..3b72184d83 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -68,10 +68,12 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list);
inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist)
{ return reinterpret_cast<NSMutableArray *>(qt_mac_QStringListToNSMutableArrayVoid(qstrlist)); }
-CGImageRef qt_mac_image_to_cgimage(const QImage &image);
NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge);
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
NSImage *qt_mac_create_nsimage(const QIcon &icon);
+CGImageRef qt_mac_toCGImage(const QImage &qImage);
+CGImageRef qt_mac_toCGImageMask(const QImage &qImage);
+QImage qt_mac_toQImage(CGImageRef image);
NSSize qt_mac_toNSSize(const QSize &qtSize);
NSRect qt_mac_toNSRect(const QRect &rect);
@@ -101,23 +103,13 @@ CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget);
CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
QString qt_mac_applicationName();
-inline int qt_mac_flipYCoordinate(int y)
-{ return QGuiApplication::primaryScreen()->geometry().height() - y; }
-
-inline qreal qt_mac_flipYCoordinate(qreal y)
-{ return QGuiApplication::primaryScreen()->geometry().height() - y; }
-
-inline QPointF qt_mac_flipPoint(const NSPoint &p)
-{ return QPointF(p.x, qt_mac_flipYCoordinate(p.y)); }
-
-inline NSPoint qt_mac_flipPoint(const QPoint &p)
-{ return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y())); }
-
-inline NSPoint qt_mac_flipPoint(const QPointF &p)
-{ return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y())); }
+int qt_mac_flipYCoordinate(int y);
+qreal qt_mac_flipYCoordinate(qreal y);
+QPointF qt_mac_flipPoint(const NSPoint &p);
+NSPoint qt_mac_flipPoint(const QPoint &p);
+NSPoint qt_mac_flipPoint(const QPointF &p);
NSRect qt_mac_flipRect(const QRect &rect);
-NSRect qt_mac_flipRect(const QRect &rect, QWindow *window);
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum);
@@ -159,8 +151,6 @@ public:
};
CGContextRef qt_mac_cg_context(QPaintDevice *pdev);
-CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy);
-QImage qt_mac_toQImage(CGImageRef image);
template<typename T>
T qt_mac_resolveOption(const T &fallback, const QByteArray &environment)
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index d27c134fa3..8975605e5c 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -79,24 +79,28 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list)
return result;
}
-static void drawImageReleaseData (void *info, const void *, size_t)
+static void qt_mac_deleteImage(void *image, const void *, size_t)
{
- delete static_cast<QImage *>(info);
+ delete static_cast<QImage *>(image);
}
-CGImageRef qt_mac_image_to_cgimage(const QImage &img)
+// Creates a CGDataProvider with the data from the given image.
+// The data provider retains a copy of the image.
+CGDataProviderRef qt_mac_CGDataProvider(const QImage &image)
{
- if (img.isNull())
+ return CGDataProviderCreateWithData(new QImage(image), image.bits(),
+ image.byteCount(), qt_mac_deleteImage);
+}
+
+CGImageRef qt_mac_toCGImage(const QImage &inImage)
+{
+ if (inImage.isNull())
return 0;
- QImage *image;
- if (img.depth() != 32)
- image = new QImage(img.convertToFormat(QImage::Format_ARGB32_Premultiplied));
- else
- image = new QImage(img);
+ QImage image = (inImage.depth() == 32) ? inImage : inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
uint cgflags = kCGImageAlphaNone;
- switch (image->format()) {
+ switch (image.format()) {
case QImage::Format_ARGB32_Premultiplied:
cgflags = kCGImageAlphaPremultipliedFirst;
break;
@@ -105,20 +109,26 @@ CGImageRef qt_mac_image_to_cgimage(const QImage &img)
break;
case QImage::Format_RGB32:
cgflags = kCGImageAlphaNoneSkipFirst;
+ break;
+ case QImage::Format_RGB888:
+ cgflags |= kCGImageAlphaNone;
+ break;
default:
break;
}
cgflags |= kCGBitmapByteOrder32Host;
- QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(image,
- static_cast<const QImage *>(image)->bits(),
- image->byteCount(),
- drawImageReleaseData);
-
- return CGImageCreate(image->width(), image->height(), 8, 32,
- image->bytesPerLine(),
- qt_mac_genericColorSpace(),
- cgflags, dataProvider, 0, false, kCGRenderingIntentDefault);
+ QCFType<CGDataProviderRef> dataProvider = qt_mac_CGDataProvider(image);
+ return CGImageCreate(image.width(), image.height(), 8, 32,
+ image.bytesPerLine(),
+ qt_mac_genericColorSpace(),
+ cgflags, dataProvider, 0, false, kCGRenderingIntentDefault);
+}
+CGImageRef qt_mac_toCGImageMask(const QImage &image)
+{
+ QCFType<CGDataProviderRef> dataProvider = qt_mac_CGDataProvider(image);
+ return CGImageMaskCreate(image.width(), image.height(), 8, image.depth(),
+ image.bytesPerLine(), dataProvider, NULL, false);
}
NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image)
@@ -132,7 +142,7 @@ NSImage *qt_mac_create_nsimage(const QPixmap &pm)
if (pm.isNull())
return 0;
QImage image = pm.toImage();
- CGImageRef cgImage = qt_mac_image_to_cgimage(image);
+ CGImageRef cgImage = qt_mac_toCGImage(image);
NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage);
CGImageRelease(cgImage);
return nsImage;
@@ -147,7 +157,7 @@ NSImage *qt_mac_create_nsimage(const QIcon &icon)
foreach (QSize size, icon.availableSizes()) {
QPixmap pm = icon.pixmap(size);
QImage image = pm.toImage();
- CGImageRef cgImage = qt_mac_image_to_cgimage(image);
+ CGImageRef cgImage = qt_mac_toCGImage(image);
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
[nsImage addRepresentation:imageRep];
[imageRep release];
@@ -585,44 +595,42 @@ QString qt_mac_applicationName()
return appName;
}
-NSRect qt_mac_flipRect(const QRect &rect)
+int qt_mac_mainScreenHeight()
{
- int flippedY = qt_mac_flipYCoordinate(rect.y() + rect.height());
- return NSMakeRect(rect.x(), flippedY, rect.width(), rect.height());
+ // The first screen in the screens array is documented
+ // to have the (0,0) origin.
+ NSRect screenFrame = [[[NSScreen screens] firstObject] frame];
+ return screenFrame.size.height;
}
-/*
- Mac window coordinates are in the first quadrant: 0, 0 is at the lower-left
- corner of the primary screen. This function converts the given rect to an
- NSRect for the window geometry, flipping from 4th quadrant to 1st quadrant
- and simultaneously ensuring that as much of the window as possible will be
- onscreen. If the rect is too tall for the screen, the OS will reduce the
- window's height anyway; but by moving the window upwards we can have more
- of it onscreen. But the application can still control the y coordinate
- in case it really wants the window to be positioned partially offscreen.
-*/
-NSRect qt_mac_flipRect(const QRect &rect, QWindow *window)
-{
- QPlatformScreen *onScreen = QPlatformScreen::platformScreenForWindow(window);
- int flippedY = onScreen->geometry().height() - (rect.y() + rect.height());
- QList<QScreen *> screens = QGuiApplication::screens();
- if (screens.size() > 1) {
- int height = 0;
- foreach (QScreen *scr, screens)
- height = qMax(height, scr->size().height());
- int difference = height - onScreen->geometry().height();
- if (difference > 0)
- flippedY += difference;
- else
- flippedY -= difference;
- }
- // In case of automatic positioning, try to put as much of the window onscreen as possible.
- if (window->isTopLevel() && qt_window_private(const_cast<QWindow*>(window))->positionAutomatic && flippedY < 0)
- flippedY = onScreen->geometry().height() - onScreen->availableGeometry().height() - onScreen->availableGeometry().y();
-#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
- qDebug() << Q_FUNC_INFO << rect << "flippedY" << flippedY <<
- "screen" << onScreen->geometry() << "available" << onScreen->availableGeometry();
-#endif
+int qt_mac_flipYCoordinate(int y)
+{
+ return qt_mac_mainScreenHeight() - y;
+}
+
+qreal qt_mac_flipYCoordinate(qreal y)
+{
+ return qt_mac_mainScreenHeight() - y;
+}
+
+QPointF qt_mac_flipPoint(const NSPoint &p)
+{
+ return QPointF(p.x, qt_mac_flipYCoordinate(p.y));
+}
+
+NSPoint qt_mac_flipPoint(const QPoint &p)
+{
+ return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y()));
+}
+
+NSPoint qt_mac_flipPoint(const QPointF &p)
+{
+ return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y()));
+}
+
+NSRect qt_mac_flipRect(const QRect &rect)
+{
+ int flippedY = qt_mac_flipYCoordinate(rect.y() + rect.height());
return NSMakeRect(rect.x(), flippedY, rect.width(), rect.height());
}
@@ -780,85 +788,6 @@ CGContextRef qt_mac_cg_context(QPaintDevice *pdev)
return ret;
}
-// qpaintengine_mac.mm
-extern void qt_mac_cgimage_data_free(void *, const void *memoryToFree, size_t);
-
-CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy)
-{
- int width = qImage.width();
- int height = qImage.height();
-
- if (width <= 0 || height <= 0) {
- qWarning() << Q_FUNC_INFO <<
- "setting invalid size" << width << "x" << height << "for qnsview image";
- return 0;
- }
-
- const uchar *imageData = qImage.bits();
- if (dataCopy) {
- *dataCopy = static_cast<uchar *>(malloc(qImage.byteCount()));
- memcpy(*dataCopy, imageData, qImage.byteCount());
- }
- int bitDepth = qImage.depth();
- int colorBufferSize = 8;
- int bytesPrLine = qImage.bytesPerLine();
-
- CGDataProviderRef cgDataProviderRef = CGDataProviderCreateWithData(
- NULL,
- dataCopy ? *dataCopy : imageData,
- qImage.byteCount(),
- dataCopy ? qt_mac_cgimage_data_free : NULL);
-
- CGImageRef cgImage = 0;
- if (isMask) {
- cgImage = CGImageMaskCreate(width,
- height,
- colorBufferSize,
- bitDepth,
- bytesPrLine,
- cgDataProviderRef,
- NULL,
- false);
- } else {
- CGColorSpaceRef cgColourSpaceRef = qt_mac_displayColorSpace(0);
-
- // Create a CGBitmapInfo contiaining the image format.
- // Support the 8-bit per component (A)RGB formats.
- CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Little;
- switch (qImage.format()) {
- case QImage::Format_ARGB32_Premultiplied :
- bitmapInfo |= kCGImageAlphaPremultipliedFirst;
- break;
- case QImage::Format_ARGB32 :
- bitmapInfo |= kCGImageAlphaFirst;
- break;
- case QImage::Format_RGB32 :
- bitmapInfo |= kCGImageAlphaNoneSkipFirst;
- break;
- case QImage::Format_RGB888 :
- bitmapInfo |= kCGImageAlphaNone;
- break;
- default:
- qWarning() << "qt_mac_toCGImage: Unsupported image format" << qImage.format();
- break;
- }
-
- cgImage = CGImageCreate(width,
- height,
- colorBufferSize,
- bitDepth,
- bytesPrLine,
- cgColourSpaceRef,
- bitmapInfo,
- cgDataProviderRef,
- NULL,
- false,
- kCGRenderingIntentDefault);
- }
- CGDataProviderRelease(cgDataProviderRef);
- return cgImage;
-}
-
QImage qt_mac_toQImage(CGImageRef image)
{
const size_t w = CGImageGetWidth(image),
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 0c1ddf9ad8..dff7c9bd50 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -487,6 +487,7 @@ void QCocoaIntegration::clearToolbars()
QHash<QWindow *, NSToolbar *>::const_iterator it = mToolbars.constBegin();
while (it != mToolbars.constEnd()) {
[it.value() release];
+ ++it;
}
mToolbars.clear();
}
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index 85ce96a8b6..f4776342de 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -248,7 +248,7 @@ void *QCocoaNativeInterface::qMenuBarToNSMenu(QPlatformMenuBar *platformMenuBar)
CGImageRef QCocoaNativeInterface::qImageToCGImage(const QImage &image)
{
- return qt_mac_toCGImage(image, false, 0);
+ return qt_mac_toCGImage(image);
}
QImage QCocoaNativeInterface::cgImageToQImage(CGImageRef image)
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index d972782f31..bf41270d12 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -392,12 +392,15 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
QWindowSystemInterface::handleGeometryChange(window(), rect);
QWindowSystemInterface::handleExposeEvent(window(), rect);
} else if (m_nsWindow) {
- NSRect bounds = qt_mac_flipRect(rect, window());
+ NSRect bounds = qt_mac_flipRect(rect);
[m_nsWindow setFrame:[m_nsWindow frameRectForContentRect:bounds] display:YES animate:NO];
} else {
[m_contentView setFrame : NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())];
}
+ if (!m_qtView)
+ QPlatformWindow::setGeometry(rect);
+
// will call QPlatformWindow::setGeometry(rect) during resize confirmation (see qnsview.mm)
}
@@ -415,7 +418,7 @@ void QCocoaWindow::clipWindow(const NSRect &clipRect)
NSRect clippedWindowRect = NSZeroRect;
if (!NSIsEmptyRect(clipRect)) {
- NSRect windowFrame = qt_mac_flipRect(QRect(window()->mapToGlobal(QPoint(0, 0)), geometry().size()), window());
+ NSRect windowFrame = qt_mac_flipRect(QRect(window()->mapToGlobal(QPoint(0, 0)), geometry().size()));
clippedWindowRect = NSIntersectionRect(windowFrame, clipRect);
// Clipping top/left offsets the content. Move it back.
NSPoint contentViewOffset = NSMakePoint(qMax(CGFloat(0), NSMinX(clippedWindowRect) - NSMinX(windowFrame)),
@@ -1153,6 +1156,10 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
// Child windows have no NSWindow, link the NSViews instead.
[m_parentCocoaWindow->m_contentView addSubview : m_contentView];
QRect rect = window()->geometry();
+ // Prevent setting a (0,0) window size; causes opengl context
+ // "Invalid Drawable" warnings.
+ if (rect.isNull())
+ rect.setSize(QSize(1, 1));
NSRect frame = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height());
[m_contentView setFrame:frame];
[m_contentView setHidden: YES];
@@ -1201,7 +1208,7 @@ NSWindow * QCocoaWindow::createNSWindow()
QCocoaAutoReleasePool pool;
QRect rect = initialGeometry(window(), window()->geometry(), defaultWindowWidth, defaultWindowHeight);
- NSRect frame = qt_mac_flipRect(rect, window());
+ NSRect frame = qt_mac_flipRect(rect);
Qt::WindowType type = window()->type();
Qt::WindowFlags flags = window()->flags();
diff --git a/src/plugins/platforms/cocoa/qmacmime.mm b/src/plugins/platforms/cocoa/qmacmime.mm
index 89d1b5f681..4274e178f7 100644
--- a/src/plugins/platforms/cocoa/qmacmime.mm
+++ b/src/plugins/platforms/cocoa/qmacmime.mm
@@ -565,7 +565,7 @@ QList<QByteArray> QMacPasteboardMimeTiff::convertFromMime(const QString &mime, Q
return ret;
QImage img = qvariant_cast<QImage>(variant);
- QCFType<CGImageRef> cgimage = qt_mac_image_to_cgimage(img);
+ QCFType<CGImageRef> cgimage = qt_mac_toCGImage(img);
QCFType<CFMutableDataRef> data = CFDataCreateMutable(0, 0);
QCFType<CGImageDestinationRef> imageDestination = CGImageDestinationCreateWithData(data, kUTTypeTIFF, 1, 0);
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 58c732de98..fcca96a8a8 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -80,7 +80,6 @@ static QTouchDevice *touchDevice = 0;
if (self) {
m_backingStore = 0;
m_maskImage = 0;
- m_maskData = 0;
m_shouldInvalidateWindowShadow = false;
m_window = 0;
m_buttons = Qt::NoButton;
@@ -106,7 +105,6 @@ static QTouchDevice *touchDevice = 0;
{
CGImageRelease(m_maskImage);
m_maskImage = 0;
- m_maskData = 0;
m_window = 0;
m_subscribesForGlobalFrameNotifications = false;
[m_inputSource release];
@@ -372,7 +370,7 @@ static QTouchDevice *touchDevice = 0;
- (BOOL) hasMask
{
- return m_maskData != 0;
+ return m_maskImage != 0;
}
- (BOOL) isOpaque
@@ -405,7 +403,7 @@ static QTouchDevice *touchDevice = 0;
dst[x] = src[x] & 0xff;
}
}
- m_maskImage = qt_mac_toCGImage(maskImage, true, &m_maskData);
+ m_maskImage = qt_mac_toCGImageMask(maskImage);
}
- (void)invalidateWindowShadowIfNeeded
@@ -861,14 +859,9 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
uint deviceId = [theEvent deviceID];
if (!tabletDeviceDataHash->contains(deviceId)) {
- // 10.6 sends tablet events for trackpad interaction, but
- // not proximity events. Silence the warning to prevent
- // flooding the console.
- if (QSysInfo::QSysInfo::MacintoshVersion == QSysInfo::MV_10_6)
- return;
-
- qWarning("QNSView handleTabletEvent: This tablet device is unknown"
- " (received no proximity event for it). Discarding event.");
+ // Error: Unknown tablet device. Qt also gets into this state
+ // when running on a VM. This appears to be harmless; don't
+ // print a warning.
return;
}
const QCocoaTabletDeviceData &deviceData = tabletDeviceDataHash->value(deviceId);
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
index 40d60a6a0a..61fbe3a61f 100644
--- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
@@ -488,7 +488,7 @@ static void qt_mac_draw_pattern(void *info, CGContextRef c)
if (isBitmap)
pat->image = qt_mac_create_imagemask(pat->data.pixmap, pat->data.pixmap.rect());
else
- pat->image = qt_mac_image_to_cgimage(pat->data.pixmap.toImage());
+ pat->image = qt_mac_toCGImage(pat->data.pixmap.toImage());
}
} else {
w = CGImageGetWidth(pat->image);
@@ -963,11 +963,11 @@ void QCoreGraphicsPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, co
CGContextSetFillColorWithColor(d->hd, cgColorForQColor(col, d->pdev));
image = qt_mac_create_imagemask(pm, sr);
} else if (differentSize) {
- QCFType<CGImageRef> img = qt_mac_image_to_cgimage(pm.toImage());
+ QCFType<CGImageRef> img = qt_mac_toCGImage(pm.toImage());
if (img)
image = CGImageCreateWithImageInRect(img, CGRectMake(qRound(sr.x()), qRound(sr.y()), qRound(sr.width()), qRound(sr.height())));
} else {
- image = qt_mac_image_to_cgimage(pm.toImage());
+ image = qt_mac_toCGImage(pm.toImage());
}
qt_mac_drawCGImage(d->hd, &rect, image);
if (doRestore)
diff --git a/src/plugins/platforms/eglfs/cursor-atlas.png b/src/plugins/platforms/eglfs/cursor-atlas.png
index 8d89a7ab86..4ddb7708e1 100644..100755
--- a/src/plugins/platforms/eglfs/cursor-atlas.png
+++ b/src/plugins/platforms/eglfs/cursor-atlas.png
Binary files differ
diff --git a/src/plugins/platforms/eglfs/cursor.json b/src/plugins/platforms/eglfs/cursor.json
index 7b6b6d95fa..307d5cf6cd 100644
--- a/src/plugins/platforms/eglfs/cursor.json
+++ b/src/plugins/platforms/eglfs/cursor.json
@@ -3,26 +3,26 @@
"cursorsPerRow": 8,
"hotSpots": [
[7, 2],
- [13, 3],
- [13, 13],
- [13, 13],
- [14, 15],
- [13, 13],
- [13, 13],
- [13, 13],
- [13, 13],
- [13, 13],
- [13, 13],
- [13, 13],
- [13, 13],
- [13, 13],
- [13, 13],
- [10, 1],
- [13, 13],
- [0, 0],
- [0, 0],
- [13, 13],
- [13, 13]
+ [12, 3],
+ [12, 12],
+ [12, 12],
+ [12, 12],
+ [12, 12],
+ [12, 12],
+ [12, 12],
+ [12, 12],
+ [11, 11],
+ [12, 12],
+ [12, 12],
+ [12, 12],
+ [9, 1],
+ [12, 12],
+ [1, 1],
+ [1, 1],
+ [12, 12],
+ [12, 12],
+ [12, 12],
+ [12, 12],
+ [12, 12]
]
}
-
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index e57025cbc6..f2b57aec9a 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -88,8 +88,10 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW
QQnxScreen *platformScreen = static_cast<QQnxScreen *>(window->screen()->handle());
- if (window->type() == Qt::CoverWindow) {
+ if (window->type() == Qt::CoverWindow || window->type() == Qt::Desktop) {
// Cover windows have to be top level to be accessible to window delegate (i.e. navigator)
+ // Desktop windows also need to be toplevel because they are not
+ // supposed to be part of the window hierarchy tree
m_isTopLevel = true;
} else if (parent() || (window->type() & Qt::Dialog) == Qt::Dialog) {
// If we have a parent we are a child window. Sometimes we have to be a child even if we
@@ -104,7 +106,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW
if (m_isTopLevel) {
Q_SCREEN_CRITICALERROR(screen_create_window(&m_window, m_screenContext),
"Could not create top level window"); // Creates an application window
- if (window->type() != Qt::CoverWindow) {
+ if (window->type() != Qt::CoverWindow && window->type() != Qt::Desktop) {
if (needRootWindow)
platformScreen->setRootWindow(this);
}
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index 5370d556fd..dcfeba12fa 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -132,19 +132,35 @@ extern "C" LRESULT QT_WIN_CALLBACK qClipboardViewerWndProc(HWND hwnd, UINT messa
return DefWindowProc(hwnd, message, wParam, lParam);
}
+// QTBUG-36958, ensure the clipboard is flushed before
+// QGuiApplication is destroyed since OleFlushClipboard()
+// might query the data again which causes problems
+// for QMimeData-derived classes using QPixmap/QImage.
+static void cleanClipboardPostRoutine()
+{
+ if (QWindowsClipboard *cl = QWindowsClipboard::instance())
+ cl->cleanup();
+}
+
QWindowsClipboard *QWindowsClipboard::m_instance = 0;
QWindowsClipboard::QWindowsClipboard() :
m_data(0), m_clipboardViewer(0), m_nextClipboardViewer(0)
{
QWindowsClipboard::m_instance = this;
+ qAddPostRoutine(cleanClipboardPostRoutine);
}
QWindowsClipboard::~QWindowsClipboard()
{
+ cleanup();
+ QWindowsClipboard::m_instance = 0;
+}
+
+void QWindowsClipboard::cleanup()
+{
unregisterViewer(); // Should release data if owner.
releaseIData();
- QWindowsClipboard::m_instance = 0;
}
void QWindowsClipboard::releaseIData()
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.h b/src/plugins/platforms/windows/qwindowsclipboard.h
index ad7ee6437f..30bc0143f4 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.h
+++ b/src/plugins/platforms/windows/qwindowsclipboard.h
@@ -64,6 +64,7 @@ public:
QWindowsClipboard();
~QWindowsClipboard();
void registerViewer(); // Call in initialization, when context is up.
+ void cleanup();
virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard);
virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard);
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 08f3ab4dbd..f67fb9bc19 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -341,6 +341,16 @@ QWindowsContext::~QWindowsContext()
m_instance = 0;
}
+void QWindowsContext::setTabletAbsoluteRange(int a)
+{
+#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE)
+ if (!d->m_tabletSupport.isNull())
+ d->m_tabletSupport->setAbsoluteRange(a);
+#else
+ Q_UNUSED(a)
+#endif
+}
+
QWindowsContext *QWindowsContext::instance()
{
return m_instance;
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index 1fea059ed9..f5dbd072c7 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -183,6 +183,8 @@ public:
void setWindowCreationContext(const QSharedPointer<QWindowCreationContext> &ctx);
+ void setTabletAbsoluteRange(int a);
+
// Returns a combination of SystemInfoFlags
unsigned systemInfo() const;
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 7307d52cf9..b6ff3dc3ce 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -880,7 +880,7 @@ public:
inline static QWindowsNativeFileDialogBase *create(QFileDialogOptions::AcceptMode am, const QWindowsFileDialogSharedData &data);
virtual void setWindowTitle(const QString &title);
- inline void setMode(QFileDialogOptions::FileMode mode, QFileDialogOptions::FileDialogOptions options);
+ inline void setMode(QFileDialogOptions::FileMode mode, QFileDialogOptions::AcceptMode acceptMode, QFileDialogOptions::FileDialogOptions options);
inline void setDirectory(const QString &directory);
inline void updateDirectory() { setDirectory(m_data.directory().toLocalFile()); }
inline QString directory() const;
@@ -1037,14 +1037,17 @@ void QWindowsNativeFileDialogBase::doExec(HWND owner)
}
}
-void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode, QFileDialogOptions::FileDialogOptions options)
+void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode,
+ QFileDialogOptions::AcceptMode acceptMode,
+ QFileDialogOptions::FileDialogOptions options)
{
DWORD flags = FOS_PATHMUSTEXIST | FOS_FORCESHOWHIDDEN;
if (options & QFileDialogOptions::DontResolveSymlinks)
flags |= FOS_NODEREFERENCELINKS;
switch (mode) {
case QFileDialogOptions::AnyFile:
- flags |= FOS_NOREADONLYRETURN;
+ if (acceptMode == QFileDialogOptions::AcceptSave)
+ flags |= FOS_NOREADONLYRETURN;
if (!(options & QFileDialogOptions::DontConfirmOverwrite))
flags |= FOS_OVERWRITEPROMPT;
break;
@@ -1059,8 +1062,9 @@ void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode, QF
flags |= FOS_FILEMUSTEXIST | FOS_ALLOWMULTISELECT;
break;
}
- qCDebug(lcQpaDialogs) << __FUNCTION__ << " mode=" << mode << " options"
- << options << " results in 0x" << flags;
+ qCDebug(lcQpaDialogs) << __FUNCTION__ << "mode=" << mode
+ << "acceptMode=" << acceptMode << "options=" << options
+ << "results in" << showbase << hex << flags;
if (FAILED(m_fileDialog->SetOptions(flags)))
qErrnoWarning("%s: SetOptions() failed", __FUNCTION__);
@@ -1592,7 +1596,7 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
m_data.fromOptions(opts);
const QFileDialogOptions::FileMode mode = opts->fileMode();
result->setWindowTitle(opts->windowTitle());
- result->setMode(mode, opts->options());
+ result->setMode(mode, opts->acceptMode(), opts->options());
result->setHideFiltersDetails(opts->testOption(QFileDialogOptions::HideNameFilterDetails));
const QStringList nameFilters = opts->nameFilters();
if (!nameFilters.isEmpty())
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 96659c505f..854444b254 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -1745,7 +1745,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &requ
if (!useDirectWrite) {
QWindowsFontEngine *few = new QWindowsFontEngine(request.family, hfont, stockFont, lf, data);
if (preferClearTypeAA)
- few->glyphFormat = QFontEngineGlyphCache::Raster_RGBMask;
+ few->glyphFormat = QFontEngine::Format_A32;
few->initFontInfo(request, fontHdc, dpi);
fe = few;
}
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp
index 1676b73658..86fcb666b0 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp
@@ -1148,7 +1148,7 @@ glyph_metrics_t QWindowsFontEngine::alphaMapBoundingBox(glyph_t glyph, QFixed, c
{
int margin = 0;
if (format == QFontEngine::Format_A32 || format == QFontEngine::Format_ARGB)
- margin = glyphMargin(QFontEngineGlyphCache::Raster_RGBMask);
+ margin = glyphMargin(QFontEngine::Format_A32);
glyph_metrics_t gm = boundingBox(glyph, matrix);
gm.width += margin * 2;
gm.height += margin * 2;
@@ -1221,7 +1221,7 @@ QImage QWindowsFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed, const QTra
SystemParametersInfo(SPI_GETFONTSMOOTHINGCONTRAST, 0, &contrast, 0);
SystemParametersInfo(SPI_SETFONTSMOOTHINGCONTRAST, 0, (void *) 1000, 0);
- int margin = glyphMargin(QFontEngineGlyphCache::Raster_RGBMask);
+ int margin = glyphMargin(QFontEngine::Format_A32);
QWindowsNativeImage *mask = drawGDIGlyph(font, glyph, margin, t, QImage::Format_RGB32);
SystemParametersInfo(SPI_SETFONTSMOOTHINGCONTRAST, 0, (void *) quintptr(contrast), 0);
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index ce5ea8167f..1c5e4508ac 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -620,7 +620,7 @@ QImage QWindowsFontEngineDirectWrite::alphaRGBMapForGlyph(glyph_t t,
{
QImage mask = imageForGlyph(t,
subPixelPosition,
- glyphMargin(QFontEngineGlyphCache::Raster_RGBMask),
+ glyphMargin(QFontEngine::Format_A32),
xform);
return mask.depth() == 32
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index e5d9444966..3735865845 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -143,7 +143,7 @@ struct QWindowsIntegrationPrivate
explicit QWindowsIntegrationPrivate(const QStringList &paramList);
~QWindowsIntegrationPrivate();
- const unsigned m_options;
+ unsigned m_options;
QWindowsContext m_context;
QPlatformFontDatabase *m_fontDatabase;
#ifndef QT_NO_CLIPBOARD
@@ -165,7 +165,8 @@ struct QWindowsIntegrationPrivate
QWindowsServices m_services;
};
-static inline unsigned parseOptions(const QStringList &paramList)
+static inline unsigned parseOptions(const QStringList &paramList,
+ int *tabletAbsoluteRange)
{
unsigned options = 0;
foreach (const QString &param, paramList) {
@@ -187,15 +188,21 @@ static inline unsigned parseOptions(const QStringList &paramList)
options |= QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch;
} else if (param.startsWith(QLatin1String("verbose="))) {
QWindowsContext::verbose = param.right(param.size() - 8).toInt();
+ } else if (param.startsWith(QLatin1String("tabletabsoluterange="))) {
+ *tabletAbsoluteRange = param.rightRef(param.size() - 20).toInt();
}
}
return options;
}
QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList &paramList)
- : m_options(parseOptions(paramList))
+ : m_options(0)
, m_fontDatabase(0)
{
+ int tabletAbsoluteRange = -1;
+ m_options = parseOptions(paramList, &tabletAbsoluteRange);
+ if (tabletAbsoluteRange >= 0)
+ m_context.setTabletAbsoluteRange(tabletAbsoluteRange);
}
QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate()
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index d8c0a9e426..dfa400285a 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -173,15 +173,15 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
// Check for events synthesized from touch. Lower byte is touch index, 0 means pen.
static const bool passSynthesizedMouseEvents =
!(QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch);
- if (!passSynthesizedMouseEvents) {
- // Check for events synthesized from touch. Lower 7 bits are touch/pen index, bit 8 indicates touch.
- // However, when tablet support is active, extraInfo is a packet serial number. This is not a problem
- // since we do not want to ignore mouse events coming from a tablet.
- const quint64 extraInfo = GetMessageExtraInfo();
- const bool fromTouch = (extraInfo & signatureMask) == miWpSignature && (extraInfo & 0x80);
- if (fromTouch)
- return false;
+ // Check for events synthesized from touch. Lower 7 bits are touch/pen index, bit 8 indicates touch.
+ // However, when tablet support is active, extraInfo is a packet serial number. This is not a problem
+ // since we do not want to ignore mouse events coming from a tablet.
+ const quint64 extraInfo = GetMessageExtraInfo();
+ if ((extraInfo & signatureMask) == miWpSignature) {
source = Qt::MouseEventSynthesizedBySystem;
+ const bool fromTouch = extraInfo & 0x80; // (else: Tablet PC)
+ if (fromTouch && !passSynthesizedMouseEvents)
+ return false;
}
#endif // !Q_OS_WINCE
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
index 8b863ec43d..484ed9cb05 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
@@ -159,6 +159,7 @@ bool QWindowsWinTab32DLL::init()
QWindowsTabletSupport::QWindowsTabletSupport(HWND window, HCTX context)
: m_window(window)
, m_context(context)
+ , m_absoluteRange(20)
, m_tiltSupport(false)
, m_currentDevice(-1)
{
@@ -402,7 +403,6 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
// in which case we snap the position to the mouse position.
// It seems there is no way to find out the mode programmatically, the LOGCONTEXT orgX/Y/Ext
// area is always the virtual desktop.
- enum { absoluteRange = 20 };
const QRect virtualDesktopArea = QGuiApplication::primaryScreen()->virtualGeometry();
qCDebug(lcQpaTablet) << __FUNCTION__ << "processing " << packetCount
@@ -427,7 +427,7 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
// Positions should be almost the same if we are in absolute
// mode. If they are not, use the mouse location.
- if ((mouseLocation - globalPos).manhattanLength() > absoluteRange) {
+ if ((mouseLocation - globalPos).manhattanLength() > m_absoluteRange) {
globalPos = mouseLocation;
globalPosF = globalPos;
}
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h
index 5e29cd9554..527d9dbf37 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.h
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.h
@@ -124,6 +124,9 @@ public:
bool translateTabletProximityEvent(WPARAM wParam, LPARAM lParam);
bool translateTabletPacketEvent();
+ int absoluteRange() const { return m_absoluteRange; }
+ void setAbsoluteRange(int a) { m_absoluteRange = a; }
+
private:
unsigned options() const;
QWindowsTabletDeviceData tabletInit(const quint64 uniqueId, const UINT cursorType) const;
@@ -131,6 +134,7 @@ private:
static QWindowsWinTab32DLL m_winTab32DLL;
const HWND m_window;
const HCTX m_context;
+ int m_absoluteRange;
bool m_tiltSupport;
QVector<QWindowsTabletDeviceData> m_devices;
int m_currentDevice;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index a0a9e75e2d..d77f587b92 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -924,11 +924,23 @@ void QWindowsWindow::fireExpose(const QRegion &region, bool force)
QWindowSystemInterface::handleExposeEvent(window(), region);
}
+static inline QWindow *findTransientChild(const QWindow *parent)
+{
+ foreach (QWindow *w, QGuiApplication::topLevelWindows())
+ if (w->transientParent() == parent)
+ return w;
+ return 0;
+}
+
void QWindowsWindow::destroyWindow()
{
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window() << m_data.hwnd;
if (m_data.hwnd) { // Stop event dispatching before Window is destroyed.
setFlag(WithinDestroy);
+ // Clear any transient child relationships as Windows will otherwise destroy them (QTBUG-35499, QTBUG-36666)
+ if (QWindow *transientChild = findTransientChild(window()))
+ if (QWindowsWindow *tw = QWindowsWindow::baseWindowOf(transientChild))
+ tw->updateTransientParent();
QWindowsContext *context = QWindowsContext::instance();
if (context->windowUnderMouse() == window())
context->clearWindowUnderMouse();
@@ -1065,7 +1077,7 @@ bool QWindowsWindow::isVisible() const
bool QWindowsWindow::isActive() const
{
// Check for native windows or children of the active native window.
- if (const HWND activeHwnd = GetActiveWindow())
+ if (const HWND activeHwnd = GetForegroundWindow())
if (m_data.hwnd == activeHwnd || IsChild(activeHwnd, m_data.hwnd))
return true;
return false;
@@ -1102,6 +1114,18 @@ QPoint QWindowsWindow::mapFromGlobal(const QPoint &pos) const
return pos;
}
+#ifndef Q_OS_WINCE
+static inline HWND transientParentHwnd(HWND hwnd)
+{
+ if (GetAncestor(hwnd, GA_PARENT) == GetDesktopWindow()) {
+ const HWND rootOwnerHwnd = GetAncestor(hwnd, GA_ROOTOWNER);
+ if (rootOwnerHwnd != hwnd) // May return itself for toplevels.
+ return rootOwnerHwnd;
+ }
+ return 0;
+}
+#endif // !Q_OS_WINCE
+
// Update the transient parent for a toplevel window. The concept does not
// really exist on Windows, the relationship is set by passing a parent along with !WS_CHILD
// to window creation or by setting the parent using GWL_HWNDPARENT (as opposed to
@@ -1112,12 +1136,13 @@ void QWindowsWindow::updateTransientParent() const
if (window()->type() == Qt::Popup)
return; // QTBUG-34503, // a popup stays on top, no parent, see also WindowCreationData::fromWindow().
// Update transient parent.
- const HWND oldTransientParent =
- GetAncestor(m_data.hwnd, GA_PARENT) == GetDesktopWindow() ? GetAncestor(m_data.hwnd, GA_ROOTOWNER) : HWND(0);
+ const HWND oldTransientParent = transientParentHwnd(m_data.hwnd);
HWND newTransientParent = 0;
if (const QWindow *tp = window()->transientParent())
- newTransientParent = QWindowsWindow::handleOf(tp);
- if (newTransientParent && newTransientParent != oldTransientParent)
+ if (const QWindowsWindow *tw = QWindowsWindow::baseWindowOf(tp))
+ if (!tw->testFlag(WithinDestroy)) // Prevent destruction by parent window (QTBUG-35499, QTBUG-36666)
+ newTransientParent = tw->handle();
+ if (newTransientParent != oldTransientParent)
SetWindowLongPtr(m_data.hwnd, GWL_HWNDPARENT, (LONG_PTR)newTransientParent);
#endif // !Q_OS_WINCE
}
diff --git a/src/plugins/platforms/winrt/qwinrtbackingstore.cpp b/src/plugins/platforms/winrt/qwinrtbackingstore.cpp
index b219548788..10136dbead 100644
--- a/src/plugins/platforms/winrt/qwinrtbackingstore.cpp
+++ b/src/plugins/platforms/winrt/qwinrtbackingstore.cpp
@@ -49,8 +49,6 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <dxgi.h>
-
// Generated shader headers
#include "blitps.h"
#include "blitvs.h"
@@ -60,10 +58,7 @@ namespace { // Utility namespace for writing out an ANGLE-compatible binary blob
// Must match packaged ANGLE
enum : quint32 {
AngleMajorVersion = 1,
- AngleMinorVersion = 2,
- AngleBuildRevision = 2446,
- AngleVersion = ((AngleMajorVersion << 24) | (AngleMinorVersion << 16) | AngleBuildRevision),
- AngleOptimizationLevel = (1 << 14)
+ AngleMinorVersion = 3
};
struct ShaderString
@@ -145,8 +140,8 @@ static const QByteArray createAngleBinary(
stream.setByteOrder(QDataStream::LittleEndian);
stream << quint32(GL_PROGRAM_BINARY_ANGLE)
- << quint32(AngleVersion)
- << quint32(AngleOptimizationLevel);
+ << qint32(AngleMajorVersion)
+ << qint32(AngleMinorVersion);
// Vertex attributes
for (int i = 0; i < 16; ++i) {
@@ -190,25 +185,6 @@ static const QByteArray createAngleBinary(
<< quint32(vertexShader.size())
<< quint32(geometryShader.size());
- // ANGLE requires that we query the adapter for its LUID. Later on, it may be useful
- // for checking feature level support, picking the best adapter on the system, etc.
- IDXGIFactory1 *dxgiFactory;
- if (FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&dxgiFactory)))) {
- qCritical("QWinRTBackingStore: failed to create DXGI factory.");
- return QByteArray();
- }
- IDXGIAdapter *dxgiAdapter;
- if (FAILED(dxgiFactory->EnumAdapters(0, &dxgiAdapter))) {
- qCritical("QWinRTBackingStore:: failed to enumerate adapter.");
- dxgiFactory->Release();
- return QByteArray();
- }
- DXGI_ADAPTER_DESC desc;
- dxgiAdapter->GetDesc(&desc);
- dxgiAdapter->Release();
- QByteArray guid(sizeof(GUID), '\0');
- memcpy(guid.data(), &desc.AdapterLuid, sizeof(LUID));
- stream.writeRawData(guid.constData(), guid.size());
stream.writeRawData(pixelShader.constData(), pixelShader.size());
stream.writeRawData(vertexShader.constData(), vertexShader.size());
if (!geometryShader.isEmpty())
diff --git a/src/plugins/platforms/winrt/winrt.pro b/src/plugins/platforms/winrt/winrt.pro
index 3bd688c069..6e3cfb1d20 100644
--- a/src/plugins/platforms/winrt/winrt.pro
+++ b/src/plugins/platforms/winrt/winrt.pro
@@ -9,7 +9,7 @@ QT += core-private gui-private platformsupport-private
DEFINES *= QT_NO_CAST_FROM_ASCII __WRL_NO_DEFAULT_LIB__ GL_GLEXT_PROTOTYPES
-LIBS += $$QMAKE_LIBS_CORE -ldxgi
+LIBS += $$QMAKE_LIBS_CORE
SOURCES = \
main.cpp \
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index f7abb4662b..ed2f685770 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -493,19 +493,21 @@ void QGLXContext::queryDummyContext()
m_supportsThreading = true;
- const char *renderer = (const char *) glGetString(GL_RENDERER);
- for (int i = 0; qglx_threadedgl_blacklist_renderer[i]; ++i) {
- if (strstr(renderer, qglx_threadedgl_blacklist_renderer[i]) != 0) {
- m_supportsThreading = false;
- break;
+ if (const char *renderer = (const char *) glGetString(GL_RENDERER)) {
+ for (int i = 0; qglx_threadedgl_blacklist_renderer[i]; ++i) {
+ if (strstr(renderer, qglx_threadedgl_blacklist_renderer[i]) != 0) {
+ m_supportsThreading = false;
+ break;
+ }
}
}
- const char *vendor = (const char *) glGetString(GL_VENDOR);
- for (int i = 0; qglx_threadedgl_blacklist_vendor[i]; ++i) {
- if (strstr(vendor, qglx_threadedgl_blacklist_vendor[i]) != 0) {
- m_supportsThreading = false;
- break;
+ if (const char *vendor = (const char *) glGetString(GL_VENDOR)) {
+ for (int i = 0; qglx_threadedgl_blacklist_vendor[i]; ++i) {
+ if (strstr(vendor, qglx_threadedgl_blacklist_vendor[i]) != 0) {
+ m_supportsThreading = false;
+ break;
+ }
}
}
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 768a591ab5..aaa2e81c40 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -253,7 +253,18 @@ QPlatformBackingStore *QXcbIntegration::createPlatformBackingStore(QWindow *wind
QPlatformOffscreenSurface *QXcbIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
{
#if defined(XCB_USE_GLX)
- return new QGLXPbuffer(surface);
+ static bool vendorChecked = false;
+ static bool glxPbufferUsable = true;
+ if (!vendorChecked) {
+ vendorChecked = true;
+ const char *glxvendor = glXGetClientString(glXGetCurrentDisplay(), GLX_VENDOR);
+ if (glxvendor && !strcmp(glxvendor, "ATI"))
+ glxPbufferUsable = false;
+ }
+ if (glxPbufferUsable)
+ return new QGLXPbuffer(surface);
+ else
+ return 0; // trigger fallback to hidden QWindow
#elif defined(XCB_USE_EGL)
QXcbScreen *screen = static_cast<QXcbScreen *>(surface->screen()->handle());
return new QEGLPbuffer(screen->connection()->egl_display(), surface->requestedFormat(), surface);
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index d0106984a2..29f71e6972 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1859,6 +1859,7 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
if (m_lastWindowStateEvent != newState) {
QWindowSystemInterface::handleWindowStateChanged(window(), newState);
m_lastWindowStateEvent = newState;
+ m_windowState = newState;
}
return;
}
diff --git a/src/plugins/printsupport/windows/qwindowsprintersupport.cpp b/src/plugins/printsupport/windows/qwindowsprintersupport.cpp
index 2faebf6f64..b7ba9ef5e7 100644
--- a/src/plugins/printsupport/windows/qwindowsprintersupport.cpp
+++ b/src/plugins/printsupport/windows/qwindowsprintersupport.cpp
@@ -101,9 +101,7 @@ QList<QPrinterInfo> QWindowsPrinterSupport::queryPrinters()
return result;
PPRINTER_INFO_4 infoList = reinterpret_cast<PPRINTER_INFO_4>(buffer.data());
QString defaultPrinterName;
- QString program;
- QString port;
- QWin32PrintEngine::queryDefaultPrinter(defaultPrinterName, program, port);
+ QWin32PrintEngine::queryDefaultPrinter(defaultPrinterName);
for (uint i = 0; i < returned; ++i) {
const QString printerName(QString::fromWCharArray(infoList[i].pPrinterName));
const bool isDefault = (printerName == defaultPrinterName);
diff --git a/src/printsupport/dialogs/qpagesetupdialog_win.cpp b/src/printsupport/dialogs/qpagesetupdialog_win.cpp
index 688f4ac314..345e698b82 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_win.cpp
+++ b/src/printsupport/dialogs/qpagesetupdialog_win.cpp
@@ -82,7 +82,7 @@ int QPageSetupDialog::exec()
// we need a temp DEVMODE struct if we don't have a global DEVMODE
HGLOBAL hDevMode = 0;
int devModeSize = 0;
- if (!ep->globalDevMode) {
+ if (!engine->globalDevMode()) {
devModeSize = sizeof(DEVMODE) + ep->devMode->dmDriverExtra;
hDevMode = GlobalAlloc(GHND, devModeSize);
if (hDevMode) {
@@ -92,10 +92,10 @@ int QPageSetupDialog::exec()
}
psd.hDevMode = hDevMode;
} else {
- psd.hDevMode = ep->devMode;
+ psd.hDevMode = engine->globalDevMode();
}
- HGLOBAL *tempDevNames = ep->createDevNames();
+ HGLOBAL *tempDevNames = engine->createGlobalDevNames();
psd.hDevNames = tempDevNames;
QWidget *parent = parentWidget();
@@ -129,8 +129,7 @@ int QPageSetupDialog::exec()
bool result = PageSetupDlg(&psd);
QDialog::setVisible(false);
if (result) {
- ep->readDevnames(psd.hDevNames);
- ep->readDevmode(psd.hDevMode);
+ engine->setGlobalDevMode(psd.hDevNames, psd.hDevMode);
QRect theseMargins = QRect(psd.rtMargin.left * multiplier,
psd.rtMargin.top * multiplier,
@@ -144,17 +143,15 @@ int QPageSetupDialog::exec()
psd.rtMargin.bottom * multiplier);
}
- ep->updateCustomPaperSize();
-
// copy from our temp DEVMODE struct
- if (!ep->globalDevMode && hDevMode) {
+ if (!engine->globalDevMode() && hDevMode) {
void *src = GlobalLock(hDevMode);
memcpy(ep->devMode, src, devModeSize);
GlobalUnlock(hDevMode);
}
}
- if (!ep->globalDevMode && hDevMode)
+ if (!engine->globalDevMode() && hDevMode)
GlobalFree(hDevMode);
GlobalFree(tempDevNames);
done(result);
diff --git a/src/printsupport/dialogs/qprintdialog_win.cpp b/src/printsupport/dialogs/qprintdialog_win.cpp
index b5dc2d016a..722f0e186f 100644
--- a/src/printsupport/dialogs/qprintdialog_win.cpp
+++ b/src/printsupport/dialogs/qprintdialog_win.cpp
@@ -68,12 +68,13 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate
Q_DECLARE_PUBLIC(QPrintDialog)
public:
QPrintDialogPrivate()
- : ep(0)
+ : engine(0), ep(0)
{
}
int openWindowsPrintDialogModally();
+ QWin32PrintEngine *engine;
QWin32PrintEnginePrivate *ep;
};
@@ -141,7 +142,7 @@ static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent,
pd->hwndOwner = parentWindow ? (HWND)QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", parentWindow) : 0;
pd->lpPageRanges[0].nFromPage = qMax(pdlg->fromPage(), pdlg->minPage());
pd->lpPageRanges[0].nToPage = (pdlg->toPage() > 0) ? qMin(pdlg->toPage(), pdlg->maxPage()) : 1;
- pd->nCopies = d->ep->num_copies;
+ pd->nCopies = d->printer->copyCount();
}
static void qt_win_read_back_PRINTDLGEX(PRINTDLGEX *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d)
@@ -162,12 +163,10 @@ static void qt_win_read_back_PRINTDLGEX(PRINTDLGEX *pd, QPrintDialog *pdlg, QPri
d->ep->printToFile = (pd->Flags & PD_PRINTTOFILE) != 0;
- d->ep->readDevnames(pd->hDevNames);
- d->ep->readDevmode(pd->hDevMode);
- d->ep->updateCustomPaperSize();
+ d->engine->setGlobalDevMode(pd->hDevNames, pd->hDevMode);
if (d->ep->printToFile && d->ep->fileName.isEmpty())
- d->ep->fileName = d->ep->port;
+ d->ep->fileName = QLatin1String("FILE:");
else if (!d->ep->printToFile && d->ep->fileName == QLatin1String("FILE:"))
d->ep->fileName.clear();
}
@@ -187,6 +186,7 @@ QPrintDialog::QPrintDialog(QPrinter *printer, QWidget *parent)
Q_D(QPrintDialog);
if (!warnIfNotNative(d->printer))
return;
+ d->engine = static_cast<QWin32PrintEngine *>(d->printer->printEngine());
d->ep = static_cast<QWin32PrintEngine *>(d->printer->printEngine())->d_func();
setAttribute(Qt::WA_DontShowOnScreen);
}
@@ -197,6 +197,7 @@ QPrintDialog::QPrintDialog(QWidget *parent)
Q_D(QPrintDialog);
if (!warnIfNotNative(d->printer))
return;
+ d->engine = static_cast<QWin32PrintEngine *>(d->printer->printEngine());
d->ep = static_cast<QWin32PrintEngine *>(d->printer->printEngine())->d_func();
setAttribute(Qt::WA_DontShowOnScreen);
}
@@ -229,7 +230,7 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally()
q->QDialog::setVisible(true);
- HGLOBAL *tempDevNames = ep->createDevNames();
+ HGLOBAL *tempDevNames = engine->createGlobalDevNames();
bool done;
bool result;
@@ -278,7 +279,7 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally()
{
qt_win_read_back_PRINTDLGEX(&pd, q, this);
// update printer validity
- printer->d_func()->validPrinter = !ep->name.isEmpty();
+ printer->d_func()->validPrinter = !printer->printerName().isEmpty();
}
// Cleanup...
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index 74484bfc8c..02b5d824f4 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -260,10 +260,6 @@ bool QWin32PrintEngine::begin(QPaintDevice *pdev)
if (!d->hdc)
return false;
- // Assign the FILE: to get the query...
- if (d->printToFile && d->fileName.isEmpty())
- d->fileName = d->port;
-
d->devMode->dmCopies = d->num_copies;
DOCINFO di;
@@ -275,6 +271,8 @@ bool QWin32PrintEngine::begin(QPaintDevice *pdev)
di.lpszDocName = reinterpret_cast<const wchar_t *>(d->docName.utf16());
if (d->printToFile && !d->fileName.isEmpty())
di.lpszOutput = reinterpret_cast<const wchar_t *>(d->fileName.utf16());
+ if (d->printToFile)
+ di.lpszOutput = d->fileName.isEmpty() ? L"FILE:" : reinterpret_cast<const wchar_t *>(d->fileName.utf16());
if (ok && StartDoc(d->hdc, &di) == SP_ERROR) {
qErrnoWarning("QWin32PrintEngine::begin: StartDoc failed");
ok = false;
@@ -1039,7 +1037,7 @@ void QWin32PrintEngine::drawPolygon(const QPointF *points, int pointCount, Polyg
void QWin32PrintEnginePrivate::queryDefault()
{
- QWin32PrintEngine::queryDefaultPrinter(name, program, port);
+ QWin32PrintEngine::queryDefaultPrinter(name);
}
QWin32PrintEnginePrivate::~QWin32PrintEnginePrivate()
@@ -1088,8 +1086,7 @@ void QWin32PrintEnginePrivate::initialize()
}
devMode = pInfo->pDevMode;
- hdc = CreateDC(reinterpret_cast<const wchar_t *>(program.utf16()),
- reinterpret_cast<const wchar_t *>(name.utf16()), 0, devMode);
+ hdc = CreateDC(NULL, reinterpret_cast<const wchar_t *>(name.utf16()), 0, devMode);
Q_ASSERT(hPrinter);
Q_ASSERT(pInfo);
@@ -1216,15 +1213,13 @@ QList<QVariant> QWin32PrintEnginePrivate::queryResolutions() const
// Read the supported resolutions of the printer.
QList<QVariant> list;
- DWORD numRes = DeviceCapabilities(reinterpret_cast<const wchar_t *>(name.utf16()),
- reinterpret_cast<const wchar_t *>(port.utf16()),
+ DWORD numRes = DeviceCapabilities(reinterpret_cast<const wchar_t *>(name.utf16()), NULL,
DC_ENUMRESOLUTIONS, 0, 0);
if (numRes == (DWORD)-1)
return list;
LONG *enumRes = (LONG*)malloc(numRes * 2 * sizeof(LONG));
- DWORD errRes = DeviceCapabilities(reinterpret_cast<const wchar_t *>(name.utf16()),
- reinterpret_cast<const wchar_t *>(port.utf16()),
+ DWORD errRes = DeviceCapabilities(reinterpret_cast<const wchar_t *>(name.utf16()), NULL,
DC_ENUMRESOLUTIONS, (LPWSTR)enumRes, 0);
if (errRes == (DWORD)-1) {
@@ -1675,15 +1670,13 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
case PPK_PaperSources:
{
- int available = DeviceCapabilities((const wchar_t *)d->name.utf16(),
- (const wchar_t *)d->port.utf16(), DC_BINS, 0, d->devMode);
+ int available = DeviceCapabilities((const wchar_t *)d->name.utf16(), NULL, DC_BINS, 0, d->devMode);
if (available <= 0)
break;
wchar_t *data = new wchar_t[available];
- int count = DeviceCapabilities((const wchar_t *)d->name.utf16(),
- (const wchar_t *)d->port.utf16(), DC_BINS, data, d->devMode);
+ int count = DeviceCapabilities((const wchar_t *)d->name.utf16(), NULL, DC_BINS, data, d->devMode);
QList<QVariant> out;
for (int i=0; i<count; ++i) {
@@ -1783,7 +1776,7 @@ QList<QPair<QString, QSizeF> > QWin32PrintEngine::supportedSizesWithNames(const
return paperSizes;
}
-void QWin32PrintEngine::queryDefaultPrinter(QString &name, QString &program, QString &port)
+void QWin32PrintEngine::queryDefaultPrinter(QString &name)
{
/* Read the default printer name, driver and port with the intuitive function
* Strings "windows" and "device" are specified in the MSDN under EnumPrinters()
@@ -1802,77 +1795,59 @@ void QWin32PrintEngine::queryDefaultPrinter(QString &name, QString &program, QSt
if (infoSize > 0) {
if (name.isEmpty())
name = info.at(0);
- if (program.isEmpty() && infoSize > 1)
- program = info.at(1);
- if (port.isEmpty() && infoSize > 2)
- port = info.at(2);
}
}
-HGLOBAL *QWin32PrintEnginePrivate::createDevNames()
+HGLOBAL *QWin32PrintEngine::createGlobalDevNames()
{
- int size = sizeof(DEVNAMES)
- + program.length() * 2 + 2
- + name.length() * 2 + 2
- + port.length() * 2 + 2;
+ Q_D(QWin32PrintEngine);
+
+ int size = sizeof(DEVNAMES) + d->name.length() * 2 + 2;
HGLOBAL *hGlobal = (HGLOBAL *) GlobalAlloc(GMEM_MOVEABLE, size);
DEVNAMES *dn = (DEVNAMES*) GlobalLock(hGlobal);
- dn->wDriverOffset = sizeof(DEVNAMES) / sizeof(wchar_t);
- dn->wDeviceOffset = dn->wDriverOffset + program.length() + 1;
- dn->wOutputOffset = dn->wDeviceOffset + name.length() + 1;
+ dn->wDriverOffset = 0;
+ dn->wDeviceOffset = sizeof(DEVNAMES) / sizeof(wchar_t);
+ dn->wOutputOffset = 0;
- memcpy((ushort*)dn + dn->wDriverOffset, program.utf16(), program.length() * 2 + 2);
- memcpy((ushort*)dn + dn->wDeviceOffset, name.utf16(), name.length() * 2 + 2);
- memcpy((ushort*)dn + dn->wOutputOffset, port.utf16(), port.length() * 2 + 2);
+ memcpy((ushort*)dn + dn->wDeviceOffset, d->name.utf16(), d->name.length() * 2 + 2);
dn->wDefault = 0;
GlobalUnlock(hGlobal);
-
-// printf("QPrintDialogWinPrivate::createDevNames()\n"
-// " -> wDriverOffset: %d\n"
-// " -> wDeviceOffset: %d\n"
-// " -> wOutputOffset: %d\n",
-// dn->wDriverOffset,
-// dn->wDeviceOffset,
-// dn->wOutputOffset);
-
-// printf("QPrintDialogWinPrivate::createDevNames(): %s, %s, %s\n",
-// QString::fromWCharArray((wchar_t*)(dn) + dn->wDriverOffset).latin1(),
-// QString::fromWCharArray((wchar_t*)(dn) + dn->wDeviceOffset).latin1(),
-// QString::fromWCharArray((wchar_t*)(dn) + dn->wOutputOffset).latin1());
-
return hGlobal;
}
-void QWin32PrintEnginePrivate::readDevnames(HGLOBAL globalDevnames)
+void QWin32PrintEngine::setGlobalDevMode(HGLOBAL globalDevNames, HGLOBAL globalDevMode)
{
- if (globalDevnames) {
- DEVNAMES *dn = (DEVNAMES*) GlobalLock(globalDevnames);
- name = QString::fromWCharArray((wchar_t*)(dn) + dn->wDeviceOffset);
- port = QString::fromWCharArray((wchar_t*)(dn) + dn->wOutputOffset);
- program = QString::fromWCharArray((wchar_t*)(dn) + dn->wDriverOffset);
- GlobalUnlock(globalDevnames);
+ Q_D(QWin32PrintEngine);
+ if (globalDevNames) {
+ DEVNAMES *dn = (DEVNAMES*) GlobalLock(globalDevNames);
+ d->name = QString::fromWCharArray((wchar_t*)(dn) + dn->wDeviceOffset);
+ GlobalUnlock(globalDevNames);
}
-}
-void QWin32PrintEnginePrivate::readDevmode(HGLOBAL globalDevmode)
-{
- if (globalDevmode) {
- DEVMODE *dm = (DEVMODE*) GlobalLock(globalDevmode);
- release();
- globalDevMode = globalDevmode;
- devMode = dm;
- hdc = CreateDC(reinterpret_cast<const wchar_t *>(program.utf16()),
- reinterpret_cast<const wchar_t *>(name.utf16()), 0, dm);
+ if (globalDevMode) {
+ DEVMODE *dm = (DEVMODE*) GlobalLock(globalDevMode);
+ d->release();
+ d->globalDevMode = globalDevMode;
+ d->devMode = dm;
+ d->hdc = CreateDC(NULL, reinterpret_cast<const wchar_t *>(d->name.utf16()), 0, dm);
- num_copies = devMode->dmCopies;
- if (!OpenPrinter((wchar_t*)name.utf16(), &hPrinter, 0))
+ d->num_copies = d->devMode->dmCopies;
+ d->updateCustomPaperSize();
+
+ if (!OpenPrinter((wchar_t*)d->name.utf16(), &d->hPrinter, 0))
qWarning("QPrinter: OpenPrinter() failed after reading DEVMODE.");
}
- if (hdc)
- initHDC();
+ if (d->hdc)
+ d->initHDC();
+}
+
+HGLOBAL QWin32PrintEngine::globalDevMode()
+{
+ Q_D(QWin32PrintEngine);
+ return d->globalDevMode;
}
static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC hdc,
diff --git a/src/printsupport/kernel/qprintengine_win_p.h b/src/printsupport/kernel/qprintengine_win_p.h
index 040140d50f..d720561c2a 100644
--- a/src/printsupport/kernel/qprintengine_win_p.h
+++ b/src/printsupport/kernel/qprintengine_win_p.h
@@ -107,7 +107,13 @@ public:
static QList<QPrinter::PaperSize> supportedPaperSizes(const QPrinterInfo &printerInfo);
static QList<QPair<QString, QSizeF> > supportedSizesWithNames(const QPrinterInfo &printerInfo);
- static void queryDefaultPrinter(QString &name, QString &program, QString &port);
+
+ /* Used by print/page setup dialogs */
+ void setGlobalDevMode(HGLOBAL globalDevNames, HGLOBAL globalDevMode);
+ HGLOBAL *createGlobalDevNames();
+ HGLOBAL globalDevMode();
+
+ static void queryDefaultPrinter(QString &name);
private:
friend class QPrintDialog;
@@ -166,12 +172,6 @@ public:
is handled in the next begin or newpage. */
void doReinit();
- /* Used by print/page setup dialogs */
- HGLOBAL *createDevNames();
-
- void readDevmode(HGLOBAL globalDevmode);
- void readDevnames(HGLOBAL globalDevnames);
-
inline bool resetDC() {
hdc = ResetDC(hdc, devMode);
return hdc != 0;
@@ -205,8 +205,6 @@ public:
// Printer info
QString name;
- QString program;
- QString port;
// Document info
QString docName;
diff --git a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
index a17628155a..7bcae3bf74 100644
--- a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
+++ b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
@@ -260,5 +260,16 @@ void TestBenchmark::simple()
}
//! [27]
+//! [28]
+QTest::keyClick(myWindow, 'a');
+//! [28]
+
+
+//! [29]
+QTest::keyClick(myWindow, Qt::Key_Escape);
+
+QTest::keyClick(myWindow, Qt::Key_Escape, Qt::ShiftModifier, 200);
+//! [29]
+
}
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 6c1df8815c..10bf200f4f 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -567,8 +567,24 @@ QT_BEGIN_NAMESPACE
\value MouseMove The mouse pointer has moved.
*/
-/*! \fn void QTest::keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+/*! \fn void QTest::keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+
+ Simulates clicking of \a key with an optional \a modifier on a \a widget.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds
+ before clicking the key.
+
+ Examples:
+ \snippet code/src_qtestlib_qtestcase.cpp 14
+
+ The first example above simulates clicking the \c escape key on \c
+ myWidget without any keyboard modifiers and without delay. The
+ second example simulates clicking \c shift-escape on \c myWidget
+ following a 200 ms delay of the test.
+
+ \sa QTest::keyClicks()
+*/
+/*! \fn void QTest::keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
\overload
Simulates clicking of \a key with an optional \a modifier on a \a widget.
@@ -584,23 +600,42 @@ QT_BEGIN_NAMESPACE
\sa QTest::keyClicks()
*/
-/*! \fn void QTest::keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+/*! \fn void QTest::keyClick(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ \overload
+ \since 5.0
- Simulates clicking of \a key with an optional \a modifier on a \a widget.
+ Simulates clicking of \a key with an optional \a modifier on a \a window.
If \a delay is larger than 0, the test will wait for \a delay milliseconds
before clicking the key.
Examples:
- \snippet code/src_qtestlib_qtestcase.cpp 14
+ \snippet code/src_qtestlib_qtestcase.cpp 29
The first example above simulates clicking the \c escape key on \c
- myWidget without any keyboard modifiers and without delay. The
- second example simulates clicking \c shift-escape on \c myWidget
+ myWindow without any keyboard modifiers and without delay. The
+ second example simulates clicking \c shift-escape on \c myWindow
following a 200 ms delay of the test.
\sa QTest::keyClicks()
*/
+/*! \fn void QTest::keyClick(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ \overload
+ \since 5.0
+
+ Simulates clicking of \a key with an optional \a modifier on a \a window.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds
+ before clicking the key.
+
+ Example:
+ \snippet code/src_qtestlib_qtestcase.cpp 28
+
+ The example above simulates clicking \c a on \c myWindow without
+ any keyboard modifiers and without delay of the test.
+
+ \sa QTest::keyClicks()
+*/
+
/*! \fn void QTest::keyEvent(KeyAction action, QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
Sends a Qt key event to \a widget with the given \a key and an associated \a action.
@@ -609,13 +644,29 @@ QT_BEGIN_NAMESPACE
*/
/*! \fn void QTest::keyEvent(KeyAction action, QWidget *widget, char ascii, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
-
\overload
Sends a Qt key event to \a widget with the given key \a ascii and an associated \a action.
Optionally, a keyboard \a modifier can be specified, as well as a \a delay
(in milliseconds) of the test before sending the event.
+*/
+
+/*! \fn void QTest::keyEvent(KeyAction action, QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ \overload
+ \since 5.0
+
+ Sends a Qt key event to \a window with the given \a key and an associated \a action.
+ Optionally, a keyboard \a modifier can be specified, as well as a \a delay
+ (in milliseconds) of the test before sending the event.
+*/
+/*! \fn void QTest::keyEvent(KeyAction action, QWindow *window, char ascii, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ \overload
+ \since 5.0
+
+ Sends a Qt key event to \a window with the given key \a ascii and an associated \a action.
+ Optionally, a keyboard \a modifier can be specified, as well as a \a delay
+ (in milliseconds) of the test before sending the event.
*/
/*! \fn void QTest::keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
@@ -629,7 +680,6 @@ QT_BEGIN_NAMESPACE
*/
/*! \fn void QTest::keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
-
\overload
Simulates pressing a \a key with an optional \a modifier on a \a widget.
@@ -641,6 +691,31 @@ QT_BEGIN_NAMESPACE
\sa QTest::keyRelease(), QTest::keyClick()
*/
+/*! \fn void QTest::keyPress(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ \overload
+ \since 5.0
+
+ Simulates pressing a \a key with an optional \a modifier on a \a window. If \a delay
+ is larger than 0, the test will wait for \a delay milliseconds before pressing the key.
+
+ \b {Note:} At some point you should release the key using \l keyRelease().
+
+ \sa QTest::keyRelease(), QTest::keyClick()
+*/
+
+/*! \fn void QTest::keyPress(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ \overload
+ \since 5.0
+
+ Simulates pressing a \a key with an optional \a modifier on a \a window.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds
+ before pressing the key.
+
+ \b {Note:} At some point you should release the key using \l keyRelease().
+
+ \sa QTest::keyRelease(), QTest::keyClick()
+*/
+
/*! \fn void QTest::keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
Simulates releasing a \a key with an optional \a modifier on a \a widget.
@@ -651,7 +726,6 @@ QT_BEGIN_NAMESPACE
*/
/*! \fn void QTest::keyRelease(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
-
\overload
Simulates releasing a \a key with an optional \a modifier on a \a widget.
@@ -661,6 +735,27 @@ QT_BEGIN_NAMESPACE
\sa QTest::keyClick()
*/
+/*! \fn void QTest::keyRelease(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ \overload
+ \since 5.0
+
+ Simulates releasing a \a key with an optional \a modifier on a \a window.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds
+ before releasing the key.
+
+ \sa QTest::keyPress(), QTest::keyClick()
+*/
+
+/*! \fn void QTest::keyRelease(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ \overload
+ \since 5.0
+
+ Simulates releasing a \a key with an optional \a modifier on a \a window.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds
+ before releasing the key.
+
+ \sa QTest::keyClick()
+*/
/*! \fn void QTest::keyClicks(QWidget *widget, const QString &sequence, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
@@ -679,6 +774,18 @@ QT_BEGIN_NAMESPACE
\sa QTest::keyClick()
*/
+/*! \fn void QTest::waitForEvents()
+ \internal
+*/
+
+/*! \fn void QTest::mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
+ \internal
+*/
+
+/*! \fn void QTest::mouseEvent(MouseAction action, QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
+ \internal
+*/
+
/*! \fn void QTest::mousePress(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = 0, QPoint pos = QPoint(), int delay=-1)
Simulates pressing a mouse \a button with an optional \a modifier
@@ -690,6 +797,19 @@ QT_BEGIN_NAMESPACE
\sa QTest::mouseRelease(), QTest::mouseClick()
*/
+/*! \fn void QTest::mousePress(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, QPoint pos = QPoint(), int delay=-1)
+ \overload
+ \since 5.0
+
+ Simulates pressing a mouse \a button with an optional \a stateKey modifier
+ on a \a window. The position is defined by \a pos; the default
+ position is the center of the window. If \a delay is specified,
+ the test will wait for the specified amount of milliseconds before
+ the press.
+
+ \sa QTest::mouseRelease(), QTest::mouseClick()
+*/
+
/*! \fn void QTest::mouseRelease(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = 0, QPoint pos = QPoint(), int delay=-1)
Simulates releasing a mouse \a button with an optional \a modifier
@@ -701,6 +821,19 @@ QT_BEGIN_NAMESPACE
\sa QTest::mousePress(), QTest::mouseClick()
*/
+/*! \fn void QTest::mouseRelease(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, QPoint pos = QPoint(), int delay=-1)
+ \overload
+ \since 5.0
+
+ Simulates releasing a mouse \a button with an optional \a stateKey modifier
+ on a \a window. The position of the release is defined by \a pos;
+ the default position is the center of the window. If \a delay is
+ specified, the test will wait for the specified amount of
+ milliseconds before releasing the button.
+
+ \sa QTest::mousePress(), QTest::mouseClick()
+*/
+
/*! \fn void QTest::mouseClick(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = 0, QPoint pos = QPoint(), int delay=-1)
Simulates clicking a mouse \a button with an optional \a modifier
@@ -712,6 +845,19 @@ QT_BEGIN_NAMESPACE
\sa QTest::mousePress(), QTest::mouseRelease()
*/
+/*! \fn void QTest::mouseClick(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, QPoint pos = QPoint(), int delay=-1)
+ \overload
+ \since 5.0
+
+ Simulates clicking a mouse \a button with an optional \a stateKey modifier
+ on a \a window. The position of the click is defined by \a pos;
+ the default position is the center of the window. If \a delay is
+ specified, the test will wait for the specified amount of
+ milliseconds before pressing and before releasing the button.
+
+ \sa QTest::mousePress(), QTest::mouseRelease()
+*/
+
/*! \fn void QTest::mouseDClick(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = 0, QPoint pos = QPoint(), int delay=-1)
Simulates double clicking a mouse \a button with an optional \a
@@ -723,6 +869,19 @@ QT_BEGIN_NAMESPACE
\sa QTest::mouseClick()
*/
+/*! \fn void QTest::mouseDClick(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, QPoint pos = QPoint(), int delay=-1)
+ \overload
+ \since 5.0
+
+ Simulates double clicking a mouse \a button with an optional \a stateKey
+ modifier on a \a window. The position of the click is defined by
+ \a pos; the default position is the center of the window. If \a
+ delay is specified, the test will wait for the specified amount of
+ milliseconds before each press and release.
+
+ \sa QTest::mouseClick()
+*/
+
/*! \fn void QTest::mouseMove(QWidget *widget, QPoint pos = QPoint(), int delay=-1)
Moves the mouse pointer to a \a widget. If \a pos is not
@@ -731,6 +890,16 @@ QT_BEGIN_NAMESPACE
moving the mouse pointer.
*/
+/*! \fn void QTest::mouseMove(QWindow *window, QPoint pos = QPoint(), int delay=-1)
+ \overload
+ \since 5.0
+
+ Moves the mouse pointer to a \a window. If \a pos is not
+ specified, the mouse pointer moves to the center of the window. If
+ a \a delay (in milliseconds) is given, the test will wait before
+ moving the mouse pointer.
+*/
+
/*!
\fn char *QTest::toString(const T &value)
@@ -2273,6 +2442,9 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
#ifdef QTESTLIB_USE_VALGRIND
if (QBenchmarkGlobalData::current->mode() == QBenchmarkGlobalData::CallgrindParentProcess) {
+ if (!qApp)
+ qFatal("QtTest: -callgrind option is not available with QTEST_APPLESS_MAIN");
+
const QStringList origAppArgs(QCoreApplication::arguments());
if (!QBenchmarkValgrindUtils::rerunThroughCallgrind(origAppArgs, callgrindChildExitCode))
return -1;
@@ -2448,6 +2620,9 @@ static inline bool isWindowsBuildDirectory(const QString &dirName)
}
#endif
+/*! \internal
+ */
+
QString QTest::qFindTestData(const QString& base, const char *file, int line, const char *builddir)
{
QString found;
@@ -2726,7 +2901,7 @@ bool QTest::compare_helper(bool success, const char *failureMsg,
}
/*! \fn bool QTest::qCompare(float const &t1, float const &t2, const char *actual, const char *expected, const char *file, int line)
-\internal
+ \internal
*/
bool QTest::qCompare(float const &t1, float const &t2, const char *actual, const char *expected,
const char *file, int line)
@@ -2736,7 +2911,7 @@ bool QTest::qCompare(float const &t1, float const &t2, const char *actual, const
}
/*! \fn bool QTest::qCompare(double const &t1, double const &t2, const char *actual, const char *expected, const char *file, int line)
-\internal
+ \internal
*/
bool QTest::qCompare(double const &t1, double const &t2, const char *actual, const char *expected,
const char *file, int line)
@@ -2745,6 +2920,14 @@ bool QTest::qCompare(double const &t1, double const &t2, const char *actual, con
toString(t1), toString(t2), actual, expected, file, line);
}
+/*! \fn bool QTest::qCompare(double const &t1, float const &t2, const char *actual, const char *expected, const char *file, int line)
+ \internal
+ */
+
+/*! \fn bool QTest::qCompare(float const &t1, double const &t2, const char *actual, const char *expected, const char *file, int line)
+ \internal
+ */
+
#define TO_STRING_IMPL(TYPE, FORMAT) \
template <> Q_TESTLIB_EXPORT char *QTest::toString<TYPE >(const TYPE &t) \
{ \
@@ -2807,12 +2990,11 @@ bool QTest::compare_string_helper(const char *t1, const char *t2, const char *ac
\internal
*/
-
-/*! \fn void QTest::mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
+/*! \fn bool QTest::qCompare(QIcon const &t1, QIcon const &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(QIcon const &t1, QIcon const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(QImage const &t1, QImage const &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
@@ -2916,12 +3098,24 @@ bool QTest::compare_string_helper(const char *t1, const char *t2, const char *ac
\internal
*/
+/*! \fn void QTest::sendKeyEvent(KeyAction action, QWindow *window, Qt::Key code, QString text, Qt::KeyboardModifiers modifier, int delay=-1)
+ \internal
+*/
+
/*! \fn void QTest::sendKeyEvent(KeyAction action, QWidget *widget, Qt::Key code, char ascii, Qt::KeyboardModifiers modifier, int delay=-1)
\internal
*/
+/*! \fn void QTest::sendKeyEvent(KeyAction action, QWindow *window, Qt::Key code, char ascii, Qt::KeyboardModifiers modifier, int delay=-1)
+ \internal
+*/
+
/*! \fn void QTest::simulateEvent(QWidget *widget, bool press, int code, Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay=-1)
\internal
*/
+/*! \fn void QTest::simulateEvent(QWindow *window, bool press, int code, Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay=-1)
+ \internal
+*/
+
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index 511dc3240f..1eef42dc2f 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -1465,7 +1465,7 @@ void HtmlGenerator::generateDocNode(DocNode* dn, CodeMarker* marker)
// Replace the marker with a QML code marker.
marker = CodeMarker::markerForLanguage(QLatin1String("QML"));
}
- else if (dn->subType() != Node::Collision && dn->name() != QString("index.html"))
+ else if (dn->subType() != Node::Collision && dn->name() != QString("index.html") && dn->name() != QString("qtexamplesandtutorials.html"))
generateTableOfContents(dn,marker,0);
generateTitle(fullTitle,
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 1c580ce143..3e4490e890 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -2739,9 +2739,8 @@ void QFileDialogPrivate::init(const QString &directory, const QString &nameFilte
q->selectFile(initialSelection(directory));
#ifndef QT_NO_SETTINGS
- QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
- settings.beginGroup(QLatin1String("Qt"));
- q->restoreState(settings.value(QLatin1String("filedialog")).toByteArray());
+ const QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
+ q->restoreState(settings.value(QLatin1String("Qt/filedialog")).toByteArray());
#endif
#if defined(Q_EMBEDDED_SMALLSCREEN)
@@ -2888,6 +2887,11 @@ void QFileDialogPrivate::createWidgets()
createToolButtons();
createMenuActions();
+#ifndef QT_NO_SETTINGS
+ const QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
+ q->restoreState(settings.value(QLatin1String("Qt/filedialog")).toByteArray());
+#endif
+
// Initial widget states from options
q->setFileMode(static_cast<QFileDialog::FileMode>(options->fileMode()));
q->setAcceptMode(static_cast<QFileDialog::AcceptMode>(options->acceptMode()));
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index bda448bde3..c31a674cc7 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -107,7 +107,7 @@ QT_BEGIN_NAMESPACE
\snippet shareddirmodel/main.cpp 7
The view's root index can be used to control how much of a
- hierarchical model is displayed. QDirModel provides a convenience
+ hierarchical model is displayed. QFileSystemModel provides a convenience
function that returns a suitable model index for a path to a
directory within the model.
@@ -401,9 +401,18 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
for (int i = 0; i < pathElements.count(); ++i) {
QString element = pathElements.at(i);
#ifdef Q_OS_WIN
- // On Windows, "filename......." and "filename" are equivalent Task #133928
- while (element.endsWith(QLatin1Char('.')))
+ // On Windows, "filename " and "filename" are equivalent and
+ // "filename . " and "filename" are equivalent
+ // "filename......." and "filename" are equivalent Task #133928
+ // whereas "filename .txt" is still "filename .txt"
+ // If after stripping the characters there is nothing left then we
+ // just return the parent directory as it is assumed that the path
+ // is referring to the parent
+ while (element.endsWith(QLatin1Char('.')) || element.endsWith(QLatin1Char(' ')))
element.chop(1);
+ // Only filenames that can't possibly exist will be end up being empty
+ if (element.isEmpty())
+ return parent;
#endif
bool alreadyExisted = parent->children.contains(element);
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 3080d5f1e8..207fe3d527 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -2697,8 +2697,8 @@ QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb
void QMessageBoxPrivate::initHelper(QPlatformDialogHelper *h)
{
Q_Q(QMessageBox);
- QObject::connect(h, SIGNAL(clicked(QPlatformDialogHelper::StandardButton, QPlatformDialogHelper::ButtonRole)),
- q, SLOT(_q_clicked(QPlatformDialogHelper::StandardButton, QPlatformDialogHelper::ButtonRole)));
+ QObject::connect(h, SIGNAL(clicked(QPlatformDialogHelper::StandardButton,QPlatformDialogHelper::ButtonRole)),
+ q, SLOT(_q_clicked(QPlatformDialogHelper::StandardButton,QPlatformDialogHelper::ButtonRole)));
static_cast<QPlatformMessageDialogHelper *>(h)->setOptions(options);
}
diff --git a/src/widgets/doc/src/modelview.qdoc b/src/widgets/doc/src/modelview.qdoc
index f094a58a91..3b33e21ec2 100644
--- a/src/widgets/doc/src/modelview.qdoc
+++ b/src/widgets/doc/src/modelview.qdoc
@@ -816,7 +816,7 @@
\row
\li Dir View
\li QTreeView
- \li QDirModel
+ \li QFileSystemModel
\li Very small example to demonstrate how to assign a model to a view
\row
\li Editable Tree Model
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index dd430435f3..781dd345bd 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -754,6 +754,8 @@ void QTreeView::expand(const QModelIndex &index)
return;
if (index.flags() & Qt::ItemNeverHasChildren)
return;
+ if (d->isIndexExpanded(index))
+ return;
if (d->delayedPendingLayout) {
//A complete relayout is going to be performed, just store the expanded index, no need to layout.
if (d->storeExpanded(index))
@@ -785,6 +787,8 @@ void QTreeView::collapse(const QModelIndex &index)
Q_D(QTreeView);
if (!d->isIndexValid(index))
return;
+ if (!d->isIndexExpanded(index))
+ return;
//if the current item is now invisible, the autoscroll will expand the tree to see it, so disable the autoscroll
d->delayedAutoScroll.stop();
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 9bc1576dc6..c01b535067 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1749,7 +1749,8 @@ bool QApplicationPrivate::tryCloseAllWidgetWindows(QWindowList *processedWindows
QWidgetList list = QApplication::topLevelWidgets();
for (int i = 0; i < list.size(); ++i) {
QWidget *w = list.at(i);
- if (w->isVisible() && w->windowType() != Qt::Desktop && !w->data->is_closing) {
+ if (w->isVisible() && w->windowType() != Qt::Desktop &&
+ !w->testAttribute(Qt::WA_DontShowOnScreen) && !w->data->is_closing) {
QWindow *window = w->windowHandle();
if (!w->close()) // Qt::WA_DeleteOnClose may cause deletion.
return false;
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 46aa93fe48..ba8147c4a6 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -2404,7 +2404,8 @@ void QWidget::setStyleSheet(const QString& styleSheet)
}
if (proxy) { // style sheet update
- proxy->repolish(this);
+ if (d->polished)
+ proxy->repolish(this);
return;
}
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index dc918657b4..43e2ccdf0b 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -73,16 +73,16 @@ extern QRegion qt_dirtyRegion(QWidget *);
* \a tlwOffset is the position of the top level widget relative to the window surface.
* \a region is the region to be updated in \a widget coordinates.
*/
-static inline void qt_flush(QWidget *widget, const QRegion &region, QBackingStore *backingStore,
- QWidget *tlw, const QPoint &tlwOffset, QPlatformTextureList *widgetTextures = 0,
- QOpenGLContext *context = 0)
+void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion &region, QBackingStore *backingStore,
+ QWidget *tlw, const QPoint &tlwOffset, QPlatformTextureList *widgetTextures)
{
#ifdef QT_NO_OPENGL
Q_UNUSED(widgetTextures);
- Q_UNUSED(context);
+ Q_ASSERT(!region.isEmpty());
+#else
+ Q_ASSERT(!region.isEmpty() || (widgetTextures && widgetTextures->count()));
#endif
Q_ASSERT(widget);
- Q_ASSERT(!region.isEmpty() || (context && widgetTextures && widgetTextures->count()));
Q_ASSERT(backingStore);
Q_ASSERT(tlw);
@@ -117,7 +117,7 @@ static inline void qt_flush(QWidget *widget, const QRegion &region, QBackingStor
#ifndef QT_NO_OPENGL
if (widgetTextures)
- backingStore->handle()->composeAndFlush(widget->windowHandle(), region, offset, widgetTextures, context);
+ backingStore->handle()->composeAndFlush(widget->windowHandle(), region, offset, widgetTextures, tlw->d_func()->shareContext());
else
#endif
backingStore->flush(region, widget->windowHandle(), offset);
@@ -751,8 +751,9 @@ QWidgetBackingStore::~QWidgetBackingStore()
for (int c = 0; c < dirtyWidgets.size(); ++c) {
resetWidget(dirtyWidgets.at(c));
}
-
+#ifndef QT_NO_OPENGL
delete dirtyOnScreenWidgets;
+#endif
dirtyOnScreenWidgets = 0;
}
@@ -936,7 +937,7 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg
// Nothing to repaint.
if (!isDirty()) {
- qt_flush(exposedWidget, exposedRegion, store, tlw, tlwOffset, widgetTextures, tlw->d_func()->shareContext());
+ qt_flush(exposedWidget, exposedRegion, store, tlw, tlwOffset, widgetTextures);
return;
}
@@ -961,7 +962,6 @@ static void findTextureWidgetsRecursively(QWidget *tlw, QWidget *widget, QPlatfo
findTextureWidgetsRecursively(tlw, w, widgetTextures);
}
}
-#endif
QPlatformTextureListWatcher::QPlatformTextureListWatcher(QWidgetBackingStore *backingStore)
: m_locked(false),
@@ -981,6 +981,7 @@ void QPlatformTextureListWatcher::onLockStatusChanged(bool locked)
if (!locked)
m_backingStore->sync();
}
+#endif // QT_NO_OPENGL
/*!
Synchronizes the backing store, i.e. dirty areas are repainted and flushed.
@@ -1005,6 +1006,7 @@ void QWidgetBackingStore::sync()
return;
}
+#ifndef QT_NO_OPENGL
if (textureListWatcher && !textureListWatcher->isLocked()) {
textureListWatcher->deleteLater();
textureListWatcher = 0;
@@ -1015,6 +1017,7 @@ void QWidgetBackingStore::sync()
textureListWatcher->watch(widgetTextures);
return;
}
+#endif
doSync();
}
@@ -1190,7 +1193,7 @@ void QWidgetBackingStore::flush(QWidget *widget)
{
if (!dirtyOnScreen.isEmpty()) {
QWidget *target = widget ? widget : tlw;
- qt_flush(target, dirtyOnScreen, store, tlw, tlwOffset, widgetTextures, tlw->d_func()->shareContext());
+ qt_flush(target, dirtyOnScreen, store, tlw, tlwOffset, widgetTextures);
dirtyOnScreen = QRegion();
}
@@ -1198,7 +1201,7 @@ void QWidgetBackingStore::flush(QWidget *widget)
#ifndef QT_NO_OPENGL
if (widgetTextures && widgetTextures->count()) {
QWidget *target = widget ? widget : tlw;
- qt_flush(target, QRegion(), store, tlw, tlwOffset, widgetTextures, tlw->d_func()->shareContext());
+ qt_flush(target, QRegion(), store, tlw, tlwOffset, widgetTextures);
}
#endif
return;
diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h
index 2fe58fa4a7..e362ee4ac1 100644
--- a/src/widgets/kernel/qwidgetbackingstore_p.h
+++ b/src/widgets/kernel/qwidgetbackingstore_p.h
@@ -61,6 +61,7 @@
QT_BEGIN_NAMESPACE
class QPlatformTextureList;
+class QPlatformTextureListWatcher;
class QWidgetBackingStore;
struct BeginPaintInfo {
@@ -70,6 +71,7 @@ struct BeginPaintInfo {
uint backingStoreRecreated : 1;
};
+#ifndef QT_NO_OPENGL
class QPlatformTextureListWatcher : public QObject
{
Q_OBJECT
@@ -86,6 +88,7 @@ private:
bool m_locked;
QWidgetBackingStore *m_backingStore;
};
+#endif
class Q_AUTOTEST_EXPORT QWidgetBackingStore
{
@@ -135,6 +138,9 @@ private:
static bool flushPaint(QWidget *widget, const QRegion &rgn);
static void unflushPaint(QWidget *widget, const QRegion &rgn);
+ static void qt_flush(QWidget *widget, const QRegion &region, QBackingStore *backingStore,
+ QWidget *tlw, const QPoint &tlwOffset,
+ QPlatformTextureList *widgetTextures = 0);
void doSync();
bool bltRect(const QRect &rect, int dx, int dy, QWidget *widget);
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 0e40dd866f..3cc48b442d 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -407,6 +407,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
widgetPos = receiver->mapFromGlobal(event->globalPos());
QWidget *alien = m_widget->childAt(m_widget->mapFromGlobal(event->globalPos()));
QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers());
+ QGuiApplicationPrivate::setMouseEventSource(&e, QGuiApplicationPrivate::mouseEventSource(event));
e.setTimestamp(event->timestamp());
QApplicationPrivate::sendMouseEvent(receiver, &e, alien, m_widget, &qt_button_down, qt_last_mouse_receiver);
} else {
@@ -442,6 +443,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
if (win && win->geometry().contains(event->globalPos())) {
const QPoint localPos = win->mapFromGlobal(event->globalPos());
QMouseEvent e(QEvent::MouseButtonPress, localPos, localPos, event->globalPos(), event->button(), event->buttons(), event->modifiers());
+ QGuiApplicationPrivate::setMouseEventSource(&e, QGuiApplicationPrivate::mouseEventSource(event));
e.setTimestamp(event->timestamp());
QApplication::sendSpontaneousEvent(win, &e);
}
@@ -498,6 +500,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
// creation of a MouseButtonDblClick event. QTBUG-25831
QMouseEvent translated(event->type(), mapped, event->windowPos(), event->screenPos(),
event->button(), event->buttons(), event->modifiers());
+ QGuiApplicationPrivate::setMouseEventSource(&translated, QGuiApplicationPrivate::mouseEventSource(event));
translated.setTimestamp(event->timestamp());
QApplicationPrivate::sendMouseEvent(receiver, &translated, widget, m_widget,
&qt_button_down, qt_last_mouse_receiver);
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index a4b3caf78d..4618e1c91d 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -197,7 +197,7 @@ QWindowContainer::QWindowContainer(QWindow *embeddedWindow, QWidget *parent, Qt:
d->window = embeddedWindow;
d->window->setParent(&d->fakeParent);
- connect(QGuiApplication::instance(), SIGNAL(focusWindowChanged(QWindow *)), this, SLOT(focusWindowChanged(QWindow *)));
+ connect(QGuiApplication::instance(), SIGNAL(focusWindowChanged(QWindow*)), this, SLOT(focusWindowChanged(QWindow*)));
}
QWindow *QWindowContainer::containedWindow() const
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 1833dce40b..ba4dbcc878 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -1493,6 +1493,9 @@ void QLineEdit::mousePressEvent(QMouseEvent* e)
return;
}
bool mark = e->modifiers() & Qt::ShiftModifier;
+#ifdef Q_OS_ANDROID
+ mark = mark && (d->imHints & Qt::ImhNoPredictiveText);
+#endif // Q_OS_ANDROID
int cursor = d->xToPos(e->pos().x());
#ifndef QT_NO_DRAGANDDROP
if (!mark && d->dragEnabled && d->control->echoMode() == Normal &&
@@ -1520,14 +1523,19 @@ void QLineEdit::mouseMoveEvent(QMouseEvent * e)
} else
#endif
{
- if (d->control->composeMode()) {
+#ifndef Q_OS_ANDROID
+ const bool select = true;
+#else
+ const bool select = (d->imHints & Qt::ImhNoPredictiveText);
+#endif
+ if (d->control->composeMode() && select) {
int startPos = d->xToPos(d->mousePressPos.x());
int currentPos = d->xToPos(e->pos().x());
if (startPos != currentPos)
d->control->setSelection(startPos, currentPos - startPos);
} else {
- d->control->moveCursor(d->xToPos(e->pos().x()), true);
+ d->control->moveCursor(d->xToPos(e->pos().x()), select);
}
}
}
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 891839ed56..9ff77c87de 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -95,7 +95,12 @@ void QLineEditPrivate::_q_completionHighlighted(QString newText)
QString text = control->text();
q->setText(text.left(c) + newText.mid(c));
control->moveCursor(control->end(), false);
- control->moveCursor(c, true);
+#ifndef Q_OS_ANDROID
+ const bool mark = true;
+#else
+ const bool mark = (imHints & Qt::ImhNoPredictiveText);
+#endif
+ control->moveCursor(c, mark);
}
}
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index edfeb840b1..2820608621 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -3173,11 +3173,7 @@ void QMenu::internalDelayedPopup()
*/
void QMenu::setNoReplayFor(QWidget *noReplayFor)
{
-#ifdef Q_OS_WIN
d_func()->noReplayFor = noReplayFor;
-#else
- Q_UNUSED(noReplayFor);
-#endif
}
/*!\internal
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 98f85e681b..03a65aa8e5 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -115,7 +115,11 @@ static QTextLine currentTextLine(const QTextCursor &cursor)
QWidgetTextControlPrivate::QWidgetTextControlPrivate()
: doc(0), cursorOn(false), cursorIsFocusIndicator(false),
+#ifndef Q_OS_ANDROID
interactionFlags(Qt::TextEditorInteraction),
+#else
+ interactionFlags(Qt::TextEditable),
+#endif
dragEnabled(true),
#ifndef QT_NO_DRAGANDDROP
mousePressed(false), mightStartDrag(false),