summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi
Commit message (Collapse)AuthorAgeFilesLines
* rhi: gl: Correctly report WideLines for OpenGLLaszlo Agocs2020-08-302-2/+3
| | | | | | | | In core profile contexts a line width other than 1 may not work as expected since it is deprecated in the core profile. Change-Id: I3fc33cf90c65156aa87d04f08518c9ddcfb62625 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: vulkan: Enable features on the deviceLaszlo Agocs2020-08-301-2/+17
| | | | | | | | | | | The silly fine-grained enabling of features on the VkDevice seems to be ignored in practice by the implementations, but wideLines becomes relevant because the validation layers warns if a line width is set on the pipeline without enabling the feature on the device. So to play nice, enable the features we care about. Change-Id: I0c64a0d10a8279fe43d899118b0d6f0e4f875d41 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: gl: Also try GLSL 140 and 130Laszlo Agocs2020-08-301-9/+13
| | | | | Change-Id: I21e3ca92d62f20f3ec608bef54c68f9bd09a207f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: d3d: Allow compiling source shaders with debug at run timeLaszlo Agocs2020-08-283-6/+56
| | | | | | | | | | Relevant for Qt Quick 3D. As in many cases Quick3D will rely on runtime generated shader code, the translated HLSL will be compiled via D3DCompile() at run time. To make such shaders debuggable, the necessary flag (D3DCOMPILE_DEBUG) should be requestable somehow. Change-Id: I4d5c3b57bf58df8d46556eebb5cf6fb75e9d0afe Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Doc: Fix documentation warnings for Qt GUITopi Reinio2020-08-281-0/+4
| | | | | | | | | | | | * Drop deprecation warnings for now-dropped items * Use the 'qt6' define and a new \nothing doc macro to conditionally document items on Qt 6 * Add a custom module header for docs that pulls in also Vulkan headers * Add \internal command for internal classes/functions * Move QtGUI-related code snippets from widgets to gui docs Change-Id: Ieb386b96631a49568d09059906d307c45c01d93a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Change QByteArray to handle large arraysLars Knoll2020-08-271-2/+2
| | | | | | | | | | Use qsizetype throughout. Change-Id: I787af7fcfa17e1be87decb64c41c609cc24be117 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port QSet to qsizetypeUlf Hermann2020-08-251-1/+1
| | | | | Change-Id: I70ad8fb6908ce3837a723e9a095bee5c166739e4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: d3d11: Enable setting xxxColor as an alpha src/dst blend factorLaszlo Agocs2020-08-191-11/+17
| | | | | | | Fixes: QTBUG-86111 Pick-to: 5.15 Change-Id: Iabcf1708ea65e9f05f39caf9df9b45c25ac5dbb8 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: sanityCheckGraphicsPipeline handle no vertex attributesPaul Lemire2020-08-181-7/+1
| | | | | | | | | It is a valid use case to have a vertex shader with no vertex attributes. Using gl_VertexID or gl_InstanceID is enough to generate vertex data out of thin air. Change-Id: If7689914624a84723923fd2d7aef355bda592e24 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: QRhiGles2 use proper texture target for multisampled texturesPaul Lemire2020-08-172-3/+18
| | | | | Change-Id: I6e92a66f2758599626e7bdfbb2e149bb69192479 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Disentangle QIODevice dependenciesLars Knoll2020-08-151-0/+1
| | | | | | | | | | | | | | | | | Move the QIODevice::OpenMode enum into a base class, so that we can remove the full QIODevice (and thus QObject) dependency from qdatastream.h and qtextstream.h. This is required so that we can include QDataStream in qmetatype.h without getting circular dependencies. As a nice side effect, QDataStream and QTextStream can now inherit QIODeviceBase and provide the OpenMode enum directly in their class scope. Change-Id: Ifa68b7b1d8d95687ed032f6c9206f92e63bfacdf Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Another round of using noexcept instead of pre-C++11 definesAllan Sandfeld Jensen2020-08-136-87/+87
| | | | | | | A few new files were added with old-school defines. Change-Id: Ieb2c71e094e55102f3f39fb9551823f36863f5f4 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove old CBOR-based format from QShaderLaszlo Agocs2020-08-114-218/+19
| | | | | | | | | We only support version 4 and 5 in Qt 6.0. 1 and 2 are already gone (due to being based on binary JSON), now we remove 3 as well. Task-number: QTBUG-81346 Change-Id: I3627dcc0587f1e36f11e93edf7172889e911d64e Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: QRhiGles2 fix leak BlitFromRenderbufferPaul Lemire2020-08-071-0/+1
| | | | | | | Leaked FBO otherwise lead to massive runtime memory consumption increases. Change-Id: Ic8ffad4917c11294e6c83cdae0b36114d661b251 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove deprecated binary json featureEdward Welbourne2020-07-313-34/+1
| | | | | | | | | Deprecated in 5.15 in favor of CBOR. Fixes: QTBUG-81239 Change-Id: I711d4bd7dd1247f58e77ac9fa53304cbe5028918 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: QRhiGLes2::gatherUniforms fix gathering in structPaul Lemire2020-07-311-1/+2
| | | | | | | | In the case we don't have an array of structs, structPrefix needs to be suffixed with a dot to get the proper uniform names. Change-Id: I50ed54c2f7c3cc4556ed1854419bc4fe3a2989f7 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Revert "Add missing override" for 3rdparty vk_mem_alloc.hAlexander Volkov2020-07-291-0/+3
| | | | | | | | | This partially reverts 9bad3508fccb058261d47e023400868147f2d733. Disable -Wsuggest-override for gcc when including the header instead. Change-Id: Id2507ce731da62bbd64aa6477b181735ba62adc1 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: Allow null resources in srbLaszlo Agocs2020-07-133-64/+135
| | | | | | | | | | In this case the srb represents the layout only, and can still be used to create a pipeline. For setShaderResources() one will then need to use another, layout compatible, srb that references valid resources. Change-Id: I3ea5b63df3be8847540ca4c0c40fbd29dbed8fb7 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Use QList instead of QVector in gui implementationJarek Kobus2020-07-078-24/+24
| | | | | | | 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>
* Use qsizetype in QListLars Knoll2020-07-061-1/+1
| | | | | | | | | | | | | | | | | | | | The change creates a slight source incompatibility. The main things to take care of are * code using printf statements on list.size(). Using qsizetype in printf statements will always require a cast to work on both 32 and 64 bit. * A few places where overloads now get ambiguous. One example is QRandomGenerator::bounded() that has overloads for int, uint and double, but not int64. * Streaming list.size() to a QDataStream will change the format depending on the architecture. [ChangeLog][QtCore][QList] QList now uses qsizetype to index into elements. Change-Id: Iaff562a4d072b97f458417b670f95971bd47cbc6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* rhi: add support for D24 / D24S8 formatsJean-Michaël Celerier2020-07-026-13/+71
| | | | | Change-Id: I7ba14d30fa57bcb92cd764aed6c85cde853935b4 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Switch to qvla where it makes sense in rhiLaszlo Agocs2020-06-308-39/+43
| | | | | | | | | For all of these we know in advance that the vast majority of usages will not exceed a certain number of elements. Also, none of these are copied or moved ever. Change-Id: I48aedf143e221dc178d661e23454d1e4fb7a271b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Use QList instead of QVector in guiJarek Kobus2020-06-2911-66/+62
| | | | | | | | Applied to headers only. Source file to be changed separately. Task-number: QTBUG-84469 Change-Id: Ic08a899321eaffc46b8461aaee3dbaa4d2c727a9 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: Enable specifying just an adapter or phys devLaszlo Agocs2020-06-268-71/+153
| | | | | | | | | Required by OpenXR. A VkPhysicalDevice or an adapter LUID + feature level pair should be adoptable while leaving the rest (device, queue, etc. setup) to QRhi as normal. Change-Id: Iada0972671b037b4efb03e7831b7c9b8c5f2393d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Use global share context in QRhiGles2Jüri Valdmann2020-06-221-0/+4
| | | | | | | | Needed for using native textures in WebEngine. Task-number: QTBUG-78682 Change-Id: I8458b17767bb992357064d85f159781ea24e61dc Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: Add a feature flag for readback format supportLaszlo Agocs2020-06-156-1/+23
| | | | | | | | | Indicate that doing a QRhiResourceUpdateBatch::readBackTexture() for texture formats other than RGBA/BGRA is not necessarily supported at run time. Change-Id: Ie9ca9546a3af9bff142b875f1ecf26bf26bcc442 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* rhi: gl: Support reading back 1 byte texture formatsLaszlo Agocs2020-06-121-5/+25
| | | | | | | | | | | | | | The GL texture readback is limited due to the underspecified glReadPixels, especially on GLES. To preserve our sanity, we just do a GL_RGBA readback always. This only worked for 4 byte formats, but now we extend it to handle the 1 byte (R8 and RED_OR_ALPHA8) formats. Note that this relies on the fact that the GL implementation is able to do a GL_RGBA readback for a GL_R8 or GL_ALPHA texture. Change-Id: I8286dca42964f0cbc6645355e105bbd81ec685ca Reviewed-by: Christian Strømme <christian.stromme@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add RHI feature check for screen space derivativesEskil Abrahamsen Blomfeldt2020-06-126-2/+14
| | | | | | | | | | | | | | Fragment shader functions like fwidth() are useful for antialiasing distance field text in the case of perspective projections. In order to enable this as an alternative code path, we need to detect support. - OpenGL: Supported with GL_OES_standard_derivatives or GLES3 and up - Direct 3D: Supported for ps_2_x, so always supported on Direct3D 11 - Vulkan/Metal: Always supported Task-number: QTBUG-84695 Change-Id: I5e3fa8014c808a9a2d639305c5e90ec25d44655c Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove winrtOliver Wolff2020-06-061-4/+0
| | | | | | | | | Macros and the await helper function from qfunctions_winrt(_p).h are needed in other Qt modules which use UWP APIs on desktop windows. Task-number: QTBUG-84434 Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix build without features.cborstreamwriterTasuku Suzuki2020-06-062-0/+4
| | | | | Change-Id: I970d21d7ac97a602a5f374f6c89cd4bfdcd847b8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use QByteArray instead of QStringJonas Karlsson2020-06-033-55/+73
| | | | | | | | | | Since the variable names in QShaderDescription are later compared to QByteArrays we can gain some performance from not having to convert them to QByteArrays later. Task-Id: QTBUG-83706 Change-Id: Iaf80d0966f45cbb09e7c1000b7854bc488e57bb3 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: Harmonize create-destroy API pattern with the rest of QtLaszlo Agocs2020-05-2813-490/+492
| | | | | | | | | | 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: d3d11: Use qstrncpy to avoid MSVC warningLaszlo Agocs2020-05-281-4/+2
| | | | | | | | | | | | | Switch strncpy to qstrncpy, which internally uses strncpy_s with MSVC. This way we will not get the following warning: qrhid3d11.cpp(933): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. Change-Id: Iaed86033b0fc182e68804f311ac382c93c72abda Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* QRhiVertexInputAttribute : Add unsigned int formats for vertex inputInho Lee2020-05-277-5/+80
| | | | | | Task-number: QTBUG-83173 Change-Id: I640cd1fe74227d2cc96672d6c7aaac93e1930bcd Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* RHI: Introduce QRhiTexture::RG8VaL Doroshchuk2020-05-256-0/+41
| | | | | | Change-Id: I58f35b2629bd6464f08cba66e852215472fcbe2a Fixes: QTBUG-84384 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix RHI-GL mapping of DXT3/5 compressed texture format identifiersEirik Aavitsland2020-05-251-2/+2
| | | | | | | | DXT1 is BC1, but DXT3 is BC2 and DXT5 is BC3. Change-Id: Icb0ea4cc9efeab2453343753e9fda7f825c9b8d1 Pick-to: 5.15 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* RHI: facilitate compressed atlas textures in gles2 backendEirik Aavitsland2020-05-224-5/+29
| | | | | | | | | | | | | | | Since glCompressedTexImage2D() does not allow zero data, it could not be executed during texture build. Instead it would be done during the first subresource upload. This made atlasing clumsy, since one had to introduce a fake upload of the full texture size before the subtexture uploads. This commits lets the gles2 backend deal with that instead. Introduces the UsedAsCompressedAtlas QRhiTexture::Flag for opting in to this behavior. Task-number: QTBUG-78582 Change-Id: Ib6e4ea637c62cc8a51bd9a4a06e59882f335f2a7 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* RHI: Store texture handle as 64-bit intEskil Abrahamsen Blomfeldt2020-05-226-26/+22
| | | | | | | | | | | | | | | | | | When storing a void* pointer to the texture handle, we had to ensure that the variable would exist until the build phase, which is error prone and caused errors in QQuickWidget because we copied the texture ID from the FBO into a local variable before passing it into QQuickWindow::setRenderTarget(). The reason for using a void* was that we cannot know the width of the handles in the different backends, but we do know that they are 64-bit at maximum, so instead of storing potentially dangling pointers, we just make it a 64-bit integer and cast it back and forth in the backends. Task-number: QTBUG-78638 Change-Id: I7951e24351ddb209045ab6197d81eb1290b4da67 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Initialize TextureOp and BufferOp structsVolker Hilsheimer2020-05-151-7/+7
| | | | | | | | | | | | | | | Fixes Coverity warnings, and avoids hard-to-debug errors, at minimal overhead. Change-Id: I3ff530a9263693d1123932458b3e186e79a14b7e Coverity-Id: 263692 Coverity-Id: 263693 Coverity-Id: 263699 Coverity-Id: 263700 Coverity-Id: 263702 Coverity-Id: 263705 Pick-to: 5.15 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: d3d11: Handle DXGI_ERROR_SDK_COMPONENT_MISSING gracefullyLaszlo Agocs2020-05-121-0/+9
| | | | | | | | | | | | Requesting the debug layer is not something that succeeds at run time if the corresponding SDK component is not present. Handle it gracefully: simply retry D3D11CreateDevice without the debug device flag. Relevant also for the Qt CI's Windows 10 VMs. Task-number: QTBUG-84067 Change-Id: Ia7b2562917ec11ce04a75c052527bf526d1fe81b Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Rhi: improve qHash implementationsGiuseppe D'Angelo2020-05-122-5/+26
| | | | | | | | Use the combiners and an algorithm. Change-Id: I577950bbd2e8b0556f28e2a8381e432c22bb0dc9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: vulkan: Fix calling finish() twice with some copy commands in-betweenLaszlo Agocs2020-05-071-3/+6
| | | | | | | | | | | The native command buffer handle was not updated, so the subsequent finish() call attempted to record an invalid VkCommandBuffer. The problem was not present with offscreen frames, only when finish() is called with a swapchain-based frame active. Task-number: QTBUG-84066 Change-Id: I9c4cb701c3dbbc28f237d6ae1cbf65aafd1fa95f Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Correct another scissor/viewport clamping problemLaszlo Agocs2020-05-071-2/+2
| | | | | | | | | | | | | | | | | | | | | When x or y are >= the width or height of the render target, then the width or height of the scissor/viewport rect is zero, no further logic is needed. This is different from the case of x or y being negative, because then there is still a chance that there is an in-bounds area (if width or height are large enough). It is important to make this check based on the original value of x and y, not the clamped ones. Otherwise we end up with a 1 pixel wide region even when the expected result is a width or height of 0. Previously the incorrect subtraction of 1 in the final clamping of w and h masked this, but once that is fixed, the issue fixed here becomes visible in the cubemap_scissor manual test. Change-Id: I3d4b0a163a16aa1116b1e838fa95c0faf7b56a3d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* RHI: fix off-by-one clippingEirik Aavitsland2020-05-071-2/+2
| | | | | | | | | | | In cases where qrhi_toTopLeftRenderTargetRect() would clip the width or height to the available space, it would subtract 1 from the result, leading to painting errors. Fixes: QTBUG-83928 Change-Id: I65d23151d838386b516ded0588702bc0bf4c0d93 Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Hotfix for int->qsizetype fallout in QShaderLaszlo Agocs2020-05-052-16/+16
| | | | | | | | The proper solution is to use qint32 everywhere, but that is left as a separate exercise. Change-Id: Id0c06b102b56a1b3b48dd67c6c29c28da7d1f22d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* rhi: Warn better in D3D/Vulkan for incompatible multisample resolve formatsLaszlo Agocs2020-04-302-3/+17
| | | | | | | | | | | | | | | Attempting to resolve a multisample image into a non-multisample one is only valid when the formats are the same, as per Vulkan spec and D3D docs. With Vulkan, this is sometimes not fatal, some implementations can apparently deal with some format combinations, so the problem may not be trivial to catch, although with validation layer enabled a warning is shown at least. To make it easier to discover, have our own warning. Task-number: QTBUG-83707 Change-Id: I8fc87471de91cd65a445fbe8cedbf31a8295db53 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* rhi: Add backing format hint to QRhiRenderBufferLaszlo Agocs2020-04-2913-250/+332
| | | | | | 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-237-8/+27
| | | | | | | | 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>
* Fix a few size_t / int conversion warningsFriedemann Kleint2020-04-101-1/+1
| | | | | | | | Change the hash function of QTypeRevision and QtFontFallbacksCacheKey to use size_t and add a few casts. Change-Id: I89a8fc617abbe8b0c67529ec41795691c99b0574 Reviewed-by: Lars Knoll <lars.knoll@qt.io>