aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickgenericshadereffect.cpp
Commit message (Collapse)AuthorAgeFilesLines
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-3/+3
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Suppress warning about QSignalMapper being deprecatedThiago Macieira2017-07-031-0/+3
| | | | | | | It is since qtbase commit 29bcbeab90210da80234529905d17280374f9684. Change-Id: I8d96dea9955d4c749b99fffd14cd512a8ff88a74 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Run includemocs in qtdeclarativeThiago Macieira2017-04-261-0/+2
| | | | | Change-Id: I84e363d735b443cb9beefffd14b8c023a37aa489 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use QByteArrayLiteral more judiciouslyAnton Kudryavtsev2016-09-031-2/+2
| | | | | | | | | | Replace it with char* literal in overloaded functions. Saves some text size. Change-Id: Iede24c2169d7329aa17c2175b10873c98c27361f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* software: Fix potential infinite loop with ShaderEffectLaszlo Agocs2016-07-151-2/+10
| | | | | | | | | | | | With the software backend we entered an infinite loop when having ShaderEffect items. The previous change introducing the usage of polish requests to defer shader processing was a bit too keen on trying over and over again: there is exactly one retry attempt we need, not more. If the second fails too and everything looks initialized and ready, then we know the backend has no shader effect support so it is futile to try again. Change-Id: Ibaaefd45e5b26d0be42dbe7f9c080363b7a939bf Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Unify ShaderEffect property settingLaszlo Agocs2016-06-291-37/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rendererInterface() should not require isSceneGraphInitialized() to be true - the API and language queries like graphicsApi() have no need for the scenegraph, they only need the plugin to be loaded, i.e. that the QQuickWindow is constructed. This is the key to be able to make GraphicsInfo report graphicsApi and shaderType with the correct values as early as possible - meaning as soon as the item is associated with a window. The initialization of the scenegraph (the exact timing of which varies backend to backend) does not matter here. The fragment and vertex shader property setting is now unified in the two ShaderEffect implementations: - If the component is complete, the shader is attempted to be processed right from the setter. - Otherwise the item will trigger processing once the component is complete. - If there is no window when processing is trigerred, it is deferred via polish. To implement item polish handling we need a new virtual in QQuickItemPrivate since we cannot intrdouce virtuals into the public classes. This way one can write a condition (and later potentially use file selectors) like this: fragmentShader: GraphicsInfo.shaderType == GraphicsInfo.GLSL ? "..." : ... without having to worry about getting an unintended value processed due to GraphicsInfo not yet reporting an up-to-date value. parseLog() forces, for GL at least, shader processing to prevent autotests from breaking. Change-Id: If55c69d746c29cd07348ddad2d6b0f2b5dd7f3a2 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* D3D12: Support runtime threaded shader compilationLaszlo Agocs2016-06-221-20/+70
| | | | | | | | | | | | | | Let's revise our policy of offline/bytecode only shaders. ShaderEffect benefits greatly from having runtime compilation support for HLSL source strings, especially when dynamically constructing shader strings. There is no reason not to support both approaches since we rely on d3dcompiler for reflection anyhow. What's more, we can call D3DCompile on a dedicated thread, keeping the gui responsive while compilation is on-going. Change-Id: Ie6c02c2aa0ebd0c8371bbf30b3ce6582128c457b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* One GraphicsInfo to rule them allLaszlo Agocs2016-06-011-30/+0
| | | | | | | | | Rename RendererInfo to GraphicsInfo. Deprecate OpenGLInfo and move the surface format properties into GraphicsInfo. Move also the shader info properties from ShaderEffect. Change-Id: I3b3f01080e059b3a30a132fd67de19a4bfca54ef Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* D3D12: qt_SubRect_<name> supportLaszlo Agocs2016-04-301-16/+14
| | | | | Change-Id: I2b5d1211ed97909a03d92d115eb057ce9e710d12 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* D3D12: Cache shader reflection resultsLaszlo Agocs2016-04-301-7/+33
| | | | | | | | Different ShaderEffect items using the same shader should have no need to examine the source/bytecode over and over again for each item. Change-Id: I9c124245b321fb0d6c4f1440d44250768d9ae94f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* D3D12: Fix 'ShaderEffect in a ShaderEffectSource as property value'Laszlo Agocs2016-04-291-11/+37
| | | | | | | | | | | | | | | | Import (and clean up) the dropshadow from the shadereffects example. This is very useful since it tests a lot more paths and cases than the wobble. To overcome the issue of not having some of functionality available before the item is added to a window, make QQuickGenericShaderEffect smarter and enhance the documentation. The handling of vertical mirroring is revised. The GLSL and HLSL version of the dropshadow shaders produce correct, identical output now. Change-Id: I94800997bfba781140d80720eb6f340cda480747 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* D3D12: Handle special shader effect casesLaszlo Agocs2016-04-291-21/+33
| | | | | | | | | | | | Like when there is only one shader is given by the ShaderEffect item, or when texture providers disappear (use a dummy texture in this case). Changing the cull mode works now too. Fix also the inconsistent naming (activate -> use) for textures in the glpyh cache. The cbuffer is now correctly aligned. Filtering and wrap modes are now taken from the texture, meaning 'smooth' and 'wrapMode' works. Change-Id: I265a7676d87d470dc8b3a8f59ea64bdadbc58c5d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* D3D12: Long Live Wobble!Laszlo Agocs2016-04-291-9/+18
| | | | | | | | | | | | | D3D12 shader effect node. Cull mode, atlas (qt_SubRect_*) support, and some nice-to-haves are currently missing. The built-in shaders won't yet work due to not sending 'source' down the stack so both have to be application-supplied. Nonetheless..the wobble test works! Change-Id: If4cd0143fa5794a8d5f89b576ffcfb084efeb343 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Adaptable shader effect enablersLaszlo Agocs2016-04-291-16/+457
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The D3D12 node implementation is mostly missing. The rest of the enablers should be in place now however. Importing QtQuick 2.8 provides new properties for ShaderEffect: - shaderType can be used to decide which language should be used - shaderCompilationType tells if compilation is runtime or offline - shaderSourceType tells if the vertex/fragmentShader properties refer to source strings or source files or pre-compiled bytecode files The last two are bitmasks. In practice however we will support only one approach per backend for now (runtime + source string for OpenGL, offline + bytecode for D3D12). In addition to QSGShaderEffectNode, introduce the QSGGuiThreadShaderEffectManager interface. This provides the gui thread bits for the above and performs shader reflection. Backends that use the new ShaderEffect system must provide both. For each ShaderEffect item there will be a manager (on the gui thread) and a node (on the render thread). Reflection is expected to be done via standard helper libs (d3d12shader + D3DReflect from d3dcompiler for the D3D12 backend), or via manually inspecting SPIR-V, or parsing the source (like the GL path does now), or by using some 3rd party library (not recommended). In any case we require that reflection is doable on the gui thread without dependencies to the actual graphics API. The ShaderEffect documentation is greatly extended, covering HLSL and the new properties. The test app uses manually compiled shaders on its HLSL path for now. This is because there is no story yet for build system integration for public use (the internal HLSL -> bytecode in C header rule is only suitable for the d3d12 plugin itself, apps need something different). Change-Id: Id112104906fbcb26b9902a35f19d8d509b340d1b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add the skeleton for the new, more generic shader effect implLaszlo Agocs2016-04-131-0/+127
which should route and place most of its work into the scenegraph. And fix a test. Change-Id: I04f29cba53c2bab62e41b3b524794d3c4d20a472 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>