aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix some test failures with QT_NO_OPENGL buildsAndy Nichols2016-05-061-7/+19
| | | | | Change-Id: I4154084b4a0e0709ee8cb39a856a37a611e2d537 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Fix building with QT_NO_OPENGL definedAndy Nichols2016-05-064-5/+14
| | | | | Change-Id: Ice6c47f766899e7313b9dde8cfcd6d81eeaf52f5 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Fix up createTextureFromIdLaszlo Agocs2016-05-061-6/+4
| | | | | | | Return null gracefully when not running with OpenGL. Change-Id: I918e7d02a5641ccaf3c19c415791773e28191806 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix up openglContext() in QQuickWindowLaszlo Agocs2016-05-061-10/+10
| | | | | | | | Return null in all non-OpenGL cases, making it safe to call in OpenGL-enabled builds even when not running with the OpenGL backend. Change-Id: I7d8f0e0d177b1447863cc951afdf8d6656a59f9c Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* D3D12: Implement grabWindowLaszlo Agocs2016-05-067-27/+210
| | | | | Change-Id: Icb8151f26bad68795eb2e1f920297267c880b40b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* D3D12: Fix up Context2DLaszlo Agocs2016-05-032-27/+33
| | | | | | | | | | | | Querying openglContext() on a non-GL specific path is never a good idea. The usage of QSGSimpleTextureNode is replaced with the correct multi-backend way, i.e. creating an image node via the adaptation layer. Demos like stocqt are now functional with the d3d12 backend as well. Change-Id: I24a6b85163fec5841349057e2fec0be6cbf01130 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* D3D12: Fix incorrect descriptor heap types in deferred releasesLaszlo Agocs2016-05-032-9/+11
| | | | | | | | The type is not always CBV_SRV_UAV, it can also be RTV or DSV when offscreen render targets are in use. Change-Id: I2d154fbf48e8372bd415be0acbee8e563f972140 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Introduce RendererInfoLaszlo Agocs2016-05-035-7/+238
| | | | | | | | | | | | | | Modeled after OpenGLInfo, RendererInfo.api is an easy to use attached property that reports the current graphics API as long as the item is associated with a window that has the scenegraph initialized. Applications should not worry about this in general since they should target one given API, however tests, examples and some advanced use cases will find this handy. RendererInfo is also a great place to expose other properties in the future. Change-Id: Ie3411b8820fc4b74efd1b1d0143e936886f62d74 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* D3D12: Painter nodeLaszlo Agocs2016-05-0311-35/+427
| | | | | | | | | Only supports QImage backing. As a bonus add some notes to the Context2D docs too. Change-Id: I18457a1f766d2f136c6864ec06fe596668d5e726 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* D3D12: qt_SubRect_<name> supportLaszlo Agocs2016-04-304-29/+103
| | | | | 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-298-34/+113
| | | | | | | | | | | | | | | | 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-297-41/+95
| | | | | | | | | | | | 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-2910-41/+769
| | | | | | | | | | | | | 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-2921-103/+1490
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/dev' into scenegraphngAndy Nichols2016-04-2643-277/+684
|\ | | | | | | Change-Id: Ib990cfbd43d4a8c0ca412b492d507424cd9e58d4
| * Add string search functions from ECMAScript 2015.Michael Brasser2016-04-253-0/+86
| | | | | | | | | | Change-Id: I46d5e42186d9f1b2994778de967610725b0e0633 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| * V4: make QQmlEnginePrivate::dereferenceScarceResources inlinable.Erik Verbruggen2016-04-212-22/+32
| | | | | | | | | | | | | | | | Done by giving the "expensive" part its own function, that's even unlikely to be called anyway. Change-Id: I35621fb0a764879f9339b9e23f210c66971ff5b7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Remove empty methodFrank Meerkoetter2016-04-191-4/+0
| | | | | | | | | | | | | | The base type already provides an empty implementation of that method. Change-Id: I942db101343b1d4bb6de16ada189d969834a6cae Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Mark overrides of QQmlExtensionPluginFrank Meerkoetter2016-04-1911-11/+11
| | | | | | | | | | | | | | | | Clearly state that we want to override registerTypes of QQmlExtensionPlugin. Change-Id: I0acf76115d47d7166ccb813a811dd757d514e6e2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Remove unused QPointerValuePair templateFrank Meerkoetter2016-04-186-199/+0
| | | | | | | | | | | | Change-Id: I93bc5951d555f799bb956020433d3087504e8f9f Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Replace handwritten loops with qDeleteAllFrank Meerkoetter2016-04-181-4/+2
| | | | | | | | | | Change-Id: Ifb54fbd7d4a32dc23404e78a58c421a8be9e0e9a Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
| * Cleanup dead fwd declarationFrank Meerkoetter2016-04-181-2/+0
| | | | | | | | | | Change-Id: I339b2234e64eaab2d2e73c1d3cb37e2d0b60fe3b Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
| * QQuickTextInput: Add some QChar::unicode() calls to brush over deprecation ↵Friedemann Kleint2016-04-181-1/+1
| | | | | | | | | | | | | | warning. Change-Id: Ifb6d499975cf2b7fd7c0d936cfb7daa633be5677 Reviewed-by: hjk <hjk@theqtcompany.com>
| * Cleanup. It is fine to call delete(0)Frank Meerkoetter2016-04-181-1/+1
| | | | | | | | | | Change-Id: Ie42891136932fca99ae6237208618a3b3c2424d1 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
| * Update DelayedFunctionCall to use an array object.Michael Brasser2016-04-132-7/+15
| | | | | | | | | | Change-Id: I9ffaa95ab58eff14abaf3573f5aa0d351ac0624d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Do not convert from latin1 over and over againFrank Meerkoetter2016-04-131-4/+7
| | | | | | | | | | Change-Id: I448c0f3b6e651fc57e1bbd40a5fcd59559da2915 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * QML: When available, use QQmlAccessors to read properties.Erik Verbruggen2016-04-1215-22/+529
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a property is read from a QObject or the QML scope object, and we can statically resolve the type to qreal/QObject/int/bool/QString, and the property has an accessor declared for it, then use that accessor to do the read. This collapses the path of e.g.: Runtime::getQmlScopeObjectProperty -> QObjectWrapper::getProperty -> QObjectWrapper::getProperty -> LoadProperty -> QQmlAccessor::read (all of which do various checks for all the stuff mentioned above) to: Runtime::accessQmlScopeObjectQRealProperty -> QQmlAccessor::read which is a simple 4-line function, and doesn't need to do any check. According to valgrind, this saves 170 instructions on x86 for the simple binding: Item { width: height } Change-Id: I0761d01e8f1a3c13ecbffe2d8e0317ce9c0a4db0 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | QQuickWidget: Partial update support with software renderingAndy Nichols2016-04-204-8/+24
| | | | | | | | | | Change-Id: I886287812c1c3cd56739e24470492adc90cfafbb Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | QQuickWidget: Enable use with software renderer backendAndy Nichols2016-04-204-89/+177
| | | | | | | | | | Change-Id: Ic7a550e55cc4ece4c3a5547dae5bf0dbb3f5b0ac Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | 2DRenderer: Have renderers tied to QPaintDeviceAndy Nichols2016-04-208-73/+53
| | | | | | | | | | | | | | | | | | | | | | Previously the software renderer would create a backing store for a given window if one was needed. This has been moved to the render loop where the backingstore is flushed to the window. This refactoring should make the software renderers flexible enough to work with QQuickRenderControl. Change-Id: Idbbb1da870afbf28e45213a887be68dba11dc592 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | D3D12: Recursive layer supportLaszlo Agocs2016-04-207-21/+49
| | | | | | | | | | | | | | | | | | | | | | To avoid using the same color buffer both as a shader resource and as a render target, recursive layers add a second render target and just play ping-pong with them. Multisampling does not need this since rendering happens into a MS buffer while shader access uses a separate, non-MS color buffer. Change-Id: I6fd65318f69390d7af9ca6763d1d9fe2329780aa Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Fix up rendernode autotestLaszlo Agocs2016-04-202-3/+4
| | | | | | | | | | | | | | | | | | | | | | Test the new RenderTargetState as well. Make releaseResources() optional. Code focusing on OpenGL only may not want to care about providing an implementation for it. It is also more compatible with the old private API this way. Change-Id: I0dcec1d48708e71d778a8e5fea1b64d710bee67f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Drop the warning from rendererInterface()Laszlo Agocs2016-04-202-11/+6
| | | | | | | | | | Change-Id: I19096f304e22d71f31845e47480c56039e4e3ce6 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | D3D12: Add support for multisampled layersLaszlo Agocs2016-04-206-29/+46
| | | | | | | | | | | | | | | | | | Pick up the main sample count. Rename a few things in the process and make the distinction betewen the int QSurfaceFormat::samples() that can be -1 or 0, and the internal uint sample count, that is >= 1, more clear. Change-Id: Ifd5a9a7c2f894b04fdc93f86ebb7c69f8c76cd28 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Make rendernode suitable for public consumptionLaszlo Agocs2016-04-2030-120/+824
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For non-OpenGL APIs the primary (and likely the only) way to add custom rendering into the Qt Quick scene is via the render node. Other approaches,like the before/afterRendering signals, QQuickFramebufferObject, remain OpenGL-only. (although QQuickFramebufferObject may get a multi-API replacement based on QSGRenderNode at a later time) Note that this is not a generic 3D content integration enabler. It targets creating 2D and 2.5D Quick items with custom rendering via the graphics API in use. Make QSGRenderNode public, enhance the docs a bit and add a releaseResources(). Add a QSGRendererInterface with a query function in QQuickWindow and QSGEngine. The scenegraph adaptation can then return a custom implementation of the interface. This will be necessary to query API-specific values, f.ex. the ID3D12Device and ID3D12CommandList when running with the d3d12 backend. The interface allows querying the API and void* resources. Resources that we know about in advance are enum-based to prevent the QPlatformNativeInterface-like ugliness of string keys. Support is there in the batch renderer already, fix this up according to the new public API, and implement the corresponding bits for the D3D12 renderer. For D3D12, fix also an issue with QSGNode destruction where graphics resources in use were attempted to be final-released without a proper wait. The semantics of changedStates() in QSGRenderNode is changed so that it can be called at any time, including before render(). This is very useful since we can implement some state restoring in a more efficient manner. Added a new example as well. Documentation for QSGRenderNode is heavily expanded. Change-Id: I4c4a261c55791d0e38743a784bc4c05a53b3462d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | D3D12: Fix another case of stale text cbufferLaszlo Agocs2016-04-131-1/+1
| | | | | | | | | | Change-Id: Ie90b9a250ab4d982ab6c75e69fdfa6b1a1a6ee0b Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* | 2DRenderer: Mark all regions of deleted node as dirtyAndy Nichols2016-04-133-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | Previous behavior was to always subtract the current bounding rect of items when calculating the previous dirty region. When you remove a node though, there is no current bounding rect because the item no longer exists. The last valid boundingRect was use instead, which led to the previous bounding rect to not get marked as dirty when the node was removed. Change-Id: Ic1a4f872d4d46125b06e2588aae695b8ff67d0fd Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | 2DRenderer: Fix Text Styles on HiDPI screensAndy Nichols2016-04-131-6/+10
| | | | | | | | | | | | | | | | It's not enough to use 1 pixel offsets, you need to adjust for the devicePixelRatio because otherwise the corners will look unusual. Change-Id: I2879da82047ef53805286cbdb33af06d669529ea Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | 2DRenderer: Fix rendering of Rectangles with float border widthAndy Nichols2016-04-131-2/+1
| | | | | | | | | | | | | | | | Previous behavior was to not fill the rectangle completely to the border because of rounding. Change-Id: I28d35a5dbe4831a55837f466c0e01601a9d55446 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | 2DRenderer: Add private header warningAndy Nichols2016-04-1316-0/+176
| | | | | | | | | | Change-Id: If88b53426302b0070ddabc111ecdc530506be1a4 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | QQuickTextNodeEngine: Use correct boundingRect when merging nodesAndy Nichols2016-04-131-1/+1
| | | | | | | | | | | | | | | | Use the transformed QRectF of otherNode instead of the untransformed boundingRect of the QGlyphRun. Change-Id: Ie2a97cccee45e2b924c2f599d8d3855aa85a4713 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Convert d3d12 backend into a pluginLaszlo Agocs2016-04-1344-19/+35
| | | | | | | | | | Change-Id: I4300ba81800e44c0b5e2a86e72b1cf96434c323d Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* | Add the skeleton for the new, more generic shader effect implLaszlo Agocs2016-04-138-79/+332
| | | | | | | | | | | | | | | | | | 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>
* | Fix up some QOpenGL includesLaszlo Agocs2016-04-132-1/+2
| | | | | | | | | | | | | | | | | | OpenGL-specific code here and there relied on qopenglfunctions.h pulled in from some unrelated place. This was cleaned up in some previous commit so add the necessary includes. Change-Id: I9d9ff6c5faf9fc9d59d8e1cfd4fab05ebff4b4e0 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* | Route ShaderEffect through the old GL implLaszlo Agocs2016-04-1312-92/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Register the common QQuickShaderEffect class as ShaderEffect to QML. In case of GL this will route to QQuickOpenGLShaderEffect. For others the default no-op implementation is used (at least for now). Later this new implementation will route to a backend-specific scenegraph node via the adaptation layer. This also means that QQuickOpenGLShaderEffect is no longer a QQuickItem and QQuickShaderEffect must handle everything item-related and forward. Change-Id: I1ff4b674253543a04978a69f4a3b67f3a44dd983 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* | Prefix GL-specific shader effect codeLaszlo Agocs2016-04-1319-1005/+1248
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename the C++ sources and classes. The QML type name remains the same. No changes in functionality. The shader effect, node, material (and uniform animator and particles and bits and pieces here and there...) are highly interconnected and do not follow the usual design practices for Quick and the scenegraph and the adaptation layer. Therefore while we aim for keeping full compatibility for GL apps, other backends will likely get a different ShaderEffect item implementation. The C++ class QQuickShaderEffect itself is currently a dummy with an unchanged API. It is not in use for now but forms the basis for the implementation for other backends. This will be covered in future commits. Change-Id: Ia39ce4b303f8f33e2f241d11e35fa62423e43127 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* | Make QQuickShaderEffectMesh genericLaszlo Agocs2016-04-136-30/+31
| | | | | | | | | | | | | | | | | | There is nothing GL-specific here (apart from the attribute name list but that will likely remain that way with non-GL backends as well). By moving a few constants it can now be built unconditionally. Change-Id: I866b7b5c0262588a39818b177455f6276f8d584b Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* | Merge remote-tracking branch 'origin/dev' into wip/scenegraphngLaszlo Agocs2016-04-13101-958/+1169
|\| | | | | | | Change-Id: If33197b616de3476811f0161d4ecd8e7d004756c
| * Fix invocations of methods taking a QByteArraySimon Hausmann2016-04-121-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 3b7e2a69f7eb8597c807de39b4de39721e9e2bd2 when calling a slot that takes a QByteArray with a parameter that is not a QByteArray, we would end up passing an empty QByteArray. This is a regression as previously we supported the conversion code path, i.e. when passing a QString it would be converted to utf-8, through QVariant's conversion code path. This code path needs to be re-activated by removing this "shortcut". The shortcut is not necessary as the execution engine's toVariant() function also knows how to apply the conversion. Change-Id: I0600d195c94fa4e1e0b7ab807f045f0da42f595b Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>