summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhi_p_p.h
Commit message (Collapse)AuthorAgeFilesLines
* rhi: Autotest rendering a triangleLaszlo Agocs2019-10-091-0/+2
| | | | | | | | | 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: Add support for buffer readbacksLaszlo Agocs2019-10-091-60/+71
| | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+2
| | | | | | | | | | | | | | | 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: Speed up buffer and texture trackingLaszlo Agocs2019-09-301-6/+10
| | | | | | Task-number: QTBUG-78862 Change-Id: If278bd55530081cbbdbab8dd6e14d86e28da558e Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* De-d-pointer QRhiShaderResourceBindingLaszlo Agocs2019-09-301-51/+0
| | | | | | | | | | | | | | | | | Sad to see this go since the d pointer pattern with implicit sharing would have been perfect for this class, had this been a public API. However, as binary compatibility will not be a concern for QRhi classes, it is wasteful to allocate memory on every QRhiShaderResourceBinding. This allows users, such as Qt Quick, to use QRhiShaderResourceBinding as a cheap, simple, value class, without having to invent their own alternatives in performance critical places. The change brings a not insignficant improvement in certain qmlbench scenes (the ones with thousands of unbatched geometry nodes). Change-Id: I6d1dced6498d9ad625f90ead78bc0a417ea99ed8 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Unify handling of special cases for scissor and viewport rectsLaszlo Agocs2019-09-261-11/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | With OpenGL a scissor (or viewport) rectangle is not allowed to have a negative width or height. Everything else is allowed. This is also the semantic we wish to keep for QRhiViewport and QRhiScissor. This raises some problems. For instance, when we do bottom-left - top-left rectangle conversion, the case of partially out of bounds rects needs to be taken into account. Otherwise, Qt Quick ends up in wrong scissoring in certain cases, typically when the QQuickWindow size is decreased so the content does not fit because that will then start generating negative x, y scissors for clipping (which is perfectly valid but the QRhi backends need to be able to deal with it) Then there is the problem of having to clamp width and height carefully, because some validation layers for some APIs will reject a viewport or scissor with partially out of bounds rectangles. To verify all this, add a new manual test, based on the cubemap one. (cubemap was chosen because that is an ideal test scene as it fills the viewport completely, and so it is visually straightforward when a scissor rectangle is moving around over it) Fixes: QTBUG-78702 Change-Id: I60614836432ea9934fc0dbd0ac7e88931f476542 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: gl: Pick up context lossLaszlo Agocs2019-09-131-1/+1
| | | | | | | | ...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/+1
| | | | | | | 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/+3
| | | | | | | | | | | | | | | | | | 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/+2
| | | | | | | | | | | 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>
* rhi: Move info prints to categorized loggingLaszlo Agocs2019-08-021-0/+3
| | | | | | | | | | | Following the Quick scenegraph (qt.scenegraph.*), we now have qt.rhi.general. Other categories may get added later. This does not change the printing of real errors, those will continue to use qWarning(). Change-Id: Id95416fc82ba8add9527212e431bcbd47d416f1a Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: gl: Add support for computeLaszlo Agocs2019-07-311-0/+3
| | | | | | | ...and storage buffers and images. Change-Id: If38a51322e3187088a13cf4e9b88cb40c8af8621 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Optimize some atomic countersMarc Mutz2019-06-271-4/+0
| | | | | | | | | | | | Define the static QAtomic at file scope to avoid GCC's pessimisation with function-static QAtomic (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79561), and make sure the initial value is 0, so it ends up in BSS, not TEXT. In QRhi..., don't create a static instance of the wrapper class, use a file- static atomic, too. This turns the class into a glorified namespace. Change-Id: I707f628e2b434330028077223071716d5704ba32 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* rhi: Add compute api and implement for Vulkan and MetalLaszlo Agocs2019-06-171-9/+34
| | | | | | | | | | | | | 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/+1
| | | | | | | | | | | | | | | | | 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/+544
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>