doc: Fix QVulkanFunctions code snippet

Showing code that cannot possibly compile is bad practice.
(vkAllocateCommandBuffers is in QVulkanDeviceFunctions, not
QVulkanFunctions)

Rather use a member function that is actually in QVulkanFunctions.

Change-Id: I3063a8a229152144ce866e915eb4c14ecc58e9ce
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit e8e9c287ec6a086a96b36e692ab6d5ed11b64951)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Laszlo Agocs 2023-07-27 12:35:57 +02:00 committed by Qt Cherry-pick Bot
parent 095bfbd3e4
commit 618abdcd80

View File

@ -8,20 +8,18 @@
namespace src_gui_vulkan_qvulkanfunctions {
struct Window {
void render();
void init();
QVulkanInstance *vulkanInstance() { return nullptr; }
};
VkDevice_T *device = nullptr;
VkCommandBufferAllocateInfo cmdBufInfo;
VkCommandBuffer cmdBuf;
//! [0]
void Window::render()
void Window::init()
{
QVulkanInstance *inst = vulkanInstance();
QVulkanFunctions *f = inst->functions();
// ...
VkResult err = f->vkAllocateCommandBuffers(device, &cmdBufInfo, &cmdBuf);
uint32_t count = 0;
VkResult err = f->vkEnumeratePhysicalDevices(inst->vkInstance(), &count, nullptr);
// ...
}
//! [0]