summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/rhi/qshader
Commit message (Collapse)AuthorAgeFilesLines
* Change license for tests filesLucie Gérard2024-02-041-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* CMake: Make gui tests standalone projectsAlexandru Croitor2023-07-051-0/+6
| | | | | | | | | | | | | | | | | Add the boilerplate standalone test prelude to each test, so that they can be opened with an IDE without the qt-cmake-standalone-test script, but directly with qt-cmake or cmake. Boilerplate was added using the following scripts: https://git.qt.io/alcroito/cmake_refactor Manual adjustments were made where the code was inserted in the wrong location. Task-number: QTBUG-93020 Change-Id: I2ef59684cf297a0222a136ce7b5630037294d000 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* rhi: Make it a QPA-style private but semi-public APILaszlo Agocs2023-05-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qrhi.h, qshader.h, qshaderdescription.h (and qshaderbaker.h from shadertools; done separately) become "RHI APIs", following the concept of QPA APIs. Mirror completely what is done for QPA headers, but using the "rhi" prefix for the headers. This involves updating syncqt to handle the new category of headers. (a note on the regex: matching everything starting with "qrhi" is not acceptable due to incorrectly matching existing and future headers, hence specifying the four header names explicitly) There is going to be one difference to QPA: the documentation for everything RHI is going to be public and part of the regular docs, not hidden with \internal. In addition to the header renaming and adding the comments and documentation notes and warnings, there is one significant change here: there is no longer a need to do API-specific includes, such as qrhid3d11[_p].h, qrhivulkan[_p].h, etc. These are simply merged into a single header that is then included from qrhi.h. This means that users within Qt, and any future applications can just do #include <rhi/qrhi.h> (or rhi/qshader.h if the QRhi stuff is not relevant), no other headers are needed. There are no changes to functionality in this patch. Only the documentation is expanded, quite a lot, to eliminate all qdoc warnings and make the generated API docs complete. An example, with a quite extensive doc page is added as well. Task-number: QTBUG-113331 Change-Id: I91c749826348f14320cb335b1c83e9d1ea2b1d8b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* tests: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-171-2/+0
| | | | | | | Pick-to: 6.5 Change-Id: I8d106554bb86ac1ec9bb7a4083de4c376bcbab1d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Support serializing the QShader for qsb versionKaj Grönholm2023-01-071-2/+2
| | | | | | | | | | Support serializing shaders with specific qsb version. The default behavior remains the same, using the latest version. Task-number: QTBUG-101062 Pick-to: 6.5 Change-Id: I090a88c1ccb3be4ac5eee1da4058afaa8bf3111c Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* RHI: QShaderDescription storage buffer qualifiers / run time strideBen Fletcher2022-12-112-0/+23
| | | | | | | | | | | | | | | | Add storage buffer memory qualifier and run time array stride information to QShaderDescription::StorageBlock. Memory qualifiers allow more informed selection of RHI resource buffer binding (bufferLoad / bufferStore / bufferLoadStore) function. Run time array stride (for last block member unsized array) allows packing of buffer data for transfer to / from GPU. Without this information, applications must infer or guess which packing rules (std430 / std140) are in use. Change-Id: I676d7e848afefd40d01cdd463c569b07022b683e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-63/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix signed/unsigned comparison warning in shader testEdward Welbourne2022-09-221-1/+1
| | | | | | | Trivial, noticed while looking for deprecation warnings. Change-Id: Ie2c450d457e25b998fb686c4c22333781364073c Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: metal: Add support for tessellationLaszlo Agocs2022-09-018-0/+83
| | | | | Change-Id: Ie8d226a6a959aa5e78284ea72505fd26aec1e671 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-031-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't use PUBLIC_LIBRARIES for tests and test helpersAlexandru Croitor2022-07-281-1/+1
| | | | | Change-Id: I9b7404e1d3a78fe0726ec0f5ce1461f6c209e90d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Use consistent ordering in QShaderLaszlo Agocs2022-06-141-0/+11
| | | | | | | Fixes: QTBUG-101923 Change-Id: I62df3eba773350e47ed650acb00bc42b3ce6a899 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-27/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Add BUILTIN_TESTDATA option to qt_internal_add_testAlexey Edelev2022-02-111-13/+8
| | | | | | | | | | | Multiple tests use qt_internal_add_resource that copies the functionality that is already implemented inside the qt_internal_add_test function. Simplify these test by replacing the qt_internal_add_resource call with the new BUILTIN_TESTDATA option. Change-Id: I18475b817d6f87264f0de53817d6c26c5ccab4e2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove unused .qrc filesJoerg Bornemann2022-01-171-5/+0
| | | | | | | | Task-number: QTBUG-94446 Change-Id: I136d8b4ab070a832866aa50b5701fc6bd863df8a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* rhi: Returns mapping tables by value from QShaderLaszlo Agocs2022-01-071-13/+12
| | | | | | | | | As these are QList and QHash. All existing usages are based on this anyway, no value in being able to indicate "not available" - an empty container fulfills the same role. Change-Id: I8059025fa7a4acb6fc674cd98b16fcafa19ed85d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Enable exposing separate image and sampler objects from the shaderLaszlo Agocs2022-01-033-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the following in a QShader/QShaderDescription: - a list of separate images - a list of separate samplers - a list of "combined_sampler_uniform_name" -> [ separate_texture_binding, separate_sampler_binding ] mappings (relevant for GLSL only) On the QShader (and qsb/QShaderBaker) level not having separate image (texture) and sampler objects exposed in the reflection info is not entirely future proof. Right now we benefit strongly from the fact that Vulkan/SPIR-V supports both combined and separate images/samplers, while for HLSL and MSL SPIRV-Cross translates combined image samplers to separate texture and sampler objects, but it is not given that relying on combined image samplers will always be possible in the long run; it is mostly a legacy OpenGL thing that just happens to be supported in Vulkan/SPIR-V due to some benefits with certain implementations/hw, but is not something present in any newer APIs. In addition, before this patch, attempting to run a shader with separate textures and samplers through qsb will just fail for GLSL, even though SPIRV-Cross does have the ability to generate a "fake" combined sampler for each separate texture+sampler combination. Take this into use. This also involves generating and exposing a combined_name->[separate_texture_binding,separate_sampler_binding] mapping table for GLSL, not unlike we have the native binding map for HLSL and MSL. A user (such as, the GL backend of QRhi) would then use this table to recognize what user-provided texture+sampler binding point numbers correspond to which auto-generated sampler2Ds in the GL program. Take the following example: layout(binding = 1) uniform texture2D sepTex; layout(binding = 2) uniform sampler sepSampler; layout(binding = 3) uniform sampler sepSampler2; Inn the reflection info (QShaderDescription) this (assuming a corresponding qtshadertools patch in place) now gives one entry in separateImages() and two in separateSamplers(). Assuming sepTex is used both with sepSampler and sepSampler2, the GLSL output and mapping table from QShaderBaker will have two auto-generated sampler2Ds (and no 'texture2D' or 'sampler'). One immediate benefit is that it is now possible to create a shader that relies only on separate images and samplers, feed it into qsb, generate all the possible targets, and then also feed the SPIR-V binary into a tool or library such as Tint (e.g. to generate WGSL) that canot deal with combined image samplers. Change-Id: I9b19847ea5854837b45d3a23edc788c48502aa15 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Prefer QFAIL("Informative message") over QVERIFY(false)Edward Welbourne2021-06-141-7/+7
| | | | | Change-Id: I706b0aedfa870452331a8c2c488d55b279ee452a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* rhi: gl: Add some enablers for supporting GL_TEXTURE_EXTERNAL_OESLaszlo Agocs2021-01-131-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | From QRhi's perspective this consists of two things: - A shader with samplerExternalOES in it cannot go through the standard pipeline. Rather, a QShader with suitable GLSL code in it has to be constructed manually. As this is something useful as an autotest anyway, add a test case to the qshader autotest that demonstrates this. - When it comes to correctly calling glBindTexture, add a QRhiTexture flag. The expectation is that an OpenGL-only client sets this in combination with QRhiTexture::createFrom(), thus wrapping an existing texture that then gets bound to the GL_TEXTURE_EXTERNAL_OES target instead of our usual GL_TEXTURE_2D. For completeness we also add a SamplerExternalOES variable type to QShaderDescription, but the sampler type is not actually used by the QRhi OpenGL backend, as it is the QRhiTexture that defines the texture target. Change-Id: I36b52325deb3703b59186ee3d726d0c3015bfc4b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-071-8/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Replace QtTest headers with QTestDavid Skoland2020-12-221-1/+3
| | | | | | | | | | | Complete search and replace of QtTest and QtTest/QtTest with QTest, as QtTest includes the whole module. Replace all such instances with correct header includes. See Jira task for more discussion. Fixes: QTBUG-88831 Change-Id: I981cfae18a1cabcabcabee376016b086d9d01f44 Pick-to: 6.0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-231-2/+2
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove old CBOR-based format from QShaderLaszlo Agocs2020-08-112-75/+0
| | | | | | | | | We only support version 4 and 5 in Qt 6.0. 1 and 2 are already gone (due to being based on binary JSON), now we remove 3 as well. Task-number: QTBUG-81346 Change-Id: I3627dcc0587f1e36f11e93edf7172889e911d64e Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove old qsb versions from qshader autotestLaszlo Agocs2020-07-317-26/+11
| | | | | | | | | | Only keep 3, 4, and 5 because 3 is the lowest version where binary JSON is not used anymore. Change-Id: Id0319e8eceb845017ed493d0ef6902b53050d5a6 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* CMake: Regenerate tests with new qt_ prefixed APIsAlexandru Croitor2020-07-091-2/+2
| | | | | | | | Use pro2cmake with '--api-version 2' to force regenerate projects to use the new prefixed qt_foo APIs. Change-Id: I055c4837860319e93aaa6b09d646dda4fc2a4069 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Use QList instead of QVector in gui testsJarek Kobus2020-06-251-3/+3
| | | | | | Task-number: QTBUG-84469 Change-Id: Ia86f39597de418dde6cd9ae3170ef919bd27416a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use QByteArray instead of QStringJonas Karlsson2020-06-031-19/+19
| | | | | | | | | | 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>
* Hotfix for int->qsizetype fallout in QShaderLaszlo Agocs2020-05-051-0/+17
| | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-03-041-2/+2
|\ | | | | | | Change-Id: I99ee6f8b4bdc372437ee60d1feab931487fe55c4
| * rhi: Use versioning in QShaderDescription serialization as wellLaszlo Agocs2020-03-031-2/+2
| | | | | | | | | | | | | | | | | | | | 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>
* | Regenerate projects one last time before mergewip/cmakeAlexandru Croitor2020-02-121-2/+1
| | | | | | | | | | | | Change-Id: Ia24cf56b79ca6dacd370a7e397024e9b663e0167 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/dev' into merge-devLeander Beernaert2020-01-242-13/+129
|\| | | | | | | Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
| * qshader autotest: Avoid variable shadowingLaszlo Agocs2020-01-141-4/+6
| | | | | | | | | | | | | | Nicer this way. Change-Id: Ia132b8e394f1080623abe4b1452a41c5ca31272c Reviewed-by: Johan Helsing <johan.helsing@qt.io>
| * Move away from CBOR in QShaderDescription serializationLaszlo Agocs2020-01-132-9/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...but keep support for deserializing for all older versions in order to play nice with existing .qsb files. The usage of binary JSON and then CBOR is a historical artifact: relying on the QJsonDocument (which we generate for purposes unrelated to binary serialization) was a convenient shortcut. However, writing to and reading from a QDataStream instead (which QShader already does) is trivial. In order not to be limited by potential CBOR requirements in the future, take it all into our own hands. Extend the qshader autotest accordingly. Task-number: QTBUG-81298 Change-Id: If0047b659bd6601ca47b5bbbce1b719630cde01e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeLeander Beernaert2019-11-197-4/+201
|\| | | | | | | Change-Id: Ifecc2d9db396d783124df8567553ba5f846f30bb
| * rhi: Move to CBOR in QShader and expand the autotestLaszlo Agocs2019-10-297-4/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Binary JSON is said to become deprecated. Therefore, add support for CBOR. Binary JSON is still supported for deserialization, so all existing .qsb files will continue to work, as long as the binaryjson feature is enabled in the Qt build. Also makes QShaderDescription comparable. This is important for tests in particular. A nice side effect of using CBOR is that .qsb files become smaller. For a typical Qt Quick material shader this can mean a reduction of 300 bytes or more. Task-number: QTBUG-79576 Change-Id: I5547c0266e3e8128c9653e954e47487352267f71 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Port rhi testsLeander Beernaert2019-10-281-0/+27
|/ | | | | | Change-Id: I3bf5731696a0647bf0e62758eb3d1742ba097041 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Introduce the Qt graphics abstraction as private QtGui helpersLaszlo Agocs2019-06-136-0/+264
Comes with backends for Vulkan, Metal, Direct3D 11.1, and OpenGL (ES). All APIs are private for now. Shader conditioning (i.e. generating a QRhiShader in memory or on disk from some shader source code) is done via the tools and APIs provided by qt-labs/qtshadertools. The OpenGL support follows the cross-platform tradition of requiring ES 2.0 only, while optionally using some (ES) 3.x features. It can operate in core profile contexts as well. Task-number: QTBUG-70287 Change-Id: I246f2e36d562e404012c05db2aa72487108aa7cc Reviewed-by: Lars Knoll <lars.knoll@qt.io>