summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Replace some usages of 0/zero/null with \nullptrSze Howe Koh2020-01-271-2/+2
| | | | | Change-Id: Ibe7de11fc6fc41477c35e7d653c6a911855deabb Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Introduce VK_KHR_display support for i.MX8 devicesLaszlo Agocs2020-01-221-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The eglfs_viv backend has Vulkan support now. While the support code is common (lives in api/vulkan), we will not expose this for any other integration yet, without the appropriate testing. While putting this to eglfs seems unintuitive at first, it turns out that for Vivante in particular this is very useful, since we can rely on the existing framebuffer device infrastructure to solve certain problems (like the lack of vsync) The VK_KHR_display implementation of Vivante currently exhibits all the known issues of the old, fbdev-style EGL plumbing (presumably since it lives on top of that): - No vsync. This can be fixed by setting QT_QPA_EGLFS_FORCEVSYNC. - May need a manual call to fbset to set the correct resolution before launching the Qt app. - And of course it lacks all the multi-screen features provided by drm. - Plus, it seems the swapchain only supports a min/max buffer count of 1. This needs special handling in QRhi since until now we assumed that there was always at least 2 buffers available. [ChangeLog][Platform Specific Changes][Linux] Vulkan is now supported by eglfs (eglfs_viv backend) on i.MX8 devices with the Vivante graphics stack. This is done via VK_KHR_display so no windowing system is required. Task-number: QTBUG-78754 Change-Id: I7530aa026d4b904b9de83f9bdbdc4897ae770e71 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-181-1/+1
|\ | | | | | | Change-Id: I12148e7b20bcdb72d9b328035d528c99633b1e92
| * Doc: Fix qdoc compilation errors qtbaseNico Vertriest2020-01-171-1/+1
| | | | | | | | | | | | Task-number: QTBUG-79824 Change-Id: I5a39525e3e735415ba96e2d585c5de754deb15de Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* | Move away from CBOR in QShaderDescription serializationLaszlo Agocs2020-01-135-5/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...but keep support for deserializing for all older versions in order to play nice with existing .qsb files. The usage of binary JSON and then CBOR is a historical artifact: relying on the QJsonDocument (which we generate for purposes unrelated to binary serialization) was a convenient shortcut. However, writing to and reading from a QDataStream instead (which QShader already does) is trivial. In order not to be limited by potential CBOR requirements in the future, take it all into our own hands. Extend the qshader autotest accordingly. Task-number: QTBUG-81298 Change-Id: If0047b659bd6601ca47b5bbbce1b719630cde01e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | rhi: gl: vulkan: Generate barriers between dispatches in a compute passLaszlo Agocs2020-01-134-18/+291
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new float16texture_with_compute manual test demonstrates a case that was not handled correctly before: multiple dispatch() calls in a row storing to and then loading from the same subresource(s). Without the appropriate barriers subtle data corruption issues appear. For Vulkan this also adds better batching for image/buffer barriers when using deferred recording. Also, for OpenGL this fixes the case of updating a buffer or rendering into a texture and then using it for load/store in a compute pass (previously this also lacked an appropriate glMemoryBarrier). Task-number: QTBUG-81217 Change-Id: I7970c445564473f9452662f4b1a20618cb8627a3 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* | rhi: gl: Do not issue glMemoryBarrier when compute is not supportedLaszlo Agocs2020-01-131-2/+3
| | | | | | | | | | | | | | Avoid crashing in a < GLES 3.1 and < GL 4.3 contexts. Change-Id: I0f713a527890ec209c967ebb6c5bb3baa77d9a31 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Remove QShaderDescription::toBinaryJson(), deprecated fromBinaryJson()Ulf Hermann2020-01-103-32/+22
| | | | | | | | | | | | | | | | | | | | Binary Json is deprecated and we should not use it. We can already serialize shaders to CBOR. Push the deprecation warning mechanism to the only user of fromBinaryJson(). Change-Id: I1d56157ab92f74eaab49400be647317e7833e35e Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | rhi: Add R16F and R32FLaszlo Agocs2020-01-096-0/+44
| | | | | | | | | | | | | | | | Can be relevant for Qt Quick 3D shadows, where the shadow map is R16F. Task-number: QTBUG-81268 Change-Id: Ic33e100929e133d1cbe0b062a15697c82536f62a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | rhi: metal: Fix incorrect native res. binding map checkLaszlo Agocs2020-01-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Checking for nullptr is insufficient: just because there is an empty map present, it does not mean it is valid. The two cases must be handled identically. This fixes a regression when using QShaders that do not have an associated native resource binding map. Amends 4639660dedceba7c16e1a8110bba16eff30be312 Change-Id: Icb239bf9a9261ed32f2cb7b22c60b608195618fc Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | rhi: Remove ugly fallthroughsLaszlo Agocs2020-01-094-72/+0
| | | | | | | | | | | | | | The coding style does not actually require this. Change-Id: I2be7cd29c4dabfed2822cd7fb63e597c071e5e15 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Deprecate QJsonDocument methods for converting to/from JSON binarySona Kurazyan2020-01-091-2/+8
| | | | | | | | | | | | | | | | | | Also remove the example code for deprecated methods and use CBOR instead where it makes sense. Task-number: QTBUG-81068 Change-Id: Iffb7a4b3d7b16a1e485fc05b3ab2e2468e9e0718 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | RHI: Remove old native texture APIPaul Olav Tvete2020-01-0617-280/+7
| | | | | | | | | | | | Task-number: QTBUG-78570 Change-Id: I8c4850828ac03319ac923a26c2e985883956c286 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Add environment variables for customizing VulkanPaul Olav Tvete2020-01-061-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QT_VULKAN_INSTANCE_EXTENSIONS to specify additional instance extensions. QT_VULKAN_INSTANCE_LAYERS to specify additional instance layers. QT_VULKAN_DEVICE_EXTENSIONS to specify additional device extensions. These will apply to all QVulkanWindows and everything that uses RHI, including Qt Quick with the Vulkan RHI backend. Task-number: QTBUG-80499 Change-Id: I912495affa987d62a9823d55d06d6a8209f6adc6 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | rhi: gl: Add support for arrays of float, vec2, vec3 and vec4Laszlo Agocs2019-12-122-10/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a thing in Qt Quick: there are some types of image particles that use uniforms like "float opacitytable[64]". This should make all views work correctly in the Image Particles example when running on the OpenGL backend of QRhi. (other backends should work as expected already) Change-Id: I64a04fbb98b97d81d257b00b428582e751d46b8e Fixes: QTBUG-80667 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | rhi: metal: Skip inactive resourcesLaszlo Agocs2019-12-122-30/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Quick3D-on-RHI PoC demonstrates a case which the Metal backend fails to handle correctly: have an object with a lighting-enabled material, but remove all lights from the scene. Under the hood this means having a uniform block in the shader, but without referencing it in any way in the actual shader code. This leads to the resource being present (as far as shader reflection is concerned), but with no native binding point available, meaning the attempt to retrieve the Metal binding point for it returns -1, and that is what the QShader carries in the nativeResourceBindingMap. The backend should be prepared to silently skip the resource, whereas currently we end up in an assertion due to attempting to batch the (native) binding "-1", which is invalid. Correct this. Change-Id: I85ee58145f589aca45d46c23e0cdce837d598850 Fixes: QTBUG-80668 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | rhi: gl: Handle struct and array of struct uniformsLaszlo Agocs2019-12-102-13/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have intentionally limited support for advanced things like arrays in a uniform block. There is one very common case however: a one dimensional array of a struct. Typical example for Qt Quick 3D: struct LightSource { vec4 position; ... }; layout (std140, binding = 1) uniform cbBufferLights { int uNumLights; LightSource lights[MAX_NUM_LIGHTS]; }; With GLSL (uniform blocks disabled) this gets turned into two structs where one has a 'lights' member that is an array of the other struct. Teach the OpenGL backend of QRhi how to handle this. This makes the QRhi port of Qt Quick3D functional with the OpenGL backend as well. Change-Id: I6a09b93276794f7ecdd38f5bfbd3491a9ef58146 Fixes: QTBUG-80628 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | rhi: gl: Destructure mat3 correctlyLaszlo Agocs2019-12-101-1/+9
| | | | | | | | | | | | | | | | As per std140 packing rules. Change-Id: I85663d36a9fa617ea387e8f201677471b2ebd948 Fixes: QTBUG-80655 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2019-12-101-1/+4
|\| | | | | | | | | | | | | Conflicts: tests/auto/network/kernel/qnetworkinterface/BLACKLIST Change-Id: I1e8866c63b54bcd95fc2a044276ee15b7f60e79a
| * rhi: metal: Do not fail pipeline creation upon compiler warningsLaszlo Agocs2019-12-091-1/+4
| | | | | | | | | | | | Change-Id: I39384de56d74cf9f1d345a5d395cc07030c6a2ab Fixes: QTBUG-80629 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | RHI: new native texture APIPaul Olav Tvete2019-12-0512-0/+205
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-12-041-20/+0
|\| | | | | | | Change-Id: Ia70e81943ef097941339f9ef9ace28592a2eb740
| * rhi: Remove unused compat functionsLaszlo Agocs2019-12-031-20/+0
| | | | | | | | | | | | | | | | | | These were kept around to keep Qt Quick compiling, but the migration there has been done a long time ago. Remove these leftovers now. Change-Id: Ibd47381b410b11b5475a85c7ed3cb05c22f7adbb Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Ulf Hermann2019-12-032-3/+2
|\| | | | | | | | | | | | | Conflicts: src/corelib/serialization/qcborvalue.cpp Change-Id: I675a3029955c96e81a33ed9d98b72b55b6784b52
| * RHI/Vulkan: Fix buildFriedemann Kleint2019-12-021-0/+1
| | | | | | | | | | | | | | | | | | | | Add missing include, fixing: rhi\qrhivulkan.cpp(6273): error C2027: use of undefined type 'QWindow' Amends 0f812db558df072a411ade3305b796d54bccd996. Change-Id: Ide61b713e958877f18a45a89b36a4e1330f75821 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
| * rhi: vulkan: Remove unused includeLaszlo Agocs2019-11-291-1/+0
| | | | | | | | | | | | | | | | QVulkanWindow support has long been removed from the Vulkan backend. The include is a leftover from those times. Change-Id: Ie68ac3611b24310f2b6111a72dd0679adafdc74d Reviewed-by: Johan Helsing <johan.helsing@qt.io>
| * rhi: gl: Fix ms renderbuffer on WASM with WebGL2Laszlo Agocs2019-11-281-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Unlike renderbufferStorage, renderbufferStorageMultisample is not guaranteed to accept the unsized GL_DEPTH_STENCIL internalformat. For the former, WebGL 2 guarantees it for compatibility for WebGL 1, but the multisample version does not exist in WebGL 1, so from the specs it is not given at all that the unsized format would be accepted. So use the ES 3.0 sized format instead, like we would on a "real" ES 3.0 implementation. Fixes: QTBUG-80296 Change-Id: I822ae382097085c0a3279c16bb69a173dbf15093 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | rhi: Allow testing QRhiRenderPassDescriptors for compatibilityLaszlo Agocs2019-11-2712-68/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Enable QRhi Metal backend on iOSLaszlo Agocs2019-11-277-34/+59
| | | | | | | | | | | | | | | | | | | | While we are at it, remove the Border and MirrorOnce wrap modes that have not been supported on OpenGL, because they are unsupported with Metal+iOS as well. Task-number: QTBUG-78580 Change-Id: I0db94b9d3a6125b3bb5d7b1db5d02a42cd94d2c2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-11-231-1/+1
|\| | | | | | | Change-Id: I1c68f2f6bc35d344c60a1898b68bf2ca79e54a9d
| * rhi: d3d11: Do not rely on Win10-only enum valueLaszlo Agocs2019-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | When building against a 8.1 or older SDK the Windows 10-only value DXGI_SWAP_EFFECT_FLIP_DISCARD may not be present. Just use the value directly. At runtime that code path cannot be hit anyway when running on 8.1 or older. Task-number: QTBUG-80084 Change-Id: I0974b82db770e5487315798432ee601937b96c5e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-11-151-3/+3
|\| | | | | | | | | | | | | | | Conflicts: src/gui/rhi/qshader.cpp tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp Change-Id: I1c4ae718eb3592a0a0a90af9d11553f3ab68cad5
| * Be explicit about QDataStream serialization: explicit casts to intThiago Macieira2019-11-141-3/+3
| | | | | | | | | | | | | | The reader uses int variables, so use the same in the writer. Change-Id: I1496b069cc534f1a838dfffd15c94c7cacd3dd93 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | rhi: Move to CBOR in QShader and expand the autotestLaszlo Agocs2019-10-294-12/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Binary JSON is said to become deprecated. Therefore, add support for CBOR. Binary JSON is still supported for deserialization, so all existing .qsb files will continue to work, as long as the binaryjson feature is enabled in the Qt build. Also makes QShaderDescription comparable. This is important for tests in particular. A nice side effect of using CBOR is that .qsb files become smaller. For a typical Qt Quick material shader this can mean a reduction of 300 bytes or more. Task-number: QTBUG-79576 Change-Id: I5547c0266e3e8128c9653e954e47487352267f71 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-256-81/+246
|\| | | | | | | Change-Id: Iebedaa967a263854f18cd403ce007d7965f26d2b
| * rhi: Use Q_GLOBAL_STATIC for QRhiGles2 GL program cacheTor Arne Vestbø2019-10-241-3/+3
| | | | | | | | | | | | | | | | Defers initialization until actually needed. Change-Id: Idb09dbad0dfa602949d381ee61565d9050e77e7c Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| * rhi: metal: Fix and clean up committing resource bindingsLaszlo Agocs2019-10-241-45/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make it readable by using names instead of mere indices for the stages. There is an important fix in there as well: when in a render pass, only resource for VERTEX and FRAGMENT are taken into account, while in a compute pass those are skipped. This ensures that we do not send messages to a nil or invalid MTLRender/ComputeCommandEncoder. (nil would not be an error but the other is fatal) Task-number: QTBUG-79447 Change-Id: Ibef108cb7c82b5b0fdd2a299cd89fbebe8c3606a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
| * rhi: metal: Remap resource bindings based on the QShader tableLaszlo Agocs2019-10-242-31/+73
| | | | | | | | | | | | | | | | | | | | ...when available. Fall back to the QRhi (i.e. SPIR-V) binding point otherwise (which becomes unsafe once shadertools bumps its SPIRV-Cross snapshot, but is fine for existing .qsb files) Task-number: QTBUG-79368 Change-Id: I2d452fdd4efb484867732c358171a800d3261dcd Reviewed-by: Christian Strømme <christian.stromme@qt.io>
| * Store a native resource binding map in QShaderLaszlo Agocs2019-10-243-18/+135
| | | | | | | | | | | | | | | | | | The deserializer remains compatible with .qsb files without this additional section. Task-number: QTBUG-79368 Change-Id: I03e2a634febbd88da7f6a4369f104855ea31e3af Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-221-2/+24
|\| | | | | | | Change-Id: Ic062a5bd62621877b17cc0d47303b3c879241385
| * rhi: Enhance swapchain size query docsLaszlo Agocs2019-10-211-2/+24
| | | | | | | | | | | | | | | | | | | | | | Inspired by a recent Qt Quick fix. Make sure we make it clear that QRhi-based rendering code should base output size calculations (e.g. for setViewport() and similar) on the pixel size reported from QRhiSwapChain, instead of going to the QWindow. Change-Id: I2fc22972162ccc6307ac07ceb7766c746d5f562a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-162-7/+22
|\| | | | | | | Change-Id: Ifd83db69416230175ddc3161f640b612755018fc
| * rhi: gl: Do not let external rendering trash our vaoLaszlo Agocs2019-10-152-7/+22
| | | | | | | | | | | | Task-number: QTBUG-79221 Change-Id: Ie8e6376f79c816071c12962dc054838aeaabcaa5 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-1012-471/+987
|\| | | | | | | Change-Id: Iadeca81f499d6b19e86ceae1edd7960db2575e90
| * 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: Fix non-base level copy and readback wrt source sizeLaszlo Agocs2019-10-094-17/+19
| | | | | | | | | | | | | | | | | | | | | | | | When the source size is not explicitly specified, we take the entire subresource. However, just using the texture's size is wrong: when the source level in a copy or readback is not 0, the size for the corresponding mip level has to be used instead. This fixes occasional crashes with Metal in the autotest. Change-Id: I99f689feef93ec86dffdc9e82d6bfdaf5c1eb041 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
| * rhi: Autotest rendering a triangleLaszlo Agocs2019-10-098-4/+61
| | | | | | | | | | | | | | | | | | 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: gl: Add a feature flag for reading back non-zero mip levelsLaszlo Agocs2019-10-097-11/+41
| | | | | | | | | | | | | | | | | | The joys of "level - Specifies the mipmap level of the texture image to be attached, which must be 0." for glFramebufferTexture2D in OpenGL ES 2.0. Change-Id: Iaf19502f48d7ba73b26abb72535bfa6696a1e182 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
| * rhi: gl: Switch GetBufferSubData emulation to MapBufferRangeLaszlo Agocs2019-10-093-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Use only APIs that are in GLES 3.0. glMapBuffer() is an old OES extension, stop bothering with that. Not the least because ANGLE claims supporting it and then fails the map. (not that we care much about ANGLE, but, for instance, the qrhi autotest is run with ANGLE configurations as well in the CI, so have to still take care of it for the duration of Qt 5.x) Change-Id: I29140402cedffe0430f920ee0c061673257c3aa1 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>