summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhinull.cpp
Commit message (Collapse)AuthorAgeFilesLines
* rhi: Make the new direct buffer update available for non-uniform buffersLaszlo Agocs2020-10-121-2/+2
| | | | | | | | | | | | | | | | | The original restriction to UniformBuffer was due to the GL backend where there is no GL buffer object for QRhiBuffers with usage UniformBuffer. However, we can still implement this for cases when there is a true GL buffer object underneath. With other backends it should all work as-is already. This becomes useful when one has buffers with usage Vertex that need full updates every frame. (f.ex. instance data) Unfortunately this involves renaming the function. But while at it, add an autotest case as well. Change-Id: Iff59e4509a8bae06654cc92fe8428bd79eb012fb Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Add support for full, direct buffer updatesLaszlo Agocs2020-10-111-4/+12
| | | | | Change-Id: I02c1f8c32c08d39cde9845d20ba8b02541d9d325 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Make per-frame flags per-pass where appropriateLaszlo Agocs2020-10-021-2/+7
| | | | | | | | | | | | | | | | | | | | ExternalContentsInPass becomes a per-pass flag now. Why is this beneficial? Because while Qt Quick has no choice for its render pass, not being able to guess if the application wants to do some native rendering in there, Quick 3D's render passes, all the ones that are under Quick3D's control, do not have native rendering from the application in them, and so using secondary command buffers with Vulkan is not necessary. Introduce something similar for compute and OpenGL. By knowing that none of the resources used in a pass are used with a compute pass (e.g. because we know that there are no compute passes at all) a small amount of time can be saved by skipping tracking buffers and textures because the only purpose of said tracking is to generate barriers that are relevant only to compute. Change-Id: I0eceb4774d87803c73a39db527f5707a9f4d75c1 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Manage buffer data without QBALaszlo Agocs2020-09-301-1/+1
| | | | | | | | Use a simple and straightforward container that only does what we need here. Change-Id: I1a81b53a58bc91d533e3d7df5471a1362046825d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Improve layout compatibility test performanceLaszlo Agocs2020-09-291-0/+6
| | | | | | | | | Also bump the non-heap buffer size in the binding list to 16, in order to accommodate complex Quick3D materials with many associated texture maps. Change-Id: Id190e5f8304f5941cffc41a2605fce45dfeb72f0 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Reuse the data in buffer ops in res.update batchesLaszlo Agocs2020-09-231-1/+1
| | | | | | | | Because having profilers bombarded with mallocs (due to creating deep copy QByteArrays) is not nice. Change-Id: I848f41f3465d6dc2a58a193cc863495aacf13d79 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Reuse buffer/texture op entries in res.update batchesLaszlo Agocs2020-09-231-2/+4
| | | | | | | | More of an enabler for reusing the data in the individual entries since not clearing the QVLA does not give us much on its own. Change-Id: Ief9761f75382c3373cc2bc7b866eb59fdd8b3277 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Expose compute threadgroup limits in ResourceLimitsLaszlo Agocs2020-09-181-0/+10
| | | | | | | | | | As OpenGL ES and Vulkan ruin the day with the spec mandated minimum value for max threads per threadgroup being only 128, clients need a way to decide if their compute shader (local_size_*) is suitable for use at run time. Change-Id: I72b4fc97032406340623add82ea4d9544ebe9fdc Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Use QList instead of QVector in gui implementationJarek Kobus2020-07-071-1/+1
| | | | | | | Task-number: QTBUG-84469 Change-Id: I366e845249203d80d640355a7780ac2f91a762f1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-071-1/+1
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* rhi: Harmonize create-destroy API pattern with the rest of QtLaszlo Agocs2020-05-281-34/+34
| | | | | | | | | | For historical reasons we use build and release instead of create and destroy. This becomes confusing now that more modules in Qt start taking QRhi into use. Migrate to the more familiar naming, so those who have used QWindow or QOpenGLContext before will find it natural. Change-Id: I05eb2243ce274c59b03a5f8bcbb2792a4f37120f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* rhi: Add backing format hint to QRhiRenderBufferLaszlo Agocs2020-04-291-4/+6
| | | | | | Task-number: QTBUG-83707 Change-Id: I63548f4ace70af614a2aa082663bb3ae9fbedc25 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* rhi: Take mip size into account for render target sizeLaszlo Agocs2020-04-231-3/+5
| | | | | | | | Also extend autotesting, both for rendering into a given mip level and for rendering into a given cubemap face. Change-Id: Ida94b71150477ceb50a3b5616d8b7be13174558b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Do not rely on unspecified relation between readbacks and FramesInFlightLaszlo Agocs2020-02-211-1/+3
| | | | | | | | | | | | | | | Add a new queriable resource limit value MaxAsyncReadbackFrames. Change the autotest to rely on this instead of relying on the unspecified, works-by-accident relation between readbacks and FramesInFlight. This way even if the behavior diverges in some backend in the future, clients (well written ones, that is), will continue to function correctly. Also clarify the docs for FramesInFlight, and change d3d and gl to return the correct value (which is 1 from QRhi perspective; the expanded docs now explain a bit what this really means and what it does not). Change-Id: I0486715570a9e6fc5d3dc431694d1712875dfe01 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Enable sampler address mode W in the APILaszlo Agocs2020-01-301-4/+4
| | | | | | | | | | | Internally this is already supported by all backends. The frontend was just not exposing addressW, instead defaulting to the (arbitrarily chosen) ClampToEdge. Add the parameter to newSampler(), but make it optional, defaulting to the more natural Repeat (because that's what one would get with OpenGL for WRAP_R by default) Change-Id: I0b991d8b649db37d4da86ac8e98ab7845601cf67 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* RHI: Remove old native texture APIPaul Olav Tvete2020-01-061-20/+2
| | | | | | Task-number: QTBUG-78570 Change-Id: I8c4850828ac03319ac923a26c2e985883956c286 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* RHI: new native texture APIPaul Olav Tvete2019-12-051-0/+6
| | | | | | | | | | | | The new version takes/returns a value that can be unpacked and passed to other functions without knowing which backend is in use. The old API will be removed in a later change when dependent modules have been updated Task-number: QTBUG-78570 Change-Id: I18d928ceef3cb617c0c509ecccb345551a7990af Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: Allow testing QRhiRenderPassDescriptors for compatibilityLaszlo Agocs2019-11-271-0/+6
| | | | | | | | | | | | | | | | | | | | For Metal and Vulkan this needs actual work because that's where the concept of renderpass descriptors is relevant. GL and D3D can just return true always. The big benefit of this is that Qt Quick can now compare renderpass descriptors via isCompatible() for its pipeline cache (similarly to how it is already using isLayoutCompatible() for srbs), and so renderpass descriptors for layers (Item.layer, ShaderEffect) will typically be compatible and so can pick up pipelines created by other layers from the cache. Also add autotests for shader resource binding and renderpass descriptor compatibility. Task-number: QTBUG-80318 Change-Id: I0008bc51c4ee13b0113d2c8caf799e1257f18a18 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* rhi: Autotest for rendering a triangle into a windowLaszlo Agocs2019-10-091-1/+1
| | | | | Change-Id: Id1562ff8cf7c6bc7e5bd147bb628f3d9dd57f2b5 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* rhi: Autotest rendering a textured quadLaszlo Agocs2019-10-091-0/+2
| | | | | | Task-number: QTBUG-78971 Change-Id: I0e7e0f3c00f9509031f7b4a8a389e51c915f01c2 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* rhi: Autotest rendering a triangleLaszlo Agocs2019-10-091-0/+4
| | | | | | | | | Also improve (docs and runtime checks) and test the minimum set of required data to create a graphics pipeline. Task-number: QTBUG-78971 Change-Id: If5c14f1ab1ff3cf70f168fde585f05fc9d28ec91 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* rhi: Autotest basic texture operationsLaszlo Agocs2019-10-091-10/+106
| | | | | | | | | | | | ...and make the Null backend able to deal with these, for RGBA8 textures at least. Naturally it is all QImage and QPainter under the hood. Also fix a bug in the OpenGL backend, as discovered by the autotest: the size from the readback did not reflect the mip level. Task-number: QTBUG-78971 Change-Id: Ie424b268bf5feb09021099b67068f4418a9b583e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* rhi: Add support for buffer readbacksLaszlo Agocs2019-10-091-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | This also marks the beginnings of significantly extending autotesting of the resource and rendering functionality in QRhi. Also involves fixing up the buffer operation lists like we did for textures before. This is to ensure updates and reads on the same batch execute in the correct order. So just have two lists: one with buffer, one with texture operations. Also simplify the struct layouts. No need for those inner structs with many duplicate members. This reduces the size even, since using a union was never an option here. Also switch to a VLA, the size is around 253 KB per batch. The Null backend now keeps track of the QRhiBuffer data so it can return valid results in readbacks. Task-number: QTBUG-78984 Task-number: QTBUG-78986 Task-number: QTBUG-78971 Task-number: QTBUG-78883 Change-Id: I9694bd7fec523a4e71cf8a5c77c828123ebbb3bd Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* rhi: Remove QVectors from the data description structs as wellLaszlo Agocs2019-10-031-4/+3
| | | | | | | | | | | | | | | As usual, keep some QVector overloads around to allow Qt Quick to compile. Color attachments and vertex input bindings get an at(index) type of accessor, unlike any other of similar lists. This is because there the index is significant, and sequential iteration is not the only type of operation that is performed. Sometimes a lookup based on an index will be needed as well. Task-number: QTBUG-78883 Change-Id: I3882941f09e94ee2f179e0e9b8161551f0d5dae7 Reviewed-by: Christian Strømme <christian.stromme@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* rhi: gl: Pick up context lossLaszlo Agocs2019-09-131-2/+3
| | | | | | | | ...and change the return value of makeThreadLocalNativeContextCurrent() to a bool since we expect this to mirror QOpenGLContext::makeCurrent(). Change-Id: I339507152e461fe28fcf7fe777165e6d0072f055 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Better handling of device lossLaszlo Agocs2019-09-121-0/+5
| | | | | | | Starting with D3D11. The other backends will follow later. Change-Id: I4f165c9f1743df0fb00bdce1e898917575bf5f6e Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: gl, metal, d3d: Reuse shader objects when source is the sameLaszlo Agocs2019-09-091-0/+5
| | | | | | | | | | | | | | | | | | Now that Qt Quick's batch renderer misses one level of shader source caching due to the nature of pipeline state objects, it can be useful to keep and reuse shader objects when the hash of the source code matches. The goal here is to allow Qt Quick to be on par with what the direct OpenGL path has when it comes to caching shader sources and compilation results. The program binary disk cache is not in scope in this patch. Also adds QRhi::releaseCachedResources(), similarly to what the scenegraph has. This can be called to clear caches such as the shader object cache we keep here. Change-Id: Ie3d81d823f61fa65ec814439e882c498f7774d43 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: vulkan: Introduce secondary command buffer usageLaszlo Agocs2019-08-291-2/+4
| | | | | | | | | | | As an option. Must opt in via setting ExternalContentsInPass in the flags for beginFrame(). It is somewhat unfortunate to require declaring this up front, but forcing using secondary command buffers always, even though beginExternal() may not be used in many applications, would be an overkill. Change-Id: I8d52bcab40c96f89f140c4c7877b6c459925e3c7 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Mark all rhi docs as internalLaszlo Agocs2019-08-271-3/+6
| | | | | | | | This is private API for the time being. Without this the QRhi* classes show up in the class list in the docs. Change-Id: I662abb9cc8eaae13ffe9266bd6313faa8e138353 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Add compute api and implement for Vulkan and MetalLaszlo Agocs2019-06-171-0/+50
| | | | | | | | | | | | | D3D11 and GL (4.3+, ES 3.1+) will come separately at a later time. Change-Id: If30f2f3d062fa27e57e9912674669225b82a7b93 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Make it possible to request making the context current on GLLaszlo Agocs2019-06-171-0/+5
| | | | | | | | | | | | | | | | | Needed by Qt Quick to handle cases where the application (or other Qt) code contains OpenGL calls, and Qt Quick facilitates this by ensuring the scenegraph's GL context is current. The expectation is that when running with the GL backend of the rhi, all such code remains fully functional. So add a makeCurrent type of call into the QRhi API that is a no-op with anything other than OpenGL. Change-Id: I6f774bf828e31802bdab0c3fef9421cdc0cebe5c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Introduce the Qt graphics abstraction as private QtGui helpersLaszlo Agocs2019-06-131-0/+709
Comes with backends for Vulkan, Metal, Direct3D 11.1, and OpenGL (ES). All APIs are private for now. Shader conditioning (i.e. generating a QRhiShader in memory or on disk from some shader source code) is done via the tools and APIs provided by qt-labs/qtshadertools. The OpenGL support follows the cross-platform tradition of requiring ES 2.0 only, while optionally using some (ES) 3.x features. It can operate in core profile contexts as well. Task-number: QTBUG-70287 Change-Id: I246f2e36d562e404012c05db2aa72487108aa7cc Reviewed-by: Lars Knoll <lars.knoll@qt.io>