Commit Graph

57602 Commits

Author SHA1 Message Date
Laszlo Agocs
878328c6ab rhi: Enhance internal docs about buffer and image load/store
Comparing the backends revealed that one cannot expect that
exposing a storage buffer or a texture to a shader with
bufferLoad, imageLoad, bufferStore, imageStore, etc. will
always be functional in any graphics and compute pipeline
stage. In fact the only place where this is universally
supported are compute shaders.

In other shaders some backends will not expose the resources
at all, e.g. because in D3D11 unordered access views (for a
buffer or image used with load/store) have limitations on the
API level, whereas others may have runtime limits, e.g. with
OpenGL ES an implementation may just say
GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS is 0 meaning no SSBOs in
vertex shaders. (apparently the case on some embedded GPUs,
presumably due to the tiled architecture, e.g. on Mali)

So for now add a note to all the relevant
QRhiShaderResourceBinding functions.

It should be possible to make it work with fragment shaders
to a degree at least, but for D3D we then have to deal with
OMSetRenderTargetsAndUnorderedAccessViews and some remapping
of binding points, whereas elsewhere they may be issues with
missing or incorrect barriers. So do not go there now.

Change-Id: Ib18949e0184626a9abf5bb72c6ef72bc1cb2e1fa
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-16 18:08:38 +02:00
Richard Moe Gustavsen
b90fd5f707 doc: QEventPoint::timeHeld is reported in seconds, not milliseconds
Pick-to: 6.4 6.3 6.2
Change-Id: I71b6fdffe7f7177069c8fe3989e8547102a7e3a6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-08-16 16:00:15 +02:00
Laszlo Agocs
e025b07c64 vkkhrdisplay: Create the platform window always
No matter what the surface type was. We only support VulkanSurface, so
if the type is something else, then a a qWarning is in order, but instead
of returning nullptr (which will almost certainly cause a fail or crash
in some form), we can just carry on normally. The resulting window
will not be renderable from the application of course, but that is
not always needed in fact, plus failing gracefully is nicer.

The tst_qrhi autotest can now be run on the RPi4 also with
-platform vkkhrdisplay. While there are some odd messages occurring
from Mesa and co., the run now completes normally, with no failures.

Change-Id: I77bd249096aede8e05458559458581d702054540
Pick-to: 6.4
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-16 16:00:15 +02:00
Laszlo Agocs
2de14b81a9 rhi: tst_qrhi: Check for OpenGL cap on the platform
Running tst_qrhi -platform eglfs will pass on RPi4 / Mesa 22.
This does not test Vulkan of course since the platform plugin cannot
create a Vulkan instance.

Running tst_qrhi -platform vkkhrdisplay will enable Vulkan but will
still try OpenGL since the autotest does not query the platform
integration about OpenGL support. Make this nicer by skipping most of
the GL test if the platform integration we have cannot handle OpenGL
stuff anyway.

For some tests the data-driven approach has to be removed since doing
QFETCH without any rows will crash. These two OpenGL-specific tests
now check OpenGL support directly and QSKIP if needed.

While we are at it, fix up the Vulkan instance API version as well.

Pick-to: 6.4
Change-Id: I2891c04540bc2dfd0ccf475629bd23542bff15f5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-16 16:00:15 +02:00
Laszlo Agocs
73fe9a786c rhi: Fix instance API version when only 1.1 is supported
Looks like something inherited from the Qt Quick code that got
moved into the helper. Setting a request of API version 1.2 is
harmless in practice, but to be correct the version should be
1.1 when 1.2 and newer are not reported by the instance.

Change-Id: I62d2c143972d6753e4311c6907ccf846ae0e9088
Pick-to: 6.4
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-16 16:00:15 +02:00
Alexandru Croitor
e38956e4f7 qmake: Fix non-Xcode asset catalog handling for iOS simulator
If an iOS project was built with qmake using the Makefile generator
instead of the Xcode generator,
so -spec macx-ios-clang, and not -spec macx-xcode,

Asset catalog processing failed with an actool error like
 Unknown platform: "ios-simulator"

This is because we used the deployment identifier (which is meant for
creation of the -mios-simulator-version-min flag) to pass a value
to actool's -platform option, rather than the sdk name.

Introduce a new variable called platform_identifier, which will be set
to the currently processed macOS/iOS sdk name (e.g. macosx,
iphonesimulator, iphoneos).

Use it when processing asset catalogs using the Makefile generator.

Relates to 9daeb6fe9d
Amends 5574aa986b

Pick-to: 6.3 6.4
Fixes: QTBUG-102053
Change-Id: Ic4ea3b9e11c21ae535d6544cbed3670f9db44e72
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-16 15:02:22 +02:00
Edward Welbourne
0ed8987078 Update QTimeZone benchmark's list of tested zones
It purports to be a list of those named in QDateTime's tests, but was
a bit out of date. In the process, sort them into somewhat coherent
order (to make it easier to verify whether one is missing next time I
check) and reformat.

Pick-to: 6.4 6.3 6.2
Change-Id: I16e7ded6f8b00e226513bd06d6174a79f7a0c675
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-16 15:02:22 +02:00
Tor Arne Vestbø
836c7f2b30 Windows: Align QWindowsWindow logging category name with other platforms
Other platforms name it singular 'qt.qpa.window'.

Change-Id: I668ed67e1686605fe5f77313c7a01c31fd574c32
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-08-16 09:35:15 +02:00
Marc Mutz
b5d5385201 tst_qbytearray: remove qCompress_data for QT_NO_COMPRESS
The _data function is useless without its test function (and it's not
used in other _data functions).

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I7aa6006ed1a9d89008577b750af4ea717dae237f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-15 23:02:32 +02:00
Marc Mutz
401041f958 QDeviceDiscoveryUDev: use NSDMI
This also fixes 0-used-as-nullptr warnings from clang-tidy.

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Ibf10f1719a6c8cf22046cf30298dadb307a853d5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-15 21:02:32 +00:00
Tor Arne Vestbø
7fc4bcd0f3 macOS: Ignore deprecation for ReleaseIconRef
There's no good replacement yet for our use of GetIconRef
and ReleaseIconRef, so for now ignore the deprecation.

Pick-to: 6.2 6.3 6.4 5.15
Change-Id: Iffcaa2af3c9e2ee053303a2272e8874913dd74d4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-15 21:08:45 +02:00
Sze Howe Koh
709ca8212e Fix ignored name filter in QFileDialog::getOpenFileContent()
Fixes: QTBUG-104948
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I83a565bfe604472fcdeb8757464e0e350da5d766
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-08-16 03:08:45 +08:00
Mikolaj Boc
644ae42e12 Make wasm finalizers work for standalone tests and other repos
The wasm helpers file is not included in QtBuild and is thus not visible
when standalone tests or other repos are being built. This fixes it.

Amends 1f9c1f032c

Pick-to: 6.4
Fixes: QTBUG-105615
Change-Id: I6c9229e1f259fa5043d7d11b8ee0293e26077f3e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-15 16:46:12 +00:00
Eskil Abrahamsen Blomfeldt
360f1547f7 Fix QFontDatabase::hasFamily() for ambiguous families
If a font family has several instances from different foundries,
we disambiguate this by adding the foundry name in brackets behind
the family. But QFontDatabase::hasFamily() would only check for
families().contains(familyName). So if the database contains e.g.
Foo [Bar] and Foo [Baz] then a check for hasFamily("Foo") would
fail.

So we need to actually check for the family name instead. In
doing this, we also skip the extra step of building the list
and then searching it, but just go directly to the source.

This removes the BLACKLISTing of Ubuntu and also introduces a
QSKIP on Unix-based platforms without fontconfig, since there
is no way to know which default fonts are acceptable on those
platforms.

Pick-to: 6.4
Fixes: QTBUG-86967
Change-Id: Id8ad80a1671daf1c14fbad8bb8f4c51ee1c59709
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-15 18:23:43 +02:00
Kai Köhne
47fded488e Doc: Remove mentioning of outdated QDataStream version
The exact version doesn't add much information, and will most likely
go stale again; so just remove the mentioning.

Change-Id: Ifd87f7cf655a610aa45e341cf5a3491ae7d91171
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-15 18:23:43 +02:00
Laszlo Agocs
dea9ed7e4c vkkhrdisplay: Silence validation complaints about presentation support
Zero reason to do this query, but the validation layer complains otherwise.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-105527
Change-Id: I7a72e4d6d89f41279db94efe663a696302f05ded
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-15 18:17:50 +02:00
Laszlo Agocs
5eacc974c7 rhi: d3d11: Enable tessellation and geometry with some caveats
The caveat being having to manually create HLSL versions of the hull,
domain, and geometry shaders in parallel with the Vulkan GLSL ones,
while keeping the interfaces intact (stage inputs and outputs, cbuffer
layouts, binding points/registers). This is not always trivial but
typically doable in not very complicated case after inspecting the
SPIRV-Cross-generated vertex/fragment code in the .qsb files. Once
written, the HLSL files can be injected into a .qsb file with qsb -r.
or the corresponding CMake syntax. Conceptually this is no different
from how samplerExternalOES support is implemented for Multimedia.
(there the problem is that the shaders cannot be compiled to SPIR-V
to begin with, here it is that we cannot translate from SPIR-V, but
in the end the workaround for both problems is effectively the same)

The manual tests demonstrate this, both the tessellation and geometry
apps work now with D3D out of the box.

On the bright side, the implementation here in the the D3D backend of
QRhi does not need to know about how the shaders got there in the
QShader. So none of the implementation is dependent on this manual
process. If some day qsb would start translating to these kind of
shaders as well, it would all still work as-is.

Change-Id: I32d9ab94e00174e4bd5b59ac814dfedef9f93ad1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-15 10:51:17 +02:00
Alexandru Croitor
6c9f4f5ebc CMake: Enable public executable finalizers for iOS tests
This ensures that tests can be executed on the simulator or device, by
doing the necessary steps like setting a bundle identifier, Info.plist
file, launch screen, etc.

This is done by calling _qt_internal_finalize_executable in the
implementation of all internal test adding functions.

The finalizers are limited only to iOS for now, as an incremental
step, and to ensure we don't accidentally break tests on other
platforms.

At least WebAssembly uses its own finalizers which would likely cause
duplicate calls if the _qt_internal_finalize_executable was
unconditional.

Pick-to: 6.4
Fixes: QTBUG-104754
Change-Id: I729d56385dd206b22c975fc2ce4e2c683e6e4e2c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-15 10:44:54 +02:00
Alexandru Croitor
c76bf58350 CMake: Tests on iOS must be app bundles to be runnable
Pick-to: 6.4
Task-number: QTBUG-104754
Change-Id: I05053d0f242f45e56e7a95ac75f5ef63ca8a5e0e
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-15 10:44:51 +02:00
Alexandru Croitor
3608bb543d CMake: Use the Xcode generator for qt-cmake-standalone-test on iOS
Pick-to: 6.4
Task-number: QTBUG-104754
Change-Id: I43aae05f7e101a619d2c1b97d9a96c74d8498bfa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-15 10:44:47 +02:00
Elias Hautala
1a60194388 Sliders: Add function that changes widgets position on layout
Changes the layout to QGridLayout and adds function to change widgets
position on the layout depending on the windows aspect ratio. Before
this the widgets wouldn't fit on screen when using the example on
Android in portrait.

Fixes: QTCREATORBUG-27685
Pick-to: 6.2 6.3 6.4
Change-Id: I00009cb6c8c250a8333ac3dfa635f70da4576d5e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Jani Korteniemi <jani.korteniemi@qt.io>
2022-08-15 11:22:14 +03:00
Kai Köhne
b057659255 Mark C++11/C++14 portability macros as deprecated
Pick-to: 6.4
Fixes: QTBUG-105542
Change-Id: If99a47858c5b48a726ad323fba6bf871bfda37d0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-08-14 10:56:26 +00:00
Sona Kurazyan
9674f1cc88 Move macros for Darwin-based operating systems to qsystemdetection.h
Task-number: QTBUG-99313
Change-Id: I5198baa1369e296cd06db964a6286978bb874859
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-13 02:20:40 +02:00
Sona Kurazyan
217a5f0745 Move the checks for disabling useless warnings to qcompilerdetection.h
Task-number: QTBUG-99313
Change-Id: I7b4a62e7a8f8a07a9386a6f1f41a33c3fc802daf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-13 00:20:40 +00:00
Sona Kurazyan
180e55a586 Move Q_{OUTOFLINE, INLINE}_TEMPLATE definitions to qcompilerdetection.h
These seem to be leftovers after
475cef58f9.

Task-number: QTBUG-99313
Change-Id: I6059cfe1ea0a0f85e3617338215effb114d3b60b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-13 00:20:40 +00:00
Sona Kurazyan
986fea9058 Move some compiler-specific macros to qcompilerdetection.h
Task-number: QTBUG-99313
Change-Id: Ia381fc0242090ee08ae734421274dcef15709778
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-13 02:20:40 +02:00
Joerg Bornemann
042290d0fb CMake: Add QT_ANDROID_SIGN_AAB variable
[ChangeLog][CMake] Added the QT_ANDROID_SIGN_AAB variable that can be
set to ON to enable signing of .aab packages.

Pick-to: 6.4
Fixes: QTBUG-105529
Change-Id: Ic06cc452851dc81b10a2721b544641cb5eeea8be
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-08-12 22:42:51 +03:00
Edward Welbourne
45cbb1e31e Fix DeferredFlag implementation for QTestEventLoop
As discovered in the expanded testing of QTRY_COMPARE() using the same
class, the timer needs a context object and a slot to call.
This amends commit 35ad157d88

Pick-to: 6.4 6.3
Task-number: QTBUG-104441
Change-Id: I41fc23de84ce8c7d6608db0005276a2071974494
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-08-12 20:32:30 +02:00
Edward Welbourne
54bcefb25c Test QTRY_COMPARE() and expand testing of QTRY_VERIFY*()
In the process, simplify the latter while adding some actual
time-variation for the QTRY_* loop to navigate round - based on the
extendedcompare test's ClassWithDeferredSetter. Testing remains
primitive, but is at least a bit more thorough.

Pick-to: 6.4
Change-Id: I40be8fb485f3f18f0a4f4bc62ad36cccac691979
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-08-12 20:32:30 +02:00
Edward Welbourne
f5840692b0 Remove the stale expected_crashes_[345].txt
These contain output only ever sent to stderr, which tst_selftests no
longer looks at; it merely verifies stderr is empty for all tests
except those expected to produce stderr output, and ignores the stderr
output for these last.

Change-Id: I50fee445d84c2d125e6db5303fc389e87746455e
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-12 20:32:30 +02:00
Edward Welbourne
f9b58b5c14 Include current test name in crash reports
Previously a crashing test's output would end with the last completed
test's output followed by a crash report, leading readers
(understandably enough) to conclude that the last-named test is the
one that crashed. In fact the crashing test is typically the next one
in the class definition.

Include the current test function's name (when non-null) in the output
accompanying crash logs. This always goes to stderr so does not show
up in the expected output.

Pick-to: 6.4
Change-Id: Icab0ccd1fe434827ee92459ab0c97f9dc034754e
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-08-12 20:32:30 +02:00
Marc Mutz
013574a5fd QLocale: port locale_data indexing to qsizetype
Not a bug, just porting to avoid the next reader having to wonder
whether the ints and uints are 64-bit safe.

As a drive-by, make a static variable constexpr and replace sizeof
foo/sizeof *foo with q20::ssize(foo).

Pick-to: 6.4
Task-number: QTBUG-103531
Change-Id: Iccc5a5896ab87981f4535820cea7f274e568f325
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-12 20:32:30 +02:00
Marc Mutz
62aec32dfa QLocale: fix UB in defaultIndex() (using < on unrelated pointers)
It's undefined behavior to compare pointers with <, >, <=, >=, unless
they point into the same subobject (or one past the last element, for
arrays). The Q_ASSERT() should detect UB. For that, it mustn't cause
UB itself.

Fix by using q_points_into_range(), which uses std::less, which is
guaranteed to define a total order on pointer values.

Pick-to: 6.4 6.3 6.2
Change-Id: I725eb9e4a9304d2edcd0776e756e6a67e224c1a7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-12 18:32:29 +00:00
Thiago Macieira
6234182d82 QMetaType: don't use global relocations to the lambdas and structures
The way the Qt 6.0 QMetaTypeInterface was designed, using a static
inline variable in a template, would normally require the linker and
dynamic linker to merge all copies and choose a single copy as the
official one. But because of hidden visibility and of Windows DLLs,
QMetaType already copes with multiple copies NOT getting merged. So we
may as well ask the linkers not to bother and use simpler, local
relocations to find those symbols.

They are all supposed to still be equivalent and it's an ODR violation
if they're not.

The Apple ld64 linker complains if you use this type of global
relocation:

 ld: warning: direct access in function
  [...]
   to global weak symbol
   'QtPrivate::QMetaTypeInterfaceWrapper<int>::metaType'

Fixes: QTBUG-93471
Pick-to: 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f98a10aa719434
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-12 11:32:29 -07:00
Thiago Macieira
985e24dd5f QMetaType: add a test to confirm that types are equal across libraries
Because of the template shenanigans. This is just to make sure.

Pick-to: 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f989e7d555894f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-12 11:32:29 -07:00
Marc Mutz
bbcdee2afa QChar: replace uint with char32_t in the implementation
Finishes the port from uint to char32_t started in Qt 5.

Task-number: QTBUG-103531
Pick-to: 6.4
Change-Id: I97c29deb30a9a4563e2eafdb25e1f290a079726f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-12 20:32:29 +02:00
Marc Mutz
cd0f696891 QString: finish migration to qsizetype
These don't look like they could cause bugs, because their range of
values is physically limited, but port them to qsizetype nonetheless,
for consistency, and to save the next reader the task of proving that
they're, indeed, ok.

Pick-to: 6.4
Task-number: QTBUG-103531
Change-Id: I337ea327b54bcf5960928f5d1d72c6fc80dcda31
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 20:32:29 +02:00
Mikolaj Boc
f8e460b915 Use the local file APIs to save/load files on WASM
QFileDialog::saveFileContent, QFileDialog::getOpenFileContent are now
using local file APIs to access files on any browser that passes a
feature check.
The feature is thoroughly tested using sinon and a new mock library.

Task-number: QTBUG-99611
Change-Id: I3dd27a9d21eb143c71ea7db0563f70ac7db3a3ac
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-12 20:32:29 +02:00
Laszlo Agocs
742ae9ea1c Be more graceful when objects die by the time the dnd loop exits
The main issue fixed in 7f23dd963536eb8123ee4c5c22bf43b6f866d008 can
manifest in another form on platforms where QBasicDrag is used (xcb).

Make sure that we recognize if an object (e.g. a QWidgetWindow) is
destroyed by the time the nested event loop exits.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104596
Change-Id: Ib82dd8230cb6f13d804bd992234b2a3ce85a7061
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-08-12 18:24:54 +02:00
Alexandru Croitor
e671b852e7 CMake: Improve tool not found error message
Pick-to: 6.4
Change-Id: I7f04e4af80c4d23b855c8c9d5f5017f8afb112ea
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-12 14:55:03 +02:00
Alexey Edelev
9029b90538 Rename arg_HEADER_MODULE variable to 'is_interface_lib'
Variables starting with 'arg_' usually are the result of the
cmake_parse_arguments call. It's better to not use them for the regular
variables for readability.

Change-Id: I4054c63d3e48b2a27d8a632cd8908a59302afa47
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-12 13:50:55 +02:00
Alexey Edelev
a3e8d28fdb Do not use the HEADER_MODULE argument in qt_generate_module_pri_file
HEADER_MODULE argument is passed to qt_generate_module_pri_file from
the qt_internal_add_module function, but the property means that the
module is an interface library. So it makes sense to replace this
argument with the reading of the target TYPE.

Change-Id: I1d8cd2ff732f526975cde6bdd4783fee44c8bd98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-12 13:50:55 +02:00
Laszlo Agocs
011d10fe26 rhi: metal: Simplify batch comparisons
Change-Id: I9d61ce3f2e8501a854e070a83cd748928129e76d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-12 12:51:59 +02:00
Andy Nichols
ea1f172267 RHI: Cache ShaderResourceBindings for Metal
We current have lots of redundant state bindings for things like
SamplerState that could reduced by checking if the state is already set.
ShaderResourceBindings are fairly involved to cache since they are done
in batches. This patch stores the current ShaderResourceBindings state
and checkes the current state before setting a new one.

Change-Id: If15ebd2b8b14b016f492d881197e423773c30ef7
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-08-12 12:51:59 +02:00
Marc Mutz
0c716c687a QUnicodeTools: mark a test-only flag constexpr/constinit
For QT_BUILD_INTERNAL, mark the flag constinit, because tests may want
to set it (which they better do before Qt spins up threads, because
otherwise this non-atomic flag runs into UB (data races)).

For non-QT_BUILD_INTERNAL, mark the flag constexpr, so dead code
elimination can do its job.

Inconsistently, of the two readers of the flag, one was ifdef'ed on
QT_BUILD_INTERNAL, while the other wasn't. Settle on exposing both,
which increases the compiler coverage of the code.

Pick-to: 6.4
Task-number: QTBUG-100486
Task-number: QTBUG-100485
Change-Id: I6e041359b8214b40d80eefa92c26422aada3eb59
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:55:23 +02:00
Marc Mutz
bd9c704823 QStringConverter: add Q_CONSTINIT to function-level QBasicAtomic
Task-number: QTBUG-100486
Pick-to: 6.4
Change-Id: Ia55b743fd7ad4716b82425410ed0cf9ff2ee30e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:55:06 +02:00
Marc Mutz
496b4294c9 QLocale: port findTag to std::string_view
QStringView lacks the equivalent of find_first_of, so use string_view
for now.

Fixes an unnecessary QString ctor/dtor call, as well as the
int/qsizetype mismatch, looking for which I found this code.

The function can now be properly noexcept.

Task-number: QTBUG-103531
Pick-to: 6.4 6.3
Change-Id: I1198c082a2ee0addbe7c0d2192073b017d9f8dd7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:54:59 +02:00
Marc Mutz
1aa00c993b Port qt_readEscapedFormatString() to qsizetype
More of the usual missing int -> qsizetype porting...

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103531
Change-Id: I53faff5fe306c1d207741bc93a1e5c15d3eefa4f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:54:51 +02:00
Marc Mutz
3e1c6e7496 QTextBoundaryFinder: fix a flawed buffer size calculation
There were two problems:

1. The cast to uint truncates the input qsizetype bufferSize mod
   UINT_MAX, which, if the original value was qsizetype(UINT_MAX) + 1,
   would yield a false negative check, so remove the cast.

2. The multiplication of the input string size with
   sizeof(QCharAttributes) looks like it could overflow, esp. on
   32-bit platforms. It can't, because sizeof(QCharAttributes) == 1
   atm, but the next attribute that's added to the struct will turn
   that into sizeof 2, so play it safe and use division on the LHS
   instead of multiplication on the RHS to avoid this arithmetic 101
   antipattern.

Task-number: QTBUG-103531
Pick-to: 6.4 6.3
Change-Id: Icae3bea1c3cb52a235b8aae181af35c86c3f5d6f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:54:38 +02:00
Marc Mutz
48c8072bb8 Finish porting cross-platform parts of QStringConverter to qsizetype/size_t
There are still problems with platforms-specific APIs that are 32-bit
only (cf. QTBUG-105105), but this patch finishes the port of the
cross-platform parts of QStringConverter.

None of these changes have a user-visible effect. They just avoid the
Code Smell that int has become since Qt 6.0.

Pick-to: 6.4
Task-number: QTBUG-103531
Change-Id: I267e2e1268a18c130892fa2fd80d1b5dabb3d9b9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-12 07:53:58 +02:00