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

added QueueFamilyIndex type replacing u32 #2541

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions examples/async-update/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
QueueCreateInfo, QueueFlags,
QueueCreateInfo, QueueFamilyIndex, QueueFlags,
},
format::Format,
image::{
Expand Down Expand Up @@ -123,9 +123,10 @@ fn main() -> Result<(), impl Error> {
.enumerate()
.position(|(i, q)| {
q.queue_flags.intersects(QueueFlags::GRAPHICS)
&& p.surface_support(i as u32, &surface).unwrap_or(false)
&& p.surface_support(QueueFamilyIndex(i as u32), &surface)
.unwrap_or(false)
})
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand All @@ -151,12 +152,13 @@ fn main() -> Result<(), impl Error> {
// For this, we need to find the queue family with the fewest queue flags set, since if the
// queue fmaily has more flags than `TRANSFER | SPARSE_BINDING`, that means it is not dedicated
// to transfer operations.
let transfer_family_index = physical_device
.queue_family_properties()
.iter()
.enumerate()
.filter(|(_, q)| {
q.queue_flags.intersects(QueueFlags::TRANSFER)
let transfer_family_index = QueueFamilyIndex(
physical_device
.queue_family_properties()
.iter()
.enumerate()
.filter(|(_, q)| {
q.queue_flags.intersects(QueueFlags::TRANSFER)
// Queue familes dedicated to transfers are not required to support partial
// transfers of images, reported by a mininum granularity of [0, 0, 0]. If you need
// to do partial transfers of images like we do in this example, you therefore have
Expand All @@ -171,10 +173,11 @@ fn main() -> Result<(), impl Error> {
&& q.min_image_transfer_granularity[0..2]
.iter()
.all(|&g| TRANSFER_GRANULARITY % g == 0)
})
.min_by_key(|(_, q)| q.queue_flags.count())
.unwrap()
.0 as u32;
})
.min_by_key(|(_, q)| q.queue_flags.count())
.unwrap()
.0 as u32,
);

let (device, mut queues) = {
let mut queue_create_infos = vec![QueueCreateInfo {
Expand Down
4 changes: 2 additions & 2 deletions examples/basic-compute-shader/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
instance::{Instance, InstanceCreateFlags, InstanceCreateInfo},
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
Expand Down Expand Up @@ -56,7 +56,7 @@ fn main() {
p.queue_family_properties()
.iter()
.position(|q| q.queue_flags.intersects(QueueFlags::COMPUTE))
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
7 changes: 4 additions & 3 deletions examples/buffer-allocator/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
image::{view::ImageView, Image, ImageUsage},
instance::{Instance, InstanceCreateFlags, InstanceCreateInfo},
Expand Down Expand Up @@ -79,9 +79,10 @@ fn main() -> Result<(), impl Error> {
.enumerate()
.position(|(i, q)| {
q.queue_flags.intersects(QueueFlags::GRAPHICS)
&& p.surface_support(i as u32, &surface).unwrap_or(false)
&& p.surface_support(QueueFamilyIndex(i as u32), &surface)
.unwrap_or(false)
})
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
7 changes: 4 additions & 3 deletions examples/clear-attachments/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
image::{view::ImageView, Image, ImageUsage},
instance::{Instance, InstanceCreateFlags, InstanceCreateInfo},
Expand Down Expand Up @@ -59,9 +59,10 @@ fn main() -> Result<(), impl Error> {
.enumerate()
.position(|(i, q)| {
q.queue_flags.intersects(QueueFlags::GRAPHICS)
&& p.surface_support(i as u32, &surface).unwrap_or(false)
&& p.surface_support(QueueFamilyIndex(i as u32), &surface)
.unwrap_or(false)
})
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
3 changes: 2 additions & 1 deletion examples/debug/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use vulkano::{
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFamilyIndex,
},
instance::{
debug::{
Expand Down Expand Up @@ -126,7 +127,7 @@ fn main() {
.filter(|p| p.supported_extensions().contains(&device_extensions))
.map(|p| {
(!p.queue_family_properties().is_empty())
.then_some((p, 0))
.then_some((p, QueueFamilyIndex(0)))
.expect("couldn't find a queue family")
})
.min_by_key(|(p, _)| match p.properties().device_type {
Expand Down
7 changes: 4 additions & 3 deletions examples/deferred/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
image::{view::ImageView, ImageUsage},
instance::{Instance, InstanceCreateFlags, InstanceCreateInfo},
Expand Down Expand Up @@ -82,9 +82,10 @@ fn main() -> Result<(), impl Error> {
.enumerate()
.position(|(i, q)| {
q.queue_flags.intersects(QueueFlags::GRAPHICS)
&& p.surface_support(i as u32, &surface).unwrap_or(false)
&& p.surface_support(QueueFamilyIndex(i as u32), &surface)
.unwrap_or(false)
})
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
4 changes: 2 additions & 2 deletions examples/dynamic-buffers/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
instance::{Instance, InstanceCreateFlags, InstanceCreateInfo},
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
Expand Down Expand Up @@ -53,7 +53,7 @@ fn main() {
p.queue_family_properties()
.iter()
.position(|q| q.queue_flags.intersects(QueueFlags::COMPUTE))
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
4 changes: 2 additions & 2 deletions examples/dynamic-local-size/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
format::Format,
image::{view::ImageView, Image, ImageCreateInfo, ImageType, ImageUsage},
Expand Down Expand Up @@ -59,7 +59,7 @@ fn main() {
p.queue_family_properties()
.iter()
.position(|q| q.queue_flags.intersects(QueueFlags::COMPUTE))
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
7 changes: 4 additions & 3 deletions examples/gl-interop/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mod linux {
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
QueueCreateInfo, QueueFlags,
QueueCreateInfo, QueueFamilyIndex, QueueFlags,
},
format::Format,
image::{
Expand Down Expand Up @@ -555,9 +555,10 @@ mod linux {
.enumerate()
.position(|(i, q)| {
q.queue_flags.intersects(QueueFlags::GRAPHICS)
&& p.surface_support(i as u32, &surface).unwrap_or(false)
&& p.surface_support(QueueFamilyIndex(i as u32), &surface)
.unwrap_or(false)
})
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.filter(|(p, _)| p.properties().driver_uuid.unwrap() == display.driver_uuid().unwrap())
.filter(|(p, _)| {
Expand Down
7 changes: 4 additions & 3 deletions examples/image-self-copy-blit/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
format::Format,
image::{
Expand Down Expand Up @@ -84,9 +84,10 @@ fn main() -> Result<(), impl Error> {
.enumerate()
.position(|(i, q)| {
q.queue_flags.intersects(QueueFlags::GRAPHICS)
&& p.surface_support(i as u32, &surface).unwrap_or(false)
&& p.surface_support(QueueFamilyIndex(i as u32), &surface)
.unwrap_or(false)
})
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
7 changes: 4 additions & 3 deletions examples/image/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
format::Format,
image::{
Expand Down Expand Up @@ -82,9 +82,10 @@ fn main() -> Result<(), impl Error> {
.enumerate()
.position(|(i, q)| {
q.queue_flags.intersects(QueueFlags::GRAPHICS)
&& p.surface_support(i as u32, &surface).unwrap_or(false)
&& p.surface_support(QueueFamilyIndex(i as u32), &surface)
.unwrap_or(false)
})
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
7 changes: 4 additions & 3 deletions examples/immutable-sampler/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
format::Format,
image::{
Expand Down Expand Up @@ -88,9 +88,10 @@ fn main() -> Result<(), impl Error> {
.enumerate()
.position(|(i, q)| {
q.queue_flags.intersects(QueueFlags::GRAPHICS)
&& p.surface_support(i as u32, &surface).unwrap_or(false)
&& p.surface_support(QueueFamilyIndex(i as u32), &surface)
.unwrap_or(false)
})
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
7 changes: 4 additions & 3 deletions examples/indirect/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
image::{view::ImageView, Image, ImageUsage},
instance::{Instance, InstanceCreateFlags, InstanceCreateInfo},
Expand Down Expand Up @@ -96,9 +96,10 @@ fn main() -> Result<(), impl Error> {
.enumerate()
.position(|(i, q)| {
q.queue_flags.intersects(QueueFlags::GRAPHICS)
&& p.surface_support(i as u32, &surface).unwrap_or(false)
&& p.surface_support(QueueFamilyIndex(i as u32), &surface)
.unwrap_or(false)
})
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
7 changes: 4 additions & 3 deletions examples/instancing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
image::{view::ImageView, Image, ImageUsage},
instance::{Instance, InstanceCreateFlags, InstanceCreateInfo},
Expand Down Expand Up @@ -94,9 +94,10 @@ fn main() -> Result<(), impl Error> {
.enumerate()
.position(|(i, q)| {
q.queue_flags.intersects(QueueFlags::GRAPHICS)
&& p.surface_support(i as u32, &surface).unwrap_or(false)
&& p.surface_support(QueueFamilyIndex(i as u32), &surface)
.unwrap_or(false)
})
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
7 changes: 4 additions & 3 deletions examples/mesh-shader/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, DeviceFeatures,
QueueCreateInfo, QueueFlags,
QueueCreateInfo, QueueFamilyIndex, QueueFlags,
},
image::{view::ImageView, Image, ImageUsage},
instance::{Instance, InstanceCreateFlags, InstanceCreateInfo},
Expand Down Expand Up @@ -115,9 +115,10 @@ fn main() -> Result<(), impl Error> {
.enumerate()
.position(|(i, q)| {
q.queue_flags.intersects(QueueFlags::GRAPHICS)
&& p.surface_support(i as u32, &surface).unwrap_or(false)
&& p.surface_support(QueueFamilyIndex(i as u32), &surface)
.unwrap_or(false)
})
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
4 changes: 2 additions & 2 deletions examples/msaa-renderpass/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
format::Format,
image::{view::ImageView, Image, ImageCreateInfo, ImageType, ImageUsage, SampleCount},
Expand Down Expand Up @@ -109,7 +109,7 @@ fn main() {
p.queue_family_properties()
.iter()
.position(|q| q.queue_flags.intersects(QueueFlags::GRAPHICS))
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
7 changes: 4 additions & 3 deletions examples/multi-window/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use vulkano::{
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
QueueFlags,
QueueFamilyIndex, QueueFlags,
},
image::{view::ImageView, Image, ImageUsage},
instance::{Instance, InstanceCreateFlags, InstanceCreateInfo},
Expand Down Expand Up @@ -99,9 +99,10 @@ fn main() -> Result<(), impl Error> {
.enumerate()
.position(|(i, q)| {
q.queue_flags.intersects(QueueFlags::GRAPHICS)
&& p.surface_support(i as u32, &surface).unwrap_or(false)
&& p.surface_support(QueueFamilyIndex(i as u32), &surface)
.unwrap_or(false)
})
.map(|i| (p, i as u32))
.map(|i| (p, QueueFamilyIndex(i as u32)))
})
.min_by_key(|(p, _)| match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
Expand Down
Loading
Loading