diff --git a/src/gui/rhi/qrhi_platform.h b/src/gui/rhi/qrhi_platform.h index 8307e9217c..30676d0da6 100644 --- a/src/gui/rhi/qrhi_platform.h +++ b/src/gui/rhi/qrhi_platform.h @@ -86,9 +86,12 @@ struct Q_GUI_EXPORT QRhiVulkanNativeHandles : public QRhiNativeHandles VkDevice dev = VK_NULL_HANDLE; quint32 gfxQueueFamilyIdx = 0; quint32 gfxQueueIdx = 0; - VkQueue gfxQueue = VK_NULL_HANDLE; // and optionally, the mem allocator void *vmemAllocator = nullptr; + + // only for querying (rhi->nativeHandles()) + VkQueue gfxQueue = VK_NULL_HANDLE; + QVulkanInstance *inst = nullptr; }; struct Q_GUI_EXPORT QRhiVulkanCommandBufferNativeHandles : public QRhiNativeHandles diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 6fe79f223e..a0e6a467bb 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -225,6 +225,13 @@ QT_BEGIN_NAMESPACE Graphics queue index. */ +/*! + \variable QRhiVulkanNativeHandles::vmemAllocator + + Relevant only when importing an existing memory allocator object, + leave it set to \nullptr otherwise. +*/ + /*! \variable QRhiVulkanNativeHandles::gfxQueue @@ -233,10 +240,10 @@ QT_BEGIN_NAMESPACE */ /*! - \variable QRhiVulkanNativeHandles::vmemAllocator + \variable QRhiVulkanNativeHandles::inst - Relevant only when importing an existing memory allocator object, - leave it set to \nullptr otherwise. + Output only, not used by QRhi::create(), only set by the + QRhi::nativeHandles() accessor. The QVulkanInstance used by the QRhi. */ /*! @@ -819,6 +826,7 @@ bool QRhiVulkan::create(QRhi::Flags flags) nativeHandlesStruct.gfxQueueIdx = gfxQueueIdx; nativeHandlesStruct.gfxQueue = gfxQueue; nativeHandlesStruct.vmemAllocator = allocator; + nativeHandlesStruct.inst = inst; return true; } diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp index 6aeae2eb03..942ee06fe4 100644 --- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp +++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp @@ -487,6 +487,8 @@ void tst_QRhi::nativeHandles() case QRhi::Vulkan: { const QRhiVulkanNativeHandles *vkHandles = static_cast(rhiHandles); + QVERIFY(vkHandles->inst); + QCOMPARE(vkHandles->inst, &vulkanInstance); QVERIFY(vkHandles->physDev); QVERIFY(vkHandles->dev); QVERIFY(vkHandles->gfxQueue);