summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi
Commit message (Collapse)AuthorAgeFilesLines
* Fix a warning treated as error - 'importDevice not used'Timur Pocheptsov2019-07-031-0/+1
| | | | | Change-Id: Id48ff52d6532cf3585648addd498cdddccbcb994 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* RHI/D3D11: Remove hard dependency on D3DCompiler libraryFriedemann Kleint2019-07-022-2/+21
| | | | | | | | | | Varying versions of the library may be available depending on build tool chain or Windows version. Try to dynamically resolve the D3DCompile function. Fixes: QTBUG-76845 Change-Id: Ib7eb3b8c454e9c25731eb2ba9ba45e54fe3f1283 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: d3d: Fix resource binding mismatch with multiple passesLaszlo Agocs2019-07-012-0/+7
| | | | | | | | | | | | | | The resetShaderResources() done when starting a render or compute pass purges all vertex, index, SRV, and UAV bindings. This will be optimized at a later point, but until then the command buffer's state should be updated accordingly, otherwise certain use cases end up with incorrect rendering results due to not binding vertex/index/shader resources as appropriate. This fixes the shadowmap example on d3d. Change-Id: I4d07929b8664b64bc608c6c8df474b0ee7c2ddbb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Improve base vertex/instance supportLaszlo Agocs2019-07-017-25/+90
| | | | | | | | | Have feature flags as appropriate. OpenGL is causing a mess here but let's support what we can since some of this will become relevant in more sophisticated mesh drawing cases with 3D in particular. Change-Id: Idfa7b4642ec87147978e03d78d6233efbd151491 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: gl: Add support for instanced drawingLaszlo Agocs2019-07-012-16/+45
| | | | | | | ...when having a 3.3+ or ES 3.0+ context. Change-Id: Ie92815263e190912d8f0b7b92ae6da55e062af05 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: gl: Adjust texture and renderbuffer sizes automaticallyLaszlo Agocs2019-07-012-18/+47
| | | | | | | | | | | | | | | | | | | | | Enforce the maximum texture size limit both for textures and renderbuffers, showing warnings and adjusting the size automatically. On the low end ES 2.0 devices we can easily hit a maximum size of 2048x2048. For example a Raspberry Pi running in full HD with the Controls 2 Material style breaks right away as it tries to create slightly wider than 2048 texture for its ShaderEffect. Instead of breaking with an obscure framebuffer incomplete warning at best, show something more informative and adjust the sizes so that something shows up on the screen still. (naturally applications not taking the maximum sizes returned from QRhi into account are technically incorrect and may well end up with incorrect rendering, but we should still try handling this as gracefully as possible) Change-Id: Ib75eb893ab4774e1a3c49ed2d14c6bf9be8c807a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: gl: Make fb attachment logic ES 2.0 and WebGL compatibleLaszlo Agocs2019-07-012-19/+68
| | | | | | | | | | | | So that we can now operate on plain ES 2.0 implementations like the Broadcom stack on the Raspberry Pi (which does not even have packed depth stencil). Also add the WebGL-specific combined attach logic to enable WebAssembly. This has not been tested in practice. Change-Id: I21219319062f295c1e88e3057c0c2ede724ac664 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Enhance line width and point size supportLaszlo Agocs2019-07-017-9/+52
| | | | | | | | | | | | | | | | | | | | | ...but this will vary between backends, or in some cases even between implementations of the same API. Point size is settable only via the vertex shader (gl_PointSize). It is silently ignored with D3D and HLSL. Line widths other than 1 are supported only on OpenGL and Vulkan. (but this is in fact deprecated with GL and optional with Vulkan) Add QRhi::Feature values for both. The line width is now settable on QRhiGraphicsPipeline. It is not a dynamic state since the static, per-pipeline width is good enough for most cases. (and the feature is not supported on half of the backends anyways so it will get limited use in practice). Change-Id: I6d3a32269527c452b794b2cb8b0f03101eab40b2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* RHI: Fix deprecation warnings about QAtomicInteger::load()Friedemann Kleint2019-06-282-5/+5
| | | | | | | | | | | | | | | | | | Replace by loadRelaxed(), fixing: rhi\qrhi.cpp: In static member function 'static QRhiShaderResourceBinding QRhiShaderResourceBinding::uniformBuffer(int, QRhiShaderResourceBinding::StageFlags, QRhiBuffer*)': rhi\qrhi.cpp:2578:26: warning: 'T QBasicAtomicInteger<T>::load() const [with T = int]' is deprecated: Use loadRelaxed [-Wdeprecated-declarations] Q_ASSERT(d->ref.load() == 1); Change-Id: Iebe9a62d20498e67bde34b2f0cab8cc38682154f Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* RHI: Fix compilation with MinGW developer buildsFriedemann Kleint2019-06-281-2/+3
| | | | | | | | | | | | | | | | Make aligned a template, fixing: rhi\qrhid3d11.cpp: In member function 'void QRhiD3D11::updateShaderResourceBindings(QD3D11ShaderResourceBindings*)': rhi\qrhid3d11.cpp:1627:53: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] Q_ASSERT(aligned(b->u.ubuf.offset, 256) == b->u.ubuf.offset); Change-Id: I6b747ebaf78e5accb9b7ed145df71a80d0a15762 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Optimize some atomic countersMarc Mutz2019-06-272-6/+3
| | | | | | | | | | | | 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: d3d: gl: Remove incorrect exec.Cmd.Buf. assumptionLaszlo Agocs2019-06-212-4/+0
| | | | | | | | | | | | | May very well be called within an active pass when going through beginExternal() (think examples like d3d11underqml) Change-Id: Ie98e72609308f47497d83fbe10c19ad1ae8eade3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: d3d11: Add compute and load/store res supportLaszlo Agocs2019-06-212-80/+450
| | | | | | | | | | | | | Also revise how we reset shader input/outputs at the beginning of a pass. Change-Id: I6d4057f32318ca09b12e16c602bb1033a3ec8e3c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: metal: Reuse drawable after a frame without a presentLaszlo Agocs2019-06-181-2/+7
| | | | | | | | | | | | | | The source of this is likely a "window" grab from Qt Quick. Requesting a new drawable is an error in this case since we do not enqueue a present for the current one. Change-Id: I64bab03ff46743ce1f270b251229be126f9ad9fb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Add compute api and implement for Vulkan and MetalLaszlo Agocs2019-06-1716-421/+1902
| | | | | | | | | | | | | 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-1713-0/+49
| | | | | | | | | | | | | | | | | 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>
* rhi: Remove reserved and since from the shader classesLaszlo Agocs2019-06-173-5/+0
| | | | | | | | | | | | Private API, do not bother with these yet. Change-Id: I77fb8fadee427425759ed42234944b30155db0f5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Introduce the Qt graphics abstraction as private QtGui helpersLaszlo Agocs2019-06-1329-0/+29413
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>