Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueueIter returned by Device::new is confusing #559

Closed
zimond opened this issue Jun 27, 2017 · 8 comments
Closed

QueueIter returned by Device::new is confusing #559

zimond opened this issue Jun 27, 2017 · 8 comments

Comments

@zimond
Copy link

zimond commented Jun 27, 2017

Currently Device::new returns a QueueIter which is documented as the queues produces when creating a device. However it seems that the iterator is just the first queue in the queue family used to create the device. Is it intended to be this?

@tomaka
Copy link
Member

tomaka commented Jun 27, 2017

I'm not sure where the confusion is. Creating a device generates queues, and this iterator returns them.
Right now all the examples only use one queue, so obviously the iterator only returns one element.

@zimond
Copy link
Author

zimond commented Jun 27, 2017

Currently vk::DeviceQueueCreateInfo's queueCount attribute is priorities.len().

priorities is defined only once for each queue family, which means the queueCount for every queue family is only one. How could I ask for multiple queues for every device created?

Maybe I misunderstood something?

@zimond
Copy link
Author

zimond commented Jun 27, 2017

So I think the queue_families param of Device::new should be having type of I: IntoIterator<Item = (QueueFamily<'a>, Vec<f32>)> ?

@tomaka
Copy link
Member

tomaka commented Jun 27, 2017

If you want multiple queues from the same family, you're supposed to pass the same family to Device::new() multiple times.

Eg. Device::new(..., vec![(my_family, 1.0), (my_family, 0.5)]);

@zimond
Copy link
Author

zimond commented Jun 27, 2017

Wouldn't passing the same family multiple times return the same queue (the first queue in the family) multiple times? I thought that vkCreateDevice returns different queues from a family, each assigned with a priority

@zimond
Copy link
Author

zimond commented Jun 27, 2017

BTW it seems to be not recommended to feed multiple vkDeviceQueueCreateInfo with the same queue family.

https://www.reddit.com/r/vulkan/comments/4nb5jx/why_does_initialization_fail_here/?st=j4fbt66d&sh=bb671eab

@tomaka
Copy link
Member

tomaka commented Jun 27, 2017

Maybe what's confusing is that vulkano's API is higher-level than the raw vkCreateDevice: https://github.com/tomaka/vulkano/blob/24fe5b18975c401d70f1aecf444317fc49a5c2f7/vulkano/src/device.rs#L205-L243

It was designed this way so that the elements of the iterator returned by Device::new match the elements of the iterator passed to the function.

@zimond
Copy link
Author

zimond commented Jun 27, 2017

oh, I finally understand the code here.... Maybe some documentation is needed here. Thanks for your quick explanation.

@Rua Rua closed this as completed Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants