Struct draw2d::graphics::vulkan::device::Device [−][src]
pub struct Device { pub physical_device: PhysicalDevice, pub logical_device: Device, pub graphics_queue: Queue, pub present_queue: Queue, // some fields omitted }
Expand description
This struct holds all device-specific resources, the physical device and logical device for interacting with it, and the associated queues.
Fields
physical_device: PhysicalDevice
logical_device: Device
graphics_queue: Queue
present_queue: Queue
Implementations
Create a new device based on this application’s required features and properties.
pub unsafe fn allocate_memory(
&self,
memory_requirements: MemoryRequirements,
property_flags: MemoryPropertyFlags
) -> Result<Allocation>
pub unsafe fn allocate_memory(
&self,
memory_requirements: MemoryRequirements,
property_flags: MemoryPropertyFlags
) -> Result<Allocation>
Allocate a a chunk of memory for use in a buffer or texture.
unsafe because
- the caller is responsible for eventually calling ‘free memory’ before the application quits
Free a memory allocation.
unsafe because
- the caller is responsible for ensuring that the memory is no longer in use by the gpu.
pub fn name_vulkan_object<Name, Handle>(
&self,
name: Name,
object_type: ObjectType,
handle: &Handle
) -> Result<()> where
Handle: Handle + Copy,
Name: Into<String>,
pub fn name_vulkan_object<Name, Handle>(
&self,
name: Name,
object_type: ObjectType,
handle: &Handle
) -> Result<()> where
Handle: Handle + Copy,
Name: Into<String>,
Give a debug name for a vulkan object owned by this device.
Whatever name is provided here will show up in the debug logs if there are any issues detected by the validation layers.
pub unsafe fn sync_graphics_commands<R, Action>(
&self,
action: Action
) -> Result<R> where
Action: FnMut(CommandBuffer) -> Result<R>,
pub unsafe fn sync_graphics_commands<R, Action>(
&self,
action: Action
) -> Result<R> where
Action: FnMut(CommandBuffer) -> Result<R>,
Synchronously submit commands for execution on the graphics queue.
This method is internally synchronized and can be called on multiple threads without any additional synchronization.
This method forces the device to wait idle after submitting commands, as such it is very slow (don’t do it in a loop every frame!).
Unsafe Because
- no internal synchronization is done, any resources used by graphcis commands must be synchronized by the caller
- note: the device idles after the submission, so no resources refereced inside this method should be in-use after the call.
pub unsafe fn submit_and_wait_idle(
&self,
queue: &Queue,
command_buffer: CommandBuffer
) -> Result<()>
pub unsafe fn submit_and_wait_idle(
&self,
queue: &Queue,
command_buffer: CommandBuffer
) -> Result<()>
Submit a command buffer to the specified queue, then wait for it to idle.
Create a new swapchain loader which will be owned by the caller.
Trait Implementations
unsafe fn create_sampler(
&self,
debug_name: impl Into<String>,
sampler_create_info: SamplerCreateInfo
) -> Result<Sampler>
unsafe fn create_sampler(
&self,
debug_name: impl Into<String>,
sampler_create_info: SamplerCreateInfo
) -> Result<Sampler>
Create a new sampler. Read more
Destroy a sampler. Read more
Auto Trait Implementations
impl RefUnwindSafe for Device
impl UnwindSafe for Device
Blanket Implementations
Mutably borrows from an owned value. Read more
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
Checks if self
is actually part of its subset T
(and can be converted to it).
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
The inclusion map: converts self
to the equivalent element of its superset.