Module Brr_webgpu.Gpu

WebGPU objects.

See the API documentation on MDN, on the W3C and WebGPU Samples.

Note. MDN's coverage of the API's objects is uneven, that's the reason why we link both on MDN and in the standard in the documentation strings.

Convention. Most (but not exactly all) API object names of the form GPUHeyHo are mapped on modules named Gpu.Hey.Ho or Gpu.Hey_ho.

module Origin_2d : sig ... end

2D origins.

module Origin_3d : sig ... end

3D origins.

module Extent_3d : sig ... end

3D extents.

module Compare_function : sig ... end

Compare functions.

module Buffer : sig ... end

GPU buffers.

module Texture : sig ... end

Textures.

module Image : sig ... end

Images.

module Sampler : sig ... end

Samplers.

Pipelines

Shaders

module Bind_group : sig ... end

Bind groups.

module Pipeline_layout : sig ... end

Pipeline layouts.

module Shader_module : sig ... end

Shader modules.

module Programmable_stage : sig ... end

Programmable stages.

Compute pipelines

module Compute_pipeline : sig ... end

Compute pipelines.

Render pipelines

module Index_format : sig ... end

Index buffer format.

module Primitive : sig ... end

Primitives.

module Vertex : sig ... end

Vertex states.

module Blend : sig ... end

Blend state.

module Color : sig ... end

Colors and color state.

module Stencil : sig ... end

Stencil state and operations.

module Depth_stencil_state : sig ... end

Depth stencil state.

module Multisample_state : sig ... end

Multisample states.

module Fragment_state : sig ... end

Fragment states.

module Render_pipeline : sig ... end

Render pipelines.

Issuing commands

Queries

module Query : sig ... end

Queries.

Passes

module Compute_pass : sig ... end

Compute passes.

module Render_bundle : sig ... end

Render bundles.

module Render_pass : sig ... end

Render passes.

Commands and queues

module Command : sig ... end

Command buffers and encoders.

module Queue : sig ... end

Queues.

Adapters and devices

module Supported_limits : sig ... end

Supported limits.

module Feature_name : sig ... end

Features names.

module Error : sig ... end

Errors.

module Pipeline_error : sig ... end

Pipeline errors.

module Device : sig ... end

Devices.

module Adapter : sig ... end

Adapters.

GPU object

type t

The type for GPU objects.

val of_navigator : Brr.Navigator.t -> t option

of_navigator n is the gpu object of n (if any).

val get_preferred_canvas_format : t -> Texture.Format.t

get_preferred_canvas_format g is the 8-bit depth optimal texture format.

val has_wgsl_language_feature : t -> Jstr.t -> bool

has_wgsl_language_features g n is true iff g has WGSL feature n.

Adapter request

module Power_preference : sig ... end

Power preference.

type opts

The type for adapter request options.

val opts : ?power_preference:Power_preference.t -> ?force_fallback_adapater:bool -> unit -> opts

opts are options for request_adapter.

val request_adapter : ?opts:opts -> t -> Adapter.t option Fut.or_error

request_adapter gpu requests an adapter from gpu.

Canvas context

module Canvas_context : sig ... end

GPU canvas contexts.