summaryrefslogtreecommitdiffstats
path: root/tests/manual/rhi
Commit message (Collapse)AuthorAgeFilesLines
* Regenerate qsb files for auto and manual testsLaszlo Agocs2020-01-2220-5/+0
| | | | | | | | | | | | | They are now version 4, which is hopefully the final format, relying on nothing but QDataStream. Except for the qshader autotest which tests all the 1..4 versions and so needs appropriate test data. Also unifies the batch file naming. Change-Id: Iec478be86d14dbec7ffb9d5f9b62c14fca5d7c9e Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* rhi: Add render-to-cubemap manual testLaszlo Agocs2020-01-1318-0/+596
| | | | | | | | | | | | | What's more, demonstrate two types of rendering to a cubemap: one by one to each face, and by attaching all faces as color attachments in one go. Both are used by Qt Quick 3D in connection with shadows, so this proves that the same is possible to implement with QRhi. Task-number: QTBUG-81261 Change-Id: I5c7077224d7cae0dd6ea02ac30a9e6f9f1f0c229 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* rhi: Add manual test for RGBA16F and computeLaszlo Agocs2020-01-139-0/+402
| | | | | | | | | | | Uses the two compute shaders from Qt Quick 3D. Demonstrates and tests both RGBA16F textures and using them (and doing load/store with mip levels individually) in combination with compute. Task-number: QTBUG-81213 Change-Id: I3f0f250d5997a26c857b7c45517684c63b44e58e Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* RHI: new native texture APIPaul Olav Tvete2019-12-051-4/+4
| | | | | | | | | | | | The new version takes/returns a value that can be unpacked and passed to other functions without knowing which backend is in use. The old API will be removed in a later change when dependent modules have been updated Task-number: QTBUG-78570 Change-Id: I18d928ceef3cb617c0c509ecccb345551a7990af Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Enable QRhi Metal backend on iOSLaszlo Agocs2019-11-276-16/+16
| | | | | | | | | | While we are at it, remove the Border and MirrorOnce wrap modes that have not been supported on OpenGL, because they are unsupported with Metal+iOS as well. Task-number: QTBUG-78580 Change-Id: I0db94b9d3a6125b3bb5d7b1db5d02a42cd94d2c2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Deprecate constructing QFlags from a pointerAllan Sandfeld Jensen2019-11-203-5/+5
| | | | | | | | | This was used to support QFlags f = 0 initialization, but with 0 used as a pointer literal now considered bad form, it had been changed many places to QFlags f = nullptr, which is meaningless and confusing. Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* rhi: Remove QVectors from the data description structs as wellLaszlo Agocs2019-10-033-8/+12
| | | | | | | | | | | | | | | As usual, keep some QVector overloads around to allow Qt Quick to compile. Color attachments and vertex input bindings get an at(index) type of accessor, unlike any other of similar lists. This is because there the index is significant, and sequential iteration is not the only type of operation that is performed. Sometimes a lookup based on an index will be needed as well. Task-number: QTBUG-78883 Change-Id: I3882941f09e94ee2f179e0e9b8161551f0d5dae7 Reviewed-by: Christian Strømme <christian.stromme@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Remove QVector in the API of QRhiResource subclassesLaszlo Agocs2019-09-304-22/+19
| | | | | | | | | | | | | | | | | | | | | | | | | Forcing users to go through a QVector, when in practice they almost always want to source the data from an initializer list, a QVarLengthArray, or a plain C array, is not ideal. Especially since we can reason about the maximum number of elements in the vast majority of use cases for all the affected lists. QRhiResource is also not copyable so we do not need the usual machinery offered by containers. So switch to a QVarLengthArray. Note that a resource is not a container. The only operations we are interested in is to be able to source data either via an initializer list or by iterating on something, and to be able to extract the data, in case a user wishes to set up another resource based on the existing one. In some cases a QVector overload is kept for source compatibility with other modules (Qt Quick). These may be removed in the future. Also do a similar QVector->QVarLengthArray change in the srb-related data in the backends. Change-Id: I6f5b2ebd8e75416ce0cca0817bb529446a4cb664 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Ensure drawable size atomicity within a frameLaszlo Agocs2019-09-294-25/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert surfacePixelSize() to be a getter only. With Metal this will mean returning the "live" layer size (and so not the layer.drawableSize), which is in line with what we expect with other backends. Instead, we leave it to the swapchain's buildOrResize() to "commit" the size by setting drawableSize on the layer. With typical application or Qt Quick logic this ensures that layer.drawableSize is set once and stays static until we get to process the next resize - on the rendering thread. This of course would still mean that there was a race when a client queries surfacePixelSize() to set the depth-stencil buffer size that is associated with a swapchain. (because that must happen before calling buildOrResize() according to the current semantics) That can however be solved in a quite elegant way, it turns out, because we already have a flag that indicates if a QRhiRenderBuffer is used in combination with (and only in combination with) a swapchain. If we simply say that setting the UsedWithSwapChainOnly flag provides automatic sizing as well (so no setPixelSize() call is needed), clients can simply get rid of the problematic surfacePixelSize() query and everything works. Task-number: QTBUG-78641 Change-Id: Ib1bfc9ef8531bcce033d1f1e5d4d5b4984d6d69f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* rhi: Always enable debug info printing from manual testsLaszlo Agocs2019-09-291-1/+3
| | | | | | | | | It can be important to see for example the adapter enumeration that is printed when qt.rhi.general is enabled. Make it enabled by default in the tests. Change-Id: I7bd073781e176d9b17b5386c548e9f8a2e16c10f Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Add a --transparent option to manual testsLaszlo Agocs2019-09-2615-14/+30
| | | | | | | | | | This will also cause clearing to 0,0,0,0. Essential in order to allow fast testing of window transparency issues in combination with QRhi and the various backends. Change-Id: Iee2763c1d06f1d3e5d59a9142abaf30fab1dc543 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Unify handling of special cases for scissor and viewport rectsLaszlo Agocs2019-09-264-0/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | | With OpenGL a scissor (or viewport) rectangle is not allowed to have a negative width or height. Everything else is allowed. This is also the semantic we wish to keep for QRhiViewport and QRhiScissor. This raises some problems. For instance, when we do bottom-left - top-left rectangle conversion, the case of partially out of bounds rects needs to be taken into account. Otherwise, Qt Quick ends up in wrong scissoring in certain cases, typically when the QQuickWindow size is decreased so the content does not fit because that will then start generating negative x, y scissors for clipping (which is perfectly valid but the QRhi backends need to be able to deal with it) Then there is the problem of having to clamp width and height carefully, because some validation layers for some APIs will reject a viewport or scissor with partially out of bounds rectangles. To verify all this, add a new manual test, based on the cubemap one. (cubemap was chosen because that is an ideal test scene as it fills the viewport completely, and so it is visually straightforward when a scissor rectangle is moving around over it) Fixes: QTBUG-78702 Change-Id: I60614836432ea9934fc0dbd0ac7e88931f476542 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Include missing shbang line in executable shell scriptEdward Welbourne2019-09-231-0/+1
| | | | | Change-Id: I802665c89fcac9e07e745cf6dce1a04404ae764d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: Add a flag to indicate preferring a software adapterLaszlo Agocs2019-09-121-0/+7
| | | | | | | ...if there is one and the concept is applicable in the first place. Change-Id: Iab202c1c1cdd229f4910159de4cae7ce30805ea9 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: d3d11: Add the device lost testing machineryLaszlo Agocs2019-09-121-1/+14
| | | | | | | | | | | | | | | | | | | The device can be lost when physically removing the graphics adapter, disabling the driver (Device Manager), upgrading/uninstalling the graphics driver, and when it is reset due to an error. Some of these can (and should) be tested manually, but the last one has a convenient, programmatic way of triggering: by triggering the timeout detection and recovery (TDR) of WDDM. A compute shader with an infinite loop should trigger this after 2 seconds by default. All tests in tests/manual/rhi can now be started with a --curse <count> argument where <count> specifies the number of frames to render before breaking the device. Qt Quick will get an environment variable with similar semantics in a separate patch. Change-Id: I4b6f8d977a15b5b89d686b3973965df6435810ae Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: vulkan: Introduce secondary command buffer usageLaszlo Agocs2019-08-292-1/+7
| | | | | | | | | | | As an option. Must opt in via setting ExternalContentsInPass in the flags for beginFrame(). It is somewhat unfortunate to require declaring this up front, but forcing using secondary command buffers always, even though beginExternal() may not be used in many applications, would be an overkill. Change-Id: I8d52bcab40c96f89f140c4c7877b6c459925e3c7 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Fix clear value in offscreen testLaszlo Agocs2019-07-311-1/+1
| | | | | | | Leftover from the migration to QColor as color clear value. Change-Id: Ibf49d65234a1e14d53035b46249753a5929ca22b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: gl: Add support for computeLaszlo Agocs2019-07-311-1/+1
| | | | | | | ...and storage buffers and images. Change-Id: If38a51322e3187088a13cf4e9b88cb40c8af8621 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: metal: Do not hold on to the drawable when not presentingLaszlo Agocs2019-07-311-0/+4
| | | | | | | | | | | The Quick render loops do SkipPresent occasionally, and it all seemed to work with the threaded one because we lack an autorelease pool on the SG render thread. (to be corrected separately) The basic one ended up crashing sometimes, however. Holding on to the drawable is incorrect. Fixes: QTBUG-76953 Change-Id: I0d0ec6d09aa209d2c848d7a9dbd9b15916fe23ab Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Improve base vertex/instance supportLaszlo Agocs2019-07-011-0/+2
| | | | | | | | | Have feature flags as appropriate. OpenGL is causing a mess here but let's support what we can since some of this will become relevant in more sophisticated mesh drawing cases with 3D in particular. Change-Id: Idfa7b4642ec87147978e03d78d6233efbd151491 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Add a test for instancingLaszlo Agocs2019-07-019-1/+227
| | | | | | | | Draws 1024 cubes at random x,y positions with varying color with a single instanced draw call. Change-Id: I8737503acf23866ad4734b1d88753415a3b93445 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Enhance line width and point size supportLaszlo Agocs2019-07-012-0/+5
| | | | | | | | | | | | | | | | | | | | | ...but this will vary between backends, or in some cases even between implementations of the same API. Point size is settable only via the vertex shader (gl_PointSize). It is silently ignored with D3D and HLSL. Line widths other than 1 are supported only on OpenGL and Vulkan. (but this is in fact deprecated with GL and optional with Vulkan) Add QRhi::Feature values for both. The line width is now settable on QRhiGraphicsPipeline. It is not a dynamic state since the static, per-pipeline width is good enough for most cases. (and the feature is not supported on half of the backends anyways so it will get limited use in practice). Change-Id: I6d3a32269527c452b794b2cb8b0f03101eab40b2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Add compute api and implement for Vulkan and MetalLaszlo Agocs2019-06-1734-44/+592
| | | | | | | | | | | | | D3D11 and GL (4.3+, ES 3.1+) will come separately at a later time. Change-Id: If30f2f3d062fa27e57e9912674669225b82a7b93 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Introduce the Qt graphics abstraction as private QtGui helpersLaszlo Agocs2019-06-1395-0/+8515
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>