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/macos"
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 |
|---|---|---|
bytes |
core/bytes |
macos.dodo |
hal |
std/gpu/hal |
macos.dodo |
handle |
std/window/handle |
macos.dodo |
mem |
core/mem |
macos.dodo |
metal |
std/gpu/metal |
macos.dodo |
objc |
std/gpu/metal/objc |
macos.dodo |
ptr |
core/ptr |
macos.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.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.limits
Function · Source
pub fn limits(&self) -> hal.Limits
Device.name
Function · Source
pub fn name(&self, out: &mut[u8]) -> usize
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 Metal (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
The upload command buffer is committed just before the encoder’s, without a signal of its own: the queue runs them in order, so the encoder’s signal covers both.
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
pub fn begin_render_pass(&self, encoder: &mut hal.Handle, pass: &hal.RenderPassInfo)
Device.end_render_pass
Function · Source
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
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
Textures start out zero, as buffers do: every level a blit from a zeroed buffer. Multisampled textures and depth textures, which blits cannot write, are cleared by a render pass when they are render targets; other depth textures can never be written, so nothing reads what they hold.
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
A CAMetalLayer on the window’s view: the one Window.metal_layer() attached, or a new one.
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
pub fn acquire(&self, surface: &mut hal.Handle, texture: &mut hal.Handle) -> u64!hal.Error
Device.present
Function · Source
pub fn present(&self, surface: &mut hal.Handle) -> u64!hal.Error
Device.destroy_surface
Function · Source
pub fn destroy_surface(&self, surface: &hal.Handle)