rhi: Fix intro doc snippet with Vulkan
The QVulkanInstance must outlive the QRhi (if Vulkan is used). Otherwise subtle problems may pop up upon application exit. Change-Id: Ia7074c7f53633d51cf3bbdcc84e7f578214d9648 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 1d019de6b7090ea6c973f7e9fa780259a455ce98) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
666a1db34c
commit
2d87d42040
@ -11,6 +11,9 @@ int main(int argc, char **argv)
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
#if QT_CONFIG(vulkan)
|
||||
QVulkanInstance inst;
|
||||
#endif
|
||||
std::unique_ptr<QRhi> rhi;
|
||||
#if defined(Q_OS_WIN)
|
||||
QRhiD3D12InitParams params;
|
||||
@ -19,7 +22,6 @@ int main(int argc, char **argv)
|
||||
QRhiMetalInitParams params;
|
||||
rhi.reset(QRhi::create(QRhi::Metal, ¶ms));
|
||||
#elif QT_CONFIG(vulkan)
|
||||
QVulkanInstance inst;
|
||||
inst.setExtensions(QRhiVulkanInitParams::preferredInstanceExtensions());
|
||||
if (inst.create()) {
|
||||
QRhiVulkanInitParams params;
|
||||
|
Loading…
x
Reference in New Issue
Block a user