pub struct Device { /* private fields */ }
Expand description
Represents a Vulkan context.
Implementations
sourceimpl Device
impl Device
sourcepub fn new(
physical_device: PhysicalDevice<'_>,
create_info: DeviceCreateInfo<'_>
) -> Result<(Arc<Device>, impl ExactSizeIterator<Item = Arc<Queue>>), DeviceCreationError>
pub fn new(
physical_device: PhysicalDevice<'_>,
create_info: DeviceCreateInfo<'_>
) -> Result<(Arc<Device>, impl ExactSizeIterator<Item = Arc<Queue>>), DeviceCreationError>
Creates a new Device
.
Panics
- Panics if
create_info.queues
is empty. - Panics if one of the queue families in
create_info.queues
doesn’t belong to the given physical device. - Panics if
create_info.queues
contains multiple elements for the same queue family. - Panics if
create_info.queues
contains an element wherequeues
is empty. - Panics if
create_info.queues
contains an element wherequeues
contains a value that is not between 0.0 and 1.0 inclusive.
sourcepub fn api_version(&self) -> Version
pub fn api_version(&self) -> Version
Returns the Vulkan version supported by the device.
This is the lower of the
physical device’s supported version
and the instance’s max_api_version
.
sourcepub fn fns(&self) -> &DeviceFunctions
pub fn fns(&self) -> &DeviceFunctions
Grants access to the Vulkan functions of the device.
sourcepub unsafe fn wait(&self) -> Result<(), OomError>
pub unsafe fn wait(&self) -> Result<(), OomError>
Waits until all work on this device has finished. You should never need to call this function, but it can be useful for debugging or benchmarking purposes.
Note: This is the Vulkan equivalent of OpenGL’s
glFinish
.
Safety
This function is not thread-safe. You must not submit anything to any of the queue of the device (either explicitly or implicitly, for example with a future’s destructor) while this function is waiting.
sourcepub fn physical_device(&self) -> PhysicalDevice<'_>
pub fn physical_device(&self) -> PhysicalDevice<'_>
Returns the physical device that was used to create this device.
sourcepub fn active_queue_families<'a>(
&'a self
) -> impl ExactSizeIterator<Item = QueueFamily<'a>>
pub fn active_queue_families<'a>(
&'a self
) -> impl ExactSizeIterator<Item = QueueFamily<'a>>
Returns an iterator to the list of queues families that this device uses.
Note: Will return
-> impl ExactSizeIterator<Item = QueueFamily>
in the future.
sourcepub fn enabled_extensions(&self) -> &DeviceExtensions
pub fn enabled_extensions(&self) -> &DeviceExtensions
Returns the extensions that have been enabled on the device.
sourcepub fn enabled_features(&self) -> &Features
pub fn enabled_features(&self) -> &Features
Returns the features that have been enabled on the device.
sourcepub fn standard_pool(me: &Arc<Self>) -> Arc<StdMemoryPool>
pub fn standard_pool(me: &Arc<Self>) -> Arc<StdMemoryPool>
Returns the standard memory pool used by default if you don’t provide any other pool.
sourcepub fn standard_descriptor_pool(me: &Arc<Self>) -> Arc<StdDescriptorPool>
pub fn standard_descriptor_pool(me: &Arc<Self>) -> Arc<StdDescriptorPool>
Returns the standard descriptor pool used by default if you don’t provide any other pool.
sourcepub fn standard_command_pool(
me: &Arc<Self>,
queue: QueueFamily<'_>
) -> Arc<StandardCommandPool>
pub fn standard_command_pool(
me: &Arc<Self>,
queue: QueueFamily<'_>
) -> Arc<StandardCommandPool>
Returns the standard command buffer pool used by default if you don’t provide any other pool.
Panic
- Panics if the device and the queue family don’t belong to the same physical device.
sourcepub unsafe fn memory_fd_properties(
&self,
handle_type: ExternalMemoryHandleType,
file: File
) -> Result<MemoryFdProperties, MemoryFdPropertiesError>
pub unsafe fn memory_fd_properties(
&self,
handle_type: ExternalMemoryHandleType,
file: File
) -> Result<MemoryFdProperties, MemoryFdPropertiesError>
Retrieves the properties of an external file descriptor when imported as a given external handle type.
An error will be returned if the
khr_external_memory_fd
extension was not
enabled on the device, or if handle_type
is ExternalMemoryHandleType::OpaqueFd
.
Safety
file
must be a handle to external memory that was created outside the Vulkan API.
sourcepub fn set_object_name<T: VulkanObject + DeviceOwned>(
&self,
object: &T,
name: &CStr
) -> Result<(), OomError>
pub fn set_object_name<T: VulkanObject + DeviceOwned>(
&self,
object: &T,
name: &CStr
) -> Result<(), OomError>
Assigns a human-readable name to object
for debugging purposes.
Panics
- If
object
is not owned by this device.
sourcepub unsafe fn set_object_name_raw(
&self,
ty: ObjectType,
object: u64,
name: &CStr
) -> Result<(), OomError>
pub unsafe fn set_object_name_raw(
&self,
ty: ObjectType,
object: u64,
name: &CStr
) -> Result<(), OomError>
Assigns a human-readable name to object
for debugging purposes.
Safety
object
must be a Vulkan handle owned by this device, and its type must be accurately described by ty
.
Trait Implementations
sourceimpl VulkanObject for Device
impl VulkanObject for Device
sourcefn internal_object(&self) -> Device
fn internal_object(&self) -> Device
Returns a reference to the object.
impl Eq for Device
impl Send for Device
impl Sync for Device
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more