Skip to content

Rewrite of the graphics and present queue index determination#104

Merged
gpx1000 merged 1 commit intoKhronosGroup:mainfrom
asuessenbach:queue_index
Jul 30, 2025
Merged

Rewrite of the graphics and present queue index determination#104
gpx1000 merged 1 commit intoKhronosGroup:mainfrom
asuessenbach:queue_index

Conversation

@asuessenbach
Copy link
Copy Markdown
Contributor

Replaces #93.

@asuessenbach
Copy link
Copy Markdown
Contributor Author

Note, that this should not be merged yet!

In case the graphics and the present index are different, the following code would fail:

       vk::DeviceQueueCreateInfo deviceQueueCreateInfo{ .queueFamilyIndex = graphicsIndex, .queueCount = 1, .pQueuePriorities = &queuePriority };
        vk::DeviceCreateInfo      deviceCreateInfo{ .pNext = &featureChain.get<vk::PhysicalDeviceFeatures2>(),
                                                    .queueCreateInfoCount = 1,
                                                    .pQueueCreateInfos = &deviceQueueCreateInfo,
                                                    .enabledExtensionCount = static_cast<uint32_t>(requiredDeviceExtension.size()),
                                                    .ppEnabledExtensionNames = requiredDeviceExtension.data() };
        device = vk::raii::Device( physicalDevice, deviceCreateInfo );
        graphicsQueue = vk::raii::Queue( device, graphicsIndex, 0 );
        presentQueue = vk::raii::Queue( device, presentIndex, 0 );

It's just the gaphicsIndex used to create a queue, but the presentIndex is used to get a queue out of the device. That should fail!

The question now is: should the index determination be simplified, such that just one index is determined, and just one queue is requested? Or should the device creation part be extended to correctly handle different graphics and present queue?

@SaschaWillems
Copy link
Copy Markdown
Collaborator

Tbh. the no. of devices that don't support present on graphics is so miniscule and if compared to how much more code that adds, I'd just skip that and simply mentioned it in the docs. I don't think anyone doing the tutorial will ever run into such a configuration.

@asuessenbach
Copy link
Copy Markdown
Contributor Author

@SaschaWillems Totally agree.

Just asking for a queue with both graphics and present support makes it much easier.

Copy link
Copy Markdown
Contributor

@gpx1000 gpx1000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, agreed that this is easier and there's little chance anyone will ever really run into a need to do it the current way.

@asuessenbach asuessenbach force-pushed the queue_index branch 4 times, most recently from 22344e4 to 415afc9 Compare July 22, 2025 15:45
… the two queue indices.

If it looks good, I can again carry that over to all the other chapters.
@asuessenbach
Copy link
Copy Markdown
Contributor Author

OK, carried the modifications over to all the other chapters.

Please pay special attention to chapters 33 and 34, which were slightly different than the others.

Note, that I could not run any of the programs, as I'm currently not able to build them. That is, would be great if someone else could verify, that they are still alive.

@gpx1000
Copy link
Copy Markdown
Contributor

gpx1000 commented Jul 22, 2025

I'll review and run all of them. Working on it now.

@gpx1000
Copy link
Copy Markdown
Contributor

gpx1000 commented Jul 22, 2025

Alright, it seems everything is working for me here in Linux.

Copy link
Copy Markdown
Collaborator

@SaschaWillems SaschaWillems left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working fine for me on Windows

@SaschaWillems
Copy link
Copy Markdown
Collaborator

Since we don't have a strict "three approvals" rule over here: Should we just merge this?

@gpx1000
Copy link
Copy Markdown
Contributor

gpx1000 commented Jul 30, 2025

Yes, we absolutely should. I'll merge it now. I was waiting for the docs call that was yesterday in case we were going to go over them.

@gpx1000 gpx1000 merged commit 090ecd6 into KhronosGroup:main Jul 30, 2025
5 checks passed
@asuessenbach asuessenbach deleted the queue_index branch July 31, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants