mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-21 22:34:43 +00:00
Move instance/physical_device.rs to device/physical.rs, rewrite and refactor some parts of it (#1617)
* Move instance/physical_device.rs to device/physical.rs, rewrite some of it * Deprecate supported_by_device_raw as well
This commit is contained in:
parent
80bb82e487
commit
e5bd8807e4
@ -17,8 +17,9 @@ use std::sync::Arc;
|
||||
use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
|
||||
use vulkano::command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage};
|
||||
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::{Instance, InstanceExtensions};
|
||||
use vulkano::pipeline::ComputePipeline;
|
||||
use vulkano::pipeline::ComputePipelineAbstract;
|
||||
use vulkano::sync;
|
||||
@ -35,10 +36,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
// The Vulkan specs guarantee that a compliant implementation must provide at least one queue
|
||||
// that supports compute operations.
|
||||
@ -65,7 +63,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -25,10 +25,11 @@ use vulkano::buffer::CpuBufferPool;
|
||||
use vulkano::command_buffer::{
|
||||
AutoCommandBufferBuilder, CommandBufferUsage, DynamicState, SubpassContents,
|
||||
};
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::image::view::ImageView;
|
||||
use vulkano::image::{ImageUsage, SwapchainImage};
|
||||
use vulkano::instance::{Instance, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::Instance;
|
||||
use vulkano::pipeline::viewport::Viewport;
|
||||
use vulkano::pipeline::GraphicsPipeline;
|
||||
use vulkano::render_pass::{Framebuffer, FramebufferAbstract, RenderPass, Subpass};
|
||||
@ -62,10 +63,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
@ -89,7 +87,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -7,6 +7,7 @@
|
||||
// notice may not be copied, modified, or distributed except
|
||||
// according to those terms.
|
||||
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::format::Format;
|
||||
use vulkano::image::ImageDimensions;
|
||||
@ -14,7 +15,7 @@ use vulkano::image::ImmutableImage;
|
||||
use vulkano::image::MipmapsCount;
|
||||
use vulkano::instance;
|
||||
use vulkano::instance::debug::{DebugCallback, MessageSeverity, MessageType};
|
||||
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::{Instance, InstanceExtensions};
|
||||
use vulkano::Version;
|
||||
|
||||
fn main() {
|
||||
@ -116,10 +117,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
Some(
|
||||
p.queue_families()
|
||||
@ -140,7 +138,9 @@ fn main() {
|
||||
let (_, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
vec![(queue_family, 0.5)],
|
||||
)
|
||||
.expect("failed to create device");
|
||||
|
@ -30,10 +30,11 @@ use crate::triangle_draw_system::*;
|
||||
use cgmath::Matrix4;
|
||||
use cgmath::SquareMatrix;
|
||||
use cgmath::Vector3;
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::image::view::ImageView;
|
||||
use vulkano::image::ImageUsage;
|
||||
use vulkano::instance::{Instance, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::Instance;
|
||||
use vulkano::swapchain;
|
||||
use vulkano::swapchain::{AcquireError, Swapchain, SwapchainCreationError};
|
||||
use vulkano::sync;
|
||||
@ -63,10 +64,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
@ -90,7 +88,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -19,8 +19,9 @@ use std::sync::Arc;
|
||||
use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
|
||||
use vulkano::command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage};
|
||||
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::{Instance, InstanceExtensions};
|
||||
use vulkano::pipeline::layout::PipelineLayout;
|
||||
use vulkano::pipeline::shader::EntryPointAbstract;
|
||||
use vulkano::pipeline::ComputePipeline;
|
||||
@ -37,10 +38,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
@ -64,7 +62,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -21,10 +21,11 @@ use std::sync::Arc;
|
||||
use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
|
||||
use vulkano::command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage};
|
||||
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::format::Format;
|
||||
use vulkano::image::{view::ImageView, ImageDimensions, StorageImage};
|
||||
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::{Instance, InstanceExtensions};
|
||||
use vulkano::pipeline::ComputePipeline;
|
||||
use vulkano::pipeline::ComputePipelineAbstract;
|
||||
use vulkano::sync;
|
||||
@ -50,10 +51,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
@ -77,7 +75,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -15,12 +15,13 @@ use vulkano::command_buffer::{
|
||||
AutoCommandBufferBuilder, CommandBufferUsage, DynamicState, SubpassContents,
|
||||
};
|
||||
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::format::Format;
|
||||
use vulkano::image::{
|
||||
view::ImageView, ImageDimensions, ImageUsage, ImmutableImage, MipmapsCount, SwapchainImage,
|
||||
};
|
||||
use vulkano::instance::{Instance, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::Instance;
|
||||
use vulkano::pipeline::viewport::Viewport;
|
||||
use vulkano::pipeline::GraphicsPipeline;
|
||||
use vulkano::pipeline::GraphicsPipelineAbstract;
|
||||
@ -53,10 +54,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
@ -80,7 +78,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -13,8 +13,9 @@ use std::sync::Arc;
|
||||
use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer, ImmutableBuffer};
|
||||
use vulkano::command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage};
|
||||
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::{Instance, InstanceExtensions};
|
||||
use vulkano::pipeline::ComputePipeline;
|
||||
use vulkano::pipeline::ComputePipelineAbstract;
|
||||
use vulkano::sync;
|
||||
@ -32,10 +33,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
@ -59,7 +57,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -38,10 +38,11 @@ use vulkano::command_buffer::{
|
||||
SubpassContents,
|
||||
};
|
||||
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::image::view::ImageView;
|
||||
use vulkano::image::{ImageUsage, SwapchainImage};
|
||||
use vulkano::instance::{Instance, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::Instance;
|
||||
use vulkano::pipeline::viewport::Viewport;
|
||||
use vulkano::pipeline::{ComputePipeline, ComputePipelineAbstract, GraphicsPipeline};
|
||||
use vulkano::render_pass::{Framebuffer, FramebufferAbstract, RenderPass, Subpass};
|
||||
@ -78,10 +79,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
@ -105,7 +103,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -23,10 +23,11 @@ use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
|
||||
use vulkano::command_buffer::{
|
||||
AutoCommandBufferBuilder, CommandBufferUsage, DynamicState, SubpassContents,
|
||||
};
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::image::view::ImageView;
|
||||
use vulkano::image::{ImageUsage, SwapchainImage};
|
||||
use vulkano::instance::{Instance, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::Instance;
|
||||
use vulkano::pipeline::vertex::OneVertexOneInstanceDefinition;
|
||||
use vulkano::pipeline::viewport::Viewport;
|
||||
use vulkano::pipeline::GraphicsPipeline;
|
||||
@ -75,10 +76,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
@ -102,7 +100,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -74,13 +74,14 @@ use vulkano::command_buffer::{
|
||||
AutoCommandBufferBuilder, CommandBufferUsage, DynamicState, PrimaryCommandBuffer,
|
||||
SubpassContents,
|
||||
};
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::format::ClearValue;
|
||||
use vulkano::format::Format;
|
||||
use vulkano::image::{
|
||||
view::ImageView, AttachmentImage, ImageDimensions, SampleCount, StorageImage,
|
||||
};
|
||||
use vulkano::instance::{Instance, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::Instance;
|
||||
use vulkano::pipeline::viewport::Viewport;
|
||||
use vulkano::pipeline::GraphicsPipeline;
|
||||
use vulkano::render_pass::{Framebuffer, Subpass};
|
||||
@ -97,10 +98,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics())
|
||||
@ -124,7 +122,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -22,10 +22,11 @@ use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
|
||||
use vulkano::command_buffer::{
|
||||
AutoCommandBufferBuilder, CommandBufferUsage, DynamicState, SubpassContents,
|
||||
};
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::image::view::ImageView;
|
||||
use vulkano::image::{ImageUsage, SwapchainImage};
|
||||
use vulkano::instance::{Instance, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::Instance;
|
||||
use vulkano::pipeline::viewport::Viewport;
|
||||
use vulkano::pipeline::GraphicsPipeline;
|
||||
use vulkano::render_pass::{Framebuffer, FramebufferAbstract, RenderPass, Subpass};
|
||||
@ -75,8 +76,7 @@ fn main() {
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
p.supported_extensions().intersection(&device_extensions) == device_extensions
|
||||
})
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
@ -101,7 +101,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -23,6 +23,7 @@ use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
|
||||
use vulkano::command_buffer::{
|
||||
AutoCommandBufferBuilder, CommandBufferUsage, DynamicState, SubpassContents,
|
||||
};
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::format::Format;
|
||||
use vulkano::image::view::ImageView;
|
||||
@ -30,8 +31,7 @@ use vulkano::image::{
|
||||
ImageAccess, ImageCreateFlags, ImageDimensions, ImageLayout, ImageUsage, SampleCount,
|
||||
StorageImage,
|
||||
};
|
||||
use vulkano::instance::PhysicalDevice;
|
||||
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDeviceType};
|
||||
use vulkano::instance::{Instance, InstanceExtensions};
|
||||
use vulkano::pipeline::viewport::Viewport;
|
||||
use vulkano::pipeline::GraphicsPipeline;
|
||||
use vulkano::render_pass::{
|
||||
@ -65,8 +65,7 @@ fn main() {
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
p.supported_extensions().intersection(&device_extensions) == device_extensions
|
||||
})
|
||||
.filter(|&p| {
|
||||
p.supported_features().superset_of(&features)
|
||||
@ -105,7 +104,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&features,
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -16,10 +16,11 @@ use vulkano::buffer::{BufferAccess, BufferUsage, CpuAccessibleBuffer};
|
||||
use vulkano::command_buffer::{
|
||||
AutoCommandBufferBuilder, CommandBufferUsage, DynamicState, SubpassContents,
|
||||
};
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, DeviceOwned, Features};
|
||||
use vulkano::format::Format;
|
||||
use vulkano::image::{view::ImageView, AttachmentImage, ImageUsage, SwapchainImage};
|
||||
use vulkano::instance::{Instance, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::Instance;
|
||||
use vulkano::pipeline::viewport::Viewport;
|
||||
use vulkano::pipeline::GraphicsPipeline;
|
||||
use vulkano::query::{QueryControlFlags, QueryPool, QueryResultFlags, QueryType};
|
||||
@ -48,10 +49,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
@ -75,7 +73,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -32,8 +32,9 @@ use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::io::Write;
|
||||
use std::sync::Arc;
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::{Instance, InstanceExtensions};
|
||||
use vulkano::pipeline::cache::PipelineCache;
|
||||
use vulkano::pipeline::ComputePipeline;
|
||||
use vulkano::Version;
|
||||
@ -48,10 +49,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
@ -76,7 +74,9 @@ fn main() {
|
||||
let (device, _) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -13,8 +13,9 @@ use std::sync::Arc;
|
||||
use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
|
||||
use vulkano::command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage};
|
||||
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::{Instance, InstanceExtensions};
|
||||
use vulkano::pipeline::{ComputePipeline, ComputePipelineAbstract};
|
||||
use vulkano::sync;
|
||||
use vulkano::sync::GpuFuture;
|
||||
@ -28,10 +29,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
@ -55,7 +53,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -29,11 +29,12 @@ use vulkano::buffer::BufferUsage;
|
||||
use vulkano::command_buffer::{
|
||||
AutoCommandBufferBuilder, CommandBufferUsage, DynamicState, SubpassContents,
|
||||
};
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::format::Format;
|
||||
use vulkano::image::view::ImageView;
|
||||
use vulkano::image::{ImageUsage, SwapchainImage};
|
||||
use vulkano::instance::{Instance, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::Instance;
|
||||
use vulkano::pipeline::layout::PipelineLayoutDesc;
|
||||
use vulkano::pipeline::shader::{
|
||||
GraphicsShaderType, ShaderInterface, ShaderInterfaceEntry, ShaderModule,
|
||||
@ -75,10 +76,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
@ -102,7 +100,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -15,8 +15,9 @@ use std::sync::Arc;
|
||||
use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
|
||||
use vulkano::command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage};
|
||||
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::{Instance, InstanceExtensions};
|
||||
use vulkano::pipeline::{ComputePipeline, ComputePipelineAbstract};
|
||||
use vulkano::sync;
|
||||
use vulkano::sync::GpuFuture;
|
||||
@ -24,16 +25,12 @@ use vulkano::Version;
|
||||
|
||||
fn main() {
|
||||
let instance = Instance::new(None, Version::V1_1, &InstanceExtensions::none(), None).unwrap();
|
||||
|
||||
let device_extensions = DeviceExtensions {
|
||||
khr_storage_buffer_storage_class: true,
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
@ -57,7 +54,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -13,8 +13,9 @@ use std::sync::Arc;
|
||||
use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
|
||||
use vulkano::command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage};
|
||||
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::{Instance, InstanceExtensions};
|
||||
use vulkano::pipeline::{ComputePipeline, ComputePipelineAbstract};
|
||||
use vulkano::sync;
|
||||
use vulkano::sync::GpuFuture;
|
||||
@ -28,10 +29,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
@ -55,7 +53,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -18,12 +18,13 @@ use vulkano::command_buffer::{
|
||||
AutoCommandBufferBuilder, CommandBufferUsage, DynamicState, SubpassContents,
|
||||
};
|
||||
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::format::Format;
|
||||
use vulkano::image::attachment::AttachmentImage;
|
||||
use vulkano::image::view::ImageView;
|
||||
use vulkano::image::{ImageUsage, SwapchainImage};
|
||||
use vulkano::instance::{Instance, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::Instance;
|
||||
use vulkano::pipeline::vertex::TwoBuffersDefinition;
|
||||
use vulkano::pipeline::viewport::Viewport;
|
||||
use vulkano::pipeline::{GraphicsPipeline, GraphicsPipelineAbstract};
|
||||
@ -55,10 +56,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
@ -82,7 +80,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&Features::none(),
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -23,10 +23,11 @@ use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
|
||||
use vulkano::command_buffer::{
|
||||
AutoCommandBufferBuilder, CommandBufferUsage, DynamicState, SubpassContents,
|
||||
};
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::image::view::ImageView;
|
||||
use vulkano::image::{ImageUsage, SwapchainImage};
|
||||
use vulkano::instance::{Instance, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::Instance;
|
||||
use vulkano::pipeline::viewport::Viewport;
|
||||
use vulkano::pipeline::GraphicsPipeline;
|
||||
use vulkano::render_pass::{Framebuffer, FramebufferAbstract, RenderPass, Subpass};
|
||||
@ -154,10 +155,7 @@ fn main() {
|
||||
..Features::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_features().superset_of(&features))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
@ -182,7 +180,9 @@ fn main() {
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
&features,
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -21,10 +21,11 @@ use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
|
||||
use vulkano::command_buffer::{
|
||||
AutoCommandBufferBuilder, CommandBufferUsage, DynamicState, SubpassContents,
|
||||
};
|
||||
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::device::{Device, DeviceExtensions, Features};
|
||||
use vulkano::image::view::ImageView;
|
||||
use vulkano::image::{ImageUsage, SwapchainImage};
|
||||
use vulkano::instance::{Instance, PhysicalDevice, PhysicalDeviceType};
|
||||
use vulkano::instance::Instance;
|
||||
use vulkano::pipeline::viewport::Viewport;
|
||||
use vulkano::pipeline::GraphicsPipeline;
|
||||
use vulkano::render_pass::{Framebuffer, FramebufferAbstract, RenderPass, Subpass};
|
||||
@ -81,8 +82,7 @@ fn main() {
|
||||
// Some devices may not support the extensions or features that your application, or
|
||||
// report properties and limits that are not sufficient for your application. These
|
||||
// should be filtered out here.
|
||||
DeviceExtensions::supported_by_device(p).intersection(&device_extensions)
|
||||
== device_extensions
|
||||
p.supported_extensions().intersection(&device_extensions) == device_extensions
|
||||
})
|
||||
.filter_map(|p| {
|
||||
// For each physical device, we try to find a suitable queue family that will execute
|
||||
@ -159,7 +159,9 @@ fn main() {
|
||||
// Some devices require certain extensions to be enabled if they are present
|
||||
// (e.g. `khr_portability_subset`). We add them to the device extensions that we're going to
|
||||
// enable.
|
||||
&DeviceExtensions::required_extensions(physical_device).union(&device_extensions),
|
||||
&physical_device
|
||||
.required_extensions()
|
||||
.union(&device_extensions),
|
||||
[(queue_family, 0.5)].iter().cloned(),
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -233,7 +233,7 @@ where
|
||||
(1, 4) => {
|
||||
cap_checks.push(quote! {
|
||||
if device.api_version() < Version::V1_2
|
||||
&& !device.loaded_extensions().khr_spirv_1_4 {
|
||||
&& !device.enabled_extensions().khr_spirv_1_4 {
|
||||
panic!("Device API version 1.2 or extension VK_KHR_spirv_1_4 required");
|
||||
}
|
||||
});
|
||||
@ -283,7 +283,7 @@ where
|
||||
for extension in extensions {
|
||||
let ident = Ident::new(extension, Span::call_site());
|
||||
cap_checks.push(quote! {
|
||||
if !device.loaded_extensions().#ident {
|
||||
if !device.enabled_extensions().#ident {
|
||||
panic!("Device extension {:?} required", #extension);
|
||||
}
|
||||
});
|
||||
|
@ -151,7 +151,7 @@ unsafe fn winit_to_surface<W: SafeBorrow<Window>>(
|
||||
_ => {
|
||||
// No wayland display found, check if we can use xlib.
|
||||
// If not, we use xcb.
|
||||
if instance.loaded_extensions().khr_xlib_surface {
|
||||
if instance.enabled_extensions().khr_xlib_surface {
|
||||
Surface::from_xlib(
|
||||
instance,
|
||||
win.borrow().xlib_display().unwrap(),
|
||||
|
@ -328,21 +328,21 @@ fn vulkano_type(ty: &str, len: Option<&str>) -> &'static str {
|
||||
"uint32_t" => "u32",
|
||||
"uint64_t" => "u64",
|
||||
"VkBool32" => "bool",
|
||||
"VkConformanceVersion" => "crate::instance::ConformanceVersion",
|
||||
"VkConformanceVersion" => "crate::device::physical::ConformanceVersion",
|
||||
"VkDeviceSize" => "u64",
|
||||
"VkDriverId" => "crate::instance::DriverId",
|
||||
"VkDriverId" => "crate::device::physical::DriverId",
|
||||
"VkExtent2D" => "[u32; 2]",
|
||||
"VkPhysicalDeviceType" => "crate::instance::PhysicalDeviceType",
|
||||
"VkPointClippingBehavior" => "crate::instance::PointClippingBehavior",
|
||||
"VkPhysicalDeviceType" => "crate::device::physical::PhysicalDeviceType",
|
||||
"VkPointClippingBehavior" => "crate::device::physical::PointClippingBehavior",
|
||||
"VkResolveModeFlags" => "crate::render_pass::ResolveModes",
|
||||
"VkSampleCountFlags" => "crate::image::SampleCounts",
|
||||
"VkSampleCountFlagBits" => "crate::image::SampleCount",
|
||||
"VkShaderCorePropertiesFlagsAMD" => "crate::instance::ShaderCoreProperties",
|
||||
"VkShaderCorePropertiesFlagsAMD" => "crate::device::physical::ShaderCoreProperties",
|
||||
"VkShaderFloatControlsIndependence" => {
|
||||
"crate::instance::ShaderFloatControlsIndependence"
|
||||
"crate::device::physical::ShaderFloatControlsIndependence"
|
||||
}
|
||||
"VkShaderStageFlags" => "crate::descriptor::descriptor::ShaderStages",
|
||||
"VkSubgroupFeatureFlags" => "crate::instance::SubgroupFeatures",
|
||||
"VkSubgroupFeatureFlags" => "crate::device::physical::SubgroupFeatures",
|
||||
_ => unimplemented!("{}", ty),
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ use crate::buffer::traits::BufferAccess;
|
||||
use crate::buffer::traits::BufferInner;
|
||||
use crate::buffer::traits::TypedBufferAccess;
|
||||
use crate::buffer::BufferUsage;
|
||||
use crate::device::physical::QueueFamily;
|
||||
use crate::device::Device;
|
||||
use crate::device::DeviceOwned;
|
||||
use crate::device::Queue;
|
||||
use crate::image::ImageAccess;
|
||||
use crate::instance::QueueFamily;
|
||||
use crate::memory::pool::AllocFromRequirementsFilter;
|
||||
use crate::memory::pool::AllocLayout;
|
||||
use crate::memory::pool::MappingRequirement;
|
||||
|
@ -19,11 +19,11 @@ use crate::buffer::traits::BufferAccess;
|
||||
use crate::buffer::traits::BufferInner;
|
||||
use crate::buffer::traits::TypedBufferAccess;
|
||||
use crate::buffer::BufferUsage;
|
||||
use crate::device::physical::QueueFamily;
|
||||
use crate::device::Device;
|
||||
use crate::device::DeviceOwned;
|
||||
use crate::device::Queue;
|
||||
use crate::image::ImageAccess;
|
||||
use crate::instance::QueueFamily;
|
||||
use crate::memory::pool::AllocFromRequirementsFilter;
|
||||
use crate::memory::pool::AllocLayout;
|
||||
use crate::memory::pool::MappingRequirement;
|
||||
@ -170,8 +170,8 @@ impl<T: ?Sized> DeviceLocalBuffer<T> {
|
||||
where
|
||||
I: IntoIterator<Item = QueueFamily<'a>>,
|
||||
{
|
||||
assert!(device.loaded_extensions().khr_external_memory_fd);
|
||||
assert!(device.loaded_extensions().khr_external_memory);
|
||||
assert!(device.enabled_extensions().khr_external_memory_fd);
|
||||
assert!(device.enabled_extensions().khr_external_memory);
|
||||
|
||||
let queue_families = queue_families
|
||||
.into_iter()
|
||||
|
@ -30,11 +30,11 @@ use crate::command_buffer::CommandBufferExecFuture;
|
||||
use crate::command_buffer::CommandBufferUsage;
|
||||
use crate::command_buffer::PrimaryAutoCommandBuffer;
|
||||
use crate::command_buffer::PrimaryCommandBuffer;
|
||||
use crate::device::physical::QueueFamily;
|
||||
use crate::device::Device;
|
||||
use crate::device::DeviceOwned;
|
||||
use crate::device::Queue;
|
||||
use crate::image::ImageAccess;
|
||||
use crate::instance::QueueFamily;
|
||||
use crate::memory::pool::AllocFromRequirementsFilter;
|
||||
use crate::memory::pool::AllocLayout;
|
||||
use crate::memory::pool::MappingRequirement;
|
||||
|
@ -155,14 +155,14 @@ impl UnsafeBuffer {
|
||||
}
|
||||
|
||||
let mut output = if device.api_version() >= Version::V1_1
|
||||
|| device.loaded_extensions().khr_get_memory_requirements2
|
||||
|| device.enabled_extensions().khr_get_memory_requirements2
|
||||
{
|
||||
let infos = ash::vk::BufferMemoryRequirementsInfo2 {
|
||||
buffer: buffer,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let mut output2 = if device.loaded_extensions().khr_dedicated_allocation {
|
||||
let mut output2 = if device.enabled_extensions().khr_dedicated_allocation {
|
||||
Some(ash::vk::MemoryDedicatedRequirementsKHR::default())
|
||||
} else {
|
||||
None
|
||||
|
@ -39,6 +39,7 @@ use crate::command_buffer::StateCacherOutcome;
|
||||
use crate::command_buffer::SubpassContents;
|
||||
use crate::descriptor::descriptor::{DescriptorBufferDesc, DescriptorDescTy};
|
||||
use crate::descriptor::descriptor_set::{DescriptorSetDesc, DescriptorSetsCollection};
|
||||
use crate::device::physical::QueueFamily;
|
||||
use crate::device::Device;
|
||||
use crate::device::DeviceOwned;
|
||||
use crate::device::Queue;
|
||||
@ -49,7 +50,6 @@ use crate::image::ImageAccess;
|
||||
use crate::image::ImageAspect;
|
||||
use crate::image::ImageAspects;
|
||||
use crate::image::ImageLayout;
|
||||
use crate::instance::QueueFamily;
|
||||
use crate::pipeline::input_assembly::Index;
|
||||
use crate::pipeline::layout::PipelineLayout;
|
||||
use crate::pipeline::vertex::VertexSource;
|
||||
@ -2796,10 +2796,10 @@ mod tests {
|
||||
use crate::command_buffer::CommandBufferUsage;
|
||||
use crate::command_buffer::ExecuteCommandsError;
|
||||
use crate::command_buffer::PrimaryCommandBuffer;
|
||||
use crate::device::physical::PhysicalDevice;
|
||||
use crate::device::Device;
|
||||
use crate::device::DeviceExtensions;
|
||||
use crate::device::Features;
|
||||
use crate::instance;
|
||||
use crate::sync::GpuFuture;
|
||||
use std::sync::Arc;
|
||||
|
||||
@ -2807,7 +2807,7 @@ mod tests {
|
||||
fn copy_buffer_dimensions() {
|
||||
let instance = instance!();
|
||||
|
||||
let phys = match instance::PhysicalDevice::enumerate(&instance).next() {
|
||||
let phys = match PhysicalDevice::enumerate(&instance).next() {
|
||||
Some(p) => p,
|
||||
None => return,
|
||||
};
|
||||
|
@ -16,7 +16,7 @@
|
||||
//! trait. By default vulkano will use the `StandardCommandPool` struct, but you can implement
|
||||
//! this trait yourself by wrapping around the `UnsafeCommandPool` type.
|
||||
|
||||
use crate::instance::QueueFamily;
|
||||
use crate::device::physical::QueueFamily;
|
||||
|
||||
use crate::device::DeviceOwned;
|
||||
use crate::OomError;
|
||||
|
@ -23,7 +23,7 @@ use crate::command_buffer::pool::CommandPoolAlloc;
|
||||
use crate::command_buffer::pool::CommandPoolBuilderAlloc;
|
||||
use crate::command_buffer::pool::UnsafeCommandPool;
|
||||
use crate::command_buffer::pool::UnsafeCommandPoolAlloc;
|
||||
use crate::instance::QueueFamily;
|
||||
use crate::device::physical::QueueFamily;
|
||||
|
||||
use crate::device::Device;
|
||||
use crate::device::DeviceOwned;
|
||||
|
@ -8,9 +8,9 @@
|
||||
// according to those terms.
|
||||
|
||||
use crate::check_errors;
|
||||
use crate::device::physical::QueueFamily;
|
||||
use crate::device::Device;
|
||||
use crate::device::DeviceOwned;
|
||||
use crate::instance::QueueFamily;
|
||||
use crate::Error;
|
||||
use crate::OomError;
|
||||
use crate::Version;
|
||||
@ -149,7 +149,7 @@ impl UnsafeCommandPool {
|
||||
pub fn trim(&self) -> Result<(), CommandPoolTrimError> {
|
||||
unsafe {
|
||||
if !(self.device.api_version() >= Version::V1_1
|
||||
|| self.device.loaded_extensions().khr_maintenance1)
|
||||
|| self.device.enabled_extensions().khr_maintenance1)
|
||||
{
|
||||
return Err(CommandPoolTrimError::Maintenance1ExtensionNotEnabled);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ impl<'a> SubmitPresentBuilder<'a> {
|
||||
|
||||
if swapchain
|
||||
.device()
|
||||
.loaded_extensions()
|
||||
.enabled_extensions()
|
||||
.khr_incremental_present
|
||||
{
|
||||
let vk_present_region = match present_region {
|
||||
@ -141,7 +141,7 @@ impl<'a> SubmitPresentBuilder<'a> {
|
||||
|
||||
let present_regions = {
|
||||
if !self.present_regions.is_empty() {
|
||||
debug_assert!(queue.device().loaded_extensions().khr_incremental_present);
|
||||
debug_assert!(queue.device().enabled_extensions().khr_incremental_present);
|
||||
debug_assert_eq!(self.swapchains.len(), self.present_regions.len());
|
||||
let mut current_index = 0;
|
||||
for present_region in &mut self.present_regions {
|
||||
|
@ -8,9 +8,9 @@
|
||||
// according to those terms.
|
||||
|
||||
use crate::buffer::TypedBufferAccess;
|
||||
use crate::device::physical::QueueFamily;
|
||||
use crate::device::Device;
|
||||
use crate::device::DeviceOwned;
|
||||
use crate::instance::QueueFamily;
|
||||
use crate::query::GetResultsError;
|
||||
use crate::query::QueryControlFlags;
|
||||
use crate::query::QueryPool;
|
||||
|
@ -7,14 +7,10 @@
|
||||
// notice may not be copied, modified, or distributed except
|
||||
// according to those terms.
|
||||
|
||||
use crate::check_errors;
|
||||
use crate::device::physical::PhysicalDevice;
|
||||
pub use crate::extensions::{
|
||||
ExtensionRestriction, ExtensionRestrictionError, SupportedExtensionsError,
|
||||
};
|
||||
use crate::instance::PhysicalDevice;
|
||||
use crate::VulkanObject;
|
||||
use std::ffi::CStr;
|
||||
use std::ptr;
|
||||
|
||||
macro_rules! device_extensions {
|
||||
(
|
||||
@ -118,52 +114,33 @@ pub(crate) use device_extensions;
|
||||
|
||||
impl DeviceExtensions {
|
||||
/// See the docs of supported_by_device().
|
||||
#[deprecated(
|
||||
since = "0.25",
|
||||
note = "Use PhysicalDevice::supported_extensions instead"
|
||||
)]
|
||||
pub fn supported_by_device_raw(
|
||||
physical_device: PhysicalDevice,
|
||||
) -> Result<Self, SupportedExtensionsError> {
|
||||
let fns = physical_device.instance().fns();
|
||||
|
||||
let properties: Vec<ash::vk::ExtensionProperties> = unsafe {
|
||||
let mut num = 0;
|
||||
check_errors(fns.v1_0.enumerate_device_extension_properties(
|
||||
physical_device.internal_object(),
|
||||
ptr::null(),
|
||||
&mut num,
|
||||
ptr::null_mut(),
|
||||
))?;
|
||||
|
||||
let mut properties = Vec::with_capacity(num as usize);
|
||||
check_errors(fns.v1_0.enumerate_device_extension_properties(
|
||||
physical_device.internal_object(),
|
||||
ptr::null(),
|
||||
&mut num,
|
||||
properties.as_mut_ptr(),
|
||||
))?;
|
||||
properties.set_len(num as usize);
|
||||
properties
|
||||
};
|
||||
|
||||
Ok(Self::from(properties.iter().map(|property| unsafe {
|
||||
CStr::from_ptr(property.extension_name.as_ptr())
|
||||
})))
|
||||
Ok(*physical_device.supported_extensions())
|
||||
}
|
||||
|
||||
/// Returns a `DeviceExtensions` object with extensions supported by the `PhysicalDevice`.
|
||||
#[deprecated(
|
||||
since = "0.25",
|
||||
note = "Use PhysicalDevice::supported_extensions instead"
|
||||
)]
|
||||
pub fn supported_by_device(physical_device: PhysicalDevice) -> Self {
|
||||
match DeviceExtensions::supported_by_device_raw(physical_device) {
|
||||
Ok(l) => l,
|
||||
Err(SupportedExtensionsError::LoadingError(_)) => unreachable!(),
|
||||
Err(SupportedExtensionsError::OomError(e)) => panic!("{:?}", e),
|
||||
}
|
||||
*physical_device.supported_extensions()
|
||||
}
|
||||
|
||||
/// Returns a `DeviceExtensions` object with extensions required as well as supported by the `PhysicalDevice`.
|
||||
/// They are needed to be passed to `Device::new(...)`.
|
||||
#[deprecated(
|
||||
since = "0.25",
|
||||
note = "Use PhysicalDevice::required_extensions instead"
|
||||
)]
|
||||
pub fn required_extensions(physical_device: PhysicalDevice) -> Self {
|
||||
let supported = Self::supported_by_device(physical_device);
|
||||
let required_if_supported = Self::required_if_supported_extensions();
|
||||
|
||||
required_if_supported.intersection(&supported)
|
||||
*physical_device.required_extensions()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ macro_rules! features {
|
||||
///
|
||||
/// ```
|
||||
/// use vulkano::device::Features;
|
||||
/// # let physical_device: vulkano::instance::PhysicalDevice = return;
|
||||
/// # let physical_device: vulkano::device::physical::PhysicalDevice = return;
|
||||
/// let minimal_features = Features {
|
||||
/// geometry_shader: true,
|
||||
/// .. Features::none()
|
||||
|
@ -20,7 +20,7 @@
|
||||
//! use vulkano::device::Features;
|
||||
//! use vulkano::instance::Instance;
|
||||
//! use vulkano::instance::InstanceExtensions;
|
||||
//! use vulkano::instance::PhysicalDevice;
|
||||
//! use vulkano::device::physical::PhysicalDevice;
|
||||
//! use vulkano::Version;
|
||||
//!
|
||||
//! // Creating the instance. See the documentation of the `instance` module.
|
||||
@ -98,6 +98,8 @@ pub use crate::autogen::DeviceExtensions;
|
||||
use crate::check_errors;
|
||||
use crate::command_buffer::pool::StandardCommandPool;
|
||||
use crate::descriptor::descriptor_set::StdDescriptorPool;
|
||||
use crate::device::physical::PhysicalDevice;
|
||||
use crate::device::physical::QueueFamily;
|
||||
pub use crate::extensions::{
|
||||
ExtensionRestriction, ExtensionRestrictionError, SupportedExtensionsError,
|
||||
};
|
||||
@ -109,8 +111,6 @@ use crate::image::ImageTiling;
|
||||
use crate::image::ImageType;
|
||||
use crate::image::ImageUsage;
|
||||
use crate::instance::Instance;
|
||||
use crate::instance::PhysicalDevice;
|
||||
use crate::instance::QueueFamily;
|
||||
use crate::memory::pool::StdMemoryPool;
|
||||
use crate::Error;
|
||||
use crate::OomError;
|
||||
@ -140,6 +140,7 @@ use std::sync::Weak;
|
||||
|
||||
pub(crate) mod extensions;
|
||||
pub(crate) mod features;
|
||||
pub mod physical;
|
||||
pub(crate) mod properties;
|
||||
|
||||
/// Represents a Vulkan context.
|
||||
@ -207,9 +208,9 @@ impl Device {
|
||||
|
||||
// Check if the extensions are correct
|
||||
requested_extensions.check_requirements(
|
||||
&DeviceExtensions::supported_by_device(physical_device),
|
||||
physical_device.supported_extensions(),
|
||||
api_version,
|
||||
instance.loaded_extensions(),
|
||||
instance.enabled_extensions(),
|
||||
)?;
|
||||
|
||||
let mut requested_features = requested_features.clone();
|
||||
@ -290,7 +291,7 @@ impl Device {
|
||||
features_ffi.make_chain(
|
||||
api_version,
|
||||
requested_extensions,
|
||||
instance.loaded_extensions(),
|
||||
instance.enabled_extensions(),
|
||||
);
|
||||
features_ffi.write(&requested_features);
|
||||
|
||||
@ -304,7 +305,7 @@ impl Device {
|
||||
// to save it alongside the instance. (`vkEnumerateDeviceLayerProperties` should get
|
||||
// the right list post-1.0.13, but not pre-1.0.13, so we can't use it here.)
|
||||
let layers_ptrs = instance
|
||||
.loaded_layers()
|
||||
.enabled_layers()
|
||||
.map(|layer| layer.as_ptr())
|
||||
.collect::<SmallVec<[_; 16]>>();
|
||||
|
||||
@ -315,7 +316,7 @@ impl Device {
|
||||
.collect::<SmallVec<[_; 16]>>();
|
||||
|
||||
let has_khr_get_physical_device_properties2 = instance
|
||||
.loaded_extensions()
|
||||
.enabled_extensions()
|
||||
.khr_get_physical_device_properties2;
|
||||
|
||||
let infos = ash::vk::DeviceCreateInfo {
|
||||
@ -465,7 +466,7 @@ impl Device {
|
||||
|
||||
/// Returns the extensions that have been enabled on the device.
|
||||
#[inline]
|
||||
pub fn loaded_extensions(&self) -> &DeviceExtensions {
|
||||
pub fn enabled_extensions(&self) -> &DeviceExtensions {
|
||||
&self.extensions
|
||||
}
|
||||
|
||||
@ -937,11 +938,11 @@ unsafe impl SynchronizedVulkanObject for Queue {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::device::physical::PhysicalDevice;
|
||||
use crate::device::Device;
|
||||
use crate::device::DeviceCreationError;
|
||||
use crate::device::DeviceExtensions;
|
||||
use crate::device::{FeatureRestriction, FeatureRestrictionError, Features};
|
||||
use crate::instance;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[test]
|
||||
@ -953,7 +954,7 @@ mod tests {
|
||||
#[test]
|
||||
fn too_many_queues() {
|
||||
let instance = instance!();
|
||||
let physical = match instance::PhysicalDevice::enumerate(&instance).next() {
|
||||
let physical = match PhysicalDevice::enumerate(&instance).next() {
|
||||
Some(p) => p,
|
||||
None => return,
|
||||
};
|
||||
@ -975,7 +976,7 @@ mod tests {
|
||||
#[test]
|
||||
fn unsupposed_features() {
|
||||
let instance = instance!();
|
||||
let physical = match instance::PhysicalDevice::enumerate(&instance).next() {
|
||||
let physical = match PhysicalDevice::enumerate(&instance).next() {
|
||||
Some(p) => p,
|
||||
None => return,
|
||||
};
|
||||
@ -1005,7 +1006,7 @@ mod tests {
|
||||
#[test]
|
||||
fn priority_out_of_range() {
|
||||
let instance = instance!();
|
||||
let physical = match instance::PhysicalDevice::enumerate(&instance).next() {
|
||||
let physical = match PhysicalDevice::enumerate(&instance).next() {
|
||||
Some(p) => p,
|
||||
None => return,
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,9 @@
|
||||
use crate::descriptor::descriptor::ShaderStages;
|
||||
use crate::image::{SampleCount, SampleCounts};
|
||||
use crate::instance::{
|
||||
use crate::device::physical::{
|
||||
ConformanceVersion, DriverId, PhysicalDeviceType, PointClippingBehavior, ShaderCoreProperties,
|
||||
ShaderFloatControlsIndependence, SubgroupFeatures,
|
||||
};
|
||||
use crate::image::{SampleCount, SampleCounts};
|
||||
use crate::render_pass::ResolveModes;
|
||||
use crate::Version;
|
||||
use std::convert::TryInto;
|
||||
|
@ -92,8 +92,8 @@
|
||||
//! // TODO: storage formats
|
||||
//!
|
||||
|
||||
use crate::device::physical::PhysicalDevice;
|
||||
use crate::image::ImageAspects;
|
||||
use crate::instance::PhysicalDevice;
|
||||
use crate::VulkanObject;
|
||||
use half::f16;
|
||||
use std::convert::TryFrom;
|
||||
|
@ -16,6 +16,7 @@ use crate::command_buffer::CommandBufferExecFuture;
|
||||
use crate::command_buffer::CommandBufferUsage;
|
||||
use crate::command_buffer::PrimaryAutoCommandBuffer;
|
||||
use crate::command_buffer::PrimaryCommandBuffer;
|
||||
use crate::device::physical::QueueFamily;
|
||||
use crate::device::Device;
|
||||
use crate::device::Queue;
|
||||
use crate::format::Format;
|
||||
@ -32,7 +33,6 @@ use crate::image::ImageLayout;
|
||||
use crate::image::ImageUsage;
|
||||
use crate::image::MipmapsCount;
|
||||
use crate::image::SampleCount;
|
||||
use crate::instance::QueueFamily;
|
||||
use crate::memory::pool::AllocFromRequirementsFilter;
|
||||
use crate::memory::pool::AllocLayout;
|
||||
use crate::memory::pool::MappingRequirement;
|
||||
|
@ -8,6 +8,7 @@
|
||||
// according to those terms.
|
||||
|
||||
use crate::buffer::BufferAccess;
|
||||
use crate::device::physical::QueueFamily;
|
||||
use crate::device::Device;
|
||||
use crate::format::ClearValue;
|
||||
use crate::format::Format;
|
||||
@ -24,7 +25,6 @@ use crate::image::ImageInner;
|
||||
use crate::image::ImageLayout;
|
||||
use crate::image::ImageUsage;
|
||||
use crate::image::SampleCount;
|
||||
use crate::instance::QueueFamily;
|
||||
use crate::memory::pool::AllocFromRequirementsFilter;
|
||||
use crate::memory::pool::AllocLayout;
|
||||
use crate::memory::pool::MappingRequirement;
|
||||
|
@ -177,7 +177,7 @@ impl UnsafeImage {
|
||||
{
|
||||
return Err(ImageCreationError::UnsupportedUsage);
|
||||
}
|
||||
if device.api_version() >= Version::V1_1 || device.loaded_extensions().khr_maintenance1
|
||||
if device.api_version() >= Version::V1_1 || device.enabled_extensions().khr_maintenance1
|
||||
{
|
||||
if usage.transfer_source && !features.transfer_src {
|
||||
return Err(ImageCreationError::UnsupportedUsage);
|
||||
@ -588,7 +588,7 @@ impl UnsafeImage {
|
||||
};
|
||||
|
||||
let mem_reqs = if device.api_version() >= Version::V1_1
|
||||
|| device.loaded_extensions().khr_get_memory_requirements2
|
||||
|| device.enabled_extensions().khr_get_memory_requirements2
|
||||
{
|
||||
let infos = ash::vk::ImageMemoryRequirementsInfo2 {
|
||||
image,
|
||||
@ -596,7 +596,7 @@ impl UnsafeImage {
|
||||
};
|
||||
|
||||
let mut output2 = if device.api_version() >= Version::V1_1
|
||||
|| device.loaded_extensions().khr_dedicated_allocation
|
||||
|| device.enabled_extensions().khr_dedicated_allocation
|
||||
{
|
||||
Some(ash::vk::MemoryDedicatedRequirements::default())
|
||||
} else {
|
||||
|
@ -74,7 +74,7 @@ impl DebugCallback {
|
||||
where
|
||||
F: Fn(&Message) + 'static + Send + panic::RefUnwindSafe,
|
||||
{
|
||||
if !instance.loaded_extensions().ext_debug_utils {
|
||||
if !instance.enabled_extensions().ext_debug_utils {
|
||||
return Err(DebugCallbackCreationError::MissingExtension);
|
||||
}
|
||||
|
||||
|
@ -8,13 +8,13 @@
|
||||
// according to those terms.
|
||||
|
||||
use crate::check_errors;
|
||||
use crate::device::physical::{init_physical_devices, PhysicalDeviceInfo};
|
||||
use crate::extensions::ExtensionRestrictionError;
|
||||
use crate::fns::InstanceFunctions;
|
||||
use crate::instance::loader;
|
||||
use crate::instance::loader::FunctionPointers;
|
||||
use crate::instance::loader::Loader;
|
||||
use crate::instance::loader::LoadingError;
|
||||
use crate::instance::physical_device::{init_physical_devices, PhysicalDeviceInfos};
|
||||
use crate::instance::InstanceExtensions;
|
||||
use crate::Error;
|
||||
use crate::OomError;
|
||||
@ -180,7 +180,7 @@ pub struct Instance {
|
||||
// The highest allowed API version for instances and devices created from it.
|
||||
max_api_version: Version,
|
||||
|
||||
pub(super) physical_devices: Vec<PhysicalDeviceInfos>,
|
||||
pub(crate) physical_device_infos: Vec<PhysicalDeviceInfo>,
|
||||
fns: InstanceFunctions,
|
||||
extensions: InstanceExtensions,
|
||||
layers: SmallVec<[CString; 16]>,
|
||||
@ -387,7 +387,7 @@ impl Instance {
|
||||
api_version,
|
||||
max_api_version,
|
||||
//alloc: None,
|
||||
physical_devices: Vec::new(),
|
||||
physical_device_infos: Vec::new(),
|
||||
fns,
|
||||
extensions: extensions.clone(),
|
||||
layers,
|
||||
@ -395,7 +395,7 @@ impl Instance {
|
||||
};
|
||||
|
||||
// Enumerating all physical devices.
|
||||
instance.physical_devices = init_physical_devices(&instance)?;
|
||||
instance.physical_device_infos = init_physical_devices(&instance)?;
|
||||
|
||||
Ok(Arc::new(instance))
|
||||
}
|
||||
@ -431,29 +431,15 @@ impl Instance {
|
||||
}
|
||||
|
||||
/// Returns the extensions that have been enabled on the instance.
|
||||
///
|
||||
/// This list is equal to what was passed to `Instance::new()`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```no_run
|
||||
/// use vulkano::instance::Instance;
|
||||
/// use vulkano::instance::InstanceExtensions;
|
||||
/// use vulkano::Version;
|
||||
///
|
||||
/// let extensions = InstanceExtensions::supported_by_core().unwrap();
|
||||
/// let instance = Instance::new(None, Version::V1_1, &extensions, None).unwrap();
|
||||
/// assert_eq!(instance.loaded_extensions(), &extensions);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn loaded_extensions(&self) -> &InstanceExtensions {
|
||||
pub fn enabled_extensions(&self) -> &InstanceExtensions {
|
||||
&self.extensions
|
||||
}
|
||||
|
||||
/// Returns the layers that have been enabled on the instance.
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
pub fn loaded_layers(&self) -> slice::Iter<CString> {
|
||||
pub fn enabled_layers(&self) -> slice::Iter<CString> {
|
||||
self.layers.iter()
|
||||
}
|
||||
}
|
||||
@ -680,7 +666,7 @@ impl From<Error> for InstanceCreationError {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::instance;
|
||||
use crate::device::physical::PhysicalDevice;
|
||||
|
||||
#[test]
|
||||
fn create_instance() {
|
||||
@ -691,7 +677,7 @@ mod tests {
|
||||
fn queue_family_by_id() {
|
||||
let instance = instance!();
|
||||
|
||||
let phys = match instance::PhysicalDevice::enumerate(&instance).next() {
|
||||
let phys = match PhysicalDevice::enumerate(&instance).next() {
|
||||
Some(p) => p,
|
||||
None => return,
|
||||
};
|
||||
|
@ -31,7 +31,7 @@
|
||||
//! # use vulkano::instance::Instance;
|
||||
//! # use vulkano::instance::InstanceExtensions;
|
||||
//! # use vulkano::Version;
|
||||
//! use vulkano::instance::PhysicalDevice;
|
||||
//! use vulkano::device::physical::PhysicalDevice;
|
||||
//!
|
||||
//! # let instance = Instance::new(None, Version::V1_1, &InstanceExtensions::none(), None).unwrap();
|
||||
//! for physical_device in PhysicalDevice::enumerate(&instance) {
|
||||
@ -60,21 +60,6 @@ pub use self::layers::LayerProperties;
|
||||
pub use self::layers::LayersIterator;
|
||||
pub use self::layers::LayersListError;
|
||||
pub use self::loader::LoadingError;
|
||||
pub use self::physical_device::ConformanceVersion;
|
||||
pub use self::physical_device::DriverId;
|
||||
pub use self::physical_device::MemoryHeap;
|
||||
pub use self::physical_device::MemoryHeapsIter;
|
||||
pub use self::physical_device::MemoryType;
|
||||
pub use self::physical_device::MemoryTypesIter;
|
||||
pub use self::physical_device::PhysicalDevice;
|
||||
pub use self::physical_device::PhysicalDeviceType;
|
||||
pub use self::physical_device::PhysicalDevicesIter;
|
||||
pub use self::physical_device::PointClippingBehavior;
|
||||
pub use self::physical_device::QueueFamiliesIter;
|
||||
pub use self::physical_device::QueueFamily;
|
||||
pub use self::physical_device::ShaderCoreProperties;
|
||||
pub use self::physical_device::ShaderFloatControlsIndependence;
|
||||
pub use self::physical_device::SubgroupFeatures;
|
||||
pub use crate::extensions::{
|
||||
ExtensionRestriction, ExtensionRestrictionError, SupportedExtensionsError,
|
||||
};
|
||||
@ -85,4 +70,3 @@ pub(crate) mod extensions;
|
||||
mod instance;
|
||||
mod layers;
|
||||
pub mod loader;
|
||||
mod physical_device;
|
||||
|
@ -8,9 +8,9 @@
|
||||
// according to those terms.
|
||||
|
||||
use crate::check_errors;
|
||||
use crate::device::physical::MemoryType;
|
||||
use crate::device::Device;
|
||||
use crate::device::DeviceOwned;
|
||||
use crate::instance::MemoryType;
|
||||
use crate::memory::Content;
|
||||
use crate::memory::DedicatedAlloc;
|
||||
use crate::memory::ExternalMemoryHandleType;
|
||||
@ -269,7 +269,7 @@ impl<'a> DeviceMemoryBuilder<'a> {
|
||||
|
||||
let mut export_handle_bits = ash::vk::ExternalMemoryHandleTypeFlags::empty();
|
||||
if self.dedicated_info.is_some() {
|
||||
if !self.device.loaded_extensions().khr_dedicated_allocation {
|
||||
if !self.device.enabled_extensions().khr_dedicated_allocation {
|
||||
return Err(DeviceMemoryAllocError::MissingExtension(
|
||||
"khr_dedicated_allocation",
|
||||
));
|
||||
@ -291,7 +291,7 @@ impl<'a> DeviceMemoryBuilder<'a> {
|
||||
if !(export_handle_bits & ash::vk::ExternalMemoryHandleTypeFlags::DMA_BUF_EXT)
|
||||
.is_empty()
|
||||
{
|
||||
if !self.device.loaded_extensions().ext_external_memory_dma_buf {
|
||||
if !self.device.enabled_extensions().ext_external_memory_dma_buf {
|
||||
return Err(DeviceMemoryAllocError::MissingExtension(
|
||||
"ext_external_memory_dmabuf",
|
||||
));
|
||||
@ -300,7 +300,7 @@ impl<'a> DeviceMemoryBuilder<'a> {
|
||||
|
||||
if !(export_handle_bits & ash::vk::ExternalMemoryHandleTypeFlags::OPAQUE_FD).is_empty()
|
||||
{
|
||||
if !self.device.loaded_extensions().khr_external_memory_fd {
|
||||
if !self.device.enabled_extensions().khr_external_memory_fd {
|
||||
return Err(DeviceMemoryAllocError::MissingExtension(
|
||||
"khr_external_memory_fd",
|
||||
));
|
||||
@ -310,7 +310,7 @@ impl<'a> DeviceMemoryBuilder<'a> {
|
||||
if !(import_handle_bits & ash::vk::ExternalMemoryHandleTypeFlags::DMA_BUF_EXT)
|
||||
.is_empty()
|
||||
{
|
||||
if !self.device.loaded_extensions().ext_external_memory_dma_buf {
|
||||
if !self.device.enabled_extensions().ext_external_memory_dma_buf {
|
||||
return Err(DeviceMemoryAllocError::MissingExtension(
|
||||
"ext_external_memory_dmabuf",
|
||||
));
|
||||
@ -319,7 +319,7 @@ impl<'a> DeviceMemoryBuilder<'a> {
|
||||
|
||||
if !(import_handle_bits & ash::vk::ExternalMemoryHandleTypeFlags::OPAQUE_FD).is_empty()
|
||||
{
|
||||
if !self.device.loaded_extensions().khr_external_memory_fd {
|
||||
if !self.device.enabled_extensions().khr_external_memory_fd {
|
||||
return Err(DeviceMemoryAllocError::MissingExtension(
|
||||
"khr_external_memory_fd",
|
||||
));
|
||||
|
@ -20,7 +20,7 @@
|
||||
//!
|
||||
//! ```
|
||||
//! // Enumerating memory heaps.
|
||||
//! # let physical_device: vulkano::instance::PhysicalDevice = return;
|
||||
//! # let physical_device: vulkano::device::physical::PhysicalDevice = return;
|
||||
//! for heap in physical_device.memory_heaps() {
|
||||
//! println!("Heap #{:?} has a capacity of {:?} bytes", heap.id(), heap.size());
|
||||
//! }
|
||||
@ -37,7 +37,7 @@
|
||||
//!
|
||||
//! ```
|
||||
//! // Enumerating memory types.
|
||||
//! # let physical_device: vulkano::instance::PhysicalDevice = return;
|
||||
//! # let physical_device: vulkano::device::physical::PhysicalDevice = return;
|
||||
//! for ty in physical_device.memory_types() {
|
||||
//! println!("Memory type belongs to heap #{:?}", ty.heap().id());
|
||||
//! println!("Host-accessible: {:?}", ty.is_host_visible());
|
||||
|
@ -12,9 +12,9 @@ use std::ops::Range;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use crate::device::physical::MemoryType;
|
||||
use crate::device::Device;
|
||||
use crate::instance::Instance;
|
||||
use crate::instance::MemoryType;
|
||||
use crate::memory::DeviceMemory;
|
||||
use crate::memory::DeviceMemoryAllocError;
|
||||
use crate::memory::MappedDeviceMemory;
|
||||
|
@ -7,8 +7,8 @@
|
||||
// notice may not be copied, modified, or distributed except
|
||||
// according to those terms.
|
||||
|
||||
use crate::device::physical::MemoryType;
|
||||
use crate::device::{Device, DeviceOwned};
|
||||
use crate::instance::MemoryType;
|
||||
use crate::memory::DedicatedAlloc;
|
||||
use crate::memory::DeviceMemory;
|
||||
use crate::memory::DeviceMemoryAllocError;
|
||||
@ -153,7 +153,7 @@ pub unsafe trait MemoryPool: DeviceOwned {
|
||||
|
||||
// Redirect to `self.alloc_generic` if we don't perform a dedicated allocation.
|
||||
if !requirements.prefer_dedicated
|
||||
|| !self.device().loaded_extensions().khr_dedicated_allocation
|
||||
|| !self.device().enabled_extensions().khr_dedicated_allocation
|
||||
{
|
||||
let alloc = self.alloc_generic(
|
||||
mem_ty,
|
||||
@ -211,13 +211,13 @@ pub unsafe trait MemoryPool: DeviceOwned {
|
||||
where
|
||||
F: FnMut(MemoryType) -> AllocFromRequirementsFilter,
|
||||
{
|
||||
assert!(self.device().loaded_extensions().khr_external_memory_fd);
|
||||
assert!(self.device().loaded_extensions().khr_external_memory);
|
||||
assert!(self.device().enabled_extensions().khr_external_memory_fd);
|
||||
assert!(self.device().enabled_extensions().khr_external_memory);
|
||||
|
||||
let mem_ty = choose_allocation_memory_type(self.device(), requirements, filter, map);
|
||||
|
||||
if !requirements.prefer_dedicated
|
||||
|| !self.device().loaded_extensions().khr_dedicated_allocation
|
||||
|| !self.device().enabled_extensions().khr_dedicated_allocation
|
||||
{
|
||||
let alloc = self.alloc_generic_with_exportable_fd(
|
||||
mem_ty,
|
||||
|
@ -7,17 +7,16 @@
|
||||
// notice may not be copied, modified, or distributed except
|
||||
// according to those terms.
|
||||
|
||||
use crate::device::physical::MemoryType;
|
||||
use crate::device::Device;
|
||||
use crate::instance::Instance;
|
||||
use crate::memory::DeviceMemory;
|
||||
use crate::memory::DeviceMemoryAllocError;
|
||||
use std::cmp;
|
||||
use std::ops::Range;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use crate::device::Device;
|
||||
use crate::instance::Instance;
|
||||
use crate::instance::MemoryType;
|
||||
use crate::memory::DeviceMemory;
|
||||
use crate::memory::DeviceMemoryAllocError;
|
||||
|
||||
/// Memory pool that operates on a given memory type.
|
||||
#[derive(Debug)]
|
||||
pub struct StdNonHostVisibleMemoryTypePool {
|
||||
|
@ -14,9 +14,9 @@ use std::hash::BuildHasherDefault;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use crate::device::physical::MemoryType;
|
||||
use crate::device::Device;
|
||||
use crate::device::DeviceOwned;
|
||||
use crate::instance::MemoryType;
|
||||
use crate::memory::pool::AllocLayout;
|
||||
use crate::memory::pool::MappingRequirement;
|
||||
use crate::memory::pool::MemoryPool;
|
||||
|
@ -299,7 +299,7 @@ impl Sampler {
|
||||
.iter()
|
||||
.any(|&mode| mode == SamplerAddressMode::MirrorClampToEdge)
|
||||
{
|
||||
if !device.loaded_extensions().khr_sampler_mirror_clamp_to_edge {
|
||||
if !device.enabled_extensions().khr_sampler_mirror_clamp_to_edge {
|
||||
return Err(SamplerCreationError::SamplerMirrorClampToEdgeExtensionNotEnabled);
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,8 @@
|
||||
#![allow(unused_variables)] // TODO: this module isn't finished
|
||||
|
||||
use crate::check_errors;
|
||||
use crate::device::physical::PhysicalDevice;
|
||||
use crate::instance::Instance;
|
||||
use crate::instance::PhysicalDevice;
|
||||
use crate::swapchain::SupportedSurfaceTransforms;
|
||||
use crate::OomError;
|
||||
use crate::VulkanObject;
|
||||
@ -58,7 +58,7 @@ impl DisplayPlane {
|
||||
pub fn enumerate_raw(device: PhysicalDevice) -> Result<IntoIter<DisplayPlane>, OomError> {
|
||||
let fns = device.instance().fns();
|
||||
|
||||
assert!(device.instance().loaded_extensions().khr_display); // TODO: return error instead
|
||||
assert!(device.instance().enabled_extensions().khr_display); // TODO: return error instead
|
||||
|
||||
let num = unsafe {
|
||||
let mut num: u32 = 0;
|
||||
@ -182,7 +182,7 @@ impl Display {
|
||||
/// See the docs of enumerate().
|
||||
pub fn enumerate_raw(device: PhysicalDevice) -> Result<IntoIter<Display>, OomError> {
|
||||
let fns = device.instance().fns();
|
||||
assert!(device.instance().loaded_extensions().khr_display); // TODO: return error instead
|
||||
assert!(device.instance().enabled_extensions().khr_display); // TODO: return error instead
|
||||
|
||||
let num = unsafe {
|
||||
let mut num = 0;
|
||||
@ -353,7 +353,7 @@ pub struct DisplayMode {
|
||||
impl DisplayMode {
|
||||
/*pub fn new(display: &Display) -> Result<Arc<DisplayMode>, OomError> {
|
||||
let fns = instance.fns();
|
||||
assert!(device.instance().loaded_extensions().khr_display); // TODO: return error instead
|
||||
assert!(device.instance().enabled_extensions().khr_display); // TODO: return error instead
|
||||
|
||||
let parameters = ash::vk::DisplayModeParametersKHR {
|
||||
visibleRegion: ash::vk::Extent2D { width: , height: },
|
||||
|
@ -8,11 +8,11 @@
|
||||
// according to those terms.
|
||||
|
||||
use crate::check_errors;
|
||||
use crate::device::physical::PhysicalDevice;
|
||||
use crate::device::physical::QueueFamily;
|
||||
use crate::format::Format;
|
||||
use crate::image::ImageUsage;
|
||||
use crate::instance::Instance;
|
||||
use crate::instance::PhysicalDevice;
|
||||
use crate::instance::QueueFamily;
|
||||
use crate::swapchain::capabilities::SupportedSurfaceTransforms;
|
||||
use crate::swapchain::display::DisplayMode;
|
||||
use crate::swapchain::display::DisplayPlane;
|
||||
@ -76,7 +76,7 @@ impl<W> Surface<W> {
|
||||
.display()
|
||||
.physical_device()
|
||||
.instance()
|
||||
.loaded_extensions()
|
||||
.enabled_extensions()
|
||||
.khr_display
|
||||
{
|
||||
return Err(SurfaceCreationError::MissingExtension {
|
||||
@ -145,7 +145,7 @@ impl<W> Surface<W> {
|
||||
) -> Result<Arc<Surface<W>>, SurfaceCreationError> {
|
||||
let fns = instance.fns();
|
||||
|
||||
if !instance.loaded_extensions().khr_win32_surface {
|
||||
if !instance.enabled_extensions().khr_win32_surface {
|
||||
return Err(SurfaceCreationError::MissingExtension {
|
||||
name: "VK_KHR_win32_surface",
|
||||
});
|
||||
@ -193,7 +193,7 @@ impl<W> Surface<W> {
|
||||
) -> Result<Arc<Surface<W>>, SurfaceCreationError> {
|
||||
let fns = instance.fns();
|
||||
|
||||
if !instance.loaded_extensions().khr_xcb_surface {
|
||||
if !instance.enabled_extensions().khr_xcb_surface {
|
||||
return Err(SurfaceCreationError::MissingExtension {
|
||||
name: "VK_KHR_xcb_surface",
|
||||
});
|
||||
@ -241,7 +241,7 @@ impl<W> Surface<W> {
|
||||
) -> Result<Arc<Surface<W>>, SurfaceCreationError> {
|
||||
let fns = instance.fns();
|
||||
|
||||
if !instance.loaded_extensions().khr_xlib_surface {
|
||||
if !instance.enabled_extensions().khr_xlib_surface {
|
||||
return Err(SurfaceCreationError::MissingExtension {
|
||||
name: "VK_KHR_xlib_surface",
|
||||
});
|
||||
@ -289,7 +289,7 @@ impl<W> Surface<W> {
|
||||
) -> Result<Arc<Surface<W>>, SurfaceCreationError> {
|
||||
let fns = instance.fns();
|
||||
|
||||
if !instance.loaded_extensions().khr_wayland_surface {
|
||||
if !instance.enabled_extensions().khr_wayland_surface {
|
||||
return Err(SurfaceCreationError::MissingExtension {
|
||||
name: "VK_KHR_wayland_surface",
|
||||
});
|
||||
@ -334,7 +334,7 @@ impl<W> Surface<W> {
|
||||
) -> Result<Arc<Surface<W>>, SurfaceCreationError> {
|
||||
let fns = instance.fns();
|
||||
|
||||
if !instance.loaded_extensions().khr_android_surface {
|
||||
if !instance.enabled_extensions().khr_android_surface {
|
||||
return Err(SurfaceCreationError::MissingExtension {
|
||||
name: "VK_KHR_android_surface",
|
||||
});
|
||||
@ -379,7 +379,7 @@ impl<W> Surface<W> {
|
||||
) -> Result<Arc<Surface<W>>, SurfaceCreationError> {
|
||||
let fns = instance.fns();
|
||||
|
||||
if !instance.loaded_extensions().mvk_ios_surface {
|
||||
if !instance.enabled_extensions().mvk_ios_surface {
|
||||
return Err(SurfaceCreationError::MissingExtension {
|
||||
name: "VK_MVK_ios_surface",
|
||||
});
|
||||
@ -424,7 +424,7 @@ impl<W> Surface<W> {
|
||||
) -> Result<Arc<Surface<W>>, SurfaceCreationError> {
|
||||
let fns = instance.fns();
|
||||
|
||||
if !instance.loaded_extensions().mvk_macos_surface {
|
||||
if !instance.enabled_extensions().mvk_macos_surface {
|
||||
return Err(SurfaceCreationError::MissingExtension {
|
||||
name: "VK_MVK_macos_surface",
|
||||
});
|
||||
@ -468,7 +468,7 @@ impl<W> Surface<W> {
|
||||
) -> Result<Arc<Surface<W>>, SurfaceCreationError> {
|
||||
let fns = instance.fns();
|
||||
|
||||
if !instance.loaded_extensions().nn_vi_surface {
|
||||
if !instance.enabled_extensions().nn_vi_surface {
|
||||
return Err(SurfaceCreationError::MissingExtension {
|
||||
name: "VK_NN_vi_surface",
|
||||
});
|
||||
|
@ -678,7 +678,7 @@ impl<W> SwapchainBuilder<W> {
|
||||
}
|
||||
}
|
||||
|
||||
if !device.loaded_extensions().khr_swapchain {
|
||||
if !device.enabled_extensions().khr_swapchain {
|
||||
return Err(SwapchainCreationError::MissingExtensionKHRSwapchain);
|
||||
}
|
||||
|
||||
@ -687,14 +687,14 @@ impl<W> SwapchainBuilder<W> {
|
||||
// TODO: VK_EXT_FULL_SCREEN_EXCLUSIVE requires these extensions, so they should always
|
||||
// be enabled if it is. A separate check here is unnecessary; this should be checked at
|
||||
// device creation.
|
||||
if device.loaded_extensions().ext_full_screen_exclusive
|
||||
if device.enabled_extensions().ext_full_screen_exclusive
|
||||
&& surface
|
||||
.instance()
|
||||
.loaded_extensions()
|
||||
.enabled_extensions()
|
||||
.khr_get_physical_device_properties2
|
||||
&& surface
|
||||
.instance()
|
||||
.loaded_extensions()
|
||||
.enabled_extensions()
|
||||
.khr_get_surface_capabilities2
|
||||
{
|
||||
surface_full_screen_exclusive_info = Some(ash::vk::SurfaceFullScreenExclusiveInfoEXT {
|
||||
|
@ -94,7 +94,7 @@ where
|
||||
&& !self
|
||||
.device
|
||||
.instance()
|
||||
.loaded_extensions()
|
||||
.enabled_extensions()
|
||||
.khr_external_semaphore_capabilities
|
||||
{
|
||||
Err(SemaphoreError::MissingExtension(
|
||||
@ -166,8 +166,8 @@ where
|
||||
pub fn export_opaque_fd(&self) -> Result<File, SemaphoreError> {
|
||||
let fns = self.device.fns();
|
||||
|
||||
assert!(self.device.loaded_extensions().khr_external_semaphore);
|
||||
assert!(self.device.loaded_extensions().khr_external_semaphore_fd);
|
||||
assert!(self.device.enabled_extensions().khr_external_semaphore);
|
||||
assert!(self.device.enabled_extensions().khr_external_semaphore_fd);
|
||||
|
||||
let fd = unsafe {
|
||||
let info = ash::vk::SemaphoreGetFdInfoKHR {
|
||||
@ -280,9 +280,9 @@ impl From<OomError> for SemaphoreError {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use crate::device::physical::PhysicalDevice;
|
||||
use crate::device::{Device, DeviceExtensions};
|
||||
use crate::instance::{Instance, InstanceExtensions, PhysicalDevice};
|
||||
use crate::instance::{Instance, InstanceExtensions};
|
||||
use crate::VulkanObject;
|
||||
use crate::{sync::Semaphore, Version};
|
||||
|
||||
@ -345,7 +345,7 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let supported_ext = DeviceExtensions::supported_by_device(physical.clone());
|
||||
let supported_ext = physical.supported_extensions();
|
||||
if supported_ext.khr_external_semaphore && supported_ext.khr_external_semaphore_fd {
|
||||
let sem = Semaphore::alloc_with_exportable_fd(device.clone()).unwrap();
|
||||
let fd = sem.export_opaque_fd().unwrap();
|
||||
|
@ -30,14 +30,14 @@ macro_rules! instance {
|
||||
/// Creates a device and a queue for graphics operations.
|
||||
macro_rules! gfx_dev_and_queue {
|
||||
($($feature:ident),*) => ({
|
||||
use crate::instance;
|
||||
use crate::device::physical::PhysicalDevice;
|
||||
use crate::device::Device;
|
||||
use crate::device::DeviceExtensions;
|
||||
use crate::device::Features;
|
||||
|
||||
let instance = instance!();
|
||||
|
||||
let physical = match instance::PhysicalDevice::enumerate(&instance).next() {
|
||||
let physical = match PhysicalDevice::enumerate(&instance).next() {
|
||||
Some(p) => p,
|
||||
None => return
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user