pub trait VulkanObject:
Sized
+ Send
+ Sync
+ Clone
+ Debug {
type NativeVulkanObject;
// Required methods
fn id(&self) -> u64;
fn as_native_vulkan_object(&self) -> Self::NativeVulkanObject;
fn try_destroy(self) -> Result<(), TryDestroyError<Self>>;
}
Required Associated Types§
Required Methods§
Sourcefn id(&self) -> u64
fn id(&self) -> u64
Get the object id.
This function returns the same value as as_native_vulkan_object()
, but conveniently cast
to a u64
. This is useful for extensions like VK_EXT_debug_report
and
VK_EXT_debug_marker
, which use these to refer Vulkan objects.
Object ids (or more correctly, handles) come in two variants, dispatchable and
non-dispatchable. While dispatchable objects are actually pointers, and thus unique,
the same is not true for non-dispatchable objects. For instance, two Semaphore
s, created
independently of each other, might in fact have the same handle.
Additionally, handles of non-dispatchable objects are only ever meaningful, if their type
is known (whether it is i.e. a Semaphore
or some other type). This must be taken into
account, if handles are used to identify Vulkan objects.
Refer to the Vulkan specification (Object Model) for more information.
fn as_native_vulkan_object(&self) -> Self::NativeVulkanObject
fn try_destroy(self) -> Result<(), TryDestroyError<Self>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.