QVulkanDeviceFunctions 类提供对设备级核心 Vulkan 1.2 API 的跨平台访问。 更多...
头: | #include <QVulkanDeviceFunctions> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
默认情况下,Qt 和 Qt 应用程序未链接到任何 Vulkan 库。相反,在运行时动态解析所有函数。每个 QVulkanInstance 提供 QVulkanFunctions 可检索对象凭借 QVulkanInstance::functions ()。这未包含设备级函数,为避免潜在内部分派开销。相反,依赖设备或设备可分派子级对象的函数的暴露是凭借 QVulkanDeviceFunctions 和 QVulkanInstance::deviceFunctions (). QVulkanFunctions 和 QVulkanDeviceFunctions 一起提供对完整核心 Vulkan API 的访问,排除任何扩展。
注意: QVulkanDeviceFunctions 实例无法被直接构造。
典型用法如下:
void Window::render() { QVulkanInstance *inst = vulkanInstance(); QVulkanDeviceFunctions *df = inst->deviceFunctions(device); VkResult err = df->vkAllocateCommandBuffers(device, &cmdBufInfo, &cmdBuf); // ... }
The QVulkanDeviceFunctions object specific to the provided VkDevice is created when QVulkanInstance::deviceFunctions () is first called with the device in question. The object is then cached internally.
要访问额外功能,应用程序可以使用 QVulkanInstance::getInstanceProcAddr () and vkGetDeviceProcAddr(). Applications can also decide to link to a Vulkan library directly, as many implementations export function symbols for the core commands. See vkGetInstanceProcAddr 手册页 了解更多信息。
另请参阅 QVulkanInstance , QVulkanFunctions , QWindow::setVulkanInstance (),和 QWindow::setSurfaceType ().