Struct vulkano::device::Device

source ·
pub struct Device { /* private fields */ }
Expand description

Represents a Vulkan context.

Implementations§

source§

impl Device

source

pub fn new( physical_device: Arc<PhysicalDevice>, create_info: DeviceCreateInfo ) -> Result<(Arc<Device>, impl ExactSizeIterator<Item = Arc<Queue>>), Validated<VulkanError>>

Creates a new Device.

source

pub unsafe fn from_handle( physical_device: Arc<PhysicalDevice>, handle: Device, create_info: DeviceCreateInfo ) -> (Arc<Device>, impl ExactSizeIterator<Item = Arc<Queue>>)

Creates a new Device from a raw object handle.

Safety
  • handle must be a valid Vulkan object handle created from physical_device.
  • create_info must match the info used to create the object.
source

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.

source

pub fn fns(&self) -> &DeviceFunctions

Returns pointers to the raw Vulkan functions of the device.

source

pub fn physical_device(&self) -> &Arc<PhysicalDevice>

Returns the physical device that was used to create this device.

source

pub fn physical_devices(&self) -> &[Arc<PhysicalDevice>]

Returns the list of physical devices that was used to create this device. The index of each physical device in this list is its device index.

This always contains the physical device returned by physical_device.

source

pub fn instance(&self) -> &Arc<Instance>

Returns the instance used to create this device.

source

pub fn active_queue_family_indices(&self) -> &[u32]

Returns the queue family indices that this device uses.

source

pub fn enabled_extensions(&self) -> &DeviceExtensions

Returns the extensions that have been enabled on the device.

This includes both the extensions specified in DeviceCreateInfo::enabled_extensions, and any extensions that are required by those extensions.

source

pub fn enabled_features(&self) -> &Features

Returns the features that have been enabled on the device.

This includes both the features specified in DeviceCreateInfo::enabled_features, and any features that are required by the enabled extensions.

source

pub fn allocation_count(&self) -> u32

Returns the current number of active DeviceMemory allocations the device has.

source

pub fn acceleration_structure_build_sizes( &self, build_type: AccelerationStructureBuildType, build_info: &AccelerationStructureBuildGeometryInfo, max_primitive_counts: &[u32] ) -> Result<AccelerationStructureBuildSizesInfo, Box<ValidationError>>

For the given acceleration structure build info and primitive counts, returns the minimum size required to build the acceleration structure, and the minimum size of the scratch buffer used during the build operation.

source

pub fn acceleration_structure_is_compatible( &self, version_data: &[u8; 32] ) -> Result<bool, Box<ValidationError>>

Returns whether a serialized acceleration structure with the specified version data is compatible with this device.

source

pub fn descriptor_set_layout_support( &self, create_info: &DescriptorSetLayoutCreateInfo ) -> Result<Option<DescriptorSetLayoutSupport>, Box<ValidationError>>

Returns whether a descriptor set layout with the given create_info could be created on the device, and additional supported properties where relevant. Some is returned if the descriptor set layout is supported, None if it is not.

This is primarily useful for checking whether the device supports a descriptor set layout that goes beyond the max_per_set_descriptors limit. A layout that does not exceed that limit is guaranteed to be supported, otherwise this function can be called.

The device API version must be at least 1.1, or the khr_maintenance3 extension must be enabled on the device.

source

pub unsafe fn memory_fd_properties( &self, handle_type: ExternalMemoryHandleType, file: File ) -> Result<MemoryFdProperties, Validated<VulkanError>>

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.
source

pub fn set_debug_utils_object_name<T: VulkanObject + DeviceOwned>( &self, object: &T, object_name: Option<&str> ) -> Result<(), VulkanError>

Assigns a human-readable name to object for debugging purposes.

If object_name is None, a previously set object name is removed.

Panics
  • If object is not owned by this device.
source

pub unsafe fn wait_idle(&self) -> Result<(), VulkanError>

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.

Trait Implementations§

source§

impl Debug for Device

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError>

Formats the value using the given formatter. Read more
source§

impl Drop for Device

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Hash for Device

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl InstanceOwned for Device

source§

fn instance(&self) -> &Arc<Instance>

Returns the instance that owns self.
source§

impl PartialEq for Device

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl VulkanObject for Device

§

type Handle = Device

The type of the object.
source§

fn handle(&self) -> Self::Handle

Returns the raw Vulkan handle of the object.
source§

impl Eq for Device

Auto Trait Implementations§

§

impl !RefUnwindSafe for Device

§

impl Send for Device

§

impl Sync for Device

§

impl Unpin for Device

§

impl !UnwindSafe for Device

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.