API referencestd/gpu

std/gpu/hal/opengl

Public declarations, types, methods, and source contracts for std/gpu/hal/opengl.

On this page

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/opengl"

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
ascii core/ascii opengl.dodo
bytes core/bytes opengl.dodo
context std/gpu/opengl opengl.dodo
gl std/gpu/opengl/gl opengl.dodo
hal std/gpu/hal opengl.dodo
handle std/window/handle opengl.dodo
mem core/mem opengl.dodo
ptr core/ptr opengl.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.tracks_resources

Function · Source

pub fn tracks_resources(&self) -> bool

Device.staged

Function · Source

pub fn staged(&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

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

Never given uploads: std/gpu stages nothing on OpenGL.

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

Bind the pass’s framebuffer, cached per set of attachments, set the pass’s initial viewport, scissor and blend constant, and clear the attachments that load by clearing.

pub fn begin_render_pass(&self, encoder: &mut hal.Handle, pass: &hal.RenderPassInfo)

Device.end_render_pass

Function · Source

Resolve multisampled attachments, drop the ones not stored, and hand the framebuffer back to the cache.

pub fn end_render_pass(&self, encoder: &mut hal.Handle)

Device.set_viewport

Function · Source

The viewport, scissor and blend constant are the pass’s: kept in its record and set at once only while OpenGL holds this pass’s state. Otherwise the pass’s next draw sets them.

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

create_texture clears textures already.

pub fn initialize_texture(&self, encoder: &mut hal.Handle, texture: &hal.Handle, descriptor: &hal.TextureDescriptor)

Device.barrier

Function · Source

Only shader writes to storage buffers and images need barriers.

pub fn barrier(&self, encoder: &mut hal.Handle, before: u32, after: u32)

Device.create_surface

Function · Source

Only the window the device was opened for has a surface.

pub fn create_surface(&self, native: &handle.NativeHandle) -> hal.Handle!hal.Error

Device.configure_surface

Function · Source

A texture to render into, and a framebuffer to copy it into the window with.

pub fn configure_surface(&self, surface: &mut hal.Handle, config: &mut hal.SurfaceConfig) -> void!hal.Error

Device.acquire

Function · Source

The surface has one image, reused every frame; first wait until fewer than SurfaceConfig.frames presented frames are unfinished.

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)

Search every guide, reference page, and API declaration.