summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* QRegularExpression: add move constructor(s)Giuseppe D'Angelo2020-10-062-0/+44
| | | | | Change-Id: I599e4b7338172de5936b191f5e16383c1c31104c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Android: use shell path format when running qmake install stepAssam Boudjelthia2020-10-061-1/+1
| | | | | | | | | | On Windows shell, using unix path format might not work, since the shell expects backslash paths only. Pick-to: 5.15 Task-number: QTBUG-87066 Change-Id: I51741b475c1ede11336df63ee1c6092c792c16ef Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Implement missing Android-related configure optionsJoerg Bornemann2020-10-062-6/+39
| | | | | | | | | | | | | | Implement the last remaining Android-related configure options for the CMake build. Print warnings for options that have no equivalent in the CMake build. Let -android-ndk automatically deduce the CMake toolchain file, and error out if that fails with a hint how to fix the situation. Task-number: QTBUG-85373 Change-Id: I8399e5334ae0f1f6634e381775a308d34f7c482b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Extend message functions in QtProcessConfigureArgs.cmakeJoerg Bornemann2020-10-061-4/+8
| | | | | | | | | | qtConfAddWarning was missing, despite being used. All of the three qtConfAdd* functions take multiple parameters and pass them to the CMake's message() function. Change-Id: I1fad46c6fd00b2e733b32cda482bbf1341ffc63f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix typo in ANDROID_SDK_ROOT's help textJoerg Bornemann2020-10-061-1/+1
| | | | | Change-Id: I1edc7e7ae443c306aca64b8f6a92c8b32fad6117 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix build with g++ 10.2Andreas Buhr2020-10-061-1/+3
| | | | | | | | | | | | g++ 10.2 complains here that a comparison of "Last" with "std::numeric_limits<quint8>::max()" is always false when "Last" is an int greater than 256. This is because "std::numeric_limits<quint8>::max() returns an quint8. Since parts of Qt are built with -Werror, the build fails. Fixed by adding a unary plus (+). Change-Id: I16a6b9f6952aeddf0a2a04d87746e433927122bf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl::fromLocalFile: accept invalid hostnamesThiago Macieira2020-10-052-3/+26
| | | | | | | | | | | | | | | | | | | | QUrl hostnames must be compliant with STD3, but we must somehow accept file paths that begin with double slash but aren't valid hostnames. Because the file URI spec requires us to start with "file://" anyway, we can represent those with four slashes. Note that on Unix "//X/y" is a valid but local file path. If given to QUrl::fromLocalFile(), if the path at the root does parse as a hostname, we will still try to normalize (the above becomes "file://x/y"). [ChangeLog][QtCore][QUrl] Changed QUrl::fromLocalFile() to accept Windows UNC paths whose hostname component is not a valid Internet hostname. This makes QUrl able to accept extended-length paths (\\?\), device namespace (\\.\), WSL (\\wsl$), etc. Pick-to: 5.15 Fixes: QTBUG-86277 Change-Id: I3eb349b832c14610895efffd1635759348214a3b Reviewed-by: David Faure <david.faure@kdab.com>
* tst_QUrl/Win: test QUrl::fromLocalFile with backslashesThiago Macieira2020-10-051-6/+17
| | | | | | Pick-to: 5.15 Change-Id: I3eb349b832c14610895efffd1635752ccc82889a Reviewed-by: David Faure <david.faure@kdab.com>
* tst_QUrl: give the to/fromLocalFile test rows proper namesThiago Macieira2020-10-051-52/+60
| | | | | | | | No change in testing, juts changed names and order. Pick-to: 5.15 Change-Id: I3eb349b832c14610895efffd16357498454bcd52 Reviewed-by: David Faure <david.faure@kdab.com>
* Make QAnyStringView comparison operators hidden friendsKarsten Heimrich2020-10-064-54/+98
| | | | | | | | | | Also add the very same operators to the QBasicUtf8StringView class to overcome the compiler issues seen on gcc. Fixes: QTBUG-86481 Change-Id: I12484455ebd3b7b38d4ad67c38977d76f9b3ddfa Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Prefer QStringView's operator[] over its at()Edward Welbourne2020-10-061-7/+7
| | | | | | Change-Id: Ibe2c450aa69ac7ea6db1e6a2174e17f31b4be9a3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Test end-date, not just its string representation, in QDTE testEdward Welbourne2020-10-061-170/+264
| | | | | | | | | | | | | In tst_QDateTimeEdit::dateEditCorrectSectionSize(), only the final displayed date was tested; many of the tests checked day of week (by name), which might well match despite actually selecting a different date than the one intended. So test the date is as expected, too. In the process, tidy up the code, give values more informative names, turn a trivial static function into a lambda. Change-Id: I0491159e9ee2f3cfdcf8a194c723be92c190c2a8 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake: Add library mapping for QmlCompilerUlf Hermann2020-10-051-0/+1
| | | | | | | This is necessary for pro2cmake.py to work on qmlcompiler.pro. Change-Id: I356a6333d3bcc15daf6f2692a2b7ca82c9f37c85 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* rhi: vk: Reduce memcopies with full dynamic buffer updatesLaszlo Agocs2020-10-051-1/+4
| | | | | Change-Id: Ifc754a639fcdb45a1b1b8721393de9356504342f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove QPlatformScreen::pixelDensity()Morten Johan Sørvig2020-10-058-42/+0
| | | | | | | | | This function is no longer in use - Qt Gui now computes scale factors based on logicalDpi() and logicalBaseDpi() instead. Change-Id: Ieb4b75ef4e1563694a8e12b7cdd1f60c419d5bf2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make the logicalDpi() default implementation return 96Morten Johan Sørvig2020-10-051-10/+5
| | | | | | | | | | | | | Remove the code which calculates physical DPI and call logicalBaseDpi() instead. This will make sure that Qt gets a device pixel ratio of 1.0 by default, for the cases where the platform plugin does not implement logicalDpi() itself. Task-number: QTBUG-87035 Change-Id: I08433c9465be03d27b3decccb0e2e7e5e6aff0ae Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Streamline the template specialization of QESDP's dtorGiuseppe D'Angelo2020-10-054-4/+30
| | | | | | | | | | | | | | | | | | | | | Declaring and implementing out of line a specialization for QESDP's destructor is needed if we have an implicitly shared type and we want to provide an inline move constructor for it. The code is however a bit heavy on the eyes, and the full implementation for the destructor must be provided (read: copy and pasted) -- the specialization destructor cannot just "reuse" the one from the primary template. This patch adds a few macros to streamline the above, so that we can start using the same pattern in more places. These macros are completely private for the moment being; we don't want to push this solution for our users. Port QPixmap to the new macros. Change-Id: Ia6a51ad988483e44c9d97c0eca2fb003b6bd21e3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Windows QPA: Fix building with OpenGL disabled after "QFlags: remove ↵Martin Storsjö2020-10-051-1/+1
| | | | | | | deprecated constructor" Change-Id: Icf07bc475ba8f8f9cbe76169dc3dede9ba703292 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Change QString::fromLatin1 and friends to use QByteArrayViewLars Knoll2020-10-054-68/+88
| | | | | | | | | | | | Also adjust the QString constructor from QByteArray to ignore \0 characters in the string (and not terminate conversion there). [ChangeLog][QtCore][QString] Constructing a QString from a QByteArray will not stop at intermediate '\0' (null) characters in the string as in Qt 5, but will convert all characters in the byte array. Change-Id: I1f6bfefe76dfa9072b165903fec7aa4af1abd882 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Implement configure -reduce-exportsJoerg Bornemann2020-10-055-10/+13
| | | | | | | | | | | | | | | | | This option maps to FEATURE_reduce_exports. The feature is on by default, except for MSVC. The reduce_exports configure test is not used in the CMake build. The <LANG>_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties are now explicitly initialized in the qt_set_common_target_properties function, because we don't have access to the feature in QtSetup.cmake where the CMAKE_<LANG>_VISIBILITY_PRESET variables were set before. Task-number: QTBUG-85373 Change-Id: I378453f0e0665731970016170302871e20ceb4e2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use QStringTokenizer instead of QStringView::splitLars Knoll2020-10-051-2/+9
| | | | | | | | | | | This nicely optimizes a hot spot when our HTML parser was loading Qt documentation. This change improves the loading time of the Qt Concurrent overview page by 30%, both over the previous commit and 5.15. Fixes: QTBUG-86354 Change-Id: I4f401c2e6048096444e482c7724e3e3a6c71516e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Don't store QTextHtmlParserNode by value in a QListLars Knoll2020-10-052-29/+34
| | | | | | | | | This is a performance bottleneck as the parse nodes are huge and we don't want to reallocate them all the time. Fixes: QTBUG-86354 Change-Id: Ia437acbb5b2c8af1723932d2cd96ba2ae48a871b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Implement date-time fromString(QStringView...) methodsEdward Welbourne2020-10-052-23/+98
| | | | | | | | | | | | | | | Inline the QString versions. One const QString & variant remains in each case: the date-time parser keeps a copy of the string it's been given, so the methods calling it have a hybrid method taking the string as the text to parse along with a view as the format. This avoids copying the string when the caller has an actual QString to pass in; the version with QStringView for both parameters has to toString() the text to be parsed, at some point on the way into the parser, but we can avoid that in the QString-accepting ones. Fixes: QTBUG-86172 Change-Id: I6a4390df90945af74a5eac2f0a752febd925ad62 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Do not use QHash's aeshash() under Clang's sanitizerAndrei Golubev2020-10-051-2/+14
| | | | | | | | | | | | | | | | | | | aeshash() has a heap-buffer-overflow when the passed in buffer length is less than 16 bytes (and I expect there's a similar issue when we process the tail when length is not divisible by 16). Despite being a real issue, the code has guarding mechanisms to make sure that: 1) no crash happens 2) out-of-range bits are not used in the computation Disabled the usage of aeshash() under Clang's sanitizer similarly to how it was done for GCC (apparently it uses its own preprocessor mechanism). Likely, this will pop up again with MSVC, but I have no clue which defines it uses Task-number: QTBUG-87112 Task-number: QTBUG-86051 Change-Id: I614d7b3082e91c9d16e0441649d6a153b222bd2e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: set default eglfs device integration pluginSamuli Piippo2020-10-051-1/+16
| | | | | | | | | Use QT_QPA_DEFAULT_EGLFS_INTEGRATION for setting the default eglfs device integration plugin, which can be overwritten at runtime using QT_QPA_EGLFS_INTEGRATION environment variable. Change-Id: I1c3ac0c58cdbbb7bb08c2f0ea5abe4d04eb8d61a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: enable egl_viv pluginsSamuli Piippo2020-10-054-2/+60
| | | | | | | | | Add needed define for egl_viv compile test and generate CMakeLists for the egl_viv plugins. Task-number: QTBUG-77809 Change-Id: I3b354faee36cbb85adcee895430eb5e8998108e1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Group, cleanup, and consolidate QProgressDialogPrivate member variablesChristian Heimlich2020-10-051-32/+32
| | | | | | | | | Members grouped and reordered for better alignment, all booleans initialized in the constructor's member initialization list, and snake case names changed to camel case for consistency. Change-Id: Ib59ed770a3d4e307296722270cd991a9a53c72ce Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace Q_DECL_UNUSED with [[maybe_unused]]Allan Sandfeld Jensen2020-10-0313-211/+211
| | | | | | | Use C++17 attribute directly Change-Id: Id853e7a5117065e4adb549f81303c1820fe198ce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Centralize the implementation of move assignment operatorsGiuseppe D'Angelo2020-10-0359-189/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment we have two main strategies for dealing with move assignment in Qt: 1) move-and-swap, used by "containers" (in the broad sense): containers, but also smart pointers and similar classes that can hold user-defined types; 2) pure swap, used by containers that hold only memory (e.g. QString, QByteArray, ...) as well as most implicitly shared datatypes. Given the fact that a move assignment operator's code is just boilerplate (whether it's move-and-swap or pure swap), provide two _strictly internal_ macros to help write them, and apply the macros across corelib and gui, porting away from the hand-rolled implementations. The rule of thumb when porting to the new macros is: * Try to stick to the existing code behavior, unless broken * if changing, then follow this checklist: * if the class does not have a move constructor => pure swap (but consider ADDING a move constructor, if possible!) * if the class does have a move constructor, try to follow the criteria above, namely: * if the class holds only memory, pure swap; * if the class may hold anything else but memory (file handles, etc.), then move and swap. Noteworthy details: * some operators planned to be removed in Qt 6 were not ported; * as drive-by, some move constructors were simplified to be using qExchange(); others were outright broken and got fixed; * some contained some more interesting code and were not touched. Change-Id: Idaab3489247dcbabb6df3fa1e5286b69e1d372e9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QAppleLogActivity: add a swap() methodGiuseppe D'Angelo2020-10-031-0/+6
| | | | | Change-Id: Id698d71fbadf5bd0301a346b3216847d0b2f0b54 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QMacKeyValueObserver: code tidiesGiuseppe D'Angelo2020-10-031-8/+9
| | | | | | | Fix the constructors and the signature of swap(). Change-Id: Ib294bb2c054510170b166b5c8bd3180d22177efc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QFlags: remove deprecated constructorEdward Welbourne2020-10-035-18/+11
| | | | | | | | Fix remaining places that still exercised it. Task-number: QTBUG-85700 Change-Id: I84562f53439197141343831c0b9f88983689e6bf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Android: rename Android's package name for Qt 6Assam Boudjelthia2020-10-0345-96/+96
| | | | | | | | | | Rename Android package name org.qtproject.qt5.android to org.qtproject.qt.android to avoid inconsistency with Qt 6 name. Also, we include the major version number in the jar target. Task-number: QTBUG-86969 Change-Id: Ibb68947289be1079911b34ea157bf089cc52c47f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Handle trailing cruft consistently in Qt::DateFormat parsingEdward Welbourne2020-10-033-103/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the ISO time format would tolerate trailing cruft at the end in various cases even though there might be an offset specifier after the time, which should *not* be separated from it by anything (not even the spaces we originally planned to still tolerate). The RFC date format is forgiving about space, as is suitable for parsing of RFC-822 headers, but the other formats should match the handling in QDateTimeParser, which rejects any dangling cruft. At the same time, since this required a re-write of fromIsoTimeString() in any case, add support for the ISO format that gives the hour a fractional part and skips minutes and seconds. Previously we only had support for fractional minutes (with no seconds). The hour without even a fractional part is also valid. Reworked the documentation of Qt::DateFormat as it was wrong in places, inconsistent in its formatting and incomplete. Adjusted some tests to match the new behavior. A fraction separator with no following digits should have been recognized as an error previously and now is. [ChangeLog][QtCore][QDateTime] The ISODate and ISODateWithMs formats now reject trailing cruft (including spaces) at the end of a time string. They also gain support for parsing hour-only formats, including the hour-with-fractional-part format. Task-number: QTBUG-86133 Change-Id: I38ad1479ae033407f7df97ffbeb7c4bcd463d04a Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove compiler testAllan Sandfeld Jensen2020-10-0212-1763/+1
| | | | | | | Outdated test for old buggy compilers Change-Id: I605a2318a21121bde9a80c046a7beb6edcd2d546 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Switch Q_DECL_DEPRECATED to use C++14 [[deprecated]]Allan Sandfeld Jensen2020-10-038-120/+103
| | | | | | | | | | As a C++ attribute it must be on the beginning of the line or after the function name however. And for friend declarations can only be on the definition. Change-Id: I456884428f36e1f1c621089c7b1addee13ada0fe Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove typedef Q_PIDFriedemann Kleint2020-10-024-25/+14
| | | | | | | | | | | It is not used in public API any more since 0f8848b7e25e4d8fb9265ff6e0aa31946addd741. Replace by an internal Windows-specific Q_PROCESS_INFORMATION typedef. Change-Id: Ia6dcc83ca667c40ac5d678c00d143c09d650e42a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProcessPrivate: Use member initializationFriedemann Kleint2020-10-022-39/+18
| | | | | | Change-Id: I9fb8120a68daaa41c153010a52f7a3e99087153b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAIM docs: use \nullptr instead of 0Giuseppe D'Angelo2020-10-021-2/+2
| | | | | | Pick-to: 5.15 Change-Id: I30b541f28ba8271eb4234c7f642485a1614808bf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rework a test, eliminating some needless conversion via stringsEdward Welbourne2020-10-021-35/+15
| | | | | | | | | | | | | | The name toSecsSinceEpoch() gave no hint to the fact that the test was, in fact, *also* testing round-tripping of the ISODateFormat. Since there are other tests for string conversion, make this a simple test of toSecsSinceEpoch(). It did the round-tripping via two methods with overly-terse names that might just as well be local lambdas - now redundant, so removed. Change-Id: I1e4fb1cc90224312c995596a8f3fe2bc5d9dfa15 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Ignore mouse events where globalPos contains NaNSteffen Kieß2020-10-021-0/+5
| | | | | | | | | | | | | | A NaN value in globalPos can cause an endless recursion in QGuiApplicationPrivate::processMouseEvent() when e->enhancedMouseEvent() is true and this is not a move event. When an event contains a NaN in globalPos, print a warning and ignore the event. Pick-to: 5.15 Fixes: QTBUG-86207 Change-Id: I8789e465921789569715e52c98193f91945ea982 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* End touch->mouse synthesis when the chosen touchpoint is releasedShawn Rutledge2020-10-022-27/+57
| | | | | | | | | | | | | | | | During delivery of a TouchBegin event, if no widget accepts it, we begin treating the first touchpoint as a synth-mouse, as before. If a second touchpoint is pressed or released in any order, it's irrelevant: the fake mouse button is released as soon as the first touchpoint is released. This fixes the bug that such a scenario caused the mouse release not to be sent, so that a widget could get "stuck" in pressed state. Done-with: Tang Haixiang <tanghaixiang@uniontech.com> Fixes: QTBUG-86253 Pick-to: 5.15 Change-Id: I7fbbe120539d8ded8ef5e7cf712a27bd69391e02 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Android: Make checking a dependency path accept both separator stylesAlessandro Portale2020-10-021-2/+2
| | | | | | | | | | | The path of dependencies (.so, .jar, etc.) might use either native or non-native dir separators. Let's support both cases. Amends: 4e94465096bd03f649da8b9b2e287d13a1bc3bd5 Task-number: QTBUG-87066 Change-Id: I8ce3235db5bab8c4c139f841d3a2fe74d3c7c7f2 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Add test case for QSslSocket to show the wrong behaviorLars Schmertmann2020-10-025-0/+373
| | | | | | | Task-number: QTBUG-81661 Change-Id: I4ed2ad3a22bd5439751328d915e9984eb89397d1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QTreeView: fetch as many nested entries as fit into the viewVolker Hilsheimer2020-10-022-2/+161
| | | | | | | | | | | | | | | | | | | | | | | | | QAbstractItemModel::canFetchMore and fetchMore implementations might only add a few rows to the model each time they are called. The item views don't generally expect that, and don't call fetchMore repeatedly, even if there would be room in the itemview for more data. This problem cannot be generally solved for all item views, as it would require in repeated expensive laying out of items. For nested indexes in a treeview however, we can try to fetch enough child rows to populate the screen when the item is laid out by repeatedly calling canFetchMore and fetchMore. To calculate how many items have space, apply the same heuristics as in the scrollContentsBy implementation to guess the number of items that can fit into the viewport. Created test case for the fix. Done-with: Doris Verria <doris.verria@qt.io> Fixes: QTBUG-85366 Pick-to: 5.15 Change-Id: I54f95552993873dd4cba80b0f70f4db9d98ddc1d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* rhi: Add a note to generateMips docsLaszlo Agocs2020-10-021-0/+7
| | | | | Change-Id: Ib07eef8944367948338075832452fdae6df6078a Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: vk: Alter command buffer strategyLaszlo Agocs2020-10-024-134/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reports on the Web have it that there's nothing guaranteeing a driver does any actual freeing of resources then doing vkFreeCommandBuffer for a command buffer from a command pool that does not have VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, thus leading to continuously growing resource usage with our current allocate/free pattern. It could be that this is the source of out of memory problems we are seeing on some Android devices. Instead of just going straight for said command pool flag and doing ResetCommandBuffer for the command buffers individually, take one step further and use per-slot (slot being 0 or 1 if QVK_FRAMES_IN_FLIGHT is 2) command pools. The current pool is reset in each beginFrame/beginOffscreenFrame, moving all allocated command buffers to the initial state (while other command buffers with the other pool are not affected). This may be (while impossible to tell from just guessing based on the spec) our best approach to command buffer allocation since a Vulkan implementation can likely just use some simple per pool allocator, knowing that we never want to free or reset individual command buffers, but we rather only reset the whole pool at once. The option of importing an existing VkCommandPool when creating the QRhi instance is now gone, but there was probably no point in offering that in the first place. When it comes to VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT it will not be set unless releaseCachedResources() (in Qt Quick this is hooked into QQuickWindow::releaseResources()) was called. What this does in practice is unknown, but have an option to set it now and then if the application really wants. While we are at it, rename secondaryCbs to activeSecondaryCbStack to indicate what it really is. (it's a stack as each call to beginExternal() pushes a new one, while each endExternal() pops) Change-Id: I2e5c1fad26d794e1f56c778e38f750998d706d84 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: gl: Best uniform is no uniformLaszlo Agocs2020-10-022-4/+84
| | | | | | | | | | | | | | | | | Artificial tests with tens of thousands of meshes drawn with the same program (graphics pipeline) and almost the same uniform values (the difference being in the normal and model and view matrices) do benefit - strongly depending on the GL implementation probably - from doing fewer glUniformNf[v] calls. Building on the fact that uniform location values will typically be an int value starting at 0 (not guaranteed of course, we just skip the smartness in that case), we can dedicate a small 16K block to keep track of float/vec3/vec3/vec4 values in the graphics and compute pipeline objects. Change-Id: I217c31ccdeb511b3e8b8286078d7fbde399c8e3b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: gl: Stop flooding with glVertexAttribPointersLaszlo Agocs2020-10-021-6/+26
| | | | | | | | | | | Artificial tests like the BechmarkDemo are full of drawing the exact same mesh multiple times in a row. These do not need respecifying anything related to vertex or index data. Also move the buffer binding out from the loop. Change-Id: I0f27a39fecebc7ca8e1fa635c63819f116867e19 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: gl: Skip rebinding the same index buffer in the same passLaszlo Agocs2020-10-021-1/+5
| | | | | | | | Already doing the same for GL_ARRAY_BUFFER, follow suit with GL_ELEMENT_ARRAY_BUFFER. Change-Id: I0cf44480abb3a60a44b316af2c09b2235f9f65e7 Reviewed-by: Andy Nichols <andy.nichols@qt.io>