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>>), 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 where queues is empty.
  • Panics if create_info.queues contains an element where queues contains a value that is not between 0.0 and 1.0 inclusive.
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 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.

source

pub fn enabled_features(&self) -> &Features

Returns the features that have been enabled on the device.

source

pub fn allocation_count(&self) -> u32

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

source

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

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

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<(), 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.

Trait Implementations§

source§

impl Debug for Device

source§

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

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 PartialEq<Device> 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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.