Commit Graph

42719 Commits

Author SHA1 Message Date
Allan Sandfeld Jensen
332816779c Multithread some QImage routines
Use QThreadPool to process QImage smooth-scaling, format conversions,
and colorspace transforms multithreaded.

Change-Id: Ic142b1fa899f56e7e5099d36ca713701a47b681b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-09 23:22:43 +01:00
Tor Arne Vestbø
cc59f0de55 macOS: Support printing when no printers are installed
Even if there are no printers installed, we can still show the print
dialog, which gives the user feedback about no printers being installed,
allows them to install one, or allows them to print to PDF as a
fallback.

The code for printing to PDF has been re-enabled, and the conditions
of QTBUG-38820 have been removed as the problem is no longer present.
The code also takes into account the possibility that the user chose
to print to PostScript, which we don't yet support, but warn about.

We now also support opening the printed document in Preview. This
requires a minor assumption about the print operation being done
synchronously after the print dialog is accepted, but this is
something we can improve in the future with internal APIs if it
turns out to be a problem.

Printing workflows such as sending the printed document via mail
or messenger are not not supported, and will give a warning.

Fixes: QTBUG-36112
Change-Id: I8ba9e2c5ce31a5a06542c4a7126d005e4b27f2be
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-03-09 14:53:50 +01:00
Kai Koehne
2097932dc5 Document how to use CMake for Qt Network
Add documentation on how to use a module from CMake, alongside
the existing documentation about qmake.

While at it, also remove the mentioning of the central include;
It is not something we should actively advocate anymore. Instead,
the documentation of every class gives the correct include to use.

Task-number: QTBUG-73058
Change-Id: I71ed5a62f4f0a6d868dd1f84ea39e5ac385a2fb8
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-03-09 14:53:50 +01:00
Andy Shaw
20167a7fe9 WinRT: Use the fallbacks for getting the save file name
To bring it in line with the other platforms, then it needs to check if
the initially selected files are set and use the first one. Otherwise it
can fall back to the initial directory if that happens to include a
filename.

Change-Id: If34ae0e7e10b6a3c25e9422d9b4f2c21e6bfc8d1
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-03-09 14:53:50 +01:00
Ulf Hermann
37a66236d2 qmake: Document qmltypes and metatypes
Task-number: QTBUG-81615
Fixes: QTBUG-82305
Change-Id: I0a411ff2ebc2dbf5462fa110b1eb70a1876b6ae5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-03-09 09:25:06 +01:00
David Faure
4bc9e3b847 QDataStream: fix compilation with QT_DISABLE_DEPRECATED_BEFORE=0x0050F00
Fixes: QTBUG-81023
Change-Id: I0d56785d1fed2c4c8e0e87ccefb0b72b0ed3644a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-03-08 15:38:04 +01:00
Christian Ehrlicher
114394702b QtSql/ODBC: allow table names with unicode chars
The ODBC driver did not properly decode table names with unicode chars.
Fix it by explicitly passing the unicode flag to qGetStringData().

Fixes: QTBUG-82401
Change-Id: Id6eb44cc85ce196ea97d0d6aef1cd573fa033970
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-03-07 12:02:22 +01:00
Jarek Kobus
50d2acdc93 Add default arguments to QPainterPath methods using transform
Fixes: QTBUG-82602
Change-Id: Id82f145ffb33e6d4ef9b81282ad14657b1c8fbd0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-06 21:09:48 +01:00
Laszlo Agocs
ccee938b51 rhi: vulkan: Silence useless desc.set validation warnings
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>
2020-03-06 18:06:01 +01:00
Tor Arne Vestbø
94fc977b2b macOS: Disable system provided tabbing by default
macOS 10.12 introduced automatic window tabbing, where the OS provides
tab handling on behalf of the application. The feature defaulted to
being on, and the release notes asked applications that had their own
tab handling to disable the automatic tab handling explicitly.

Qt has its own tab handling, and should therefore disable the automatic
handling. We do this on a per NSWindow basis, using the tabbingMode
property of the window, instead of the global allowsAutomaticWindowTabbing
property on NSWindow, so that individual windows can still opt in to
the automatic tab handling. Doing it via the tabbingMode property
also ensures that we're not affecting the host application's
behavior in a plug-in setting.

Ideally Qt's tab handling should read the userTabbingPreference
property of NSWindow to pick up the system preference choice of
whether to open new windows as standalone windows or tabs, but
this is left for a later change. An alternative would also be to
use the automatic window tabbing instead of our own implementation.

Fixes: QTBUG-61707
Change-Id: Icf2078b63ec16202ff7fd83ea264a48dc61978e1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-06 18:06:01 +01:00
Joerg Bornemann
2de3bfced3 Fix UB in QProcess deprecation warning fixes
The commits e1e08629 and 66e905b1 introduced undefined behavior. Fix
this by assigning the result of takeFirst to a temporary.

Change-Id: I9e29412cf632d4836b95d47e12d8c07ab0645fbb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-06 10:00:01 +01:00
Sona Kurazyan
249a2e3271 Disable warnings for the deprecated QLinkedList
QLinkedList has been deprecated, but we still need to test it. Suppress
the warnings for QLinkedList used in tests. Note, that I had to move
some of the test code, to avoid repeating
QT_WARNING_PUSH/QT_WARNING_POP everywhere.

Change-Id: I4203b3ef50045c4f45475a08638dbdc60f68761d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-06 09:50:35 +01:00
Kai Koehne
1a9c29289a Doc: Mark QColorSpace enum as introduced in Qt 5.15
Change-Id: Ibf2da1ebb4eb9520a2a507ed6afb89f7176391bb
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2020-03-06 08:42:00 +01:00
Kai Koehne
b80503b377 Doc: Fix \sa link for QResource::uncompressedData()
No point in linking to itself.

Change-Id: Id0bf3fa6878417e541ec0997d34758b0c59e99b3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-03-06 08:41:32 +01:00
Paul Wicking
a2446c0eed Doc: Let SQL Drill Down example show correct use of qgraphicsitem_cast
For qgraphicsitem_cast to work correctly with custom items, one must
reimplement the type() function for each custom QGraphicsItem subclass.
Do that in the example code.

Fixes: QTBUG-7357
Change-Id: Ibf221817908355f0347cddfc46747b6955958f5f
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-03-06 08:12:52 +01:00
Laszlo Agocs
c3ae30085e rhi: Add support for arrays of combined image samplers
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>
2020-03-05 19:40:41 +01:00
Joerg Bornemann
e1e0862990 Fix deprecation warning in QGenericUnixServices
Do not use the deprecated method QProcess::start(QString) anymore.

Change-Id: I09eae2c8a1dbb53fd2de004e5030da9bb3c07b14
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-05 15:20:07 +01:00
Joerg Bornemann
66e905b1c3 Fix deprecation warning in QProcess::execute(QString)
Implement this method in terms of splitCommand and
QProcess::execute(QString, QStringList).

Change-Id: I1fe78fb53d8b6b34a8796f9fbda380a98a840c99
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-05 15:20:02 +01:00
Tor Arne Vestbø
a539e53eb0 Add 'pass' test to testlib selftests
Change-Id: I858cd5e6ef7ad1064166efb7325c62065d46eb27
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2020-03-05 15:18:04 +01:00
Marc Mutz
16f927a4f1 QLoggingRegistry: use QStringView/QLatin1String more
- QLoggingRule::parse() and the ctor take pattern as QStringView

- parseNextLine takes lines as QStringView and produces the pattern as
  QStringView for QLoggingRule

- (setContent has to wait for QStringTokenizer)

- QLoggingRule::pass()'s first argument is always QLatin1String, so
  take it as one

Use chopped() more, add a std::move().

Change-Id: Ic95ea77464a9922fef452846bc6d5053bd5de56e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-05 13:03:13 +02:00
Marc Mutz
c58249c327 tst_qstringapisymmetry: start testing char16_t, too
No surprises, as char16_t is transparently handled by QChar overloads.

Ok, one surprise: we seem to have QChar <> QByteArray relational
operators, but they don't work for char16_t. Probably members of
QChar, so LHS implicit conversions are disabled. Didn't investigate,
because it needs to be fixed at some point anyway, but that point is
not now.

Change-Id: I74e1c9bdd168e6480e18d7d86c1f13412e718a32
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-05 10:51:39 +03:00
Marc Mutz
50f865e33f tst_qstringapisymmetry: fix indexOf/contains/lastIndexOf tests
... to not fold QChar tests into QString ones.

This is needed for adding char16_t tests.

Change-Id: I2507d7d68a39ff96cf033eadde10e383dc976dda
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-05 07:50:33 +00:00
Marc Mutz
b2f79cceb1 QLatin1String/QStringView: add (missing) member compare()
[ChangeLog][QtCore][QLatin1String] Added compare().

[ChangeLog][QtCore][QStringView] Added compare() overloads
taking QLatin1String, QChar.

Change-Id: Ie2aa400299cb63495e65ce29b2a32133066de826
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-03-05 07:50:02 +00:00
Marc Mutz
728cc964f3 QString/QByteArray: make all symmetry-checked member-compare() combinations noexcept
In QByteArray, they were just not marked as such.

In QString and QStringRef, the implicit conversion from QChar to
QString would destroy it. Add a QChar overload, delegating to
QStringView.

Added docs for the new overloads, copying from the nearest neighbor so
as to not look out of place. All string classes use different wording
for these functions. A cleanup of this state of affairs is out of the
scope of this patch.

Change-Id: I0b7b1d037aa229bcaf29b793841a18caf977d66b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-05 07:49:40 +00:00
Timur Pocheptsov
9e46dd7719 Document TlsV1SslV3 as deprecated
Change-Id: Id127b6d985d0085982e47b4f80886e3831ce07c7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-04 19:24:58 +01:00
BogDan Vatra
519ea72108 Android: Bump gradle (plugin) versions
Move min & target sdk from AndroidManifest.xml to build.gradle

Fixes: QTBUG-70817
Change-Id: Id9bb9825a3232587e0255b2d3d6f0273c5f9b66a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-03-04 18:02:35 +00:00
Mårten Nordheim
8131116896 QSslCertificate: Turn enum into enum class and expand abbreviation
From API review

Change-Id: Id174ff1a0a123585e41723ef1c1876b2f3bd39c5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-04 18:36:04 +01:00
Andre de la Rocha
566def740e Windows QPA: Add support to UiaRaiseNotificationEvent()
This change adds support to UiaRaiseNotificationEvent() in the
UI Automation-based accessibility code, and uses it to notify changes
in string-typed values, allowing Narrator, NVDA and other screen readers
to notice changes in the application state that were previously missed.

Fixes: QTBUG-75003
Change-Id: I646ca3a851ab7b69817d900b002eb91a3bf607a6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-03-04 13:09:48 +01:00
Volker Hilsheimer
295a16b0d3 Don't use deprecated QPixmapCache::find overload
Silence compile time warning and show correct usage in example
snippet.

Change-Id: I1936f006e4b5f3ca71bbc0100ed039beeb459271
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-03-04 09:15:27 +01:00
Tor Arne Vestbø
048f0a00fa macOS: Don't create QMacCGContext when printing
We adopt the context of the print session, so the code is not needed,
and would just produce a warning since QMacCGContext didn't know what
to do about the printer paint device.

Change-Id: I9ac079f5cb5d98022045632592d0e375710eecc3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-04 01:30:11 +01:00
Tor Arne Vestbø
5d9d3ff326 macOS: Reduce save dialog extension filters to their last component
NSSavePanel does not deal well with multi-part extensions, to the point
where it will fail to open if that's the only acceptable extension.

We follow Chromium's lead here and reduce the extension to its last
component, which enables selecting and saving files such as 'foo.tar.gz'.

To improve the user experience we always show file extensions when we
detect a multi-part extension. This makes it clearer what the final
extension will be, and avoids confusing macOS about the intention of
the user when choosing a file that without the final extension also
matches another known extension.

Fixes: QTBUG-38303
Fixes: QTBUG-44227
Change-Id: Id0cee84f758c2cd59fcf1b339caa30f7da07dd1e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-04 00:29:54 +00:00
Thiago Macieira
1edf586ed7 QMimeXMLProvider: fix another issue with -no-mimetype-database
The compiler must emit the destructor for the members of a class in an
inline constructor, in case the constructor throws. This won't work in
Qt 5.15 due to QList requiring knowing whether QMimeMagicRuleMatcher is
trivial or not. Another solution would be to use QVector.

Fixes: QTBUG-82547
Change-Id: Ia8b65350cd5d49debca9fffd15f79db872ed7c0c
Reviewed-by: David Faure <david.faure@kdab.com>
2020-03-03 11:44:27 -08:00
Ivan Čukić
14420b359b Add operator-> to the key-value iterator for QHash and QMap
This patch adds the arrow operator to the stl-like key-value
iterator (QKeyValueIterator) for QMap and QHash.

This allows using normal member access syntax it->first and it->second
instead of having to use (*it).first and (*it).second.

[ChangeLog][QtCore][Containers] Added operator-> to the key-value
iterator for QHash/QMap.

Change-Id: I9cfa6480784ebce147fcfbf37fec5ad0080e2899
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
2020-03-03 20:25:19 +01:00
Joerg Bornemann
065ace2bca Generate separate debug info for Qt tools too
If Qt was configured with -separate-debug-info, Qt's tools should be
separated from their debug information too.

Fixes: QTBUG-56482
Change-Id: Ief0130db1787b767496d0052716183fe773460bf
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2020-03-03 20:08:56 +01:00
Volker Hilsheimer
b4669b9190 QMenu: hide when a QWidgetAction fires the trigged signal
QMenu hides regularly when the user interacts with it, and manages
the firing of signals based on that. It ignores if a QAction that is
added to it fires the triggered() signal programmatically.

With QWidgetActions added to the menu, the menu usually doesn't get
interacted with directly, as the widget gets the input events.
Since the action can be added to multiple menus, neither widget nor
action can interact with the menus programmatically. Instead, the
menu needs to hide when the widget action triggers.

Test included that covers the case where a QWidgetAction is added
to multiple menus that are visible. Documentation updated, and
removed a redudant paragraph as a drive-by change.

[ChangeLog][QtWidgets][QMenu] a popup menu hides when a QWidgetAction
added to it fires the triggered signal.

Change-Id: I69f378426a45c2e46cebdaa5e6f1b21c8fb03633
Fixes: QTBUG-10427
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-03-03 18:52:11 +01:00
Alex Trotsenko
23785face5 QEventDispatcherWin32: unregister event notifiers on close
When QEventDispatcherWin32::closingDown() is called,
threadData->eventDispatcher is already nullptr and the application
will no longer process the events.

Thus, just as it works for socket notifiers and timers, it makes sense
to disable all active event notifiers at this point. Otherwise, it
seems possible that an object in signalled state can provoke a data
race in the notifier's callback on 'edp' pointer, if
QWin32EventDispatcher destructor is running simultaneously.

Task-number: QTBUG-64152
Task-number: QTBUG-70214
Change-Id: I6e77f3eeca1b0ea639021e73b86798cba0200ebf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-03 19:44:01 +02:00
Assam Boudjelthia
b711ee2555 Examples: add scrollbar to allow viewing all options on Android
This fix is most relevant for Android for affine and gradients examples.
Currently, if the screen size is small the settings will show cramped
and not usable. Thus, adding a scrollbar to fix that.

Task-number: QTBUG-80717
Change-Id: Ic25460e5ce37a5c53bbcae48e11b6b787c45e999
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2020-03-03 19:35:46 +02:00
Assam Boudjelthia
8a6e1de87c Examples: update examples list for Android
Explicitly set the list of examples that works on Android,
as many have issues with layout or other issues.

Task-number: QTBUG-80716
Change-Id: If71efc45a48c6236f8775e21e4cab6dc0129f024
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-03-03 19:35:34 +02:00
Edward Welbourne
f03202b560 Fix missing return-type in doc of qfloat16::copySign()
Change-Id: I617081fe3335a85191be7882578644621d5ffede
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-03-03 18:35:21 +01:00
Assam Boudjelthia
e5f4e14059 Examples: enable HighDPI scaling for examples on Android
These examples show very tiny UI elements on Android devices,
thus enabling HighDPI.

Task-number: QTBUG-80717
Change-Id: I813801d5249dc1fcfc6f61a8d146f60dd19901f6
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2020-03-03 19:35:11 +02:00
Edward Welbourne
466d32160a Suppress warnings where QString and its tests use SplitBehavior
This is a follow-up to commit 895939c7f9
to fix deprecation warnings it added.

Change-Id: I3d86655ec2c84c1bdcac9c70436075fc78f2f781
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-03 17:34:16 +00:00
Mårten Nordheim
8f8eb99991 QNetworkReply: Deprecate 'error' signal, use 'errorOccurred' instead
[ChangeLog][Deprecation Notice] QNetworkReply::error() (the signal) is deprecated; superseded by errorOccurred()

Change-Id: I4f1ef410fd22d34ddf87e89cc5709cc60703af95
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-03 18:25:57 +01:00
Laszlo Agocs
dd0a197be4 QVulkanWindow: Remove queueCreateInfoModifier getter
This is inconsistent with the other similar functions in QVulkanWindow,
we do not provide getters for those either.

Change-Id: If764b49f4b26ff14a2fa908b8d5b37429047250c
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2020-03-03 18:25:57 +01:00
Laszlo Agocs
bbc52a043d rhi: Add a way to communicate back the native image layout for a QRhiTexture
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>
2020-03-03 18:25:57 +01:00
Laszlo Agocs
eff6f77c1a Add since 5.15 to new QVulkanInstance function
Change-Id: Ib1fb6186a8c76d6848d5eda1756e7749383dae40
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-03-03 18:25:57 +01:00
Laszlo Agocs
0378332bc1 rhi: Use versioning in QShaderDescription serialization as well
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>
2020-03-03 18:25:57 +01:00
Laszlo Agocs
4cff6e102d rhi: Include an arrayDims vector in InOutVariable too
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>
2020-03-03 18:25:57 +01:00
Laszlo Agocs
bd2b77120e rhi: vulkan: Sanitize device extension handling
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>
2020-03-03 18:25:57 +01:00
Laszlo Agocs
5bbc9986f9 rhi: d3d: Use native resource binding mapping table when present
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>
2020-03-03 18:25:56 +01:00
Laszlo Agocs
753e4d82be rhi: Execute pending host writes on nativeBuffer() query
Otherwise it is impossible to write an application that pulls out the
VkBuffer for a Dynamic QRhiBuffer, and then uses it with custom Vulkan
operations that read from the buffer. More precisely, the problem arises
only if the buffer in question is not used in combination with any QRhi
operations, because in that case there is nothing that would trigger
doing the host writes queued up by a resource batch's updateDynamicBuffer().

Task-number: QTBUG-82435
Change-Id: Ieb54422f1493921bc6d4d029be56130cd3a1362a
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2020-03-03 18:25:56 +01:00