summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Change qHash() to work with size_t instead of uintLars Knoll2020-04-094-22/+22
| | | | | | | | | | | This is required, so that QHash and QSet can hold more than 2^32 items on 64 bit platforms. The actual hashing functions for strings are still 32bit, this will be changed in a follow-up commit. Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-082-77/+282
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/doc/src/cube.qdoc src/corelib/global/qlibraryinfo.cpp src/corelib/text/qbytearray_p.h src/corelib/text/qlocale_data_p.h src/corelib/time/qhijricalendar_data_p.h src/corelib/time/qjalalicalendar_data_p.h src/corelib/time/qromancalendar_data_p.h src/network/ssl/qsslcertificate.h src/widgets/doc/src/graphicsview.qdoc src/widgets/widgets/qcombobox.cpp src/widgets/widgets/qcombobox.h tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro tests/manual/diaglib/debugproxystyle.cpp tests/manual/diaglib/qwidgetdump.cpp tests/manual/diaglib/qwindowdump.cpp tests/manual/diaglib/textdump.cpp util/locale_database/cldr2qlocalexml.py util/locale_database/qlocalexml.py util/locale_database/qlocalexml2cpp.py Resolution of util/locale_database/ are based on: https://codereview.qt-project.org/c/qt/qtbase/+/294250 and src/corelib/{text,time}/*_data_p.h were then regenerated by running those scripts. Updated CMakeLists.txt in each of tests/auto/corelib/serialization/qcborstreamreader/ tests/auto/corelib/serialization/qcborvalue/ tests/auto/gui/kernel/ and generated new ones in each of tests/auto/gui/kernel/qaddpostroutine/ tests/auto/gui/kernel/qhighdpiscaling/ tests/libfuzzer/corelib/text/qregularexpression/optimize/ tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/ tests/libfuzzer/gui/text/qtextdocument/sethtml/ tests/libfuzzer/gui/text/qtextdocument/setmarkdown/ tests/libfuzzer/gui/text/qtextlayout/beginlayout/ by running util/cmake/pro2cmake.py on their changed .pro files. Changed target name in tests/auto/gui/kernel/qaction/qaction.pro tests/auto/gui/kernel/qaction/qactiongroup.pro tests/auto/gui/kernel/qshortcut/qshortcut.pro to ensure unique target names for CMake Changed tst_QComboBox::currentIndex to not test the currentIndexChanged(QString), as that one does not exist in Qt 6 anymore. Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
| * rhi: gles2: fix uniform gathering after struct-type member in UBOsJean-Michaël Celerier2020-03-231-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given: struct Light { vec4 foo; }; layout(std140, binding = 2) uniform material { Light light; int lightCount; }; the previous code would keep "light" appended for the prefix and look for `light.lightCount`. Change-Id: Ia8deacd0cb4833f45151e922fa7b5970169332eb Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
| * rhi: gl: Reduce state changesLaszlo Agocs2020-03-202-74/+278
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...between setGraphicsPipeline() calls with different QRhiGraphicsPipeline instances within the same pass. Also adds similar logic for the GL_ARRAY_BUFFER (vertex buffers) as that is a hotspot as well. This is not intended to be a 100% avoiding any redundant call solution, but rather to take care of the most common hotspots, so that bad OpenGL implementations with a larger API call overhead will not cause us to regress compared to the direct OpenGL rendering path in Quick and Quick3D. What we have here reduces the number of GL calls in the view3d example by ~200 within one frame, which is a pretty good start. Task-number: QTBUG-78603 Change-Id: I6aeab9c1c43b148ea6ef05d0284990a996c7ba28 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | rhi: d3d11: Disable DXGI message queue monitoringLaszlo Agocs2020-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | We do not benefit from it (don't need Alt+Enter and such). Switching to DXGI_MWA_NO_WINDOW_CHANGES is also in line with the qtbase/5.14 patch 1430b29 that does the same for ANGLE. Change-Id: Ie6384aeb2e97130ff439f761a7c166086f04526c Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | RHI: Fix running with Vulkan on WaylandEskil Abrahamsen Blomfeldt2020-03-302-19/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the Wayland client plugin is in use, the capabilities for the surface may report a minimum image count of 4. The internal "maximum minimum count" of 3, was arbitrary and only used for sizing buffers. To be more friendly to different setups, we remove the restriction and use QVarLengthArrays instead. We also set the initial size of the buffers to 4 so that we can run with Wayland without any resizing, but now the arrays will also grow to be safe for cases where 4 is not sufficient. Change-Id: Iba5434e84417d36b70f2655b152e816f04650ce4 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Use qsizetype for size related methods in QVarlengthArrayLars Knoll2020-03-141-1/+1
| | | | | | | | | | Change-Id: Ib94b9a4e6e17da21f592e71a36fd1b97d42dfe62 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-119-234/+423
|\| | | | | | | Change-Id: Ibee5acec72a1a1769d4bc5f23f56c7dc8d4cf3cb
| * rhi: d3d11: Honor resource/sampler slot limitsLaszlo Agocs2020-03-101-66/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Show a warning but allow applications to survive by not attempting to call VS/PS/CSSetWhatever() with an invalid number of resources. Relevant for samplers in particular, where the limit is 16. Qt Quick 3D exhibits problems with this when using custom materials combined with shadow mapping, and while this is not a solution to the problem there, at least the problem is now clearly indicated instead of crashing. Task-number: QTBUG-82719 Change-Id: I83914b7648001fa421ed1cf07a7b7444e0ef8fc0 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
| * rhi: vulkan: Silence useless desc.set validation warningsLaszlo Agocs2020-03-061-0/+9
| | | | | | | | | | | | | | | | | | | | This is deemed more appropriate than having some time consuming tracking of descriptor types in pools, just to avoid the rare case of attempting a failing vkAllocateDescriptorSets(), which is then always followed by another, successful attempt. Change-Id: I7a3a1d80afe400dc96605a3d6c834e8b2c71143a Reviewed-by: Christian Strømme <christian.stromme@qt.io>
| * rhi: Add support for arrays of combined image samplersLaszlo Agocs2020-03-059-168/+290
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces a new QRhiShaderResourceBinding function that takes an array of texture-sampler pairs. The existing function is also available and is equivalent to calling the array-based version with array size 1. It is important to note that for Metal one needs MSL 2.0 for array of textures, so qsb needs --msl 20 instead of --msl 12 for such shaders. Comes with an autotest, and also updates all .qsb files for said test with the latest shadertools. Task-number: QTBUG-82624 Change-Id: Ibc1973aae826836f16d842c41d6c8403fd7ff876 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-03-0414-132/+382
|\| | | | | | | Change-Id: I99ee6f8b4bdc372437ee60d1feab931487fe55c4
| * rhi: Add a way to communicate back the native image layout for a QRhiTextureLaszlo Agocs2020-03-034-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Relevant when doing custom rendering combined with QRhi, and only for APIs like Vulkan, where image layouts are a thing. As shown by demo apps, it is not currently possible to implement a correct application that renders or raytraces into a QRhiTexture's backing VkImage, and then uses that QRhiTexture in a QRhi-based render pass. This is because QRhi has no knowledge of the image layout if it changes due to commands recorded by direct Vulkan calls, and not via QRhi itself. So, except for certain simple cases, one will end up with incorrect image layout transitions in the barriers. (at minimum this will be caught by the validation layer) To remedy this, add a simple function taking the layout as int (we already do the opposite in nativeTexture()). Task-number: QTBUG-82435 Change-Id: Ic9e9c1b820b018f3b236742f99fe99fa6de63d36 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
| * rhi: Use versioning in QShaderDescription serialization as wellLaszlo Agocs2020-03-035-23/+29
| | | | | | | | | | | | | | | | | | | | This is the first time that we add something to QShaderDescription after migrating to the non-JSON based serialization system. This now involves checking the "qsb version" when deserializing. Task-number: QTBUG-82624 Change-Id: I2bd875ef21e461559b878dccc5537cdfa43feaa2 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
| * rhi: Include an arrayDims vector in InOutVariable tooLaszlo Agocs2020-03-032-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We use the this struct to describe combined image samplers and storage images as well. Especially with the former, it is not unlikely that we will need arrays, so e.g. layout(binding = 1) uniform samplerCube shadowCubes[8]. In this case the '8' is something that must be reported in to the reflection information. The new arrayDims member is expected to work exactly like the similarly named member in BlockVariable. Task-number: QTBUG-82624 Change-Id: I1fb8b0318906ff4c116c1a7ec23a399c6545c730 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
| * rhi: vulkan: Sanitize device extension handlingLaszlo Agocs2020-03-033-18/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of qputenv("QT_VULKAN_DEVICE_EXTENSIONS", "VK_KHR_get_memory_requirements2;VK_NV_ray_tracing"); one can now do params.deviceExtensions = { "VK_KHR_get_memory_requirements2", "VK_NV_ray_tracing" }; on the QRhiVulkanInitParams passed to QRhi::create(). The environment variable stays important for Qt Quick applications, which provide no configurability for the QRhi construction (yet). On the other hand, applications using QRhi directly can now also use the new approach to specify the list of device extensions to enable. In addition, take QVulkanInfoVector<QVulkanExtension> into use. There is no reason not to rely on the infrastructure provided by QVulkanInstance. This also implies showing an informative warning for unsupported extensions, instead of merely failing the device creation. (applications will likely not be able to recover of course, but at least the reason for failing is made obvious this way) Task-number: QTBUG-82435 Change-Id: Ib47fd1a10c02be5ceef2c973e61e896c34f92fa3 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
| * rhi: d3d: Use native resource binding mapping table when presentLaszlo Agocs2020-03-032-64/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Newer versions of QShaderBaker will now use distinct, zero-based b, t+s, and u register spaces in the generated HLSL source. If this is the case, the native resource binding map (which so far we only used with Metal) contains the SPIR-V binding -> HLSL register binding mappings. This way we won't end up with invalid resource binding attempts (consider that e.g. D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT is only 16), just because, for example, a combined image sampler had a binding of 18 which then got blindly mapped to s18 and t18 in HLSL. Task-number: QTBUG-82472 Change-Id: I8bdcb5378634cf159f6367424582f9e9e5821c8e Reviewed-by: Christian Strømme <christian.stromme@qt.io>