Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/gpu/hal/vulkan"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
hal |
std/gpu/hal |
vulkan.dodo |
handle |
std/window/handle |
vulkan.dodo |
mem |
core/mem |
vulkan.dodo |
memory |
std/gpu/hal/vulkan/memory |
vulkan.dodo |
ptr |
core/ptr |
vulkan.dodo |
vk |
std/gpu/vulkan |
vulkan.dodo |
Device
Struct · Source
pub struct Device: hal.Backend {
// Private implementation fields omitted.
}
Device.open
Function · Source
pub fn open(debug: bool) -> Device!hal.Error
Device.open_for_window
Function · Source
pub fn open_for_window(native: &handle.NativeHandle, debug: bool) -> Device!hal.Error
Device.api
Function · Source
pub fn api(&self) -> hal.Api
Device.limits
Function · Source
pub fn limits(&self) -> hal.Limits
Device.name
Function · Source
pub fn name(&self, out: &mut[u8]) -> usize
Device.staged
Function · Source
pub fn staged(&self) -> bool
Device.tracks_resources
Function · Source
pub fn tracks_resources(&self) -> bool
Device.mapped
Function · Source
pub fn mapped(&self, buffer: &hal.Handle) -> usize
Device.invalidate
Function · Source
pub fn invalidate(&self, buffer: &hal.Handle, offset: u64, size: u64)
Device.create_buffer
Function · Source
pub fn create_buffer(&self, size: u64, usage: u32) -> hal.Handle!hal.Error
Device.write_buffer
Function · Source
std/gpu stages every transfer on Vulkan (staged() is true).
pub fn write_buffer(&self, buffer: &hal.Handle, offset: u64, data: &[u8]) -> void!hal.Error
Device.read_buffer
Function · Source
pub fn read_buffer(&self, buffer: &hal.Handle, offset: u64, out: &mut[u8]) -> void!hal.Error
Device.create_texture
Function · Source
pub fn create_texture(&self, descriptor: &hal.TextureDescriptor) -> hal.Handle!hal.Error
Device.write_texture
Function · Source
pub fn write_texture(&self, texture: &hal.Handle, descriptor: &hal.TextureDescriptor, region: &hal.Region, data: &[u8], bytes_per_row: u32) -> void!hal.Error
Device.read_texture
Function · Source
pub fn read_texture(&self, texture: &hal.Handle, descriptor: &hal.TextureDescriptor, region: &hal.Region, out: &mut[u8], bytes_per_row: u32) -> void!hal.Error
Device.create_sampler
Function · Source
pub fn create_sampler(&self, descriptor: &hal.SamplerDescriptor) -> hal.Handle!hal.Error
Device.create_compute_pipeline
Function · Source
pub fn create_compute_pipeline(&self, descriptor: &hal.ComputePipelineDescriptor) -> hal.Handle!hal.Error
Device.create_render_pipeline
Function · Source
pub fn create_render_pipeline(&self, descriptor: &hal.RenderPipelineDescriptor) -> hal.Handle!hal.Error
Device.destroy
Function · Source
pub fn destroy(&self, object: u32, handle: &hal.Handle)
Device.completed
Function · Source
pub fn completed(&self) -> u64
Device.wait
Function · Source
pub fn wait(&self, index: u64) -> void!hal.Error
Device.begin_encoder
Function · Source
pub fn begin_encoder(&self) -> hal.Handle!hal.Error
Device.submit
Function · Source
One submission: the upload encoder’s command buffer, when there is one, then the encoder’s.
pub fn submit(&self, uploads: &mut hal.Handle, encoder: &mut hal.Handle) -> u64!hal.Error
Device.begin_compute_pass
Function · Source
pub fn begin_compute_pass(&self, encoder: &mut hal.Handle)
Device.end_compute_pass
Function · Source
pub fn end_compute_pass(&self, encoder: &mut hal.Handle)
Device.begin_render_pass
Function · Source
A render pass’s commands go to a list until it ends; see the top.
pub fn begin_render_pass(&self, encoder: &mut hal.Handle, pass: &hal.RenderPassInfo)
Device.end_render_pass
Function · Source
Run the barrier the pass’s draws need, then the pass itself.
pub fn end_render_pass(&self, encoder: &mut hal.Handle)
Device.set_viewport
Function · Source
pub fn set_viewport(&self, encoder: &mut hal.Handle, x: f32, y: f32, width: f32, height: f32, min_depth: f32, max_depth: f32)
Device.set_scissor
Function · Source
pub fn set_scissor(&self, encoder: &mut hal.Handle, x: u32, y: u32, width: u32, height: u32)
Device.set_blend_constant
Function · Source
pub fn set_blend_constant(&self, encoder: &mut hal.Handle, red: f64, green: f64, blue: f64, alpha: f64)
Device.dispatch
Function · Source
pub fn dispatch(&self, encoder: &mut hal.Handle, state: &mut hal.PassState, x: u32, y: u32, z: u32)
Device.draw
Function · Source
pub fn draw(&self, encoder: &mut hal.Handle, state: &mut hal.PassState, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32)
Device.draw_indexed
Function · Source
pub fn draw_indexed(&self, encoder: &mut hal.Handle, state: &mut hal.PassState, index_count: u32, instance_count: u32, first_index: u32, base_vertex: i32, first_instance: u32)
Device.copy_buffer
Function · Source
pub fn copy_buffer(&self, encoder: &mut hal.Handle, source: &hal.Handle, source_offset: u64, destination: &hal.Handle, destination_offset: u64, size: u64)
Device.copy_buffer_to_texture
Function · Source
pub fn copy_buffer_to_texture(&self, encoder: &mut hal.Handle, source: &hal.Handle, offset: u64, bytes_per_row: u32, destination: &hal.Handle, descriptor: &hal.TextureDescriptor, region: &hal.Region)
Device.copy_texture_to_buffer
Function · Source
pub fn copy_texture_to_buffer(&self, encoder: &mut hal.Handle, source: &hal.Handle, descriptor: &hal.TextureDescriptor, region: &hal.Region, destination: &hal.Handle, offset: u64, bytes_per_row: u32)
Device.generate_mipmaps
Function · Source
Blit each level from the one before it, in the general layout.
pub fn generate_mipmaps(&self, encoder: &mut hal.Handle, texture: &hal.Handle, descriptor: &hal.TextureDescriptor)
Device.clear_buffer
Function · Source
pub fn clear_buffer(&self, encoder: &mut hal.Handle, buffer: &hal.Handle, offset: u64, size: u64)
Device.initialize_texture
Function · Source
Move a new image to the general layout and clear it.
pub fn initialize_texture(&self, encoder: &mut hal.Handle, texture: &hal.Handle, descriptor: &hal.TextureDescriptor)
Device.barrier
Function · Source
pub fn barrier(&self, encoder: &mut hal.Handle, before: u32, after: u32)
Device.create_surface
Function · Source
pub fn create_surface(&self, native: &handle.NativeHandle) -> hal.Handle!hal.Error
Device.configure_surface
Function · Source
pub fn configure_surface(&self, surface: &mut hal.Handle, config: &mut hal.SurfaceConfig) -> void!hal.Error
Device.acquire
Function · Source
Acquiring submits nothing: the image’s move into the general layout and the wait for it join the next submission, so this returns 0.
pub fn acquire(&self, surface: &mut hal.Handle, texture: &mut hal.Handle) -> u64!hal.Error
Device.present
Function · Source
One submission moves the image to the present layout, after everything before it (and the image’s own preparation, when nothing was submitted since acquire), and signals the image’s semaphore.
pub fn present(&self, surface: &mut hal.Handle) -> u64!hal.Error
Device.destroy_surface
Function · Source
pub fn destroy_surface(&self, surface: &hal.Handle)