温馨提示:本文翻译自stackoverflow.com,查看原文请点击:c++ - Get Queue Families in Vulkan Qt
c++ QT vulkan

c++ - 获取Vulkan Qt中的队列家庭

发布于 2020-05-03 04:16:38

我正在使用QVulkanWindow示例,尝试加载图像并将其显示在Qt窗口中。

这将设置Vulkan实例:

if (!inst.create())
    qFatal("Failed to create Vulkan instance: %d", inst.errorCode());

VulkanWindow w;
w.setVulkanInstance(&inst);

现在initResources(),在VulkanRenderer类中,我想从设备获取GraphicsQueue:

m_devFuncs->vkGetDeviceQueue(device, VK_QUEUE_GRAPHICS_BIT, 0, &graphicsQueue);

我得到的错误是:

vkDebug: Validation: 0:  [ VUID-vkGetDeviceQueue-queueFamilyIndex-00384 ] Object: 0x564e779a5f90 (Type = 3) | 
vkGetDeviceQueue: queueFamilyIndex (= 1) is not one of the queue families given via VkDeviceQueueCreateInfo structures when the device was created. 
The Vulkan spec states: queueFamilyIndex must be one of the queue family indices specified when device was created, via the VkDeviceQueueCreateInfo structure 

Qt是否没有设置图形队列?还是我做错了?还是应该创建自己的VkInstance并将其传递给Qt?

查看更多

提问者
tde
被浏览
20
krOoze 2020-02-13 22:07

VK_QUEUE_GRAPHICS_BIT是一个枚举数,而不是队列家族索引。因此该代码从根本上来说是不正确的。

graphicsQueue()方法QVulkanWindow返回一个VkQueue可以使用。