c++ - 关于如何处理vulkan queue family的问题

标签 c++ queue vulkan

我正在听这个图 https://vulkan-tutorial.com/Drawing_a_triangle/Presentation/Window_surface

当我读到这篇文章时,我有一些问题。关于队列族

下面的代码是

检查有能力呈现到您的窗口表面的队列族

VkBool32 presentSupport = false;
vkGetPhysicalDeviceSurfaceSupportKHR(device, i, surface, &presentSupport);

if (presentSupport) {
    indices.presentFamily = i;
}

这篇文章有这句话。

Note that it's very likely that these end up being the same queue family after all, but throughout the program we will treat them as if they were separate queues for a uniform approach

  1. 为什么要将它们视为统一方法的独立队列?

you could add logic to explicitly prefer a physical device that supports drawing and presentation in the same queue for improved performance.

  1. 添加逻辑以明确首选支持同一队列中的绘图和演示的物理设备。为什么要提高性能?

最佳答案

why treat them as if they were separate queues for a uniform approach?

教程的重点是指导,通常使用尽可能清晰直接的代码。为特殊情况添加一堆逻辑只会混淆示例代码。这对于本系列的早期教程尤其重要。

why improve performance ?

假设您可以使用不同的同步选项,或者如果您知道您将在与渲染图像相同的队列中呈现,则可以不为转移交换链图像的所有权添加障碍。

但这可能不是什么大问题。

关于c++ - 关于如何处理vulkan queue family的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59357510/

相关文章:

将所有纹理绑定(bind)到一个巨大的描述符集上

c++ - shgetvalue 运行时错误

c++ - 随机数函数未正确随机化 (C++)

c++ - 如何使用递归反转打印堆栈?

size - MSMQ队列大小是否有限制?

c# - 在 C# 中线程化时锁定变量

c++ - 为什么 C++11 move 运算符 (=) 的行为不同

Java Queue add()/offer() 和 poll() 方法无法按照预期的 FIFO 工作

vulkan - 重置命令缓冲区是否比设置统一缓冲区更快?

algorithm - GLSL Vulkan 计算着色器可有效地从共享数组中删除零以生成压缩数组