qt5base-lts/tests/auto/gui/rhi
Laszlo Agocs df0e98d408 rhi: Pipeline cache load/save
Add QRhi APIs to retrieve and reload the contents of the "pipeline
cache".

The only API where there is a true pipeline cache is object is Vulkan
(VkPipelineCache). For OpenGL, the other backend where we support this,
it is simulated with program binaries. The Qt 5 style OpenGL program
binary disk cache continues to work like before, but one has now the
option to do things in a more modern, graphics API agnostic way, that
leads to generating a single blob instead of a large set of files in
some system location, allowing easier "pre-baking" of the cache content.

It is expected that Qt Quick exposes the two new functions in form
if QSG_RHI_ environment variables, thus allowing easy testing and
cache file generation.

As an example for the performance improvements this can give, consider
Vulkan, where we do not have any existing persistent caching mechanism
in place:

Running BenchmarkDemoQt6.exe --scene flythrough --mode demo creates 18
QRhiGraphicsPipeline objects from Qt Quick and Qt Quick 3D.

The total time spent in QRhiGraphicsPipeline::create() during application
startup for these 18 pipelines is 35-40 ms on a given Windows (NVIDIA)
system.

When exporting the pipeline cache contents to a file, and then, in a
subsequent run, reloading the cache contents, this is reduced to 5-7 ms
on the same system, meaning we get a 6-7x improvement.

The generated data is always specific to a given Qt version, RHI
backend, graphics device, and driver version. Much of the implementation
consists of adding and verifying the appropriate header to the blobs
retrieved from the driver, to allow gracefully ignoring data that was
generated with a device or driver that differs from the one used at
run time. This should provide robustness, even if the Vulkan or OpenGL
implementation is for some reason not prepared to identity and reject
incompatible cache/program blobs.

Fixes: QTBUG-90398
Change-Id: I67b197f393562434f372c7b7377f638abab85cb3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-22 10:26:03 +01:00
..
qrhi rhi: Pipeline cache load/save 2021-01-22 10:26:03 +01:00
qshader rhi: gl: Add some enablers for supporting GL_TEXTURE_EXTERNAL_OES 2021-01-13 10:08:23 +01:00
CMakeLists.txt Re-enable tst_qrhi on Linux 2020-07-29 15:04:19 +02:00