Reputation: 325
i`m fllowing this tut https://vulkan-tutorial.com/Drawing_a_triangle/Presentation/Window_surface
As I read this, I got some questions. about queue families
The code below is
check for queue family that has the capability of presenting to your window surface
VkBool32 presentSupport = false;
vkGetPhysicalDeviceSurfaceSupportKHR(device, i, surface, &presentSupport);
if (presentSupport) {
indices.presentFamily = i;
}
This article has this sentence.
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
you could add logic to explicitly prefer a physical device that supports drawing and presentation in the same queue for improved performance.
Upvotes: 0
Views: 367
Reputation: 13246
- why treat them as if they were separate queues for a uniform approach?
Because Vulkan API technically allows that possibility. Though it is quite obscure.
I think for purposes of a tutorial, you could get away with checking if GRAPHICS
queue family supports present, and terminate otherwise. But that is a choice of the tutorial author. Ask him, not the general community.
- add logic to explicitly prefer a physical device that supports drawing and presentation in the same queue. why improve performance?
Why not improve performance? :p
Two queue families implies a VkSemaphore
and Queue Ownership Transfer or VK_SHARING_MODE_CONCURRENT
. Singular queue does not need that, so might have slightly better performance.
Then again it is only a theoretical discussion because virtualy every driver supports present on GRAPHICS
queue family. And driver that would have two GRAPHICS
queue families, where only one supports presentation is even more obscure\theoretical possibility.
Upvotes: 1
Reputation: 473322
why treat them as if they were separate queues for a uniform approach?
The point of a tutorial is to instruct, typically with as clear and straight-forward code as possible. Adding a bunch of logic for special-casing that scenario only clouds and muddles the example code. This is especially important for early tutorials in the series.
why improve performance ?
Presumably you could use different synchronization options or not add barriers for transferring ownership of the swapchain image if you know that you're going to present on the same queue as the rendering one.
But this probably isn't going to be a big deal.
Upvotes: 1