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. Pick-to: 6.6 Change-Id: Ia7074c7f53633d51cf3bbdcc84e7f578214d9648 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>bb10
parent
480b39288f
commit
1d019de6b7
|
|
@ -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…
Reference in New Issue