qt5base-lts/tests/manual/rhi/triquadcube
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
..
CMakeLists.txt CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
quadrenderer.cpp rhi: Harmonize create-destroy API pattern with the rest of Qt 2020-05-28 17:53:32 +02:00
quadrenderer.h
texturedcuberenderer.cpp rhi: Make triquadcube manual test compile after recent changes 2021-01-04 11:42:15 +01:00
texturedcuberenderer.h
triangleoncuberenderer.cpp rhi manual tests: Prevent warnings with MSVC 2020-06-15 15:34:05 +02:00
triangleoncuberenderer.h
trianglerenderer.cpp rhi: Harmonize create-destroy API pattern with the rest of Qt 2020-05-28 17:53:32 +02:00
trianglerenderer.h
triquadcube.cpp rhi: Pipeline cache load/save 2021-01-22 10:26:03 +01:00
triquadcube.pro
triquadcube.qrc